php7 fixes
[Pman.Builder] / Pman.Dialog.BuilderProp.js
index f21f7d2..b9266d0 100644 (file)
@@ -30,9 +30,16 @@ Pman.Dialog.BuilderProp = {
         this.dialog = Roo.factory({
             xtype: 'LayoutDialog',
             xns: Roo,
+            listeners : {
+                show : function (_self)
+                {
+                   _this.grid.ds.load({});
+                }
+            },
             closable : false,
             collapsible : false,
-            height : 170,
+            height : 600,
+            modal : true,
             resizable : false,
             title : "Add Property",
             width : 600,
@@ -40,252 +47,80 @@ Pman.Dialog.BuilderProp = {
                 {
                     xtype: 'GridPanel',
                     xns: Roo,
-                    title : "AutoAuth",
-                    fitToframe : true,
-                    fitContainer : true,
-                    tableName : 'AutoAuth',
-                    background : true,
-                    region : 'center',
                     listeners : {
                         activate : function() {
                             _this.panel = this;
-                            if (_this.grid) {
-                                _this.grid.footer.onClick('first');
-                            }
+                            //if (_this.grid) {
+                            //    _this.grid.ds.load({});
+                            //}
                         }
                     },
+                    fitContainer : true,
+                    fitToframe : true,
+                    region : 'center',
+                    title : "Props",
                     grid : {
                         xtype: 'Grid',
                         xns: Roo.grid,
-                        autoExpandColumn : 'url',
-                        loadMask : true,
                         listeners : {
                             render : function() 
                             {
                                 _this.grid = this; 
                                 //_this.dialog = Pman.Dialog.FILL_IN
-                                if (_this.panel.active) {
-                                   this.footer.onClick('first');
-                                }
+                               // if (_this.panel.active) {
+                                 //  this.footer.onClick('first');
+                               // }
                             },
                             rowdblclick : function (_self, rowIndex, e)
                             {
-                                if (!_this.dialog) return;
-                                _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
-                                    _this.grid.footer.onClick('first');
-                                }); 
+                                 
+                                 _this.callback(this.getDataSource().getAt(rowIndex).data.name);
+                                 _this.dialog.hide(); 
                             }
                         },
+                        autoExpandColumn : 'desc',
+                        loadMask : true,
                         dataSource : {
                             xtype: 'Store',
                             xns: Roo.data,
-                            remoteSort : true,
-                            sortInfo : { field : 'url', direction: 'ASC' },
+                            listeners : {
+                                beforeload : function (_self, options)
+                                {
+                                    // we should cache this!!!
+                                    options.params = options.params || {};
+                                    options.params.xtype = _this.data.xtype;
+                                    options.params.xns = _this.data.xns;
+                                    options.params.list = _this.data.list;    
+                                }
+                            },
+                            remoteSort : false,
+                            sortInfo : { field : 'name', direction: 'ASC' },
                             proxy : {
                                 xtype: 'HttpProxy',
                                 xns: Roo.data,
                                 method : 'GET',
-                                url : baseURL + '/Builder/Prop.php'
+                                url : baseURL + '/Builder/Palette/Prop.php'
                             },
                             reader : {
                                 xtype: 'JsonReader',
                                 xns: Roo.data,
-                                totalProperty : 'total',
-                                root : 'data',
                                 id : 'id',
+                                root : 'data',
+                                totalProperty : 'total',
                                 fields : [
-                                    {
-                                        'name': 'id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'url',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'ts',
-                                        'type': 'date',
-                                        'dateFormat': 'Y-m-d'
-                                    },
-                                    {
-                                        'name': 'checksum',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_name',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_title',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_company',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_address',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_email',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_telephone',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_fax',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_mobile',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_country',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_currency',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_shipping_method',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_shipping_acc',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_terms_agreed',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_passwd',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_is_buyer',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_is_seller',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_is_want_blind_rfq',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_buyer_type',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_is_verified',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_is_disabled',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_is_want_email',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_mail_newprod_freq',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_quotation_by',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_is_want_make_offer',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_mail_inventry_freq',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_max_rfq_per_day',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_is_approved',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_created',
-                                        'type': 'date'
-                                    },
-                                    {
-                                        'name': 'user_id_modified',
-                                        'type': 'date'
-                                    },
-                                    {
-                                        'name': 'user_id_modified_by',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_is_administrator',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'user_id_bank_name',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_bank_account',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'user_id_last_inventory_sent',
-                                        'type': 'date'
-                                    },
-                                    {
-                                        'name': 'user_id_last_rfq_report_sent',
-                                        'type': 'date'
-                                    },
-                                    {
-                                        'name': 'user_id_last_productlist_sent',
-                                        'type': 'date'
-                                    },
-                                    {
-                                        'name': 'user_id_company_id',
-                                        'type': 'int'
-                                    }
+                                    'name',
+                                    'desc'
                                 ]
                             }
                         },
-                        footer : {
-                            xtype: 'PagingToolbar',
-                            xns: Roo,
-                            pageSize : 25,
-                            displayInfo : true,
-                            displayMsg : 'Displaying AutoAuth{0} - {1} of {2}',
-                            emptyMsg : 'No AutoAuth found'
-                        },
                         colModel : [
                             {
                                 xtype: 'ColumnModel',
                                 xns: Roo.grid,
                                 dataIndex : 'name',
                                 header : 'name',
-                                width : 75,
-                                renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
+                                width : 175,
+                                renderer : function(v) { return String.format('{0}', v ? v : ''); }
                             },
                             {
                                 xtype: 'ColumnModel',
@@ -322,14 +157,18 @@ Pman.Dialog.BuilderProp = {
                         click : function (_self, e)
                         {
                             // do some checks?
-                             
+                             var sel = _this.grid.getSelectionModel().getSelected();
+                            if (!sel) {
+                                Roo.MessageBox.alert("Error", "Select a property");
+                            }
                             
-                            _this.dialog.el.mask("Saving");
-                            _this.form.doAction("submit");
+                            _this.callback(sel.data.name);
+                           _this.dialog.hide();
+                         
                         
                         }
                     },
-                    text : "Save"
+                    text : "Add"
                 }
             ]
         });