Commit 5c6a2418 authored by Ivan Tyagov's avatar Ivan Tyagov

Use JSON to read data from server.

Do not return meaningless content.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42518 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 650c9f59
......@@ -50,7 +50,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>knowledge_pad = None\n
<value> <string>from Products.ERP5Type.JSON import dumps\n
\n
knowledge_pad = None\n
portal = context.getPortalObject()\n
user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n
tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n
......@@ -117,7 +119,8 @@ if owner is not None:\n
\n
# set default gadgets\n
context.ERP5Site_createDefaultKnowledgeBox(knowledge_pad, activate_kw=activate_kw)\n
return knowledge_pad.getRelativeUrl()\n
\n
return dumps({\'knowledge_pad_relative_url\': knowledge_pad.getRelativeUrl()})\n
</string> </value>
</item>
<item>
......
......@@ -50,7 +50,8 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
<value> <string>from Products.ERP5Type.JSON import dumps\n
portal = context.getPortalObject()\n
\n
if active_knowledge_pad is None and js_call:\n
# only for asynchronous checks\n
......@@ -75,7 +76,8 @@ if active_knowledge_pad is None:\n
is_pending_create_activities = active_knowledge_pad.hasActivity()\n
\n
if js_call:\n
return str(is_pending_create_activities)\n
return dumps({\'result\':str(is_pending_create_activities)})\n
\n
return is_pending_create_activities\n
</string> </value>
</item>
......
......@@ -65,7 +65,6 @@ if state == \'visible\':\n
box.invisible()\n
elif state == \'invisible\':\n
box.visible()\n
return "OK"\n
]]></string> </value>
......
......@@ -80,7 +80,6 @@ if not context.portal_membership.isAnonymousUser():\n
# update only if necessary\n
if getattr(knowledge_pad, \'user_layout\', None)!=new_user_layout:\n
knowledge_pad.edit(user_layout=new_user_layout)\n
return "OK"\n
</string> </value>
</item>
<item>
......
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts95444322.67</string> </value>
<value> <string>ts95535671.25</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -55,7 +55,8 @@ function createCustomKnowledgePadOnServer(){\n
$.ajax({url:create_default_knowledge_pad_script_id, \n
data:{mode: mode,\n
default_pad_group: default_pad_group},\n
success:function(data){window.location=cancel_url + "/view?active_pad_url=" + data;}});\n
dataType: "json",\n
success:function(data){window.location=cancel_url + "/view?active_pad_url=" + data.knowledge_pad_relative_url;}});\n
}\n
\n
function showCreateDefaultKnowledgePadWarningMessage(){\n
......@@ -150,7 +151,8 @@ function checkForActivitiesOnServer(timeout, return_url, mode, default_pad_group
data: {js_call: 1,\n
mode: mode,\n
default_pad_group: default_pad_group},\n
success: function (data){if(data=="False"){window.location=return_url;}}\n
dataType: "json",\n
success: function (data){if(data.result=="False"){window.location=return_url;}}\n
})},\n
timeout);\n
};\n
......@@ -481,7 +483,7 @@ $(document).ready(initialize);\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>17957</int> </value>
<value> <int>18051</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
680
\ No newline at end of file
682
\ 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