Author: jmorliaguet
Date: Sun Jan 15 22:28:08 2006
New Revision: 2222

Added:
   cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py   (contents, 
props changed)
   cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt   (contents, 
props changed)
Modified:
   cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/authoring/views.py
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/screens/editor.pt
Log:

- moved all views / widgets definitions to the server
  (ui/authoring/definitions.py)



Modified: cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml      
(original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml      Sun Jan 
15 22:28:08 2006
@@ -114,6 +114,11 @@
           attribute="getHint"
       />
 
+      <browser:page
+          name="getView"
+          attribute="getView"
+      />
+
   </browser:pages>
 
 </configure>

Added: cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py      Sun Jan 
15 22:28:08 2006
@@ -0,0 +1,172 @@
+
+from zope.i18nmessageid import MessageFactory
+
+_ = MessageFactory("cpsskins")
+
+VIEWS = {
+
+    # Top area
+    'action-pad': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@actionPad.html',
+        },
+        'perspectives': ['site-designer', 'page-designer', 'layout-designer',
+                         'content-author'],
+    },
+
+    'tooltip': {
+        'widget': {
+            'type': 'tooltip',
+        },
+        'show_effect': {
+            'transition': 'fadein',
+            'delay': 2000,
+        },
+    },
+
+    'perspective-selector': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@perspectiveSelector.html',
+        },
+        'perspectives': ['page-designer', 'layout-designer', 'content-author'],
+    },
+
+    # Main area
+    'theme-tabs': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@themeTabs.html',
+        },
+        'perspectives': ['page-designer', 'layout-designer'],
+    },
+
+    'page-tabs': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@pageTabs.html',
+        },
+        'perspectives': ['page-designer', 'layout-designer'],
+    },
+
+    'location-selector': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@locationSelector.html',
+        },
+        'perspectives': ['content-author'],
+        'show_effect': {
+            'transition': 'fadein',
+        },
+    },
+
+    # rendered pages
+    'page-designer': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@renderPage.html?engine=page-designer',
+            'css': '/++skin++cpsskins/@@/++resource++page-designer.css',
+        },
+        'perspectives': ['page-designer'],
+    },
+
+    'layout-designer': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@renderPage.html?engine=layout-designer',
+            'css': '/++skin++cpsskins/@@/++resource++layout-designer.css',
+        },
+        'perspectives': ['layout-designer'],
+    },
+
+    'content-author': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@renderPage.html?engine=content-author',
+            'css': '/++skin++cpsskins/@@/++resource++content-author.css',
+        },
+        'perspectives': ['content-author'],
+    },
+
+    # screen
+    'site-designer': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@site-designer.html',
+            'css': '/++skin++cpsskins/@@/++resource++site-designer.css',
+        },
+        'perspectives': ['site-designer'],
+    },
+
+    # Bottom area
+
+    'portlet-factory': {
+        'widget': {
+            'type': 'panel',
+            'url': '@@portletFactory.html',
+        },
+        'perspectives': ['page-designer', 'layout-designer', 'content-author'],
+    },
+
+    # Contextual menu
+    'context-menu': {
+       'controller': 'menuactions',
+       'widget': {
+         'type': 'contextmenu',
+         'items': [
+           {'type': 'item',
+            'label': _('Edit'),
+            'icon': 'edit.png',
+            'action': 'edit',
+            'visible': 'editable',
+           },
+           {'type': 'item',
+            'label': _('Duplicate'),
+            'icon': 'duplicate.png',
+            'action': 'duplicate',
+            'visible': 'editable',
+           },
+           {'type': 'separator',
+           },
+           {'type': 'item',
+            'label': _('Copy'),
+            'icon': 'copy.png',
+            'action': 'copy',
+           },
+           {'type': 'item',
+            'label': _('Paste'),
+            'icon': 'paste.png',
+            'action': 'paste',
+            'visible': 'editable',
+           },
+           {'type': 'separator',
+           },
+           {'type': 'submenu',
+            'label': _('Format'),
+            'visible': 'formattable',
+            'items': [
+              {'type': 'selection',
+               'action': 'format',
+               'choices': 'formats',
+              },
+            ]
+           },
+           {'type': 'separator',
+           },
+           {'type': 'item',
+            'label': _('Delete'),
+            'icon': 'delete.png',
+            'action': 'delete',
+            'confirm': _('Deleting, are you sure?'),
+           }
+         ],
+       },
+       'show_effect': {
+         'transition': 'fadein',
+       },
+       'hide_effect': {
+         'transition': 'fadeout',
+       },
+    },
+}

Modified: cpsskins/branches/jmo-perspectives/ui/authoring/views.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/views.py    (original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/views.py    Sun Jan 15 
22:28:08 2006
@@ -35,6 +35,7 @@
 from cpsskins.elements.interfaces import IDisplayable
 from cpsskins.browser.rendering.interfaces import IViewer
 from cpsskins.setup.interfaces import IResourceManager
+from cpsskins.ui.authoring.definitions import VIEWS
 from cpsskins.utils import getThemeManager
 
 _ = MessageFactory("cpsskins")
@@ -234,3 +235,6 @@
     def getHint(self, msgid):
         return self._encode({'hint': _(msgid)})
 
+    def getView(self, id):
+        return json.write(VIEWS[id])
+

Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sun Jan 15 
22:28:08 2006
@@ -190,8 +190,8 @@
       return to_show.indexOf(el) < 0;
     });
 
-    $A(to_hide).each(function(el) { el.hide() } );
-    $A(to_show).each(function(el) { el.show() } );
+    $A(to_hide).each(function(el) { el.hide(); });
+    $A(to_show).each(function(el) { el.show(); });
 
     CPSSkins.PreviousPerspective = CPSSkins.CurrentPerspective;
     CPSSkins.CurrentPerspective = perspective;

Added: cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt  Sun Jan 15 
22:28:08 2006
@@ -0,0 +1,22 @@
+<div id="actionPad">
+
+  <ins class="model" cite="@@getHint?msgid=hint-site-designer"></ins>
+  <a onclick="CPSSkins.switchPerspective('site-designer')"
+     href="javascript:void(0)">Site designer</a>
+
+  <ins class="model" cite="@@getHint?msgid=hint-layout-designer"></ins>
+  <a onclick="CPSSkins.switchPerspective('layout-designer')"
+     href="javascript:void(0)">Layout designer</a>
+
+  <ins class="model" cite="@@getHint?msgid=hint-page-designer"></ins>
+  <a onclick="CPSSkins.switchPerspective('page-designer')"
+     href="javascript:void(0)">Page designer</a>
+
+  <ins class="model" cite="@@getHint?msgid=hint-content-author"></ins>
+  <a onclick="CPSSkins.switchPerspective('content-author')"
+     href="javascript:void(0)">Content author</a>
+
+  <!-- tooltip -->
+  <ins class="view" cite="@@getView?id=tooltip"></ins>
+
+</div>

Modified: cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml (original)
+++ cpsskins/branches/jmo-perspectives/ui/panels/configure.zcml Sun Jan 15 
22:28:08 2006
@@ -9,6 +9,11 @@
       permission="zope.ManageContent">
 
     <page
+      name="actionPad.html"
+      template="action_pad.pt"
+    />
+
+    <page
       name="perspectiveSelector.html"
       template="perspective_selector.pt"
     />

Modified: cpsskins/branches/jmo-perspectives/ui/screens/editor.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/screens/editor.pt     (original)
+++ cpsskins/branches/jmo-perspectives/ui/screens/editor.pt     Sun Jan 15 
22:28:08 2006
@@ -27,131 +27,26 @@
   <body>
     <div class="floatingHeader">
 
-      <div id="actionPad">
-
-        <ins class="model" cite="@@getHint?msgid=hint-site-designer"></ins>
-        <a href="#" onclick="javascript: new 
CPSSkins.switchPerspective('site-designer')">Site designer</a>
-
-        <ins class="model" cite="@@getHint?msgid=hint-layout-designer"></ins>
-        <a href="#" onclick="javascript: new 
CPSSkins.switchPerspective('layout-designer')">Layout designer</a>
-
-        <ins class="model" cite="@@getHint?msgid=hint-page-designer"></ins>
-        <a href="#" onclick="javascript: new 
CPSSkins.switchPerspective('page-designer')">Page designer</a>
-
-        <ins class="model" cite="@@getHint?msgid=hint-content-author"></ins>
-        <a href="#" onclick="javascript: new 
CPSSkins.switchPerspective('content-author')">Content author</a>
-
-        <ins class="view">
-        {"widget": {"type": "tooltip"},
-         "show_effect": {"transition": "fadein", "delay": 500}
-        }
-        </ins>
-
-      </div>
-
-      <ins class="view">
-      {"widget": {"type": "panel", "url": "@@perspectiveSelector.html"},
-       "perspectives": ["page-designer", "layout-designer", "content-author"]}
-      </ins>
-
+      <ins class="view" cite="@@getView?id=action-pad"></ins>
+      <ins class="view" cite="@@getView?id=perspective-selector"></ins>
+  <a href="#" onclick="javascript: 
CPSSkins.switchPerspective('content-author')">Content author</a> 
     </div>
 
     <!-- Edit area for rendered content -->
     <div id="editArea">
 
       <!-- top tabs -->
-      <ins class="view">
-      {"widget": {"type": "panel", "url": "@@themeTabs.html"},
-       "perspectives": ["page-designer", "layout-designer"]}
-      </ins>
-
-      <ins class="view">
-      {"widget": {"type": "panel", "url": "@@pageTabs.html"},
-       "perspectives": ["page-designer", "layout-designer"]}
-      </ins>
-
-      <ins class="view">
-      {"widget": {"type": "panel", "url": "@@locationSelector.html"},
-       "perspectives": ["content-author"]},
-       "show_effect": {"transition": "fadein"}
-      </ins>
+      <ins class="view" cite="@@getView?id=theme-tabs"></ins>
+      <ins class="view" cite="@@getView?id=page-tabs"></ins>
+      <ins class="view" cite="@@getView?id=location-selector"></ins>
 
       <!-- rendered pages -->
-      <ins class="view">
-      {"widget": {
-         "type": "panel",
-         "url": "@@renderPage.html?engine=page-designer",
-         "css": "/++skin++cpsskins/@@/++resource++page-designer.css"
-       },
-       "perspectives": ["page-designer"]}
-      </ins>
-
-      <ins class="view">
-      {"widget": {
-         "type": "panel",
-         "url": "@@renderPage.html?engine=layout-designer",
-         "css": "/++skin++cpsskins/@@/++resource++layout-designer.css"
-       },
-       "perspectives": ["page-designer"]}
-      </ins>
-
-      <ins class="view">
-      {"widget": {
-         "type": "panel",
-         "url": "@@renderPage.html?engine=layout-designer",
-         "css": "/++skin++cpsskins/@@/++resource++layout-designer.css"
-       },
-       "perspectives": ["page-designer"]}
-      </ins>
-
-      <ins class="view">
-      {"widget": {
-         "type": "panel",
-         "url": "@@renderPage.html?engine=content-author",
-         "css": "/++skin++cpsskins/@@/++resource++content-author.css"
-       },
-       "perspectives": ["content-author"]}
-      </ins>
+      <ins class="view" cite="@@getView?id=page-designer"></ins>
+      <ins class="view" cite="@@getView?id=layout-designer"></ins>
+      <ins class="view" cite="@@getView?id=content-author"></ins>
 
       <!-- Contextual menu -->
-      <cpsskins:view widget="contextmenu" controller="menuactions">
-
-        <item
-            action="edit"
-            label="menu-edit" i18n:attributes="label"
-            icon="/++skin++cpsskins/@@/edit-16.png"></item>
-
-        <item
-            action="duplicate"
-            label="menu-duplicate" i18n:attributes="label"
-            icon="/++skin++cpsskins/@@/duplicate-16.png"></item>
-
-        <separator></separator>
-
-        <item
-            action="copy"
-            label="menu-copy" i18n:attributes="label"
-            icon="/++skin++cpsskins/@@/copy-16.png"></item>
-        <item
-            action="paste"
-            label="menu-paste" i18n:attributes="label"
-            icon="/++skin++cpsskins/@@/paste-16.png"></item>
-
-        <separator></separator>
-
-        <submenu label="menu-format" i18n:attributes="label">
-          <items choices="formats"></items>
-        </submenu>
-
-        <separator></separator>
-
-        <item
-            action="delete"
-            label="menu-delete" i18n:attributes="label"
-            confirm="Deleting, are you sure?"
-            icon="/++skin++cpsskins/@@/delete-16.png"></item>
-
-      </cpsskins:view>
+      <ins class="view" cite="@@getView?id=context-menu"></ins>
 
       <div id="drag-feedback-box"></div>
       <div id="factory-box"></div>
@@ -160,31 +55,12 @@
 
     <!-- Main area for other screens -->
     <div id="mainArea">
-
-      <ins class="view">
-      {"widget": {
-         "type": "panel",
-         "url": "@@site-designer.html",
-         "css": "/++skin++cpsskins/@@/++resource++site-designer.css"
-       },
-       "perspectives": ["site-designer"]
-      }
-      </ins>
-
+      <ins class="view" cite="@@getView?id=site-designer"></ins>
     </div>
 
     <!-- Bottom area -->
     <div class="floatingFooter">
-
-      <ins class="view">
-      {"widget": {
-         "type": "panel",
-         "url": "@@portletFactory.html"
-       },
-       "perspectives": ["page-designer", "layout-designer", "content-author"]
-      }
-      </ins>
-
+      <ins class="view" cite="@@getView?id=portlet-factory"></ins>
     </div>
 
   </body>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to