diff --git a/modules/websubmit/lib/websubmit_templates.py b/modules/websubmit/lib/websubmit_templates.py index b4655babd..38d96713c 100644 --- a/modules/websubmit/lib/websubmit_templates.py +++ b/modules/websubmit/lib/websubmit_templates.py @@ -1,3013 +1,3034 @@ ## $Id$ ## This file is part of CDS Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN. ## ## CDS Invenio 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. ## ## CDS Invenio 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 CDS Invenio; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. __revision__ = "$Id$" import urllib import time import cgi import gettext import string import locale import re import operator import os from invenio.config import \ CFG_SITE_URL, \ CFG_VERSION, \ CFG_SITE_URL, \ CFG_SITE_LANG from invenio.messages import gettext_set_language from invenio.dateutils import convert_datetext_to_dategui from invenio.webmessage_mailutils import email_quoted_txt2html from invenio.htmlutils import escape_html import invenio.template class Template: # Parameters allowed in the web interface for fetching files files_default_urlargd = { 'version': (str, ""), # version "" means "latest" 'docname': (str, ""), # the docname (optional) 'format' : (str, ""), # the format 'verbose' : (int, 0) # the verbosity } def tmpl_submit_home_page(self, ln, catalogues): """ The content of the home page of the submit engine Parameters: - 'ln' *string* - The language to display the interface in - 'catalogues' *string* - The HTML code for the catalogues list """ # load the right message language _ = gettext_set_language(ln) return """ """ % { 'document_types' : _("Document types available for submission"), 'please_select' : _("Please select the type of document you want to submit"), 'catalogues' : catalogues, 'ln' : ln, } def tmpl_submit_home_catalog_no_content(self, ln): """ The content of the home page of submit in case no doctypes are available Parameters: - 'ln' *string* - The language to display the interface in """ # load the right message language _ = gettext_set_language(ln) out = "

" + _("No document types available.") + "

\n" return out def tmpl_submit_home_catalogs(self, ln, catalogs): """ Produces the catalogs' list HTML code Parameters: - 'ln' *string* - The language to display the interface in - 'catalogs' *array* - The catalogs of documents, each one a hash with the properties: - 'id' - the internal id - 'name' - the name - 'sons' - sub-catalogs - 'docs' - the contained document types, in the form: - 'id' - the internal id - 'name' - the name There is at least one catalog """ # load the right message language _ = gettext_set_language(ln) # import pprint # out = "
" + pprint.pformat(catalogs)
         out = ""
         for catalog in catalogs:
             out += "\n\n"
 
         return out
 
+    def tmpl_print_warning(self, msg, type, prologue, epilogue):
+        """Prints warning message and flushes output.
+
+        Parameters:
+
+          - 'msg' *string* - The message string
+
+          - 'type' *string* - the warning type
+
+          - 'prologue' *string* - HTML code to display before the warning
+
+          - 'epilogue' *string* - HTML code to display after the warning
+        """
+
+        out = '\n%s' % (prologue)
+        if type:
+            out += '%s: ' % type
+        out += '%s%s' % (msg, epilogue)
+        return out
+
+
     def tmpl_submit_home_catalogs_sub(self, ln, catalog):
         """
         Recursive function that produces a catalog's HTML display
 
         Parameters:
 
           - 'ln' *string* - The language to display the interface in
 
           - 'catalog' *array* - A catalog of documents, with the properties:
                 - 'id' - the internal id
                 - 'name' - the name
                 - 'sons' - sub-catalogs
                 - 'docs' - the contained document types, in the form:
                       - 'id' - the internal id
                       - 'name' - the name
         """
 
         # load the right message language
         _ = gettext_set_language(ln)
 
         if catalog['level'] == 1:
             out = "
  • %s\n" % catalog['name'] else: if catalog['level'] == 2: out = "
  • %s\n" % catalog['name'] else: if catalog['level'] > 2: out = "
  • %s\n" % catalog['name'] if len(catalog['docs']) or len(catalog['sons']): out += "
  • " else: out += "" return out def tmpl_submit_home_catalogs_doctype(self, ln, doc): """ Recursive function that produces a catalog's HTML display Parameters: - 'ln' *string* - The language to display the interface in - 'doc' *array* - A catalog of documents, with the properties: - 'id' - the internal id - 'name' - the name """ # load the right message language _ = gettext_set_language(ln) return """
  • %(name)s
  • """ % doc def tmpl_action_page(self, ln, uid, guest, pid, now, doctype, description, docfulldesc, snameCateg, lnameCateg, actionShortDesc, indir, statustext): """ Recursive function that produces a catalog's HTML display Parameters: - 'ln' *string* - The language to display the interface in - 'guest' *boolean* - If the user is logged in or not - 'pid' *string* - The current process id - 'now' *string* - The current time (security control features) - 'doctype' *string* - The selected doctype - 'description' *string* - The description of the doctype - 'docfulldesc' *string* - The title text of the page - 'snameCateg' *array* - The short names of all the categories of documents - 'lnameCateg' *array* - The long names of all the categories of documents - 'actionShortDesc' *array* - The short names (codes) for the different actions - 'indir' *array* - The directories for each of the actions - 'statustext' *array* - The names of the different action buttons """ # load the right message language _ = gettext_set_language(ln) out = "" out += """

    %(continue_explain)s
    Access Number:

    """ % { 'continue_explain' : _("To continue with a previously interrupted submission, enter an access number into the box below:"), 'doctype' : doctype, 'go' : _("GO"), 'ln' : ln, } return out def tmpl_warning_message(self, ln, msg): """ Produces a warning message for the specified text Parameters: - 'ln' *string* - The language to display the interface in - 'msg' *string* - The message to display """ # load the right message language _ = gettext_set_language(ln) return """
    %s
    """ % msg def tmpl_page_interface(self, ln, docname, actname, curpage, nbpages, file, nextPg, access, nbPg, doctype, act, indir, fields, javascript, mainmenu): """ Produces a page with the specified fields (in the submit chain) Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The document type - 'docname' *string* - The document type name - 'actname' *string* - The action name - 'act' *string* - The action - 'curpage' *int* - The current page of submitting engine - 'nbpages' *int* - The total number of pages - 'nextPg' *int* - The next page - 'access' *string* - The submission number - 'nbPg' *string* - ?? - 'indir' *string* - the directory of submitting - 'fields' *array* - the fields to display in the page, with each record having the structure: - 'fullDesc' *string* - the description of the field - 'text' *string* - the HTML code of the field - 'javascript' *string* - if the field has some associated javascript code - 'type' *string* - the type of field (T, F, I, H, D, S, R) - 'name' *string* - the name of the field - 'rows' *string* - the number of rows for textareas - 'cols' *string* - the number of columns for textareas - 'val' *string* - the default value of the field - 'size' *string* - the size for text fields - 'maxlength' *string* - the maximum length for text fields - 'htmlcode' *string* - the complete HTML code for user-defined fields - 'typename' *string* - the long name of the type - 'javascript' *string* - the javascript code to insert in the page - 'mainmenu' *string* - the url of the main menu """ # load the right message language _ = gettext_set_language(ln) # top menu out = """
    \n" # Display the navigation cell # Display "previous page" navigation arrows out += """
    %(docname)s   %(actname)s  """ % { 'docname' : docname, 'actname' : actname, } for i in range(1, nbpages+1): if i == int(curpage): out += """""" % curpage else: out += """""" % (i, i) out += """
       page: %s  %s   
     %(summary)s(2) 

    """ % { 'summary' : _("SUMMARY"), 'doctype' : doctype, 'act' : act, 'access' : access, 'indir' : indir, 'file' : file, 'nextPg' : nextPg, 'curpage' : curpage, 'nbPg' : nbPg, 'ln' : ln, } for field in fields: if field['javascript']: out += """ """ % field['javascript'] # now displays the html form field(s) out += "%s\n%s\n" % (field['fullDesc'], field['text']) out += javascript out += "
     
     
    """ if int(curpage) != 1: out += """ """ % { 'prpage' : int(curpage) - 1, 'images' : CFG_SITE_URL + '/img', 'prevpage' : _("Previous page"), } else: out += """ """ # Display the submission number out += """ \n""" % { 'submission' : _("Submission number") + '(1)', 'access' : access, } # Display the "next page" navigation arrow if int(curpage) != int(nbpages): out += """ """ % { 'nxpage' : int(curpage) + 1, 'images' : CFG_SITE_URL + '/img', 'nextpage' : _("Next page"), } else: out += """ """ out += """
      %(prevpage)s %(prevpage)s  %(submission)s: %(access)s %(nextpage)s %(nextpage)s  


    %(back)s


    %(take_note)s
    %(explain_summary)s
    """ % { 'surequit' : _("Are you sure you want to quit this submission?"), 'back' : _("Back to main menu"), 'mainmenu' : mainmenu, 'images' : CFG_SITE_URL + '/img', 'take_note' : '(1) ' + _("This is your submission access number. It can be used to continue with an interrupted submission in case of problems."), 'explain_summary' : '(2) ' + _("Mandatory fields appear in red in the SUMMARY window."), } return out def tmpl_submit_field(self, ln, field): """ Produces the HTML code for the specified field Parameters: - 'ln' *string* - The language to display the interface in - 'field' *array* - the field to display in the page, with the following structure: - 'javascript' *string* - if the field has some associated javascript code - 'type' *string* - the type of field (T, F, I, H, D, S, R) - 'name' *string* - the name of the field - 'rows' *string* - the number of rows for textareas - 'cols' *string* - the number of columns for textareas - 'val' *string* - the default value of the field - 'size' *string* - the size for text fields - 'maxlength' *string* - the maximum length for text fields - 'htmlcode' *string* - the complete HTML code for user-defined fields - 'typename' *string* - the long name of the type """ # load the right message language _ = gettext_set_language(ln) # If the field is a textarea if field['type'] == 'T': ## Field is a textarea: text = "" \ % (field['name'], field['rows'], field['cols'], cgi.escape(str(field['val']), 1)) # If the field is a file upload elif field['type'] == 'F': ## the field is a file input: text = """""" \ % (field['name'], field['size'], "%s" \ % ((field['maxlength'] in (0, None) and " ") or (""" maxlength="%s\"""" % field['maxlength'])) ) # If the field is a text input elif field['type'] == 'I': ## Field is a text input: text = """""" \ % (field['name'], field['size'], field['val'], "%s" \ % ((field['maxlength'] in (0, None) and " ") or (""" maxlength="%s\"""" % field['maxlength'])) ) # If the field is a hidden input elif field['type'] == 'H': text = "" % (field['name'], field['val']) # If the field is user-defined elif field['type'] == 'D': text = field['htmlcode'] # If the field is a select box elif field['type'] == 'S': text = field['htmlcode'] # If the field type is not recognized else: text = "%s: unknown field type" % field['typename'] return text def tmpl_page_interface_js(self, ln, upload, field, fieldhtml, txt, check, level, curdir, values, select, radio, curpage, nbpages, returnto): """ Produces the javascript for validation and value filling for a submit interface page Parameters: - 'ln' *string* - The language to display the interface in - 'upload' *array* - booleans if the field is a field - 'field' *array* - the fields' names - 'fieldhtml' *array* - the fields' HTML representation - 'txt' *array* - the fields' long name - 'check' *array* - if the fields should be checked (in javascript) - 'level' *array* - strings, if the fields should be filled (M) or not (O) - 'curdir' *array* - the current directory of the submission - 'values' *array* - the current values of the fields - 'select' *array* - booleans, if the controls are "select" controls - 'radio' *array* - booleans, if the controls are "radio" controls - 'curpage' *int* - the current page - 'nbpages' *int* - the total number of pages - 'returnto' *array* - a structure with 'field' and 'page', if a mandatory field on antoher page was not completed """ # load the right message language _ = gettext_set_language(ln) nbFields = len(upload) # if there is a file upload field, we change the encoding type out = """""" return out def tmpl_page_endaction(self, ln, file, nextPg, startPg, access, curpage, nbPg, nbpages, doctype, act, docname, actname, indir, mainmenu, finished, function_content, next_action): """ Produces the pages after all the fields have been submitted. Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The document type - 'act' *string* - The action - 'docname' *string* - The document type name - 'actname' *string* - The action name - 'curpage' *int* - The current page of submitting engine - 'startPg' *int* - The start page - 'nextPg' *int* - The next page - 'access' *string* - The submission number - 'nbPg' *string* - total number of pages - 'nbpages' *string* - number of pages (?) - 'indir' *string* - the directory of submitting - 'file' *string* - ?? - 'mainmenu' *string* - the url of the main menu - 'finished' *bool* - if the submission is finished - 'function_content' *string* - HTML code produced by some function executed - 'next_action' *string* - if there is another action to be completed, the HTML code for linking to it """ # load the right message language _ = gettext_set_language(ln) out = """
    """ % { 'finished' : _("finished!"), } else: for i in range(1, nbpages + 1): out += """""" % (i,i) out += """
    %(docname)s   %(actname)s  """ % { 'file' : file, 'nextPg' : nextPg, 'startPg' : startPg, 'access' : access, 'curpage' : curpage, 'nbPg' : nbPg, 'doctype' : doctype, 'act' : act, 'docname' : docname, 'actname' : actname, 'indir' : indir, 'mainmenu' : mainmenu, 'ln' : ln, } if finished == 1: out += """
      %(finished)s   
       %s %(end_action)s  
     %(summary)s(2) """ % { 'end_action' : _("end of action"), 'summary' : _("SUMMARY"), 'doctype' : doctype, 'act' : act, 'access' : access, 'indir' : indir, 'ln' : ln, } out += """

    %(function_content)s %(next_action)s

    """ % { 'function_content' : function_content, 'next_action' : next_action, } if finished == 0: out += """%(submission)s²: %(access)s""" % { 'submission' : _("Submission no"), 'access' : access, } else: out += " \n" out += """


    """ # Add the "back to main menu" button if finished == 0: out += """ %(back)s

    """ % { 'surequit' : _("Are you sure you want to quit this submission?"), 'back' : _("Back to main menu"), 'images' : CFG_SITE_URL + '/img', 'mainmenu' : mainmenu } else: out += """ %(back)s

    """ % { 'back' : _("Back to main menu"), 'images' : CFG_SITE_URL + '/img', 'mainmenu' : mainmenu, } return out def tmpl_function_output(self, ln, display_on, action, doctype, step, functions): """ Produces the output of the functions. Parameters: - 'ln' *string* - The language to display the interface in - 'display_on' *bool* - If debug information should be displayed - 'doctype' *string* - The document type - 'action' *string* - The action - 'step' *int* - The current step in submission - 'functions' *aray* - HTML code produced by functions executed and informations about the functions - 'name' *string* - the name of the function - 'score' *string* - the score of the function - 'error' *bool* - if the function execution produced errors - 'text' *string* - the HTML code produced by the function """ # load the right message language _ = gettext_set_language(ln) out = "" if display_on: out += """

    %(function_list)s

    """ % { 'function_list' : _("Here is the %(x_action)s function list for %(x_doctype)s documents at level %(x_step)s") % { 'x_action' : action, 'x_doctype' : doctype, 'x_step' : step, }, 'function' : _("Function"), 'score' : _("Score"), 'running' : _("Running function"), } for function in functions: out += """""" % { 'name' : function['name'], 'score' : function['score'], 'result' : function['error'] and (_("Function %s does not exist.") % function['name'] + "
    ") or function['text'] } out += "
    %(function)s%(score)s%(running)s
    %(name)s%(score)s%(result)s
    " else: for function in functions: if not function['error']: out += function['text'] return out def tmpl_next_action(self, ln, actions): """ Produces the output of the functions. Parameters: - 'ln' *string* - The language to display the interface in - 'actions' *array* - The actions to display, in the structure - 'page' *string* - the starting page - 'action' *string* - the action (in terms of submission) - 'doctype' *string* - the doctype - 'nextdir' *string* - the path to the submission data - 'access' *string* - the submission number - 'indir' *string* - ?? - 'name' *string* - the name of the action """ # load the right message language _ = gettext_set_language(ln) out = "

    %(haveto)s

      " % { 'haveto' : _("You must now"), } i = 0 for action in actions: if i > 0: out += " " + _("or") + " " i += 1 out += """
    • %(name)s
    • """ % action out += "
    " return out def tmpl_filelist(self, ln, filelist='', recid='', docname='', version=''): """ Displays the file list for a record. Parameters: - 'ln' *string* - The language to display the interface in - 'recid' *int* - The record id - 'docname' *string* - The document name - 'version' *int* - The version of the document - 'filelist' *string* - The HTML string of the filelist (produced by the BibDoc classes) """ # load the right message language _ = gettext_set_language(ln) title = _("record") + ' #' + '%s' % (CFG_SITE_URL, recid, recid) if docname != "": title += ' ' + _("document") + ' #' + str(docname) if version != "": title += ' ' + _("version") + ' #' + str(version) out = """
    %s
    """ % (filelist) return out def tmpl_bibrecdoc_filelist(self, ln, types, verbose_files=''): """ Displays the file list for a record. Parameters: - 'ln' *string* - The language to display the interface in - 'types' *array* - The different types to display, each record in the format: - 'name' *string* - The name of the format - 'content' *array of string* - The HTML code produced by tmpl_bibdoc_filelist, for the right files - 'verbose_files' - A string representing in a verbose way the file information. """ # load the right message language _ = gettext_set_language(ln) out = "" for mytype in types: out += "%s %s:" % (mytype['name'], _("file(s)")) out += "
      " for content in mytype['content']: out += content out += "
    " if verbose_files: out += "
    %s
    " % verbose_files return out def tmpl_bibdoc_filelist(self, ln, versions=[], imageurl='', recid='', docname=''): """ Displays the file list for a record. Parameters: - 'ln' *string* - The language to display the interface in - 'versions' *array* - The different versions to display, each record in the format: - 'version' *string* - The version - 'content' *string* - The HTML code produced by tmpl_bibdocfile_filelist, for the right file - 'previous' *bool* - If the file has previous versions - 'imageurl' *string* - The URL to the file image - 'recid' *int* - The record id - 'docname' *string* - The name of the document """ # load the right message language _ = gettext_set_language(ln) out = """""" % { 'imageurl' : imageurl, 'docname' : docname } for version in versions: if version['previous']: versiontext = """
    (%(see)s %(previous)s)""" % { 'see' : _("see"), 'siteurl' : CFG_SITE_URL, 'docname' : urllib.quote(docname), 'recID': recid, 'previous': _("previous"), 'ln_link': (ln != CFG_SITE_LANG and '&ln=' + ln) or '', } else: versiontext = "" out += """" out += "" return out def tmpl_bibdocfile_filelist(self, ln, recid, name, version, format, size): """ Displays a file in the file list. Parameters: - 'ln' *string* - The language to display the interface in - 'recid' *int* - The id of the record - 'name' *string* - The name of the file - 'version' *string* - The version - 'format' *string* - The display format - 'size' *string* - The size of the file """ # load the right message language _ = gettext_set_language(ln) return """ %(name)s%(format)s [%(size)s B] """ % { 'siteurl' : CFG_SITE_URL, 'recid' : recid, 'quoted_name' : urllib.quote(name), 'name' : name, 'version' : version, 'name' : name, 'quoted_format' : urllib.quote(format), 'format' : format, 'size' : size } def tmpl_submit_summary (self, ln, values): """ Displays the summary for the submit procedure. Parameters: - 'ln' *string* - The language to display the interface in - 'values' *array* - The values of submit. Each of the records contain the following fields: - 'name' *string* - The name of the field - 'mandatory' *bool* - If the field is mandatory or not - 'value' *string* - The inserted value - 'page' *int* - The submit page on which the field is entered """ # load the right message language _ = gettext_set_language(ln) out = """""" % \ { 'images' : CFG_SITE_URL + '/img' } for value in values: if value['mandatory']: color = "red" else: color = "" out += """""" % { 'color' : color, 'name' : value['name'], 'value' : value['value'], 'page' : value['page'], 'ln' : ln } out += "
    %(name)s %(value)s
    " return out def tmpl_yoursubmissions(self, ln, order, doctypes, submissions): """ Displays the list of the user's submissions. Parameters: - 'ln' *string* - The language to display the interface in - 'order' *string* - The ordering parameter - 'doctypes' *array* - All the available doctypes, in structures: - 'id' *string* - The doctype id - 'name' *string* - The display name of the doctype - 'selected' *bool* - If the doctype should be selected - 'submissions' *array* - The available submissions, in structures: - 'docname' *string* - The document name - 'actname' *string* - The action name - 'status' *string* - The status of the document - 'cdate' *string* - Creation date - 'mdate' *string* - Modification date - 'id' *string* - The id of the submission - 'reference' *string* - The display name of the doctype - 'pending' *bool* - If the submission is pending - 'act' *string* - The action code - 'doctype' *string* - The doctype code """ # load the right message language _ = gettext_set_language(ln) out = "" out += """
    " return out def tmpl_yourapprovals(self, ln, referees): """ Displays the doctypes and categories for which the user is referee Parameters: - 'ln' *string* - The language to display the interface in - 'referees' *array* - All the doctypes for which the user is referee: - 'doctype' *string* - The doctype - 'docname' *string* - The display name of the doctype - 'categories' *array* - The specific categories for which the user is referee: - 'id' *string* - The category id - 'name' *string* - The display name of the category """ # load the right message language _ = gettext_set_language(ln) out = """ " out += '''

    To see the status of documents for which approval has been requested, click here

    ''' % {'url' : CFG_SITE_URL} return out def tmpl_publiline_selectdoctype(self, ln, docs): """ Displays the doctypes that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'docs' *array* - All the doctypes that the user can select: - 'doctype' *string* - The doctype - 'docname' *string* - The display name of the doctype """ # load the right message language _ = gettext_set_language(ln) out = """ %s""" % (ln, _("Go to specific approval workflow")) return out def tmpl_publiline_selectcplxdoctype(self, ln, docs): """ Displays the doctypes that the user can select in a complex workflow Parameters: - 'ln' *string* - The language to display the interface in - 'docs' *array* - All the doctypes that the user can select: - 'doctype' *string* - The doctype - 'docname' *string* - The display name of the doctype """ # load the right message language _ = gettext_set_language(ln) out = """
    """ return out def tmpl_publiline_selectcateg(self, ln, doctype, title, categories): """ Displays the categories from a doctype that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categories' *array* - All the categories that the user can select: - 'id' *string* - The id of the category - 'waiting' *int* - The number of documents waiting - 'approved' *int* - The number of approved documents - 'rejected' *int* - The number of rejected documents """ # load the right message language _ = gettext_set_language(ln) out = """ """ % { 'key' : _("Key"), 'pending' : _("Pending"), 'images' : CFG_SITE_URL + '/img', 'waiting' : _("Waiting for approval"), 'approved' : _("Approved"), 'already_approved' : _("Already approved"), 'rejected' : _("Rejected"), 'rejected_text' : _("Rejected"), 'somepending' : _("Some documents are pending."), } return out def tmpl_publiline_selectcplxcateg(self, ln, doctype, title, types): """ Displays the categories from a doctype that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categories' *array* - All the categories that the user can select: - 'id' *string* - The id of the category - 'waiting' *int* - The number of documents waiting - 'approved' *int* - The number of approved documents - 'rejected' *int* - The number of rejected documents """ # load the right message language _ = gettext_set_language(ln) out = "" #out = """ # # # # #
    # # """ % { # 'title' : title, # 'list_type' : _("List of specific approvals"), # } columns = [] columns.append ({'apptype' : 'RRP', 'list_categ' : _("List of refereing categories"), 'id_form' : 0, }) #columns.append ({'apptype' : 'RPB', # 'list_categ' : _("List of publication categories"), # 'id_form' : 1, # }) #columns.append ({'apptype' : 'RDA', # 'list_categ' : _("List of direct approval categories"), # 'id_form' : 2, # }) for column in columns: out += """ """ # Key out += """ """ % { 'key' : _("Key"), 'pending' : _("Pending"), 'images' : CFG_SITE_URL + '/img', 'waiting' : _("Waiting for approval"), 'approved' : _("Approved"), 'already_approved' : _("Already approved"), 'rejected' : _("Rejected"), 'rejected_text' : _("Rejected"), 'cancelled' : _("Cancelled"), 'cancelled_text' : _("Cancelled"), 'somepending' : _("Some documents are pending."), } return out def tmpl_publiline_selectdocument(self, ln, doctype, title, categ, docs): """ Displays the documents that the user can select in the specified category Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categ' *string* - the category - 'docs' *array* - All the categories that the user can select: - 'RN' *string* - The id of the document - 'status' *string* - The status of the document """ # load the right message language _ = gettext_set_language(ln) out = """ """ return out def tmpl_publiline_selectcplxdocument(self, ln, doctype, title, categ, categname, docs, apptype): """ Displays the documents that the user can select in the specified category Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'title' *string* - The doctype name - 'categ' *string* - the category - 'docs' *array* - All the categories that the user can select: - 'RN' *string* - The id of the document - 'status' *string* - The status of the document - 'apptype' *string* - the approval type """ # load the right message language _ = gettext_set_language(ln) listtype = "" if apptype == "RRP": listtype = _("List of refereed documents") elif apptype == "RPB": listtype = _("List of publication documents") elif apptype == "RDA": listtype = _("List of direct approval documents") out = """ """ return out def tmpl_publiline_displaydoc(self, ln, doctype, docname, categ, rn, status, dFirstReq, dLastReq, dAction, access, confirm_send, auth_code, auth_message, authors, title, sysno, newrn): """ Displays the categories from a doctype that the user can select Parameters: - 'ln' *string* - The language to display the interface in - 'doctype' *string* - The doctype - 'docname' *string* - The doctype name - 'categ' *string* - the category - 'rn' *string* - The document RN (id number) - 'status' *string* - The status of the document - 'dFirstReq' *string* - The date of the first approval request - 'dLastReq' *string* - The date of the last approval request - 'dAction' *string* - The date of the last action (approval or rejection) - 'confirm_send' *bool* - must display a confirmation message about sending approval email - 'auth_code' *bool* - authorised to referee this document - 'auth_message' *string* - ??? - 'authors' *string* - the authors of the submission - 'title' *string* - the title of the submission - 'sysno' *string* - the unique database id for the record - 'newrn' *string* - the record number assigned to the submission """ # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ return out def tmpl_publiline_displaycplxdoc(self, ln, doctype, docname, categ, rn, apptype, status, dates, isPubCom, isEdBoard, isReferee, isProjectLeader, isAuthor, authors, title, sysno, newrn): # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') elif status == "cancelled": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ return out def tmpl_publiline_displaycplxdocitem(self, doctype, categ, rn, apptype, action, comments, (user_can_view_comments, user_can_add_comment, user_can_delete_comment), selected_category, selected_topic, selected_group_id, comment_subject, comment_body, ln): _ = gettext_set_language(ln) if comments and user_can_view_comments: comments_text = '' comments_overview = '
      ' for comment in comments: (cmt_uid, cmt_nickname, cmt_title, cmt_body, cmt_date, cmt_priority, cmtid) = comment comments_overview += '
    • %s - %s (%s)
    • ' % (cmtid, cmt_nickname, cmt_title, convert_datetext_to_dategui (cmt_date)) comments_text += """
      %s - %s (%s)ReplyTop
      %s
      """ % (cmtid, cmt_nickname, cmt_title, convert_datetext_to_dategui (cmt_date), CFG_SITE_URL, doctype, apptype, categ, rn, cmt_uid, ln, email_quoted_txt2html(cmt_body)) comments_overview += '
    ' else: comments_text = '' comments_overview = 'None.' body = '' if user_can_view_comments: body += """

    %(comments_label)s

    """ if user_can_view_comments: body += """%(comments)s""" if user_can_add_comment: validation = """ """ % {'button_label': _("Add Comment")} body += self.tmpl_publiline_displaywritecomment (doctype, categ, rn, apptype, action, _("Add Comment"), comment_subject, validation, comment_body, ln) body %= { 'comments_label': _("Comments"), 'action': action, 'button_label': _("Write a comment"), 'comments': comments_text} content = '
    ' out = """

    %(comments_overview_label)s

    %(comments_overview)s
    %(body)s
    """ % { 'comments_overview_label' : _('Comments overview'), 'comments_overview' : comments_overview, 'body' : body,} return out def tmpl_publiline_displaywritecomment(self, doctype, categ, rn, apptype, action, write_label, title, validation, reply_message, ln): _ = gettext_set_language(ln) return """

    %(write_label)s

    %(title_label)s:

    %(comment_label)s:


    %(validation)s
    """ % {'write_label': write_label, 'title_label': _("Title"), 'title': title, 'comment_label': _("Comment"), 'rn' : rn, 'categ' : categ, 'doctype' : doctype, 'apptype' : apptype, 'action' : action, 'validation' : validation, 'reply_message' : reply_message, 'ln' : ln, } def tmpl_publiline_displaydocplxaction(self, ln, doctype, categ, rn, apptype, action, status, authors, title, sysno, subtitle1, email_user_pattern, stopon1, users, extrausers, stopon2, subtitle2, usersremove, stopon3, validate_btn): # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ if ((apptype == "RRP") or (apptype == "RPB")) and ((action == "EdBoardSel") or (action == "RefereeSel")): out += """ """ if action == "EdBoardSel": out += """ """ if validate_btn != "": out += """
    """ % { 'rn' : rn, 'categ' : categ, 'doctype' : doctype, 'apptype' : apptype, 'action' : action, 'validate_btn' : validate_btn, 'ln': ln, } return out def tmpl_publiline_displaycplxrecom(self, ln, doctype, categ, rn, apptype, action, status, authors, title, sysno, msg_to, msg_to_group, msg_subject): # load the right message language _ = gettext_set_language(ln) if status == "waiting": image = """""" % (CFG_SITE_URL + '/img') elif status == "approved": image = """""" % (CFG_SITE_URL + '/img') elif status == "rejected": image = """""" % (CFG_SITE_URL + '/img') else: image = "" out = """ """ # escape forbidden character msg_to = escape_html(msg_to) msg_to_group = escape_html(msg_to_group) msg_subject = escape_html(msg_subject) write_box = """
    """ if msg_to != "": addr_box = """ """ % {'users_label': _("User"), 'to_users' : msg_to, } if msg_to_group != "": addr_box += """ """ % {'groups_label': _("Group"), 'to_groups': msg_to_group, } elif msg_to_group != "": addr_box = """ """ % {'groups_label': _("Group"), 'to_groups': msg_to_group, } else: addr_box = """ """ write_box += addr_box write_box += """
    %(to_label)s%(users_label)s %(to_users)s
      %(groups_label)s %(to_groups)s%(groups_label)s %(to_groups)s   
         
    %(subject_label)s
    %(message_label)s
    """ write_box = write_box % {'rn' : rn, 'categ' : categ, 'doctype' : doctype, 'apptype' : apptype, 'action' : action, 'subject' : msg_subject, 'to_label': _("To:"), 'subject_label': _("Subject:"), 'message_label': _("Message:"), 'send_label': _("SEND"), 'ln': ln, } out += write_box return out def displaycplxdoc_displayauthaction(action, linkText): return """ (%(linkText)s)""" % { "action" : action, "linkText" : linkText }