Commit 765c5215 authored by Gabriel Monnerat's avatar Gabriel Monnerat

- remove not used script

- implemented dialog to edit more properties of object. Next, I will clean up the javascript code to be more expressive and clean.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41034 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5666b29e
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal_type_list = ["Web Page", "Web Table", "Web Illustration"]\n
portal = context.getPortalObject()\n
new_title = context.REQUEST.get("new_title")\n
\n
# XXX - Refactor the below code to use a scalable solution\n
id = context.REQUEST.get("URL1").split("/")[-1]\n
document = portal.portal_catalog.getResultValue(portal_type=portal_type_list, id=id)\n
document.setTitle(new_title)\n
\n
return True\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>portal_type_list</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>new_title</string>
<string>_getitem_</string>
<string>id</string>
<string>document</string>
<string>True</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_renameDocument</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -53,16 +53,28 @@ ...@@ -53,16 +53,28 @@
<tal:block tal:condition="python: has_editor">\n <tal:block tal:condition="python: has_editor">\n
<a name="document_title" tal:content="here/getTitle"/>\n <a name="document_title" tal:content="here/getTitle"/>\n
<a name="document_state" tal:content="here/getValidationStateTitle"/>\n <a name="document_state" tal:content="here/getValidationStateTitle"/>\n
<!--<tal:block tal:condition="python: \'Illustration\' not in request.get(\'ACTUAL_URL\')">-->\n
<div id="edit_document" title="Rename Document">\n <div id="edit_document" title="Rename Document">\n
<form>\n <form>\n
<fieldset>\n <fieldset>\n
<label for="name">Insert a new name:</label>\n <label for="name">Insert a new name:</label>\n
<input type="text" class="title" id="name" name="name" value="">\n <input type="text" class="title" id="name" name="name" value=""><br>\n
<div id="more_property">\n
<label for="short_title">Short Title:</label>\n
<input type="text" class="short_title" id="short_title" name="short_title" value=""><br>\n
<label for="name">Reference:</label>\n
<input type="text" class="reference" id="reference" name="reference" value=""><br>\n
<label for="version">Version:</label>\n
<input type="text" class="version" id="version" name="version" value=""><br>\n
<label for="language">Language:</label>\n
<input type="text" class="language" id="language" name="language" value=""><br>\n
<label for="language">Sort Index:</label>\n
<input type="text" class="sort_index" id="sort_index" name="sort_index" value=""><br>\n
</div>\n
<p class="more_properties" id="more_properties">Edit More Properties</p>\n
<p class="hide_properties" id="hide_properties">Hide Properties</p>\n
</fieldset>\n </fieldset>\n
</form>\n </form>\n
</div>\n </div>\n
<!--</tal:block>-->\n
</tal:block>\n </tal:block>\n
</tal:block> </tal:block>
......
...@@ -30,7 +30,23 @@ ...@@ -30,7 +30,23 @@
<key> <string>raw</string> </key> <key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
function getObjectPropertyValue(method_name){\n
return $.ajax({\n
url: method_name,\n
async: false\n
}).responseText;\n
}\n
\n
function setObjectPropertyValue(method_name, value, parameter){\n
$.ajax({\n
type: "POST",\n
url: method_name,\n
data: parameter + "=" + value,\n
});\n
return true;\n
}\n
$(document).ready(function(){\n $(document).ready(function(){\n
$("a[name=\'document_title\']").html(getObjectPropertyValue("getTitle"));\n
if ($("div.gadget-column").length == 1) {\n if ($("div.gadget-column").length == 1) {\n
$("body").css("overflow", "hidden");\n $("body").css("overflow", "hidden");\n
navigation_html = $("div.listbox-footer div.listbox-page-navigation").html();\n navigation_html = $("div.listbox-footer div.listbox-page-navigation").html();\n
...@@ -50,27 +66,64 @@ $(document).ready(function(){\n ...@@ -50,27 +66,64 @@ $(document).ready(function(){\n
modal: true,\n modal: true,\n
buttons: {\n buttons: {\n
"Save": function(){\n "Save": function(){\n
var new_title = $("input#name.title").attr("value");\n var new_title = $("input#name.title").attr("value");\n
$.ajax({\n var new_reference = $("input#reference.reference").attr("value");\n
type: "POST",\n var new_short_title = $("input#short_title.short_title").attr("value");\n
url: "WebSection_renameDocument",\n var new_language = $("input#language.language").attr("value");\n
data: "new_title="+ new_title,\n var new_version = $("input#version.version").attr("value");\n
success: function(msg){\n var new_int_index = $("input#sort_index.sort_index").attr("value");\n
location.reload();\n setObjectPropertyValue("setTitle", new_title, "value");\n
}\n setObjectPropertyValue("setReference", new_reference, "value");\n
});\n setObjectPropertyValue("setShortTitle", new_short_title, "value");\n
setObjectPropertyValue("setLanguage", new_language, "language");\n
setObjectPropertyValue("setVersion", new_version, "value");\n
setObjectPropertyValue("setIntIndex", new_int_index, "value");\n
location.reload();\n
},\n },\n
Cancel: function() {\n Cancel: function() {\n
$(this).dialog("close");\n $(this).dialog("close");\n
},\n },\n
}\n }\n
});\n });\n
$("p#more_properties")\n
.click(function(){\n
$("div#more_property").show();\n
$("p#hide_properties").show();\n
$("div#edit_document fieldset").animate({"height": "151px"}, "slow");\n
$("div.ui-dialog").animate({"top": "50px"}, "slow")\n
.animate({"height": "228px"}, "slow");\n
$("div#edit_document").animate({"height": "157px"}, "slow");\n
$("div#edit_document fieldset input").css("margin", "0")\n
.css("width", "60%");\n
$("div#edit_document fieldset label").css("float", "left")\n
.css("width", "35%");\n
$("div#more_property input").css("width", "47%");\n
$("p#more_properties").hide();\n
});\n
$("p#hide_properties")\n
.click(function(){\n
$("div#more_property").hide();\n
$("p#more_properties").show();\n
$("p#hide_properties").hide();\n
$("div#edit_document fieldset input").css("width", "95%")\n
.css("margin-top", "14px");\n
$("div#edit_document fieldset").animate({"height": "69px"}, "slow");\n
$("div.ui-dialog").animate({"height": "148px"}, "slow");\n
$("div#edit_document").animate({"height": "78px"}, "slow");\n
})\n
$("button.ui-button, span.ui-icon").click(function(){$("p#hide_properties").click()})\n
$("a[name=\'document_title\']")\n $("a[name=\'document_title\']")\n
.click(function() {\n .click(function(){\n
$("div#more_property").hide();\n
$("p#hide_properties").hide();\n
var document_title = $(this).html();\n var document_title = $(this).html();\n
$("input#name.title").attr("value", document_title);\n $("input#name.title").attr("value", document_title);\n
$("#edit_document").dialog("open");\n $("input#short_title.short_title").attr("value", getObjectPropertyValue("getShortTitle"));\n
\n $("input#reference.reference").attr("value", getObjectPropertyValue("getReference"));\n
$("input#version.version").attr("value", getObjectPropertyValue("getVersion"));\n
$("input#language.language").attr("value", getObjectPropertyValue("getLanguage"));\n
$("input#sort_index.sort_index").attr("value", getObjectPropertyValue("getIntIndex"));\n
$("#edit_document").dialog("open"); \n
});\n });\n
return false;\n return false;\n
}); });
......
...@@ -664,7 +664,7 @@ div.ui-dialog-titlebar {\n ...@@ -664,7 +664,7 @@ div.ui-dialog-titlebar {\n
div#edit_document fieldset {\n div#edit_document fieldset {\n
background:none no-repeat scroll 0 0 #FFFFFF;\n background:none no-repeat scroll 0 0 #FFFFFF;\n
border:0 none;\n border:0 none;\n
height:69px;\n height:72px;\n
margin-left:-1em;\n margin-left:-1em;\n
margin-top:-0.5em;\n margin-top:-0.5em;\n
width:379px;\n width:379px;\n
...@@ -761,7 +761,7 @@ div.listbox-number-of-records{\n ...@@ -761,7 +761,7 @@ div.listbox-number-of-records{\n
font-size: 12px;\n font-size: 12px;\n
margin-right: 12em;\n margin-right: 12em;\n
margin-top: -18px;\n margin-top: -18px;\n
width: 30%;\n width: 28%;\n
}\n }\n
\n \n
div.listbox-navigation button.listbox_last_page,\n div.listbox-navigation button.listbox_last_page,\n
...@@ -805,6 +805,14 @@ div.listbox-navigation button.listbox_previous_page, \n ...@@ -805,6 +805,14 @@ div.listbox-navigation button.listbox_previous_page, \n
div.listbox-navigation button.listbox_last_page,\n div.listbox-navigation button.listbox_last_page,\n
div.listbox-navigation button.listbox_next_page {\n div.listbox-navigation button.listbox_next_page {\n
background-repeat:no-repeat;\n background-repeat:no-repeat;\n
}\n
\n
p#more_properties, p#hide_properties {\n
font-size: 12px;\n
}\n
\n
p#more_properties:hover, p#hide_properties:hover {\n
color:#525f94;\n
} }
]]></string> </value> ]]></string> </value>
......
92 93
\ 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