PHP7 fix
[Pman.Core] / Pman.Dialog.Document_Types.js
1 //<script type="text/javascript">
2
3 Pman.Dialog.Document_Types = {
4     dialog : false,
5     form : false,
6     create: function()
7     {
8         if (this.dialog) {
9             return;
10         }
11         
12         this.dialog = new Ext.LayoutDialog(Ext.get(document.body).createChild({tag:'div'}),  { 
13             autoCreated: true,
14             title: "Edit Document Type",
15             modal: true,
16             width:  650,
17             height: 250,
18             shadow:true,
19             minWidth:200,
20             minHeight:180,
21             //proxyDrag: true,
22             closable: false,
23             draggable: false,
24             center: {
25                 autoScroll:false,
26                 titlebar: false,
27                // tabPosition: 'top',
28                 hideTabs: true,
29                 closeOnTab: true,
30                 alwaysShowTabs: false
31             }
32         });
33         this.dialog.addKeyListener(27, this.dialog.hide, this.dialog);
34         this.dialog.addButton("Cancel", this.dialog.hide, this.dialog);
35        
36         this.dialog.addButton("Save", this.save, this);
37         this.layout = this.dialog.getLayout();
38         this.layout.beginUpdate();
39         
40         var dg = Pman.Dialog.Document_Types;
41         
42         this.form = new Ext.form.Form({
43             labelWidth: 250 ,
44             listeners : {
45                 actionfailed : function(f, act) {
46                     dg.dialog.el.unmask();
47                     // error msg???
48                     
49                     Pman.standardActionFailed(f,act);
50                               
51                 },
52                 actioncomplete: function(f, act) {
53                     dg.dialog.el.unmask();
54                     //console.log('load completed'); 
55                     // error messages?????
56                     
57                    
58                     if (act.type == 'load') {
59                         
60                         dg.data = act.result.data;
61                        // dg.loaded();
62                         return;
63                     }
64                     
65                     
66                     if (act.type == 'submit') { // only submitted here if we are 
67                         dg.dialog.hide();
68                         if (dg.callback) {
69                             dg.callback.call(this, act.result.data);
70                         }
71                         return; 
72                     }
73                     // unmask?? 
74                 }
75             }
76         
77             
78             
79              
80         });
81         //?? will this work...
82         this.form.addxtype.apply(this.form,[{
83                 name : 'code',
84                 fieldLabel : "Code",
85                 value : '',
86                 allowBlank : false,
87                 qtip : "Enter code",
88                 xtype : 'TextField',
89                 width : 100
90             },{
91                 name : 'name',
92                 fieldLabel : "Document Type",
93                 value : '',
94                 allowBlank : true,
95                 qtip : "Enter Document Type",
96                 xtype : 'TextField',
97                 width : 300
98             },{
99                 name : 'remarks',
100                 fieldLabel : "Remarks",
101                 value : '',
102                 allowBlank : true,
103                 qtip : "Enter remarks",
104                 xtype : 'TextArea',
105                 height : 100,
106                 width : 300
107             },{
108                 name : 'id',
109                 value : '',
110                 xtype : 'Hidden'
111                 
112            
113             }
114         ]);
115         var ef = this.dialog.getLayout().getEl().createChild({tag: 'div'});
116         ef.dom.style.margin = 10;
117          
118         this.form.render(ef.dom);
119
120         var vp = this.dialog.getLayout().add('center', new Ext.ContentPanel(ef, {
121             autoCreate : true,
122             //title: 'Org Details',
123             //toolbar: this.tb,
124             width: 250,
125             maxWidth: 250,
126             fitToFrame:true
127         }));
128           
129
130         
131         
132         this.layout.endUpdate();
133     },
134     _id : 0,
135     show: function (data, callback)
136     {
137         
138         this.callback = callback;
139         this._id = data.id ? data.id : 0;  // modify if you do not use ID !!!!
140         this.create();
141         this.form.reset();
142         
143         this.form.setValues(data);
144         
145         this.dialog.show();
146         
147
148     },
149      
150     save : function()
151     {
152          this.form.doAction('submit', {
153             url: baseURL + '/Roo/Document_Types.html',
154             method: 'POST',
155             params: {
156                 _id: this._id ,
157                 ts : Math.random()
158             } 
159         });
160     }
161     
162     
163     
164     
165          
166 };