r13384 - in MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog: . archetypes/querywidget

"Nathan Van Gheem" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: vangheem
Date: Mon Dec 27 21:54:18 2010
New Revision: 13384

Added:
   MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/
      - copied from r13382, MoreFieldsAndWidgets/archetypes.querywidget/trunk/
Modified:
   MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/README.txt
   MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/field.py
   MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/querywidget.js
   MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/widget.py
   MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/setup.py
Log:
branch for plone 3 compatibility and hooks to work with any catalog



Modified: MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/README.txt
==============================================================================
--- MoreFieldsAndWidgets/archetypes.querywidget/trunk/README.txt	(original)
+++ MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/README.txt	Mon Dec 27 21:54:18 2010
@@ -2,3 +2,10 @@
 ============
 
 
+
+
+for plone 3.3
+-------------
+* require plone.app.vocabularies > 2.0b3
+* require zope.security > 3.6.0
+* require zope.site
\ No newline at end of file

Modified: MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/field.py
==============================================================================
--- MoreFieldsAndWidgets/archetypes.querywidget/trunk/archetypes/querywidget/field.py	(original)
+++ MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/field.py	Mon Dec 27 21:54:18 2010
@@ -18,6 +18,9 @@
     """QueryField for storing query"""
     implements(IQueryField)
     _properties = ObjectField._properties.copy()
+    _properties.update({
+        'catalog' : 'portal_catalog'
+    })
 
     security = ClassSecurityInfo()
 
@@ -42,9 +45,9 @@
         if raw == True:
             # We actually wanted the raw value, should have called getRaw
             return value
-        querybuilder = QueryBuilder(instance, getSite().REQUEST)
+        querybuilder = QueryBuilder(instance, getSite().REQUEST, catalog=self.catalog)
 
-        sort_order = 'reverse' if instance.getSort_reversed() else 'ascending'
+        sort_order = instance.getSort_reversed() and 'reverse' or 'ascending'
         return querybuilder(query=value, sort_on=instance.getSort_on(), sort_order=sort_order)
 
     def getRaw(self, instance, **kwargs):

Modified: MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/querywidget.js
==============================================================================
--- MoreFieldsAndWidgets/archetypes.querywidget/trunk/archetypes/querywidget/querywidget.js	(original)
+++ MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/querywidget.js	Mon Dec 27 21:54:18 2010
@@ -1,5 +1,7 @@
 ;(function($) {
 
+    var base_url = $('base').attr('href');
+
     // Define querywidget namespace if it doesn't exist
     if (typeof($.querywidget) == "undefined") {
         $.querywidget = {
@@ -177,7 +179,7 @@
     };
 
     $.querywidget.updateSearch = function () {
-        var query = portal_url + "/@@querybuilder_html_results?";
+        var query = base_url + "/@@querybuilder_html_results?";
         var querylist  = [];
         $('.ArchetypesQueryWidget .queryindex').each(function () {
             var results = $(this).parents('.criteria').children('.queryresults');
@@ -203,7 +205,7 @@
                     break;
             }
 
-            $.get(portal_url + '/@@querybuildernumberofresults?' + querylist.join('&'),
+            $.get(base_url + '/@@querybuildernumberofresults?' + querylist.join('&'),
                   {},
                   function (data) { results.html(data); });
         });
@@ -238,7 +240,7 @@
         $.querywidget.initialized = true;
 
         // Get configuration
-        $.getJSON(portal_url + '/@@querybuilderjsonconfig', function (data) {
+        $.getJSON(base_url + '/@@querybuilderjsonconfig', function (data) {
             $.querywidget.config = data;
 
             // Find querywidgets

Modified: MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/widget.py
==============================================================================
--- MoreFieldsAndWidgets/archetypes.querywidget/trunk/archetypes/querywidget/widget.py	(original)
+++ MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/archetypes/querywidget/widget.py	Mon Dec 27 21:54:18 2010
@@ -21,6 +21,7 @@
         'macro': 'querywidget',
         'helper_css': ('++resource++archetypes.querywidget.querywidget.css',),
         'helper_js': ('++resource++archetypes.querywidget.querywidget.js',),
+        'registry_prefix' : 'plone.app.querystring',
         }),
 
     security = ClassSecurityInfo()
@@ -43,6 +44,7 @@
         """get the config"""
         registry = getUtility(IRegistry)
         registryreader = IQuerystringRegistryReader(registry)
+        registryreader.prefix = self.registry_prefix
         config = registryreader()
 
         # Group indices by "group", order alphabetically

Modified: MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/setup.py
==============================================================================
--- MoreFieldsAndWidgets/archetypes.querywidget/trunk/setup.py	(original)
+++ MoreFieldsAndWidgets/archetypes.querywidget/branches/vangheem-plone3-any-catalog/setup.py	Mon Dec 27 21:54:18 2010
@@ -33,5 +33,7 @@
       extras_require={'test': tests_require},
       entry_points="""
       # -*- Entry points: -*-
+      [z3c.autoinclude.plugin]
+      target = plone
       """,
       )

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.