예제 #1
0
    def POST(self):
        try:
            authuser()
            x = web.input(myfile={})
            filedir = config.upload_path+str(web.session.Session.user_info['id']) # change this to the directory you want to store the file in.
            if 'myfile' in x: # to check if the file-object is created
                filepath=x.myfile.filename.replace('\\','/') # replaces the windows-style slashes with linux ones.
                filename=filepath.split('/')[-1] # splits the and chooses the last part (the filename with extension)
                filename=filename.split('.')[1]

                if filename.lower()=='jpg' or filename.lower()=='png' or filename.lower()=='gif' or filename.lower()=='pdf' or filename.lower()=='zip' or filename.lower()=='tar':
                    filename=up_nowtime()+"."+filename
                    fout = open(filedir +'/'+ filename,'wb') # creates the file where the uploaded file should be stored
                    fout.write(x.myfile.file.read()) # writes the uploaded file to the newly created file.
                    fout.close() # closes the file, upload complete.
                    filename="/"+filedir+"/"+filename
                    web.header("Content-Type","text/html; charset=utf-8;")
                    return "<html><head></head><body>up ok!<img style='width:150px; height:150px;' src='"+filename+"'/>"+filename+"</body></html>"



                else:
                    return "sorry,only put jpg,png,gif,zip,tar,pdf"

        except ValueError:
            return "文件太大了,上传的文件请小于1M,如果要传送大文件,请联系管理员"
예제 #2
0
    def GET(self):
        authuser()
        html='''
        <div id="divCenter" align="center" style="position: absolute; z-index: 3; display: none; background-color: #fff;" >

<iframe src="/admin/manager/person/userinfo/uptouxiang/" width="200px" height="150px" align="center" scrolling="NO" frameborder="0"  >
</iframe>
</div>
'''
        html+="<img width='180px' height='150px' src='"+web.session.Session.user_info['tx_path']+"'>"
        html+='''<a onclick="javascript:document.all.divCenter.style.display='block';"><font color='red'>更换头像</font></a><hr>'''
        html+="<form action='/admin/manager/person/userinfo/' method='POST'><table border='1' bordercolor='blue' cellspacing='0' border='1' id='atc_list_table' />"
        html+="<tr><td>用户名:</td><td><input type='text'  name='user' disabled='disabled' value='"+web.session.Session.user_info['user']+"'/></td></tr>"
        html+="<tr><td>昵称:</td><td><input type='text'  name='l_name'  value='"+web.session.Session.user_info['l_name']+"'/></td></tr>"
        html+="<tr><td>年龄:</td><td><input type='text'  name='age'  value='"+web.session.Session.user_info['age']+"'/></td></tr>"
        html+="<tr><td>性别:</td><td><input type='text'  name='sex'  value='"+web.session.Session.user_info['sex']+"'/></td></tr>"
        html+="<tr><td>爱好:</td><td><input type='text'  name='lovely'  value='"+web.session.Session.user_info['lovely']+"'/></td></tr>"
        html+="<tr><td>出生日期:</td><td><input type='text'  name='both_date'  value='"+web.session.Session.user_info['both_date']+"'/></td></tr>"
        html+="<tr><td>地址:</td><td><input type='text'  name='address'  value='"+web.session.Session.user_info['address']+"'/></td></tr>"
        html+="<tr><td>邮箱:</td><td><input type='text'  name='email'  value='"+web.session.Session.user_info['email']+"'/></td></tr>"

        html+="<tr><td colspan='2' align='center'><input type='submit' value='保存修改'></td></tr></table></form>"

        html+="<form action='/admin/manager/person/userinfo/pass/' method='GET'><input type='submit' value='修改密码' /></form>"

        return render.menu(html,context='')
예제 #3
0
 def GET(self,mid):
     authuser()
     link_one=url_link_select_one(mid).list()[0]
     html="<form action='/admin/manager/url_link/edit/' method='POST'/><h1>友情链接修改</h1>"
     html+="<p>标题:<input type='text' name='title' value='"+link_one['title']+"'></p><p>网址:<input type='text' name='site_url' value='"+link_one['site_url']+"'></p>"
     html+="<input type='text' style='display:none;' name='linkid' value='"+str(mid)+"'><input type='submit' value='保存'></form>"
     return render.menu('',context=html)
예제 #4
0
 def POST(self):
     authuser()
     if not web.input().new_class_name:
         html='添加失败,请稍后重试'
     else:
         class_add(web.session.Session.user,web.input().new_class_name)
         html=web.input().new_class_name+'---添加成功'
     return render.menu('',context=html)
예제 #5
0
 def POST(self,del_id=None):
     authuser()
     if not del_id:
         del_id='删除失败,请稍后重试'
     else:
         m_article_class_delete(web.session.Session.user,del_id)
         del_id='删除成功'
     return render.menu('',context=del_id)
예제 #6
0
    def POST(self):
        authuser()
        sql="update admin set l_name='"+web.input().l_name+"',age='"+web.input().age+"',sex='"+web.input().sex+"',lovely='"+web.input().lovely+"',both_date='"+web.input().both_date+"',address='"+web.input().address+"',email='"+web.input().email+"' where user='******';"
        config.dbw.query(sql)

        web.session.Session.user_info=user_persion_info(web.session.Session.user).list()[0]
        web.header("Content-Type","text/html; charset=utf-8;")
        return "<script type='text/javascript'>alert('修改成功!');history.go(-1);location.reload();</script>"
예제 #7
0
 def GET(self):
     authuser()
     html='''<form action='/admin/manager/person/userinfo/pass/' method='POST'><h1>密码修改</h1>
     新&nbsp;密&nbsp;码:<input type='password' name='pwd1'/></br>
     确认输入:<input type='password' name='pwd2'/></br>
     <input type='submit' value='修改'/></form>
     '''
     return render.menu(html,context='')
예제 #8
0
 def POST(self,xiu_id):
     authuser()
     if not xiu_id:
         xiu_id='修改失败,请稍后重试'
     else:
         sql="UPDATE article_class SET class_title='"+string_to_mysqlstr(web.input().atc_class_name)+"', v_id='"+web.input().atc_class_id+"' where class_id=  "+xiu_id+" and class_author='"+web.session.Session.user+"'"
         config.dbw.query(sql)
         html="修改成功"
     return render.menu('',context=html)
예제 #9
0
    def GET(self):
        authuser()
        html="<p>at&nbsp;"+web.session.Session.login_time+"&nbsp;"+web.session.Session.user+"&nbsp;login from:"+web.session.Session.client_ip+"<br>"
        if login_logs_last(web.session.Session.user).list():
            info=login_logs_last(web.session.Session.user).list()
            html+="last login at:"+info[0]['last_time']+"&nbsp;from:"+info[0]['login_ip']+"</p>"

        #return web.session.Session.user+web.session.Session.uuid+web.session.Session.client_ip
        return render.menu(html,context='')
예제 #10
0
 def POST(self):
     authuser()
     if not web.input().title:
         return "please input the title!"
     elif not web.input().site_url:
         return "please input the site url!"
     else:
         url_link_addone(web.input().title,web.input().site_url)
         web.redirect("/admin/manager/url_link/")
예제 #11
0
 def POST(self):
     authuser()
     if not web.input().push_mood:
         html='发表失败,心情不能为空'
     else:
         moods= web.input().push_mood
         add_moods(web.session.Session.user,moods)
         html='心情发表成功!'
     return render.menu('',context=html)
예제 #12
0
    def GET(self,xiu_id):
        authuser()
        if not xiu_id:
            xiu_id='修改失败,请稍后重试'
        else:
            sql="select * from article_class where class_id="+str(xiu_id)+" and class_author='"+web.session.Session.user+"'"
            c1=config.dbw.query(sql).list()
            html="<form action='/admin/manager/article/class/edit/"+str(c1[0]['class_id'])+"/' method='POST'/><tr><td><input type='text' name='atc_class_id' value='"+str(c1[0]['v_id'])+"'/></td><td><input type='text' name='atc_class_name' value='"+mysql_to_str(c1[0]['class_title'])+"'></td><input type='submit' value='保存修改'/></form></td></tr>"

        return render.menu('',context=html)
예제 #13
0
    def GET(self,gid=None):
        authuser()
        edit_res=m_article_edit(web.session.Session.user,gid).list()[0]
        wenzhang="<form action='/admin/manager/article/edit/"+str(edit_res['atc_ID'])+"/' method='POST'/>"
        wenzhang+="&nbsp标题:<input type='text' id='atc_title' name='atc_title' value='"+edit_res['atc_title']+"'/>"
        wenzhang+="<script type='text/javascript' src='/static/public/editor/nicEdit.js'></script><script type='text/javascript'>bkLib.onDomLoaded(function() { nicEditors.allTextAreas() }); </script>"

        wenzhang+="<textarea id='area_atc'  name='area_atc' values='"+edit_res['atc_contents']+"'>"
        wenzhang+=mysql_to_str(edit_res['atc_contents'])
        wenzhang+="</textarea><input type='submit' id='atc_tj' value='保存修改'/></form>"
        return render.menu('',context=wenzhang)
예제 #14
0
    def GET(self):
        authuser()
        newmes_data=message_old_sql().list()
        html="<form action='' id='mes_form' method='POST'>已读评论:"+str(len(newmes_data))+"<br><table border='1' cellspacing='0' border='1' id='atc_msg_table' >"
        for i in range(len(newmes_data)):
            html+="<tr><td>"+str(newmes_data[i]['date'])+"&nbsp;&nbsp;<strong>"+newmes_data[i]['mes_author']+"</strong>&nbsp;评论:《"+newmes_data[i]['atc_title']+"》-><strong>"+newmes_data[i]['mes_text']+"</strong></td>"
            html+="<td><a href='/article/show/"+str(newmes_data[i]['atc_id'])+"/?classid="+str(newmes_data[i]['class_id'])+"#"+newmes_data[i]['mes_author']+"' target='_blank'>查看</a></td>"
            html+="<td><input type='submit' value='删除' onclick='mes_del_old("+str(newmes_data[i]['id'])+")'"+"></td>"

        html+="</tr></table></form>"

        return render.menu('',context=html)
예제 #15
0
    def GET(self):
        authuser()
        web.header("Content-Type","text/html; charset=utf-8;")

        html="<h1 align='center'>欢迎你"+web.session.Session.user+"</h1>"
        html+='''
        男性标准三围</br>
胸 身高*0.48</br>
腰 身高*0.47</br>
臀 身高*0.51</br>
身高(cm)-110<p>您的标准身材是</br>
86.4 84.6  91.8 70kg<p>
最近的记录:'''
        sql="select * from health where user='******' order by date ;"
        sql_n="select count(*) c from health where user='******' order by date ;"
        n=config.dbw.query(sql_n)[0]['c']
        h_res=config.dbw.query(sql).list()
        html+="<table border='1' bordercolor='red'>"
        html+="<tr><td>胸围(cm)</td><td>腰围(cm)</td><td>臀围(cm)</td><td>体重(kg)</td><td>运动内容:</td><td>日期</td></tr>"
        for i in range(n):
            html+="<tr><td>"+h_res[i]['xiongwei']
            html+="</td><td>"+h_res[i]['yaowei']
            html+="</td><td>"+h_res[i]['tunwei']
            html+="</td><td>"+h_res[i]['tizhong']
            html+="</td><td>"+h_res[i]['sports_text']
            html+="</td><td>"+str(h_res[i]['date'])+"</td></tr>"

        html+="</table><h2>距离目标已经很近了!您只需要:</h2>"
        sql="select *  from health where user='******' order by date desc limit 1;"
        new_res=config.dbw.query(sql).list()[0]
        html+="胸围还差:"+str(float(new_res['xiongwei'])-180*0.48)+'cm</br>'
        html+="腰围还差:"+str(float(new_res['yaowei'])-180*0.47)+'cm</br>'
        html+="臀围还差:"+str(float(new_res['tunwei'])-180*0.51)+'cm</br>'
        html+="体重还差:"+str(float(new_res['tizhong'])-(180-110))+'kg</br>'



        html+='''
        <h2 align='center'>请提交您最新的记录</h2>
<form action='/others/mybody/' method='POST'/>
胸围:<input type='text' name='xiongwei'/><br/>
腰围:<input type='text' name='yaowei'/><br/>
臀围:<input type='text' name='tunwei'/><br/>
体重:<input type='text' name='tizhong'/><br/>
今天做了哪些运动?:<input type='text' name='sports_text'/><br/>
<input type='submit' value="提交入库了"/>
</form>
'''

        return html
예제 #16
0
    def GET(self):
        authuser()
        all_data=m_article_class(web.session.Session.user)
        n=all_data[0]
        class_res=all_data[1].list()
        html="<table id='atc_list_table' border='1' cellspacing='0' >"
        for i in range(n):
            html+="<tr><td width='5%'>"+str(class_res[i]['v_id'])+"</td><td width='85%'>"+mysql_to_str(class_res[i]['class_title'])+"</td>"
            html+="<td width='5%'><form action='/admin/manager/article/class/delete/"+str(class_res[i]['class_id'])+"/' method='POST'/><input type='submit'  onclick='delfirm()' value='删除'/></form></td>"
            html+="<td width='5%'><form action='/admin/manager/article/class/edit/"+str(class_res[i]['class_id'])+"/' method='GET'/><input type='submit' value='修改'/></form></td></tr>"

        html+="<tr ><td  id='addclass' colspan='4' align='center'><input type='button' value='添加新分类' onclick='add_newclass()'/></td></tr>"
        html+="</table>"
        return render.menu('',context=html)
예제 #17
0
    def GET(self):
        authuser()
        url_data=url_link_select().list()
        html="<form action='' id='link_form' method='POST'>友情链接<br><table border='1' cellspacing='0' border='1' id='atc_list_table' >"
        for i in range(len(url_data)):
            html+="<tr><td>"+str(i+1)+"</td><td>"+url_data[i]['title']+"</td><td>"+url_data[i]['site_url']+"</td>"
            html+="<td><input type='submit' onclick='link_del("+str(url_data[i]['id'])+")' value='删除'></td>"
            html+="<td><input type='submit' onclick='link_xiugai("+str(url_data[i]['id'])+")' value='修改'></td><tr>"

        html+="</table></form>"
        html+="<p><form action='/admin/manager/url_link/add/' method='POST'/></p>"
        html+="标题:<input type='text' name='title' value=''>&nbsp;&nbsp;网址:<input type='text' name='site_url' value=''>"
        html+="<input type='submit' value='添加'></form>"
        return render.menu('',context=html)
예제 #18
0
    def GET(self):
        authuser()

        sql='select * from dd_class;'
        sql2='select count(*) c from dd_class;'
        n=config.dbw.query(sql2).list()[0]['c']
        res=config.dbw.query(sql).list()
        ra="<form action='/admin/manager/link/' method='POST'/><select name='atc_type'>"
        for i in range(n):
            #ra+=str(res[i]['class_id'])+res[i]['class_title']+"<br>"
            ra+="<option value ="+str(res[i]['class_id'])+">"+res[i]['class_title']+"</option>"

        ra+="</select><input type='submit' value='qiji'/></form>"
        return render.menu('',context=ra)
예제 #19
0
    def POST(self):
        authuser()
        try:
            r = web.input(atcid=[])
            ids = r.get('atcid')
            id_list='('
            for i in range(len(ids)):
                id_list+=ids[i]+','

            id_list+=')'
            id_list=id_list.replace(",)",")")
            atc_delete(web.session.Session.user,id_list)
            web.redirect('/admin/manager/article/')
        except:
            web.redirect('/admin/manager/article/')
예제 #20
0
    def POST(self):
        authuser()
        web.header("Content-Type","text/html; charset=utf-8;")
        if not web.input().xiongwei:
            return '请输入胸围'
        if not web.input().yaowei:
            return '请输入腰围'
        if not web.input().tunwei:
            return '请输入臀围'
        if not web.input().tizhong:
            return '请输入体重'

        sql="insert into health (user,xiongwei,yaowei,tunwei,tizhong,sports_text,date) value('"+web.session.Session.user+"','"+web.input().xiongwei+"','"+web.input().yaowei+"','"+web.input().tunwei+"','"+web.input().tizhong+"','"+web.input().sports_text+"',now())"
        config.dbw.query(sql)
        web.redirect('/others/mybody/')
예제 #21
0
    def GET(self,pid=1):
        authuser()
        html=""
        html+="<form action='' id='mood_form' method='POST'><p>心情:</p><table cellspacing='0' border='1' id='atc_list_table' >"
        all_data=moods_page(pid,config.moods_nums,web.session.Session.user)
        page=all_data[0]
        all_moods=all_data[1].list()
        for i in range(len(all_data[1])):
            html+="<tr><td>"+all_moods[i]['mood_title']+"</td><td>"+str(all_moods[i]['push_date'])+"</td>"
            html+="<td><input type='submit' onclick='is_mood_del("+str(all_moods[i]['id'])+")' value='删除'></td></tr>"

        html+='</table></form><hr>Page:'

        for a in range(1,page+1):
            html+="<a href='/admin/manager/mood/"+str(a)+"/'/>"+str(a)+"</a>&nbsp;"

        return render.menu('',context=html)
예제 #22
0
 def GET(self):
     authuser()
     add_html='''
     <h1 align='center'>添加新主机</h1>
     <form action='/admin/manager/hostmonitor/add/' method='POST'>
     <table border='1'  cellspacing='0' id="atc_list_table">
     <tr><td>*主机ip:</td><td><input type='text'  name='hostip' id='hostip' onblur="ck_ip('hostip')" title='请输入主机ip'></td></tr>
     <tr><td>*监控方式:</td><td>
     <input type="radio" name="jktype" id='jktype1' value ="ping" checked  >ping<br>
     <input type="radio" name="jktype" id='jktype2' value ="port" onclick="checkbox_xiu_2('jktype2')">port<br>
     <input type="text" align="center" name="portnum" id='portnum' style="display:none;" onblur="check_num('portnum')" title='请输入要监控的端口'><br>
     </td></tr>
     <tr><td>主机名称(可选):</td><td><input type='text'  name='hostdes' title='请输入主机名称(描述可选项)'></td></tr>
     <tr><td colspan='2' align='center'><input type='submit' value='确认并添加'</td></tr>
     </table></form>
     '''
     return render.menu(add_html,context='',viewlist=manger_shouye_viewlist())
예제 #23
0
    def POST(self,id):
        authuser()
        edit_html=''
        if web.input().jktype and web.input().ip and id:
            if web.input().portnum and len(web.input().portnum)>1:
                t_type=web.input().portnum
            else:
                t_type='ping'
            if web.input().hostdes:
                hostinfo=web.input().hostdes
            else:
                 hostinfo=web.input().ip

            edit_html= m_host_edit_2(web.input().ip,t_type,hostinfo,int(id))


        else:
            edit_html='未知错误,请重试'
        return render.menu(edit_html,context='',viewlist=manger_shouye_viewlist())
예제 #24
0
    def GET(self,id):
        authuser()
        oneres=m_host_edit(id).list()
        edit_html='''
        <h1 align='center'>修改主机</h1>
        <form action='/admin/manager/hostmonitor/edit/%s/' method='POST' >''' % (oneres[0]['id'])
        edit_html+='''
        <table border='1'  cellspacing='0' id="atc_list_table">
        <tr><td>*主机ip:</td><td><input type='text'  name='ip' id='ip' readonly  value='%s'></td></tr>
        <tr><td>*监控方式:</td><td>
        <input type="radio" name="jktype"  id="jktype1" value ="ping" checked  >ping<br>
        <input type="radio" name="jktype"  id="jktype2" value ="port" onclick="checkbox_xiu_2('jktype2')">port<br>
        <input type="text" align="center" name="portnum" id='portnum' style="display:none;" onblur="check_num('portnum')" title='请输入要监控的端口'><br>
        </td></tr>
        <tr><td>主机名称(可选):</td><td><input type='text'  name='hostdes' title='请输入主机名称(描述可选项)' value='%s' ></td></tr>
        <tr><td colspan='2' align='center'><input type='submit' value='确认并修改'</td></tr>
        </table>
        </form>''' % (oneres[0]['ip'],oneres[0]['host_info'])

        return render.menu(edit_html,context='',viewlist=manger_shouye_viewlist())
예제 #25
0
    def POST(self):
        authuser()
        web.header("Content-Type","text/html; charset=utf-8;")
        try:
            if not web.input().pwd1 or not web.input().pwd2 or len(web.input().pwd1)<8 or len(web.input().pwd1)<8 or web.input().pwd1=='12345678' or web.input().pwd2=='12345678' :
                return "<script type='text/javascript'>alert('密码不能为空,不能小于8位');history.go(-1);location.reload();</script>"
            elif web.input().pwd1==web.input().pwd2:
                sql="update admin set passwd=md5('"+web.input().pwd1+"') where user='******';"
                config.dbw.query(sql)
                return "<script type='text/javascript'>alert('密码修改成功,现在请重新登录');window.location='/login/';</script>"

            else:
                return "<script type='text/javascript'>alert('两次输入的密码不一致');history.go(-1);location.reload();</script>"

        except:
            html='''<form action='/admin/manager/person/userinfo/pass/' method='POST'><h1>密码修改</h1>
            新&nbsp;密&nbsp;码:<input type='password' name='pwd1'/></br>
            确认输入:<input type='password' name='pwd2'/></br>
            <input type='submit' value='修改'/></form>
            '''
        return render.menu(html,context='')
예제 #26
0
    def POST(self):
        try:
            authuser()
            x = web.input(myfile={})
            filedir = config.upload_path+str(web.session.Session.user_info['id']) # change this to the directory you want to store the file in.
            if 'myfile' in x: # to check if the file-object is created
                filepath=x.myfile.filename.replace('\\','/') # replaces the windows-style slashes with linux ones.
                filename=filepath.split('/')[-1] # splits the and chooses the last part (the filename with extension)
                filename=filename.split('.')[1]

                if filename.lower()=='jpg' or filename.lower()=='png' or filename.lower()=='gif':
                    filename=up_nowtime()+"."+filename
                    fout = open(filedir +'/'+ filename,'wb') # creates the file where the uploaded file should be stored
                    fout.write(x.myfile.file.read()) # writes the uploaded file to the newly created file.
                    fout.close() # closes the file, upload complete.
                    filename="/"+filedir+"/"+filename

                    sql="update admin set tx_path='"+filename+"' where user='******'"
                    config.dbw.query(sql)
                    web.session.Session.user_info['tx_path']=filename
                    html='''
                    <script language="JavaScript">
                    alert('图像更新成功!');
          top.location.href='/admin/manager/person/userinfo/';
   </script>
   '''
                    return html
#                    web.redirect('/admin/manager/person/userinfo/')
#                    web.header("Content-Type","text/html; charset=utf-8;")
#                    return "<html><head></head><body>头像更新成功!<img style='width:150px; height:150px;' src='"+filename+"'/>"+filename+"</body></html>"



                else:
                    return "sorry,only put jpg,png,gif"

        except ValueError:
            return "文件太大了,上传的文件请小于1M,如果要传送大文件,请联系管理员"
예제 #27
0
    def GET(self,pid=1):
	authuser()
        all_data=atc_pages(pid,config.atc_nums,web.session.Session.user)
        page=all_data[0]
        all_atc=all_data[1].list()
        html="<form id='man_atc_form' action='' method='POST'>"
        html+='''<table  border='1'  cellspacing='0' id="atc_list_table" >
<tr  align='center'><td width='5%'>选择</td><td width='15%'>文章分类</td><td width='58%'>文章标题</td><td width='17%'>发表时间</td><td width='5%'>编辑</td></tr>
'''
        for i in range(len(all_data[1])):
            html+="<tr >"
            html+="<td><input type='checkbox' size='20px' name='atcid' value='"+str(all_atc[i]['atc_ID'])+"' id='atc_chk'>"
            html+="</td><td><label for='atc_chk'>"+mysql_to_str(all_atc[i]['class_title'])+"</label></td>"
            html+="<td><label for='atc_chk'>"+all_atc[i]['atc_title']+"</label></td>"
            html+="<td><label for='atc_chk'>"+str(all_atc[i]['push_date'])+"</label></td>"
            html+="<td><input type='submit' value='修改' onclick=atc_edit_js("+str(all_atc[i]['atc_ID'])+")></td>"
            html+="</tr>"
        html+="<tr><td colspan='4' align='center'><input type='submit' value='删除' onclick='del_atcchk_js()' /></td></tr>"
        html+="</table></form>"
        html+='Page:'
        for pi in range(1,page+1):
            html+="<a href='/admin/manager/article/"+str(pi)+"/'/>"+str(pi)+"</a>&nbsp;"
        return render.menu('',context=html)
예제 #28
0
    def GET(self):
        authuser()
        host_data=m_host_show().list()
        monitor_html='''<form action='#' id='hsform' method='GET'>
        <table border='1'  cellspacing='0' id='atc_list_table'>
        <tr class='tb_title'><td>ip</td><td>描述</td><td>主机状态</td><td>last_check</td><td>禁用</td><td>修改</td></tr>
        '''
        reddata=[]
        greendata=[]
        for i in range(len(host_data)):
            if host_data[i]['jk_color']=='red':
                reddata.append(host_data[i])
            else:
                greendata.append(host_data[i])


        alldata=reddata+greendata
        for i in range(len(alldata)):
            monitor_html+="<tr bgcolor='%s'><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><input type='submit' class='btnfont' value='禁用' onclick='host_disable(%s)'></td><td><input type='submit' class='btnfont' value='修改' onclick='host_edit(%s)' ></td></tr>" % (alldata[i]['jk_color'],alldata[i]['ip'],alldata[i]['host_info'],alldata[i]['jk_status'],alldata[i]['last_check'],alldata[i]['id'],alldata[i]['id'])


        monitor_html+="</table></form><p style='color:#f6f6f6'>统计:一共有%s台被监控主机,状态正常的%s台,状态不正常的%s台<br>*目前仅支持ping和端口两种检测方式</p>" % (len(host_data),len(greendata),len(reddata))
        return render.menu(monitor_html,context='',viewlist=manger_shouye_viewlist())
예제 #29
0
    def GET(self):
        authuser()
        class_data=m_article_class(web.session.Session.user)
        n=class_data[0]
        class_res=class_data[1].list()
        wenzhang='''
        <form action='/admin/manager/article/publish/' method='POST'/>
        &nbsp;标题:<input type="text" name="atc_title"/>分类:
        '''
        wenzhang+="<select name='atc_type'>"
        for i in range(class_data[0]):
            wenzhang+="<option value ="+str(class_res[i]['class_id'])+">"+mysql_to_str(class_res[i]['class_title'])+"</option>"

        wenzhang+="</select>"
        wenzhang+='''
        <script type="text/javascript" src="/static/public/editor/nicEdit.js"></script>
        <script type="text/javascript">
            bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
        </script>
        <textarea id="area_atc"  name="area_atc">
        </textarea>
        <input type='submit' id="atc_tj" value='发表'/></form>
        '''
        return render.menu('',context=wenzhang)
예제 #30
0
    def POST(self):
        authuser()
        add_html=''
        try:
            if web.input().jktype and web.input().hostip:
                hostip=web.input().hostip
                if 'ping' in web.input().jktype:
                    t_type='ping'
                elif 'port' in web.input().jktype and len(web.input().portnum)>1:
                    t_type=web.input().portnum
                else:
                    t_type='请输入被监控的端口号'

            else:
                add_html+='请输入被监控主机的ip'
            if web.input().hostdes:
                hostinfo=web.input().hostdes
            else:
                hostinfo=hostip
            #add_html+=hostip+type+hostinfo
            add_html= m_add_host(hostip,t_type,hostinfo)
        except:
            add_html='请输入被监控主机的ip'
        return render.menu(add_html,context='',viewlist=manger_shouye_viewlist())