Page MenuHomec4science

yourbaskets.py
No OneTemporary

File Metadata

Created
Sat, Jul 6, 18:42

yourbaskets.py

## $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 import webbasket
from cdsware.dbquery import run_sql
from cdsware.webuser import getUid
from mod_python import apache
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=""):
uid = getUid(req)
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),
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=""):
title = "Display basket"
uid = getUid(req)
return page(title=title,
body=webbasket.perform_display_public(uid, id_basket, name, action, to_basket, mark, newname),
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)
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