[CMF-checkins] SVN: CMF/trunk/CMFUid/ Forward port patch from collector #383.

Tres Seaver tseaver at palladion.com
Tue Sep 13 08:26:33 EDT 2005


Log message for revision 38451:
  Forward port patch from collector #383.

Changed:
  U   CMF/trunk/CMFUid/UniqueIdHandlerTool.py
  A   CMF/trunk/CMFUid/www/
  A   CMF/trunk/CMFUid/www/queryUID.pt

-=-
Modified: CMF/trunk/CMFUid/UniqueIdHandlerTool.py
===================================================================
--- CMF/trunk/CMFUid/UniqueIdHandlerTool.py	2005-09-13 12:18:41 UTC (rev 38450)
+++ CMF/trunk/CMFUid/UniqueIdHandlerTool.py	2005-09-13 12:26:32 UTC (rev 38451)
@@ -16,6 +16,7 @@
 
 $Id$
 """
+import os
 
 import Missing
 
@@ -23,7 +24,9 @@
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base
 from Globals import InitializeClass
+from Globals import package_home
 from OFS.SimpleItem import SimpleItem
+from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
 from Products.CMFCore.permissions import ManagePortal
@@ -37,6 +40,8 @@
 
 UID_ATTRIBUTE_NAME = 'cmf_uid'
 
+_wwwdir = os.path.join( package_home( globals() ), 'www' )
+
 class UniqueIdHandlerTool(UniqueObject, SimpleItem, ActionProviderBase):
 
     __doc__ = __doc__ # copy from module
@@ -50,6 +55,15 @@
     )
 
     id = 'portal_uidhandler'
+
+    manage_options = ( ActionProviderBase.manage_options
+                     + ( {'label':'Query',
+                          'action':'manage_queryObject'}
+                       ,
+                       )
+                     + SimpleItem.manage_options
+                     )
+
     alternative_id = "portal_standard_uidhandler"
     meta_type = 'Unique Id Handler Tool'
 
@@ -242,4 +256,7 @@
         except UniqueIdError:
             return default
 
+    security.declareProtected(ManagePortal, 'manage_queryObject')
+    manage_queryObject = PageTemplateFile('queryUID.pt', _wwwdir)
+
 InitializeClass(UniqueIdHandlerTool)

Added: CMF/trunk/CMFUid/www/queryUID.pt
===================================================================
--- CMF/trunk/CMFUid/www/queryUID.pt	2005-09-13 12:18:41 UTC (rev 38450)
+++ CMF/trunk/CMFUid/www/queryUID.pt	2005-09-13 12:26:32 UTC (rev 38451)
@@ -0,0 +1,31 @@
+<h1 tal:replace="structure context/manage_page_header">HEADER</h1>
+<h1 tal:replace="structure context/manage_tabs">TABS</h1>
+
+<h3>Query  <code>portal_uid_handler</code> Tool </h3>
+
+<div tal:define="uid request/uid | nothing">
+<form action="." method="POST"
+      tal:attributes="action string:${context/absolute_url};"
+>
+ <input type="text" name="uid:int" value=""
+        tal:attributes="value uid" />
+ <input type="submit" name="manage_queryObject:method" value=" Query UID ">
+</form>
+
+<div tal:condition="uid"
+     tal:define="obj python:context.queryObject(uid, None);">
+ <div tal:condition="obj">
+   <strong>Found
+        <a href="#object_url"
+           tal:attributes="href obj/absolute_url"
+           tal:content="obj/getId">OBJECTID</a></strong>
+ </div>
+ <div tal:condition="not: obj">
+   <strong>No object matching uid
+            <span tal:content="uid">UID</span> found</strong>
+ </div>
+</div>
+
+</div>
+
+<h1 tal:replace="structure context/manage_page_footer">FOOTER</h1>



More information about the CMF-checkins mailing list