diff --git a/modules/websubmit/web/approve.py b/modules/websubmit/web/approve.py index 76b5c06db..6344788ba 100644 --- a/modules/websubmit/web/approve.py +++ b/modules/websubmit/web/approve.py @@ -1,83 +1,84 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../approve.py/index") ln = wash_language(ln) form = req.form if form.keys(): access = form.keys()[0] if access == "": return errorMsg("approve.py: cannot determine document reference",req) res = run_sql("select doctype,rn from sbmAPPROVAL where access=%s",(access,)) if len(res) == 0: return errorMsg("approve.py: cannot find document in database",req) else: doctype = res[0][0] rn = res[0][1] res = run_sql("select value from sbmPARAMETERS where name='edsrn' and doctype=%s",(doctype,)) edsrn = res[0][0] url = "%s/sub.py?%s=%s&password=%s@APP%s" % (urlpath,edsrn,rn,access,doctype) req.err_headers_out.add("Location", url) raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY return "" else: return errorMsg("Sorry parameter missing...", req, c, ln) 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) diff --git a/modules/websubmit/web/approve.py.wml b/modules/websubmit/web/approve.py.wml index 76b5c06db..6344788ba 100644 --- a/modules/websubmit/web/approve.py.wml +++ b/modules/websubmit/web/approve.py.wml @@ -1,83 +1,84 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../approve.py/index") ln = wash_language(ln) form = req.form if form.keys(): access = form.keys()[0] if access == "": return errorMsg("approve.py: cannot determine document reference",req) res = run_sql("select doctype,rn from sbmAPPROVAL where access=%s",(access,)) if len(res) == 0: return errorMsg("approve.py: cannot find document in database",req) else: doctype = res[0][0] rn = res[0][1] res = run_sql("select value from sbmPARAMETERS where name='edsrn' and doctype=%s",(doctype,)) edsrn = res[0][0] url = "%s/sub.py?%s=%s&password=%s@APP%s" % (urlpath,edsrn,rn,access,doctype) req.err_headers_out.add("Location", url) raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY return "" else: return errorMsg("Sorry parameter missing...", req, c, ln) 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) diff --git a/modules/websubmit/web/direct.py b/modules/websubmit/web/direct.py index 0272d44bb..5510fe28a 100644 --- a/modules/websubmit/web/direct.py +++ b/modules/websubmit/web/direct.py @@ -1,96 +1,97 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang,sub=""): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../direct.py/index") myQuery = req.args if sub == "": return errorMsg("Sorry parameter missing...",req) res = run_sql("select docname,actname from sbmIMPLEMENT where subname=%s", (sub,)) if len(res)==0: return errorMsg("Sorry. Can't analyse parameter",req) else: # get document type doctype = res[0][0] # get action name action = res[0][1] # retrieve other parameter values params = re.sub("sub=[^&]*","",myQuery) # find existing access number result = re.search("access=([^&]*)",params) if result != None: access = result.group(1) params = re.sub("access=[^&]*","",params) else: # create 'unique' access number pid = os.getpid() now = time.time() access = "%i_%s" % (now,pid) # retrieve 'dir' value res = run_sql ("select dir from sbmACTION where sactname=%s",(action,)) dir = res[0][0] try: mainmenu = req.headers_in['Referer'] except: mainmenu = "" url = "submit.py?doctype=%s&dir=%s&access=%s&act=%s&startPg=1%s&mainmenu=%s" % (doctype,dir,access,action,params,mainmenu) req.err_headers_out.add("Location", url) raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY return "" 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) diff --git a/modules/websubmit/web/direct.py.wml b/modules/websubmit/web/direct.py.wml index 0272d44bb..5510fe28a 100644 --- a/modules/websubmit/web/direct.py.wml +++ b/modules/websubmit/web/direct.py.wml @@ -1,96 +1,97 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang,sub=""): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../direct.py/index") myQuery = req.args if sub == "": return errorMsg("Sorry parameter missing...",req) res = run_sql("select docname,actname from sbmIMPLEMENT where subname=%s", (sub,)) if len(res)==0: return errorMsg("Sorry. Can't analyse parameter",req) else: # get document type doctype = res[0][0] # get action name action = res[0][1] # retrieve other parameter values params = re.sub("sub=[^&]*","",myQuery) # find existing access number result = re.search("access=([^&]*)",params) if result != None: access = result.group(1) params = re.sub("access=[^&]*","",params) else: # create 'unique' access number pid = os.getpid() now = time.time() access = "%i_%s" % (now,pid) # retrieve 'dir' value res = run_sql ("select dir from sbmACTION where sactname=%s",(action,)) dir = res[0][0] try: mainmenu = req.headers_in['Referer'] except: mainmenu = "" url = "submit.py?doctype=%s&dir=%s&access=%s&act=%s&startPg=1%s&mainmenu=%s" % (doctype,dir,access,action,params,mainmenu) req.err_headers_out.add("Location", url) raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY return "" 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) diff --git a/modules/websubmit/web/getfile.py b/modules/websubmit/web/getfile.py index 75ecd0412..3e93efce7 100644 --- a/modules/websubmit/web/getfile.py +++ b/modules/websubmit/web/getfile.py @@ -1,115 +1,116 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache from cdsware.websubmit_config import * from cdsware.file import * +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang,recid="",docid="",version="",name="",format=""): # get user ID: try: uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../getfile.py/index") uid_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) docfiles = [] t="" filelist="" # if a precise file is requested, we stream it if name!="": if docid=="": return errorMsg("Parameter docid missing",req) else: docfile = BibDoc(bibdocid=docid).getFile(name,format,version) if docfile == None: return warningMsg("can't find file...",req) else: return docfile.stream(req) # all files attached to a record elif recid!="": bibarchive = BibRecDocs(recid) filelist = bibarchive.display(docid,version) # a precise filename elif docid!="": bibdoc = BibDoc(bibdocid=docid) recid = bibdoc.getRecid() filelist = bibdoc.display(version) title = "record #%s" % (recid,recid) if docid != "": title += " document #%s" % docid if version != "": title += " version #%s" % version t = """
\n""" p_navtrail = "Access to Fulltext" return page(title="", body=t, navtrail = p_navtrail, description="", keywords="keywords", uid=uid, 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) 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)
diff --git a/modules/websubmit/web/getfile.py.wml b/modules/websubmit/web/getfile.py.wml index 75ecd0412..3e93efce7 100644 --- a/modules/websubmit/web/getfile.py.wml +++ b/modules/websubmit/web/getfile.py.wml @@ -1,115 +1,116 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache from cdsware.websubmit_config import * from cdsware.file import * +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang,recid="",docid="",version="",name="",format=""): # get user ID: try: uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../getfile.py/index") uid_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) docfiles = [] t="" filelist="" # if a precise file is requested, we stream it if name!="": if docid=="": return errorMsg("Parameter docid missing",req) else: docfile = BibDoc(bibdocid=docid).getFile(name,format,version) if docfile == None: return warningMsg("can't find file...",req) else: return docfile.stream(req) # all files attached to a record elif recid!="": bibarchive = BibRecDocs(recid) filelist = bibarchive.display(docid,version) # a precise filename elif docid!="": bibdoc = BibDoc(bibdocid=docid) recid = bibdoc.getRecid() filelist = bibdoc.display(version) title = "record #%s" % (recid,recid) if docid != "": title += " document #%s" % docid if version != "": title += " version #%s" % version t = """
\n""" p_navtrail = "Access to Fulltext" return page(title="", body=t, navtrail = p_navtrail, description="", keywords="keywords", uid=uid, 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) 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)
diff --git a/modules/websubmit/web/publiline.py b/modules/websubmit/web/publiline.py index 4bf22988b..65f2551cf 100644 --- a/modules/websubmit/web/publiline.py +++ b/modules/websubmit/web/publiline.py @@ -1,432 +1,433 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang,supportemail 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, page_not_authorized from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE execfile("%s/cdsware/websubmit_functions/Retrieve_Data.py" % pylibdir) execfile("%s/cdsware/websubmit_functions/mail.py" % pylibdir) def index(req,c=cdsname,ln=cdslang,doctype="",categ="",RN="",send=""): global uid ln = wash_language(ln) t="" # get user ID: try: uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../publiline.py/index") uid_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) if doctype == "": t=selectDoctype() elif categ == "": t=selectCateg(doctype) elif RN == "": t=selectDocument(doctype,categ) else: t=displayDocument(doctype,categ,RN,send) return page(title="publication line", body=t, description="", keywords="", uid=uid, language=ln, urlargs=req.args) def selectDoctype(): t=""" """ return t def selectCateg(doctype): t="" res = run_sql("select ldocname from sbmDOCTYPE where sdocname=%s",(doctype,)) title = res[0][0] sth = run_sql("select * from sbmCATEGORIES where doctype=%s order by lname",(doctype,)) if len(sth) == 0: categ = "unknown" return selectDocument(doctype,categ) t+=""" """ t+= "" % title t+=""" """ return t def selectDocument(doctype,categ): t="" res = run_sql("select ldocname from sbmDOCTYPE where sdocname=%s", (doctype,)) title = res[0][0] if categ == "": categ == "unknown" t+=""" """ t+= "" % (title,categ) t+=""" """ return t def displayDocument(doctype,categ,RN,send): t="" res = run_sql("select ldocname from sbmDOCTYPE where sdocname=%s", (doctype,)) docname = res[0][0] if categ == "": categ = "unknown" sth = run_sql("select rn,status,dFirstReq,dLastReq,dAction,access from sbmAPPROVAL where rn=%s",(RN,)) if len(sth) > 0: arr = sth[0] status = arr[1] dFirstReq = arr[2] dLastReq = arr[3] dAction = arr[4] access = arr[5] if status == "waiting": image = "\"\"" % images elif status == "approved": image = "\"\"" % images elif status == "rejected": image = "\"\"" % images else: image = "" t+=""" """ t+= "" % (image,RN) t+=""" """ return t # Retrieve info about document def getInfo(doctype,categ,RN): result = getInPending(doctype,categ,RN) if not result: result = getInAlice(doctype,categ,RN) return result #seek info in pending directory def getInPending(doctype,categ,RN): PENDIR="%s/pending" % storage if os.path.exists("%s/%s/%s/AU" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/AU" % (PENDIR,doctype,RN),"r") authors=fp.read() fp.close() else: authors = "" if os.path.exists("%s/%s/%s/TI" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/TI" % (PENDIR,doctype,RN),"r") title=fp.read() fp.close() else: title = "" if os.path.exists("%s/%s/%s/SN" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/SN" % (PENDIR,doctype,RN),"r") sysno=fp.read() fp.close() else: sysno = "" if title == "" and os.path.exists("%s/%s/%s/TIF" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/TIF" % (PENDIR,doctype,RN),"r") title=fp.read() fp.close() if title == "": return 0 else: return (authors,title,sysno,"") #seek info in Alice database def getInAlice(doctype,categ,RN): # initialize sysno variable sysno = "" searchresults = search_pattern(req=None, p=RN, f="reportnumber").items().tolist() if len(searchresults) == 0: return 0 sysno = searchresults[0] if sysno != "": title = Get_Field('245__a',sysno) emailvalue = Get_Field('8560_f',sysno) authors = Get_Field('100__a',sysno) authors += "\n%s" % Get_Field('700__a',sysno) newrn = Get_Field('037__a',sysno) return (authors,title,sysno,newrn) else: return 0 def SendEnglish(doctype,categ,RN,title,authors,access,sysno): FROMADDR = '%s Submission Engine <%s>' % (cdsname,supportemail) # retrieve useful information from webSubmit configuration res = run_sql("select value from sbmPARAMETERS where name='categformatDAM' and doctype=%s", (doctype,)) categformat = res[0][0] categformat = re.sub("","([^-]*)",categformat) categs = re.match(categformat,RN) if categs != None: categ = categs.group(1) else: categ = "unknown" res = run_sql("select value from sbmPARAMETERS where name='addressesDAM' and doctype=%s",(doctype,)) if len(res) > 0: otheraddresses = res[0][0] otheraddresses = otheraddresses.replace("",categ) else: otheraddresses = "" # Build referee's email address refereeaddress = "" # Try to retrieve the referee's email from the referee's database for user in acc_getRoleUsers(acc_getRoleId("referee_%s_%s" % (doctype,categ))): refereeaddress += user[1] + "," # And if there are general referees for user in acc_getRoleUsers(acc_getRoleId("referee_%s_*" % doctype)): refereeaddress += user[1] + "," refereeaddress = re.sub(",$","",refereeaddress) # Creation of the mail for the referee addresses = "" if refereeaddress != "": addresses = refereeaddress + "," if otheraddresses != "": addresses += otheraddresses else: addresses = re.sub(",$","",addresses) if addresses=="": SendWarning(doctype,categ,RN,title,authors,access) return 0 if authors == "": authors = "-" res = run_sql("select value from sbmPARAMETERS where name='directory' and doctype=%s", (doctype,)) directory = res[0][0] message = """ The document %s has been published as a Communication. Your approval is requested for it to become an official Note. Title: %s Author(s): %s To access the document(s), select the file(s) from the location: <%s/getfile.py?recid=%s> To approve/reject the document, you should go to this URL: <%s/approve.py?%s> --------------------------------------------- Best regards. The submission team.""" % (RN,title,authors,urlpath,sysno,urlpath,access) # send the mail body = forge_email(FROMADDR,addresses,adminemail,"Request for Approval of %s" % RN,message) send_email(FROMADDR,addresses,body,0) return "" def SendWarning(doctype,categ,RN,title,authors,access): FROMADDR = '%s Submission Engine <%s>' % (cdsname,supportemail) message = "Failed sending approval email request for %s" % RN # send the mail body = forge_email(FROMADDR,adminemail,"","Failed sending approval email request",message) send_email(FROMADDR,adminemail,body,0) return "" diff --git a/modules/websubmit/web/publiline.py.wml b/modules/websubmit/web/publiline.py.wml index 4bf22988b..65f2551cf 100644 --- a/modules/websubmit/web/publiline.py.wml +++ b/modules/websubmit/web/publiline.py.wml @@ -1,432 +1,433 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang,supportemail 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, page_not_authorized from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE execfile("%s/cdsware/websubmit_functions/Retrieve_Data.py" % pylibdir) execfile("%s/cdsware/websubmit_functions/mail.py" % pylibdir) def index(req,c=cdsname,ln=cdslang,doctype="",categ="",RN="",send=""): global uid ln = wash_language(ln) t="" # get user ID: try: uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../publiline.py/index") uid_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) if doctype == "": t=selectDoctype() elif categ == "": t=selectCateg(doctype) elif RN == "": t=selectDocument(doctype,categ) else: t=displayDocument(doctype,categ,RN,send) return page(title="publication line", body=t, description="", keywords="", uid=uid, language=ln, urlargs=req.args) def selectDoctype(): t=""" """ return t def selectCateg(doctype): t="" res = run_sql("select ldocname from sbmDOCTYPE where sdocname=%s",(doctype,)) title = res[0][0] sth = run_sql("select * from sbmCATEGORIES where doctype=%s order by lname",(doctype,)) if len(sth) == 0: categ = "unknown" return selectDocument(doctype,categ) t+=""" """ t+= "" % title t+=""" """ return t def selectDocument(doctype,categ): t="" res = run_sql("select ldocname from sbmDOCTYPE where sdocname=%s", (doctype,)) title = res[0][0] if categ == "": categ == "unknown" t+=""" """ t+= "" % (title,categ) t+=""" """ return t def displayDocument(doctype,categ,RN,send): t="" res = run_sql("select ldocname from sbmDOCTYPE where sdocname=%s", (doctype,)) docname = res[0][0] if categ == "": categ = "unknown" sth = run_sql("select rn,status,dFirstReq,dLastReq,dAction,access from sbmAPPROVAL where rn=%s",(RN,)) if len(sth) > 0: arr = sth[0] status = arr[1] dFirstReq = arr[2] dLastReq = arr[3] dAction = arr[4] access = arr[5] if status == "waiting": image = "\"\"" % images elif status == "approved": image = "\"\"" % images elif status == "rejected": image = "\"\"" % images else: image = "" t+=""" """ t+= "" % (image,RN) t+=""" """ return t # Retrieve info about document def getInfo(doctype,categ,RN): result = getInPending(doctype,categ,RN) if not result: result = getInAlice(doctype,categ,RN) return result #seek info in pending directory def getInPending(doctype,categ,RN): PENDIR="%s/pending" % storage if os.path.exists("%s/%s/%s/AU" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/AU" % (PENDIR,doctype,RN),"r") authors=fp.read() fp.close() else: authors = "" if os.path.exists("%s/%s/%s/TI" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/TI" % (PENDIR,doctype,RN),"r") title=fp.read() fp.close() else: title = "" if os.path.exists("%s/%s/%s/SN" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/SN" % (PENDIR,doctype,RN),"r") sysno=fp.read() fp.close() else: sysno = "" if title == "" and os.path.exists("%s/%s/%s/TIF" % (PENDIR,doctype,RN)): fp = open("%s/%s/%s/TIF" % (PENDIR,doctype,RN),"r") title=fp.read() fp.close() if title == "": return 0 else: return (authors,title,sysno,"") #seek info in Alice database def getInAlice(doctype,categ,RN): # initialize sysno variable sysno = "" searchresults = search_pattern(req=None, p=RN, f="reportnumber").items().tolist() if len(searchresults) == 0: return 0 sysno = searchresults[0] if sysno != "": title = Get_Field('245__a',sysno) emailvalue = Get_Field('8560_f',sysno) authors = Get_Field('100__a',sysno) authors += "\n%s" % Get_Field('700__a',sysno) newrn = Get_Field('037__a',sysno) return (authors,title,sysno,newrn) else: return 0 def SendEnglish(doctype,categ,RN,title,authors,access,sysno): FROMADDR = '%s Submission Engine <%s>' % (cdsname,supportemail) # retrieve useful information from webSubmit configuration res = run_sql("select value from sbmPARAMETERS where name='categformatDAM' and doctype=%s", (doctype,)) categformat = res[0][0] categformat = re.sub("","([^-]*)",categformat) categs = re.match(categformat,RN) if categs != None: categ = categs.group(1) else: categ = "unknown" res = run_sql("select value from sbmPARAMETERS where name='addressesDAM' and doctype=%s",(doctype,)) if len(res) > 0: otheraddresses = res[0][0] otheraddresses = otheraddresses.replace("",categ) else: otheraddresses = "" # Build referee's email address refereeaddress = "" # Try to retrieve the referee's email from the referee's database for user in acc_getRoleUsers(acc_getRoleId("referee_%s_%s" % (doctype,categ))): refereeaddress += user[1] + "," # And if there are general referees for user in acc_getRoleUsers(acc_getRoleId("referee_%s_*" % doctype)): refereeaddress += user[1] + "," refereeaddress = re.sub(",$","",refereeaddress) # Creation of the mail for the referee addresses = "" if refereeaddress != "": addresses = refereeaddress + "," if otheraddresses != "": addresses += otheraddresses else: addresses = re.sub(",$","",addresses) if addresses=="": SendWarning(doctype,categ,RN,title,authors,access) return 0 if authors == "": authors = "-" res = run_sql("select value from sbmPARAMETERS where name='directory' and doctype=%s", (doctype,)) directory = res[0][0] message = """ The document %s has been published as a Communication. Your approval is requested for it to become an official Note. Title: %s Author(s): %s To access the document(s), select the file(s) from the location: <%s/getfile.py?recid=%s> To approve/reject the document, you should go to this URL: <%s/approve.py?%s> --------------------------------------------- Best regards. The submission team.""" % (RN,title,authors,urlpath,sysno,urlpath,access) # send the mail body = forge_email(FROMADDR,addresses,adminemail,"Request for Approval of %s" % RN,message) send_email(FROMADDR,addresses,body,0) return "" def SendWarning(doctype,categ,RN,title,authors,access): FROMADDR = '%s Submission Engine <%s>' % (cdsname,supportemail) message = "Failed sending approval email request for %s" % RN # send the mail body = forge_email(FROMADDR,adminemail,"","Failed sending approval email request",message) send_email(FROMADDR,adminemail,body,0) return "" diff --git a/modules/websubmit/web/sub.py b/modules/websubmit/web/sub.py index 043391535..46d523115 100644 --- a/modules/websubmit/web/sub.py +++ b/modules/websubmit/web/sub.py @@ -1,65 +1,66 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../sub.py/index") myQuery = req.args if myQuery: if re.search("@",myQuery): param = re.sub("@.*","",myQuery) IN = re.sub(".*@","",myQuery) else: IN = myQuery url = "%s/direct.py?sub=%s&%s" % (urlpath,IN,param) req.err_headers_out.add("Location", url) raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY return "" else: return "Illegal page access" diff --git a/modules/websubmit/web/sub.py.wml b/modules/websubmit/web/sub.py.wml index 043391535..46d523115 100644 --- a/modules/websubmit/web/sub.py.wml +++ b/modules/websubmit/web/sub.py.wml @@ -1,65 +1,66 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../sub.py/index") myQuery = req.args if myQuery: if re.search("@",myQuery): param = re.sub("@.*","",myQuery) IN = re.sub(".*@","",myQuery) else: IN = myQuery url = "%s/direct.py?sub=%s&%s" % (urlpath,IN,param) req.err_headers_out.add("Location", url) raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY return "" else: return "Illegal page access" diff --git a/modules/websubmit/web/submit.py b/modules/websubmit/web/submit.py index eee400769..845eb3bc6 100644 --- a/modules/websubmit/web/submit.py +++ b/modules/websubmit/web/submit.py @@ -1,63 +1,64 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache from cdsware.websubmit_config import * from cdsware.websubmit_engine import * +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang, doctype="", act="", startPg=1, indir="", access="",mainmenu="",fromdir="",file="",nextPg="",nbPg="",curpage=1,step=0,mode="U"): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../submit.py/index") if doctype=="": return home(req,c,ln) elif act=="": return action(req,c,ln,doctype) elif int(step)==0: return interface(req,c,ln, doctype, act, startPg, indir, access,mainmenu,fromdir,file,nextPg,nbPg,curpage) else: return endaction(req,c,ln, doctype, act, startPg, indir, access,mainmenu,fromdir,file,nextPg,nbPg,curpage,step,mode) diff --git a/modules/websubmit/web/submit.py.wml b/modules/websubmit/web/submit.py.wml index eee400769..845eb3bc6 100644 --- a/modules/websubmit/web/submit.py.wml +++ b/modules/websubmit/web/submit.py.wml @@ -1,63 +1,64 @@ ## $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 = "/python" ## $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 sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.access_control_engine import acc_authorize_action from cdsware.access_control_admin import acc_isRole from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid, get_email, page_not_authorized from cdsware.messages import * from mod_python import apache from cdsware.websubmit_config import * from cdsware.websubmit_engine import * +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,c=cdsname,ln=cdslang, doctype="", act="", startPg=1, indir="", access="",mainmenu="",fromdir="",file="",nextPg="",nbPg="",curpage=1,step=0,mode="U"): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../submit.py/index") if doctype=="": return home(req,c,ln) elif act=="": return action(req,c,ln,doctype) elif int(step)==0: return interface(req,c,ln, doctype, act, startPg, indir, access,mainmenu,fromdir,file,nextPg,nbPg,curpage) else: return endaction(req,c,ln, doctype, act, startPg, indir, access,mainmenu,fromdir,file,nextPg,nbPg,curpage,step,mode) diff --git a/modules/websubmit/web/summary.py b/modules/websubmit/web/summary.py index a204cfb26..307b897b7 100644 --- a/modules/websubmit/web/summary.py +++ b/modules/websubmit/web/summary.py @@ -1,77 +1,78 @@ ## $Id$ ## CDSware WebSubmit in mod_python. ## 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" ## start Python: ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. """CDSware Submission Web Interface.""" ## fill config variables: pylibdir = "/python" ## import interesting modules: import string import os import sys import time sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid,get_email, page_not_authorized from cdsware.messages import * +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,doctype="",act="",access="",indir=""): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../summary.py/index") t="" curdir = "%s/%s/%s/%s" % (storage,indir,doctype,access) subname = "%s%s" % (act,doctype) res = run_sql("select sdesc,fidesc,pagenb,level from sbmFIELD where subname=%s order by pagenb,fieldnb", (subname,)) nbFields = 0 t=t+"\n" % images for arr in res: if arr[0] != "": if arr[3] == "M": color = "red" else: color = "" if os.path.exists("%s/%s" % (curdir,arr[1])): fd = open("%s/%s" % (curdir,arr[1]),"r") value = fd.read() fd.close() value = value.replace("\n"," ") value = value.replace("Select:","") else: value = "" #value = strip_tags($value); t=t+ "\n" % (arr[2],color,arr[0],value); t=t+"
%s%s
" return t
diff --git a/modules/websubmit/web/summary.py.wml b/modules/websubmit/web/summary.py.wml index a204cfb26..307b897b7 100644 --- a/modules/websubmit/web/summary.py.wml +++ b/modules/websubmit/web/summary.py.wml @@ -1,77 +1,78 @@ ## $Id$ ## CDSware WebSubmit in mod_python. ## 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" ## start Python: ## $Id$ ## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES. """CDSware Submission Web Interface.""" ## fill config variables: pylibdir = "/python" ## import interesting modules: import string import os import sys import time sys.path.append('%s' % pylibdir) from cdsware.config import cdsname,cdslang from cdsware.dbquery import run_sql from cdsware.access_control_engine import acc_authorize_action from cdsware.websubmit_config import * from cdsware.webpage import page, create_error_box from cdsware.webuser import getUid,get_email, page_not_authorized from cdsware.messages import * +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE def index(req,doctype="",act="",access="",indir=""): uid = getUid(req) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../summary.py/index") t="" curdir = "%s/%s/%s/%s" % (storage,indir,doctype,access) subname = "%s%s" % (act,doctype) res = run_sql("select sdesc,fidesc,pagenb,level from sbmFIELD where subname=%s order by pagenb,fieldnb", (subname,)) nbFields = 0 t=t+"\n" % images for arr in res: if arr[0] != "": if arr[3] == "M": color = "red" else: color = "" if os.path.exists("%s/%s" % (curdir,arr[1])): fd = open("%s/%s" % (curdir,arr[1]),"r") value = fd.read() fd.close() value = value.replace("\n"," ") value = value.replace("Select:","") else: value = "" #value = strip_tags($value); t=t+ "\n" % (arr[2],color,arr[0],value); t=t+"
%s%s
" return t
diff --git a/modules/websubmit/web/yourapprovals.py b/modules/websubmit/web/yourapprovals.py index be0d8ae11..a1fdc051f 100644 --- a/modules/websubmit/web/yourapprovals.py +++ b/modules/websubmit/web/yourapprovals.py @@ -1,105 +1,106 @@ ## $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 = "/python" ## $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, page_not_authorized from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE 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) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../yourapprovals.py/index") u_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) t+=""" " return page(title="Your Approvals", navtrail="""Your Account""" % weburl, body=t, description="", keywords="", uid=uid, language=ln, urlargs=req.args) def isReferee(uid,doctype="",categ=""): (auth_code, auth_message) = acc_authorize_action(uid, "referee",verbose=0,doctype=doctype, categ=categ) if auth_code == 0: 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) diff --git a/modules/websubmit/web/yourapprovals.py.wml b/modules/websubmit/web/yourapprovals.py.wml index be0d8ae11..a1fdc051f 100644 --- a/modules/websubmit/web/yourapprovals.py.wml +++ b/modules/websubmit/web/yourapprovals.py.wml @@ -1,105 +1,106 @@ ## $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 = "/python" ## $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, page_not_authorized from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE 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) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../yourapprovals.py/index") u_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) t+=""" " return page(title="Your Approvals", navtrail="""Your Account""" % weburl, body=t, description="", keywords="", uid=uid, language=ln, urlargs=req.args) def isReferee(uid,doctype="",categ=""): (auth_code, auth_message) = acc_authorize_action(uid, "referee",verbose=0,doctype=doctype, categ=categ) if auth_code == 0: 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) diff --git a/modules/websubmit/web/yoursubmissions.py b/modules/websubmit/web/yoursubmissions.py index 5fa291c76..a70292c5e 100644 --- a/modules/websubmit/web/yoursubmissions.py +++ b/modules/websubmit/web/yoursubmissions.py @@ -1,214 +1,215 @@ ## $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 = "/python" ## $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 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, page_not_authorized from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE 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) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../yoursubmissions.py/index") u_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) if deletedId != "": t+=deleteSubmission(deletedId,deletedAction,deletedDoctype,u_email) t+="""
""" % order t+="""
" return page(title="Your Submissions", navtrail="""Your Account""" % 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)
diff --git a/modules/websubmit/web/yoursubmissions.py.wml b/modules/websubmit/web/yoursubmissions.py.wml index 5fa291c76..a70292c5e 100644 --- a/modules/websubmit/web/yoursubmissions.py.wml +++ b/modules/websubmit/web/yoursubmissions.py.wml @@ -1,214 +1,215 @@ ## $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 = "/python" ## $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 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, page_not_authorized from cdsware.messages import * from cdsware.websubmit_config import * from cdsware.search_engine import search_pattern +from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE 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) - if uid == -1: + if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1: return page_not_authorized(req, "../yoursubmissions.py/index") u_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) if deletedId != "": t+=deleteSubmission(deletedId,deletedAction,deletedDoctype,u_email) t+="""
""" % order t+="""
" return page(title="Your Submissions", navtrail="""Your Account""" % 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)