diff --git a/modules/websubmit/web/yourapprovals.py b/modules/websubmit/web/yourapprovals.py new file mode 100644 index 000000000..d205862e4 --- /dev/null +++ b/modules/websubmit/web/yourapprovals.py @@ -0,0 +1,102 @@ +## $Id$ + +## This file is part of the CERN Document Server Software (CDSware). +## Copyright (C) 2002 CERN. +## +## The CDSware 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. +## +## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + + + +## read config variables: +#include "config.wml" +#include "configbis.wml" + +pylibdir = "<LIBDIR>/python" +<protect> +## $Id$ +## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. + +## import interesting modules: +import os +import sys +sys.path.append('%s' % pylibdir) +from cdsware.config import weburl,cdsname,cdslang +from cdsware.dbquery import run_sql +from cdsware.access_control_engine import acc_authorize_action +from cdsware.access_control_admin import * +from cdsware.webpage import page, create_error_box +from cdsware.webuser import getUid, get_email, list_registered_users +from cdsware.messages import * +from cdsware.websubmit_config import * +from cdsware.search_engine import search_pattern + +def index(req,c=cdsname,ln=cdslang,order="",doctype="",deletedId="",deletedAction="",deletedDoctype=""): + global uid + ln = wash_language(ln) + t="" + # get user ID: + try: + uid = getUid(req) + u_email = get_email(uid) + except MySQLdb.Error, e: + return errorMsg(e.value,req) + t+=""" + <table class="searchbox" width="100%" summary=""> + <tr> + <th class="portalboxheader">Refereed Documents</th> + </tr> + <tr> + <td class=\"portalboxbody\">""" + res = run_sql("select sdocname,ldocname from sbmDOCTYPE") + for row in res: + doctype = row[0] + docname = row[1] + reftext = "" + if isReferee(uid,doctype,"*"): + reftext+= "<LI><A HREF=\"publiline.py?doctype=%s\">You are general referee</a><br>" % doctype + res2 = run_sql("select sname,lname from sbmCATEGORIES where doctype=%s",(doctype,)) + for row2 in res2: + category = row2[0] + categname = row2[1] + if isReferee(uid,doctype,category): + reftext+= "<LI><A HREF=\"publiline.py?doctype=%s&categ=%s\">You are referee for category: %s (%s)</a><br>" % (doctype,category,categname,category) + if reftext != "": + t+= "<UL><LI><b>%s</b><UL><small>" % docname + t+=reftext + t+="</small></UL></UL>" + t+="</td></tr></table>" + return page(title="Your Approvals", + navtrail="""<a class="navtrail" href="%s/youraccount.py/display">Your Account</a>""" % weburl, + body=t, + description="", + keywords="", + uid=uid, + language=ln, + urlargs=req.args) + +def isReferee(uid,doctype="",categ=""): + if acc_authorize_action(uid, "referee",verbose=0,doctype=doctype, categ=categ): + return 1 + else: + return 0 + +def errorMsg(title,req,c=cdsname,ln=cdslang): + return page(title="error", + body = create_error_box(req, title=title,verbose=0, ln=ln), + description="%s - Internal Error" % c, + keywords="%s, CDSware, Internal Error" % c, + language=ln, + urlargs=req.args) +</protect> diff --git a/modules/websubmit/web/yourapprovals.py.wml b/modules/websubmit/web/yourapprovals.py.wml new file mode 100644 index 000000000..d205862e4 --- /dev/null +++ b/modules/websubmit/web/yourapprovals.py.wml @@ -0,0 +1,102 @@ +## $Id$ + +## This file is part of the CERN Document Server Software (CDSware). +## Copyright (C) 2002 CERN. +## +## The CDSware 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. +## +## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + + + +## read config variables: +#include "config.wml" +#include "configbis.wml" + +pylibdir = "<LIBDIR>/python" +<protect> +## $Id$ +## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. + +## import interesting modules: +import os +import sys +sys.path.append('%s' % pylibdir) +from cdsware.config import weburl,cdsname,cdslang +from cdsware.dbquery import run_sql +from cdsware.access_control_engine import acc_authorize_action +from cdsware.access_control_admin import * +from cdsware.webpage import page, create_error_box +from cdsware.webuser import getUid, get_email, list_registered_users +from cdsware.messages import * +from cdsware.websubmit_config import * +from cdsware.search_engine import search_pattern + +def index(req,c=cdsname,ln=cdslang,order="",doctype="",deletedId="",deletedAction="",deletedDoctype=""): + global uid + ln = wash_language(ln) + t="" + # get user ID: + try: + uid = getUid(req) + u_email = get_email(uid) + except MySQLdb.Error, e: + return errorMsg(e.value,req) + t+=""" + <table class="searchbox" width="100%" summary=""> + <tr> + <th class="portalboxheader">Refereed Documents</th> + </tr> + <tr> + <td class=\"portalboxbody\">""" + res = run_sql("select sdocname,ldocname from sbmDOCTYPE") + for row in res: + doctype = row[0] + docname = row[1] + reftext = "" + if isReferee(uid,doctype,"*"): + reftext+= "<LI><A HREF=\"publiline.py?doctype=%s\">You are general referee</a><br>" % doctype + res2 = run_sql("select sname,lname from sbmCATEGORIES where doctype=%s",(doctype,)) + for row2 in res2: + category = row2[0] + categname = row2[1] + if isReferee(uid,doctype,category): + reftext+= "<LI><A HREF=\"publiline.py?doctype=%s&categ=%s\">You are referee for category: %s (%s)</a><br>" % (doctype,category,categname,category) + if reftext != "": + t+= "<UL><LI><b>%s</b><UL><small>" % docname + t+=reftext + t+="</small></UL></UL>" + t+="</td></tr></table>" + return page(title="Your Approvals", + navtrail="""<a class="navtrail" href="%s/youraccount.py/display">Your Account</a>""" % weburl, + body=t, + description="", + keywords="", + uid=uid, + language=ln, + urlargs=req.args) + +def isReferee(uid,doctype="",categ=""): + if acc_authorize_action(uid, "referee",verbose=0,doctype=doctype, categ=categ): + return 1 + else: + return 0 + +def errorMsg(title,req,c=cdsname,ln=cdslang): + return page(title="error", + body = create_error_box(req, title=title,verbose=0, ln=ln), + description="%s - Internal Error" % c, + keywords="%s, CDSware, Internal Error" % c, + language=ln, + urlargs=req.args) +</protect> diff --git a/modules/websubmit/web/yoursubmissions.py b/modules/websubmit/web/yoursubmissions.py index 26605fa49..9560c5ede 100644 --- a/modules/websubmit/web/yoursubmissions.py +++ b/modules/websubmit/web/yoursubmissions.py @@ -1,211 +1,212 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 CERN. ## ## The CDSware 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. ## ## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## read config variables: #include "config.wml" #include "configbis.wml" pylibdir = "<LIBDIR>/python" <protect> ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. ## import interesting modules: import string import os import sys import time import types import re import MySQLdb import shutil import operator sys.path.append('%s' % pylibdir) -from cdsware.config import cdsname,cdslang +from cdsware.config import weburl,cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, list_registered_users from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern def index(req,c=cdsname,ln=cdslang,order="",doctype="",deletedId="",deletedAction="",deletedDoctype=""): global uid ln = wash_language(ln) t="" # get user ID: try: uid = getUid(req) u_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) if deletedId != "": t+=deleteSubmission(deletedId,deletedAction,deletedDoctype,u_email) t+=""" <BR> <SMALL> <form> <input type=hidden value='%s' name=order>""" % order t+=""" <input type=hidden name=deletedId> <input type=hidden name=deletedDoctype> <input type=hidden name=deletedAction> <table class="searchbox" width="100%" summary=""> <tr> <th class="portalboxheader">For """ t+="<select name=doctype onchange=\"document.forms[0].submit();\"><option value=\"\">all types of document" res = run_sql("select ldocname,sdocname from sbmDOCTYPE order by ldocname") for row in res: if doctype==row[1]: t+="<option value=%s selected>%s" % (row[1],row[0]) else: t+="<option value=%s>%s" % (row[1],row[0]) t+="</th></tr><tr><td class=\"portalboxbody\">\n" t+="<table><tr><td></td></tr>" # request order default value reqorder = "sbmSUBMISSIONS.md DESC, lactname" # requested value if order == "actiondown": reqorder = "lactname ASC, sbmSUBMISSIONS.md DESC" elif order == "actionup": reqorder = "lactname DESC, sbmSUBMISSIONS.md DESC" elif order == "refdown": reqorder = "reference ASC, sbmSUBMISSIONS.md DESC, lactname DESC" elif order == "refup": reqorder = "reference DESC, sbmSUBMISSIONS.md DESC, lactname DESC" elif order == "cddown": reqorder = "sbmSUBMISSIONS.cd DESC, lactname" elif order == "cdup": reqorder = "sbmSUBMISSIONS.cd ASC, lactname" elif order == "mddown": reqorder = "sbmSUBMISSIONS.md DESC, lactname" elif order == "mdup": reqorder = "sbmSUBMISSIONS.md ASC, lactname" elif order == "statusdown": reqorder = "sbmSUBMISSIONS.status DESC, lactname" elif order == "statusup": reqorder = "sbmSUBMISSIONS.status ASC, lactname" if doctype != "": docselect = " and doctype='%s' " % doctype else: docselect = "" if u_email == "guest" or u_email == "": return warningMsg("<font color=red size=+1>You first have to login before using this feature. Use the left menu to log in.</font>",req) else: res = run_sql("SELECT sbmSUBMISSIONS.* FROM sbmSUBMISSIONS,sbmACTION WHERE sactname=action and email=%s and id!='' "+docselect+" ORDER BY doctype,"+reqorder,(u_email,)) currentdoctype = "" currentaction = "" currentstatus = "" num = 0 for row in res: if currentdoctype != row[1]: currentdoctype = row[1] currentaction = "" currentstatus = "" res2 = run_sql("SELECT ldocname FROM sbmDOCTYPE WHERE sdocname=%s",(currentdoctype,)) ldocname = res2[0][0] t+= "</table>\n" t+="%s<br>\n" % ldocname t+="<table border=\"0\" class=\"searchbox\" align=\"left\" width=\"100%\">\n" t+="<tr><th class=headerselected>Action " t+="<a href='' onClick='document.forms[0].order.value=\"actiondown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"actionup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>Status " t+="<a href='' onClick='document.forms[0].order.value=\"statusdown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"statusup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>id</th><th class=headerselected>reference " t+="<a href='' onClick='document.forms[0].order.value=\"refdown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"refup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>first access " t+="<a href='' onClick='document.forms[0].order.value=\"cddown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"cdup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>last access " t+="<a href='' onClick='document.forms[0].order.value=\"mddown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"mdup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th></tr>\n" % images if currentaction != row[2]: currentaction = row[2] res2 = run_sql("SELECT lactname FROM sbmACTION WHERE sactname=%s",(currentaction,)) lactname = res2[0][0] else: lactname = "\"" cdate = str(row[6]).replace(" "," ") mdate= str(row[7]).replace(" "," ") if currentstatus != row[3]: currentstatus = row[3] status=row[3] else: status = "\"" if row[3] == "pending": idtext = "<a href=\"sub.py?access=%s@%s%s\">%s</a>" % (row[4],currentaction,currentdoctype,row[4]) idtext+= " <a onClick='if (confirm(\"Are you sure you want to delete this submission?\")){document.forms[0].deletedId.value=\"%s\";document.forms[0].deletedDoctype.value=\"%s\";document.forms[0].deletedAction.value=\"%s\";document.forms[0].submit();return true;}else{return false;}' href=''><img src=%s/smallbin.gif border=0 alt='delete submission %s in %s'></a>" % (row[4],currentdoctype,currentaction,images,row[4],ldocname) else: idtext = row[4] if row[5] == "": reference = "<font color=red>not yet given</font>" else: reference = row[5] if operator.mod(num,2) == 0: t+= "<tr bgcolor=\"#e0e0e0\">\n" else: t+= "<tr bgcolor=\"#eeeeee\">\n" t+="<td align=center class=mycdscell><small>%s</small></td>\n<td align=center class=mycdscell><small>%s</small></td>\n<td class=mycdscell><small>" % (lactname,status) t+="%s</small></td>\n<td class=mycdscell><small> %s" % (idtext,reference) t+="</small></td>\n<td class=mycdscell><small>%s</small></td>\n<td class=mycdscell><small>" % cdate t+="%s</small></td>\n</tr>\n" % mdate num+=1 t+="</table></td></tr></table></form>" return page(title="Your Submissions", - body=t, - description="", - keywords="", - uid=uid, - language=ln, - urlargs=req.args) + navtrail="""<a class="navtrail" href="%s/youraccount.py/display">Your Account</a>""" % weburl, + body=t, + description="", + keywords="", + uid=uid, + language=ln, + urlargs=req.args) def deleteSubmission(id, action, doctype, u_email): global storage run_sql("delete from sbmSUBMISSIONS WHERE doctype=%s and action=%s and email=%s and status='pending' and id=%s",(doctype,action,u_email,id,)) res = run_sql("select dir from sbmACTION where sactname=%s",(action,)) dir = res[0][0] if re.search("\.\.",doctype) == None and re.search("\.\.",id) == None and id != "": if os.path.exists("%s/%s/%s/%s" % (storage,dir,doctype,id)): os.rmdir("%s/%s/%s/%s" % (storage,dir,doctype,id)) return "" def warningMsg(title,req,c=cdsname,ln=cdslang): return page(title="warning", body = title, description="%s - Internal Error" % c, keywords="%s, CDSware, Internal Error" % c, language=ln, urlargs=req.args) def errorMsg(title,req,c=cdsname,ln=cdslang): return page(title="error", body = create_error_box(req, title=title,verbose=0, ln=ln), description="%s - Internal Error" % c, keywords="%s, CDSware, Internal Error" % c, language=ln, urlargs=req.args) </protect> diff --git a/modules/websubmit/web/yoursubmissions.py.wml b/modules/websubmit/web/yoursubmissions.py.wml index 26605fa49..9560c5ede 100644 --- a/modules/websubmit/web/yoursubmissions.py.wml +++ b/modules/websubmit/web/yoursubmissions.py.wml @@ -1,211 +1,212 @@ ## $Id$ ## This file is part of the CERN Document Server Software (CDSware). ## Copyright (C) 2002 CERN. ## ## The CDSware 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. ## ## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## read config variables: #include "config.wml" #include "configbis.wml" pylibdir = "<LIBDIR>/python" <protect> ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. ## import interesting modules: import string import os import sys import time import types import re import MySQLdb import shutil import operator sys.path.append('%s' % pylibdir) -from cdsware.config import cdsname,cdslang +from cdsware.config import weburl,cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, list_registered_users from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern def index(req,c=cdsname,ln=cdslang,order="",doctype="",deletedId="",deletedAction="",deletedDoctype=""): global uid ln = wash_language(ln) t="" # get user ID: try: uid = getUid(req) u_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) if deletedId != "": t+=deleteSubmission(deletedId,deletedAction,deletedDoctype,u_email) t+=""" <BR> <SMALL> <form> <input type=hidden value='%s' name=order>""" % order t+=""" <input type=hidden name=deletedId> <input type=hidden name=deletedDoctype> <input type=hidden name=deletedAction> <table class="searchbox" width="100%" summary=""> <tr> <th class="portalboxheader">For """ t+="<select name=doctype onchange=\"document.forms[0].submit();\"><option value=\"\">all types of document" res = run_sql("select ldocname,sdocname from sbmDOCTYPE order by ldocname") for row in res: if doctype==row[1]: t+="<option value=%s selected>%s" % (row[1],row[0]) else: t+="<option value=%s>%s" % (row[1],row[0]) t+="</th></tr><tr><td class=\"portalboxbody\">\n" t+="<table><tr><td></td></tr>" # request order default value reqorder = "sbmSUBMISSIONS.md DESC, lactname" # requested value if order == "actiondown": reqorder = "lactname ASC, sbmSUBMISSIONS.md DESC" elif order == "actionup": reqorder = "lactname DESC, sbmSUBMISSIONS.md DESC" elif order == "refdown": reqorder = "reference ASC, sbmSUBMISSIONS.md DESC, lactname DESC" elif order == "refup": reqorder = "reference DESC, sbmSUBMISSIONS.md DESC, lactname DESC" elif order == "cddown": reqorder = "sbmSUBMISSIONS.cd DESC, lactname" elif order == "cdup": reqorder = "sbmSUBMISSIONS.cd ASC, lactname" elif order == "mddown": reqorder = "sbmSUBMISSIONS.md DESC, lactname" elif order == "mdup": reqorder = "sbmSUBMISSIONS.md ASC, lactname" elif order == "statusdown": reqorder = "sbmSUBMISSIONS.status DESC, lactname" elif order == "statusup": reqorder = "sbmSUBMISSIONS.status ASC, lactname" if doctype != "": docselect = " and doctype='%s' " % doctype else: docselect = "" if u_email == "guest" or u_email == "": return warningMsg("<font color=red size=+1>You first have to login before using this feature. Use the left menu to log in.</font>",req) else: res = run_sql("SELECT sbmSUBMISSIONS.* FROM sbmSUBMISSIONS,sbmACTION WHERE sactname=action and email=%s and id!='' "+docselect+" ORDER BY doctype,"+reqorder,(u_email,)) currentdoctype = "" currentaction = "" currentstatus = "" num = 0 for row in res: if currentdoctype != row[1]: currentdoctype = row[1] currentaction = "" currentstatus = "" res2 = run_sql("SELECT ldocname FROM sbmDOCTYPE WHERE sdocname=%s",(currentdoctype,)) ldocname = res2[0][0] t+= "</table>\n" t+="%s<br>\n" % ldocname t+="<table border=\"0\" class=\"searchbox\" align=\"left\" width=\"100%\">\n" t+="<tr><th class=headerselected>Action " t+="<a href='' onClick='document.forms[0].order.value=\"actiondown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"actionup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>Status " t+="<a href='' onClick='document.forms[0].order.value=\"statusdown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"statusup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>id</th><th class=headerselected>reference " t+="<a href='' onClick='document.forms[0].order.value=\"refdown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"refup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>first access " t+="<a href='' onClick='document.forms[0].order.value=\"cddown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"cdup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th>" % images t+="\n<th class=headerselected>last access " t+="<a href='' onClick='document.forms[0].order.value=\"mddown\";document.forms[0].submit();return false;'><img src=%s/smalldown.gif border=0></a> " % images t+="<a href='' onClick='document.forms[0].order.value=\"mdup\";document.forms[0].submit();return false;'><img src=%s/smallup.gif border=0></a></th></tr>\n" % images if currentaction != row[2]: currentaction = row[2] res2 = run_sql("SELECT lactname FROM sbmACTION WHERE sactname=%s",(currentaction,)) lactname = res2[0][0] else: lactname = "\"" cdate = str(row[6]).replace(" "," ") mdate= str(row[7]).replace(" "," ") if currentstatus != row[3]: currentstatus = row[3] status=row[3] else: status = "\"" if row[3] == "pending": idtext = "<a href=\"sub.py?access=%s@%s%s\">%s</a>" % (row[4],currentaction,currentdoctype,row[4]) idtext+= " <a onClick='if (confirm(\"Are you sure you want to delete this submission?\")){document.forms[0].deletedId.value=\"%s\";document.forms[0].deletedDoctype.value=\"%s\";document.forms[0].deletedAction.value=\"%s\";document.forms[0].submit();return true;}else{return false;}' href=''><img src=%s/smallbin.gif border=0 alt='delete submission %s in %s'></a>" % (row[4],currentdoctype,currentaction,images,row[4],ldocname) else: idtext = row[4] if row[5] == "": reference = "<font color=red>not yet given</font>" else: reference = row[5] if operator.mod(num,2) == 0: t+= "<tr bgcolor=\"#e0e0e0\">\n" else: t+= "<tr bgcolor=\"#eeeeee\">\n" t+="<td align=center class=mycdscell><small>%s</small></td>\n<td align=center class=mycdscell><small>%s</small></td>\n<td class=mycdscell><small>" % (lactname,status) t+="%s</small></td>\n<td class=mycdscell><small> %s" % (idtext,reference) t+="</small></td>\n<td class=mycdscell><small>%s</small></td>\n<td class=mycdscell><small>" % cdate t+="%s</small></td>\n</tr>\n" % mdate num+=1 t+="</table></td></tr></table></form>" return page(title="Your Submissions", - body=t, - description="", - keywords="", - uid=uid, - language=ln, - urlargs=req.args) + navtrail="""<a class="navtrail" href="%s/youraccount.py/display">Your Account</a>""" % weburl, + body=t, + description="", + keywords="", + uid=uid, + language=ln, + urlargs=req.args) def deleteSubmission(id, action, doctype, u_email): global storage run_sql("delete from sbmSUBMISSIONS WHERE doctype=%s and action=%s and email=%s and status='pending' and id=%s",(doctype,action,u_email,id,)) res = run_sql("select dir from sbmACTION where sactname=%s",(action,)) dir = res[0][0] if re.search("\.\.",doctype) == None and re.search("\.\.",id) == None and id != "": if os.path.exists("%s/%s/%s/%s" % (storage,dir,doctype,id)): os.rmdir("%s/%s/%s/%s" % (storage,dir,doctype,id)) return "" def warningMsg(title,req,c=cdsname,ln=cdslang): return page(title="warning", body = title, description="%s - Internal Error" % c, keywords="%s, CDSware, Internal Error" % c, language=ln, urlargs=req.args) def errorMsg(title,req,c=cdsname,ln=cdslang): return page(title="error", body = create_error_box(req, title=title,verbose=0, ln=ln), description="%s - Internal Error" % c, keywords="%s, CDSware, Internal Error" % c, language=ln, urlargs=req.args) </protect>