Page MenuHomec4science

yourapprovals.py
No OneTemporary

File Metadata

Created
Thu, Jul 4, 23:03

yourapprovals.py

## $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>

Event Timeline