From 4901a5e5f2c3bc94fa61e467c51cd9b83df511c8 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Wed, 18 Aug 2004 17:10:20 +0000
Subject: [PATCH] Initial import.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1391 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_core/ERP5Site_getModuleItemList      | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100755 product/ERP5/skins/erp5_core/ERP5Site_getModuleItemList

diff --git a/product/ERP5/skins/erp5_core/ERP5Site_getModuleItemList b/product/ERP5/skins/erp5_core/ERP5Site_getModuleItemList
new file mode 100755
index 0000000000..fa8ac517c8
--- /dev/null
+++ b/product/ERP5/skins/erp5_core/ERP5Site_getModuleItemList
@@ -0,0 +1,33 @@
+## Script (Python) "ERP5Site_getModuleItemList"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+from Products.ERP5Type.Cache import CachingMethod
+
+try:
+  user = context.portal_membership.getAuthenticatedMember().getUserName()
+except:
+  user = None
+
+def getModuleItemList(user=None):
+  translate = context.translation_service.translate
+
+  item_list = []
+  for module in context.getPortalObject().objectValues('ERP5 Folder'):
+    url = module.absolute_url()
+    label = module.getTitle() or module.getId()
+    label = translate('ui', label)
+    item_list.append((url, label))
+
+  def compareModules(a, b): return cmp(a[1], b[1])
+  item_list.sort(compareModules)
+  return item_list
+
+getModuleItemList = CachingMethod(getModuleItemList, id='ERP5Site_getModuleItemList')
+return getModuleItemList(user=user)
+
-- 
2.30.9