Commit 610c8dbd authored by Łukasz Nowak's avatar Łukasz Nowak

Prepare and draw placeholder for SR categories.

parent c2dcf925
<?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 pprint import pformat\n
software = context.getPortalObject().portal_categories.product_line.software\n
\n
def getCategoryTree(category):\n
tree = {}\n
for c in category.getCategoryChildValueList(recursive=0):\n
tree[c.getTitle()] = getCategoryTree(c)\n
return tree\n
\n
category_tree = getCategoryTree(software)\n
return context.asJSON(category_tree)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getSoftwareCategoryTreeAsJSON</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -52,6 +52,7 @@
<script type="text/javascript">\n
$(document).ready(function() {\n
$.ajaxSetup ({cache: false});\n
$.getJSON(vifib[\'site_url\'] + "/ERP5Site_getSoftwareCategoryTreeAsJSON", drawSoftwareCategoryTree);\n
$(window).hashchange(hashController);\n
$(window).hashchange();\n
});\n
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts22232696.03</string> </value>
<value> <string>ts22660122.87</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -94,6 +94,63 @@ function hashTo(event) {\n
window.location.hash = \'#\'+$.param(event.data);\n
}\n
\n
function toggle() {\n
var el = $(\'ul#\' + $(this)[0].id).filter(\':visible\');\n
if (el.length > 0) { el.hide(); }\n
else { $(\'ul#\' + $(this)[0].id).show(); }\n
}\n
\n
function hasher() {\n
t = $(this)[0].id.replace(\'_\', \' \', \'g\');\n
console.log(\'Would set \' + t)\n
// window.location.hash = \'oink=\' + t;\n
$(\'.selected\').removeClass(\'selected\');\n
$(this).addClass(\'selected\');\n
}\n
\n
function resetCategoryHash() {\n
console.log(\'Reseted\');\n
}\n
\n
function appendSoftwareCategoryTree(data, id) {\n
console.log(id);\n
console.log(data);\n
var ul = $(\'<ul>\');\n
if (id !== undefined) {ul.attr(\'id\', id.replace(\' \', \'_\', \'g\'));}\n
else {\n
ul.attr(\'id\', \'master\');\n
var reset = $(\'<li>\');\n
reset.text(\'Reset...\')\n
reset.click(resetCategoryHash);\n
ul.append(reset);\n
}\n
var i = 0;\n
for (var q in data) {\n
var li = $(\'<li>\');\n
li.attr({\'id\': q.replace(\' \', \'_\', \'g\'), \'t\': q});\n
ul.append(li);\n
var s = q;\n
r = appendSoftwareCategoryTree(data[q], q);\n
if (r) {\n
ul.append(r);\n
s += \' + \';\n
li.click(toggle);\n
}\n
li.click(hasher);\n
li.html(s);\n
++i;\n
}\n
if (id !== undefined) {ul.hide();}\n
if (i>0) {return ul; }\n
else {return false; }\n
}\n
\n
function drawSoftwareCategoryTree(data) {\n
category = $(\'#left_menu\');\n
category.empty();\n
category.append(appendSoftwareCategoryTree(data));\n
}\n
\n
function drawSoftwareReleaseList(data) {\n
$(\'#software_release_container\').empty()\n
var ul = $(\'<ul>\');\n
......@@ -282,7 +339,7 @@ function hashController ()\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>8160</int> </value>
<value> <int>9491</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
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