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