Пример #1
0
def ft_channels_editFirst():    
    obj = deal_mysql()
    msg = ('''SELECT ulv.channel_id,tvs.chname 
    from ulv_genchannels as ulv
    inner join tvs_channel as tvs
    on tvs.chid=ulv.channel_id order by ulv.sort_id, ulv.channel_id;''')
    
    result = obj.askdata(msg)
    headers = ["频道名称"]
    print(yate.start_response())
    print(yate.include_header("频道维护"))       
    print(yate.start_form("ft_channels_edit.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))  
    print(yate.start_row())
    print(yate.select('which_chid'))
    #for array in result:        
    print(yate.select_option(result))
    print(yate.end_select())
    print(yate.end_row()) 
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())   
    obj.Close()
Пример #2
0
def channels():
    message = """select live_channel.chid,tvs_channel.chname,live_server.live_ip,live_url.live_path,live_status.sname """
    message += """from tvs_channel,live_channel,live_server,live_url,live_status where tvs_channel.chid=live_channel.chid and """
    message += """live_status.statusid=live_channel.statusid and live_url.live_urlid=live_channel.live_urlid and live_url.serverid = live_server.serverid """
    message += """and live_url.status=0 order by live_channel.chid """

    conn = my_sql.connect()
    cursor = conn.cursor()
    cursor.execute(message)
    result = cursor.fetchall()
    conn.close()
    
    headers = ["频道名称", "直播地址", "直播路径", "发布状态"]
    print(yate.start_response())
    print(yate.include_header("JSB living system"))
    print(yate.start_form("edit.py"))
    print(yate.start_table(tb_width="80%", tb_border="1px solid"))
    print(yate.tb_caption("已发布频道"))
    print(yate.tb_header(headers))

    for array in result:
        print(yate.tb_data(array[1:]))
    print(yate.end_table())
    print(yate.end_form())
    print(yate.include_footer({"Home": "/index.html"}))
Пример #3
0
def channels_offline(channel_offline=True):
    message = ("""SELECT ulv_genchannels.channel_id,
    tvs_channel.chname, 
    ulv_genaddress.gen_address, 
    ulv_status.des
    FROM ulv_genchannels
    NATURAL JOIN tvs_channel, ulv_genaddress, ulv_status
    WHERE ulv_genchannels.channel_id = tvs_channel.chid 
    AND tvs_channel.chid = ulv_genaddress.channel_id 
    AND ulv_status.status_id=1 order by ulv_genchannels.sort_id, ulv_genchannels.channel_id""")

    conn = my_sql.connect()
    cursor = conn.cursor()
    cursor.execute(message)
    result = cursor.fetchall()
    conn.close()
    
    headers = ["频道名称", "频道编号", "直播路径", "发布状态"]
    print(yate.start_response())
    if channel_offline:
        print(yate.include_header("频道下线"))
    else:
        print(yate.include_header("已发布频道"))
    print(yate.start_form("ft_channels_offline.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    
    for array in result:
        print(yate.do_table(array, channel_offline))

    print(yate.end_table())
    if channel_offline==True:
        print(yate.end_form("确定"))
Пример #4
0
def select_sp():    
    
    obj = deal_mysql("uspset.ini")
    msg =  '''select id,name from u_sp'''
    results = obj.askdata(msg)
    obj.Close()
    
    headers = ["运营商名称"]
    print(yate.start_response())
  
    print(yate.include_header("首页运营"))

    print(yate.start_form("op_guidepage_arrange.py"))    
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    for array in results:
        print(yate.start_row())
        print(yate.checked_radio_button('which_spid',[array[0],array[1]]))
        print(yate.end_row())
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())        
Пример #5
0
def ft_channels_edit_second():
    start_response()
    chid = get_formData('which_chid')
    obj = deal_mysql()
    msg = ("""SELECT ulv.channel_id,tvs.chname,ulv.gen_address 
    from ulv_genaddress as ulv inner join tvs_channel as tvs 
    on ulv.channel_id=tvs.chid and ulv.channel_id=%s""" % chid[0])
    result = obj.askdata(msg)
    info = result.pop(0)  
    headers = ["频道信息"]   
    print(yate.include_header("频道修改"))       
    print(yate.start_form("ft_channels_editDone.py"))
    print(yate.start_table(tb_width="100%", tb_border="1px solid"))
    print(yate.tb_header(headers))       
    print(yate.start_row())
    print(yate.checked_radio_button('which_chid',[info[0],info[1]]))
    print(yate.end_row()) 
    print(yate.start_row())
    print(yate.input_text("which_addr",info[2]))
    print(yate.end_row())     
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    obj.Close()  
Пример #6
0
def channels_operation(sp_id):  
    chidDic  = dict() #store the checked chid from sp_id
    obj = deal_mysql()
    
    msg = ('''SELECT ulv.channel_id,tvs.chname 
    from ulv_genchannels as ulv
    inner join tvs_channel as tvs
    on tvs.chid=ulv.channel_id order by ulv.sort_id, ulv.channel_id;''')
    
    msgn = ('''SELECT chid,sp_id from ulv_opchannels where sp_id=%d''' % int(sp_id))
    
    result = obj.askdata(msg)    
    checked = obj.askdata(msgn)
    for ele in checked:
        chidDic[ele[0]] = ele[1]
    nobj = deal_mysql('uspset.ini')
    msgs = '''select name from u_sp where id=%s''' % int(sp_id)
    response = nobj.askdata(msgs)
    
    headers = ["频道名称", "频道编号"]
    print(yate.start_response())
  
    print(yate.include_header("频道运营"))

    print(yate.start_form("op_channels_generate.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    theader = ['运营商']
    print(yate.tb_header(theader))
    print(yate.start_row())
    print('<input type="radio" checked="checked" name="which_sp" value="'+(sp_id)+'"/>"'+response[0][0]+'"')
    print(yate.end_row())
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))
    for array in result:
        if chidDic.get(array[0],None)==None:
            print(yate.do_operationtable(array))
        else:
            print(yate.checked_operationtable(array))
    print(yate.end_table())
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())    
    obj.Close()
    nobj.Close()
Пример #7
0
def channels_publish():
    cmdmsg = ("""SELECT tvs_channel.chid, tvs_channel.chname
    FROM tvs_channel
    NATURAL JOIN ulv_genaddress
    WHERE tvs_channel.`status` <> 1 AND tvs_channel.chid = ulv_genaddress.channel_id
    order by tvs_channel.chid""")
    
    conn = my_sql.connect()
    cur = conn.cursor()
    cur.execute(cmdmsg)
    result = cur.fetchall()
    
    msg = ("""select sort_id,sort_name from ulv_sort""")
    cur.execute(msg)
    sortinfo = cur.fetchall()
    conn.close()

    print(yate.start_response())
    print(yate.include_header("上线频道"))
    print("<p ><b>通过下面的复选框选择要上线的频道</b></p>")    
    print(yate.start_form("ft_channels_publish.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.start_row())
    print("<center>")   
    print(yate.select("channel_id"))
    print(yate.select_option(result))
    print(yate.end_select())  
    print('</center>')
    print(yate.end_row())
    
    print(yate.start_row())
    print("<center>")
    print(yate.select("sort_id"))
    print(yate.select_option(sortinfo))
    print(yate.end_select()) 
    print('</center>')
    print(yate.end_row())    
    
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
Пример #8
0
def channels_collect():
    start_response()    
    obj = deal_mysql()
    msg = ("""SELECT chid,chname from tvs_channel where status=0""")         
    result = obj.askdata(msg)
    #info = result.pop(0)  
    headers = ["频道信息"]   
    print(yate.include_header("新频道收录"))       
    print(yate.start_form("ft_channels_collectDone.py"))
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))       
    print(yate.start_row())   
    print(yate.select('which_chid'))               
    print(yate.select_option(result))
    print(yate.end_select())    
    print('<input type="text" name="which_addr" />')
    print(yate.end_row())      
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    obj.Close()  
Пример #9
0
def print_operationboundary():
    obj = deal_mysql('uspset.ini')
    msg = '''select id,name from u_sp;'''
    response = obj.askdata(msg)
    headers = ["运营商"]
    print(yate.start_response())
    print(yate.include_header("运营发布"))     
   
    print("<p ><b>点击下面的运营商名称可选择要发布的频道</b></p>")            
    print(yate.start_table(tb_width="50%", tb_border="1px solid"))
    print(yate.tb_header(headers))     
    print(yate.start_div('channel_div'))
    print(yate.start_form("op_channels_select.py"))
    for element in response:
        print('<tr><td>')        
        print(yate.radio_button("which_sp",element)) 
        print('</tr></td>')        
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())
    print(yate.end_table())
    print(yate.end_div())          
    obj.Close()
Пример #10
0
#! /usr/bin/env python

import athletemodel
import yate
import cgitb

#cgitb.enable()

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("NUAC's List of Athletes"))
print(yate.start_form('generate_timing_data.py'))
print(yate.para('Select an athlete from the list to work with: '))

for each_athlete in sorted(athletes):
    print(yate.radio_button_id('which_athlete', each_athlete[0], each_athlete[1]))
print(yate.end_form('Select'))

print(yate.include_footer({'Home': '/index.html'}))
Пример #11
0
#! /usr/local/bin/python3

import glob

import athletemodel
import yate

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print((yate.start_response()))
print((yate.include_header("Coach Kelly's List of Athletes")))
print((yate.start_form("generate_timing_data.py")))
print((yate.para("Select an athlete from the list to work with:")))
for each_athlete in athletes:
    print((yate.radio_button("which_athlete", athletes[each_athlete].name)))
print((yate.end_form("Select")))
print((yate.include_footer({"Home": "/index.html"})))
Пример #12
0
#! /usr/bin/env python
import cgitb; cgitb.enable()
import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print yate.start_response()
print yate.include_header("Coach Kelly's List of Athletes")
print yate.start_form("generate_timing_data.py")
print yate.para("Select an athlete from the list to work with:")
for each_athlete in athletes:
    print yate.radio_button("which_athlete", each_athlete)
print yate.end_form("Select")
print yate.include_footer({"Home": "../index.html"})
Пример #13
0
#! /usr/bin/python3
# -*- coding: utf-8 -*-
import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("老司机 Silence 的资源收藏"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("请选择你想要深入了解的角色:"))

for each_athlete in athletes:
	print(yate.radio_button("which_athlete",athletes[each_athlete].name))
print(yate.end_form("选择"))

print(yate.include_footer({"返回首页":"/index.html"}))
Пример #14
0
import athletemodel
import yate  # 模板
import time
import glob  # 可以操作系统查询一个文件名列表
import json
import requests
# 启用python的cgi跟踪技术
import cgitb
cgitb.enable()

print(yate.start_response())
print(yate.include_header("List of Athletes"))
print(yate.start_form("json_generate_timing_data.py"))
print(yate.para("Select an athlete from the list"))
url = "http://192.168.1.61:8089/cgi-bin/json_back_names.py"
namelist = json.loads(requests.get(url, timeout=4).text)
try:
    time.sleep(1)  # 单线程,需要等namelist的结果返回后,才能进行下一个web请求,但是还不能解决,头大???
    for each_athlete in namelist:
        print(yate.radio_button('which_athlete', each_athlete))
except Exception as err:
    print(err)
print(yate.end_form('Select'))
print(yate.include_footer({"Home": "/index.html"}))
Пример #15
0
#! /usr/local/bin/python3
#点击查看成绩的时候调用这个函数
import cgitb
cgitb.enable()

import athletemodel
import cgi
import yate

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())
print(yate.include_header("运动员的成绩"))
print(yate.start_form("generate_timing_data.py"))  #选择想要查询的运动员名字后,执行这个脚本
print(yate.para("选择你想要查询的运动员: "))

for each_athlete in athletes:
    print(
        yate.radio_button_id("which_athlete", each_athlete[0],
                             each_athlete[1]))
    #print(each_athlete[0],each_athlete[1])
print(yate.end_form("查询"))

print(yate.include_footer({"返回主页": "/index.html"}))
Пример #16
0
import glob

import athletemodel
import yate

files = glob.glob("data/*.txt")
plays = athletemodel.put_to_store(files)
print(yate.start_response())
print(
    yate.include_header(
        "Coack Kelly's List of Plays, attention: data comes from pickle"))
print(yate.start_form("generate_time_data.py"))
print(yate.para("Click here to select an play you want to see"))
for play in plays:
    print(yate.radio_button("which_player", plays[play].name))
print(yate.end_form("Select to show detail"))
print(yate.include_footer({"Click here to go Home": "/index.html"}))
Пример #17
0
    with open(RecordFilePath, mode='r', encoding='utf-8') as readfile:
        jsonstring = json.loads(readfile.read().strip())
        ExamRecDict = OrderedDict()
        for Arec in sorted(jsonstring['ExamRecords'].keys(), reverse=True):
            for AnExam in jsonstring['ExamRecords'][Arec]:
                WrongCount = WrongCount + len(
                    jsonstring['ExamRecords'][Arec][AnExam]['WrongRecords'])
            ExamRecDict[Arec] = Arec + '(%d | %d)' % (len(
                jsonstring['ExamRecords'][Arec]), WrongCount)

    print('<div id="topfixed">')
    print(yate.header('韦浩宇的算术训练营 -- 测验回顾', 1))
    print(yate.para('请选择查看哪天的测验?'))
    print(yate.start_form('ExamRecords.py'))
    print(yate.select_set('ExamRecSelect', ExamRecDict))
    print(yate.end_form('确定', 'sub'))

    try:
        Recordkey = form_data['ExamRecSelect'].value
        print(yate.para(''))
        print(
            yate.header(
                '以下为 <ins>%s</ins> 的测验记录(共 <ins>%d</ins> 次):' %
                (Recordkey, len(jsonstring['ExamRecords'][Recordkey])), 2))
        print('</div>')
        print('<div style="margin-top:220px">')
        for AnExam in sorted(jsonstring['ExamRecords'][Recordkey].keys()):
            ExamWrongList = jsonstring['ExamRecords'][Recordkey][AnExam][
                'WrongRecords']
            ExamTime = jsonstring['ExamRecords'][Recordkey][AnExam]['ExamTime']
            ExamTimeAct = cal_time.seconds2time(int(ExamTime[1]))
Пример #18
0
    print(yate.input_hidden('operator', Operator))
print(yate.input_hidden('level', form_data['level'].value))
print(yate.input_hidden('ExpNum', ExpNum))
print(yate.input_hidden('WrongNum', WrongNum))
print(yate.input_hidden('WrongTag', WrongTag))
print(yate.input_hidden('CorrectNum', CorrectNum))
print(yate.input_hidden('NewSetting', 0))
print(yate.input_hidden('ArithmeticExpress', ArithmeticExpress))
print(yate.input_hidden('FactResult', str(FactResult)))
#==============================记录完毕================================

print(yate.header('%s' % (ArithmeticExpress + ' = &nbsp;&nbsp;' + yate.create_inputs('CalResult', style='input_control')), 2))

print(yate.para(''))

print(yate.end_form('提交', 'sub'))

# =================<换一题>表单提交=================

print(yate.start_form('generate_expression.py'))
# =================在页面上记录上之前的设置参数=================
print(yate.input_hidden('numlist', form_data['numlist'].value))
for Operator in OperatorList:
    print(yate.input_hidden('operator', Operator))
print(yate.input_hidden('level', form_data['level'].value))
print(yate.input_hidden('ExpNum', ExpNum + 1))
print(yate.input_hidden('WrongNum', WrongNum))
print(yate.input_hidden('WrongTag', 0))
print(yate.input_hidden('CorrectNum', CorrectNum))
print(yate.input_hidden('NewSetting', 0))
Пример #19
0
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 12 11:50:51 2018

@author: dell]

generate_list
"""

import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in athletes:
    print(yate.radio_button("Which_athlete", athletes[each_athlete].name))
print(yate.end_form("select"))

print(yate.include_footer({"Home": "/index.html"}))
Пример #20
0
import athletemodel
import yate
import glob
# import os
# os.chdir('D:/Python/python-git/begginger/2017-03-13/Program')

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())  # 总是从一个content-type行开始
print(yate.include_header(
    "Coach Kelly's List of Athletes"))  # 开始生成Web页面,提供一个合适的标题
print(yate.start_form("generate_timing_data.py"))  # 开始生成表单,提供要连接的服务器端程序的名。
print(yate.para(
    "Select an athlete from the list to work with:"))  # 这是一个段落,告诉用户做什么

# 为每个选手分别生成一个单选钮
for each_athlete in athletes:
    print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))  # 定制一个"提交"按钮

print(yate.include_footer({"Home": "/index.html"}))
Пример #21
0
__author__ = 'Dixit_Patel'

from genericFunctions import *
import athletemodel
#from athletemodel import *
import yate
import glob

data_files = glob.glob("../data/*.txt")
#print(data_files)
# print(glob.glob0('data','/*.txt'))
# print(glob.glob1('data','/*.txt'))
athletes = athletemodel.put_to_store(data_files)

# impt line - start response
print(yate.start_response())

print(yate.include_header("Home"))
print(yate.header("AthLetA"))
print(yate.para('Select an athlete from list'))
print(yate.start_form("generate_timing_data.py"))
print(type(athletes))
for athlete in athletes:
    print(yate.radio_button("which_athlete",athletes[athlete].name))
# print(yate.radio_button('James','James'))
# print(yate.radio_button('Mikey','Mikey'))
print(yate.end_form())
print(yate.include_footer({"Home": "/index.html"}))
Пример #22
0
import athletemodel
import glob
import yate
import cgi

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)
print(yate.start_response())
print(yate.include_header("Atheletes list"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Please select one athlete from the list below:"))
for each in athletes:
    print(yate.radio_button("which_athlete", athletes[each].name))
print(yate.end_form())
print(yate.include_footer({"Home": "../index.html"}))

form_data = cgi.FieldStorage()
athlete_name = form_data['which_athlete'].value
Пример #23
0
def guidpage_arrange():
    spid = get_formData('which_spid')
    obj = deal_mysql()
    msg = '''select id,alias from u_items'''
    results = obj.askdata(msg)
    
    nummsg = '''select item_id,position from u_homepage where spid=%s''' % spid[0]
    homeitem= obj.askdata(nummsg)   
    
    obj.Close()
    
    nobj = deal_mysql('uspset.ini')
    nmsg = """select name from u_sp where id=%s""" % spid[0]
    spname = nobj.askdata(nmsg)   
    nobj.Close()
      
    
    #headers = ["频道名称", "频道编号"]
    print(yate.start_response())
    aa = "频道运营"
    aa.encode('utf-8')
  
  
    print(yate.include_header(aa))

    print(yate.start_form("op_guidepage_storage.py"))
    
    print(yate.start_table(tb_width="75%", tb_border="1px solid"))    
    print(yate.start_row())
    print('<input type="radio" checked="checked" name="which_sp" value="'+(spid[0])+'"/>"'+spname[0][0]+'"')
    
    print(yate.end_row())
    print(yate.end_table())
    
    print(yate.start_table(tb_width="75%", tb_border="5px solid")) 
    '''
    spid has in u_homepage
    '''
    if homeitem !=():        
        position = dict()
        for eachItem in homeitem:
            position.update({eachItem[0]:eachItem[1]})
        for i in range(2):    
            print(yate.start_tr())
            for iters in range(3):
                if i == 1:
                    iters = iters + 3
                print(yate.start_td())
                pos = 'pos'+str(iters)
                print(yate.select(pos))
                for item in results:
                    if item[0] in position.keys() and position[item[0]]==iters+1:                        
                        print(yate.select_optione_with_selected(item,True))
                    else:
                        print(yate.select_optione_with_selected(item))                        
                print(yate.end_select())
                print(yate.end_td())
            print(yate.end_tr())
                     
    
    else:
        for i in range(2):                          
            print(yate.start_tr())        
            for iters in range(3):
                if i == 1:
                    iters = iters + 3
                print(yate.start_td())
                pos = 'pos'+str(iters)
                print(yate.select(pos))        
                print(yate.select_option(results))
                print(yate.end_select())
                print(yate.end_td())
            print(yate.end_tr())    
    
    print(yate.end_table())
    
    print(yate.start_table(tb_width="75%", tb_border="1px solid"))
    print(yate.start_row())
    print(yate.end_form("确定"))
    print(yate.end_row())    
    print(yate.end_table())  
    print('</body></html>')
Пример #24
0
    print(yate.input_hidden(ExamData, str(ExamList[key][1])))
    print(
        yate.header(
            '<span class="specfont">%d.</span>&nbsp;&nbsp;&nbsp;&nbsp;%s' %
            (key, ExamList[key][0] + ' = &nbsp;&nbsp;' +
             yate.create_inputs(ExamData, style='input_control')), 2))
# ================= 在页面上记录上之前的设置参数 =================
print(yate.input_hidden('numlist', form_data['numlist'].value))
for Operator in OperatorList:
    print(yate.input_hidden('operator', Operator))
print(yate.input_hidden('level', form_data['level'].value))
print(yate.input_hidden('ExamCount', ExamCount))  #把考试题目数量传过去
print(yate.input_hidden('NewSetting', NewSettingTag))
print(yate.input_hidden('totaltime'))  #把考试用时传过去(由JS提供值)
# print(yate.para('新页面标识为:%s' % NewSettingTag))
# # ================= 在页面上记录本次考题和答案 =================
# ExpressListJson = json.dumps(ExamList)   #把考题列表转换为json字符串
# print(yate.input_hidden('ExpressListJson', ExpressListJson))
# print(yate.para(ExpressListJson))

#===========================================================

print(yate.end_form('完成提交', 'sub'))
print('</div>')

# =====================设置页脚的链接(保持固定顺序)=====================
FooterString = OrderedDict()
FooterString['返回首页'] = '/index.html'
FooterString['测验回顾'] = 'ExamRecords.py'
print(yate.include_footer(FooterString))
Пример #25
0
candidateList = [s.encode("utf-8") for s in candidateList]

print('<h2>' + "After calculation, these are the most possible query candidates! " +'</h2>')
print(yate.u_list(candidateList))
print ('</br>')
#print(yate.createLink({"Verbose mode": "/cgi-bin/controller4.py"}))
print ('</br>')

#print(yate.start_form(NEXT_URL, form_type="POST"))

#### CGI passing for DEBUG page  
for c in candidateList:
	print(yate.hidden_input('candidate', c))
print('<h3>' + "Check verbose info: " +'</h3>')
print(yate.end_form("enter to verbose mode"))

#### CGI passing for final results page 

#print(yate.start_form(NEXT_URL1, form_type="POST"))
#for c in candidateList:
#	print(yate.hidden_input('results', c))
#print('<h3>' + "View the final results: " +'</h3>')
#print(yate.end_form("Go to result page", submitname = "submit1"))


print(yate.include_footer({"Done, go back to Google": "/index.html"}))

### render segmented results #### 
#segmentedQuery = segQuery.segmentToListPerQuery(term)
#print(yate.para("These are segmented query: "))
Пример #26
0
operatelist = {}
for key in operatelist1:
    operatelist[operatelist1[key]] = key

print(yate.start_response())
print(yate.include_header('这是一个WEB应用测试页面'))

print(yate.header('%s' % ('=' * 10 + '下面是测试内容' + '=' * 10), 3))
print(yate.start_form('test_content.py'))

# for Anoperator in operatelist:
#     print(yate.checked_box('operator',Anoperator))

print(yate.select_set('operator', operatelist, 3, multiple=True))

print(yate.end_form('提交'))

footer_string = '=' * 10 + '结束' + '=' * 10

form_data = cgi.FieldStorage()
if (form_data):
    if (isinstance(form_data['operator'], list)):
        OperatorList = [x.value for x in form_data['operator']]
    else:
        OperatorList = form_data['operator'].value
    ShowData = str(OperatorList)
    print(yate.para(''))
    print(yate.header('%s' % ('=' * 10 + '以下为测试结果' + '=' * 10), 3))
    print(yate.header(ShowData, 3))

print(yate.include_footer({footer_string: ''}))
Пример #27
0
import athletemodel
import yate
import glob  #this module lets you query your operating system for a list of file names

data_files = glob.glob(
    "data/*.txt"
)  #creating a list of the file names of type '*.txt' within folder 'data'
athletes = athletemodel.put_to_store(
    data_files)  #creating a dictionary of athletes from the list of data files

print(yate.start_response())  #always start with a Content-type line
print(yate.include_header(
    "Coach Kelly's List of Athletes"))  #provide a title for the page

print(
    yate.start_form("generate_timing_data.py")
)  #start generating the form providing the name of the server-side program to link to.
print(yate.para("Select an athlete from the list to work with:"))

for each_athlete in athletes:  #generate a radio button for each athlete
    print(yate.radio_button("which_athlete", athletes[each_athlete].name))

print(yate.end_form(
    "Select"))  # end the form with a custom text for the submit button

print(yate.include_footer({"Home": "/index.html"
                           }))  # a link to go back to the Home page
Пример #28
0
#! /usr/bin/env python3

import glob

import athletemodel
import yate

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
    print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
Пример #29
0
import glob
import model
import yate

data_files = glob.glob("../data/*.txt")
img_dic = model.writeList(data_files)


print (img_dic)


print (yate.start_response())
print (yate.include_header("haha"))
print (yate.start_form("by my CGI"))
print (yate.para("from my data list"))
for item in img_dic:
    print(yate.radio_button("which_img",img_dic[item] ))
print(yate.end_form("Selec"))
print(yate.include_footer({"HOME": "/index.html"}))

Пример #30
0

print(dir())

the_files = ['sarah2.txt', 'james2.txt', 'mikey2.txt', 'julie2.txt']
data = put_to_store(the_files)
print(data)

for each_athlete in data:
	print(data[each_athlete].name + ' ' + data[each_athlete].dob)

data_copy = get_from_store()
for each_athlete in data_copy:
	print(data_copy[each_athlete].name + ' ' + data_copy[each_athlete].dob)

print(yate.start_response())
print(yate.start_response("text/plain"))
print(yate.start_response("application/json"))
print(yate.include_header("Welcome to my home on the web!"))
print(yate.include_footer({'Home': '/index.html', 'Select': '/cgi-bin/select.py'}))
print(yate.include_footer({}))
print(yate.start_form("/cgi-bin/process-athlete.py"))
print(yate.end_form())
print(yate.end_form("Click to Confirm Your Order"))
for fab in ['John', 'Paul', 'George', 'Ringo']:
	print(yate.radio_button(fab, fab))
print(yate.u_list(['Life of Brian', 'Holy Grail']))
print(yate.header("Welcome to my home on the web"))
print(yate.header("This isa sub-sub-sub-sub-heading", 5))
print(yate.para("Was it worth the wait? We hope it was..."))
Пример #31
0
def main():
    form_data = cgi.FieldStorage()
    
    print(yate.start_response())
    print(yate.include_header('Estatísticas para Loterias do Brasil'))
    
    if not form_data:
        print(yate.start_form('', 'jogos.py'))
        print(yate.drop_box('Jogo: ', 'Jogos', {'Quina':'Quina',
            'Mega-Sena': 'Mega-Sena',
            'LotoFácil':'LotoFácil'}, 'Mega-Sena'))
    
        print(yate.drop_box('Estatística: ', 'Estat', {
            'doze': 'Dezenas Mais Sorteadas',
            'rule': 'Distribuição entre Pares e Impares',
            'wors': 'Maior tempo sem ser sorteado',
            'more': 'Mais Sorteado',
            'aver': 'Média de tempo sem ser sorteado',
            'sugs': 'Sugere números com melhor Escore Z',
            'sugl': 'Sugere números menos sorteados recentemente',
            'sugm': 'Sugere números sorteados recentemente',
            'last': 'Última vez sorteado',
            'unit': 'Unidades Mais Sorteadas'},
            'more'))
    
        print(yate.end_form('Enviar'))
    
    elif form_data.getvalue('Jogos') and form_data.getvalue('Estat'):
        jogo = form_data.getvalue('Jogos')
        estat = form_data.getvalue('Estat')
        if jogo == 'Quina':
            obj = QuinaStats('../data/D_QUINA.HTM')
        elif jogo == 'Mega-Sena':
            obj = SenaStats('../data/d_megasc.htm')
        elif jogo == 'LotoFácil':
            obj = LotoFacilStats('../data/D_LOTFAC.HTM')
        else:
            print(yate.para('Opção Inexistente'))
            print(yate.include_footer('&copy LotoEstat 2012'))
            return
    
        if form_data.getvalue('Estat') == 'more':
            print(yate.header('Números Mais Sorteados'))
            print(yate.para('Lista decrescente dos números mais sorteados da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('More', for_print=False)
            print(yate.start_tb(['Dezena ', ' Número de Vezes Sorteado']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'rule':
            print(yate.header('Distribuição entre Pares e Impares'))
            print(yate.para('Combinação de pares e ímpares entre os números da ' + form_data.getvalue('Jogos') + '.'))
            to_print = obj.print_rule_even_by_odd(for_print=False) 
            print(yate.start_tb(['Dezenas Pares ', ' Dezenas Ímpares ', ' Número de Vezes Sorteado']))
            p = re.compile('\d+')
            for each in to_print:
                even, odd = p.findall(each[0])
                print(yate.inner_tb([even, odd, each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'unit':
            print(yate.header('Unidades Mais Sorteadas'))
            print(yate.para('Lista das Unidades mais Sorteadas dos Jogos da ' + form_data.getvalue('Jogos') + '.'))
            to_print = obj.print_more_often_unit(for_print=False) 
            print(yate.start_tb(['Dezenas terminadas em ', ' Número de Vezes Sorteado']))
            p = re.compile('\d+')
            for each in to_print:
                unidade = p.findall(each[0])
                print(yate.inner_tb([unidade[0], each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'doze':
            print(yate.header('Dezenas Mais Sorteadas'))
            print(yate.para('Lista das Dezenas mais Sorteadas dos Jogos da ' + form_data.getvalue('Jogos') + '.'))
            to_print = obj.print_more_often_dozen(for_print=False) 
            print(yate.start_tb(['Dezenas Começadas por ', ' Número de Vezes Sorteado']))
            p = re.compile('\d+')
            for each in to_print:
                dezena = p.findall(each[0])
                print(yate.inner_tb([dezena[0], each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'last':
            print(yate.header('Última vez Sorteado'))
            print(yate.para('A quanto tempo a dezena não é sorteada entre os números premiados da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('Last', for_print=False)
            print(yate.start_tb(['Dezena ', ' Tempo sem ser sorteada']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'wors':
            print(yate.header('Maior tempo sem ser sorteado'))
            print(yate.para('Pior tempo de espera que um número aguardou para ser sorteado entre todos os sorteios da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('Worst', for_print=False)
            print(yate.start_tb(['Dezena ', ' Pior tempo sem ser sorteada']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'aver':
            print(yate.header('Média de tempo sem ser sorteado'))
            print(yate.para('Tempo médio que um número leva até ser sorteado, obtidos à partir do histórico de resultados  da ' + form_data.getvalue('Jogos') + '.'))
            
            to_print = obj.prepare_to_print('Average', for_print=False)
            print(yate.start_tb(['Dezena ', ' Média de espera entre dois sorteios']))
            for each in to_print:
                print(yate.inner_tb([each[0],each[1]]))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'sugm':
            print(yate.header('Sugere números sorteados recentemente'))
            print(yate.para('Ordena os números da ' + form_data.getvalue('Jogos') + ' levando em conta as estatísticas individuais, favorecendo os números que saíram com mais frequencia e que foram sorteados recentemente.'))
            to_print = obj.suggest_num(method='Most Recently', for_print=False)
            if form_data.getvalue('Jogos') == 'Quina':
                dez_sug = 7 
            elif form_data.getvalue('Jogos') == 'Mega-Sena':
                dez_sug = 15 
            elif form_data.getvalue('Jogos') == 'LotoFácil':
                dez_sug = 15 

            cabecalho_tabela = []
            for num in range(1, dez_sug + 1):
                cabecalho_tabela.append(str(num) + 'ª dezena')
            print(yate.start_tb(cabecalho_tabela))
            lis = []
            for each in to_print[:dez_sug]:
                lis.append(each[0])
            print(yate.inner_tb(lis))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'sugl':
            print(yate.header('Sugere números menos sorteados recentemente'))
            print(yate.para('Ordena os números da ' + form_data.getvalue('Jogos') + ' levando em conta as estatísticas individuais, favorecendo os números que saíram com mais frequencia e que estão a mais tempo sem serem sorteados.'))
            to_print = obj.suggest_num(method='Least Recently', for_print=False)
            if form_data.getvalue('Jogos') == 'Quina':
                dez_sug = 7 
            elif form_data.getvalue('Jogos') == 'Mega-Sena':
                dez_sug = 15
            elif form_data.getvalue('Jogos') == 'LotoFácil':
                dez_sug = 15

            cabecalho_tabela = []
            for num in range(1, dez_sug + 1):
                cabecalho_tabela.append(str(num) + 'ª dezena')
            print(yate.start_tb(cabecalho_tabela))
            lis = []
            for each in to_print[:dez_sug]:
                lis.append(each[0])
            print(yate.inner_tb(lis))
            print(yate.end_tb())
        
        elif form_data.getvalue('Estat') == 'sugs':
            print(yate.header('Sugere números com melhor escore padrão'))
            print(yate.para('Ordena os números da ' + form_data.getvalue('Jogos') + ' levando em conta o escore padrão de cada um, favorecendo os números com menor desvio padrão da média de tempo de espera para um número ser sorteado.'))
            to_print = obj.suggest_num(method='Score', for_print=False)
            if form_data.getvalue('Jogos') == 'Quina':
                dez_sug = 7 
            elif form_data.getvalue('Jogos') == 'Mega-Sena':
                dez_sug = 15
            elif form_data.getvalue('Jogos') == 'LotoFácil':
                dez_sug = 15

            cabecalho_tabela = []
            for num in range(1, dez_sug + 1):
                cabecalho_tabela.append(str(num) + 'ª dezena')
            print(yate.start_tb(cabecalho_tabela))
            lis = []
            for each in to_print[:dez_sug]:
                lis.append(each[0])
            print(yate.inner_tb(lis))
            print(yate.end_tb())
        
        print(yate.header('Atualizado em : %s', header_level=6) % obj.print_updated_data())

    else :
        print(yate.para('Opção por Jogo ou Estatística não efetuada.'))
    
    print(yate.include_footer('&copy LotoEstat 2012'))