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)s:
%(please_select)s:
""" % {
'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
"
out += self.tmpl_submit_home_catalogs_sub(ln, catalog)
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 += "
\n"
if len(catalog['docs']) != 0:
for row in catalog['docs']:
out += self.tmpl_submit_home_catalogs_doctype(ln, row)
if len(catalog['sons']) != 0:
for row in catalog['sons']:
out += self.tmpl_submit_home_catalogs_sub(ln, row)
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 """
""" % 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' : _("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 = """
%(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 = """
"""
# Add the "back to main menu" button
if finished == 0:
out += """
""" % {
'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' : _("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)s
%(score)s
%(running)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)s
%(score)s
%(result)s
""" % {
'name' : function['name'],
'score' : function['score'],
'result' : function['error'] and (_("Function %s does not exist.") % function['name'] + " ") or function['text']
}
out += "
"
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 += """
"
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 = """
%(docname)s
""" % {
'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 += """
%(version)s %(ver)s%(text)s
""" % {
'version' : _("version"),
'ver' : version['version'],
'text' : versiontext,
}
for content in version['content']:
out += content
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 """
""" % {
'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 += """
"
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 = """
%(refdocs)s
""" % {
'refdocs' : _("Refereed Documents"),
}
for doctype in referees:
out += """
%(docname)s
""" % doctype
if doctype ['categories'] is None:
out += '''
''' % {
'docname' : doctype['docname'],
'doctype' : doctype['doctype'],
'generalref' : _("You are a general referee"),
'ln_link': (ln != CFG_SITE_LANG and '&ln=' + ln) or ''}
else:
for category in doctype['categories']:
out += """
""" % {
'referee' : _("You are a referee for category:") + ' ' + str(category['name']) + ' (' + str(category['id']) + ')',
'doctype' : doctype['doctype'],
'categ' : category['id'],
'ln_link': (ln != CFG_SITE_LANG and '&ln=' + ln) or ''}
out += "
"
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 = """
%(list)s
%(select)s:
""" % {
'list' : _("List of refereed types of documents"),
'select' : _("Select one of the following types of documents to check the documents status"),
}
for doc in docs:
params = {'ln' : ln}
params.update(doc)
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 = """
%(list)s
%(select)s:
""" % {
'list' : _("List of refereed types of documents"),
'select' : _("Select one of the following types of documents to check the documents status"),
}
for doc in docs:
params = {'ln' : ln}
params.update(doc)
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 = """
%(title)s: %(list_categ)s
%(choose_categ)s
""" % {
'title' : title,
'doctype' : doctype,
'list_categ' : _("List of refereed categories"),
'choose_categ' : _("Please choose a category"),
'ln' : ln,
}
for categ in categories:
num = categ['waiting'] + categ['approved'] + categ['rejected']
if categ['waiting'] != 0:
classtext = "class=\"blocknote\""
else:
classtext = ""
out += """%(id)s (%(num)s document(s)""" % {
'id' : categ['id'],
'classtext' : classtext,
'num' : num,
}
if categ['waiting'] != 0:
out += """| %(waiting)s """ % {
'waiting' : categ['waiting'],
'pending' : _("Pending"),
'images' : CFG_SITE_URL + '/img',
}
if categ['approved'] != 0:
out += """| %(approved)s""" % {
'approved' : categ['approved'],
'approved_text' : _("Approved"),
'images' : CFG_SITE_URL + '/img',
}
if categ['rejected'] != 0:
out += """| %(rejected)s""" % {
'rejected' : categ['rejected'],
'rejected_text' : _("Rejected"),
'images' : CFG_SITE_URL + '/img',
}
out += ") "
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)s: %(list_type)s
#
#
#
#
""" % {
# '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 += """
%(list_categ)s
%(choose_categ)s
""" % {
'doctype' : doctype,
'apptype' : column['apptype'],
'list_categ' : column['list_categ'],
'choose_categ' : _("Please choose a category"),
'ln' : ln,
}
for categ in types[column['apptype']]:
num = categ['waiting'] + categ['approved'] + categ['rejected'] + categ['cancelled']
if categ['waiting'] != 0:
classtext = "class=\"blocknote\""
else:
classtext = ""
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 = """
%(title)s - %(categ)s: %(list)s
%(choose_report)s
%(report_no)s
%(pending)s
%(approved)s
%(rejected)s
""" % {
'doctype' : doctype,
'title' : title,
'categ' : categ,
'list' : _("List of refereed documents"),
'choose_report' : _("Click on a report number for more information."),
'report_no' : _("Report Number"),
'pending' : _("Pending"),
'approved' : _("Approved"),
'rejected' : _("Rejected"),
'ln': ln,
}
for doc in docs:
status = doc ['status']
if status == "waiting":
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 = """
%(title)s - %(categname)s: %(list)s
%(choose_report)s
%(report_no)s
%(pending)s
%(approved)s
%(rejected)s
%(cancelled)s
""" % {
'doctype' : doctype,
'title' : title,
'categname' : categname,
'categ' : categ,
'list' : listtype,
'choose_report' : _("Click on a report number for more information."),
'apptype' : apptype,
'report_no' : _("Report Number"),
'pending' : _("Pending"),
'approved' : _("Approved"),
'rejected' : _("Rejected"),
'cancelled' : _("Cancelled"),
'ln': ln,
}
for doc in docs:
status = doc ['status']
if status == "waiting":
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 = """
%(image)s %(rn)s
""" % {
'image' : image,
'rn' : rn,
}
if confirm_send:
out += """%(requestsent)s
""" % {
'requestsent' : _("Your request has been sent to the referee."),
}
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 = """