Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
0e675c94
Commit
0e675c94
authored
Oct 31, 2001
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ZPT search interface
parent
85600e78
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
211 additions
and
19 deletions
+211
-19
lib/python/Shared/DC/ZRDB/Aqueduct.py
lib/python/Shared/DC/ZRDB/Aqueduct.py
+36
-2
lib/python/Shared/DC/ZRDB/Search.py
lib/python/Shared/DC/ZRDB/Search.py
+113
-16
lib/python/Shared/DC/ZRDB/dtml/customDefaultReport.dtml
lib/python/Shared/DC/ZRDB/dtml/customDefaultReport.dtml
+1
-1
lib/python/Shared/DC/ZRDB/dtml/customDefaultZPTReport.dtml
lib/python/Shared/DC/ZRDB/dtml/customDefaultZPTReport.dtml
+41
-0
lib/python/Shared/DC/ZRDB/dtml/searchAdd.dtml
lib/python/Shared/DC/ZRDB/dtml/searchAdd.dtml
+20
-0
No files found.
lib/python/Shared/DC/ZRDB/Aqueduct.py
View file @
0e675c94
...
...
@@ -84,8 +84,8 @@
##############################################################################
__doc__
=
'''Shared classes and functions
$Id: Aqueduct.py,v 1.5
2 2001/08/13 14:57:55 andreasjung
Exp $'''
__version__
=
'$Revision: 1.5
2
$'
[
11
:
-
2
]
$Id: Aqueduct.py,v 1.5
3 2001/10/31 18:49:57 michel
Exp $'''
__version__
=
'$Revision: 1.5
3
$'
[
11
:
-
2
]
import
Globals
,
os
from
Globals
import
Persistent
...
...
@@ -285,6 +285,8 @@ def default_input_form(id,arguments,action='query',
custom_default_report_src
=
DocumentTemplate
.
File
(
os
.
path
.
join
(
dtml_dir
,
'customDefaultReport.dtml'
))
custom_default_zpt_report_src
=
DocumentTemplate
.
File
(
os
.
path
.
join
(
dtml_dir
,
'customDefaultZPTReport.dtml'
))
def
custom_default_report
(
id
,
result
,
action
=
''
,
no_table
=
0
,
goofy
=
re
.
compile
(
'
\
W
'
).search
...
...
@@ -316,6 +318,38 @@ def custom_default_report(id, result, action='', no_table=0,
return custom_default_report_src(
id=id,heading=heading,row=row,action=action,no_table=no_table)
def custom_default_zpt_report(id, result, action='', no_table=0,
goofy=re.compile('
\
W
'
).search
):
columns=result._searchable_result_columns()
__traceback_info__=columns
heading=('<tr>
\
n
%s </tr>' %
string.joinfields(
map(lambda c:
' <th>%s</th>
\
n
' % nicify(c['name']),
columns),
''
)
)
if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ',
\
n
'
else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '
\
n
'
row=[]
for c in columns:
n=c['name']
# ugh! what the hell is goofy?
# if goofy(n) is not None:
# n='expr="
_
[
\
'%s]"'
%
(
`'"'+n`
[
2
:])
row
.
append
(
' %s<span tal:replace="result/%s">%s goes here</span>%s'
%
(
td
,
n
,
n
,
_td
))
row
=
(
' %s
\
n
%s
\
n
%s'
%
(
tr
,
string
.
joinfields
(
row
,
delim
),
_tr
))
return
custom_default_zpt_report_src
(
id
=
id
,
heading
=
heading
,
row
=
row
,
action
=
action
,
no_table
=
no_table
)
def
detypify
(
arg
):
l
=
string
.
find
(
arg
,
':'
)
if
l
>
0
:
arg
=
arg
[:
l
]
...
...
lib/python/Shared/DC/ZRDB/Search.py
View file @
0e675c94
...
...
@@ -84,16 +84,17 @@
##############################################################################
__doc__
=
'''Search Interface Wizard
$Id: Search.py,v 1.1
6 2001/01/12 17:52:28 chrism
Exp $'''
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
$Id: Search.py,v 1.1
7 2001/10/31 18:49:57 michel
Exp $'''
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
from
Globals
import
DTMLFile
from
Aqueduct
import
custom_default_report
,
nicify
,
Args
from
Aqueduct
import
custom_default_report
,
custom_default_zpt_report
,
nicify
,
Args
from
string
import
join
from
AccessControl
import
getSecurityManager
addForm
=
DTMLFile
(
'dtml/searchAdd'
,
globals
())
def
manage_addZSearch
(
self
,
report_id
,
report_title
,
report_style
,
input_id
,
input_title
,
queries
=
[],
input_id
,
input_title
,
object_type
,
queries
=
[],
REQUEST
=
None
):
'add a report'
...
...
@@ -109,6 +110,9 @@ def manage_addZSearch(self, report_id, report_title, report_style,
qs
=
map
(
lambda
q
,
self
=
self
:
_getquery
(
self
,
q
),
queries
)
arguments
=
{}
keys
=
[]
checkPermission
=
getSecurityManager
().
checkPermission
for
q
in
qs
:
url
=
q
.
absolute_url
()
if
input_id
:
...
...
@@ -127,21 +131,53 @@ def manage_addZSearch(self, report_id, report_title, report_style,
try out the query, <a href="%s">click here</a>.
"""
%
(
q
.
title_and_id
(),
url
))
if
input_id
:
arguments
=
Args
(
arguments
,
keys
)
if
object_type
==
'dtml_methods'
:
if
not
checkPermission
(
'Add DTML Methods'
,
self
):
raise
Unauthorized
,
(
'You are not authorized to add DTML Methods.'
)
if
input_id
:
arguments
=
Args
(
arguments
,
keys
)
self
.
manage_addDocument
(
input_id
,
input_title
,
default_input_form
(
arguments
,
report_id
))
self
.
manage_addDocument
(
input_id
,
input_title
,
default_input_form
(
arguments
,
report_id
))
report_id
,
report_title
,
(
'<dtml-var standard_html_header>
\
n
%s
\
n
'
'<dtml-var standard_html_footer>'
%
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
)
self
.
manage_addDocument
(
report_id
,
report_title
,
(
'<dtml-var standard_html_header>
\
n
%s
\
n
'
'<dtml-var standard_html_footer>'
%
join
(
map
(
lambda
q
,
report_style
=
report_style
:
custom_default_report
(
q
.
id
,
q
,
no_table
=
report_style
),
qs
),
'
\
n
<hr>
\
n
'
)))
elif
object_type
==
'page_templates'
:
if
REQUEST
:
return
self
.
manage_main
(
self
,
REQUEST
)
if
not
checkPermission
(
'Add Page Templates'
,
self
):
raise
Unauthorized
,
(
'You are not authorized to add Page Templates.'
)
if
input_id
:
arguments
=
Args
(
arguments
,
keys
)
self
.
manage_addProduct
[
'PageTemplates'
].
manage_addPageTemplate
(
input_id
,
input_title
,
default_input_zpt_form
(
arguments
,
report_id
))
self
.
manage_addProduct
[
'PageTemplates'
].
manage_addPageTemplate
(
report_id
,
report_title
,
(
'<html><body>
\
n
%s
\
n
'
'</body></html>'
%
join
(
map
(
lambda
q
,
report_style
=
report_style
:
custom_default_zpt_report
(
q
.
id
,
q
,
no_table
=
report_style
),
qs
),
'
\
n
<hr>
\
n
'
)))
if
REQUEST
:
return
self
.
manage_main
(
self
,
REQUEST
)
def
ZQueryIds
(
self
):
# Note that report server configurations will expend on this
...
...
@@ -238,3 +274,64 @@ def default_input_form(arguments,action='query',
'<dtml-var standard_html_footer>
\
n
'
%
(
tabs
,
action
)
)
def
default_input_zpt_form
(
arguments
,
action
=
'query'
,
tabs
=
''
):
if
arguments
:
items
=
arguments
.
items
()
return
(
"%s
\
n
%s%s"
%
(
'<html><body>
\
n
%s
\
n
'
'<form action="%s" method="get">
\
n
'
'<h2><dtml-var document_title></h2>
\
n
'
'Enter query parameters:<br>'
'<table>
\
n
'
%
(
tabs
,
action
),
join
(
map
(
lambda
a
:
(
'<tr><th>%s</th>
\
n
'
' <td><input name="%s"
\
n
'
' width=30 value="%s">'
'</td></tr>'
%
(
nicify
(
a
[
0
]),
(
a
[
1
].
has_key
(
'type'
)
and
(
"%s:%s"
%
(
a
[
0
],
a
[
1
][
'type'
]))
or
a
[
0
]
),
a
[
1
].
has_key
(
'default'
)
and
a
[
1
][
'default'
]
or
''
))
,
items
),
'
\
n
'
),
'
\
n
<tr><td colspan=2 align=center>
\
n
'
'<input type="SUBMIT" name="SUBMIT" value="Submit Query">
\
n
'
'</td></tr>
\
n
</table>
\
n
</form>
\
n
'
'</body></html>
\
n
'
)
)
else
:
return
(
'<html><body>
\
n
%s
\
n
'
'<form action="%s" method="get">
\
n
'
'<h2><dtml-var document_title></h2>
\
n
'
'This query requires no input.<p>
\
n
'
'<input type="SUBMIT" name="SUBMIT" value="Submit Query">
\
n
'
'</td></tr>
\
n
</table>
\
n
</form>
\
n
'
'</body></html>
\
n
'
%
(
tabs
,
action
)
)
lib/python/Shared/DC/ZRDB/dtml/customDefaultReport.dtml
View file @
0e675c94
<dtml-in %(id)s size=
5
0 start=query_start>
<dtml-in %(id)s size=
2
0 start=query_start>
<dtml-if sequence-start>
<dtml-if previous-sequence>
...
...
lib/python/Shared/DC/ZRDB/dtml/customDefaultZPTReport.dtml
0 → 100644
View file @
0e675c94
<html>
<body
tal:define=
"results here/%(id)s;
start python:path('request/start') or 0;
batch python:modules['ZTUtils'].Batch(results,
size=20,
start=start);
previous python:batch.previous;
next python:batch.next"
>
<p>
<a
tal:condition=
"previous"
tal:attributes=
"href string:${request/URL0}?start:int=${previous/first}"
href=
"previous_url"
>
previous
</a>
<a
tal:condition=
"next"
tal:attributes=
"href string:${request/URL0}?start:int=${next/first}"
href=
"next_url"
>
next
</a>
</p>
%(else no_table)[
<table
border
>
%(heading)s
%(else)]
<div
tal:repeat=
"result batch"
>
%(row)s
</div>
%(else no_table)[
</table>
%(else)]
<p>
<a
tal:condition=
"previous"
tal:attributes=
"href string:${request/URL0}?start:int=${previous/first}"
href=
"previous_url"
>
previous
</a>
<a
tal:condition=
"next"
tal:attributes=
"href string:${request/URL0}?start:int=${next/first}"
href=
"next_url"
>
next
</a>
</p>
</body>
</html>
lib/python/Shared/DC/ZRDB/dtml/searchAdd.dtml
View file @
0e675c94
...
...
@@ -94,6 +94,26 @@ report and search form objects that will be created.
<input type="text" name="input_title" size="40" value="" />
</td>
</tr
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="radio" name="object_type"
value="dtml_methods">Generate DTML Methods
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="radio" name="object_type"
value="page_templates">Generate Page Templates
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment