Commit 9651ca03 authored by Ivan Tyagov's avatar Ivan Tyagov

When removing a pad there's no difference in mode so simplify it.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40979 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d802c3db
......@@ -183,8 +183,9 @@
<tal:block tal:repeat="knowledge_pad knowledge_pads">\n
\n
<tal:block \n
tal:define="is_active python:\n
knowledge_pad.getRelativeUrl()==active_knowledge_pad.getRelativeUrl()"> \n
tal:define="knowledge_pad_relative_url knowledge_pad/getRelativeUrl;\n
active_knowledge_pad_relative_url active_knowledge_pad/getRelativeUrl;\n
is_active python: knowledge_pad_relative_url==active_knowledge_pad_relative_url"> \n
\n
<li tal:condition="is_active"\n
class="tab tab_selected">\n
......@@ -201,37 +202,20 @@
i18n:attributes="title"\n
i18n:domain="ui"\n
class="clickable_image remove_tab_dialog_image"\n
tal:condition="python: mode==\'erp5_front\'"\n
tal:attributes="onclick python: \'removeKnowledgePadFromServer(\n
\\\'%s\\\', \\\'%s\\\',\\\'/%s\\\')\' \n
%(active_knowledge_pad.getRelativeUrl(), \n
mode,\n
context.getId())"></span>\n
<span title="Remove"\n
i18n:attributes="title"\n
i18n:domain="ui"\n
class="clickable_image remove_tab_dialog_image"\n
tal:condition="python: mode!=\'erp5_front\'"\n
tal:attributes="onclick python: \'removeKnowledgePadFromServer(\n
\\\'%s\\\', \\\'%s\\\',\\\'/%s/%s\\\')\' \n
%(active_knowledge_pad.getRelativeUrl(), \n
mode,\n
context.getPortalObject().getId(),\n
context.getRelativeUrl())"></span>\n
\n
tal:attributes="onclick string: removeKnowledgePadFromServer(\n
\'${active_knowledge_pad_relative_url}\', \'${mode}\')"/>\n
</li>\n
\n
<li tal:condition="not: is_active"\n
class="tab">\n
<a tal:attributes="href python:\n
<a tal:attributes="href python:\n
\'ERP5Site_toggleActiveKnowledgePad?knowledge_pad_url=%s&mode=%s\'\n
%(knowledge_pad.getRelativeUrl(), mode)">\n
<span tal:content="knowledge_pad/getTitle"/>\n
</a>\n
<!-- XXX: instant switch\n
<span tal:attributes="onclick string:loadPadFromServer(\'${knowledge_pad.getRelativeUrl()}\', \'page_wrapper\', \'${mode}\')" \n
tal:content="knowledge_pad/getTitle"/>\n
-->\n
<!-- XXX: instant switch-->\n
<!-- <span tal:attributes="onclick string:loadPadFromServer(\'${knowledge_pad_relative_url}\', \'page_wrapper\', \'${mode}\')" \n
tal:content="knowledge_pad/getTitle"/>-->\n
\n
</li>\n
</tal:block>\n
......
......@@ -89,7 +89,6 @@ for knowledge_pad in knowledge_pads:\n
# ERP5 Site front gadget \n
return knowledge_pad, knowledge_pads \n
\n
\n
# no customized version found for this context so\n
# try finding pad by group\n
for knowledge_pad in knowledge_pads:\n
......
......@@ -111,7 +111,6 @@ if active_pad is not None and active_pad.getValidationState() != \'deleted\':\n
results = filterKnowledgePadListForContext(results, mode, \n
default_pad_group)\n
\n
\n
if not len(results) and not isAnon:\n
# try getting default knowledge pads for user from global site preference\n
user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n
......
......@@ -53,19 +53,21 @@
<value> <string>"""\n
Render an entire PAD plus navigation (XXX)\n
Used to in AJAX calls for instan PAD switching.\n
XXX: rather than return HTML we should return JSON as some parts like JS needs to be evaluated explicitly by\n
browser.\n
"""\n
pad = context.restrictedTraverse(pad_relative_url)\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
html = pad.WebSection_viewDashboardWidget(real_context=context, page_wrapper_id=\'\')\n
#WebSection_viewDashboardWidget\n
#KnowledgePad_viewDashboardWidget\n
# XXX: merge both to KnowledgePad_viewDashboardWidget !\n
\n
# render Pad\'s html\n
\n
html = pad.KnowledgePad_viewDashboardWidget(real_context=context, page_wrapper_id=\'\')\n
# toggle new active pad \n
context.ERP5Site_toggleActiveKnowledgePad(pad_relative_url, mode, redirect=False)\n
context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'text/html;; charset=utf-8\')\n
\n
print html\n
return printed\n
context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'text/html;; charset=utf-8\')\n
return html\n
</string> </value>
</item>
<item>
......@@ -104,8 +106,6 @@ return printed\n
<tuple>
<string>pad_relative_url</string>
<string>mode</string>
<string>_print_</string>
<string>_print</string>
<string>_getattr_</string>
<string>context</string>
<string>pad</string>
......
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts91191957.42</string> </value>
<value> <string>ts91216542.63</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -261,7 +261,7 @@ function showAddNewPadPopup(popup_id, input_id){\n
\n
function loadPadFromServer(pad_relative_url, wrapper_dom_id, mode){\n
/* Load Pad from server */\n
d = MochiKit.Async.doSimpleXMLHttpRequest(\'A\', \n
d = MochiKit.Async.doSimpleXMLHttpRequest(\'KnowledgePag_getPadAsHTML\', \n
{\'pad_relative_url\':pad_relative_url,\n
\'mode\':mode});\n
d.addCallback(handleServerSuccess);\n
......@@ -299,7 +299,7 @@ function addPadOnServer(create_url,\n
};\n
};\n
\n
function removeKnowledgePadFromServer(knowledge_pad_relative_url, mode, base_path){\n
function removeKnowledgePadFromServer(knowledge_pad_relative_url, mode){\n
/* remove pad from server*/\n
if (is_knowledge_template_used){\n
showCreateDefaultKnowledgePadWarningMessage();}\n
......@@ -442,7 +442,7 @@ MochiKit.DOM.addLoadEvent(initialize);\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>16302</int> </value>
<value> <int>16315</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
635
\ No newline at end of file
637
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment