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 @@ ...@@ -50,7 +50,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 portal = context.getPortalObject()\n
user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n
tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n
...@@ -117,7 +119,8 @@ if owner is not None:\n ...@@ -117,7 +119,8 @@ if owner is not None:\n
\n \n
# set default gadgets\n # set default gadgets\n
context.ERP5Site_createDefaultKnowledgeBox(knowledge_pad, activate_kw=activate_kw)\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> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 \n
if active_knowledge_pad is None and js_call:\n if active_knowledge_pad is None and js_call:\n
# only for asynchronous checks\n # only for asynchronous checks\n
...@@ -75,7 +76,8 @@ if active_knowledge_pad is None:\n ...@@ -75,7 +76,8 @@ if active_knowledge_pad is None:\n
is_pending_create_activities = active_knowledge_pad.hasActivity()\n is_pending_create_activities = active_knowledge_pad.hasActivity()\n
\n \n
if js_call:\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 return is_pending_create_activities\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -65,7 +65,6 @@ if state == \'visible\':\n ...@@ -65,7 +65,6 @@ if state == \'visible\':\n
box.invisible()\n box.invisible()\n
elif state == \'invisible\':\n elif state == \'invisible\':\n
box.visible()\n box.visible()\n
return "OK"\n
]]></string> </value> ]]></string> </value>
......
...@@ -80,7 +80,6 @@ if not context.portal_membership.isAnonymousUser():\n ...@@ -80,7 +80,6 @@ if not context.portal_membership.isAnonymousUser():\n
# update only if necessary\n # update only if necessary\n
if getattr(knowledge_pad, \'user_layout\', None)!=new_user_layout:\n if getattr(knowledge_pad, \'user_layout\', None)!=new_user_layout:\n
knowledge_pad.edit(user_layout=new_user_layout)\n knowledge_pad.edit(user_layout=new_user_layout)\n
return "OK"\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts95444322.67</string> </value> <value> <string>ts95535671.25</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -55,7 +55,8 @@ function createCustomKnowledgePadOnServer(){\n ...@@ -55,7 +55,8 @@ function createCustomKnowledgePadOnServer(){\n
$.ajax({url:create_default_knowledge_pad_script_id, \n $.ajax({url:create_default_knowledge_pad_script_id, \n
data:{mode: mode,\n data:{mode: mode,\n
default_pad_group: default_pad_group},\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
\n \n
function showCreateDefaultKnowledgePadWarningMessage(){\n function showCreateDefaultKnowledgePadWarningMessage(){\n
...@@ -150,7 +151,8 @@ function checkForActivitiesOnServer(timeout, return_url, mode, default_pad_group ...@@ -150,7 +151,8 @@ function checkForActivitiesOnServer(timeout, return_url, mode, default_pad_group
data: {js_call: 1,\n data: {js_call: 1,\n
mode: mode,\n mode: mode,\n
default_pad_group: default_pad_group},\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 })},\n
timeout);\n timeout);\n
};\n };\n
...@@ -481,7 +483,7 @@ $(document).ready(initialize);\n ...@@ -481,7 +483,7 @@ $(document).ready(initialize);\n
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>17957</int> </value> <value> <int>18051</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
680 682
\ 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