From 1605263e1d06a57f56be92e397c2293b3eb6ae4c Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Thu, 2 Dec 2010 15:27:32 +0000 Subject: [PATCH] Clean up. Initialize draggable & droppable functionality of new pad. Use proper script name. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41039 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../Base_viewKnowledgePadMacroLibrary.xml | 4 ++-- .../KnowledgePad_viewColumnWidget.xml | 5 ++--- .../KnowledgePad_viewDashboardWidget.xml | 7 +++---- ..._getPadAsHTML.xml => KnowledgePag_getPadAsJSON.xml} | 10 ++-------- .../erp5_knowledge_pad/erp5_knowledge_box.js.xml | 9 ++++++--- bt5/erp5_knowledge_pad/bt/revision | 2 +- 6 files changed, 16 insertions(+), 21 deletions(-) rename bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/{KnowledgePag_getPadAsHTML.xml => KnowledgePag_getPadAsJSON.xml} (93%) diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/Base_viewKnowledgePadMacroLibrary.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/Base_viewKnowledgePadMacroLibrary.xml index c183bfc674..1dc05adce1 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/Base_viewKnowledgePadMacroLibrary.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/Base_viewKnowledgePadMacroLibrary.xml @@ -208,8 +208,8 @@ </div>\n <div class="pad-switch"\n tal:attributes="style python: test(is_active, \'display:none\', \'display:block\')">\n -<!--\n - <span tal:attributes="onclick string:loadPadFromServer(\'${knowledge_pad_relative_url}\', \'${dom_id}\', \'${mode}\')" \n +\n +<!-- <span tal:attributes="onclick string:loadPadFromServer(\'${knowledge_pad_relative_url}\', \'${dom_id}\', \'${mode}\')" \n tal:content="knowledge_pad/getTitle"/>-->\n \n <a tal:attributes="href python:\n diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml index 0bfa119939..de8e6efc19 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml @@ -56,7 +56,6 @@ view_form_id gadget/getViewFormId;\n render_type gadget/getRenderType;\n is_asynchronous_gadget python: render_type == \'asynchronous\';\n - force_synchronous_gadget_rendering python: request.get(\'force_synchronous_gadget_rendering\', False);\n current_web_section python: context.REQUEST.get(\'current_web_section\',\n here);\n current_web_section python: \n @@ -179,13 +178,13 @@ tal:define="view_form_object python: getattr(real_context, view_form_id);">\n \n <!-- Synchronous Gadget -->\n - <div tal:condition="python: not is_asynchronous_gadget or force_synchronous_gadget_rendering"\n + <div tal:condition="python: not is_asynchronous_gadget"\n tal:attributes="id view_form_dom_id"\n class="box_inner_content" \n tal:content="structure python: view_form_object(box=box)"/>\n \n <!-- Asynchronous Gadget -->\n - <tal:block tal:condition="python: is_asynchronous_gadget and not force_synchronous_gadget_rendering">\n + <tal:block tal:condition="python: is_asynchronous_gadget">\n <div tal:attributes="id view_form_dom_id" \n class="box_inner_content"\n i18n:translate="" \n diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewDashboardWidget.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewDashboardWidget.xml index b977817faf..8a57bf2ef2 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewDashboardWidget.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewDashboardWidget.xml @@ -36,18 +36,17 @@ <key> <string>_text</string> </key> <value> <unicode encoding="cdata"><![CDATA[ -<div tal:define="layout here/KnowledgePad_getBoxColumnLayout;\n +<div id="page_wrapper"\n + tal:define="layout here/KnowledgePad_getBoxColumnLayout;\n real_context python: options.get(\'real_context\', None);\n cancel_url python: options.get(\'cancel_url\', None);\n isAnon python: here.portal_membership.isAnonymousUser();\n is_tab_empty python: (len(layout)==1 and len(layout[0])==0) or\n (len(layout)==3 and len(layout[0]+layout[1]+layout[2])==0);\n - page_wrapper_id python: options.get(\'page_wrapper_id\', \'page_wrapper\');\n columns python: options.get(\'columns\', 3);\n column_css_class python: test(isAnon, \n \'portal-column portal-column-undraggable\', \n - \'portal-column\');"\n - tal:attributes="id page_wrapper_id">\n + \'portal-column\');">\n \n <!-- No gadgets message -->\n <span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/add_new_gadget_message"/> \n diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePag_getPadAsHTML.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePag_getPadAsJSON.xml similarity index 93% rename from bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePag_getPadAsHTML.xml rename to bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePag_getPadAsJSON.xml index 7387c79454..3ed5970640 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePag_getPadAsHTML.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePag_getPadAsJSON.xml @@ -58,18 +58,12 @@ """\n pad = context.restrictedTraverse(pad_relative_url)\n \n -# we set this as a temp hack to force all gadgets rendering as synchronous\n -#context.REQUEST.set(\'force_synchronous_gadget_rendering\', 1)\n -\n # render Pad\'s html\n -body = pad.KnowledgePad_viewDashboardWidget(real_context=context, page_wrapper_id=\'\')\n +body = pad.KnowledgePad_viewDashboardWidget(real_context=context)\n \n # toggle new active pad \n context.ERP5Site_toggleActiveKnowledgePad(pad_relative_url, mode, redirect=False)\n \n -# XXX: generate navigation\n -#navigation = pad.KnowledgePad_viewNavigationWidget(real_context=context, page_wrapper_id=\'\')\n -\n # XXX: generate all JS updater code\n javascript = \'\'\'updater(\'http://localhost/km/ERP5Site_viewRssGadget\', \'knowledge_pad_module/65/2\', \'visual_2\', \'web_site_module/km_test_web_site\', \'0\', {});\n updater(\'http://localhost/km/ERP5Site_viewRssGadget\', \'knowledge_pad_module/64/3\', \'visual_3\', \'\', \'0\', {}); \'\'\'\n @@ -139,7 +133,7 @@ return \'%s\' % result\n </item> <item> <key> <string>id</string> </key> - <value> <string>KnowledgePag_getPadAsHTML</string> </value> + <value> <string>KnowledgePag_getPadAsJSON</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.js.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.js.xml index 0045f2a69c..538842d3ef 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.js.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.js.xml @@ -12,7 +12,7 @@ </item> <item> <key> <string>_EtagSupport__etag</string> </key> - <value> <string>ts91301986.39</string> </value> + <value> <string>ts91303406.12</string> </value> </item> <item> <key> <string>__name__</string> </key> @@ -270,7 +270,7 @@ function loadPadFromServer(pad_relative_url, selected_pad_dom_id, mode){\n /* Load Pad from server */\n // XXX: show some animation ?\n \n - d = MochiKit.Async.loadJSONDoc(\'KnowledgePag_getPadAsHTML\', \n + d = MochiKit.Async.loadJSONDoc(\'KnowledgePag_getPadAsJSON\', \n {\'pad_relative_url\':pad_relative_url,\n \'mode\':mode});\n //d.addCallback(handleServerSuccess);\n @@ -303,8 +303,11 @@ function loadPadFromServer(pad_relative_url, selected_pad_dom_id, mode){\n javascript = meta.javascript\n body_element = getElement(\'pad-body-wrapper\');\n body_element.innerHTML = body;\n + // init new Pad\n + initialize();\n // execute JS code\n eval(javascript);\n + \n }\n }\n \n @@ -475,7 +478,7 @@ MochiKit.DOM.addLoadEvent(initialize);\n </item> <item> <key> <string>size</string> </key> - <value> <int>17637</int> </value> + <value> <int>17680</int> </value> </item> <item> <key> <string>title</string> </key> diff --git a/bt5/erp5_knowledge_pad/bt/revision b/bt5/erp5_knowledge_pad/bt/revision index 5628fa72e9..c3282600a4 100644 --- a/bt5/erp5_knowledge_pad/bt/revision +++ b/bt5/erp5_knowledge_pad/bt/revision @@ -1 +1 @@ -639 \ No newline at end of file +640 \ No newline at end of file -- 2.30.9