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
52983a88
Commit
52983a88
authored
Oct 30, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back find support templates.
parent
f15bbed5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
559 additions
and
1 deletion
+559
-1
src/OFS/FindSupport.py
src/OFS/FindSupport.py
+17
-0
src/OFS/Folder.py
src/OFS/Folder.py
+2
-1
src/OFS/dtml/findAdv.dtml
src/OFS/dtml/findAdv.dtml
+161
-0
src/OFS/dtml/findForm.dtml
src/OFS/dtml/findForm.dtml
+105
-0
src/OFS/dtml/findResult.dtml
src/OFS/dtml/findResult.dtml
+270
-0
src/OFS/interfaces.py
src/OFS/interfaces.py
+4
-0
No files found.
src/OFS/FindSupport.py
View file @
52983a88
...
...
@@ -20,6 +20,7 @@ from AccessControl.class_init import InitializeClass
from
AccessControl.Permission
import
name_trans
from
AccessControl.Permissions
import
view_management_screens
from
Acquisition
import
aq_base
,
aq_parent
from
App.special_dtml
import
DTMLFile
from
DateTime.DateTime
import
DateTime
from
DocumentTemplate.DT_Util
import
Eval
from
DocumentTemplate.DT_Util
import
InstanceDict
...
...
@@ -39,6 +40,22 @@ class FindSupport(Base):
manage_options
=
()
security
=
ClassSecurityInfo
()
security
.
declareProtected
(
view_management_screens
,
'manage_findForm'
)
manage_findForm
=
DTMLFile
(
'dtml/findForm'
,
globals
(),
management_view
=
'Find'
)
security
.
declareProtected
(
view_management_screens
,
'manage_findAdv'
)
manage_findAdv
=
DTMLFile
(
'dtml/findAdv'
,
globals
(),
management_view
=
'Find'
)
security
.
declareProtected
(
view_management_screens
,
'manage_findResult'
)
manage_findResult
=
DTMLFile
(
'dtml/findResult'
,
globals
(),
management_view
=
'Find'
)
manage_options
=
(
{
'label'
:
'Find'
,
'action'
:
'manage_findForm'
},
)
security
.
declareProtected
(
view_management_screens
,
'ZopeFind'
)
def
ZopeFind
(
self
,
obj
,
obj_ids
=
None
,
obj_metatypes
=
None
,
obj_searchterm
=
None
,
obj_expr
=
None
,
...
...
src/OFS/Folder.py
View file @
52983a88
...
...
@@ -74,7 +74,8 @@ class Folder(
manage_options
=
(
ObjectManager
.
manage_options
+
RoleManager
.
manage_options
+
Item
.
manage_options
Item
.
manage_options
+
FindSupport
.
manage_options
)
__ac_permissions__
=
()
...
...
src/OFS/dtml/findAdv.dtml
0 → 100644
View file @
52983a88
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<FORM ACTION="manage_findResult" METHOD="GET">
<INPUT TYPE = "hidden" NAME="searchtype" VALUE="advanced">
<TABLE>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
Find objects of type:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_metatypes:list" SIZE="8" MULTIPLE>
<OPTION VALUE="all" SELECTED> All types
<dtml-in all_meta_types mapping>
<OPTION VALUE="&dtml-name;"> &dtml-name;
</dtml-in>
</SELECT>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
with ids:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="obj_ids:tokens" SIZE="30">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
containing:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="obj_searchterm" SIZE="30">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
expr:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<TEXTAREA NAME="obj_expr" ROWS="4" COLS="30"></TEXTAREA>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
modified:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_mspec">
<OPTION VALUE="<"> before
<OPTION VALUE=">"> after
</SELECT>
</div>
<INPUT TYPE="TEXT" NAME="obj_mtime" SIZE="22">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
where the roles:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_roles:list" SIZE="3" MULTIPLE>
<dtml-in valid_roles>
<OPTION VALUE="&dtml-sequence-item;"> &dtml-sequence-item;
</dtml-in>
</SELECT>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
have permission:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_permission">
<dtml-in permission_settings mapping>
<OPTION VALUE="&dtml-name;"> &dtml-name;
</dtml-in>
</SELECT>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
Sort results by:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="skey">
<OPTION VALUE="meta_type">Type
<OPTION VALUE="id">Id
</SELECT>
<INPUT TYPE="checkbox" NAME="rkey" VALUE="reverse">
<span class="form-label"> Reverse?</span>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-text">
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="0">
Search only in this folder
<BR>
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="1" CHECKED>
Search all subfolders
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<INPUT class="form-element" TYPE="SUBMIT" NAME="btn_submit" VALUE="Find">
<span class="form-text">
<a href="manage_findForm"> Simple...<a>
</span>
</div>
</TD>
</TR>
</TABLE>
</FORM>
<dtml-var manage_page_footer>
src/OFS/dtml/findForm.dtml
0 → 100644
View file @
52983a88
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<p class="form-help">
Find allows you to locate Zope objects based on different
criteria. For more find choices choose the <EM>Advanced</EM>
find option.
</p>
<FORM ACTION="manage_findResult" METHOD="GET">
<INPUT TYPE = "hidden" NAME="searchtype" VALUE="simple">
<TABLE class="action">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
Find objects of type:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_metatypes:list" SIZE="8" MULTIPLE>
<OPTION VALUE="all" SELECTED> All types
<dtml-let sorted_meta_types="[]">
<dtml-in all_meta_types mapping>
<dtml-call "sorted_meta_types.append(name)">
</dtml-in>
<dtml-call "sorted_meta_types.sort()">
<dtml-in sorted_meta_types>
<OPTION VALUE="&dtml-sequence-item;">&dtml-sequence-item;
</dtml-in>
</dtml-let>
</SELECT>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
with ids:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="obj_ids:tokens" SIZE="30">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
containing:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="obj_searchterm" SIZE="30">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
modified:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_mspec">
<OPTION VALUE="<"> before
<OPTION VALUE=">"> after
</SELECT>
</div>
<INPUT TYPE="TEXT" NAME="obj_mtime" SIZE="22">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-text">
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="0">
Search only in this folder
<BR>
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="1" CHECKED>
Search all subfolders
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<INPUT class="form-element" TYPE="SUBMIT" NAME="btn_submit" VALUE="Find">
<span class="form-text">
<a href="manage_findAdv">Advanced...<a>
</span>
</div>
</TD>
</TR>
</TABLE>
</FORM>
<dtml-var manage_page_footer>
src/OFS/dtml/findResult.dtml
0 → 100644
View file @
52983a88
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<dtml-in expr="('obj_ids', 'obj_metatypes', 'obj_searchterm', 'obj_expr', 'obj_mtime', 'obj_mspec', 'obj_permission', 'obj_roles', 'search_sub')">
<dtml-else expr="_.hasattr(REQUEST, _['sequence-item'])">
<dtml-call expr="REQUEST.set(_['sequence-item'], _.None)">
</dtml-else>
</dtml-in>
<dtml-if btn_submit>
<dtml-with "_.namespace(
results=ZopeFind(this(),
obj_ids=obj_ids,
obj_metatypes=obj_metatypes,
obj_searchterm=obj_searchterm,
obj_expr=obj_expr,
obj_mtime=obj_mtime,
obj_mspec=obj_mspec,
obj_permission=obj_permission,
obj_roles=obj_roles,
search_sub=search_sub,
REQUEST=REQUEST))">
<dtml-unless batch_size>
<dtml-call "REQUEST.set('batch_size',20)">
</dtml-unless>
<dtml-if results>
<p class="std-text">
Displaying items
<dtml-in name="results" size=batch_size start=query_start>
<dtml-if sequence-start>&dtml-sequence-number;</dtml-if><dtml-if
sequence-end>-&dtml-sequence-number; of <dtml-var
"_.len(results)"></dtml-if></dtml-in> items matching your query. You can
<a href="#form">revise</a> your search terms below.
</p>
<dtml-else>
<p class="std-text">
No items were found matching your query. You can <a href="#form">revise</a>
your search terms below.
</p>
</dtml-if>
<dtml-unless searchtype>
<dtml-call expr="REQUEST.set('searchtype', 'simple')">
</dtml-unless>
<dtml-unless skey>
<dtml-call expr="REQUEST.set('skey', 'id')">
</dtml-unless>
<dtml-unless rkey>
<dtml-call expr="REQUEST.set('rkey', '')">
</dtml-unless>
<dtml-if "rkey == 'reverse'">
<dtml-call "REQUEST.set('rkey', skey)">
</dtml-if>
<TABLE width="100%" CELLSPACING="0" CELLPADDING="2" border="0">
<dtml-if expr="_.len(results) > batch_size">
<tr class="list-header">
<td width="50%">
<div class="list-item">
<dtml-in name="results" previous size="batch_size" start="query_start">
<strong> <a href="<dtml-var "REQUEST.URL" html_quote>&dtml-sequence-query;query_start=&dtml-previous-sequence-start-number;">< Previous</a></strong>
<dtml-else> </dtml-in></div>
</td>
<td align="right" width="50%">
<div class="list-item">
<dtml-in name="results" next size=batch_size start=query_start>
<strong><a href="<dtml-var "REQUEST.URL" html_quote>&dtml-sequence-query;query_start=&dtml-next-sequence-start-number;">Next ></a></strong>
<dtml-else> </dtml-in></div>
</td>
</tr>
</dtml-if>
</table>
<TABLE width="100%" CELLSPACING="0" CELLPADDING="2" border="0">
<dtml-in results size="batch_size" start="query_start" sort_expr="skey" reverse_expr="rkey">
<dtml-if sequence-odd>
<TR class="row-normal">
<dtml-else>
<TR class="row-hilite">
</dtml-if>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="16"></TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="list-item">
<A HREF="&dtml.url_quote-sequence-key;/manage_workspace">
&dtml-sequence-key;
<dtml-if title>
(&dtml-title;)
</dtml-if>
</A>
</div>
</TD>
</TR>
</dtml-in>
</TABLE>
</dtml-with>
</dtml-if>
<a name="form">
<FORM ACTION="manage_findResult" METHOD="GET">
<TABLE class="action">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
Find objects of type:</a>
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_metatypes:list" SIZE="4" MULTIPLE>
<OPTION VALUE="all" <dtml-in obj_metatypes><dtml-if "_['sequence-item'] == 'all'">SELECTED</dtml-if></dtml-in>> All types
<dtml-in all_meta_types mapping>
<OPTION VALUE="&dtml-name;" <dtml-in obj_metatypes><dtml-if "_['sequence-item'] == _['name']">SELECTED</dtml-if></dtml-in>>&dtml-name;
</dtml-in>
</SELECT>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
with ids:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="obj_ids:tokens" SIZE="30" VALUE="<dtml-var "' '.join(obj_ids or [])">">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
containing:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="obj_searchterm" SIZE="30" VALUE="<dtml-var "REQUEST.obj_searchterm" html_quote>">
</TD>
</TR>
<dtml-if "searchtype == 'advanced'">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
expr:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<TEXTAREA NAME="obj_expr" ROWS="4" COLS="30">&dtml-obj_expr;</TEXTAREA>
</TD>
</TR>
</dtml-if>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
modified:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_mspec">
<OPTION VALUE="<" <dtml-if "REQUEST.obj_mspec == '<'">SELECTED</dtml-if>> before
<OPTION VALUE=">" <dtml-if "REQUEST.obj_mspec == '>'">SELECTED</dtml-if>> after
</SELECT>
</div>
<INPUT TYPE="TEXT" NAME="obj_mtime" SIZE="22" VALUE="&dtml-obj_mtime;">
</TD>
</TR>
<dtml-if "searchtype == 'advanced'">
<INPUT TYPE = "hidden" NAME="searchtype" VALUE="advanced">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
where the roles:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_roles:list" SIZE="3" MULTIPLE>
<dtml-in valid_roles>
<dtml-if obj_roles>
<OPTION VALUE="&dtml-sequence-item;"<dtml-if "_['sequence-item'] in obj_roles">SELECTED</dtml-if>>&dtml-sequence-item;
<dtml-else>
<OPTION VALUE="&dtml-sequence-item;">&dtml-sequence-item;
</dtml-if>
</dtml-in>
</SELECT>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
have permission:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="obj_permission">
<dtml-in permission_settings mapping>
<OPTION VALUE="&dtml-name;"<dtml-in obj_metatypes><dtml-if "_['sequence-item'] == _['name']">SELECTED</dtml-if></dtml-in>> &dtml-name;
</dtml-in>
</SELECT>
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">
Sort results by:
</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<SELECT NAME="skey">
<OPTION VALUE="id">Id
<OPTION VALUE="meta_type">Type
</SELECT>
<span class="form-label">
<INPUT TYPE="checkbox" NAME="rkey" VALUE="reverse"> Reverse?
</span>
</div>
</TD>
</TR>
</dtml-if>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-text">
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="0" <dtml-if "REQUEST.search_sub == 0">CHECKED</dtml-if>>
Search only in this folder
<BR>
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="1" <dtml-if "REQUEST.search_sub == 1">CHECKED</dtml-if>>
Search all subfolders
</div>
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-element">
<INPUT TYPE="SUBMIT" NAME="btn_submit" VALUE="Find">
<span class="form-text">
<dtml-if "searchtype == 'advanced'">
<a href="manage_findForm">Simple...<a>
<dtml-else>
<a href="manage_findAdv">Advanced...<a>
</dtml-if>
</span>
</div>
</TD>
</TR>
</TABLE>
</FORM>
<dtml-var manage_page_footer>
src/OFS/interfaces.py
View file @
52983a88
...
...
@@ -729,6 +729,10 @@ class IObjectManager(IZopeObject, ICopyContainer, INavigation, IManageable,
class
IFindSupport
(
Interface
):
"""Find support for Zope Folders"""
manage_findForm
=
Attribute
(
""" """
)
manage_findAdv
=
Attribute
(
""" """
)
manage_findResult
=
Attribute
(
""" """
)
def
ZopeFind
(
obj
,
obj_ids
=
None
,
obj_metatypes
=
None
,
obj_searchterm
=
None
,
obj_expr
=
None
,
obj_mtime
=
None
,
obj_mspec
=
None
,
...
...
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