dd1dd0a93b16f37d9655c3c41a3a9f1fe85dc80e
[odoo/odoo.git] / addons / base / static / src / js / view_editor.js
1 openerp.base.view_editor = function(openerp) {
2 openerp.base.ViewEditor =  openerp.base.Widget.extend({
3     init: function(parent, element_id, dataset, view, options) {
4         this._super(parent);
5         this.element_id = element_id
6         this.parent = parent
7         this.dataset = dataset;
8         this.model = dataset.model;
9         this.fields_views = view;
10     },
11     start: function() {
12
13         var self = this;
14         var action = {
15             name:'ViewEditor',
16             context:this.session.user_context,
17             domain: [["model", "=", this.dataset.model]],
18             res_model: 'ir.ui.view',
19             views : [[false, 'list']],
20             type: 'ir.actions.act_window',
21             target: "current",
22             limit : 80,
23             auto_search : true,
24             flags: {
25                 sidebar: false,
26                 views_switcher: false,
27                 action_buttons:false,
28                 search_view:false,
29                 pager:false,
30                 radio:true
31             },
32         };
33         var action_manager = new openerp.base.ActionManager(this);
34         this.dialog = new openerp.base.Dialog(this,{
35             modal: true,
36             title: 'ViewEditor',
37             width: 750,
38             height: 500,
39             buttons: {
40                 "Create": function(){
41                      $(this).dialog('destroy');
42                 },
43                 "Edit": function(){
44                     self.Edit_view();
45                 },
46                 " Close": function(){
47                 }
48             },
49
50         });
51        this.dialog.start(); 
52        this.dialog.open();
53        action_manager.appendTo(this.dialog);
54        action_manager.do_action(action);
55     },
56
57     Edit_view : function(){
58         
59             this.dialog = new openerp.base.Dialog(this,{
60             modal: true,
61             title: 'Edit Xml',
62             width: 750,
63             height: 500,
64             buttons: {
65                 "Inherited View": function(){
66                     
67                 },
68                 "Preview": function(){
69                     
70                 },
71                 "Close": function(){
72                     $(this).dialog('destroy');
73                    
74                 }
75             },
76
77         });
78          this.dialog.start().open();
79          
80     }
81         
82 });
83 };