Pman.Dialog.CmsBlog.bjs
[Pman.Cms] / Pman.Dialog.CmsLanguagePick.js
index edccead..d6bf155 100644 (file)
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Dialog');
+
 Pman.Dialog.CmsLanguagePick = {
 
-    dialog : false,
-    callback:  false,
+ _strings : {
+  '4994a8ffeba4ac3140beb89e8d41f174' :"Language",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  '052ca52fc8eb1bdff3e34de3fa735e35' :"Select a Language",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
+ },
 
-    show : function(data, cb)
-    {
-        if (!this.dialog) {
-            this.create();
-        }
+ dialog : false,
+ callback:  false,
 
-        this.callback = cb;
-        this.data = data;
-        this.dialog.show(this.data._el);
-        if (this.form) {
-           this.form.reset();
-           this.form.setValues(data);
-           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
-        }
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
 
-    },
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
 
-    create : function()
-    {
-        var _this = this;
-        this.dialog = Roo.factory({
-            xtype: 'LayoutDialog',
-            xns: Roo,
-            closable : false,
-            collapsible : false,
-            height : 630,
-            resizable : false,
-            title : "Edit / Create Person",
-            width : 400,
-            modal : true,
-            items : [
-                {
-                    xtype: 'ContentPanel',
-                    xns: Roo,
-                    region : 'center',
-                    items : [
-                        {
-                            xtype: 'Form',
-                            xns: Roo.form,
-                            listeners : {
-                                actioncomplete : function(_self,action)
-                                {
-                                    if (action.type == 'setdata') {
-                                       //_this.dialog.el.mask("Loading");
-                                       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
-                                       return;
-                                    }
-                                    if (action.type == 'load') {
-                                        _this.dialog.el.unmask();
-                                        return;
-                                    }
-                                    if (action.type =='submit') {
-                                    
-                                        _this.dialog.el.unmask();
-                                        _this.dialog.hide();
-                                    
-                                         if (_this.callback) {
-                                            _this.callback.call(_this, _this.form.getValues());
-                                         }
-                                         _this.form.reset();
-                                         return;
-                                    }
-                                },
-                                rendered : function (form)
-                                {
-                                    _this.form= form;
-                                }
-                            },
-                            method : 'POST',
-                            style : 'margin:10px;',
-                            url : baseURL + '/Roo/Person.php',
-                            items : [
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Passwd',
-                                    name : 'passwd',
-                                    width : 200
-                                },
-                                {
-                                    xtype: 'ComboBox',
-                                    xns: Roo.form,
-                                    allowBlank : false,
-                                    editable : false,
-                                    emptyText : "Select Person",
-                                    forceSelection : true,
-                                    listWidth : 400,
-                                    loadingText : "Searching...",
-                                    minChars : 2,
-                                    pageSize : 20,
-                                    qtip : "Select Person",
-                                    selectOnFocus : true,
-                                    triggerAction : 'all',
-                                    typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
-                                    queryParam : 'query[name]',
-                                    fieldLabel : 'Owner',
-                                    valueField : 'id',
-                                    displayField : 'name',
-                                    hiddenName : 'owner_id',
-                                    name : 'owner_id_name',
-                                    store : {
-                                        xtype: 'Store',
-                                        xns: Roo.data,
-                                        remoteSort : true,
-                                        sortInfo : { direction : 'ASC', field: 'id' },
-                                        listeners : {
-                                            beforeload : function (_self, o){
-                                                o.params = o.params || {};
-                                                // set more here
-                                            }
-                                        },
-                                        proxy : {
-                                            xtype: 'HttpProxy',
-                                            xns: Roo.data,
-                                            method : 'GET',
-                                            url : baseURL + '/Roo/Person.php'
-                                        },
-                                        reader : {
-                                            xtype: 'JsonReader',
-                                            xns: Roo.data,
-                                            id : 'id',
-                                            root : 'data',
-                                            totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Lang',
-                                    name : 'lang',
-                                    width : 200
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'No reset sent',
-                                    name : 'no_reset_sent',
-                                    width : 75
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Action type',
-                                    name : 'action_type',
-                                    width : 200
-                                },
-                                {
-                                    xtype: 'ComboBox',
-                                    xns: Roo.form,
-                                    allowBlank : false,
-                                    editable : false,
-                                    emptyText : "Select Projects",
-                                    forceSelection : true,
-                                    listWidth : 400,
-                                    loadingText : "Searching...",
-                                    minChars : 2,
-                                    pageSize : 20,
-                                    qtip : "Select Projects",
-                                    selectOnFocus : true,
-                                    triggerAction : 'all',
-                                    typeAhead : true,
-                                    width : 300,
-                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
-                                    queryParam : 'query[name]',
-                                    fieldLabel : 'Project',
-                                    valueField : 'id',
-                                    displayField : 'name',
-                                    hiddenName : 'project_id',
-                                    name : 'project_id_name',
-                                    store : {
-                                        xtype: 'Store',
-                                        xns: Roo.data,
-                                        remoteSort : true,
-                                        sortInfo : { direction : 'ASC', field: 'id' },
-                                        listeners : {
-                                            beforeload : function (_self, o){
-                                                o.params = o.params || {};
-                                                // set more here
-                                            }
-                                        },
-                                        proxy : {
-                                            xtype: 'HttpProxy',
-                                            xns: Roo.data,
-                                            method : 'GET',
-                                            url : baseURL + '/Roo/Projects.php'
-                                        },
-                                        reader : {
-                                            xtype: 'JsonReader',
-                                            xns: Roo.data,
-                                            id : 'id',
-                                            root : 'data',
-                                            totalProperty : 'total',
-                                            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'TextField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Deleted by',
-                                    name : 'deleted_by',
-                                    width : 75
-                                },
-                                {
-                                    xtype: 'DateField',
-                                    xns: Roo.form,
-                                    fieldLabel : 'Deleted dt',
-                                    name : 'deleted_dt',
-                                    width : 100,
-                                    format : 'Y-m-d'
-                                },
-                                {
-                                    xtype: 'Hidden',
-                                    xns: Roo.form,
-                                    name : 'id'
-                                }
-                            ]
-                        }
-                    ]
-                }
-            ],
-            center : {
-                xtype: 'LayoutRegion',
-                xns: Roo
-            },
-            buttons : [
+ },
+
+ create : function()
+ {
+   var _this = this;
+   this.dialog = Roo.factory({
+    xtype : 'LayoutDialog',
+    closable : false,
+    collapsible : false,
+    height : 120,
+    modal : true,
+    resizable : false,
+    title : _this._strings['052ca52fc8eb1bdff3e34de3fa735e35'] /* Select a Language */,
+    width : 400,
+    xns : Roo,
+    '|xns' : 'Roo',
+    center : {
+     xtype : 'LayoutRegion',
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    buttons : [
+     {
+      xtype : 'Button',
+      text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo'
+     },
+     {
+      xtype : 'Button',
+      text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      listeners : {
+       click : function (_self, e)
+        {
+            // do some checks?
+             
+            var data =  _this.form.getValues();
+         
+            if (!data.lang.length) {
+            
+                Roo.MessageBox.alert("Error", "Select language");
+                return;
+            
+            }
+            _this.dialog.hide();
+                    
+            var callbackData = data.lang;
+           // Roo.log(_this.data);
+            if(_this.data._with_name == true){
+                callbackData = {'lang' : data.lang , 'lang_name' : _this.form.findField('lang').lastSelectionText};
+            }
+            
+            _this.callback(callbackData);
+            
+        
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'ContentPanel',
+      region : 'center',
+      xns : Roo,
+      '|xns' : 'Roo',
+      items  : [
+       {
+        xtype : 'Form',
+        method : 'GET',
+        style : 'margin:10px;',
+        url : baseURL + '/Roo/INGORE.php',
+        listeners : {
+         actioncomplete : function(_self,action)
+          {
+              if (action.type == 'setdata') {
+                 //_this.dialog.el.mask("Loading");
+                 //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                 return;
+              }
+              if (action.type == 'load') {
+                  _this.dialog.el.unmask();
+                  return;
+              }
+              if (action.type =='submit') {
+              
+                  _this.dialog.el.unmask();
+                  _this.dialog.hide();
+          
+                   if (_this.callback) {
+                      _this.callback.call(_this, _this.form.getValues());
+                   }
+                   _this.form.reset();
+                   return;
+              }
+          },
+         rendered : function (form)
+          {
+              _this.form= form;
+          }
+        },
+        xns : Roo.form,
+        '|xns' : 'Roo.form',
+        items  : [
+         {
+          xtype : 'ComboBox',
+          allowBlank : false,
+          alwaysQuery : true,
+          displayField : 'title',
+          editable : false,
+          fieldLabel : _this._strings['4994a8ffeba4ac3140beb89e8d41f174'] /* Language */,
+          hiddenName : 'lang',
+          listWidth : 200,
+          name : 'language_name',
+          triggerAction : 'all',
+          valueField : 'code',
+          width : 200,
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          store : {
+           xtype : 'Store',
+           listeners : {
+            beforeload : function (_self, o)
+             {
+                 o.params['!code'] = 'en'; // exclude english from the list (it's the default?)
+             }
+           },
+           xns : Roo.data,
+           '|xns' : 'Roo.data',
+           proxy : {
+            xtype : 'HttpProxy',
+            method : 'GET',
+            url : baseURL + '/Core/I18n/Lang',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           },
+           reader : {
+            xtype : 'JsonReader',
+            fields : [
                 {
-                    xtype: 'Button',
-                    xns: Roo,
-                    listeners : {
-                        click : function (_self, e)
-                        {
-                            _this.dialog.hide();
-                        }
-                    },
-                    text : "Cancel"
+                    'name': 'code',
+                    'type': 'string'
                 },
                 {
-                    xtype: 'Button',
-                    xns: Roo,
-                    listeners : {
-                        click : function (_self, e)
-                        {
-                            // do some checks?
-                             
-                            
-                            _this.dialog.el.mask("Saving");
-                            _this.form.doAction("submit");
-                        
-                        }
-                    },
-                    text : "Save"
+                    'name': 'title',
+                    'type': 'string'
                 }
-            ]
-        });
-    }
+            ],
+            id : 'code',
+            root : 'data',
+            totalProperty : 'total',
+            xns : Roo.data,
+            '|xns' : 'Roo.data'
+           }
+          }
+         }
+        ]
+       }
+      ]
+     }
+    ]
+   });
+ }
 };