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