summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 045b8e4)
raw | patch | inline | side by side (parent: 045b8e4)
| author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Mon, 17 Feb 2003 00:39:28 +0000 (00:39 +0000) | ||
| committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Mon, 17 Feb 2003 00:39:28 +0000 (00:39 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1514 57a73879-2fb5-44c3-a270-3262357dd7e2
| doc/customizing.txt | patch | blob | history | |
| roundup/cgi/client.py | patch | blob | history | |
| roundup/cgi/templating.py | patch | blob | history |
diff --git a/doc/customizing.txt b/doc/customizing.txt
index a1b46ac3172f61e75c3bedf0cab5843160cf18f0..bcaf3d3555e4154e037a3a561db1798f6d628ae5 100644 (file)
--- a/doc/customizing.txt
+++ b/doc/customizing.txt
Customising Roundup
===================
-:Version: $Revision: 1.73 $
+:Version: $Revision: 1.74 $
.. This document borrows from the ZopeBook section on ZPT. The original is at:
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
confirm only on Password properties - render a second form edit field for
the property, used for confirmation that the user typed the
password correctly. Generates a field with name "name:confirm".
+now only on Date properties - return the current date as a new property
reldate only on Date properties - render the interval between the
date and now
+local only on Date properties - return this date as a new property with
+ some timezone offset
pretty only on Interval properties - render the interval in a
pretty format (eg. "yesterday")
menu only on Link and Multilink properties - render a form select
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index 74e19a871499d75ac314f1901e5287b70b6052a9..23edf8fdacb330c5cfbe7159b3096f5db8405fb1 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.86 2003-02-16 22:57:09 richard Exp $
+# $Id: client.py,v 1.87 2003-02-17 00:39:28 richard Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
Special form variables:
Note that in various places throughout this code, special form
variables of the form :<name> are used. The colon (":") part may
- actually be one of several characters from the set:
-
- : @ +
-
+ actually be one of either ":" or "@".
'''
#
# special form variables
#
- FV_TEMPLATE = re.compile(r'[@+:]template')
- FV_OK_MESSAGE = re.compile(r'[@+:]ok_message')
- FV_ERROR_MESSAGE = re.compile(r'[@+:]error_message')
+ FV_TEMPLATE = re.compile(r'[@:]template')
+ FV_OK_MESSAGE = re.compile(r'[@:]ok_message')
+ FV_ERROR_MESSAGE = re.compile(r'[@:]error_message')
# specials for parsePropsFromForm
- FV_REQUIRED = re.compile(r'[@+:]required')
- FV_ADD = re.compile(r'([@+:])add\1')
- FV_REMOVE = re.compile(r'([@+:])remove\1')
- FV_CONFIRM = re.compile(r'.+[@+:]confirm')
- FV_LINK = re.compile(r'([@+:])link\1(.+)')
+ FV_REQUIRED = re.compile(r'[@:]required')
+ FV_ADD = re.compile(r'([@:])add\1')
+ FV_REMOVE = re.compile(r'([@:])remove\1')
+ FV_CONFIRM = re.compile(r'.+[@:]confirm')
+ FV_LINK = re.compile(r'([@:])link\1(.+)')
# deprecated
- FV_NOTE = re.compile(r'[@+:]note')
- FV_FILE = re.compile(r'[@+:]file')
+ FV_NOTE = re.compile(r'[@:]note')
+ FV_FILE = re.compile(r'[@:]file')
# Note: index page stuff doesn't appear here:
# columns, sort, sortdir, filter, group, groupdir, search_text,
special form values.
'''
# parse the props from the form
+# XXX reinstate exception handling
# try:
if 1:
props, links = self.parsePropsFromForm()
# return
# handle the props - edit or create
+# XXX reinstate exception handling
# try:
if 1:
# create the context here
self.db.commit()
# redirect to the new item's page
- raise Redirect, '%s%s%s?:ok_message=%s'%(self.base, self.classname,
+ raise Redirect, '%s%s%s?@ok_message=%s'%(self.base, self.classname,
nid, urllib.quote(messages))
def newItemPermission(self, props):
_('You do not have permission to search %s' %self.classname))
# add a faked :filter form variable for each filtering prop
+# XXX migrate to new : @ +
props = self.db.classes[self.classname].getprops()
for key in self.form.keys():
if not props.has_key(key): continue
def showAction(self):
''' Show a node
'''
+# XXX allow : @ +
t = self.form[':type'].value
n = self.form[':number'].value
url = '%s%s%s'%(self.db.config.TRACKER_WEB, t, n)
''' Pull properties for the given class out of the form.
In the following, <bracketed> values are variable, ":" may be
- any of : @ + and other text "required" is fixed.
+ one of ":" or "@", and other text "required" is fixed.
Properties are specified as form variables
<designator>:<propname>
[classname|designator] will be set/appended the id of the
newly created item of class <classname>.
- Note: the colon may be one of: : @ +
+ Note: the colon may be either ":" or "@".
Any of the form variables may be prefixed with a classname or
designator.
# generate the regexp for detecting
# <classname|designator>[@:+]property
classes = '|'.join(db.classes.keys())
- self.FV_ITEMSPEC = re.compile(r'(%s)([-\d]+)[@+:](.+)$'%classes)
+ self.FV_ITEMSPEC = re.compile(r'(%s)([-\d]+)[@:](.+)$'%classes)
self.FV_DESIGNATOR = re.compile(r'(%s)([-\d]+)'%classes)
# these indicate the default class / item
index 87243a763148265c8158cde0e4eba6b3d03512c1..6992e061f3625c758953e864dd880af262cb00fe 100644 (file)
return ''
return str(self._value.local(self._db.getUserTimezone()))
+ def now(self):
+ ''' Return the current time.
+
+ This is useful for defaulting a new value. Returns a
+ DateHTMLProperty.
+ '''
+ return DateHTMLProperty(self._client, self._nodeid, self._prop,
+ self._name, date.Date('.'))
+
def field(self, size = 30):
''' Render a form edit field for the property
'''
''' Return the date/time as a local (timezone offset) date/time.
'''
return DateHTMLProperty(self._client, self._nodeid, self._prop,
- self._name, self._value.local())
+ self._name, self._value.local(offset))
class IntervalHTMLProperty(HTMLProperty):
def plain(self):
'''
# extract the index display information from the form
self.columns = []
- for name in ':columns +columns @columns'.split():
+ for name in ':columns @columns'.split():
if self.form.has_key(name):
self.special_char = name[0]
self.columns = handleListCGIValue(self.form[name])
# sorting
self.sort = (None, None)
- for name in ':sort +sort @sort'.split():
+ for name in ':sort @sort'.split():
if self.form.has_key(name):
self.special_char = name[0]
sort = self.form[name].value
# grouping
self.group = (None, None)
- for name in ':group +group @group'.split():
+ for name in ':group @group'.split():
if self.form.has_key(name):
self.special_char = name[0]
group = self.form[name].value
# filtering
self.filter = []
- for name in ':filter +filter @filter'.split():
+ for name in ':filter @filter'.split():
if self.form.has_key(name):
self.special_char = name[0]
self.filter = handleListCGIValue(self.form[name])
# full-text search argument
self.search_text = None
- for name in ':search_text +search_text @search_text'.split():
+ for name in ':search_text @search_text'.split():
if self.form.has_key(name):
self.special_char = name[0]
self.search_text = self.form[name].value
# pagination - size and start index
# figure batch args
self.pagesize = 50
- for name in ':pagesize +pagesize @pagesize'.split():
+ for name in ':pagesize @pagesize'.split():
if self.form.has_key(name):
self.special_char = name[0]
self.pagesize = int(self.form[name].value)
self.startwith = 0
- for name in ':startwith +startwith @startwith'.split():
+ for name in ':startwith @startwith'.split():
if self.form.has_key(name):
self.special_char = name[0]
self.startwith = int(self.form[name].value)