Commit 878efaac authored by Łukasz Nowak's avatar Łukasz Nowak

WIP: Working list of Software Products in JS.

parent b110cab3
<?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>response = []\n
\n
kw = {}\n
kw.update(\n
portal_type=\'Software Product\',\n
validation_state=\'published\',\n
limit=10,\n
title=title,\n
)\n
if title:\n
for software_product in context.getPortalObject().portal_catalog(**kw\n
):\n
response.append({\'title\': software_product.getTitle(), \'image\': software_product.getDefaultImageAbsoluteUrl() + \'/Base_download\', \'uid\': str(software_product.getUid())})\n
return context.asJSON(response)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>title</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getSoftwareProductListAsJSON</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n
<tal:block tal:define="form_action string:logged_in;\n
global form_id string:login_form;\n
js_list python: [\'%s/login_form.js\' % (here.portal_url(), ), \'%s/erp5.js\' % (here.portal_url(), )]">\n
<tal:block metal:use-macro="here/main_template/macros/master">\n
<tal:block metal:fill-slot="main">\n
<div class="content">\n
<h1 i18n:translate="" i18n:domain="ui">Request a Software Instance</h1>\n
<input type="hidden" name="js_entry" id="js_entry">\n
<script type="text/javascript">\n
$(document).ready(mainController());\n
</script>\n
</div>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_viewSoftwareRender</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -53,7 +53,10 @@ ...@@ -53,7 +53,10 @@
<value> <string># This script returns an iterable of the paths to standard JavaScript objects.\n <value> <string># This script returns an iterable of the paths to standard JavaScript objects.\n
\n \n
return (\'jquery/core/jquery.js\',\n return (\'jquery/core/jquery.js\',\n
\'vifib_hosting_js/vifib_hosting.js\',)\n \'vifib_hosting_js/vifib_hosting.js\',\n
\'vifib_hosting_js/slap.js\',\n
\'vifib_hosting_js/vifib.js\',\n
)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21350751.9</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>slap.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string>slap = {\n
}</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>10</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts21351032.04</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>vifib.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="cdata"><![CDATA[
function drawSoftwareProductList(data) {\n
$(\'#software_product_list\').remove()\n
var ul = $(\'<ul>\');\n
ul.attr(\'id\', \'software_product_list\')\n
$.each(data, function(i,item){\n
sp_id = \'software_product_\' + \'\'+item.uid;\n
li = $(\'<li>\').appendTo(ul);\n
var newElem = $(\'<img>\');\n
newElem.attr(\'alt\', item.title);\n
newElem.attr(\'src\', item.image);\n
newElem.attr(\'id\', sp_id);\n
newElem.appendTo(li)\n
$(\'#\' + sp_id).click(function() {\n
alert(\'Clicked on \' + $(this)[0][\'alt\']);\n
});\n
});\n
$("#js_entry").before(ul);\n
}\n
\n
function updateSoftwareProductList() {\n
q = $(\'#software_product_query\')[0][\'value\']\n
$.getJSON(\n
"http://t228:18080/erp5/web_site_module/hosting/myspace/software/ERP5Site_getSoftwareProductListAsJSON",\n
{"title":q},\n
drawSoftwareProductList);\n
}\n
\n
function mainController() {\n
$.ajaxSetup ({ \n
cache: false \n
});\n
\n
var newElem = $(\'<input type="text">\');\n
newElem.attr(\'id\', "software_product_query");\n
$("#js_entry").before(newElem);\n
\n
var newElem = $(\'<input type="button">\')\n
newElem.attr(\'value\', \'Refresh...\')\n
$("#js_entry").before(newElem);\n
\n
newElem.click(updateSoftwareProductList)\n
\n
}
]]></string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1189</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
</div>\n </div>\n
\n \n
<div class="available_menu_option">\n <div class="available_menu_option">\n
<a tal:attributes="href string:${website_url}/myspace/help">\n <a tal:attributes="href string:${website_url}/myspace/software">\n
<img tal:attributes="src string:${base_url}help_active.png" alt="Help" />\n <img tal:attributes="src string:${base_url}software_active.png" alt="Software" />\n
<br /><span i18n:translate="">Help</span>\n <br /><span i18n:translate="">Software</span>\n
</a>\n </a>\n
</div>\n </div>\n
\n \n
......
315 316
\ 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