Page MenuHomec4science

yourapprovals.py.wml
No OneTemporary

File Metadata

Created
Fri, Nov 1, 14:18

yourapprovals.py.wml

## $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, 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 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+="""
<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=""):
(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)
</protect>

Event Timeline