✏️ 编辑:abj_change.py
路径:
/virtual/bigbrother/public_html/edream-c.com/cr/PLUGINS/abj_change.py
大小:8.08 KB · 修改:2014-04-14 18:59:41 · 权限:0644 · 可写
← 返回目录
👁 查看
⬇ 下载
#!/usr/bin/env python # -*- coding: utf-8 -*- # TOMUSS: The Online Multi User Simple Spreadsheet # Copyright (C) 2008-2014 Thierry EXCOFFIER, Universite Claude Bernard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Contact: Thierry.EXCOFFIER@bat710.univ-lyon1.fr from .. import plugin from .. import utilities from .. import abj from ..files import files from .. import document css = """ TR#dates TD { text-align: center ; vertical-align: middle ; } TR#ampm TD { text-align: center ; } TD.weekend { background-color: #FBB; } TABLE.display_abjs TH { text-align: center ; } TABLE.display_abjs TD, TABLE.display_da TD { background-color: #EEE ; } TABLE.display_abjs TH, TABLE.display_abjs TD, TABLE.display_da TD, TABLE.display_da TH { padding: 1px } IFRAME#datasend { height: 15em ; width: 100% ; } DIV#student_display IMG { width: 10% ; float: right ; } INPUT#sendabj { width: 15em ; } INPUT#sendmessage { width: auto ; text-align: left } INPUT#sendabj, INPUT#sendmessage { background: #EEE; } SPAN.arrow { color: blue ; font-size: 200% ; } BODY#BODY P, BODY#BODY H1 { margin: 0px ; } BODY.abj_body { background: #EEE } P.wait { background-color: #8F8 ; } DIV.abj_comments { border: 3px solid black; line-height: 1.5em; top:6em } .abj_comments A { border: 1px solid black ; } #abjcomment, #dateda { background: white; } """ def abj_home(server): """Display the home page for ABJ management""" utilities.warn('Start') d = (document.table_head(int(server.the_year), server.the_semester, the_ticket=server.ticket.ticket, user_name = server.ticket.user_name, hide_more=True, ) + '<title>%s</title>' % server._("TITLE_abj") + str(files['abj.html']) ) server.the_file.write(d) def abj_alpha_licence(server): """Send a CSV file containing all the ABJ and DA information for all the students""" abj.alpha_html(server.the_file, server.the_year, server.the_semester, ue_name_endswith='L') def abj_alpha_master(server): """Send a CSV file containing all the ABJ and DA information for all the students""" abj.alpha_html(server.the_file, server.the_year, server.the_semester, ue_name_endswith='M') def abj_alpha_epu(server): """Send a CSV file containing all the ABJ and DA information for all the students""" abj.alpha_html(server.the_file, server.the_year, server.the_semester, ue_name_startswith='UE-EI') def abj_alpha_author(server): """Send a CSV file containing all the ABJ and DA information for all the students""" abj.alpha_html(server.the_file, server.the_year, server.the_semester, author=server.ticket.user_name) def abj_send_mail(server): """When triggered this function send all the mail generated by the plugin <a href="#plugin_abjlistmail">listmail</a>.""" abj.send_mail(server.the_file) def abj_list_mail(server): """Generate and display all the message to the UE teachers given them the names of the students with ABJ, DA and TT. <p>At the end of the page, there is a link to really send the messages</p> """ abj.list_mail(server.the_file, server.the_year, server.the_semester) def abj_action(server): """This plugin perform an action on the ABJ and DA list. These actions can be adding or removing an ABJ or a DA. The client receive a feedback image indicating the status of the change. """ path = server.the_path if path[0] == 'addabj': abj.add_abjs(server.the_year, server.the_semester, server.ticket, server.the_student, '/'.join(path[1:4]) + path[4], '/'.join(path[5:8]) + path[8], path[9].strip()) elif path[0] == 'add_da': abj.add_abjs_da(server.the_year, server.the_semester, server.ticket, server.the_student, path[1], path[2] + '/' + path[3] + '/' + path[4], path[5].strip()) elif path[0] == 'rem_da': abj.rem_abjs_da(server.the_year, server.the_semester, server.ticket, server.the_student, path[1]) elif path[0] == 'delabj': abj.rem_abjs(server.the_year, server.the_semester, server.ticket, server.the_student, '/'.join(path[1:4]) + path[4], '/'.join(path[5:8]) + path[8]) elif path[0] == 'display': pass else: server.the_file.write('bug') abj.a_student(server.the_file, server.the_year, server.the_semester, server.ticket, server.the_student) def abj_no(server): """Display an error message becauses this action is unauthorized""" server.the_file.write('BUG: abj_no') plugin.Plugin('abj', '/{Y}/{S}/abj', function=abj_home, group='abj_masters', link=plugin.Link( url="javascript:go('abj')", where='abj_master', html_class="safe", ), css=css, priority = -3, unsafe=False, ) plugin.Plugin('abjalpha', '/{Y}/{S}/abj/alpha.xls', function=abj_alpha_licence, group='abj_masters', launch_thread = True, link=plugin.Link( url="javascript:go('abj/alpha.xls')", where='abj_master', html_class="verysafe", ), priority = -3, ) plugin.Plugin('abjalphamaster', '/{Y}/{S}/abj/alpha_master.xls', function=abj_alpha_master, group='abj_masters', launch_thread = True, link=plugin.Link( url="javascript:go('abj/alpha_master.xls')", where='abj_master', html_class="verysafe", ), priority = -3, ) plugin.Plugin('abjalphaepu', '/{Y}/{S}/abj/alpha_epu.xls', function=abj_alpha_epu, group='abj_masters', launch_thread = True, link=plugin.Link( url="javascript:go('abj/alpha_epu.xls')", where='abj_master', html_class="verysafe", ), priority = -3, ) plugin.Plugin('abjalphaauthor', '/{Y}/{S}/abj/alpha_author.xls', function=abj_alpha_author, group='abj_masters', launch_thread = True, link=plugin.Link( url="javascript:go('abj/alpha_author.xls')", where='abj_master', html_class="verysafe", ), priority = -3, ) plugin.Plugin('abjlistmail', '/{Y}/{S}/abj/list_mail', function=abj_list_mail, group='abj_masters', launch_thread = True, link=plugin.Link( url="javascript:go('abj/list_mail')", where='abj_master', html_class="safe", ), priority = -3, ) plugin.Plugin('abjhacker', '/{Y}/{S}/abjs', function=abj_no, priority = -20, ) plugin.Plugin('abjaction', '/{Y}/{S}/abj/{P}/{I}/{*}', function=abj_action, group='abj_masters', priority = -20, ) plugin.Plugin('abjsendmail', '/{Y}/{S}/abj/send_mail', function=abj_send_mail, group='abj_masters', launch_thread = True, priority = -3, )
💾 保存
取消
保存为 UTF-8,换行统一为 LF