Commit de4e13fc authored by Ivan Tyagov's avatar Ivan Tyagov

Do not initializeundraggable columns (for anonymous views).

Make changes towards instant pad switch.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41080 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 990ca7de
......@@ -61,13 +61,11 @@
\n
</tal:block> \n
\n
<tal:block metal:define-macro="add_new_gadget">\n
<a href="Base_viewGadgetListDialog"\n
tal:condition="not: isKnowledgePadTemplateUsed"\n
tal:attributes="href python:\n
\'Base_viewGadgetListDialog?reset=1&cancel_url=%s&active_pad_relative_url=%s&mode=%s\'\n
%(cancel_url, \n
active_knowledge_pad.getRelativeUrl(), mode);"\n
<tal:block metal:define-macro="add_new_gadget"\n
tal:define="active_knowledge_pad_relative_url active_knowledge_pad/getRelativeUrl;">\n
<a tal:condition="not: isKnowledgePadTemplateUsed"\n
onclick="return addNewPad()"\n
tal:attributes="onclick string: addNewPad(\'${cancel_url}\',\'${active_knowledge_pad_relative_url}\',\'${mode}\')"\n
title="Add gadgets"\n
i18n:domain="ui"\n
i18n:attributes="title"\n
......@@ -134,10 +132,8 @@
<input type="text"\n
id="new_knowledge_pad_title"\n
name="knowledge_pad_title"\n
tal:attributes="value active_knowledge_pad/getTitle;\n
onkeypress string:return renameKnowledgePadToServerOnEnter(event,\n
\'rename_tab_dialog\',\'active_knowledge_pad_title\',\n
\'new_knowledge_pad_title\',\'${active_knowledge_pad_relative_url}\');"/>\n
onkeypress="return renameKnowledgePadToServerOnEnter(event);"\n
tal:attributes="value active_knowledge_pad/getTitle;"/>\n
<br/>\n
<br/>\n
<button type="button"\n
......@@ -148,9 +144,7 @@
i18n:translate="" \n
i18n:domain="ui"\n
id="rename_tab_dialog_rename_button"\n
tal:attributes="onclick string:renameKnowledgePadToServer(\n
\'rename_tab_dialog\',\'active_knowledge_pad_title\',\n
\'new_knowledge_pad_title\',\'${active_knowledge_pad_relative_url}\');">\n
onclick="renameKnowledgePadToServer();">\n
Rename \n
</button>\n
</div>\n
......@@ -186,37 +180,37 @@
tal:define="knowledge_pad_relative_url knowledge_pad/getRelativeUrl;\n
active_knowledge_pad_relative_url active_knowledge_pad/getRelativeUrl;\n
is_active python: knowledge_pad_relative_url==active_knowledge_pad_relative_url;\n
dom_id python: \'%s\' %knowledge_pad_relative_url.replace(\'/\', \'_\')"> \n
dom_id python: \'%s\' %knowledge_pad_relative_url.replace(\'/\', \'_\');\n
pad_title_dom_id python: \'%s_title\' %dom_id;"> \n
\n
<li tal:attributes="id dom_id;\n
class python: test(is_active, \'tab tab_selected\', \'tab\')">\n
\n
<a tal:attributes="href string:\n
ERP5Site_toggleActiveKnowledgePad?knowledge_pad_url=${knowledge_pad_relative_url}&amp;mode=${mode}">\n
<span tal:attributes="id pad_title_dom_id;"\n
tal:content="knowledge_pad/getTitle"/>\n
</a>\n
\n
\n
<!-- <span tal:attributes="id pad_title_dom_id;\n
onclick string:loadPadFromServer(\'${knowledge_pad_relative_url}\', \'${dom_id}\', \'${mode}\')" \n
tal:content="knowledge_pad/getTitle"/>-->\n
\n
<div class="pad-actions"\n
tal:attributes="style python: test(is_active, \'display:block\', \'display:none\')">\n
<span id="active_knowledge_pad_title" \n
tal:content="knowledge_pad/title"/>\n
<span title="Settings"\n
i18n:attributes="title"\n
i18n:domain="ui"\n
class="clickable_image rename_tab_dialog_image"\n
onclick="showRenamePadPopup();"></span>\n
tal:attributes="onclick string:showRenamePadPopup(\'${knowledge_pad_relative_url}\', \n
\'${pad_title_dom_id}\');"></span>\n
<span title="Remove"\n
i18n:attributes="title"\n
i18n:domain="ui"\n
class="clickable_image remove_tab_dialog_image"\n
tal:attributes="onclick string: removeKnowledgePadFromServer(\n
\'${active_knowledge_pad_relative_url}\', \'${mode}\')"/>\n
</div>\n
<div class="pad-switch"\n
tal:attributes="style python: test(is_active, \'display:none\', \'display:block\')">\n
\n
<!-- <span tal:attributes="onclick string:loadPadFromServer(\'${knowledge_pad_relative_url}\', \'${dom_id}\', \'${mode}\')" \n
tal:content="knowledge_pad/getTitle"/>-->\n
\n
<a tal:attributes="href python:\n
\'ERP5Site_toggleActiveKnowledgePad?knowledge_pad_url=%s&mode=%s\'\n
%(knowledge_pad.getRelativeUrl(), mode)">\n
<span tal:content="knowledge_pad/getTitle"/></a>\n
\n
\'${knowledge_pad_relative_url}\', \'${mode}\')"/>\n
</div>\n
\n
</li>\n
......
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts91104683.38</string> </value>
<value> <string>ts91368675.54</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -54,7 +54,9 @@ div.block {\n
padding: 0px;\n
width: 100%;\n
}\n
\n
div.pad-actions{\n
float:left;\n
}\n
h3.handle {\n
margin: 0;\n
padding: 0 0 0 10px;\n
......@@ -225,7 +227,9 @@ div.toggable_dialog{\n
background-color: #97B0D1;\n
padding: 0em 1em 0.5em 1em;\n
}\n
\n
#add-gadgets{\n
cursor: pointer;\n
}\n
#add_new_tab_dialog_link{\n
cursor: pointer; \n
font-weight: bold;\n
......@@ -493,7 +497,7 @@ div.gadget-rss-reader .body {\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>8186</int> </value>
<value> <int>8253</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts91303406.12</string> </value>
<value> <string>ts91368480.41</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -29,6 +29,10 @@
// global layout is saved here\n
var last_layout = \'\';\n
\n
// current active pad relative url\n
var active_knowledge_pad_relative_url = \'\';\n
var active_knowledge_pad_title_dom_id = \'\';\n
\n
// enable or disable integration with server\n
var is_knowledge_template_used = 0;\n
\n
......@@ -260,8 +264,14 @@ function showAddNewPadPopup(){\n
setTimeout("MochiKit.DOM.getElement(\'new_pad_title\').focus()", 500 );\n
}\n
\n
function showRenamePadPopup(){\n
toggleElementById(\'rename_tab_dialog\');\n
function showRenamePadPopup(knowledge_pad_relative_url, knowledge_pad_title_dom_id){\n
// set current active pad\' url & title dom element id\n
active_knowledge_pad_relative_url = knowledge_pad_relative_url;\n
active_knowledge_pad_title_dom_id = knowledge_pad_title_dom_id;\n
// init rename dialog input field to current active pad\n
getElement("new_knowledge_pad_title").value = getElement(knowledge_pad_title_dom_id).innerHTML;\n
// show rename dialog\n
toggleElementById(\'rename_tab_dialog\');\n
// set focus on new Pad title after toggle effect is over \n
setTimeout("MochiKit.DOM.getElement(\'new_knowledge_pad_title\').focus()", 500 );\n
}\n
......@@ -281,9 +291,8 @@ function loadPadFromServer(pad_relative_url, selected_pad_dom_id, mode){\n
old_selected_pad = getFirstElementByTagAndClassName("li", "tab_selected", pads_container);\n
old_selected_pad.setAttribute("class", "tab");\n
pad_actions = getFirstElementByTagAndClassName("div", "pad-actions", old_selected_pad);\n
pad_switch = getFirstElementByTagAndClassName("div", "pad-switch", old_selected_pad); \n
\n
pad_actions.style.display="none";\n
pad_switch.style.display="block";\n
\n
// set new selected pad class \n
new_selected_pad = getElement(selected_pad_dom_id);\n
......@@ -291,11 +300,11 @@ function loadPadFromServer(pad_relative_url, selected_pad_dom_id, mode){\n
\n
// enable "settings" for this pad and hide instant switch\n
pad_actions = getFirstElementByTagAndClassName("div", "pad-actions", new_selected_pad);\n
pad_switch = getFirstElementByTagAndClassName("div", "pad-switch", new_selected_pad); \n
pad_actions.style.display="block";\n
pad_switch.style.display="none";\n
\n
\n
\n
// set new active pad\n
active_knowledge_pad_relative_url = pad_relative_url;\n
\n
function metadataFetchFailed(meta){}\n
\n
function handleServerSuccess(meta){\n
......@@ -311,6 +320,15 @@ function loadPadFromServer(pad_relative_url, selected_pad_dom_id, mode){\n
}\n
}\n
\n
function addNewPad(cancel_url, knowledge_pad_relative_url, mode){\n
// if it\'s first time we switch set active_knowledge_pad_relative_url\n
if(active_knowledge_pad_relative_url==\'\'){\n
active_knowledge_pad_relative_url = knowledge_pad_relative_url;\n
}\n
// redirect to add gadget dialog\n
window.location="Base_viewGadgetListDialog?reset=1&cancel_url="+cancel_url+"&active_pad_relative_url="+active_knowledge_pad_relative_url+"&mode="+mode; \n
}\n
\n
function addPadOnServerOnEnter(event, create_url, mode, cancel_url){\n
/* Catch and submit form when ENTER is pressed */\n
if(event.keyCode == 13){\n
......@@ -347,31 +365,32 @@ function removeKnowledgePadFromServer(knowledge_pad_relative_url, mode){\n
}\n
}\n
\n
function renameKnowledgePadToServerOnEnter(event, dialog_id, title_id, \n
input_id, knowledge_pad_relative_url){\n
function renameKnowledgePadToServerOnEnter(event){\n
if(event.keyCode == 13){\n
renameKnowledgePadToServer(dialog_id, title_id, input_id, knowledge_pad_relative_url);\n
renameKnowledgePadToServer();\n
return false;\n
}\n
return true;\n
}\n
\n
function renameKnowledgePadToServer(dialog_id, title_id, \n
input_id, knowledge_pad_relative_url){\n
function renameKnowledgePadToServer(){\n
if (is_knowledge_template_used){\n
showCreateDefaultKnowledgePadWarningMessage();}\n
else{\n
// rename it locally and update server asynchonously\n
title_element = getElement(title_id)\n
input_element = getElement(input_id)\n
\n
// --title_id, input_id, knowledge_pad_relative_url\n
\n
title_element = getElement(active_knowledge_pad_title_dom_id)\n
input_element = getElement("new_knowledge_pad_title")\n
var knowledge_pad_title = input_element.value;\n
title_element.innerHTML = knowledge_pad_title;\n
doSimpleXMLHttpRequest("ERP5Site_renameKnowledgePad", \n
{knowledge_pad_relative_url: knowledge_pad_relative_url,\n
{knowledge_pad_relative_url: active_knowledge_pad_relative_url,\n
knowledge_pad_title: knowledge_pad_title});\n
}\n
//anyway toggle show dialog\n
toggle(dialog_id);\n
toggle("rename_tab_dialog");\n
}\n
\n
function toggleElementById(dom_id){\n
......@@ -385,18 +404,21 @@ function initialize(){\n
// allow drag and drop only if we are dealing with a pad we can modify\n
var sortables = getElementsByTagAndClassName(\'div\', \'portal-column\');\n
forEach(sortables, function (item) {\n
MochiKit.Sortable.create(item.id, {"constraint" : false,\n
"containment" : sortables,\n
"handle": "handle",\n
"only": "block",\n
"tag": "div",\n
"scroll": "true",\n
"hoverclass": "block-hover",\n
"dropOnEmpty": "true",\n
"onUpdate": updateServerBoxColumnLayout,\n
"starteffect" : MochiKit.Base.noop,\n
"endeffect" : MochiKit.Base.noop\n
});\n
// eliminate undraggable columns by checking exact match\n
if (item.className==\'portal-column\'){\n
MochiKit.Sortable.create(item.id, {"constraint" : false,\n
"containment" : sortables,\n
"handle": "handle",\n
"only": "block",\n
"tag": "div",\n
"scroll": "true",\n
"hoverclass": "block-hover",\n
"dropOnEmpty": "true",\n
"onUpdate": updateServerBoxColumnLayout,\n
"starteffect" : MochiKit.Base.noop,\n
"endeffect" : MochiKit.Base.noop\n
});\n
};\n
})}\n
\n
// enable show/hide tabs\n
......@@ -478,7 +500,7 @@ MochiKit.DOM.addLoadEvent(initialize);\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>17680</int> </value>
<value> <int>18522</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
640
\ No newline at end of file
641
\ 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