Pman.Dialog.CmsBlog.bjs
[Pman.Cms] / Pman.Dialog.CmsCategory.js
index 9b847cf..ee7908f 100644 (file)
@@ -1,6 +1,7 @@
 //<script type="text/javascript">
 
-// Auto generated file - created by Builder Module - do not edit directly
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
 Pman.Dialog.CmsCategory = {
 
     dialog : false,
@@ -14,7 +15,7 @@ Pman.Dialog.CmsCategory = {
 
         this.callback = cb;
         this.data = data;
-        this.dialog.show();
+        this.dialog.show(this.data._el);
         if (this.form) {
            this.form.reset();
            this.form.setValues(data);
@@ -27,7 +28,7 @@ Pman.Dialog.CmsCategory = {
     {
         var _this = this;
         this.dialog = Roo.factory({
-            xtype : 'LayoutDialog',
+            xtype: 'LayoutDialog',
             xns: Roo,
             background : true,
             width : 800,
@@ -39,24 +40,22 @@ Pman.Dialog.CmsCategory = {
             closable : false,
             items : [
                 {
-                    xtype : 'ContentPanel',
+                    xtype: 'ContentPanel',
+                    xns: Roo,
                     background : true,
                     fitToFrame : true,
                     region : 'center',
                     items : [
                         {
-                            xtype : 'Form',
-                            style : 'margin: 5px',
-                            url: baseURL + '/Roo/Category.php',
-                            method : 'POST',
+                            xtype: 'Form',
+                            xns: Roo.form,
                             listeners : {
-                                actionfailed: function (_self, action)
+                                actionfailed : function (_self, action)
                                 {
                                     _this.dialog.el.unmask();
                                     Pman.standardActionFailed(_self, action);
-                                }
-                                ,
-                                actioncomplete: function (_self, action)
+                                },
+                                actioncomplete : function (_self, action)
                                 {
                                    
                                    if (action.type =='submit') {
@@ -70,88 +69,135 @@ Pman.Dialog.CmsCategory = {
                                         _this.form.reset();
                                         return;
                                     }
-                                    if (action.type = 'setdata') {
+                                     if (action.type == 'setdata') {
+                                         if (_this.data.id) {
+                                           _this.dialog.el.mask("Loading");
+                                           this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                                            return;
+                                       }
+                                      _this.grid.getDataSource().load();
+                                       return;
+                                    }
+                                    if (action.type == 'load') {
                                        _this.grid.getDataSource().load();
-                                    
+                                        _this.dialog.el.unmask();
+                                        return;
                                     }
-                                }
-                                ,
-                                rendered: function (_self)
+                                    
+                                  
+                                    
+                                },
+                                rendered : function (_self)
                                 {
                                     _this.form = _self;
                                 }
-                                
                             },
+                            method : 'POST',
+                            style : 'margin: 5px',
+                            url : baseURL + '/Roo/Category.php',
                             items : [
                                 {
-                                    fieldLabel : "Parent ",
+                                    xtype: 'TextField',
+                                    xns: Roo.form,
+                                    fieldLabel : 'Parent',
                                     name : 'parent_id_title',
-                                    hiddenName : 'parent_id',
-                                    qtip : "Select Parent ",
-                                    emptyText : "Select Parent ",
-                                    xtype : 'ComboBox',
-                                    selectOnFocus : true,
+                                    readOnly : true,
+                                    width : 450
+                                },
+                                {
+                                    xtype: 'NumberField',
+                                    xns: Roo.form,
+                                    decimalPrecision : 0,
+                                    fieldLabel : 'Order (1 first)',
+                                    name : 'display_order',
+                                    width : 50
+                                },
+                                {
+                                    xtype: 'TextField',
+                                    xns: Roo.form,
+                                    name : 'title',
+                                    fieldLabel : 'Title',
+                                    width : 450
+                                },
+                                {
+                                    xtype: 'ComboBox',
+                                    xns: Roo.form,
                                     allowBlank : true,
-                                    width : 300,
-                                    listWidth : 400,
-                                    editable : false,
-                                    displayField : 'title',
-                                    valueField : 'id',
-                                    typeAhead : true,
+                                    displayField : 'name',
+                                    editable : 'false',
+                                    emptyText : "Select Type",
+                                    fieldLabel : 'Type',
                                     forceSelection : true,
-                                    triggerAction : 'all',
-                                    tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}<\/b> <\/div>',
-                                    queryParam : 'query[title]',
+                                    hiddenName : 'category_type_id',
+                                    listWidth : 200,
                                     loadingText : "Searching...",
                                     minChars : 2,
+                                    name : 'category_type_id_name',
                                     pageSize : 20,
+                                    qtip : "Select cms_category_type",
+                                    selectOnFocus : true,
+                                    tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
+                                    triggerAction : 'all',
+                                    typeAhead : true,
+                                    valueField : 'id',
+                                    width : 200,
                                     store : {
-                                        xtype : 'Store',
-                                        reader: Pman.Readers.Category,
+                                        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',
-                                            url: baseURL + '/Roo/Category.php',
-                                            method : 'GET'
+                                            xtype: 'HttpProxy',
+                                            xns: Roo.data,
+                                            method : 'GET',
+                                            url : baseURL + '/Roo/cms_category_type.php'
+                                        },
+                                        reader : {
+                                            xtype: 'JsonReader',
+                                            xns: Roo.data,
+                                            id : 'id',
+                                            root : 'data',
+                                            totalProperty : 'total',
+                                            fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
                                         }
                                     }
                                 },
                                 {
-                                    name : 'title',
-                                    fieldLabel : "Title",
-                                    width : 450,
-                                    xtype : 'TextField'
+                                    xtype: 'Checkbox',
+                                    xns: Roo.form,
+                                    fieldLabel : 'Visible',
+                                    name : 'visible'
                                 },
                                 {
-                                    xtype : 'Column',
-                                    width : 550,
-                                    labelAlign : 'top',
-                                    items : [
-                                        {
-                                            name : 'page_text',
-                                            fieldLabel : "Page text",
-                                            xtype : 'HtmlEditor',
-                                            width : 550,
-                                            height : 350
-                                        }
-                                    ]
+                                    xtype: 'Hidden',
+                                    xns: Roo.form,
+                                    name : 'parent_id'
                                 },
                                 {
-                                    name : 'id',
-                                    xtype : 'Hidden'
+                                    xtype: 'Hidden',
+                                    xns: Roo.form,
+                                    name : 'id'
                                 }
                             ]
                         }
                     ]
                 },
                 {
-                    xtype : 'GridPanel',
+                    xtype: 'GridPanel',
+                    xns: Roo,
                     title : "Images",
                     fitToframe : true,
                     fitContainer : true,
                     tableName : 'Images',
                     background : false,
                     listeners : {
-                        activate: function() {
+                        activate : function() {
                             _this.panel = this;
                             if (_this.grid) {
                                 //_this.grid.footer.onClick('first');
@@ -160,11 +206,12 @@ Pman.Dialog.CmsCategory = {
                     },
                     region : 'east',
                     grid : {
-                        xtype : 'Grid',
+                        xtype: 'Grid',
+                        xns: Roo.grid,
                         autoExpandColumn : 'filename',
                         loadMask : true,
                         listeners : {
-                            render: function() { 
+                            render : function() { 
                                 _this.grid = this; 
                                 //_this.dialog = Pman.Dialog.FILL_IN
                                 if (_this.panel.active) {
@@ -173,10 +220,11 @@ Pman.Dialog.CmsCategory = {
                             }
                         },
                         dataSource : {
-                            xtype : 'Store',
-                            reader: Pman.Readers.Images,
+                            xtype: 'Store',
+                            xns: Roo.data,
+                            reader : Pman.Readers.Images,
                             listeners : {
-                                beforeload: function (_self, o)
+                                beforeload : function (_self, o)
                                 {
                                   if (!_this.data.id) {
                                        return false;
@@ -187,35 +235,24 @@ Pman.Dialog.CmsCategory = {
                                 }
                             },
                             proxy : {
-                                xtype : 'HttpProxy',
+                                xtype: 'HttpProxy',
+                                xns: Roo.data,
                                 method : 'GET',
-                                url: baseURL + '/Roo/Images.php'
+                                url : baseURL + '/Roo/Images.php'
                             }
                         },
-                        colModel : [
-                            {
-                                header : '',
-                                width : 110,
-                                dataIndex : 'id',
-                                renderer: function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}">', baseURL, v, r.data.filename); }
-                            },
-                            {
-                                header : 'Filename',
-                                width : 100,
-                                dataIndex : 'filename',
-                                renderer: function(v,x,r) { return String.format('{0}<br/><i qtip="{1}">{1}</i>', v, r.data.linkurl); }
-                            }
-                        ],
                         toolbar : {
-                            xtype : 'Toolbar',
+                            xtype: 'Toolbar',
+                            xns: Roo,
                             items : [
                                 {
+                                    xtype: 'Button',
+                                    xns: Roo,
                                     text : "Add",
-                                    xtype : 'Button',
                                     cls : 'x-btn-text-icon',
-                                    icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
+                                    icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
                                     listeners : {
-                                        click: function()
+                                        click : function()
                                                 {
                                                     Pman.Dialog.Image.show( { id : 0, onid: _this.data.id, ontable: 'Category' }, function(data) {
                                                         _this.grid.getDataSource().load();
@@ -227,16 +264,16 @@ Pman.Dialog.CmsCategory = {
                                                     }); 
                                         
                                                 }
-                                                
                                     }
                                 },
                                 {
+                                    xtype: 'Button',
+                                    xns: Roo,
                                     text : "Edit",
-                                    xtype : 'Button',
                                     cls : 'x-btn-text-icon',
-                                    icon: Roo.rootURL + 'images/default/tree/leaf.gif',
+                                    icon : Roo.rootURL + 'images/default/tree/leaf.gif',
                                     listeners : {
-                                        click: function()
+                                        click : function()
                                                 {
                                                     var s = _this.grid.getSelectionModel().getSelections();
                                                     if (!s.length || (s.length > 1))  {
@@ -249,31 +286,52 @@ Pman.Dialog.CmsCategory = {
                                                        }); 
                                                     
                                                 }
-                                                
                                     }
                                 },
                                 {
+                                    xtype: 'Button',
+                                    xns: Roo,
                                     text : "Delete",
                                     cls : 'x-btn-text-icon',
-                                    icon: rootURL + '/Pman/templates/images/trash.gif',
-                                    xtype : 'Button',
+                                    icon : rootURL + '/Pman/templates/images/trash.gif',
                                     listeners : {
-                                        click: function()
+                                        click : function()
                                                 {
                                                 Pman.genericDelete(_this, _this.panel.tableName); 
                                                 }
-                                                
                                     }
                                 }
                             ]
-                        }
+                        },
+                        colModel : [
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'id',
+                                header : '',
+                                width : 110,
+                                renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}">', baseURL, v, r.data.filename); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                header : 'Filename',
+                                width : 100,
+                                dataIndex : 'filename',
+                                renderer : function(v,x,r) { return String.format('{0}<br/><i qtip="{1}">{1}</i>', v, r.data.linkurl); }
+                            }
+                        ]
                     }
                 }
             ],
             center : {
+                xtype: 'LayoutRegion',
+                xns: Roo,
                 titlebar : false
             },
             east : {
+                xtype: 'LayoutRegion',
+                xns: Roo,
                 titlebar : false,
                 split : 'true',
                 fitToFrame : 'true',
@@ -281,72 +339,34 @@ Pman.Dialog.CmsCategory = {
             },
             buttons : [
                 {
-                    text : "Cancel",
-                    xtype : 'Button',
+                    xtype: 'Button',
                     xns: Roo,
+                    text : "Cancel",
                     listeners : {
-                        click function() {
+                        click : function() {
                         
                                                             _this.form.reset();
                         
                                                             _this.dialog.hide();
                         
                                                         }
-                        
                     }
                 },
                 {
-                    text : "OK",
-                    xtype : 'Button',
+                    xtype: 'Button',
                     xns: Roo,
+                    text : "OK",
                     listeners : {
-                        click function() {
+                        click : function() {
                         
                                                             _this.dialog.el.mask("Saving");
                         
                                                             _this.form.doAction("submit");
                         
                                                         }
-                        
                     }
                 }
             ]
         });
     }
 };
-/*
---SOURCE--
-QlpoNDFBWSZTWWkvz3kACmz/gEzOgARw//5fv+/fjr/v//5gCH19djibM7q2SlACWjpQAKhiiZAink/U
-1NM0o9oU/VNNPRqNkjQGyj1G0mnpA9Rp6g01BNAanqaI0AZHqGjQ0aAANAAAGg4yZNGgNGmIyNDEMCaN
-MQYjQYQAGCTUVCelNlNBoGJoNDEAABoADQyGg0OMmTRoDRpiMjQxDAmjTEGI0GEABgkSBAICGU9TITwU
-8pND1NGnplHqAG0mR4KDiASSfQgThZJQKCwXj/iaYdHYofgaAMG/QD+o+Rdd9uwdnc7ZIGdz/sK4d6EH
-SwFrPzjeheUjk08jgjBhd8/lEjnHhcRdpF7/2ypfHPruJFvL4tBi0YOG9cGWMbeEooicWwkQ2FAt0z0/
-twdwQYHvDGybl2vkEkBaYY8FT4lLdP7TxDAqaaE2i3FVYdBTqHm2RE1sT+1lFCmRcXYBA6RPLf56nkPk
-X3Iw6s4kk3xahukZjQSihKZvWBWzoqucKcDTbzuKO6MFBWc6MJG60SpEr54LVkRKAmySFJWeBKJGMZUv
-nSoCz6kYAsCLESaxGRBYqM1mhghGDGBBZKFagigottwsoEREgy7JZFRUFChoBIsDVMHk9ksevwNqe3vZ
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