Commit 18de7643 authored by Ivan Tyagov's avatar Ivan Tyagov

Handle better server side failures like gadget edit, view form being not available.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32493 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 912d64b3
...@@ -94,7 +94,6 @@ ...@@ -94,7 +94,6 @@
title="Minimize"></a>\n title="Minimize"></a>\n
</tal:block>\n </tal:block>\n
<span class="gadget_title" \n <span class="gadget_title" \n
tal:define="dummy python:context.log(box)"\n
tal:content="python: here.Base_translateString(box.getProperty(\'preferred_header_title\', None) or gadget.getTitle())"/>\n tal:content="python: here.Base_translateString(box.getProperty(\'preferred_header_title\', None) or gadget.getTitle())"/>\n
</span>\n </span>\n
</h3>\n </h3>\n
...@@ -105,74 +104,93 @@ ...@@ -105,74 +104,93 @@
\n \n
<!-- Edit form -->\n <!-- Edit form -->\n
<div class="edit-form" \n <div class="edit-form" \n
tal:condition="python: not isAnon and edit_form_id is not None and not isKnowledgePadTemplateUsed"\n tal:condition="python: not isAnon and edit_form_id is not None and box is not None and not isKnowledgePadTemplateUsed"\n
tal:attributes="id edit_form_dom_id"\n tal:attributes="id edit_form_dom_id"\n
style="display: none;">\n style="display: none;">\n
\n \n
<form action="KnowledgeBox_baseEdit"\n <tal:block tal:define="edit_form_object python: getattr(box, edit_form_id, None);">\n
tal:condition="not: is_asynchronous_gadget"\n
tal:define="box_relative_url python: box.getRelativeUrl();">\n
<div>\n
<span tal:replace="structure python: getattr(box, edit_form_id)()"/>\n
<input type="hidden" \n
name="box_relative_url" \n
tal:attributes="value box_relative_url"/>\n
<input type="hidden" \n
name="cancel_url" \n
tal:attributes="value cancel_url;\n
name python: \'%s_cancel_url\' \n
%box_relative_url.replace(\'/\', \'_\')"/> \n
<button type="submit"\n
i18n:translate="" \n
i18n:domain="ui" \n
name="KnowledgeBox_baseEdit:method">Save</button>\n
</div>\n
</form>\n
\n \n
<tal:block tal:condition="is_asynchronous_gadget">\n <tal:block tal:condition="python: edit_form_object is None">\n
<span tal:replace="structure python: getattr(box, edit_form_id)()"/>\n <span i18n:translate="" \n
<button type="button" \n i18n:domain="ui">Server side error.</span>\n
i18n:translate="" \n </tal:block>\n
i18n:domain="ui"\n
tal:attributes="onclick python: \n
\'sendPreferencesToServer(\\\'%s\\\', \\\'%s\\\', \\\'%s\\\', \\\'%s\\\')\'\n
%(edit_form_dom_id, \n
view_form_id, \n
box.getRelativeUrl(), \n
view_form_dom_id)">\n
Save</button>\n
</tal:block>\n
\n \n
</div>\n <tal:block tal:condition="python: edit_form_object is not None">\n
\n <form action="KnowledgeBox_baseEdit"\n
<!-- Content render -->\n tal:condition="not: is_asynchronous_gadget"\n
<div class="content" \n tal:define="box_relative_url python: box.getRelativeUrl();">\n
tal:condition="not: is_asynchronous_gadget">\n <div>\n
<span tal:replace="structure python: edit_form_object()"/>\n
<input type="hidden" \n
name="box_relative_url" \n
tal:attributes="value box_relative_url"/>\n
<input type="hidden" \n
name="cancel_url" \n
tal:attributes="value cancel_url;\n
name python: \'%s_cancel_url\' \n
%box_relative_url.replace(\'/\', \'_\')"/> \n
<button type="submit"\n
i18n:translate="" \n
i18n:domain="ui" \n
name="KnowledgeBox_baseEdit:method">Save</button>\n
</div>\n
</form>\n
\n \n
<div tal:attributes="id view_form_dom_id"\n <tal:block tal:condition="is_asynchronous_gadget">\n
class="box_inner_content" \n <span tal:replace="structure python: edit_form_object()"/>\n
tal:content="structure python: getattr(real_context,\n <button type="button" \n
view_form_id)(box=box)"/>\n i18n:translate="" \n
i18n:domain="ui"\n
tal:attributes="onclick python: \n
\'sendPreferencesToServer(\\\'%s\\\', \\\'%s\\\', \\\'%s\\\', \\\'%s\\\')\'\n
%(edit_form_dom_id, \n
view_form_id, \n
box.getRelativeUrl(), \n
view_form_dom_id)">Save</button>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</div>\n </div>\n
\n \n
<div class="content"\n <!-- Content render (view form) -->\n
tal:condition="is_asynchronous_gadget">\n <tal:block \n
<div tal:attributes="id view_form_dom_id" \n tal:define="exists_view_form python: view_form_id is not None and \n
class="box_inner_content"\n getattr(real_context, view_form_id, None) is not None">\n
i18n:translate="" \n
i18n:domain="ui">Loading ...</div>\n
<script type="text/javascript"\n
tal:content="structure python:\n
here.KnowledgePad_generateAjaxCall(\'%s/%s\' %(current_web_section.absolute_url(),view_form_id),\n
box,\n
view_form_dom_id,\n
ignore_security_check=1)">\n
</script>\n
\n \n
</div>\n <div class="content"\n
</div>\n tal:condition="not: exists_view_form">\n
<span i18n:translate="" \n
i18n:domain="ui">Server side error.</span>\n
</div>\n
\n \n
<tal:block tal:condition="exists_view_form">\n
<div class="content"\n
tal:define="view_form_object python: getattr(real_context, view_form_id);">\n
\n \n
<!-- Synchronous Gadget -->\n
<div tal:condition="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="is_asynchronous_gadget">\n
<div tal:attributes="id view_form_dom_id" \n
class="box_inner_content"\n
i18n:translate="" \n
i18n:domain="ui">Loading ...</div>\n
<script type="text/javascript"\n
tal:content="structure python:\n
here.KnowledgePad_generateAjaxCall(\'%s/%s\' %(current_web_section.absolute_url(),view_form_id),\n
box,\n
view_form_dom_id,\n
ignore_security_check=1)"/>\n
</tal:block>\n
</div>\n
\n
</tal:block>\n
</tal:block>\n
</div> \n
</div>\n </div>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
......
450 451
\ No newline at end of file \ 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