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 @@
<tal:block tal:condition="python: has_editor">\n
<a name="document_title" tal:content="here/getTitle"/>\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
<form>\n
<fieldset>\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
</form>\n
</div>\n
<!--</tal:block>-->\n
</tal:block>\n
</tal:block>
......
......@@ -30,7 +30,23 @@
<key> <string>raw</string> </key>
<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
$("a[name=\'document_title\']").html(getObjectPropertyValue("getTitle"));\n
if ($("div.gadget-column").length == 1) {\n
$("body").css("overflow", "hidden");\n
navigation_html = $("div.listbox-footer div.listbox-page-navigation").html();\n
......@@ -51,26 +67,63 @@ $(document).ready(function(){\n
buttons: {\n
"Save": function(){\n
var new_title = $("input#name.title").attr("value");\n
$.ajax({\n
type: "POST",\n
url: "WebSection_renameDocument",\n
data: "new_title="+ new_title,\n
success: function(msg){\n
var new_reference = $("input#reference.reference").attr("value");\n
var new_short_title = $("input#short_title.short_title").attr("value");\n
var new_language = $("input#language.language").attr("value");\n
var new_version = $("input#version.version").attr("value");\n
var new_int_index = $("input#sort_index.sort_index").attr("value");\n
setObjectPropertyValue("setTitle", new_title, "value");\n
setObjectPropertyValue("setReference", new_reference, "value");\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
},\n
Cancel: function() {\n
$(this).dialog("close");\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
.click(function() {\n
.click(function(){\n
$("div#more_property").hide();\n
$("p#hide_properties").hide();\n
var document_title = $(this).html();\n
$("input#name.title").attr("value", document_title);\n
$("#edit_document").dialog("open");\n
\n
$("input#short_title.short_title").attr("value", getObjectPropertyValue("getShortTitle"));\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
return false;\n
});
......
......@@ -664,7 +664,7 @@ div.ui-dialog-titlebar {\n
div#edit_document fieldset {\n
background:none no-repeat scroll 0 0 #FFFFFF;\n
border:0 none;\n
height:69px;\n
height:72px;\n
margin-left:-1em;\n
margin-top:-0.5em;\n
width:379px;\n
......@@ -761,7 +761,7 @@ div.listbox-number-of-records{\n
font-size: 12px;\n
margin-right: 12em;\n
margin-top: -18px;\n
width: 30%;\n
width: 28%;\n
}\n
\n
div.listbox-navigation button.listbox_last_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_next_page {\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>
......
92
\ No newline at end of file
93
\ 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