Commit 4c668817 authored by Hanno Schlichting's avatar Hanno Schlichting

Retire the ZMI find screens.

parent c8e4cd5c
...@@ -28,6 +28,8 @@ Features Added ...@@ -28,6 +28,8 @@ Features Added
Restructuring Restructuring
+++++++++++++ +++++++++++++
- Simplify ZMI control panel and globally available management screens.
- Move ZServer related testing support into ZServer.Testing. - Move ZServer related testing support into ZServer.Testing.
- Split out Lifetime, webdav and ZServer packages into a ZServer project. - Split out Lifetime, webdav and ZServer packages into a ZServer project.
......
...@@ -37,7 +37,6 @@ from zope.interface import implements ...@@ -37,7 +37,6 @@ from zope.interface import implements
import Folder import Folder
import misc_ import misc_
from FindSupport import FindSupport
from interfaces import IApplication from interfaces import IApplication
from misc_ import Misc_ from misc_ import Misc_
...@@ -51,7 +50,7 @@ LOG = getLogger('Application') ...@@ -51,7 +50,7 @@ LOG = getLogger('Application')
APP_MANAGER = None APP_MANAGER = None
class Application(ApplicationDefaultPermissions, Folder.Folder, FindSupport): class Application(ApplicationDefaultPermissions, Folder.Folder):
"""Top-level system object""" """Top-level system object"""
implements(IApplication) implements(IApplication)
......
...@@ -19,8 +19,7 @@ from AccessControl import ClassSecurityInfo ...@@ -19,8 +19,7 @@ from AccessControl import ClassSecurityInfo
from AccessControl.class_init import InitializeClass from AccessControl.class_init import InitializeClass
from AccessControl.Permission import name_trans from AccessControl.Permission import name_trans
from AccessControl.Permissions import view_management_screens from AccessControl.Permissions import view_management_screens
from Acquisition import aq_base from Acquisition import aq_base, aq_parent
from App.special_dtml import DTMLFile
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
from DocumentTemplate.DT_Util import Eval from DocumentTemplate.DT_Util import Eval
from DocumentTemplate.DT_Util import InstanceDict from DocumentTemplate.DT_Util import InstanceDict
...@@ -33,33 +32,12 @@ from OFS.interfaces import IFindSupport ...@@ -33,33 +32,12 @@ from OFS.interfaces import IFindSupport
class FindSupport(Base): class FindSupport(Base):
"""Find support for Zope Folders""" """Find support for Zope Folders"""
implements(IFindSupport) implements(IFindSupport)
security = ClassSecurityInfo() security = ClassSecurityInfo()
#findframe is deprecated
security.declareProtected(view_management_screens, 'manage_findFrame')
manage_findFrame=DTMLFile('dtml/findFrame', globals())
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') security.declareProtected(view_management_screens, 'ZopeFind')
def ZopeFind(self, obj, obj_ids=None, obj_metatypes=None, def ZopeFind(self, obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None, obj_searchterm=None, obj_expr=None,
...@@ -68,16 +46,14 @@ class FindSupport(Base): ...@@ -68,16 +46,14 @@ class FindSupport(Base):
search_sub=0, search_sub=0,
REQUEST=None, result=None, pre=''): REQUEST=None, result=None, pre=''):
"""Zope Find interface""" """Zope Find interface"""
return self.ZopeFindAndApply(obj, obj_ids=obj_ids, return self.ZopeFindAndApply(
obj, obj_ids=obj_ids,
obj_metatypes=obj_metatypes, obj_searchterm=obj_searchterm, obj_metatypes=obj_metatypes, obj_searchterm=obj_searchterm,
obj_expr=obj_expr, obj_mtime=obj_mtime, obj_mspec=obj_mspec, obj_expr=obj_expr, obj_mtime=obj_mtime, obj_mspec=obj_mspec,
obj_permission=obj_permission, obj_roles=obj_roles, obj_permission=obj_permission, obj_roles=obj_roles,
search_sub=search_sub, REQUEST=REQUEST, result=result, search_sub=search_sub, REQUEST=REQUEST, result=result,
pre=pre, apply_func=None, apply_path='') pre=pre, apply_func=None, apply_path='')
security.declareProtected(view_management_screens, 'PrincipiaFind')
PrincipiaFind=ZopeFind
security.declareProtected(view_management_screens, 'ZopeFindAndApply') security.declareProtected(view_management_screens, 'ZopeFindAndApply')
def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None, def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None, obj_searchterm=None, obj_expr=None,
...@@ -89,72 +65,69 @@ class FindSupport(Base): ...@@ -89,72 +65,69 @@ class FindSupport(Base):
"""Zope Find interface and apply""" """Zope Find interface and apply"""
if result is None: if result is None:
result=[] result = []
if obj_metatypes and 'all' in obj_metatypes: if obj_metatypes and 'all' in obj_metatypes:
obj_metatypes=None obj_metatypes = None
if obj_mtime and type(obj_mtime)==type('s'): if obj_mtime and isinstance(obj_mtime, str):
obj_mtime=DateTime(obj_mtime).timeTime() obj_mtime = DateTime(obj_mtime).timeTime()
if obj_permission: if obj_permission:
obj_permission=p_name(obj_permission) obj_permission = p_name(obj_permission)
if obj_roles and type(obj_roles) is type('s'): if obj_roles and isinstance(obj_roles, str):
obj_roles=[obj_roles] obj_roles = [obj_roles]
if obj_expr: if obj_expr:
# Setup expr machinations # Setup expr machinations
md=td() md = td()
obj_expr=(Eval(obj_expr), md, md._push, md._pop) obj_expr = (Eval(obj_expr), md, md._push, md._pop)
base = aq_base(obj) base = aq_base(obj)
if not hasattr(base, 'objectItems'): if not hasattr(base, 'objectItems'):
return result return result
try: items=obj.objectItems() try:
except: return result items = obj.objectItems()
except Exception:
return result
try: add_result=result.append try:
except: add_result = result.append
raise AttributeError, `result` except Exception:
raise AttributeError(repr(result))
for id, ob in items: for id, ob in items:
if pre: p="%s/%s" % (pre, id) if pre:
else: p=id p = "%s/%s" % (pre, id)
else:
p = id
dflag=0 dflag = 0
if hasattr(ob, '_p_changed') and (ob._p_changed == None): if hasattr(ob, '_p_changed') and (ob._p_changed is None):
dflag=1 dflag = 1
bs = aq_base(ob) bs = aq_base(ob)
if ( if ((not obj_ids or absattr(bs.getId()) in obj_ids) and
(not obj_ids or absattr(bs.getId()) in obj_ids)
and
(not obj_metatypes or (hasattr(bs, 'meta_type') and (not obj_metatypes or (hasattr(bs, 'meta_type') and
bs.meta_type in obj_metatypes)) bs.meta_type in obj_metatypes)) and
and
(not obj_searchterm or (not obj_searchterm or
(hasattr(ob, 'PrincipiaSearchSource') and (hasattr(ob, 'PrincipiaSearchSource') and
obj_searchterm in ob.PrincipiaSearchSource()) obj_searchterm in ob.PrincipiaSearchSource()) or
or
(hasattr(ob, 'SearchableText') and (hasattr(ob, 'SearchableText') and
obj_searchterm in ob.SearchableText()) obj_searchterm in ob.SearchableText())
) ) and
and (not obj_expr or expr_match(ob, obj_expr)) and
(not obj_expr or expr_match(ob, obj_expr)) (not obj_mtime or mtime_match(ob, obj_mtime, obj_mspec)) and
and ((not obj_permission or not obj_roles) or
(not obj_mtime or mtime_match(ob, obj_mtime, obj_mspec)) role_match(ob, obj_permission, obj_roles))):
and
( (not obj_permission or not obj_roles) or \
role_match(ob, obj_permission, obj_roles)
)
):
if apply_func: if apply_func:
apply_func(ob, (apply_path+'/'+p)) apply_func(ob, (apply_path + '/' + p))
else: else:
add_result((p, ob)) add_result((p, ob))
dflag=0 dflag = 0
if search_sub and hasattr(bs, 'objectItems'): if search_sub and hasattr(bs, 'objectItems'):
self.ZopeFindAndApply(ob, obj_ids, obj_metatypes, self.ZopeFindAndApply(ob, obj_ids, obj_metatypes,
...@@ -164,7 +137,8 @@ class FindSupport(Base): ...@@ -164,7 +137,8 @@ class FindSupport(Base):
search_sub, search_sub,
REQUEST, result, p, REQUEST, result, p,
apply_func, apply_path) apply_func, apply_path)
if dflag: ob._p_deactivate() if dflag:
ob._p_deactivate()
return result return result
...@@ -176,32 +150,32 @@ class td(RestrictedDTML, TemplateDict): ...@@ -176,32 +150,32 @@ class td(RestrictedDTML, TemplateDict):
def expr_match(ob, ed, c=InstanceDict, r=0): def expr_match(ob, ed, c=InstanceDict, r=0):
e, md, push, pop=ed e, md, push, pop = ed
push(c(ob, md)) push(c(ob, md))
try: r=e.eval(md) try:
r = e.eval(md)
finally: finally:
pop() pop()
return r return r
def mtime_match(ob, t, q, fn=hasattr): def mtime_match(ob, t, q, fn=hasattr):
if not fn(ob, '_p_mtime'): if not fn(ob, '_p_mtime'):
return 0 return 0
return q=='<' and (ob._p_mtime < t) or (ob._p_mtime > t) return q == '<' and (ob._p_mtime < t) or (ob._p_mtime > t)
def role_match(ob, permission, roles, lt=type([]), tt=type(())): def role_match(ob, permission, roles, lt=type([]), tt=type(())):
pr=[] pr = []
fn=pr.append fn = pr.append
while 1: while 1:
if hasattr(ob, permission): if hasattr(ob, permission):
p=getattr(ob, permission) p = getattr(ob, permission)
if type(p) is lt: if type(p) is lt:
map(fn, p) map(fn, p)
if hasattr(ob, 'aq_parent'): if hasattr(ob, '__parent__'):
ob=ob.aq_parent ob = aq_parent(ob)
continue continue
break break
if type(p) is tt: if type(p) is tt:
...@@ -211,8 +185,8 @@ def role_match(ob, permission, roles, lt=type([]), tt=type(())): ...@@ -211,8 +185,8 @@ def role_match(ob, permission, roles, lt=type([]), tt=type(())):
map(fn, ('Manager', 'Anonymous')) map(fn, ('Manager', 'Anonymous'))
break break
if hasattr(ob, 'aq_parent'): if hasattr(ob, '__parent__'):
ob=ob.aq_parent ob = aq_parent(ob)
continue continue
break break
...@@ -222,10 +196,9 @@ def role_match(ob, permission, roles, lt=type([]), tt=type(())): ...@@ -222,10 +196,9 @@ def role_match(ob, permission, roles, lt=type([]), tt=type(())):
return 1 return 1
# Helper functions
def absattr(attr): def absattr(attr):
if callable(attr): return attr() if callable(attr):
return attr()
return attr return attr
......
...@@ -20,7 +20,6 @@ from App.special_dtml import DTMLFile ...@@ -20,7 +20,6 @@ from App.special_dtml import DTMLFile
from zope.interface import implements from zope.interface import implements
from OFS import bbb from OFS import bbb
from OFS.FindSupport import FindSupport
from OFS.interfaces import IFolder from OFS.interfaces import IFolder
from OFS.Lockable import LockableItem from OFS.Lockable import LockableItem
from OFS.ObjectManager import ObjectManager from OFS.ObjectManager import ObjectManager
...@@ -57,9 +56,7 @@ class Folder( ...@@ -57,9 +56,7 @@ class Folder(
RoleManager, RoleManager,
Collection, Collection,
LockableItem, LockableItem,
Item, Item):
FindSupport,
):
"""Folders are basic container objects that provide a standard """Folders are basic container objects that provide a standard
interface for object management. Folder objects also implement interface for object management. Folder objects also implement
...@@ -71,16 +68,15 @@ class Folder( ...@@ -71,16 +68,15 @@ class Folder(
_properties=({'id':'title', 'type': 'string','mode':'wd'},) _properties=({'id':'title', 'type': 'string','mode':'wd'},)
manage_options=( manage_options = (
ObjectManager.manage_options + ObjectManager.manage_options +
({'label': 'View', 'action': ''}, ) + ({'label': 'View', 'action': ''}, ) +
PropertyManager.manage_options + PropertyManager.manage_options +
RoleManager.manage_options + RoleManager.manage_options +
Item.manage_options + Item.manage_options
FindSupport.manage_options
) )
__ac_permissions__=() __ac_permissions__ = ()
def __init__(self, id=None): def __init__(self, id=None):
if id is not None: if id is not None:
......
<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="&lt;"> before
<OPTION VALUE="&gt;"> 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>
<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="&lt;"> before
<OPTION VALUE="&gt;"> 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>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML lang="en">
<HEAD>
<TITLE>Find</TITLE>
</HEAD>
<FRAMESET ROWS="52%,*">
<dtml-if cv_ffaf>
<FRAME SRC="<dtml-var "REQUEST.URL1" html_quote>/manage_findAdv" NAME="findForm"
<dtml-else>
<FRAME SRC="<dtml-var "REQUEST.URL1" html_quote>/manage_findForm" NAME="findForm"
</dtml-if>
MARGINWIDTH="2" MARGINHEIGHT="2" SCROLLING="auto">
<FRAME SRC="<dtml-var "REQUEST.URL1" html_quote>/manage_findResult" NAME="findResult"
MARGINWIDTH="2" MARGINHEIGHT="0" SCROLLING="auto">
</FRAMESET>
<NOFRAMES>
Management interfaces require the use of a <B>frames-capable</B> web browser.
</NOFRAMES>
</HTML>
<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=PrincipiaFind(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;">&lt; Previous</a></strong>
<dtml-else>&nbsp;</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 &gt;</a></strong>
<dtml-else>&nbsp;</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="&lt;" <dtml-if "REQUEST.obj_mspec == '<'">SELECTED</dtml-if>> before
<OPTION VALUE="&gt;" <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>
...@@ -774,18 +774,9 @@ class IObjectManager(IZopeObject, ICopyContainer, INavigation, IManageable, ...@@ -774,18 +774,9 @@ class IObjectManager(IZopeObject, ICopyContainer, INavigation, IManageable,
""" """
# XXX: might contain non-API methods and outdated comments;
# not synced with ZopeBook API Reference;
# based on OFS.FindSupport.FindSupport
class IFindSupport(Interface): class IFindSupport(Interface):
"""Find support for Zope Folders""" """Find support for Zope Folders"""
manage_findFrame = Attribute(""" """)
manage_findForm = Attribute(""" """)
manage_findAdv = Attribute(""" """)
manage_findResult = Attribute(""" """)
def ZopeFind(obj, obj_ids=None, obj_metatypes=None, def ZopeFind(obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None, obj_searchterm=None, obj_expr=None,
obj_mtime=None, obj_mspec=None, obj_mtime=None, obj_mspec=None,
...@@ -794,8 +785,6 @@ class IFindSupport(Interface): ...@@ -794,8 +785,6 @@ class IFindSupport(Interface):
REQUEST=None, result=None, pre=''): REQUEST=None, result=None, pre=''):
"""Zope Find interface""" """Zope Find interface"""
PrincipiaFind = ZopeFind
def ZopeFindAndApply(obj, obj_ids=None, obj_metatypes=None, def ZopeFindAndApply(obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None, obj_searchterm=None, obj_expr=None,
obj_mtime=None, obj_mspec=None, obj_mtime=None, obj_mspec=None,
...@@ -1004,10 +993,7 @@ class IPropertyManager(Interface): ...@@ -1004,10 +993,7 @@ class IPropertyManager(Interface):
"""Delete one or more properties specified by 'ids'.""" """Delete one or more properties specified by 'ids'."""
# XXX: based on OFS.Folder.Folder class IFolder(IObjectManager, IPropertyManager, IRoleManager, IItem):
class IFolder(IObjectManager, IPropertyManager, IRoleManager,
IItem, IFindSupport):
"""Folders are basic container objects that provide a standard """Folders are basic container objects that provide a standard
interface for object management. Folder objects also implement a interface for object management. Folder objects also implement a
management interface and can have arbitrary properties. management interface and can have arbitrary properties.
......
...@@ -291,12 +291,12 @@ class FileTests(unittest.TestCase): ...@@ -291,12 +291,12 @@ class FileTests(unittest.TestCase):
def testStr(self): def testStr(self):
self.assertEqual(str(self.file), self.data) self.assertEqual(str(self.file), self.data)
def testFindSupport_not_text(self): def testPrincipiaSearchSource_not_text(self):
self.file.manage_edit('foobar', 'application/octet-stream', self.file.manage_edit('foobar', 'application/octet-stream',
filedata=''.join([chr(x) for x in range(256)])) filedata=''.join([chr(x) for x in range(256)]))
self.assertEqual(self.file.PrincipiaSearchSource(), '') self.assertEqual(self.file.PrincipiaSearchSource(), '')
def testFindSupport_text(self): def testPrincipiaSearchSource_text(self):
self.file.manage_edit('foobar', 'text/plain', self.file.manage_edit('foobar', 'text/plain',
filedata='Now is the time for all good men to ' filedata='Now is the time for all good men to '
'come to the aid of the Party.') 'come to the aid of the Party.')
......
...@@ -47,8 +47,3 @@ class TestFindSupport(unittest.TestCase): ...@@ -47,8 +47,3 @@ class TestFindSupport(unittest.TestCase):
self.assertEqual(self.base['1'].id, '1') self.assertEqual(self.base['1'].id, '1')
self.assertEqual(self.base['2'].id, 'foo2') self.assertEqual(self.base['2'].id, 'foo2')
self.assertEqual(self.base['3'].id, '3') self.assertEqual(self.base['3'].id, '3')
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TestFindSupport),
))
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