Commit 521761b7 authored by Jim Fulton's avatar Jim Fulton

added option for tabular vs record reports

parent ad3bca87
......@@ -10,8 +10,8 @@
##############################################################################
__doc__='''Shared Aqueduct classes and functions
$Id: Aqueduct.py,v 1.16 1997/12/12 23:38:04 jim Exp $'''
__version__='$Revision: 1.16 $'[11:-2]
$Id: Aqueduct.py,v 1.17 1998/01/09 13:58:14 jim Exp $'''
__version__='$Revision: 1.17 $'[11:-2]
from Globals import HTMLFile, Persistent
import DocumentTemplate, DateTime, regex, regsub, string, urllib, rotor
......@@ -191,7 +191,7 @@ def default_input_form(id,arguments,action='query',
custom_default_report_src=DocumentTemplate.File(
dtml_dir+'customDefaultReport.dtml')
def custom_default_report(id, result, action=''):
def custom_default_report(id, result, action='', no_table=0):
columns=result._searchable_result_columns()
__traceback_info__=columns
heading=('<tr>\n%s</tr>' %
......@@ -202,19 +202,24 @@ def custom_default_report(id, result, action=''):
''
)
)
row=('<tr>\n%s</tr>' %
string.joinfields(
map(lambda c:
'\t\t<td><!--#var %s%s--></td>\n'
% (urllib.quote(c['name']),
c['type']!='s' and ' null=""' or '',
),
columns),
''
)
)
if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', '
else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', ''
if no_table: tr='<p>'
else: tr, _tr = '<tr>', '</p>'
row=('%s\n%s\t\t%s' %
(tr,string.joinfields(
map(lambda c, td=td, _td=_td:
'\t\t%s<!--#var %s%s-->%s\n'
% (td,urllib.quote(c['name']),
c['type']!='s' and ' null=""' or '',_td),
columns),
delim), _tr))
return custom_default_report_src(
id=id,heading=heading,row=row,action=action)
id=id,heading=heading,row=row,action=action,no_table=no_table)
def detypify(arg):
l=string.find(arg,':')
......@@ -360,6 +365,9 @@ def delimited_output(results,REQUEST,RESPONSE):
##############################################################################
#
# $Log: Aqueduct.py,v $
# Revision 1.17 1998/01/09 13:58:14 jim
# added option for tabular vs record reports
#
# Revision 1.16 1997/12/12 23:38:04 jim
# Added debugging info.
#
......
......@@ -10,15 +10,16 @@
##########################################################################
__doc__='''Aqueduct Search Interface Wizard
$Id: Search.py,v 1.2 1998/01/07 16:32:48 jim Exp $'''
__version__='$Revision: 1.2 $'[11:-2]
$Id: Search.py,v 1.3 1998/01/09 13:58:15 jim Exp $'''
__version__='$Revision: 1.3 $'[11:-2]
from Globals import HTMLFile
from Aqueduct import custom_default_report, nicify
from string import join
addForm=HTMLFile('searchAdd', globals())
def add(self, report_id, report_title, input_id, input_title, queries=[],
def add(self, report_id, report_title, report_style,
input_id, input_title, queries=[],
REQUEST=None):
'add a report'
......@@ -56,7 +57,8 @@ def add(self, report_id, report_title, input_id, input_title, queries=[],
report_id,report_title,
('<!--#var standard_html_header-->\n%s\n'
'<!--#var standard_html_footer-->' %
join(map(lambda q: custom_default_report(q.id, q), qs),
join(map(lambda q, report_style=report_style:
custom_default_report(q.id, q, no_table=report_style), qs),
'\n<hr>\n')))
if REQUEST: return self.manage_main(self,REQUEST)
......@@ -171,6 +173,9 @@ def default_input_form(arguments,action='query',
##############################################################################
#
# $Log: Search.py,v $
# Revision 1.3 1998/01/09 13:58:15 jim
# added option for tabular vs record reports
#
# Revision 1.2 1998/01/07 16:32:48 jim
# Brought up to date with latest Principia models.
#
......
<!--#in %(id)s size=50 start=query_start-->
<!--#if sequence-start-->
<!--#if previous-sequence-->
<a href="<!--#var URL-->/<!--#var sequence-query
-->&query_start=<!--#var
previous-sequence-start-number-->">
(Previous <!--#var previous-sequence-size--> results)
</a>
<!--#/if previous-sequence-->
<table border>
%(heading)s
<!--#/if sequence-start-->
%(row)s
<!--#if sequence-end-->
</table>
<!--#if next-sequence-->
<a href="<!--#var URL-->/<!--#var sequence-query
-->&query_start=<!--#var
next-sequence-start-number-->">
(Next <!--#var next-sequence-size--> results)
</a>
<!--#/if next-sequence-->
<!--#/if sequence-end-->
<!--#else-->
There was no data matching this <!--#var title_or_id--> query.
<!--#/in-->
<!--#in %(id)s size=50 start=query_start-->
<!--#if sequence-start-->
<!--#if previous-sequence-->
<a href="<!--#var URL-->/<!--#var sequence-query
-->&query_start=<!--#var
previous-sequence-start-number-->">
(Previous <!--#var previous-sequence-size--> results)
</a>
<!--#/if previous-sequence-->
%(else no_table)[<table border>
%(heading)s%(else)]
<!--#/if sequence-start-->
%(row)s
<!--#if sequence-end-->
%(else no_table)[</table>%(else)]
<!--#if next-sequence-->
<a href="<!--#var URL-->/<!--#var sequence-query
-->&query_start=<!--#var
next-sequence-start-number-->">
(Next <!--#var next-sequence-size--> results)
</a>
<!--#/if next-sequence-->
<!--#/if sequence-end-->
<!--#else-->
There was no data matching this <!--#var title_or_id--> query.
<!--#/in-->
......@@ -11,7 +11,7 @@ and a report for a searchable object.
<table>
<tr> <th>Select one or more searchable objects</th>
<td><select name="queries:list" size=5 multiple>
<td><select name="queries:list" size=4 multiple>
<!--#in aqueductQueryIds-->
<option><!--#var sequence-item--></option>
<!--#/in aqueductQueryIds-->
......@@ -20,11 +20,15 @@ and a report for a searchable object.
<td><input name="report_id" size="40"></td></tr>
<tr> <th><em>Report Title<em></th>
<td><input name="report_title" size="40"></td></tr>
<tr> <th>Report Style</th>
<td><select name='report_style:int'>
<option value="0">Tabular</option>
<option value="1">Records</option>
</select></td></tr>
<tr> <th>Search Input ID</th>
<td><input name="input_id" size="40"></td></tr>
<tr> <th><em>Search Input Title</em></th>
<td><input name="input_title" size="40"></td></tr>
<!--#var smallRolesWidget-->
<tr><td></td><td><input type="SUBMIT" name="SUBMIT" value="Add"></td></tr>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment