Uncommited changes synced
[Pman.Cms] / Pman.Tab.CmsAggregate.js
index 7f8f97f..8f590ca 100644 (file)
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
 
+Pman.Tab.CmsAggregate = new Roo.XComponent({
 
-// register the module first
-Pman.on('beforeload', function()
-{
-    Pman.register({
-        part :  ["Cms","Aggregate"],
-        modKey : '850-Pman.Tab.CmsAggregate',
-        module : Pman.Tab.CmsAggregate,
-        region : 'center',
-        parent : Pman.Tab.Cms,
-        name : "Pman.Tab.CmsAggregate",
-        disabled : false, 
-        permname: '' 
-    });
-});
-
-Pman.Tab.CmsAggregate = new Roo.util.Observable({
-
-    panel : false,
-    disabled : false,
-    parentLayout:  false,
+ _strings : {
+  '3b82002c77bd3f33f81e7be33deceb80' :"RSS Feed Aggregator",
+  '116af9a686a753275179db02cbb68f62' :"Displaying cms_rssaggr{0} - {1} of {2}",
+  'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
+  '7dce122004969d56ae2e0245cb754d35' :"Edit",
+  '9b9d8a976b42e0bd66381797644943d5' :"Published",
+  '4c57e321aef3fb4261f9930dc39d9fb1' :"Update from Feed",
+  '86754577897acfb25deb69039d49d9a7' :"Displayed",
+  'b6f4933fc36f3dd21c402b0ab1e4e0c7' :"No cms_rssaggr found",
+  'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
+  'c6568e77f61109390e82d035aaacaef0' :"Headline"
+ },
 
-    add : function(parentLayout, region)
-    {
-
-        var _this = this;
-        this.parentLayout = parentLayout;
-
-        this.panel = parentLayout.addxtype({
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            title : "RSS Feed Aggregator",
-            layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                },
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
+  part     :  ["Cms", "Aggregate" ],
+  order    : '850-Pman.Tab.CmsAggregate',
+  region   : 'center',
+  parent   : 'Pman.Tab.Cms',
+  name     : "Pman.Tab.CmsAggregate",
+  disabled : false, 
+  permname : '', 
+  _tree : function()
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   region : 'center',
+   title : _this._strings['3b82002c77bd3f33f81e7be33deceb80'] /* RSS Feed Aggregator */,
+   xns : Roo,
+   '|xns' : 'Roo',
+   xtype : 'NestedLayoutPanel',
+   layout : {
+    xns : Roo,
+    '|xns' : 'Roo',
+    xtype : 'BorderLayout',
+    center : {
+     xns : Roo,
+     '|xns' : 'Roo',
+     xtype : 'LayoutRegion'
+    },
+    south : {
+     height : 150,
+     xns : Roo,
+     '|xns' : 'Roo',
+     xtype : 'LayoutRegion'
+    },
+    items  : [
+     {
+      background : true,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'cms_rssaggr',
+      title : _this._strings['3b82002c77bd3f33f81e7be33deceb80'] /* RSS Feed Aggregator */,
+      xns : Roo,
+      '|xns' : 'Roo',
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.panel = this;
+            if (_this.grid) {
+                _this.grid.footer.onClick('first');
+            }
+        }
+      },
+      grid : {
+       autoExpandColumn : 'headline',
+       loadMask : true,
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       xtype : 'Grid',
+       listeners : {
+        cellclick : function (_self, rowIndex, colIndex, e)
+         {
+         
+             if (colIndex != 0) {
+                 return;
+             }
+             var d = this.ds.getAt(rowIndex);
+             var s =    d.data.is_displayed ? 0 : 1;
+             d.set('is_displayed', s);
+             new Pman.Request({
+                 url : baseURL + '/Roo/cms_rssaggr',
+                 method : 'POST',
+                 params : {
+                     id : d.data.id,
+                     is_displayed : s
+                 },
+                 success : function( ) {
+                 
+                 } 
+                 // should error on failure.
+             });
+              
+         
+         },
+        render : function() 
+         {
+             _this.grid = this; 
+             //_this.dialog = Pman.Dialog.FILL_IN
+             if (_this.panel.active) {
+                this.footer.onClick('first');
+             }
+         },
+        rowclick : function (_self, rowIndex, e)
+         {
+             _this.cpanel.setContent(
+             
+                 String.format('<div style="margin:10px">{0}</div>',
+                 _this.grid.ds.getAt(rowIndex).data.body)
+             );
+         }
+       },
+       footer : {
+        displayInfo : true,
+        displayMsg : _this._strings['116af9a686a753275179db02cbb68f62'] /* Displaying cms_rssaggr{0} - {1} of {2} */,
+        emptyMsg : _this._strings['b6f4933fc36f3dd21c402b0ab1e4e0c7'] /* No cms_rssaggr found */,
+        pageSize : 25,
+        xns : Roo,
+        '|xns' : 'Roo',
+        xtype : 'PagingToolbar'
+       },
+       toolbar : {
+        xns : Roo,
+        '|xns' : 'Roo',
+        xtype : 'Toolbar',
+        items  : [
+         {
+          text : _this._strings['4c57e321aef3fb4261f9930dc39d9fb1'] /* Update from Feed */,
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Button',
+          listeners : {
+           click : function (_self, e)
+            {
+                Roo.MessageBox.alert("Downloading", 
+                    "Updating feed, wait till this message disapears, or press OK to let it carry on in the background"
+                );
+                
+                
+                new Pman.Request({
+                    url : baseURL + '/Roo/cms_rssaggr',
+                    method : 'GET',
+                    params : {
+                        _pullfeed : 1
+                    },
+                    success : function() {
+                        Roo.MessageBox.hide();
+                        _this.grid.footer.onClick('first');
+                    }
+                });
+            }
+          }
+         },
+         {
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Fill'
+         },
+         {
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Button',
+          listeners : {
+           click : function()
+            {
+                if (!_this.dialog) {
+                    return;
                 }
+                _this.dialog.show( { id : 0 } , function() {
+                    _this.grid.footer.onClick('first');
+               }); 
             }
-        });
-        this.layout = this.panel.layout;
-
-    }
+          }
+         },
+         {
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+          text : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Button',
+          listeners : {
+           click : function()
+            {
+                var s = _this.grid.getSelectionModel().getSelections();
+                if (!s.length || (s.length > 1))  {
+                    Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                    return;
+                }
+                if (!_this.dialog) {
+                    return;
+                }
+                
+                _this.dialog.show(s[0].data, function() {
+                    _this.grid.footer.onClick('first');
+                }); 
+                
+            }
+          }
+         },
+         {
+          cls : 'x-btn-text-icon',
+          icon : rootURL + '/Pman/templates/images/trash.gif',
+          text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Button',
+          listeners : {
+           click : function()
+            {
+                 Pman.genericDelete(_this, 'cms_rssaggr'); 
+            }
+          }
+         }
+        ]
+       },
+       dataSource : {
+        remoteSort : true,
+        sortInfo : { field : 'published_dt', direction: 'DESC' },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        xtype : 'Store',
+        proxy : {
+         method : 'GET',
+         url : baseURL + '/Roo/cms_rssaggr.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data',
+         xtype : 'HttpProxy'
+        },
+        reader : {
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'extid',
+                 'type': 'string'
+             },
+             {
+                 'name': 'published_dt',
+                 'type': 'date',
+                 'dateFormat': 'Y-m-d'
+             },
+             {
+                 'name': 'headline',
+                 'type': 'string'
+             },
+             {
+                 'name': 'body',
+                 'type': 'string'
+             },
+             {
+                 'name': 'src_id',
+                 'type': 'int'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data',
+         xtype : 'JsonReader'
+        }
+       },
+       colModel : [
+        {
+         dataIndex : 'is_displayed',
+         header : _this._strings['86754577897acfb25deb69039d49d9a7'] /* Displayed */,
+         renderer : function(v) {  
+             var state = v> 0 ?  '-checked' : '';
+         
+             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                         
+          },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'published_dt',
+         header : _this._strings['9b9d8a976b42e0bd66381797644943d5'] /* Published */,
+         renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'headline',
+         header : _this._strings['c6568e77f61109390e82d035aaacaef0'] /* Headline */,
+         renderer : function(v) { return String.format('{0}', v); },
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        }
+       ]
+      }
+     },
+     {
+      region : 'south',
+      xns : Roo,
+      '|xns' : 'Roo',
+      xtype : 'ContentPanel',
+      listeners : {
+       render : function (_self)
+        {
+            _this.cpanel = _self;
+        }
+      }
+     }
+    ]
+   }
+  };  }
 });