eggification
[MosaicDocument.git] / Products / MosaicDocument / MosaicTool.py
diff --git a/Products/MosaicDocument/MosaicTool.py b/Products/MosaicDocument/MosaicTool.py
new file mode 100755 (executable)
index 0000000..86ef932
--- /dev/null
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+# (c) 2003 Centre de Recherche en Informatique ENSMP Fontainebleau <http://cri.ensmp.fr>
+# (c) 2003 BenoĆ®t PIN <mailto:pin@cri.ensmp.fr>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+
+"""
+  Mosaic Tool
+"""
+
+from Globals import InitializeClass
+from Products.CMFCore.TypesTool import TypesTool
+from Products.CMFCore.permissions import ManagePortal
+from MosaicBlockInformation import MosaicBlockInformation
+from AccessControl import ClassSecurityInfo
+
+
+allowedTypes = ['Mosaic Block Information']
+
+class MosaicTool(TypesTool):
+    """
+    Mosaic Tool
+    """
+
+    id = 'mosaic_tool'
+    meta_type = 'Mosaic Tool'
+    
+    def filtered_meta_types(self, user=None):
+        # Filters the list of available meta types.
+        allowed = {}
+        for name in allowedTypes:
+            allowed[name] = 1
+
+        all = TypesTool.inheritedAttribute('filtered_meta_types')(self)
+        meta_types = []
+        for meta_type in self.all_meta_types():
+            if allowed.get(meta_type['name']):
+                meta_types.append(meta_type)
+        return meta_types
+
+
+InitializeClass(MosaicTool)
\ No newline at end of file