Commit 3d9dcac0 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to don't need pass the form everytime. The form used is selected...

refactor code to don't need pass the form everytime. The form used is selected by actions of each portal type as expected

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45702 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent abc0817b
...@@ -76,8 +76,7 @@ portal_type = new_content.getPortalType()\n ...@@ -76,8 +76,7 @@ portal_type = new_content.getPortalType()\n
module = portal.getDefaultModule(portal_type)\n module = portal.getDefaultModule(portal_type)\n
\n \n
kw["webpage_path"] = new_content.getPath()\n kw["webpage_path"] = new_content.getPath()\n
return new_content.Base_redirect(context.Base_getEditorViewName(portal_type), \n return new_content.Base_redirect(keep_items = dict(editable_mode=1, **kw))\n
keep_items = dict(editable_mode=1, **kw))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,11 +50,7 @@ ...@@ -50,11 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal_type = kw["brain"].getPortalType()\n <value> <string>return "%s?editable_mode:int=1" % kw["brain"].absolute_url()\n
absolute_url = kw["brain"].absolute_url()\n
\n
return "%s/%s?editable_mode:int=1" % (absolute_url, \n
context.Base_getEditorViewName(portal_type))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -60,8 +60,7 @@ request = context.REQUEST\n ...@@ -60,8 +60,7 @@ request = context.REQUEST\n
if request.form.has_key("key"):\n if request.form.has_key("key"):\n
webpage = context.ERP5Site_userFollowUpWebPage(reference=context.REQUEST.form.get("key"))\n webpage = context.ERP5Site_userFollowUpWebPage(reference=context.REQUEST.form.get("key"))\n
webpage_id = webpage.getId()\n webpage_id = webpage.getId()\n
editor_name = context.Base_getEditorViewName(webpage.getPortalType())\n return context.Base_redirect("/web_page_module/%s" % webpage_id,\n
return context.Base_redirect("/web_page_module/%s/%s" % (webpage_id, editor_name),\n
keep_items=dict(editable_mode=1))\n keep_items=dict(editable_mode=1))\n
\n \n
else:\n else:\n
......
...@@ -44,17 +44,24 @@ function changeLanguage(language){\n ...@@ -44,17 +44,24 @@ function changeLanguage(language){\n
});\n });\n
}\n }\n
\n \n
function getWebEditorName(){\n function getPortalTypeFromContext(){\n
currentUrlSplitted = window.location.href.split("?")[0].split("/");\n var response = $.ajax({\n
return currentUrlSplitted[currentUrlSplitted.length-1];\n url: "getPortalType",\n
method: "GET",\n
async: false,\n
}).responseText;\n
return response;\n
}\n }\n
\n \n
function getUrlParameterList(){\n function getUrlParameterList(){\n
var argumentList = {};\n var argumentList = {};\n
resultList = window.location.href.split("?")[1].split("&");\n var resultList = window.location.href.split("?");\n
for (var i=0;i<resultList.length;i++){\n if (resultList.length > 1) {\n
parameterList = (resultList[i].replace(":int","")).split("=");\n var parameterList = resultList[1].split("&");\n
argumentList[parameterList[0]] = parameterList[1];\n for (var i=0;i<parameterList.length;i++){\n
parameter = (parameterList[i].replace(":int","")).split("=");\n
argumentList[parameter[0]] = parameter[1];\n
}\n
}\n }\n
return argumentList;\n return argumentList;\n
}\n }\n
...@@ -214,20 +221,20 @@ $().ready(function(){\n ...@@ -214,20 +221,20 @@ $().ready(function(){\n
if ($("a#login").html() != null){\n if ($("a#login").html() != null){\n
displayLoginForm();\n displayLoginForm();\n
}\n }\n
if ($("div.gadget-column").length == 0 && window.location.href.split("?").length > 1) {\n if ($("div.gadget-column").length == 0) {\n
parameterList = getUrlParameterList();\n parameterList = getUrlParameterList();\n
if (parameterList.hasOwnProperty("upload_document") == true){\n if (parameterList.hasOwnProperty("upload_document") == true){\n
$("a[name=\'document_title\'], a[name=\'document_state\'], div.header-right, div.content").hide();\n $("a[name=\'document_title\'], a[name=\'document_state\'], div.header-right, div.content").hide();\n
$("a#loading_message").show();\n $("a#loading_message").show();\n
setTimeout(checkConversion(), 1000);\n setTimeout(checkConversion(), 1000);\n
}\n }\n
switch (getWebEditorName()) {\n switch (getPortalTypeFromContext()) {\n
case "WebPage_viewEditor":\n case "Web Page":\n
$("div.content").css({"position":"fixed", "bottom": "0px",\n $("div.content").css({"position":"fixed", "bottom": "0px",\n
"left": "0px", "right": "0px"});\n "left": "0px", "right": "0px"});\n
$("div.content").css({"top": "5em"});\n $("div.content").css({"top": "5em"});\n
break;\n break;\n
case "WebTable_viewEditor":\n case "Web Table":\n
$("div.content").css({"position":"fixed", "bottom": "0px",\n $("div.content").css({"position":"fixed", "bottom": "0px",\n
"left": "0px", "right": "0px"});\n "left": "0px", "right": "0px"});\n
$("div.content").css({"top": "6em"});\n $("div.content").css({"top": "6em"});\n
......
366 367
\ 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