Author: jmorliaguet
Date: Thu Jan  5 00:44:36 2006
New Revision: 2142

Removed:
   cpsskins/branches/jmo-perspectives/ui/authoring/authoring_macros.pt
   cpsskins/branches/jmo-perspectives/ui/contentauthor/content_author.pt
   cpsskins/branches/jmo-perspectives/ui/framework/pdlib.js
   cpsskins/branches/jmo-perspectives/ui/framework/utils.js
   cpsskins/branches/jmo-perspectives/ui/layoutdesigner/layout_designer.pt
   cpsskins/branches/jmo-perspectives/ui/pagedesigner/page_designer.pt
Modified:
   cpsskins/branches/jmo-perspectives/browser/README.txt
   cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt
   cpsskins/branches/jmo-perspectives/browser/negociation/views.py
   cpsskins/branches/jmo-perspectives/browser/skin/popup_macros.pt
   cpsskins/branches/jmo-perspectives/browser/skin/template.pt
   cpsskins/branches/jmo-perspectives/interfaces.py
   cpsskins/branches/jmo-perspectives/thememanager.py
   cpsskins/branches/jmo-perspectives/ui/README.txt
   cpsskins/branches/jmo-perspectives/ui/authoring/authoring.css
   cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js
   cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/authoring/views.py
   cpsskins/branches/jmo-perspectives/ui/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/contentauthor/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js
   cpsskins/branches/jmo-perspectives/ui/editing/edit_menu.pt
   cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css
   cpsskins/branches/jmo-perspectives/ui/framework/prototype.js
   cpsskins/branches/jmo-perspectives/ui/layoutdesigner/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/pagedesigner/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/screens/editor.pt
   cpsskins/branches/jmo-perspectives/ui/sitedesigner/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.css
   cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.pt
Log:

- saving work (single page application refactoring)

  TODO: fix drag-and-drop, add support for sub-perspectives,
        remove all url redirections



Modified: cpsskins/branches/jmo-perspectives/browser/README.txt
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/README.txt       (original)
+++ cpsskins/branches/jmo-perspectives/browser/README.txt       Thu Jan  5 
00:44:36 2006
@@ -1,17 +1,7 @@
 
 $id$
 
-This package contains the browser-specific "view-logic" of the application
-including:
-
-authoring
----------
-the theme editor ('page authoring') and portlet editor ('content authoring')
-
-elements
---------
-views for manipulating theme elements as content objects (adding, removing,
-reordering, ...)
+This package contains the basic application views including:
 
 manager
 -------
@@ -23,11 +13,14 @@
 negociation between the client/user (request) and the server -- such as
 the effective theme, the current perspective ...
 
+rendering
+---------
+element viewer, rendering
+
 skin
 ----
 generic skins used in forms, etc.
 
-framework
----------
-javascript libraries (AJAX, JSON-RPC, ...)
-
+tree
+----
+manipulation of elements as tree nodes using request information.

Modified: cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt        
(original)
+++ cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt        
Thu Jan  5 00:44:36 2006
@@ -8,7 +8,7 @@
             <tal:block define="theme_url theme/url">
               <a href=""
                tal:content="theme/id"
-               tal:attributes="href 
string:/++skin++cpsskins$theme_url/@@page-designer.html" />
+               tal:attributes="href 
string:/++skin++cpsskins$theme_url/@@editor.html" />
               (<span tal:content="theme/title" />)
             </tal:block>
           </li>

Modified: cpsskins/branches/jmo-perspectives/browser/negociation/views.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/negociation/views.py     
(original)
+++ cpsskins/branches/jmo-perspectives/browser/negociation/views.py     Thu Jan 
 5 00:44:36 2006
@@ -42,10 +42,19 @@
         (the one that will be effectively displayed)
         """
         context = self.context
-        if ITheme.providedBy(context):
-            return context
-        return queryUtility(ITheme, context=context) or \
-               getThemeManager().getDefaultTheme()
+        request = self.request
+
+        tmutil = getThemeManager()
+
+        # ?theme=...
+        name = request.form.get('theme')
+        if name:
+            theme = tmutil.getThemeByName(name)
+            if theme:
+                return theme
+
+        # theme in context or default theme
+        return queryUtility(ITheme, context=context) or 
tmutil.getDefaultTheme()
 
     def getPage(self):
         """Return the effective page

Modified: cpsskins/branches/jmo-perspectives/browser/skin/popup_macros.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/skin/popup_macros.pt     
(original)
+++ cpsskins/branches/jmo-perspectives/browser/skin/popup_macros.pt     Thu Jan 
 5 00:44:36 2006
@@ -1,7 +1,7 @@
 <metal:block define-macro="page">
   <metal:block define-slot="doctype">
-    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
   </metal:block>
   <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
     <head>
@@ -19,8 +19,8 @@
 
 <metal:block define-macro="frames">
   <metal:block define-slot="doctype">
-    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
   </metal:block>
   <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
     <head>

Modified: cpsskins/branches/jmo-perspectives/browser/skin/template.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/skin/template.pt (original)
+++ cpsskins/branches/jmo-perspectives/browser/skin/template.pt Thu Jan  5 
00:44:36 2006
@@ -1,7 +1,7 @@
 <metal:block define-macro="page">
   <metal:block define-slot="doctype">
-    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
   </metal:block>
   <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"
   tal:define="negociation nocall:context/@@negociation;

Modified: cpsskins/branches/jmo-perspectives/interfaces.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/interfaces.py    (original)
+++ cpsskins/branches/jmo-perspectives/interfaces.py    Thu Jan  5 00:44:36 2006
@@ -57,6 +57,9 @@
     def getThemes():
         """Return the list of available themes."""
 
+    def getThemeByName(name):
+        """Return a theme by its name."""
+
     def getDefaultTheme():
         """Return the default theme."""
 

Modified: cpsskins/branches/jmo-perspectives/thememanager.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/thememanager.py  (original)
+++ cpsskins/branches/jmo-perspectives/thememanager.py  Thu Jan  5 00:44:36 2006
@@ -155,6 +155,15 @@
         """
         return [theme for name, theme in getUtilitiesFor(ITheme, self)]
 
+    def getThemeByName(self, name=u''):
+        """Return a theme by its name.
+        """
+        for k, v in getUtilitiesFor(ITheme, self):
+            if k != name:
+                continue
+            return v
+        return None
+
     def isDefault(self, object=None):
         """Return True if the element is used by default
         """

Modified: cpsskins/branches/jmo-perspectives/ui/README.txt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/README.txt    (original)
+++ cpsskins/branches/jmo-perspectives/ui/README.txt    Thu Jan  5 00:44:36 2006
@@ -1,33 +1,18 @@
 
-This package contains the setup of the following rendering engines:
+This package contains views for the user interface
 
-- pagedesigner
-
-- layoutdesigner
-
-- contentauthor
-
-- jsr168
-
-- default
-
-  contains default engines, formats and filters
-
-- authoring
-
-  contains resources for the engines that use authoring functions (Ajax, ...)
-
-
-The directory and file structure is:
-
-- configure.zcml (the main configuration file)
-
-- engine.zcml (the definition of the rendering engine itself)
-
-- accesskeys.zcml (the access keys defined by the engine)
-
-- perspectives.zcml (the perspectives defined by the engine)
-
-- filters/ (the filters defined by the engine)
-
-- formats/ (the formats defined by the engine)
+authoring
+---------
+creating, removing elements
+
+editing
+-------
+editing existing elements
+
+framework
+---------
+javascript libraries (AJAX, JSON-RPC, ...)
+
+screens
+-------
+different screens (site designer, page designer, layout designer, ...)

Modified: cpsskins/branches/jmo-perspectives/ui/authoring/authoring.css
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/authoring.css       
(original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/authoring.css       Thu Jan 
 5 00:44:36 2006
@@ -8,16 +8,17 @@
   padding: 0;
   overflow-y: expression('auto'); /* IE */
   height: expression('100%'); /* IE */
+  font: 12px Arial, Helvetica, sans-serif;
 }
 
-#editSpace {
+#editArea {
   border-top: 2px solid #000;
   margin-top: 50px;
 }
 
 div.locationSelector {
   background-color: #eee;
-  font: 12px Arial, sans-serif;
+  font-size: 12px;
   padding: 0.2em;
   border-bottom: 1px solid #ccc;
   margin-bottom: 0.5em;
@@ -76,13 +77,13 @@
 }
 
 /* toolbar buttons */
-.actionPad {
+#actionPad {
   padding-top: 12px;
   padding-left: 5px;
 }
 
-.actionPad a {
-  font: 12px Arial, Helvetica, sans-serif;
+#actionPad a {
+  font-size: 12px;
   color: #000 !important;
   background: #f6f6f6;
   text-decoration: none;
@@ -93,14 +94,14 @@
   margin: 0 0 0 4px;
 }
 
-.actionPad a.selected, .actionPad a:hover {
+#actionPad a.selected, #actionPad a:hover {
   background-color: #f9ff50;
   border-width: 1px;
   border-style: solid;
   border-color: #333 #ccc #ccc #333;
 }
 
-.actionPad a.exit {
+#actionPad a.exit {
   background-color: #dfb;
 }
 
@@ -125,7 +126,7 @@
 
 .topTabs, .topTabs a {
   text-decoration: none;
-  font: 11px Arial, Helvetica, sans-serif;
+  font-size: 11px;
   color: #000;
 }
 
@@ -171,7 +172,7 @@
 .pageTabs {
   text-align: left;
   text-decoration: none;
-  font: 11px Arial, Helvetica, sans-serif;
+  font-size: 11px;
   border-bottom: 1px dotted #ccc;
   margin-bottom: 15px;
   margin-top: 7px;
@@ -214,7 +215,7 @@
   position: absolute;
   right: 13px;
   top: 8px;
-  font: 11px Verdana, Arial, Helvetica, sans-serif;
+  font-size: 11px;
   background-image: url(/++skin++cpsskins/@@/perspective-12.png);
   background-repeat: no-repeat;
   background-position: 5% 50%;
@@ -226,99 +227,6 @@
 }
 
 
-/* PDLib */
-.context-menu {
-  font: 11px Verdana, Arial, Helvetica, sans-serif;
-  position: absolute;
-  border-width: 1px 2px 2px 1px;
-  border-style: solid;
-  border-color: #666;
-  background: #eeeeec;
-  color: #000;
-  cursor: default;
-  z-index: 2000;
-  visibility: hidden;
-  display: table;
-  white-space: nowrap;
-  width: 120px;
-}
-
-.context-menu a {
-  color: #000;
-  padding: 4px 5px 4px 29px;
-  vertical-align: top;
-  cursor: default;
-  display: block;
-  background-repeat: no-repeat;
-  background-position: 6px center;
-  width: 86px;
-}
-
-.context-menu a:hover {
-  background-color: #3465a4;
-  color: #fff;
-}
-
-.context-menu .edit {
-  background-image: url(/++skin++cpsskins/@@/edit-16.png);
-}
-
-.context-menu .format {
-  background-image: url(/++skin++cpsskins/@@/format-16.png);
-}
-
-.context-menu .copy {
-  background-image: url(/++skin++cpsskins/@@/copy-16.png);
-}
-
-.context-menu .paste {
-  background-image: url(/++skin++cpsskins/@@/paste-16.png);
-}
-
-.context-menu .duplicate {
-  background-image: url(/++skin++cpsskins/@@/duplicate-16.png);
-}
-
-.context-menu .delete {
-  background-image: url(/++skin++cpsskins/@@/delete-16.png);
-}
-
-.context-menu .separator {
-  border-bottom: 1px solid #666;
-  margin: 3px;
-}
-
-.context-menu-item {
-}
-
-.context-submenu { 
-  display: none;
-  position: absolute;
-  top: auto;
-  left: auto;
-  border-width: 1px 2px 2px 1px;
-  border-style: solid;
-  border-color: #333;
-  margin-top: -2px;
-}
-
-.context-submenu a {
-  background: #f6f3f3;
-  background-image: url(/++skin++cpsskins/@@/li-16.png);
-  background-repeat: no-repeat;
-  background-position: 6px center;
-}
-
-.context-submenu a:hover {
-  background-color: #326ab7;
-  color: #fff;
-}
-
-.context-menu-item > .context-submenu { /* ignored by IE */
-  margin-top: -20px;
-}
-
-
 /* inline editing of portlets and of canvas elements  */
 
 /* Macro slots */
@@ -356,16 +264,3 @@
   z-index: 5;
 }
 
-#tooltip-box {
-  position: absolute;
-  top: 100px;
-  border-style: solid;
-  border-width: 1px 2px 2px 1px;
-  border-color: #666;
-  background-color: #ffc;
-  padding: 0.3em 0.5em;
-  width: 200px;
-  font: 13px Arial, sans-serif;
-  z-index: 100;
-}
-

Modified: cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js        
(original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js        Thu Jan 
 5 00:44:36 2006
@@ -7,12 +7,7 @@
 var current_container = null;
 var drag_destination = null;
 
-var context_menu = null;
 var drag_box = null;
-var tooltip_box = null;
-var tooltip_active = false;
-
-var menu_actions = null;
 
 function getEngineName() {
   var engine = '';
@@ -21,14 +16,27 @@
   return engine;
 }
 
+var newwindow = '';
+
+function newWindow(url) {
+  if (!newwindow.closed && newwindow.location) {
+    newwindow.close();
+  }
+  newwindow=window.open(url, 'selector', "width=760, height=600, location=no, 
menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes");
+  if (!newwindow.opener) newwindow.opener = self;
+  if (window.focus) {newwindow.focus()}
+  return false;
+}
+
 /* Box */
 Box = Class.create();
 Box.prototype = {
   initialize: function(node) {
+    var node = $(node);
     this.node = node;
     this.bg = node.style.background;
     this.container = node.parentNode;
-    this.order = Util.getElementOrder(node);
+    this.order = Identifiable.getOrder(node);
     this.xpos = null;
     this.ypos = null;
     this.can_move = true;
@@ -51,47 +59,9 @@
   cloneDimensions: function(source) {
     Element.setStyle(this.node, {
       width: '' + source.offsetWidth - 2 + 'px',
-      height: '' + source.offsetHeight - 2 + 'px',
+      height: '' + source.offsetHeight - 2 + 'px'
     });
-  },
-}
-
-/* Actions */
-MenuActions = Class.create();
-MenuActions.prototype = {
-  initialize: function() {
-    this.handlers = {
-      'edit': function(id) {
-        var new_url = '@@edit-panel.html?id=' + id;
-        newWindow(new_url);
-      },
-      'duplicate': function(id) {
-        current_elem = pd_selected_item;
-        model.duplicate({'id': id});
-      },
-      'copy': function(id) {
-        model.copy({'id': id});
-      },
-      'paste': function(id) {
-        model.paste({'id': id});
-      },
-      'format': function(id, format) {
-        var new_url = '@@edit-panel.html?id=' + id + '&format=' + format;
-        newWindow(new_url);
-      },
-      'remove': function(id) {
-        model.remove({'id': id});
-        var container = pd_selected_item.parentNode;
-        container.removeChild(pd_selected_item);
-      },
-    }
-  },
-  call: function(id, action, choice) {
-    handler = this.handlers[action];
-    if (handler) handler(id, choice);
-    pd_hideContextSubMenu();
-    pd_hideContextMenu();
-  },
+  }
 }
 
 /* MODELS */
@@ -115,7 +85,7 @@
         var new_id = request.responseText;
         var rendered = render_element(id=new_id);
         var container = current_elem.parentNode;
-        container.insertBefore(rendered, Util.getNextElement(current_elem));
+        container.insertBefore(rendered, Identifiable.getNext(current_elem));
         // set up the new nodes
         pd_setupPage();
       }
@@ -153,7 +123,7 @@
         current_container = null;
         current_elem = null;
         pd_setupPage();
-      },
+      }
     });
   },
   add: function(args) {
@@ -168,9 +138,9 @@
         }
         current_elem = null;
         pd_setupPage();
-      },
+      }
     });
-  },
+  }
 }
 
 /* VIEWS */
@@ -178,7 +148,7 @@
   // XXX the wrapper is not necessarily a div
   var wrapper = document.createElement('div');
   new Ajax.Updater(wrapper, 'renderElement', options={
-    parameters: $H({'id':id, 'engine':getEngineName()}).toQueryString(),
+    parameters: $H({'id':id, 'engine':getEngineName()}).toQueryString()
   });
   return wrapper;
 }
@@ -208,23 +178,6 @@
 
 /* CONTROLLERS */
 
-/* Contextual menu  */
-function menu_action(e) {
-  if (pd_selected_item == null) 
-    return;
-  if (!e) e = event;
-  var target = Event.element(e);
-  if (!target) return;
-  var confirm = target.getAttribute("confirm");
-  if (confirm) {
-    if (!window.confirm(confirm)) return;
-  }
-  var action = target.getAttribute("action");
-  var choice = target.getAttribute("choice");
-  var id = pd_selected_item.getAttribute("id");
-  menu_actions.call(id, action, choice);
-}
-
 /* Drag-and-drop, etc */
 function drag_element(el, e) {
   if (!pd_drag_event) return;
@@ -243,7 +196,7 @@
   var speed = vertical_speed(e);
   if (Math.abs(speed) < 1) return;
   if (speed > 0) {
-    var target = Util.getNextElement(el);
+    var target = Identifiable.getNext(el);
   } else {
     var target = el;
   }
@@ -258,10 +211,10 @@
 }
 
 function save_move(elem) {
-  var parent = Util.getParentElement(elem);
+  var parent = Identifiable.getParent(elem);
   var src_id = elem.getAttribute("id");
   var dest_id = parent.getAttribute("id");
-  var order = Util.getElementOrder(elem);
+  var order = Identifiable.getOrder(elem);
   current_elem = elem;
   current_container = parent;
   model.move({'src_id': src_id, 'dest_id': dest_id, 'order': order});
@@ -275,15 +228,15 @@
   if (!Element.hasClassName(moving, 'draggable')) return;
   var target = Event.element(e);
   if (!Element.hasClassName(target, 'container')) return;
-  if (!Util.isNodeEmpty(target)) return;
+  if (!Identifiable.isEmpty(target)) return;
   target.appendChild(moving);
   current_elem = moving;
 }
 
 function add_element(container, el, type_name) {
-  var container_id = Util.getTargetElement(container).getAttribute("id");
+  var container_id = 
Identifiable.getIdentifiableElement(container).getAttribute("id");
   if (el) {
-    var order = Util.getElementOrder(el);
+    var order = Identifiable.getOrder(el);
   } else {
     var order = 0;
   }
@@ -330,7 +283,7 @@
     setCursor("default");
     if (!moved) return;
     if (!current_elem) return;
-    if ((moved.order == Util.getElementOrder(current_elem))
+    if ((moved.order == Identifiable.getOrder(current_elem))
      && (moved.container == current_elem.parentNode)) return;
     save_move(current_elem);
     moved = null;
@@ -360,11 +313,11 @@
   Event.observe(mo, 'mouseup', function(e) {
     if (factory) {
       var type_name = factory.node.getAttribute("type_name");
-      if (Util.isNodeEmpty(mo)) {
+      if (Identifiable.isEmpty(mo)) {
         var el = null; 
       } else {
         var target = Event.element(e);
-        var el = Util.getTargetElement(target);
+        var el = Identifiable.getIdentifiableElement(target);
       }
       add_element(mo, el, type_name);
     }
@@ -373,14 +326,6 @@
 }
 
 function setupEditable(mo) {
-  contextmenu_handler = function(e) {
-    var target = Event.element(e);
-    if (Element.hasClassName(target, 'editable') || !moved) {
-      return pd_stopEvent(e);
-    } else {
-      return pd_itemOnContextMenu(mo, e, "choice-context-menu");
-    }
-  }
   Event.observe(mo, 'mousedown', function(e) {
     var target = Event.element(e);
     if (Element.hasClassName(target, 'editable')) return;
@@ -390,62 +335,47 @@
     edit_element(target, target.name, target.value);
     pd_stopEvent(e);
     });
-  Event.observe(mo, 'contextmenu', contextmenu_handler);
-  Event.observe(mo, 'click', contextmenu_handler);
-}
-
-function setupTooltip(mo) {
-  Event.observe(mo, 'mouseover', function(e) {
-    var target = Event.element(e);
-    tooltip_box.style.top = '' + (Event.pointerY(e) + 20) + 'px';
-    tooltip_box.style.left = '' + (Event.pointerX(e)) + 'px';
-    tooltip_box.innerHTML = target.getAttribute('hint');
-    tooltip_active = true;
-    setTimeout("showTooltip()", 1000);
-    });
-  Event.observe(mo, 'mouseout', function(e) {
-    Element.hide('tooltip-box');
-    tooltip_active = false;
-    });
-}
-
-function showTooltip() {
-  if (tooltip_active) Element.show('tooltip-box');
-}
-
-function setupContextMenu(mo) {
-  Event.observe(mo, 'mousedown', pd_stopEvent);
-  Event.observe(mo, 'mouseup', menu_action);
-}
-
-function setupContextMenuItem(mo) {
-  Event.observe(mo, 'click', menu_action);
-  Event.observe(mo, 'mouseover', function() {
-    pd_showContextSubMenu(mo);
-    });
-  Event.observe(mo, 'mouseup', pd_stopEvent);
-  Event.observe(mo, 'mouseout', pd_hideContextSubMenu);
 }
 
 /* Setup editor, JSON-RPC */
 function setupEditor() {
     edit_space = $("editSpace");
-    drag_box = new Box($("drag-feedback-box"));
-    context_menu = $("choice-context-menu");
-    tooltip_box = $("tooltip-box");
-    Element.hide('tooltip-box')
+    drag_box = new Box('drag-feedback-box');
 
     model = new Model();
-    menu_actions = new MenuActions();
 
-    pd_setupPage();
+    new CPSSkins.Controller('menuactions').register({
+      'edit': function(selected, choice) {
+          var id = selected.getAttribute('id');
+          var new_url = '@@edit-panel.html?id=' + id;
+          newWindow(new_url);
+      },
+      'duplicate': function(selected, choice) {
+          var id = selected.getAttribute('id');
+          current_elem = selected;
+          model.duplicate({'id': id});
+      },
+      'copy': function(selected, choice) {
+          var id = selected.getAttribute('id');
+          model.copy({'id': id});
+      },
+      'paste': function(selected, choice) {
+          var id = selected.getAttribute('id');
+          model.paste({'id': id});
+      },
+      'format': function(selected, choice) {
+          var id = selected.getAttribute('id');
+          var new_url = '@@edit-panel.html?id=' + id + '&format=' + choice;
+          newWindow(new_url);
+      },
+      'remove': function(selected, choice) {
+          var id = selected.getAttribute('id');
+          model.remove({'id': id});
+          var container = selected.parentNode;
+          container.removeChild(selected);
+      }
+    });
 }
 
-// Register event handlers
-pd_node_setup['factory'] = setupFactory;
-pd_node_setup['container'] = setupContainer;
-pd_node_setup['draggable'] = setupDraggable;
-pd_node_setup['editable'] = setupEditable;
-pd_node_setup['tooltip'] = setupTooltip;
-pd_node_setup['context-menu'] = setupContextMenu;
-pd_node_setup['context-menu-item'] = setupContextMenuItem;
+Event.observe(window, "load", setupEditor);
+

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      Thu Jan 
 5 00:44:36 2006
@@ -15,18 +15,6 @@
       name="authoring.js" file="authoring.js"
       layer="cpsskins" />
 
-  <browser:page
-      for="*"
-      name="authoring_macros"
-      permission="zope.Public"
-      template="authoring_macros.pt"
-  />
-
-  <browser:menu
-       id="cpsskins_authoring_actions"
-       title="Authoring actions"
-  />
-
   <browser:pages
       for="cpsskins.elements.interfaces.IElement"
       layer="cpsskins"

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    Thu Jan  5 
00:44:36 2006
@@ -103,6 +103,10 @@
             self.session_info['perspective'] = perspective
         self._redirect()
 
+    ###################################################################
+    # Presentation
+    ###################################################################
+
     def clonePresentation(self, perspective=None):
         """Clone a view in a given perspective by:
 
@@ -130,6 +134,10 @@
         IPresentable(self.context).removePresentation(perspective)
         self._redirect()
 
+    ###################################################################
+    # Format
+    ###################################################################
+
     def customizeFormat(self, name=u'', perspective=None):
         perspectives = getUtility(IResourceManager, 'perspectives')
         perspective = perspectives.lookup(perspective, context=self.context)
@@ -244,3 +252,4 @@
         container = getParent(element)
         duplicating = getMultiAdapter((container, request), INodeDuplicating)
         return str(duplicating.duplicate(element))
+

Modified: cpsskins/branches/jmo-perspectives/ui/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/configure.zcml        (original)
+++ cpsskins/branches/jmo-perspectives/ui/configure.zcml        Thu Jan  5 
00:44:36 2006
@@ -1,6 +1,8 @@
 <configure
     xmlns="http://namespaces.zope.org/zope";>
 
+  <include package=".screens" />
+
   <!-- default engine (HTML) -->
   <include package=".default" />
 

Modified: cpsskins/branches/jmo-perspectives/ui/contentauthor/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/contentauthor/configure.zcml  
(original)
+++ cpsskins/branches/jmo-perspectives/ui/contentauthor/configure.zcml  Thu Jan 
 5 00:44:36 2006
@@ -6,35 +6,9 @@
 
   <include file="engine.zcml" />
 
-  <browser:page
-      name="content-author.html"
-      class=".Authoring"
-      for="cpsskins.elements.interfaces.ITheme"
-      template="content_author.pt"
-      permission="zope.Public"
-      layer="cpsskins"
-  />
-
-  <browser:page
-      name="content-author.html"
-      class=".Authoring"
-      for="cpsskins.elements.interfaces.IThemePage"
-      template="content_author.pt"
-      permission="zope.Public"
-      layer="cpsskins"
-  />
-
   <browser:resource
       name="content-author.css" file="content_author.css"
       layer="cpsskins"
   />
 
-  <browser:menuItem
-      menu="cpsskins_authoring_actions"
-      for="*"
-      title="Content author"
-      description="Content authors add content to pages in different contexts."
-      action="@@content-author.html"
-  />
-
 </configure>

Modified: 
cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js 
(original)
+++ cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js 
Thu Jan  5 00:44:36 2006
@@ -49,7 +49,7 @@
     if (!label) {
       label = 'unknown label';
     }
-    Util.replaceHTML(tooltip_box, label);
+    tooltip_box.innerHTML = label;
     tooltip_box.style.left = '' + Event.pointerX(e) + "px";
     tooltip_box.style.top = '' + Event.pointerY(e) + "px";
     Element.show(tooltip_box);
@@ -64,7 +64,7 @@
     // ignore inactive elements
     if (elem.getAttribute("inactive")) return;
     // Get the element selector
-    var selector = Util.getSelectorInContext(elem, context=widget_area);
+    var selector = this.getSelectorInContext(elem, context=widget_area);
     if (selector == this.selector) return;
     this.selector = selector;
     // Set the current selector style
@@ -107,7 +107,7 @@
       style += "#previewArea " + widget_tag + " " + sel + "{" + attrs + "}";
     }
     // XXX this does not work with IE
-    Util.replaceHTML($('style'), style);
+    $('style').innerHTML = style;
   },
 
   getSelectorStyle: function() {
@@ -132,6 +132,30 @@
     });
   },
 
+  getSelectorInContext: function(element, context) {
+    var i, node, tag, name, selector;
+    node = element;
+
+    // If no context is passed, use the document itself.
+    if (!context) context = document;
+
+    var selectors = new Array()
+    while (node) {
+      if (node == context) break;
+      tag = node.tagName;
+      if (!tag) break;
+      tag = tag.toLowerCase();
+      name = node.className;
+      selector = name ? tag + '.' + name : tag;
+
+      // ignore tags that have the "ignore" attribute set
+      if (!node.getAttribute("ignore")) selectors.push(selector);
+      node = node.parentNode;
+    }
+    // reverse the array
+    selectors.reverse();
+    return selectors.join(" ");
+  }
 }
 
 
@@ -249,7 +273,7 @@
 
 /* Debug */
 function write_message(msg) {
-  if (message_box) Util.replaceHTML(message_box, msg);
+  if (message_box) message_box.innerHTML = msg;
 }
 
 function clear_message() {

Modified: cpsskins/branches/jmo-perspectives/ui/editing/edit_menu.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/editing/edit_menu.pt  (original)
+++ cpsskins/branches/jmo-perspectives/ui/editing/edit_menu.pt  Thu Jan  5 
00:44:36 2006
@@ -12,8 +12,6 @@
                    'parent.main.location.href = \'%s\'' % main_url
                     or 'parent.main.location.reload()'">
 
-    <metal:block use-macro="context/@@authoring_macros/perspective_selector" />
-
     <!-- top menu -->
     <ul class="buttons">
 

Modified: cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml      
(original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/configure.zcml      Thu Jan 
 5 00:44:36 2006
@@ -2,17 +2,16 @@
     xmlns="http://namespaces.zope.org/browser";
     xmlns:zope="http://namespaces.zope.org/zope";>
 
-  <!-- Drag and drop, contextual menus -->
+  <!-- Drag and drop, contextual menus, tooltips -->
   <resource
-      name="pdlib.js" file="pdlib.js"
+      name="cpsskins.js" file="cpsskins.js"
       layer="cpsskins" />
 
-
-  <!-- Utilities, libraries -->
   <resource
-      name="utils.js" file="utils.js"
+      name="cpsskins.css" file="cpsskins.css"
       layer="cpsskins" />
 
+  <!-- Utilities, libraries -->
   <resource
       name="prototype.js" file="prototype.js"
       layer="cpsskins" />

Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css        
(original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css        Thu Jan 
 5 00:44:36 2006
@@ -8,6 +8,8 @@
   border-color: #666;
   border-width: 1px 2px 2px 1px;
   border-style: solid;
+  width: 200px;
+  z-index: 1000;
 }
 
 

Modified: cpsskins/branches/jmo-perspectives/ui/framework/prototype.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/prototype.js        
(original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/prototype.js        Thu Jan 
 5 00:44:36 2006
@@ -1782,4 +1782,4 @@
 
     return [valueL, valueT];
   }
-}
\ No newline at end of file
+}

Modified: cpsskins/branches/jmo-perspectives/ui/layoutdesigner/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/layoutdesigner/configure.zcml 
(original)
+++ cpsskins/branches/jmo-perspectives/ui/layoutdesigner/configure.zcml Thu Jan 
 5 00:44:36 2006
@@ -6,36 +6,10 @@
 
   <include file="engine.zcml" />
 
-  <browser:page
-      name="layout-designer.html"
-      class=".Authoring"
-      for="cpsskins.elements.interfaces.ITheme"
-      template="layout_designer.pt"
-      permission="zope.Public"
-      layer="cpsskins"
-  />
-
-  <browser:page
-      name="layout-designer.html"
-      class=".Authoring"
-      for="cpsskins.elements.interfaces.IThemePage"
-      template="layout_designer.pt"
-      permission="zope.Public"
-      layer="cpsskins"
-  />
-
   <browser:resource
       name="layout-designer.css"
       file="layout_designer.css"
       layer="cpsskins"
   />
 
-  <browser:menuItem
-      menu="cpsskins_authoring_actions"
-      for="*"
-      title="Layout designer"
-      description="Layout designers define the layout structure of pages."
-      action="@@layout-designer.html"
-  />
-
 </configure>

Modified: cpsskins/branches/jmo-perspectives/ui/pagedesigner/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/pagedesigner/configure.zcml   
(original)
+++ cpsskins/branches/jmo-perspectives/ui/pagedesigner/configure.zcml   Thu Jan 
 5 00:44:36 2006
@@ -6,32 +6,6 @@
 
   <include file="engine.zcml" />
 
-  <browser:page
-      name="page-designer.html"
-      class=".Authoring"
-      for="cpsskins.elements.interfaces.ITheme"
-      template="page_designer.pt"
-      permission="zope.Public"
-      layer="cpsskins"
-  />
-
-  <browser:page
-      name="page-designer.html"
-      class=".Authoring"
-      for="cpsskins.elements.interfaces.IThemePage"
-      template="page_designer.pt"
-      permission="zope.Public"
-      layer="cpsskins"
-  />
-
-  <browser:menuItem
-      menu="cpsskins_authoring_actions"
-      for="*"
-      title="Page designer"
-      description="Page designers are in charge of the site's graphic design. 
They also define the areas in which content authors will add the site's 
content."
-      action="@@page-designer.html"
-  />
-
   <browser:resource
       name="page-designer.css"
       file="page_designer.css"

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     Thu Jan  5 
00:44:36 2006
@@ -17,11 +17,13 @@
     <script type="text/javascript"
             src="/++skin++cpsskins/@@/++resource++prototype.js"></script>
     <script type="text/javascript"
+            src="/++skin++cpsskins/@@/++resource++pdlib.js"></script>
+    <script type="text/javascript"
+            src="/++skin++cpsskins/@@/++resource++authoring.js"></script>
+    <script type="text/javascript"
             src="/++skin++cpsskins/@@/++resource++json.js"></script>
     <script type="text/javascript"
             src="/++skin++cpsskins/@@/++resource++cpsskins.js"></script>
-    <script type="text/javascript"
-            src="/++skin++cpsskins/@@/++resource++authoring.js"></script>
   </head>
   <body>
     <div class="floatingHeader">
@@ -62,6 +64,13 @@
 
     </div>
 
+      <!-- main area: rendered page -->
+      <cpsskins:panel
+          perspectives="site-designer"
+          url="@@site-designer.html"
+          css="/++skin++cpsskins/@@/++resource++site-designer.css">
+      </cpsskins:panel>
+
     <div id="editArea">
 
       <!-- top area -->
@@ -80,13 +89,6 @@
           url="@@locationSelector.html">
       </cpsskins:panel>
 
-      <!-- main area: rendered page -->
-      <cpsskins:panel
-          perspectives="site-designer"
-          url="@@site-designer.html"
-          css="/++skin++cpsskins/@@/++resource++site-designer.css">
-      </cpsskins:panel>
-
       <cpsskins:panel
           perspectives="page-designer"
           url="@@renderPage.html?engine=page-designer"

Modified: cpsskins/branches/jmo-perspectives/ui/sitedesigner/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/sitedesigner/configure.zcml   
(original)
+++ cpsskins/branches/jmo-perspectives/ui/sitedesigner/configure.zcml   Thu Jan 
 5 00:44:36 2006
@@ -11,14 +11,6 @@
       template="site_designer.pt"
   />
 
-  <menuItem
-      for="*"
-      menu="cpsskins_authoring_actions"
-      title="Site designer"
-      action="@@site-designer.html"
-      description="Site designers are in charge of the overall site's design. 
They manage resources and settings."
-  />
-
   <resource
       name="site-designer.css"
       file="site_designer.css"

Modified: cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.css
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.css        
(original)
+++ cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.css        
Thu Jan  5 00:44:36 2006
@@ -1,5 +1,5 @@
 
-.editArea {
+#editArea {
   font: 12px Arial, sans-serif;
   padding: 1em;
 }
@@ -59,10 +59,6 @@
   list-style: none;
 }
 
-li {
-}
-
-
 table.panel {
   width: 100%;
 }

Modified: cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.pt 
(original)
+++ cpsskins/branches/jmo-perspectives/ui/sitedesigner/site_designer.pt Thu Jan 
 5 00:44:36 2006
@@ -4,91 +4,70 @@
                    subsection selection/subsection|nothing;
                    selected selection/selected|nothing">
 
-<metal:block use-macro="context/@@authoring_macros/editor">
+  <h1>Site designer</h1>
 
-  <metal:block fill-slot="css">
-    <link rel="Stylesheet" type="text/css"
-          href="/++skin++cpsskins/@@/++resource++site-designer.css" />
-  </metal:block>
-
-  <metal:block fill-slot="header">
-    <metal:block use-macro="context/@@authoring_macros/perspective_selector" />
-    <metal:block use-macro="context/@@authoring_macros/navigation_pad" />
-  </metal:block>
-
-  <metal:block fill-slot="main">
-
-    <div class="editArea">
-
-      <h1>Site designer</h1>
-
-      <table class="panel" cellpadding="0" cellspacing="0"
-             tal:define="info context/@@getSettingInfo">
-        <tr>
-          <td class="first">
-            <h2>Settings</h2>
-            <div class="sections">
-              <img class="icon"
-                   src="/++skin++cpsskins/@@/++resource++settings-48.png" />
-              <ul>
-                <li tal:repeat="subsection info">
-                  <a class="section"
-                     tal:attributes="href 
string:@@setSelection?subsection=$subsection"
-                     tal:content="subsection" i18n:translate="" />
-                </li>
-              </ul>
-              <br style="clear:both"/>
-            </div>
-          </td>
-          <td class="subsection" tal:condition="subsection">
-
-            <h2 tal:content="subsection" i18n:translate="" />
-            <div class="sections">
-
-            <ul tal:define="setting_info info">
-              <li tal:repeat="info setting_info/?subsection|nothing">
-                <tal:block content="info/setting/title" />
-                <tal:block define="name info/name;
-                                   readonly info/readonly;
-                                   custom info/custom">
-                  <a tal:attributes="href string:@@customizeSetting?name=$name"
-                     tal:condition="readonly">[customize]</a>
-                  <a tal:attributes="href string:@@removeSetting?name=$name"
-                     tal:condition="python: not custom and not 
readonly">[remove]</a>
-                  <a tal:attributes="href 
string:@@decustomizeSetting?name=$name"
-                     tal:condition="custom">[remove customization]</a>
-                  <a tal:attributes="href string:@@exportSetting?name=$name"
-                     tal:condition="not:readonly">[export]</a>
-                  <a tal:attributes="href string:@@reloadSetting?name=$name"
-                     tal:condition="readonly">[reload]</a>
-                </tal:block>
-              </li>
-            </ul>
-            </div>
-
-          </td>
-        </tr>
-      </table>
-
-      <h2>Associations</h2>
-      <div class="sections">
-        <img class="icon"
-             src="/++skin++cpsskins/@@/++resource++associations-48.png" />
-        <span class="description">local themes, perspectives ...</span>
-        <br style="clear:both"/>
-      </div>
-
-      <h2>Management</h2>
-      <div class="sections">
-        <img class="icon"
-             src="/++skin++cpsskins/@@/++resource++management-48.png" />
-        <span class="description">export, import themes and settings ...</span>
-        <br style="clear:both"/>
-      </div>
-
-    </div>
-  </metal:block>
-
-</metal:block>
+  <table class="panel" cellpadding="0" cellspacing="0"
+         tal:define="info context/@@getSettingInfo">
+    <tr>
+      <td class="first">
+        <h2>Settings</h2>
+        <div class="sections">
+          <img class="icon"
+               src="/++skin++cpsskins/@@/++resource++settings-48.png" />
+          <ul>
+            <li tal:repeat="subsection info">
+              <a class="section"
+                 tal:attributes="href 
string:@@setSelection?subsection=$subsection"
+                 tal:content="subsection" i18n:translate="" />
+            </li>
+          </ul>
+          <br style="clear:both"/>
+        </div>
+      </td>
+      <td class="subsection" tal:condition="subsection">
+
+        <h2 tal:content="subsection" i18n:translate="" />
+        <div class="sections">
+
+        <ul tal:define="setting_info info">
+          <li tal:repeat="info setting_info/?subsection|nothing">
+            <tal:block content="info/setting/title" />
+            <tal:block define="name info/name;
+                               readonly info/readonly;
+                               custom info/custom">
+              <a tal:attributes="href string:@@customizeSetting?name=$name"
+                 tal:condition="readonly">[customize]</a>
+              <a tal:attributes="href string:@@removeSetting?name=$name"
+                 tal:condition="python: not custom and not 
readonly">[remove]</a>
+              <a tal:attributes="href string:@@decustomizeSetting?name=$name"
+                 tal:condition="custom">[remove customization]</a>
+              <a tal:attributes="href string:@@exportSetting?name=$name"
+                 tal:condition="not:readonly">[export]</a>
+              <a tal:attributes="href string:@@reloadSetting?name=$name"
+                 tal:condition="readonly">[reload]</a>
+            </tal:block>
+          </li>
+        </ul>
+        </div>
+
+      </td>
+    </tr>
+  </table>
+
+  <h2>Associations</h2>
+  <div class="sections">
+    <img class="icon"
+         src="/++skin++cpsskins/@@/++resource++associations-48.png" />
+    <span class="description">local themes, perspectives ...</span>
+    <br style="clear:both"/>
+  </div>
+
+  <h2>Management</h2>
+  <div class="sections">
+    <img class="icon"
+         src="/++skin++cpsskins/@@/++resource++management-48.png" />
+    <span class="description">export, import themes and settings ...</span>
+    <br style="clear:both"/>
+  </div>
 
 </tal:block>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to