Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78347992
bibrankadmin.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Aug 19, 23:30
Size
7 KB
Mime Type
text/x-python
Expires
Wed, Aug 21, 23:30 (2 d)
Engine
blob
Format
Raw Data
Handle
20027831
Attached To
R3600 invenio-infoscience
bibrankadmin.py
View Options
## $Id$
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio 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.
##
## CDS Invenio 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 CDS Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""CDS Invenio BibRank Administrator Interface."""
__revision__
=
"$Id$"
__lastupdated__
=
"""$Date$"""
import
sys
import
invenio.bibrankadminlib
as
brc
#reload(brc)
from
invenio.webpage
import
page
,
create_error_box
from
invenio.config
import
weburl
,
CFG_SITE_LANG
,
CFG_SITE_NAME
from
invenio.dbquery
import
Error
from
invenio.webuser
import
getUid
,
page_not_authorized
def
index
(
req
,
ln
=
CFG_SITE_LANG
):
navtrail_previous_links
=
brc
.
getnavtrail
()
# + """> <a class="navtrail" href="%s/admin/bibrank/bibrankadmin.py">BibRank Admin Interface</a> """ % (weburl)
try
:
uid
=
getUid
(
req
)
except
Error
,
e
:
return
error_page
(
req
)
auth
=
brc
.
check_user
(
req
,
'cfgbibrank'
)
if
not
auth
[
0
]:
return
page
(
title
=
"BibRank Admin Interface"
,
body
=
brc
.
perform_index
(
ln
),
uid
=
uid
,
language
=
ln
,
navtrail
=
navtrail_previous_links
,
lastupdated
=
__lastupdated__
,
req
=
req
)
else
:
return
page_not_authorized
(
req
=
req
,
text
=
auth
[
1
],
navtrail
=
navtrail_previous_links
)
def
addrankarea
(
req
,
ln
=
CFG_SITE_LANG
,
rnkcode
=
''
,
template
=
''
,
confirm
=-
1
):
navtrail_previous_links
=
brc
.
getnavtrail
()
+
"""> <a class="navtrail" href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """
%
(
weburl
)
try
:
uid
=
getUid
(
req
)
except
Error
,
e
:
return
error_page
(
req
)
auth
=
brc
.
check_user
(
req
,
'cfgbibrank'
)
if
not
auth
[
0
]:
return
page
(
title
=
"Add new rank method"
,
body
=
brc
.
perform_addrankarea
(
rnkcode
=
rnkcode
,
ln
=
ln
,
template
=
template
,
confirm
=
confirm
),
uid
=
uid
,
language
=
ln
,
navtrail
=
navtrail_previous_links
,
req
=
req
,
lastupdated
=
__lastupdated__
)
else
:
return
page_not_authorized
(
req
=
req
,
text
=
auth
[
1
],
navtrail
=
navtrail_previous_links
)
def
modifytranslations
(
req
,
rnkID
=
''
,
ln
=
CFG_SITE_LANG
,
sel_type
=
''
,
trans
=
[],
confirm
=
0
):
navtrail_previous_links
=
brc
.
getnavtrail
()
+
"""> <a class="navtrail" href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """
%
(
weburl
)
try
:
uid
=
getUid
(
req
)
except
Error
,
e
:
return
error_page
(
req
)
auth
=
brc
.
check_user
(
req
,
'cfgbibrank'
)
if
not
auth
[
0
]:
return
page
(
title
=
"Modify translations"
,
body
=
brc
.
perform_modifytranslations
(
rnkID
=
rnkID
,
ln
=
ln
,
sel_type
=
sel_type
,
trans
=
trans
,
confirm
=
confirm
),
uid
=
uid
,
language
=
ln
,
req
=
req
,
navtrail
=
navtrail_previous_links
,
lastupdated
=
__lastupdated__
)
else
:
return
page_not_authorized
(
req
=
req
,
text
=
auth
[
1
],
navtrail
=
navtrail_previous_links
)
def
modifycollection
(
req
,
ln
=
CFG_SITE_LANG
,
rnkID
=
''
,
func
=
''
,
colID
=
''
,
confirm
=
0
):
navtrail_previous_links
=
brc
.
getnavtrail
()
+
"""> <a class="navtrail" href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """
%
(
weburl
)
try
:
uid
=
getUid
(
req
)
except
Error
,
e
:
return
error_page
(
req
)
auth
=
brc
.
check_user
(
req
,
'cfgbibrank'
)
if
not
auth
[
0
]:
return
page
(
title
=
"Modify visibility toward collections"
,
body
=
brc
.
perform_modifycollection
(
rnkID
=
rnkID
,
ln
=
ln
,
func
=
func
,
colID
=
colID
,
confirm
=
confirm
),
uid
=
uid
,
language
=
ln
,
req
=
req
,
navtrail
=
navtrail_previous_links
,
lastupdated
=
__lastupdated__
)
else
:
return
page_not_authorized
(
req
=
req
,
text
=
auth
[
1
],
navtrail
=
navtrail_previous_links
)
def
deleterank
(
req
,
ln
=
CFG_SITE_LANG
,
rnkID
=
''
,
confirm
=
0
):
navtrail_previous_links
=
brc
.
getnavtrail
()
+
"""> <a class="navtrail" href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """
%
(
weburl
)
try
:
uid
=
getUid
(
req
)
except
Error
,
e
:
return
error_page
(
req
)
auth
=
brc
.
check_user
(
req
,
'cfgbibrank'
)
if
not
auth
[
0
]:
return
page
(
title
=
"Delete rank method"
,
body
=
brc
.
perform_deleterank
(
rnkID
=
rnkID
,
ln
=
ln
,
confirm
=
confirm
),
uid
=
uid
,
language
=
ln
,
req
=
req
,
navtrail
=
navtrail_previous_links
,
lastupdated
=
__lastupdated__
)
else
:
return
page_not_authorized
(
req
=
req
,
text
=
auth
[
1
],
navtrail
=
navtrail_previous_links
)
def
modifyrank
(
req
,
ln
=
CFG_SITE_LANG
,
rnkID
=
''
,
rnkcode
=
''
,
template
=
''
,
cfgfile
=
''
,
confirm
=
0
):
navtrail_previous_links
=
brc
.
getnavtrail
()
+
"""> <a class="navtrail" href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """
%
(
weburl
)
try
:
uid
=
getUid
(
req
)
except
Error
,
e
:
return
error_page
(
req
)
auth
=
brc
.
check_user
(
req
,
'cfgbibrank'
)
if
not
auth
[
0
]:
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
,
req
=
req
,
navtrail
=
navtrail_previous_links
,
lastupdated
=
__lastupdated__
)
else
:
return
page_not_authorized
(
req
=
req
,
text
=
auth
[
1
],
navtrail
=
navtrail_previous_links
)
def
showrankdetails
(
req
,
ln
=
CFG_SITE_LANG
,
rnkID
=
''
):
navtrail_previous_links
=
brc
.
getnavtrail
()
+
"""> <a class="navtrail" href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """
%
(
weburl
)
try
:
uid
=
getUid
(
req
)
except
Error
,
e
:
return
error_page
(
req
)
auth
=
brc
.
check_user
(
req
,
'cfgbibrank'
)
if
not
auth
[
0
]:
return
page
(
title
=
"Rank method details"
,
body
=
brc
.
perform_showrankdetails
(
rnkID
=
rnkID
,
ln
=
ln
),
uid
=
uid
,
language
=
ln
,
req
=
req
,
navtrail
=
navtrail_previous_links
,
lastupdated
=
__lastupdated__
)
else
:
return
page_not_authorized
(
req
=
req
,
text
=
auth
[
1
],
navtrail
=
navtrail_previous_links
)
def
error_page
(
req
,
ln
=
CFG_SITE_LANG
,
verbose
=
1
):
return
page
(
title
=
"Internal Error"
,
body
=
create_error_box
(
req
,
verbose
=
verbose
,
ln
=
ln
),
description
=
"
%s
- Internal Error"
%
CFG_SITE_NAME
,
keywords
=
"
%s
, Internal Error"
%
CFG_SITE_NAME
,
language
=
ln
,
req
=
req
)
Event Timeline
Log In to Comment