[Erp5-report] r20031 - in /erp5/trunk/bt5/erp5_calendar: SkinTemplateItem/portal_skins/erp5...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 19 13:13:33 CET 2008


Author: jerome
Date: Wed Mar 19 13:13:32 2008
New Revision: 20031

URL: http://svn.erp5.org?rev=20031&view=rev
Log:
Organisation_generateSubordinationDomain: generate a domain sorted alphabetically

Modified:
    erp5/trunk/bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/Organisation_generateSubordinationDomain.xml
    erp5/trunk/bt5/erp5_calendar/bt/revision

Modified: erp5/trunk/bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/Organisation_generateSubordinationDomain.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/Organisation_generateSubordinationDomain.xml?rev=20031&r1=20030&r2=20031&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/Organisation_generateSubordinationDomain.xml (original)
+++ erp5/trunk/bt5/erp5_calendar/SkinTemplateItem/portal_skins/erp5_calendar/Organisation_generateSubordinationDomain.xml Wed Mar 19 13:13:32 2008
@@ -74,12 +74,21 @@
   # Sometimes the object_path not comes with the request, when you edit for example.\n
   object_path = request.get(\'URL1\').split(\'/\')[-1]\n
 \n
+def sorted(seq, comparator):\n
+  new_seq = seq[::]\n
+  new_seq.sort(comparator)\n
+  return new_seq\n
+\n
+def display_method(doc):\n
+  return doc.getTitle()\n
+\n
 domain_list = []\n
 organisation =  context.organisation_module.restrictedTraverse(object_path)\n
-for person in organisation.getSubordinationRelatedValueList(\n
-                portal_type=\'Person\', checked_permission=\'View\'):\n
+for person in sorted(organisation.getSubordinationRelatedValueList(\n
+                       portal_type=\'Person\', checked_permission=\'View\'),\n
+                     lambda a, b: cmp(display_method(a), display_method(b))):\n
   domain = parent.generateTempDomain(id=person.getId())\n
-  domain.edit(title = person.getTitle(),\n
+  domain.edit(title = display_method(person),\n
               membership_criterion_base_category = (\'source\', \'destination\'), \n
               membership_criterion_category = (person.getRelativeUrl(),),\n
               domain_generator_method_id = script.id,\n
@@ -134,17 +143,19 @@
                             <string>parent</string>
                             <string>kw</string>
                             <string>_getattr_</string>
-<string>context</string>
+                            <string>context</string>
                             <string>request</string>
                             <string>object_path</string>
                             <string>None</string>
                             <string>_getitem_</string>
+                            <string>sorted</string>
+                            <string>display_method</string>
                             <string>domain_list</string>
                             <string>organisation</string>
                             <string>_getiter_</string>
                             <string>person</string>
                             <string>domain</string>
-<string>script</string>
+                            <string>script</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_calendar/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_calendar/bt/revision?rev=20031&r1=20030&r2=20031&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_calendar/bt/revision (original)
+++ erp5/trunk/bt5/erp5_calendar/bt/revision Wed Mar 19 13:13:32 2008
@@ -1,1 +1,1 @@
-317
+318




More information about the Erp5-report mailing list