From f2bad9c18b0526732fc83ee88759b08809ebdf33 Mon Sep 17 00:00:00 2001 From: Bruno Produit Date: Mon, 10 Dec 2018 04:54:05 +0200 Subject: [PATCH] editor --- ckanext-editor/ckanext/editor/plugin.py | 11 ++++++++++- ckanext-editor/ckanext/editor/templates/base.html | 9 +++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ckanext-editor/ckanext/editor/plugin.py b/ckanext-editor/ckanext/editor/plugin.py index d68c56a..cf2013f 100644 --- a/ckanext-editor/ckanext/editor/plugin.py +++ b/ckanext-editor/ckanext/editor/plugin.py @@ -84,7 +84,16 @@ def setup_template_variables(self, context, data_dict): for tag in root.iter(): tag_list.append(tag.tag) - data = json.dumps(xmltodict.parse(open(file_path, 'r').read()) + a=xmltodict.parse(open(file_path, 'r').read()) + b = {} + for i in a: + b[i] = { + 'id' : 'node_2', + 'text' : 'Root node with options', + 'state' : { 'opened' : true, 'selected' : true }, + 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] + } + data = json.dumps() return {'root': root, 'tree': tree, 'treeview': Markup(treeview), 'tag_list': tag_list, 'data': data} diff --git a/ckanext-editor/ckanext/editor/templates/base.html b/ckanext-editor/ckanext/editor/templates/base.html index ce0a44c..506393a 100644 --- a/ckanext-editor/ckanext/editor/templates/base.html +++ b/ckanext-editor/ckanext/editor/templates/base.html @@ -21,7 +21,8 @@