Page MenuHomec4science

yourbaskets.py.wml
No OneTemporary

File Metadata

Created
Fri, Nov 8, 17:01

yourbaskets.py.wml

## $Id$
## Personal features - your baskets.
## 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>
"""Web Baskets features."""
__lastupdated__ = """<: print `date +"%d %b %Y %H:%M:%S %Z"`; :>"""
## fill config variables:
pylibdir = "<LIBDIR>/python"
import sys
import time
import zlib
import urllib
sys.path.append('%s' % pylibdir)
from cdsware.config import weburl,webdir
from cdsware.webpage import page
from cdsware.dbquery import run_sql
from cdsware.webuser import getUid,page_not_authorized
from cdsware import webbasket
from mod_python import apache
from cdsware.access_control_config import CFG_ACCESS_CONTROL_LEVEL_SITE
imagesurl = "%s/img" % webdir
## rest of the Python code goes below
### CALLABLE INTERFACE
def index(req):
req.err_headers_out.add("Location", "%s/yourbaskets.py/display?%s" % (weburl, req.args))
raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY
def display(req, action="", title="Your Baskets", delete_alerts="", confirm_action="", id_basket=0, bname="", newname="", newbname="", mark=[], to_basket="", copy_move="", idup="", ordup="", iddown="", orddown="", of="hb"):
uid = getUid(req)
if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1:
return page_not_authorized(req, "../yourbaskets.py/display")
if action=="DELETE":
title="Delete basket"
return page(title=title,
body=webbasket.perform_display(uid, action, delete_alerts, confirm_action, id_basket, bname, newname, newbname, mark, to_basket, copy_move, idup, ordup, iddown, orddown, of),
navtrail="""<a class="navtrail" href="%s/youraccount.py/display">Your Account</a>""" % weburl,
description="CDS Personalize, Display baskets",
keywords="CDS, personalize",
uid=uid,
lastupdated=__lastupdated__)
def display_public(req, id_basket=0, name="", action="", to_basket="", mark=[], newname="", of="hb"):
title = "Display basket"
uid = getUid(req)
if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE == 2:
return page_not_authorized(req, "../yourbaskets.py/display_public")
if CFG_ACCESS_CONTROL_LEVEL_SITE >= 1 and action == "EXECUTE":
return page_not_authorized(req, "../yourbaskets.py/display_public")
return page(title=title,
body=webbasket.perform_display_public(uid, id_basket, name, action, to_basket, mark, newname, of),
navtrail="""<a class="navtrail" href="%s/youraccount.py/display">Your Account</a>""" % weburl,
description="CDS Personalize, Display baskets",
keywords="CDS, personalize",
uid=uid,
lastupdated=__lastupdated__)
def add(req, recid=[], bid=[], bname=[]):
"""Add records to basket. If bid isn't set, it'll ask user into which baskets to add them.
If bname is set, it'll create new basket with this name, and add records there rather than to bid."""
title = "Adding records to baskets"
uid = getUid(req)
if uid == -1 or CFG_ACCESS_CONTROL_LEVEL_SITE >= 1:
return page_not_authorized(req, "../yourbaskets.py/add")
return page(title=title,
body=webbasket.perform_request_add(uid, recid, bid, bname),
navtrail="""<a class="navtrail" href="%s/youraccount.py/display">Your Account</a> &gt; <a class="navtrail" href="%s/yourbaskets.py/display">Your Baskets</a>""" % (weburl, weburl),
description="CDS Personalize, Add records to basket",
keywords="CDS, personalize",
uid=uid,
lastupdated=__lastupdated__)

Event Timeline