Commit f0496be4 authored by Gabriel Monnerat's avatar Gabriel Monnerat

2010-12-10 gabriel

* Added box and feature to make upload of Text documents.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41323 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 911c60bc
<?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>from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n
\n
catalog_object = context.portal_catalog.getResultValue(path=path)\n
\n
if catalog_object is None:\n
print dumps("empty")\n
return printed\n
\n
document = context.restrictedTraverse(catalog_object.getPath())\n
\n
print dumps(document.getExternalProcessingState())\n
return printed\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>path</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>path</string>
<string>_print_</string>
<string>_print</string>
<string>Products.ERP5Type.JSONEncoder</string>
<string>encodeInJson</string>
<string>dumps</string>
<string>_getattr_</string>
<string>context</string>
<string>catalog_object</string>
<string>None</string>
<string>document</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>Base_getDocumentConversionState</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>from Products.ERP5Type.JSONEncoder import encodeInJson as dumps\n
\n
catalog_object = context.portal_catalog.getResultValue(path=document_path)\n
document = context.restrictedTraverse(catalog_object.getPath())\n
\n
catalog_object = context.portal_catalog.getResultValue(path=webpage_path)\n
webpage_document = context.restrictedTraverse(catalog_object.getPath())\n
\n
webpage_document.setTextContent(document.asStrippedHTML())\n
webpage_document.setTitle(document.getTitle())\n
\n
if document.getTitle() != webpage_document.getTitle() or document.getId() == webpage_document.getTitle():\n
context.log(document.getTitle(), webpage_document.getTitle())\n
print dumps(dict(status=400))\n
return printed\n
\n
print dumps(dict(status=200))\n
return printed\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>document_path, webpage_path</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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>document_path</string>
<string>webpage_path</string>
<string>_print_</string>
<string>_print</string>
<string>Products.ERP5Type.JSONEncoder</string>
<string>encodeInJson</string>
<string>dumps</string>
<string>_getattr_</string>
<string>context</string>
<string>catalog_object</string>
<string>document</string>
<string>webpage_document</string>
<string>dict</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>Base_updateWebDocument</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -51,15 +51,16 @@
<item>
<key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n
portal_type = request.get("select_action")\n
portal_type = request.get("select_action", selection_action)\n
\n
# Create the new content in appropriate module\n
portal_object = context.getPortalObject()\n
module = portal_object.getDefaultModule(portal_type)\n
new_object = module.newContent(portal_type=portal_type)\n
\n
kw["webpage_path"] = new_object.getPath()\n
return new_object.Base_redirect(context.Base_getEditorViewName(portal_type), \n
keep_items = dict(editable_mode=1))\n
keep_items = dict(editable_mode=1, **kw))\n
</string> </value>
</item>
<item>
......@@ -70,7 +71,7 @@ return new_object.Base_redirect(context.Base_getEditorViewName(portal_type), \n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>selection_action=None, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -90,12 +91,14 @@ return new_object.Base_redirect(context.Base_getEditorViewName(portal_type), \n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>selection_action</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
......@@ -103,6 +106,8 @@ return new_object.Base_redirect(context.Base_getEditorViewName(portal_type), \n
<string>portal_object</string>
<string>module</string>
<string>new_object</string>
<string>_write_</string>
<string>_apply_</string>
<string>dict</string>
</tuple>
</value>
......@@ -115,7 +120,9 @@ return new_object.Base_redirect(context.Base_getEditorViewName(portal_type), \n
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
......
<?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>document = context.Base_contribute(file=file, \n
url=None, \n
portal_type="Text", \n
synchronous_metadata_discovery=None, \n
redirect_to_document=False, \n
attach_document_to_context=False, \n
use_context_for_container=False, \n
redirect_url=None, \n
cancel_url=None, \n
batch_mode=False,\n
max_repeat=0, \n
editable_mode=1,\n
follow_up_list=None, \n
)\n
\n
return context.ERP5Site_createNewWebDocument(selection_action="Web Page",\n
document_path=document.getPath(),\n
upload_document=1)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>file, **kw</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>file</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>None</string>
<string>False</string>
<string>document</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_uploadDocument</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -65,11 +65,17 @@
</li> \n
</tal:block>\n
</div>\n
<input type="submit" name="Upload" value="Upload..."/>\n
</div> \n
<div class="file-selection">\n
<div class="file-quick-search">\n
<input type="submit" id="upload" name="Upload" value="Upload"/>\n
<div id="upload_document" title="Upload Document">\n
<form action="WebSection_uploadDocument" method="post" enctype="multipart/form-data">\n
<fieldset id="file_box">\n
<input type="file" size="30" name="file">\n
<input type="submit" value="Submit" id="submit_document">\n
</fieldset>\n
</form> \n
</div>\n
<div class="file-selection">\n
<div class="file-quick-search"></div>\n
<div class="file-quick-browser">\n
<div class="quick-search-item">ERP5</div>\n
<div class="quick-search-item">SANEF</div>\n
......
......@@ -43,6 +43,7 @@
<a class="ung_docs" tal:attributes="href python: portal_path + \'?reset:int=1\'">\n
<img src="ung_images/ung-logo.gif">\n
</a>\n
<a id=\'loading_message\'>Loading...</a>\n
<tal:block tal:condition="python: not has_editor">\n
<form>\n
<input type="text" name="field_your_search_text" class="field" \n
......
......@@ -131,7 +131,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <string>UNG Document Layout</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
......@@ -143,7 +143,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <string>UNG Default Layout</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
......
......@@ -30,13 +30,56 @@
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
function getCurrentObjectUrl(){\n
return window.location.href.split("?")[0];\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
}\n
return argumentList;\n
}\n
\n
function getObjectPropertyValue(method_name){\n
return $.ajax({\n
url: method_name,\n
async: false\n
async: false,\n
}).responseText;\n
}\n
\n
function updateWebPage(){\n
parameterList = getUrlParameterList();\n
url = "Base_updateWebDocument?document_path=" + parameterList.document_path + "&webpage_path=" + parameterList.webpage_path;\n
$.get(url, {}, function(data, textStatus, XMLHttpRequest){\n
response = jQuery.parseJSON(data);\n
if (response.status != 200){\n
setTimeout(updateWebPage(), 1500);\n
}\n
else {\n
clearTimeout();\n
window.location = getCurrentObjectUrl() + "?editable_mode:int=1";\n
}\n
});\n
}\n
function checkConversion(){\n
parameterList = getUrlParameterList();\n
$.get("Base_getDocumentConversionState?path=" + parameterList.document_path, {},\n
function(data, textStatus, XMLHttpRequest){\n
status = jQuery.parseJSON(data);\n
if (status != "converted"){\n
setTimeout(checkConversion(), 1500);\n
}\n
else {\n
clearTimeout();\n
setTimeout(updateWebPage(), 1000);\n
}\n
});\n
}\n
\n
function setObjectPropertyValue(method_name, value, parameter){\n
$.ajax({\n
type: "POST",\n
......@@ -46,8 +89,24 @@ function setObjectPropertyValue(method_name, value, parameter){\n
return true;\n
}\n
\n
function update(){\n
$("a#loading_message").append(".");\n
}\n
\n
$(document).ready(function(){\n
if ($("div.gadget-column").length == 0 && window.location.href.split("?").length > 1) {\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
}\n
$("a[name=\'document_title\']").html(getObjectPropertyValue("getTitle"));\n
$("input#upload").click(function(event){\n
event.preventDefault();\n
$("#upload_document").dialog("open");\n
});\n
if ($("div.gadget-column").length == 1) {\n
$("a.domain_selected").text($("a.tree-open").text());\n
$("a.tree-open, a.tree-closed").each(function(){\n
......@@ -92,6 +151,7 @@ $(document).ready(function(){\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
$("a[name=\'document_title\']").html(new_title);\n
setObjectPropertyValue("setTitle", new_title, "value");\n
setObjectPropertyValue("setReference", new_reference, "value");\n
setObjectPropertyValue("setShortTitle", new_short_title, "value");\n
......@@ -105,6 +165,12 @@ $(document).ready(function(){\n
},\n
}\n
});\n
$("#upload_document").dialog({\n
autoOpen: false,\n
height: 116,\n
width: 346,\n
modal: true,\n
});\n
$("p#more_properties")\n
.click(function(){\n
$("div#more_property").show();\n
......@@ -136,8 +202,10 @@ $(document).ready(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
if ($("input#name.title").attr("value") != getObjectPropertyValue("getTitle")) {\n
$(this).html(getObjectPropertyValue("getTitle"));\n
}\n
$("input#name.title").attr("value", getObjectPropertyValue("getTitle"));\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
......@@ -145,10 +213,12 @@ $(document).ready(function(){\n
$("input#sort_index.sort_index").attr("value", getObjectPropertyValue("getIntIndex"));\n
$("#edit_document").dialog("open"); \n
});\n
$("a#settings, a#help").click(function(){\n
$("a#settings, a#help").click(function(event){\n
event.preventDefault()\n
$("a#right_message").show();\n
});\n
$("a.calendar, a.email").click(function(){\n
$("a.calendar, a.email").click(function(event){\n
event.preventDefault() \n
$("a#left_message").show();\n
});\n
$("a#right_message, a#left_message").click(function(){\n
......
......@@ -41,10 +41,13 @@ body {\n
font-family: arial,sans-serif;\n
display:inline-block;\n
font-weight:normal;\n
overflow-x: hidden;\n
}\n
\n
/* Hidden input */\n
fieldset#hidden_fieldset {\t \n
fieldset#hidden_fieldset,\n
div#upload_document,\n
div#edit_document {\t \n
display: none;\n
}\n
\n
......@@ -650,10 +653,6 @@ div#edit_document fieldset label {\n
font-size: 12px;\n
}\n
\n
span#ui-dialog-title-edit_document {\n
margin-top:-3px;\n
}\n
\n
div.ui-dialog-titlebar {\n
height:15px;\n
}\n
......@@ -687,7 +686,8 @@ div#edit_document fieldset label {\n
font-size: 12px;\n
}\n
\n
span#ui-dialog-title-edit_document {\n
span#ui-dialog-title-edit_document, \n
span#ui-dialog-title-upload_document {\n
font-size:17px;\n
margin-left:-8px;\n
margin-top:-3px;\n
......@@ -846,6 +846,29 @@ a.tree-open {\n
a.domain_selected {\n
float:left !important;\n
font-size: 15px !important;\n
}\n
\n
div#upload_document {\n
height: 36px !important;\n
width: 390px !important;\n
font-size: 12px;\n
}\n
fieldset#file_box {\n
border: 0px !important;\n
margin-left: -17px;\n
margin-top: -4px;\n
}\n
input#submit_document {\n
background: url("images/ui-bg_glass_75_dae6f6_1x400.png") repeat-x scroll 50% 50% #DAE6F6;\n
border: 1px solid #3D6474;\n
color: #555555;\n
font-weight: normal;\n
-moz-border-radius: 4px 4px 4px 4px;\n
margin-top: 3px;\n
}\n
\n
a#loading_message {\n
display: none;\n
}
]]></string> </value>
......
2010-12-10 gabriel
* Added box and feature to make upload of Text documents.
2010-12-07 gabriel
* Added feature to be possible filter the Listbox according to the Portal Type
......
107
\ No newline at end of file
108
\ 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