Example #1
0
 def GET(self,pid):
     if pid=='':
         classes = model.get_classes('order by ctime DESC')
     elif pid=='unapprove':
         classes = model.get_classes('where approve=\'未审批\' order by ctime DESC')
     elif pid=='pass':
         classes = model.get_classes('where approve=\'通过\' order by ctime DESC')
     elif pid=='notpass':
         classes = model.get_classes('where approve=\'不通过\' order by ctime DESC')
     else:
         classes = model.get_classes('where class.pid='+pid+' order by ctime DESC')
     return render.index_class(classes,pid)
Example #2
0
 def GET(self, cid):
     c = model.get_classes('where cid=' + cid)[0]
     begin = c['begindate'].day + 1 / 2 * c['begintime']
     end = c['enddate'].day + 1 / 2 * c['endtime']
     year = c['begindate'].year
     month = c['begindate'].month
     classroom = c['classroom']
     wh = 'where (DAYOFMONTH(begindate)+1/2*begintime between '+str(begin)+' and '+str(end)\
     +' or DAYOFMONTH(enddate)+1/2*begintime between '+str(begin)+' and '+str(end)+')'\
     +' and MONTH(begindate)='+str(month)+' and YEAR(begindate)='+str(year)\
     +' and classroom.classroom=\''+classroom+'\''+' and approve=\''+'未审批'.decode('utf-8')+'\''
     classes = list(model.get_classes(wh))
     return render.conflict_class(classes)
 def GET(self, term):
     if session.privilege == 3:
         user = '******' + str(session.uid)
         if term == '':
             classes = model.get_classes(user + ' order by ctime DESC')
         elif term == 'unapprove':
             classes = model.get_classes(
                 user + ' and approve=\'未审批\' order by ctime DESC')
         elif term == 'pass':
             classes = model.get_classes(
                 user + ' and approve=\'通过\' order by ctime DESC')
         elif term == 'notpass':
             classes = model.get_classes(
                 user + ' and approve=\'不通过\' order by ctime DESC')
     elif session.privilege == 2:
         if term == '':
             classes = model.get_classes('order by ctime DESC')
         elif term == 'unapprove':
             classes = model.get_classes(
                 'where approve=\'未审批\' order by ctime DESC')
         elif term == 'pass':
             classes = model.get_classes(
                 'where approve=\'通过\' order by ctime DESC')
         elif term == 'notpass':
             classes = model.get_classes(
                 'where approve=\'不通过\' order by ctime DESC')
     render = create_render(session.privilege)
     return render.index_class(classes,
                               datetime.datetime.now().strftime('%Y-%m'))
 def GET(self, term):
     if term == '':
         classes = model.get_classes('order by ctime DESC')
     elif term == 'unapprove':
         classes = model.get_classes(
             'where approve=\'未审批\' order by ctime DESC')
     elif term == 'pass':
         classes = model.get_classes(
             'where approve=\'通过\' order by ctime DESC')
     elif term == 'notpass':
         classes = model.get_classes(
             'where approve=\'不通过\' order by ctime DESC')
     return render.index_class(classes,
                               datetime.datetime.now().strftime('%Y-%m'))
 def GET(self, pid):
     classes = model.get_classes('where class.pid=' + str(pid) +
                                 ' order by ctime DESC')
     render = create_render(session.privilege)
     return render.index_class_project(
         classes, pid,
         datetime.datetime.now().strftime('%Y-%m'))
Example #6
0
 def GET(self, date):
     wh = 'where approve=\''+'通过'.decode('utf-8')+'\''\
     +' and YEAR(begindate)='+date[0:4]+' and MONTH(begindate)='+date[5:7]\
     +' order by begindate'
     classes = list(model.get_classes(wh))
     days = calendar.monthrange(int(date[0:4]), int(date[5:7]))[1]
     return render.monthly_summary(classes, date, days)
Example #7
0
 def GET(self,date):
     print date
     wh = 'where approve!=\''+'不通过'.decode('utf-8')+'\''\
     +' and YEAR(begindate)='+date[0:4]+' and MONTH(begindate)='+date[5:7]\
     +' order by begindate'
     classes = list(model.get_classes(wh))
     return render.approve_class(classes)
Example #8
0
 def GET(self, pid):
     table = alltable['class']
     if pid == '':
         classes = model.get_items(table)
     else:
         classes = model.get_classes(table, pid)
     return render.index_class(table, classes, pid)
 def GET(self, cid):
     if logged():
         classes = model.get_classes('where cid=' + str(cid))[0]
         render = create_render(session.privilege)
         return render.view_class(classes)
     else:
         raise web.seeother('/')
Example #10
0
 def GET(self, pid):
     if pid == '':
         classes = model.get_classes('order by ctime DESC')
     elif pid == 'unapprove':
         classes = model.get_classes(
             'where approve=\'未审批\' order by ctime DESC')
     elif pid == 'pass':
         classes = model.get_classes(
             'where approve=\'通过\' order by ctime DESC')
     elif pid == 'notpass':
         classes = model.get_classes(
             'where approve=\'不通过\' order by ctime DESC')
     else:
         classes = model.get_classes('where class.pid=' + str(pid) +
                                     ' order by ctime DESC')
     return render.index_class(classes, pid,
                               datetime.datetime.now().strftime('%Y-%m'))
Example #11
0
 def GET(self, date):
     wh = 'where approve=\''+'通过'.decode('utf-8')+'\''\
     +' and strftime(\'%Y\',begindate)=\''+date[0:4]+'\' and strftime(\'%m\',begindate)=\''+date[5:7]\
     +'\' order by begindate'
     classes = list(model.get_classes(wh))
     days = calendar.monthrange(int(date[0:4]), int(date[5:7]))[1]
     render = create_render(session.privilege)
     return render.monthly_summary(classes, date, days)
Example #12
0
 def GET(self, cid):
     c = model.get_classes('where cid=' + cid)[0]
     begin = c['begindate'].day + 1 / 2 * c['begintime']
     end = c['enddate'].day + 1 / 2 * c['endtime']
     year = c['begindate'].year
     month = c['begindate'].month
     place = c['place']
     classroom = c['classroom']
     wh = 'where (DAYOFMONTH(begindate)+1/2*begintime between '+str(begin)+' and '+str(end)\
     +' or DAYOFMONTH(enddate)+1/2*endtime between '+str(begin)+' and '+str(end)\
     +' or (DAYOFMONTH(begindate)+1/2*begintime<'+str(begin)+' and DAYOFMONTH(enddate)+1/2*endtime>'+str(end)+'))'\
     +' and MONTH(begindate)='+str(month)+' and YEAR(begindate)='+str(year)\
     +' and classroom.place=\''+place+'\''+' and classroom.classroom=\''+classroom+'\''\
     +' and approve!=\''+'不通过'.decode('utf-8')+'\''+' order by begindate'
     classes = list(model.get_classes(wh))
     date = classes[0]['begindate'].strftime('%Y-%m')
     return render.conflict_class(classes, date)
 def GET(self, date):
     wh = 'where approve!=\''+'不通过'.decode('utf-8')+'\''\
     +' and YEAR(begindate)='+date[0:4]+' and MONTH(begindate)='+date[5:7]\
     +' order by begindate'
     classes = list(model.get_classes(wh))
     days = calendar.monthrange(int(date[0:4]), int(date[5:7]))[1]
     render = create_render(session.privilege)
     return render.approve_class(classes, date, days)
 def GET(self, cid):
     if logged():
         c = model.get_classes('where cid=' + cid)[0]
         classes = model.get_conflict_class(c)
         date = c['begindate'].strftime('%Y-%m')
         render = create_render(session.privilege)
         return render.conflict_class(classes, date, cid)
     else:
         raise web.seeother('/')
 def GET(self,pid):
     classes = list(model.get_classes('where class.pid='+str(pid)+' order by ctime DESC'))
     for c in classes:
         conflict_class = model.get_conflict_class(c)
         if len(conflict_class)==1:
             c['conflict'] = 0
         else:
             c['conflict'] = 1
     render = create_render(session.privilege)
     return render.index_class_project(classes,pid,datetime.datetime.now().strftime('%Y-%m'))
Example #16
0
 def GET(self,cid):
     c = model.get_item(alltable['class'],cid)
     begin = c['begindate'].day+1/2*c['begintime']
     end = c['enddate'].day+1/2*c['endtime']
     year = c['begindate'].year
     month = c['begindate'].month
     whl = 'where (DAYOFMONTH(begindate)+1/2*begintime between '+str(begin)+' and '+str(end)+\
     ' or DAYOFMONTH(enddate)+1/2*begintime between '+str(begin)+' and '+str(end)+\
     ') and MONTH(begindate)='+str(month)+' and YEAR(begindate)='+str(year)+' and approve=\'未审批\''
     classes = model.get_classes(whl)
     return render.conflict_class(classes)
 def GET(self, date):
     if logged():
         '''
         wh = 'where (approve!=\''+'不通过'.decode('utf-8')+'\' or approve ISNULL)'\
         +' and ((strftime(\'%Y\',begindate)=\''+date[0:4]+'\' and strftime(\'%m\',begindate)=\''+date[5:7]+'\') or begindate ISNULL)'\
         +' order by ctime DESC'
         '''
         wh = 'where approve!=\''+'不通过'.decode('utf-8')+'\''\
         +' and strftime(\'%Y\',begindate)=\''+date[0:4]+'\' and strftime(\'%m\',begindate)=\''+date[5:7]\
         +'\' order by begindate'
         classes = list(model.get_classes(wh))
         days = calendar.monthrange(int(date[0:4]), int(date[5:7]))[1]
         render = create_render(session.privilege)
         return render.approve_class(classes, date, days)
     else:
         raise web.seeother('/')
 def GET(self, term):
     if logged():
         if session.privilege == 3:
             user = '******' + str(session.uid)
             if term == '':
                 classes = list(
                     model.get_classes(user + ' order by ctime DESC'))
             elif term == 'unapprove':
                 classes = list(
                     model.get_classes(
                         user + ' and approve=\'未审批\' order by ctime DESC'))
             elif term == 'pass':
                 classes = list(
                     model.get_classes(
                         user + ' and approve=\'通过\' order by ctime DESC'))
             elif term == 'notpass':
                 classes = list(
                     model.get_classes(
                         user + ' and approve=\'不通过\' order by ctime DESC'))
             for c in classes:
                 conflict_class = model.get_conflict_class(c)
                 if len(conflict_class) == 1:
                     c['conflict'] = 0
                 else:
                     c['conflict'] = 1
         elif session.privilege == 2:
             if term == '':
                 classes = model.get_classes('order by ctime DESC')
             elif term == 'unapprove':
                 classes = model.get_classes(
                     'where approve=\'未审批\' order by ctime DESC')
             elif term == 'pass':
                 classes = model.get_classes(
                     'where approve=\'通过\' order by ctime DESC')
             elif term == 'notpass':
                 classes = model.get_classes(
                     'where approve=\'不通过\' order by ctime DESC')
         render = create_render(session.privilege)
         return render.index_class(
             classes,
             datetime.datetime.now().strftime('%Y-%m'))
     else:
         raise web.seeother('/')
 def POST(self, pid):
     if logged():
         classes_project = list(
             model.get_classes('where class.pid=' + str(pid)))
         if len(classes_project) != 0:
             approval = [a['approve'] for a in classes_project]
             if approval == [u'未审批'] * len(approval):
                 for c in classes_project:
                     model.del_item(alltable['class'], int(c['cid']))
                 model.del_item(alltable['project'], int(pid))
                 raise web.seeother('/index_project')
             else:
                 render = create_render(0)
                 return render.error('细项已审批,不能删除!')
         else:
             model.del_item(alltable['project'], int(pid))
             raise web.seeother('/index_project')
     else:
         raise web.seeother('/')
Example #20
0
 def GET(self):
     classes = list(model.get_classes('where approve=\'未审批\' '))
     return render.approve_class(classes)
Example #21
0
 def GET(self,pid):
     if pid=='':
         classes = model.get_classes('')
     else:
         classes = model.get_classes('where class.pid=\''+pid+'\' ')
     return render.index_class(classes,pid)
Example #22
0
 def GET(self, pid):
     if pid == '':
         classes = model.get_classes()
     else:
         classes = model.get_pclasses(pid)
     return render.index_class(classes, pid)
Example #23
0
 def GET(self, pid):
     table = alltable['class']
     """ Show page """
     classes = model.get_classes(table, pid)
     return render.index_class(table, classes, pid)
Example #24
0
 def GET(self, cid):
     classes = model.get_classes('where cid=' + str(cid))[0]
     render = create_render(session.privilege)
     return render.view_class(classes)
 def GET(self,cid):
     c = model.get_classes('where cid='+cid)[0]
     classes = model.get_conflict_class(c)
     date = classes[0]['begindate'].strftime('%Y-%m')
     render = create_render(session.privilege)
     return render.conflict_class(classes,date,cid)