Page MenuHomec4science

bibrankadmin.py.wml
No OneTemporary

File Metadata

Created
Mon, Dec 2, 02:33

bibrankadmin.py.wml

## Administrator interface for BibRank
## 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"
<protect>## $Id$</protect>
<protect>## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.</protect>
"""CDSware BibRank Administrator Interface."""
__lastupdated__ = """<: print `date +"%d %b %Y %H:%M:%S %Z"`; :>"""
## fill config variables:
pylibdir = "<LIBDIR>/python"
import sys
sys.path.append('%s' % pylibdir)
import cdsware.bibrank_config as brc
reload(brc)
from cdsware.webpage import page, create_error_box
from cdsware.config import weburl,cdslang
from cdsware.webuser import getUid
__version__ = "$Id$"
def index(req, ln=cdslang):
navtrail_previous_links = brc.getnavtrail() # + """&gt; <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py">BibRank Admin Interface</a> """ % (weburl)
try:
uid = getUid(req)
except MySQLdb.Error, e:
return page(title=msg_internal_error[ln],
body = create_error_box(req, verbose=verbose, ln=ln),
description="%s - Internal Error" % cdsname,
keywords="%s, CDSware, Internal Error" % cdsname,
language=ln,
urlargs=req.args)
if not brc.check_user(uid):
return page(title="BibRank Admin Interface",
body=brc.perform_index(ln),
uid=uid,
language=ln,
navtrail = navtrail_previous_links,
lastupdated=__lastupdated__,
urlargs=req.args)
else:
return page(title='Authorization failure',
uid=uid,
body=brc.adderrorbox('try to login first',
datalist=["""You are not a user authorized to perform admin tasks, try to
<a href="%s/youraccount.py/login?referer=%s/admin/bibrank/">login</a> with another account.""" % (weburl, weburl)]),
navtrail= navtrail_previous_links,
lastupdated=__lastupdated__)
def addrankarea(req, ln=cdslang, rnkcode='', template='', confirm=-1):
navtrail_previous_links = brc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl)
try:
uid = getUid(req)
except MySQLdb.Error, e:
return page(title=msg_internal_error[ln],
body = create_error_box(req, verbose=verbose, ln=ln),
description="%s - Internal Error" % cdsname,
keywords="%s, CDSware, Internal Error" % cdsname,
language=ln,
urlargs=req.args)
if not brc.check_user(uid):
return page(title="Add new rank method",
body=brc.perform_addrankarea(rnkcode=rnkcode,
ln=cdslang,
template=template,
confirm=confirm),
uid=uid,
language=ln,
navtrail = navtrail_previous_links,
urlargs=req.args,
lastupdated=__lastupdated__)
else:
return page(title='Authorization failure',
uid=uid,
body=brc.adderrorbox('try to login first',
datalist=["""You are not a user authorized to perform admin tasks, try to
<a href="%s/youraccount.py/login?referer=%s/admin/bibrank/">login</a> with another account.""" % (weburl, weburl)]),
navtrail= navtrail_previous_links,
lastupdated=__lastupdated__)
def modifytranslation(req, rnkid='', ln=cdslang, sel_lang='', trans = [], confirm=0):
navtrail_previous_links = brc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl)
try:
uid = getUid(req)
except MySQLdb.Error, e:
return page(title=msg_internal_error[ln],
body = create_error_box(req, verbose=verbose, ln=ln),
description="%s - Internal Error" % cdsname,
keywords="%s, CDSware, Internal Error" % cdsname,
language=ln,
urlargs=req.args)
if not brc.check_user(uid):
return page(title="Modify translations",
body=brc.perform_modifytranslation(rnkid=rnkid,
ln=ln,
sel_lang=sel_lang,
trans=trans,
confirm=confirm),
uid=uid,
language=ln,
urlargs=req.args,
navtrail = navtrail_previous_links,
lastupdated=__lastupdated__)
else:
return page(title='Authorization failure',
uid=uid,
body=brc.adderrorbox('try to login first',
datalist=["""You are not a user authorized to perform admin tasks, try to
<a href="%s/youraccount.py/login?referer=%s/admin/bibrank/">login</a> with another account.""" % (weburl, weburl)]),
navtrail= navtrail_previous_links,
lastupdated=__lastupdated__)
def modifycollection(req, ln=cdslang, rnkid='', func='', collid='', confirm=0):
navtrail_previous_links = brc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl)
try:
uid = getUid(req)
except MySQLdb.Error, e:
return page(title=msg_internal_error[ln],
body = create_error_box(req, verbose=verbose, ln=ln),
description="%s - Internal Error" % cdsname,
keywords="%s, CDSware, Internal Error" % cdsname,
language=ln,
urlargs=req.args)
if not brc.check_user(uid):
return page(title="Modify visibility toward collections",
body=brc.perform_modifycollection(rnkid=rnkid,
ln=ln,
func=func,
collid=collid,
confirm=confirm),
uid=uid,
language=ln,
urlargs=req.args,
navtrail = navtrail_previous_links,
lastupdated=__lastupdated__)
else:
return page(title='Authorization failure',
uid=uid,
body=brc.adderrorbox('try to login first',
datalist=["""You are not a user authorized to perform admin tasks, try to
<a href="%s/youraccount.py/login?referer=%s/admin/bibrank/">login</a> with another account.""" % (weburl, weburl)]),
navtrail= navtrail_previous_links,
lastupdated=__lastupdated__)
def deleterank(req, ln=cdslang, rnkid='', confirm=0):
navtrail_previous_links = brc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl)
try:
uid = getUid(req)
except MySQLdb.Error, e:
return page(title=msg_internal_error[ln],
body = create_error_box(req, verbose=verbose, ln=ln),
description="%s - Internal Error" % cdsname,
keywords="%s, CDSware, Internal Error" % cdsname,
language=ln,
urlargs=req.args)
if not brc.check_user(uid):
return page(title="Delete rank method",
body=brc.perform_deleterank(rnkid=rnkid,
ln=ln,
confirm=confirm),
uid=uid,
language=ln,
urlargs=req.args,
navtrail = navtrail_previous_links,
lastupdated=__lastupdated__)
else:
return page(title='Authorization failure',
uid=uid,
body=brc.adderrorbox('try to login first',
datalist=["""You are not a user authorized to perform admin tasks, try to
<a href="%s/youraccount.py/login?referer=%s/admin/bibrank/">login</a> with another account.""" % (weburl, weburl)]),
navtrail= navtrail_previous_links,
lastupdated=__lastupdated__)
def modifyrank(req, ln=cdslang, rnkid='', rnkcode='', template='', cfgfile='', confirm=0):
navtrail_previous_links = brc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl)
try:
uid = getUid(req)
except MySQLdb.Error, e:
return page(title=msg_internal_error[ln],
body = create_error_box(req, verbose=verbose, ln=ln),
description="%s - Internal Error" % cdsname,
keywords="%s, CDSware, Internal Error" % cdsname,
language=ln,
urlargs=req.args)
if not brc.check_user(uid):
return page(title="Modify rank method",
body=brc.perform_modifyrank(rnkid=rnkid,
ln=ln,
rnkcode=rnkcode,
cfgfile=cfgfile,
template=template,
confirm=confirm),
uid=uid,
language=ln,
urlargs=req.args,
navtrail = navtrail_previous_links,
lastupdated=__lastupdated__)
else:
return page(title='Authorization failure',
uid=uid,
body=brc.adderrorbox('try to login first',
datalist=["""You are not a user authorized to perform admin tasks, try to
<a href="%s/youraccount.py/login?referer=%s/admin/bibrank/">login</a> with another account.""" % (weburl, weburl)]),
navtrail= navtrail_previous_links,
lastupdated=__lastupdated__)
def showrankdetails(req, ln=cdslang, rnkid=''):
navtrail_previous_links = brc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl)
try:
uid = getUid(req)
except MySQLdb.Error, e:
return page(title=msg_internal_error[ln],
body = create_error_box(req, verbose=verbose, ln=ln),
description="%s - Internal Error" % cdsname,
keywords="%s, CDSware, Internal Error" % cdsname,
language=ln,
urlargs=req.args)
if not brc.check_user(uid):
return page(title="Rank method details",
body=brc.perform_showrankdetails(rnkid=rnkid,
ln=ln),
uid=uid,
language=ln,
urlargs=req.args,
navtrail = navtrail_previous_links,
lastupdated=__lastupdated__)
else:
return page(title='Authorization failure',
uid=uid,
body=brc.adderrorbox('try to login first',
datalist=["""You are not a user authorized to perform admin tasks, try to
<a href="%s/youraccount.py/login?referer=%s/admin/bibrank/">login</a> with another account.""" % (weburl, weburl)]),
navtrail= navtrail_previous_links,
lastupdated=__lastupdated__)

Event Timeline