},
"Edit": function(){
- self.xml_id=0;
- self.edit_view();
+ self.xml_id = 0 ;
+ self.get_data();
+
},
"Close": function(){
$(this).dialog('destroy');
action_manager.appendTo(this.dialog);
action_manager.do_action(action);
},
- check_attr:function(xml,tag){
+
+ check_attr:function(xml,tag,level){
var obj = new Object();
obj.child_id = [];
obj.id = this.xml_id++;
+ obj.level = level;
var att_list = [];
var name1 = "<" + tag;
$(xml).each(function() {
obj.name = name1;
return obj;
},
+
save_object : function(val,parent_list,child_obj_list){
var self = this;
var check_id = parent_list[0];
val.child_id = child_obj_list;
}
},
+
children_function : function(xml,root,parent_list,parent_id,main_object){
var self = this;
var child_obj_list = [];
var parent_list = parent_list;
var main_object = main_object;
var children_list = $(xml).filter(root).children();
+ var parents = $(children_list[0]).parents().get();
_.each(children_list, function(child_node){
- var string = self.check_attr(child_node,child_node.tagName.toLowerCase());
+ var string = self.check_attr(child_node,child_node.tagName.toLowerCase(),parents.length);
child_obj_list.push(string);
});
if(children_list.length != 0){
}
for(var i=0;i<children_list.length;i++){
self.children_function
-(children_list[i],children_list[i].tagName.toLowerCase(),parent_list,child_obj_list[i].id,main_object);
+ (children_list[i],children_list[i].tagName.toLowerCase(),parent_list,child_obj_list[i].id,main_object);
}
return main_object;
},
- edit_view : function(){
+ get_data : function(){
var self = this;
- var all_list =[];
var view_id =(($("input[name='radiogroup']:checked").parent()).parent()).attr('data-id');
var ve_dataset = new openerp.web.DataSet(this,'ir.ui.view');
- ve_dataset.read_ids([parseInt(view_id)],['arch'],function (arch) {
- var arch = arch[0].arch;
- var root = $(arch).filter(":first")[0];
- var tag = root.tagName.toLowerCase();
- var root_object = self.check_attr(root,tag);
- one_object = self.children_function(arch,tag,[],0,[root_object]);
- //render here
- });
+ ve_dataset.read_ids([parseInt(view_id)],['arch'],function (arch){
+ var arch = arch[0].arch;
+ var root = $(arch).filter(":first")[0];
+ var tag = root.tagName.toLowerCase();
+ var root_object = self.check_attr(root,tag,0);
+ var one_object = self.children_function(arch,tag,[],0,[root_object]);
+ return self.edit_view(one_object);
+ });
+ },
+ edit_view : function(o){
+ var self = this;
this.dialog = new openerp.web.Dialog(this,{
- modal: true,
- title: 'Edit Xml',
- width: 750,
- height: 500,
- buttons: {
- "Inherited View": function(){
-
- },
- "Preview": function(){
-
- },
- "Close": function(){
- $(this).dialog('destroy');
- }
- },
+ modal: true,
+ title: 'Edit Xml',
+ width: 750,
+ height: 500,
+ buttons: {
+ "Inherited View": function(){
+
+ },
+ "Preview": function(){
+
+ },
+ "Close": function(){
+ $(this).dialog('destroy');
+ }
+ }
+ });
- });
-
+ this.dialog.start().open();
+ this.dialog.$element.html(QWeb.render('view_editor', {
+ 'data': o,
+ }));
}
});
.unwrap();
</t>
</t>
+<t t-name="view_editor">
+ <table align="left" width= "100%">
+ <t t-call="view_editor.row"/>
+ </table>
+</t>
+<t t-name="view_editor.row">
+
+ <t t-foreach="data" t-as="rec">
+ <tr >
+ <td class= "view_editor"
+ t-att-style="'background-position: ' + 30*rec.level + 'px; padding-left: ' + 30*rec.level + 'px'">
+ <img t-if="rec.child_id.length" src="/web/static/src/img/collapse.gif" width="16" height="16" border="0"/>
+ <t t-esc="rec.name"/>
+ </td>
+ </tr >
+ <t t-if="rec.child_id.length">
+ <t t-set="data" t-value="rec.child_id"/>
+ <t t-call="view_editor.row"/>
+ </t>
+ </t>
+
+</t>
<t t-name="ExportView">
<a id="exportview" href="javascript: void(0)" style="text-decoration: none;color: #3D3D3D;">Export</a>
</tr>
</table>
+
<table t-name="ExportTreeView-Secondary"
id="field-tree-structure" class="oe_export_fields_selector_export"
cellspacing="0" cellpadding="0">