Author: jmorliaguet Date: Mon Feb 27 21:23:01 2006 New Revision: 2498 Modified: cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js cpsskins/branches/jmo-perspectives/ui/authoring/configure.zcml cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py cpsskins/branches/jmo-perspectives/ui/authoring/views.py cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt cpsskins/branches/jmo-perspectives/ui/screens/editor.pt Log:
- updated to the latest API 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 Mon Feb 27 21:23:01 2006 @@ -36,7 +36,7 @@ this.node = node; this.bg = node.style.background; this.container = node.parentNode; - this.order = Identifiable.getOrder(node); + this.order = CPSSkins.Identifiable.getOrder(node); this.xpos = null; this.ypos = null; this.can_move = true; @@ -85,7 +85,7 @@ var new_id = request.responseText; var rendered = render_element(id=new_id); var container = current_elem.parentNode; - container.insertBefore(rendered, Identifiable.getNext(current_elem)); + container.insertBefore(rendered, CPSSkins.Identifiable.getNext(current_elem)); // set up the new nodes pd_setupPage(); } @@ -196,7 +196,7 @@ var speed = vertical_speed(e); if (Math.abs(speed) < 1) return; if (speed > 0) { - var target = Identifiable.getNext(el); + var target = CPSSkins.Identifiable.getNext(el); } else { var target = el; } @@ -211,10 +211,10 @@ } function save_move(elem) { - var parent = Identifiable.getParent(elem); + var parent = CPSSkins.Identifiable.getParent(elem); var src_id = elem.getAttribute("id"); var dest_id = parent.getAttribute("id"); - var order = Identifiable.getOrder(elem); + var order = CPSSkins.Identifiable.getOrder(elem); current_elem = elem; current_container = parent; model.move({'src_id': src_id, 'dest_id': dest_id, 'order': order}); @@ -228,15 +228,15 @@ if (!Element.hasClassName(moving, 'draggable')) return; var target = Event.element(e); if (!Element.hasClassName(target, 'container')) return; - if (!Identifiable.isEmpty(target)) return; + if (!CPSSkins.Identifiable.isEmpty(target)) return; target.appendChild(moving); current_elem = moving; } function add_element(container, el, type_name) { - var container_id = Identifiable.getIdentifiableElement(container).getAttribute("id"); + var container_id = CPSSkins.Identifiable.getIdentifiableElement(container).getAttribute("id"); if (el) { - var order = Identifiable.getOrder(el); + var order = CPSSkins.Identifiable.getOrder(el); } else { var order = 0; } @@ -283,7 +283,7 @@ setCursor("default"); if (!moved) return; if (!current_elem) return; - if ((moved.order == Identifiable.getOrder(current_elem)) + if ((moved.order == CPSSkins.Identifiable.getOrder(current_elem)) && (moved.container == current_elem.parentNode)) return; save_move(current_elem); moved = null; @@ -313,11 +313,11 @@ Event.observe(mo, 'mouseup', function(e) { if (factory) { var type_name = factory.node.getAttribute("type_name"); - if (Identifiable.isEmpty(mo)) { + if (CPSSkins.Identifiable.isEmpty(mo)) { var el = null; } else { var target = Event.element(e); - var el = Identifiable.getIdentifiableElement(target); + var el = CPSSkins.Identifiable.getIdentifiableElement(target); } add_element(mo, el, type_name); } 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 Mon Feb 27 21:23:01 2006 @@ -123,6 +123,12 @@ name="getView" attribute="getView" /> + + <browser:page + name="getController" + attribute="getController" + /> + </browser:pages> </configure> Modified: cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py (original) +++ cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py Mon Feb 27 21:23:01 2006 @@ -90,6 +90,7 @@ 'model': 'action-pad', 'perspectives': ['site-designer', 'page-designer', 'layout-designer', 'content-author'], + 'controllers': ['main-editor-perspectives'], }, 'tooltip': { @@ -108,6 +109,7 @@ }, 'model': 'perspective-selector', 'perspectives': ['page-designer', 'layout-designer', 'content-author'], + 'controllers': ['main-editor-perspectives'], }, # Main area @@ -117,6 +119,7 @@ }, 'model': 'theme-tabs', 'perspectives': ['page-designer', 'layout-designer'], + 'controllers': ['main-editor-perspectives'], }, 'page-tabs': { @@ -125,6 +128,7 @@ }, 'model': 'page-tabs', 'perspectives': ['page-designer', 'layout-designer'], + 'controllers': ['main-editor-perspectives'], }, 'location-selector': { @@ -136,6 +140,7 @@ 'show_effect': { 'transition': 'fadein', }, + 'controllers': ['main-editor-perspectives'], }, # rendered pages @@ -145,6 +150,7 @@ }, 'model': 'page-designer', 'perspectives': ['page-designer'], + 'controllers': ['main-editor-perspectives'], }, 'layout-designer': { @@ -153,6 +159,7 @@ }, 'model': 'layout-designer', 'perspectives': ['layout-designer'], + 'controllers': ['main-editor-perspectives'], }, 'content-author': { @@ -161,6 +168,7 @@ }, 'model': 'content-author', 'perspectives': ['content-author'], + 'controllers': ['main-editor-perspectives'], }, # screen @@ -170,6 +178,7 @@ }, 'model': 'site-designer', 'perspectives': ['site-designer'], + 'controllers': ['main-editor-perspectives'], }, # Bottom area @@ -180,6 +189,7 @@ }, 'model': 'portlet-factory', 'perspectives': ['page-designer', 'layout-designer', 'content-author'], + 'controllers': ['main-editor-perspectives'], }, # Contextual menu @@ -243,3 +253,11 @@ }, }, } + +CONTROLLERS = { + 'main-editor-perspectives': { + 'id': 'main-editor-perspectives', + 'type': 'perspective selector', + } + +} 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 Mon Feb 27 21:23:01 2006 @@ -35,7 +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 MODELS, VIEWS +from cpsskins.ui.authoring.definitions import MODELS, VIEWS, CONTROLLERS from cpsskins.utils import getThemeManager _ = MessageFactory("cpsskins") @@ -241,3 +241,6 @@ def getView(self, id): return json.write(VIEWS[id]) + def getController(self, id): + return json.write(CONTROLLERS[id]) + Modified: cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/panels/action_pad.pt Mon Feb 27 21:23:01 2006 @@ -1,19 +1,19 @@ <div id="actionPad"> <ins class="model" cite="@@getHint?msgid=hint-site-designer"></ins> - <a onclick="CPSSkins.switchPerspective('site-designer')" + <a onclick="CPSSkins.getControllerById('main-editor-perspectives').switchTo('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')" + <a onclick="CPSSkins.getControllerById('main-editor-perspectives').switchTo('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')" + <a onclick="CPSSkins.getControllerById('main-editor-perspectives').switchTo('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')" + <a onclick="CPSSkins.getControllerById('main-editor-perspectives').switchTo('content-author')" href="javascript:void(0)">Content author</a> <!-- tooltip --> 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 Mon Feb 27 21:23:01 2006 @@ -28,12 +28,14 @@ <ins class="view" cite="@@getView?id=action-pad"></ins> <ins class="model" cite="@@getModel?id=perspective-selector"></ins> <ins class="view" cite="@@getView?id=perspective-selector"></ins> - <a href="#" onclick="javascript: CPSSkins.switchPerspective('content-author')">Content author</a> + <a href="#" onclick="javascript: CPSSkins.getControllerById('main-editor-perspectives').switchTo('content-author')">Content author</a> </div> <!-- Edit area for rendered content --> <div id="editArea"> + <ins class="controller" cite="@@getController?id=main-editor-perspectives"></ins> + <!-- top tabs --> <ins class="model" cite="@@getModel?id=theme-tabs"></ins> <ins class="view" cite="@@getView?id=theme-tabs"></ins> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins