sync
authorAlan Knowles <alan@akbkhome.com>
Fri, 25 Feb 2011 07:40:33 +0000 (15:40 +0800)
committerAlan Knowles <alan@akbkhome.com>
Fri, 25 Feb 2011 07:40:33 +0000 (15:40 +0800)
old/Pman.Tab.AdminPermManager.bjs [new file with mode: 0644]
old/Pman.Tab.AdminPermManager.js [new file with mode: 0644]
old/Pman.Tab.AdminPermMembers.bjs [new file with mode: 0644]
old/Pman.Tab.AdminPermMembers.js [new file with mode: 0644]
old/Pman.Tab.AdminPermProjects.bjs [new file with mode: 0644]
old/Pman.Tab.AdminPermProjects.js [new file with mode: 0644]
old/Pman.Tab.AdminProjects.js [new file with mode: 0644]
old/Pman.Tab.Contacts.js [new file with mode: 0644]
old/Pman.Tab.ContactsMgr.js [new file with mode: 0644]
old/Pman.Tab.ProjectMgr.js [new file with mode: 0644]

diff --git a/old/Pman.Tab.AdminPermManager.bjs b/old/Pman.Tab.AdminPermManager.bjs
new file mode 100644 (file)
index 0000000..756b1de
--- /dev/null
@@ -0,0 +1,189 @@
+{
+    "id": "roo-file-10",
+    "name": "Pman.Tab.AdminPermManager",
+    "parent": "Pman.Tab.Admin",
+    "title": "Pman.Tab.AdminPermManager",
+    "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminPermManager.bjs",
+    "items": [
+        {
+            "background": true,
+            "region": "center",
+            "title": "Permission Manager",
+            "xtype": "NestedLayoutPanel",
+            "|xns": "Roo",
+            "items": [
+                {
+                    "|xns": "Roo",
+                    "xtype": "BorderLayout",
+                    "*prop": "layout",
+                    "items": [
+                        {
+                            "*prop": "center",
+                            "tabPosition": "top",
+                            "xtype": "LayoutRegion",
+                            "|xns": "Roo"
+                        },
+                        {
+                            "*prop": "west",
+                            "width": 200,
+                            "xtype": "LayoutRegion",
+                            "|xns": "Roo"
+                        },
+                        {
+                            "listeners": {
+                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n}"
+                            },
+                            "background": true,
+                            "fitContainer": true,
+                            "fitToframe": true,
+                            "region": "west",
+                            "tableName": "Groups",
+                            "title": "Groups",
+                            "xtype": "GridPanel",
+                            "|xns": "Roo",
+                            "items": [
+                                {
+                                    "listeners": {
+                                        "|render": "function() \n{\n    _this.grid = this; \n    _this.dialog = Pman.Dialog.Groups;\n    if (_this.panel.active) {\n        _this.grid.ds.load({});\n    }\n}",
+                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    var s = this.getDataSource().getAt(rowIndex);\n    if (s.data.id < 1 ) {\n        return;\n    }\n    _this.dialog.show( s.data, function() {\n        _this.ds.load({});\n    }); \n}\n"
+                                    },
+                                    "*prop": "grid",
+                                    "autoExpandColumn": "name",
+                                    "ddGroup": "groupDD",
+                                    "enableDrop": true,
+                                    "loadMask": true,
+                                    "xtype": "Grid",
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "listeners": {
+                                                "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.type =0;\n}",
+                                                "load": "function (_self, records, options)\n{\n    var sm = _this.grid.getSelectionModel();\n    if (!sm.getSelections().length) {\n        sm.selectFirstRow();\n    }\n    // should refresh righthand side grid..\n     //   Pman.Tab.AdminContacts.grid.footer.onClick('first');\n}"
+                                            },
+                                            "*prop": "dataSource",
+                                            "remoteSort": true,
+                                            "xtype": "Store",
+                                            "|sortInfo": "{ field : 'name', direction: 'ASC' }",
+                                            "|xns": "Roo.data",
+                                            "items": [
+                                                {
+                                                    "*prop": "proxy",
+                                                    "xtype": "HttpProxy",
+                                                    "method": "GET",
+                                                    "|url": "baseURL + '/Roo/Groups.php'",
+                                                    "|xns": "Roo.data"
+                                                },
+                                                {
+                                                    "|xns": "Roo.data",
+                                                    "xtype": "JsonReader",
+                                                    "totalProperty": "total",
+                                                    "root": "data",
+                                                    "*prop": "reader",
+                                                    "id": "id",
+                                                    "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'type',\n        'type': 'int'\n    },\n    {\n        'name': 'leader',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_name',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_email',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_role',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_active',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'leader_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'leader_project_id',\n        'type': 'int'\n    }\n]"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "*prop": "toolbar",
+                                            "xtype": "Toolbar",
+                                            "|xns": "Roo",
+                                            "items": [
+                                                {
+                                                    "text": "Manage Groups",
+                                                    "xtype": "Button",
+                                                    "|xns": "Roo.Toolbar",
+                                                    "items": [
+                                                        {
+                                                            "|xns": "Roo.menu",
+                                                            "xtype": "Menu",
+                                                            "*prop": "menu",
+                                                            "items": [
+                                                                {
+                                                                    "listeners": {
+                                                                        "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0,  type: 0 } , function() {\n         _this.grid.ds.load({});\n   }); \n}\n"
+                                                                    },
+                                                                    "cls": "x-btn-text-icon",
+                                                                    "text": "Add",
+                                                                    "xtype": "Item",
+                                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                                                    "|xns": "Roo.menu"
+                                                                },
+                                                                {
+                                                                    "listeners": {
+                                                                        "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (s[0].data.id < 1 ) {\n        return;\n    }\n    if (!_this.dialog) return;\n    _this.dialog.show(s[0].data, function() {\n         _this.grid.ds.load({});\n    }); \n    \n}\n"
+                                                                    },
+                                                                    "cls": "x-btn-text-icon",
+                                                                    "text": "Edit",
+                                                                    "xtype": "Item",
+                                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                                                    "|xns": "Roo.menu"
+                                                                },
+                                                                {
+                                                                    "listeners": {
+                                                                        "|click": "function()\n{\n     Pman.genericDelete(_this, 'Groups'); \n}\n        "
+                                                                    },
+                                                                    "cls": "x-btn-text-icon",
+                                                                    "text": "Delete",
+                                                                    "xtype": "Item",
+                                                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                                                    "|xns": "Roo.menu"
+                                                                },
+                                                                {
+                                                                    "|xns": "Roo.menu",
+                                                                    "xtype": "Separator"
+                                                                },
+                                                                {
+                                                                    "listeners": {
+                                                                        "click": "function (_self, e)\n{\n  _this.grid.ds.load({});\n}"
+                                                                    },
+                                                                    "text": "Reload",
+                                                                    "xtype": "Item",
+                                                                    "|xns": "Roo.menu"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "*prop": "colModel[]",
+                                            "dataIndex": "name",
+                                            "header": "Name",
+                                            "width": 200,
+                                            "xtype": "ColumnModel",
+                                            "|renderer": "function(v,x,r) { \n    if (r.data.id == -1) {\n        return '<b>' + \"Not in a Group\" + '</b>';\n    }\n    if ((r.data.id == 0) && (_this.type == 0)) {\n        return '<b>' + \"All Staff (Default Permissions)\" + '</b>';\n    }\n    if ((r.data.id == 0) && (_this.type == 2)) {\n        return '<b>' + \"Everybody\" + '</b>';\n    }\n    if (r.data.id == 0) {\n        return '<b>' + \"All Staff\" + '</b>';\n    }\n    if (v == 'Administrators') {\n        return '<b>' + \"Adminstrators\" + '</b>';\n    }\n    if (r.data.leader) {\n        return v + ' (' + r.data.leader_name + ')';\n    }\n    \n    return v;\n}",
+                                            "|xns": "Roo.grid"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "afterselectionchange": "function (_self)\n{\n    Pman.Tab.AdminPermMembers.grid.footer.onClick('first');\n}"
+                                            },
+                                            "*prop": "sm",
+                                            "singleSelect": true,
+                                            "xtype": "RowSelectionModel",
+                                            "|xns": "Roo.grid"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "drop": "function (source, e, data)\n{\n    // Roo.log(\"DROP\");\n    var t = Roo.lib.Event.getTarget(e); \n    var ri = _this.grid.view.findRowIndex(t);\n    var rid  = false;\n    if (ri !== false) {\n        rid = _this.grid.getDataSource().getAt(ri).data;\n    }\n    var s = _this.grid.getSelectionModel().getSelections();\n      \n    //console.log(data);\n    var isFromGroup = s.length ? s[0].data.id > 0 : false;\n\n    var isToGroup = rid && rid.id > 0;\n    this.success = false;\n    if (isFromGroup && isToGroup) {\n        return;\n    }\n    if (!isFromGroup && !isToGroup) {\n        return;\n    }\n    var action = 'add';\n    if (isFromGroup && !isToGroup) {\n        action = 'sub';\n        //return 'x-dd-drop-ok-sub'; \n    }\n    // build a list of selections.\n    var sels = [];\n    for (var i=0; i < data.selections.length; i++) {\n        sels.push(data.selections[i].data.id);\n    }\n\n    Pman.request({\n        url: baseURL + '/Core/GroupMembers.php',\n        params: {\n            action : action,\n            group_id: action =='add' ? rid.id : s[0].data.id,\n            type: _this.type,\n            user_ids : sels.join(',')\n            \n        },  \n        method: 'POST',  \n        success : function(data) {\n            //refreshPager();\n            // \n            // do we need to do anything??\n            if (isFromGroup) {\n                Pman.Tab.AdminPermMembers.grid.footer.onClick('refresh');\n            }\n        }, \n        \n        failure: function() {\n            //Ext.get(document.body).unmask();\n            //if (cb) {\n            //    cb.call(false);\n            //}\n             \n        }\n    });\n\n    this.success = true;\n\n    //if (!isFromGroup && isToGroup) {\n        //return 'x-dd-drop-ok-add'; \n    return;\n    //}\n}",
+                                                "over": "function (source, e, data)\n{\n    // Roo.log(\"dragover\");\n     \n    //Roo.log(e);\n    var t = Roo.lib.Event.getTarget(e); \n       //  Roo.log(t);\n    var ri = _this.grid.view.findRowIndex(t);\n      //            Roo.log(ri);\n    \n    var rid  = false;\n    if (ri !== false) {\n        rid = _this.grid.getDataSource().getAt(ri).data;\n    }\n    \n    var s = _this.grid.getSelectionModel().getSelections();\n    \n    var isFromGroup = s.length ? s[0].data.id > 0 : false;\n    \n    var isToGroup = rid && rid.id > 0;\n    \n//    Roo.log(\"isToGroup:\"  + isToGroup + \", isFromGroup\" + isFromGroup);\n     \n    if (isFromGroup && isToGroup) {\n        this.valid = false;\n//        Roo.log('not valid');\n        return;\n    }\n    if (!isFromGroup && !isToGroup) {\n        this.valid = false;\n//        Roo.log('not valid');\n        return  \n    }\n    if (isFromGroup && !isToGroup) {\n        this.valid = 'ok-sub'; \n        return;\n    } \n    //if (!isFromGroup && isToGroup) {\n    this.valid = 'ok-add';\n//    Roo.log('add'); \n    //}\n}"
+                                            },
+                                            "*prop": "dropTarget",
+                                            "ddGroup": "groupDD",
+                                            "xtype": "DropTarget",
+                                            "|xns": "Roo.dd"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "permname": "Core.Groups",
+    "modOrder": "700"
+}
\ No newline at end of file
diff --git a/old/Pman.Tab.AdminPermManager.js b/old/Pman.Tab.AdminPermManager.js
new file mode 100644 (file)
index 0000000..85e9bdc
--- /dev/null
@@ -0,0 +1,468 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+
+
+// register the module first
+Pman.on('beforeload', function()
+{
+    Pman.register({
+        modKey : '700-Pman.Tab.AdminPermManager',
+        module : Pman.Tab.AdminPermManager,
+        region : 'center',
+        parent : Pman.Tab.Admin,
+        name : "Pman.Tab.AdminPermManager",
+        disabled : false, 
+        permname: 'Core.Groups' 
+    });
+});
+
+Pman.Tab.AdminPermManager = new Roo.util.Observable({
+
+    panel : false,
+    disabled : false,
+    parentLayout:  false,
+
+    add : function(parentLayout, region)
+    {
+
+        var _this = this;
+        this.parentLayout = parentLayout;
+
+        this.panel = parentLayout.addxtype({
+            xtype: 'NestedLayoutPanel',
+            xns: Roo,
+            background : true,
+            region : 'center',
+            title : "Permission Manager",
+            layout : {
+                xtype: 'BorderLayout',
+                xns: Roo,
+                items : [
+                    {
+                        xtype: 'GridPanel',
+                        xns: Roo,
+                        listeners : {
+                            activate : function() {
+                                _this.panel = this;
+                                if (_this.grid) {
+                                    _this.grid.ds.load({});
+                                }
+                            }
+                        },
+                        background : true,
+                        fitContainer : true,
+                        fitToframe : true,
+                        region : 'west',
+                        tableName : 'Groups',
+                        title : "Groups",
+                        grid : {
+                            xtype: 'Grid',
+                            xns: Roo.grid,
+                            listeners : {
+                                render : function() 
+                                {
+                                    _this.grid = this; 
+                                    _this.dialog = Pman.Dialog.Groups;
+                                    if (_this.panel.active) {
+                                        _this.grid.ds.load({});
+                                    }
+                                },
+                                rowdblclick : function (_self, rowIndex, e)
+                                {
+                                    if (!_this.dialog) return;
+                                    var s = this.getDataSource().getAt(rowIndex);
+                                    if (s.data.id < 1 ) {
+                                        return;
+                                    }
+                                    _this.dialog.show( s.data, function() {
+                                        _this.ds.load({});
+                                    }); 
+                                }
+                            },
+                            autoExpandColumn : 'name',
+                            ddGroup : 'groupDD',
+                            enableDrop : true,
+                            loadMask : true,
+                            dataSource : {
+                                xtype: 'Store',
+                                xns: Roo.data,
+                                listeners : {
+                                    beforeload : function (_self, o)
+                                    {
+                                        o.params = o.params || {};
+                                        o.params.type =0;
+                                    },
+                                    load : function (_self, records, options)
+                                    {
+                                        var sm = _this.grid.getSelectionModel();
+                                        if (!sm.getSelections().length) {
+                                            sm.selectFirstRow();
+                                        }
+                                        // should refresh righthand side grid..
+                                         //   Pman.Tab.AdminContacts.grid.footer.onClick('first');
+                                    }
+                                },
+                                remoteSort : true,
+                                sortInfo : { field : 'name', direction: 'ASC' },
+                                proxy : {
+                                    xtype: 'HttpProxy',
+                                    xns: Roo.data,
+                                    method : 'GET',
+                                    url : baseURL + '/Roo/Groups.php'
+                                },
+                                reader : {
+                                    xtype: 'JsonReader',
+                                    xns: Roo.data,
+                                    totalProperty : 'total',
+                                    root : 'data',
+                                    id : 'id',
+                                    fields : [
+                                        {
+                                            'name': 'id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'type',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader_office_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader_name',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_phone',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_fax',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_email',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_company_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader_role',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_active',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader_remarks',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_passwd',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_owner_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader_lang',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_no_reset_sent',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'leader_action_type',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'leader_project_id',
+                                            'type': 'int'
+                                        }
+                                    ]
+                                }
+                            },
+                            toolbar : {
+                                xtype: 'Toolbar',
+                                xns: Roo,
+                                items : [
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        text : "Manage Groups",
+                                        menu : {
+                                            xtype: 'Menu',
+                                            xns: Roo.menu,
+                                            items : [
+                                                {
+                                                    xtype: 'Item',
+                                                    xns: Roo.menu,
+                                                    listeners : {
+                                                        click : function()
+                                                        {
+                                                            if (!_this.dialog) return;
+                                                            _this.dialog.show( { id : 0,  type: 0 } , function() {
+                                                                 _this.grid.ds.load({});
+                                                           }); 
+                                                        }
+                                                    },
+                                                    cls : 'x-btn-text-icon',
+                                                    text : "Add",
+                                                    icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                                                },
+                                                {
+                                                    xtype: 'Item',
+                                                    xns: Roo.menu,
+                                                    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 (s[0].data.id < 1 ) {
+                                                                return;
+                                                            }
+                                                            if (!_this.dialog) return;
+                                                            _this.dialog.show(s[0].data, function() {
+                                                                 _this.grid.ds.load({});
+                                                            }); 
+                                                            
+                                                        }
+                                                    },
+                                                    cls : 'x-btn-text-icon',
+                                                    text : "Edit",
+                                                    icon : Roo.rootURL + 'images/default/tree/leaf.gif'
+                                                },
+                                                {
+                                                    xtype: 'Item',
+                                                    xns: Roo.menu,
+                                                    listeners : {
+                                                        click : function()
+                                                        {
+                                                             Pman.genericDelete(_this, 'Groups'); 
+                                                        }
+                                                    },
+                                                    cls : 'x-btn-text-icon',
+                                                    text : "Delete",
+                                                    icon : rootURL + '/Pman/templates/images/trash.gif'
+                                                },
+                                                {
+                                                    xtype: 'Separator',
+                                                    xns: Roo.menu
+                                                },
+                                                {
+                                                    xtype: 'Item',
+                                                    xns: Roo.menu,
+                                                    listeners : {
+                                                        click : function (_self, e)
+                                                        {
+                                                          _this.grid.ds.load({});
+                                                        }
+                                                    },
+                                                    text : "Reload"
+                                                }
+                                            ]
+                                        }
+                                    }
+                                ]
+                            },
+                            colModel : [
+                                {
+                                    xtype: 'ColumnModel',
+                                    xns: Roo.grid,
+                                    dataIndex : 'name',
+                                    header : 'Name',
+                                    width : 200,
+                                    renderer : function(v,x,r) { 
+                                        if (r.data.id == -1) {
+                                            return '<b>' + "Not in a Group" + '</b>';
+                                        }
+                                        if ((r.data.id == 0) && (_this.type == 0)) {
+                                            return '<b>' + "All Staff (Default Permissions)" + '</b>';
+                                        }
+                                        if ((r.data.id == 0) && (_this.type == 2)) {
+                                            return '<b>' + "Everybody" + '</b>';
+                                        }
+                                        if (r.data.id == 0) {
+                                            return '<b>' + "All Staff" + '</b>';
+                                        }
+                                        if (v == 'Administrators') {
+                                            return '<b>' + "Adminstrators" + '</b>';
+                                        }
+                                        if (r.data.leader) {
+                                            return v + ' (' + r.data.leader_name + ')';
+                                        }
+                                        
+                                        return v;
+                                    }
+                                }
+                            ],
+                            sm : {
+                                xtype: 'RowSelectionModel',
+                                xns: Roo.grid,
+                                listeners : {
+                                    afterselectionchange : function (_self)
+                                    {
+                                        Pman.Tab.AdminPermMembers.grid.footer.onClick('first');
+                                    }
+                                },
+                                singleSelect : true
+                            },
+                            dropTarget : {
+                                xtype: 'DropTarget',
+                                xns: Roo.dd,
+                                listeners : {
+                                    drop : function (source, e, data)
+                                    {
+                                        // Roo.log("DROP");
+                                        var t = Roo.lib.Event.getTarget(e); 
+                                        var ri = _this.grid.view.findRowIndex(t);
+                                        var rid  = false;
+                                        if (ri !== false) {
+                                            rid = _this.grid.getDataSource().getAt(ri).data;
+                                        }
+                                        var s = _this.grid.getSelectionModel().getSelections();
+                                          
+                                        //console.log(data);
+                                        var isFromGroup = s.length ? s[0].data.id > 0 : false;
+                                    
+                                        var isToGroup = rid && rid.id > 0;
+                                        this.success = false;
+                                        if (isFromGroup && isToGroup) {
+                                            return;
+                                        }
+                                        if (!isFromGroup && !isToGroup) {
+                                            return;
+                                        }
+                                        var action = 'add';
+                                        if (isFromGroup && !isToGroup) {
+                                            action = 'sub';
+                                            //return 'x-dd-drop-ok-sub'; 
+                                        }
+                                        // build a list of selections.
+                                        var sels = [];
+                                        for (var i=0; i < data.selections.length; i++) {
+                                            sels.push(data.selections[i].data.id);
+                                        }
+                                    
+                                        Pman.request({
+                                            url: baseURL + '/Core/GroupMembers.php',
+                                            params: {
+                                                action : action,
+                                                group_id: action =='add' ? rid.id : s[0].data.id,
+                                                type: _this.type,
+                                                user_ids : sels.join(',')
+                                                
+                                            },  
+                                            method: 'POST',  
+                                            success : function(data) {
+                                                //refreshPager();
+                                                // 
+                                                // do we need to do anything??
+                                                if (isFromGroup) {
+                                                    Pman.Tab.AdminPermMembers.grid.footer.onClick('refresh');
+                                                }
+                                            }, 
+                                            
+                                            failure: function() {
+                                                //Ext.get(document.body).unmask();
+                                                //if (cb) {
+                                                //    cb.call(false);
+                                                //}
+                                                 
+                                            }
+                                        });
+                                    
+                                        this.success = true;
+                                    
+                                        //if (!isFromGroup && isToGroup) {
+                                            //return 'x-dd-drop-ok-add'; 
+                                        return;
+                                        //}
+                                    },
+                                    over : function (source, e, data)
+                                    {
+                                        // Roo.log("dragover");
+                                         
+                                        //Roo.log(e);
+                                        var t = Roo.lib.Event.getTarget(e); 
+                                           //  Roo.log(t);
+                                        var ri = _this.grid.view.findRowIndex(t);
+                                          //            Roo.log(ri);
+                                        
+                                        var rid  = false;
+                                        if (ri !== false) {
+                                            rid = _this.grid.getDataSource().getAt(ri).data;
+                                        }
+                                        
+                                        var s = _this.grid.getSelectionModel().getSelections();
+                                        
+                                        var isFromGroup = s.length ? s[0].data.id > 0 : false;
+                                        
+                                        var isToGroup = rid && rid.id > 0;
+                                        
+                                    //    Roo.log("isToGroup:"  + isToGroup + ", isFromGroup" + isFromGroup);
+                                         
+                                        if (isFromGroup && isToGroup) {
+                                            this.valid = false;
+                                    //        Roo.log('not valid');
+                                            return;
+                                        }
+                                        if (!isFromGroup && !isToGroup) {
+                                            this.valid = false;
+                                    //        Roo.log('not valid');
+                                            return  
+                                        }
+                                        if (isFromGroup && !isToGroup) {
+                                            this.valid = 'ok-sub'; 
+                                            return;
+                                        } 
+                                        //if (!isFromGroup && isToGroup) {
+                                        this.valid = 'ok-add';
+                                    //    Roo.log('add'); 
+                                        //}
+                                    }
+                                },
+                                ddGroup : 'groupDD'
+                            }
+                        }
+                    }
+                ],
+                center : {
+                    xtype: 'LayoutRegion',
+                    xns: Roo,
+                    tabPosition : 'top'
+                },
+                west : {
+                    xtype: 'LayoutRegion',
+                    xns: Roo,
+                    width : 200
+                }
+            }
+        });
+        this.layout = this.panel.layout;
+
+    }
+});
diff --git a/old/Pman.Tab.AdminPermMembers.bjs b/old/Pman.Tab.AdminPermMembers.bjs
new file mode 100644 (file)
index 0000000..19e9c6d
--- /dev/null
@@ -0,0 +1,262 @@
+{
+    "id": "roo-file-11",
+    "name": "Pman.Tab.AdminPermMembers",
+    "parent": "Pman.Tab.AdminPermManager",
+    "title": "Pman.Tab.AdminPermMembers",
+    "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminPermMembers.bjs",
+    "items": [
+        {
+            "listeners": {
+                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+            },
+            "autoScroll": true,
+            "background": true,
+            "fitContainer": true,
+            "fitToframe": true,
+            "region": "center",
+            "tableName": "Person",
+            "title": "Person",
+            "xtype": "GridPanel",
+            "|xns": "Roo",
+            "items": [
+                {
+                    "listeners": {
+                        "|render": "function() \n{\n    _this.grid = this; \n    if (!_this.dialog) {\n        _this.dialog = Pman.Dialog.PersonEdit;\n        \n    }\n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
+                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
+                        "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n\n        var di = this.colModel.getDataIndex(columnIndex);\n        if (di != 'active') {\n            return;\n        }\n         \n        var rec = _this.grid.ds.getAt(rowIndex);\n        \n        rec.set('active', rec.data.active ? 0 : 1);\n        rec.commit();\n         \n        \n}"
+                    },
+                    "*prop": "grid",
+                    "autoExpandColumn": "name",
+                    "ddGroup": "groupDD",
+                    "enableDrag": true,
+                    "loadMask": true,
+                    "xtype": "Grid",
+                    "|xns": "Roo.grid",
+                    "items": [
+                        {
+                            "listeners": {
+                                "beforeload": "function (_self, o)\n{\n  \n   // technically we may allow non-owner's to be in the group..\n   // need to work out how that will work...\n   // \n   \n    //o.params['company_id_comptype'] = 'OWNER';\n    o.params['query[search]'] = _this.searchBox.getValue();\n    \n    if (!_this.activeButton) {return; false;}\n    \n    \n    o.params.active = _this.activeButton.pressed ? 0 : 1;\n    if (!Pman.Tab.AdminPermManager) { \n        return false;\n    }\n    \n    \n    if (Pman.Tab.AdminPermManager && Pman.Tab.AdminPermManager.grid) {\n        var tms = Pman.Tab.AdminPermManager.grid.getSelectionModel().getSelected();\n        \n        if (!tms) {\n            return false;\n        }\n        o.params['query[in_group]'] = tms.data.id;\n        o.params['query[type]'] = 0; // group type..\n        \n    }\n    //o.params['query[name]'] = _this.searchBox.getValue();\n  \n    \n}",
+                                "update": "function (_self, record, operation)\n{\n    if (operation != 'commit') {\n        return;\n    }\n    // only used to change active status.\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Person.php',\n        method :'POST',\n        params : {\n            id : record.data.id,\n            active: record.data.active\n            \n        },\n        success : function() {\n            // do nothing\n            \n            _this.grid.ds.remove(record);\n            \n        },\n        failure : function() \n        {\n            Roo.MessageBox.alert(\"Error\", \"saving failed\", function() {\n                _this.grid.footer.onClick('first');\n            });\n        }\n    });\n}"
+                            },
+                            "*prop": "dataSource",
+                            "remoteSort": true,
+                            "xtype": "Store",
+                            "|sortInfo": "{ field : 'name', direction: 'ASC' }",
+                            "|xns": "Roo.data",
+                            "items": [
+                                {
+                                    "*prop": "proxy",
+                                    "xtype": "HttpProxy",
+                                    "method": "GET",
+                                    "|url": "baseURL + '/Roo/Person.php'",
+                                    "|xns": "Roo.data"
+                                },
+                                {
+                                    "|xns": "Roo.data",
+                                    "xtype": "JsonReader",
+                                    "totalProperty": "total",
+                                    "root": "data",
+                                    "*prop": "reader",
+                                    "id": "id",
+                                    "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'phone',\n        'type': 'string'\n    },\n    {\n        'name': 'fax',\n        'type': 'string'\n    },\n    {\n        'name': 'email',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'role',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'lang',\n        'type': 'string'\n    },\n    {\n        'name': 'no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_tel',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_isOwner',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_logo_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_background_color',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_comptype',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_url',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_main_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_updated_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_type',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_client_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_team_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_file_location',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_open_date',\n        'type': 'date'\n    },\n    {\n        'name': 'project_id_open_by',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_close_date',\n        'type': 'date'\n    },\n    {\n        'name': 'project_id_countries',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_languages',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_agency_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_project_id',\n        'type': 'int'\n    }\n]"
+                                }
+                            ]
+                        },
+                        {
+                            "*prop": "footer",
+                            "xtype": "PagingToolbar",
+                            "pageSize": 25,
+                            "displayInfo": true,
+                            "displayMsg": "Displaying Person{0} - {1} of {2}",
+                            "emptyMsg": "No Person found",
+                            "|xns": "Roo",
+                            "items": [
+                                {
+                                    "text": "Drag person to add or remove from group",
+                                    "xtype": "TextItem",
+                                    "|xns": "Roo.Toolbar"
+                                }
+                            ]
+                        },
+                        {
+                            "*prop": "toolbar",
+                            "xtype": "Toolbar",
+                            "|xns": "Roo",
+                            "items": [
+                                {
+                                    "listeners": {
+                                        "|click": "function()\n{\n    \n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                    },
+                                    "cls": "x-btn-text-icon",
+                                    "text": "Add",
+                                    "xtype": "Button",
+                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                    "|xns": "Roo.Toolbar"
+                                },
+                                {
+                                    "listeners": {
+                                        "|click": "function()\n{\n    \n    Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                    },
+                                    "cls": "x-btn-text-icon",
+                                    "text": "Bulk Add",
+                                    "xtype": "Button",
+                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                    "|xns": "Roo.Toolbar"
+                                },
+                                {
+                                    "listeners": {
+                                        "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n  \n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
+                                    },
+                                    "cls": "x-btn-text-icon",
+                                    "text": "Edit",
+                                    "xtype": "Button",
+                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                    "|xns": "Roo.Toolbar"
+                                },
+                                {
+                                    "|xns": "Roo.Toolbar",
+                                    "xtype": "Separator"
+                                },
+                                {
+                                    "text": "Search",
+                                    "xtype": "TextItem",
+                                    "|xns": "Roo.Toolbar"
+                                },
+                                {
+                                    "listeners": {
+                                        "render": "function (_self)\n{\n    _this.searchBox = _self;\n}",
+                                        "show": "function (_self,e)\n{\n    if (e.getCharCode() != 13) {\n        return;\n    }\n    _this.grid.footer.onClick('first');\n}",
+                                        "specialkey": "function (_self, e)\n{\n  if (e.getKey() == 13) {\n    _this.grid.footer.onClick('first');\n  }\n}"
+                                    },
+                                    "xtype": "TextField",
+                                    "|xns": "Roo.form"
+                                },
+                                {
+                                    "listeners": {
+                                        "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
+                                    },
+                                    "cls": "x-btn-icon",
+                                    "xtype": "Button",
+                                    "|icon": "rootURL + '/Pman/templates/images/search.gif'",
+                                    "|xns": "Roo.Toolbar"
+                                },
+                                {
+                                    "listeners": {
+                                        "|click": "function (_self, e)\n{\n_this.searchBox.setValue('');\n    _this.grid.footer.onClick('first');\n}"
+                                    },
+                                    "cls": "x-btn-icon",
+                                    "xtype": "Button",
+                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                    "|xns": "Roo.Toolbar"
+                                },
+                                {
+                                    "|xns": "Roo.Toolbar",
+                                    "xtype": "Fill"
+                                },
+                                {
+                                    "listeners": {
+                                        "toggle": "function (_self, pressed)\n{\n   _this.grid.footer.onClick('first');\n   this.setText(pressed ? \"Show Active\" : \"Show Removed\");\n   \n   \n}",
+                                        "render": "function (_self)\n{\n  _this.activeButton = _self;\n}"
+                                    },
+                                    "enableToggle": true,
+                                    "text": "Show Removed",
+                                    "xtype": "Button",
+                                    "|xns": "Roo.Toolbar"
+                                }
+                            ]
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "project_id_code",
+                            "header": "Project",
+                            "hidden": true,
+                            "sortable": true,
+                            "width": 75,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v,x,r) { \n      return String.format('<span qtip=\"{0}\">{1}</span>', \n                    r.data.project_id_name,\n                    v);\n }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "company_id_comptype",
+                            "header": "Type",
+                            "sortable": true,
+                            "width": 50,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v,x,r) {\n    if (r.data.office_id) {\n        return String.format('{0} - {1}', v, r.data.office_id_name); \n    } \n    return String.format('{0}', v); \n}",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "company_id_name",
+                            "header": "Company",
+                            "sortable": true,
+                            "width": 150,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v,x,r) {\n    if (r.data.office_id) {\n        return String.format('{0} - {1}', v, r.data.office_id_name); \n    } \n    return String.format('{0}', v); \n}",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "name",
+                            "header": "Name",
+                            "sortable": true,
+                            "width": 200,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "role",
+                            "header": "Role",
+                            "width": 100,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "phone",
+                            "header": "Phone",
+                            "width": 100,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "fax",
+                            "header": "Fax",
+                            "width": 100,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "email",
+                            "header": "Email",
+                            "sortable": true,
+                            "width": 200,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) {\n   return (v.length && v.indexOf('@') > 0 ) ? \n                    String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "active",
+                            "header": "Active",
+                            "width": 75,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) {  \n    var state = v> 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
+                            "|xns": "Roo.grid"
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": "001"
+}
\ No newline at end of file
diff --git a/old/Pman.Tab.AdminPermMembers.js b/old/Pman.Tab.AdminPermMembers.js
new file mode 100644 (file)
index 0000000..51ba411
--- /dev/null
@@ -0,0 +1,745 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+
+
+// register the module first
+Pman.on('beforeload', function()
+{
+    Pman.register({
+        modKey : '001-Pman.Tab.AdminPermMembers',
+        module : Pman.Tab.AdminPermMembers,
+        region : 'center',
+        parent : Pman.Tab.AdminPermManager,
+        name : "Pman.Tab.AdminPermMembers",
+        disabled : false, 
+        permname: '' 
+    });
+});
+
+Pman.Tab.AdminPermMembers = new Roo.util.Observable({
+
+    panel : false,
+    disabled : false,
+    parentLayout:  false,
+
+    add : function(parentLayout, region)
+    {
+
+        var _this = this;
+        this.parentLayout = parentLayout;
+
+        this.panel = parentLayout.addxtype({
+            xtype: 'GridPanel',
+            xns: Roo,
+            listeners : {
+                activate : function() {
+                    _this.panel = this;
+                    if (_this.grid) {
+                        _this.grid.footer.onClick('first');
+                    }
+                }
+            },
+            autoScroll : true,
+            background : true,
+            fitContainer : true,
+            fitToframe : true,
+            region : 'center',
+            tableName : 'Person',
+            title : "Person",
+            grid : {
+                xtype: 'Grid',
+                xns: Roo.grid,
+                listeners : {
+                    render : function() 
+                    {
+                        _this.grid = this; 
+                        if (!_this.dialog) {
+                            _this.dialog = Pman.Dialog.PersonEdit;
+                            
+                        }
+                        //_this.dialog = Pman.Dialog.FILL_IN
+                        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');
+                        }); 
+                    },
+                    cellclick : function (_self, rowIndex, columnIndex, e)
+                    {
+                    
+                            var di = this.colModel.getDataIndex(columnIndex);
+                            if (di != 'active') {
+                                return;
+                            }
+                             
+                            var rec = _this.grid.ds.getAt(rowIndex);
+                            
+                            rec.set('active', rec.data.active ? 0 : 1);
+                            rec.commit();
+                             
+                            
+                    }
+                },
+                autoExpandColumn : 'name',
+                ddGroup : 'groupDD',
+                enableDrag : true,
+                loadMask : true,
+                dataSource : {
+                    xtype: 'Store',
+                    xns: Roo.data,
+                    listeners : {
+                        beforeload : function (_self, o)
+                        {
+                          
+                           // technically we may allow non-owner's to be in the group..
+                           // need to work out how that will work...
+                           // 
+                           
+                            //o.params['company_id_comptype'] = 'OWNER';
+                            o.params['query[search]'] = _this.searchBox.getValue();
+                            
+                            if (!_this.activeButton) {return; false;}
+                            
+                            
+                            o.params.active = _this.activeButton.pressed ? 0 : 1;
+                            if (!Pman.Tab.AdminPermManager) { 
+                                return false;
+                            }
+                            
+                            
+                            if (Pman.Tab.AdminPermManager && Pman.Tab.AdminPermManager.grid) {
+                                var tms = Pman.Tab.AdminPermManager.grid.getSelectionModel().getSelected();
+                                
+                                if (!tms) {
+                                    return false;
+                                }
+                                o.params['query[in_group]'] = tms.data.id;
+                                o.params['query[type]'] = 0; // group type..
+                                
+                            }
+                            //o.params['query[name]'] = _this.searchBox.getValue();
+                          
+                            
+                        },
+                        update : function (_self, record, operation)
+                        {
+                            if (operation != 'commit') {
+                                return;
+                            }
+                            // only used to change active status.
+                            
+                            new Pman.Request({
+                                url : baseURL + '/Roo/Person.php',
+                                method :'POST',
+                                params : {
+                                    id : record.data.id,
+                                    active: record.data.active
+                                    
+                                },
+                                success : function() {
+                                    // do nothing
+                                    
+                                    _this.grid.ds.remove(record);
+                                    
+                                },
+                                failure : function() 
+                                {
+                                    Roo.MessageBox.alert("Error", "saving failed", function() {
+                                        _this.grid.footer.onClick('first');
+                                    });
+                                }
+                            });
+                        }
+                    },
+                    remoteSort : true,
+                    sortInfo : { field : 'name', direction: 'ASC' },
+                    proxy : {
+                        xtype: 'HttpProxy',
+                        xns: Roo.data,
+                        method : 'GET',
+                        url : baseURL + '/Roo/Person.php'
+                    },
+                    reader : {
+                        xtype: 'JsonReader',
+                        xns: Roo.data,
+                        totalProperty : 'total',
+                        root : 'data',
+                        id : 'id',
+                        fields : [
+                            {
+                                'name': 'id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'office_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'phone',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'role',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'active',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'passwd',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'lang',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'no_reset_sent',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'action_type',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'office_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'office_id_company_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'office_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'office_id_address',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'office_id_phone',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'office_id_fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'office_id_email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'office_id_role',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_code',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'company_id_address',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_tel',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'company_id_isOwner',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'company_id_logo_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'company_id_background_color',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_comptype',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_url',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'company_id_main_office_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'company_id_created_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'company_id_created_dt',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'company_id_updated_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'company_id_updated_dt',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'company_id_passwd',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'project_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'project_id_code',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_active',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'project_id_type',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_client_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'project_id_team_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'project_id_file_location',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_open_date',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'project_id_open_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'project_id_close_date',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'project_id_countries',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_languages',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'project_id_agency_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_office_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_phone',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_company_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_role',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_active',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_passwd',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_lang',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_no_reset_sent',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_action_type',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_project_id',
+                                'type': 'int'
+                            }
+                        ]
+                    }
+                },
+                footer : {
+                    xtype: 'PagingToolbar',
+                    xns: Roo,
+                    pageSize : 25,
+                    displayInfo : true,
+                    displayMsg : 'Displaying Person{0} - {1} of {2}',
+                    emptyMsg : 'No Person found',
+                    items : [
+                        {
+                            xtype: 'TextItem',
+                            xns: Roo.Toolbar,
+                            text : "Drag person to add or remove from group"
+                        }
+                    ]
+                },
+                toolbar : {
+                    xtype: 'Toolbar',
+                    xns: Roo,
+                    items : [
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                click : function()
+                                {
+                                    
+                                    _this.dialog.show( { id : 0 } , function() {
+                                        _this.grid.footer.onClick('first');
+                                   }); 
+                                }
+                            },
+                            cls : 'x-btn-text-icon',
+                            text : "Add",
+                            icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                click : function()
+                                {
+                                    
+                                    Pman.Dialog.PersonBulkAdd.show( { id : 0 } , function() {
+                                        _this.grid.footer.onClick('first');
+                                   }); 
+                                }
+                            },
+                            cls : 'x-btn-text-icon',
+                            text : "Bulk Add",
+                            icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            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;
+                                    }
+                                  
+                                    _this.dialog.show(s[0].data, function() {
+                                        _this.grid.footer.onClick('first');
+                                    }); 
+                                    
+                                }
+                            },
+                            cls : 'x-btn-text-icon',
+                            text : "Edit",
+                            icon : Roo.rootURL + 'images/default/tree/leaf.gif'
+                        },
+                        {
+                            xtype: 'Separator',
+                            xns: Roo.Toolbar
+                        },
+                        {
+                            xtype: 'TextItem',
+                            xns: Roo.Toolbar,
+                            text : "Search"
+                        },
+                        {
+                            xtype: 'TextField',
+                            xns: Roo.form,
+                            listeners : {
+                                render : function (_self)
+                                {
+                                    _this.searchBox = _self;
+                                },
+                                show : function (_self,e)
+                                {
+                                    if (e.getCharCode() != 13) {
+                                        return;
+                                    }
+                                    _this.grid.footer.onClick('first');
+                                },
+                                specialkey : function (_self, e)
+                                {
+                                  if (e.getKey() == 13) {
+                                    _this.grid.footer.onClick('first');
+                                  }
+                                }
+                            }
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                click : function (_self, e)
+                                {
+                                _this.grid.footer.onClick('first');
+                                }
+                            },
+                            cls : 'x-btn-icon',
+                            icon : rootURL + '/Pman/templates/images/search.gif'
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                click : function (_self, e)
+                                {
+                                _this.searchBox.setValue('');
+                                    _this.grid.footer.onClick('first');
+                                }
+                            },
+                            cls : 'x-btn-icon',
+                            icon : rootURL + '/Pman/templates/images/edit-clear.gif'
+                        },
+                        {
+                            xtype: 'Fill',
+                            xns: Roo.Toolbar
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                toggle : function (_self, pressed)
+                                {
+                                   _this.grid.footer.onClick('first');
+                                   this.setText(pressed ? "Show Active" : "Show Removed");
+                                   
+                                   
+                                },
+                                render : function (_self)
+                                {
+                                  _this.activeButton = _self;
+                                }
+                            },
+                            enableToggle : true,
+                            text : "Show Removed"
+                        }
+                    ]
+                },
+                colModel : [
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'project_id_code',
+                        header : 'Project',
+                        hidden : true,
+                        sortable : true,
+                        width : 75,
+                        renderer : function(v,x,r) { 
+                              return String.format('<span qtip="{0}">{1}</span>', 
+                                            r.data.project_id_name,
+                                            v);
+                         }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'company_id_comptype',
+                        header : 'Type',
+                        sortable : true,
+                        width : 50,
+                        renderer : function(v,x,r) {
+                            if (r.data.office_id) {
+                                return String.format('{0} - {1}', v, r.data.office_id_name); 
+                            } 
+                            return String.format('{0}', v); 
+                        }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'company_id_name',
+                        header : 'Company',
+                        sortable : true,
+                        width : 150,
+                        renderer : function(v,x,r) {
+                            if (r.data.office_id) {
+                                return String.format('{0} - {1}', v, r.data.office_id_name); 
+                            } 
+                            return String.format('{0}', v); 
+                        }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'name',
+                        header : 'Name',
+                        sortable : true,
+                        width : 200,
+                        renderer : function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'role',
+                        header : 'Role',
+                        width : 100,
+                        renderer : function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'phone',
+                        header : 'Phone',
+                        width : 100,
+                        renderer : function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'fax',
+                        header : 'Fax',
+                        width : 100,
+                        renderer : function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'email',
+                        header : 'Email',
+                        sortable : true,
+                        width : 200,
+                        renderer : function(v) {
+                           return (v.length && v.indexOf('@') > 0 ) ? 
+                                            String.format('<a href="mailto:{0}">{0}</a>',v) : v;
+                         }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'active',
+                        header : 'Active',
+                        width : 75,
+                        renderer : function(v) {  
+                            var state = v> 0 ?  '-checked' : '';
+                        
+                            return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                        
+                         }
+                    }
+                ]
+            }
+        });
+        this.layout = this.panel.layout;
+
+    }
+});
diff --git a/old/Pman.Tab.AdminPermProjects.bjs b/old/Pman.Tab.AdminPermProjects.bjs
new file mode 100644 (file)
index 0000000..62685ab
--- /dev/null
@@ -0,0 +1,108 @@
+{
+    "id": "roo-file-187",
+    "name": "Pman.Tab.AdminPermProjects",
+    "parent": "Pman.Tab.AdminPermManager",
+    "title": "Pman.Tab.AdminPermProjects",
+    "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminPermProjects.bjs",
+    "items": [
+        {
+            "|xns": "Roo",
+            "xtype": "GridPanel",
+            "title": "Projects",
+            "fitToframe": true,
+            "fitContainer": true,
+            "tableName": "Projects",
+            "background": true,
+            "region": "center",
+            "listeners": {
+                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+            },
+            "items": [
+                {
+                    "*prop": "grid",
+                    "xtype": "Grid",
+                    "autoExpandColumn": "name",
+                    "loadMask": true,
+                    "listeners": {
+                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
+                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                    },
+                    "|xns": "Roo.grid",
+                    "items": [
+                        {
+                            "|xns": "Roo",
+                            "xtype": "Toolbar",
+                            "*prop": "toolbar",
+                            "items": [
+                                {
+                                    "|xns": "Roo.Toolbar",
+                                    "xtype": "Fill"
+                                },
+                                {
+                                    "enableToggle": true,
+                                    "text": "Hide Closed Projects",
+                                    "xtype": "Button",
+                                    "|xns": "Roo.Toolbar"
+                                }
+                            ]
+                        },
+                        {
+                            "*prop": "dataSource",
+                            "xtype": "Store",
+                            "remoteSort": true,
+                            "|sortInfo": "{ field : 'name', direction: 'ASC' }",
+                            "|xns": "Roo.data",
+                            "items": [
+                                {
+                                    "*prop": "proxy",
+                                    "xtype": "HttpProxy",
+                                    "method": "GET",
+                                    "|url": "baseURL + '/Roo/Projects.php'",
+                                    "|xns": "Roo.data"
+                                },
+                                {
+                                    "|xns": "Roo.data",
+                                    "xtype": "JsonReader",
+                                    "totalProperty": "total",
+                                    "root": "data",
+                                    "*prop": "reader",
+                                    "id": "id",
+                                    "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'code',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'type',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id',\n        'type': 'int'\n    },\n    {\n        'name': 'team_id',\n        'type': 'int'\n    },\n    {\n        'name': 'file_location',\n        'type': 'string'\n    },\n    {\n        'name': 'open_date',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'open_by',\n        'type': 'int'\n    },\n    {\n        'name': 'close_date',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'countries',\n        'type': 'string'\n    },\n    {\n        'name': 'languages',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_tel',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_isOwner',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_logo_id',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_background_color',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_comptype',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_url',\n        'type': 'string'\n    },\n    {\n        'name': 'client_id_main_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_created_by',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'client_id_updated_by',\n        'type': 'int'\n    },\n    {\n        'name': 'client_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'client_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'agency_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_tel',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'agency_id_isOwner',\n        'type': 'int'\n    },\n    {\n        'name': 'agency_id_logo_id',\n        'type': 'int'\n    },\n    {\n        'name': 'agency_id_background_color',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_comptype',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_url',\n        'type': 'string'\n    },\n    {\n        'name': 'agency_id_main_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'agency_id_created_by',\n        'type': 'int'\n    },\n    {\n        'name': 'agency_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'agency_id_updated_by',\n        'type': 'int'\n    },\n    {\n        'name': 'agency_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'agency_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'team_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'team_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'team_id_type',\n        'type': 'int'\n    },\n    {\n        'name': 'team_id_leader',\n        'type': 'int'\n    },\n    {\n        'name': 'open_by_id',\n        'type': 'int'\n    },\n    {\n        'name': 'open_by_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'open_by_name',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_email',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'open_by_role',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_active',\n        'type': 'int'\n    },\n    {\n        'name': 'open_by_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'open_by_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'open_by_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'open_by_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_project_id',\n        'type': 'int'\n    }\n]"
+                                }
+                            ]
+                        },
+                        {
+                            "*prop": "footer",
+                            "xtype": "PagingToolbar",
+                            "pageSize": 25,
+                            "displayInfo": true,
+                            "displayMsg": "Displaying Projects{0} - {1} of {2}",
+                            "emptyMsg": "No Projects found",
+                            "|xns": "Roo"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "is_member",
+                            "header": "Is member",
+                            "width": 75,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "xtype": "ColumnModel",
+                            "header": "Name",
+                            "width": 200,
+                            "dataIndex": "name",
+                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                            "|xns": "Roo.grid",
+                            "*prop": "colModel[]"
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": "001"
+}
\ No newline at end of file
diff --git a/old/Pman.Tab.AdminPermProjects.js b/old/Pman.Tab.AdminPermProjects.js
new file mode 100644 (file)
index 0000000..5e1281a
--- /dev/null
@@ -0,0 +1,510 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+
+
+// register the module first
+Pman.on('beforeload', function()
+{
+    Pman.register({
+        modKey : '001-Pman.Tab.AdminPermProjects',
+        module : Pman.Tab.AdminPermProjects,
+        region : 'center',
+        parent : Pman.Tab.AdminPermManager,
+        name : "Pman.Tab.AdminPermProjects",
+        disabled : false, 
+        permname: '' 
+    });
+});
+
+Pman.Tab.AdminPermProjects = new Roo.util.Observable({
+
+    panel : false,
+    disabled : false,
+    parentLayout:  false,
+
+    add : function(parentLayout, region)
+    {
+
+        var _this = this;
+        this.parentLayout = parentLayout;
+
+        this.panel = parentLayout.addxtype({
+            xtype: 'GridPanel',
+            xns: Roo,
+            title : "Projects",
+            fitToframe : true,
+            fitContainer : true,
+            tableName : 'Projects',
+            background : true,
+            region : 'center',
+            listeners : {
+                activate : function() {
+                    _this.panel = this;
+                    if (_this.grid) {
+                        _this.grid.footer.onClick('first');
+                    }
+                }
+            },
+            grid : {
+                xtype: 'Grid',
+                xns: Roo.grid,
+                autoExpandColumn : 'name',
+                loadMask : true,
+                listeners : {
+                    render : function() 
+                    {
+                        _this.grid = this; 
+                        //_this.dialog = Pman.Dialog.FILL_IN
+                        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');
+                        }); 
+                    }
+                },
+                toolbar : {
+                    xtype: 'Toolbar',
+                    xns: Roo,
+                    items : [
+                        {
+                            xtype: 'Fill',
+                            xns: Roo.Toolbar
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            enableToggle : true,
+                            text : "Hide Closed Projects"
+                        }
+                    ]
+                },
+                dataSource : {
+                    xtype: 'Store',
+                    xns: Roo.data,
+                    remoteSort : true,
+                    sortInfo : { field : 'name', direction: 'ASC' },
+                    proxy : {
+                        xtype: 'HttpProxy',
+                        xns: Roo.data,
+                        method : 'GET',
+                        url : baseURL + '/Roo/Projects.php'
+                    },
+                    reader : {
+                        xtype: 'JsonReader',
+                        xns: Roo.data,
+                        totalProperty : 'total',
+                        root : 'data',
+                        id : 'id',
+                        fields : [
+                            {
+                                'name': 'id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'code',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'active',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'type',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'team_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'file_location',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_date',
+                                'type': 'date',
+                                'dateFormat': 'Y-m-d'
+                            },
+                            {
+                                'name': 'open_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'close_date',
+                                'type': 'date',
+                                'dateFormat': 'Y-m-d'
+                            },
+                            {
+                                'name': 'countries',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'languages',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_code',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_address',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_tel',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_isOwner',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_logo_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_background_color',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_comptype',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_url',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'client_id_main_office_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_created_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_created_dt',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'client_id_updated_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'client_id_updated_dt',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'client_id_passwd',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_code',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'agency_id_address',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_tel',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'agency_id_isOwner',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'agency_id_logo_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'agency_id_background_color',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_comptype',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_url',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'agency_id_main_office_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'agency_id_created_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'agency_id_created_dt',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'agency_id_updated_by',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'agency_id_updated_dt',
+                                'type': 'date'
+                            },
+                            {
+                                'name': 'agency_id_passwd',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'team_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'team_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'team_id_type',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'team_id_leader',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'open_by_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'open_by_office_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'open_by_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_phone',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_company_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'open_by_role',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_active',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'open_by_remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_passwd',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'open_by_lang',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_no_reset_sent',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'open_by_action_type',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'open_by_project_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_office_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_phone',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_fax',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_email',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_company_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_role',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_active',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_remarks',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_passwd',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_owner_id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_lang',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_no_reset_sent',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'owner_id_action_type',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'owner_id_project_id',
+                                'type': 'int'
+                            }
+                        ]
+                    }
+                },
+                footer : {
+                    xtype: 'PagingToolbar',
+                    xns: Roo,
+                    pageSize : 25,
+                    displayInfo : true,
+                    displayMsg : 'Displaying Projects{0} - {1} of {2}',
+                    emptyMsg : 'No Projects found'
+                },
+                colModel : [
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'is_member',
+                        header : 'Is member',
+                        width : 75,
+                        renderer : function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        header : 'Name',
+                        width : 200,
+                        dataIndex : 'name',
+                        renderer : function(v) { return String.format('{0}', v); }
+                    }
+                ]
+            }
+        });
+        this.layout = this.panel.layout;
+
+    }
+});
diff --git a/old/Pman.Tab.AdminProjects.js b/old/Pman.Tab.AdminProjects.js
new file mode 100644 (file)
index 0000000..dded830
--- /dev/null
@@ -0,0 +1,340 @@
+//<script type="text/javascript"> 
+       
+// Auto generated file build Builder
+
+            
+       
+// register the module first       
+Pman.on('beforeload', function()
+{
+
+    if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
+        return;
+    }
+    
+    if (!Pman.hasPerm('Core.Projects_All', 'S')) {
+        return;
+    }
+    
+    Pman.register({
+        modKey : '010-pman_tab_adminprojects',
+        module : Pman.Tab.AdminProjects,
+        region : 'center',
+        parent : Pman.Tab.Admin,
+        name : "Admin - Projects"
+    });
+});
+
+Pman.Tab.AdminProjects = {
+    
+    panel : false,
+    disabled : false,
+    parentLayout:  false,
+
+    add : function(parentLayout, region)
+    {
+        
+        if (this.disabled) {
+            return;
+        }
+        var _this = this;
+        this.parentLayout = parentLayout;
+        
+        this.panel = this.parentLayout.addxtype({
+            xtype : 'GridPanel',
+            title : "Projects",
+            fitToframe : true,
+            fitContainer : true,
+            tableName : 'Projects',
+            background : true,
+            listeners : {
+                activate: function() {
+                    _this.panel = this;
+                  
+                    
+                      if (_this.grid && _this.grid.rendered) {
+                        _this.grid.footer.onClick('first');
+                    }
+                }
+            },
+            grid : {
+                xtype : 'Grid',
+                autoExpandColumn : 'remarks',
+                loadMask : true,
+                listeners : {
+                    render: function() { 
+                    
+                        _this.grid = this; 
+                        _this.dialog = Pman.Dialog.CoreProject;
+                        _this.filter =  'P,U';
+                        _this.getTypes = function()
+                        {
+                            return [
+                                [  'U' , "Project (Unconfirmed)" ],
+                                [  'P' , "Project" ],
+                                [  'C' , "Project (Closed)" ],
+                                [  'N' , "Non-Project" ],
+                                [  'X' , "Non-Project (Closed)" ]
+                            
+                            ];
+                        };
+                        _this.typeToString = function(v)
+                        {
+                            var ar = this.getTypes();
+                            var ret = '';
+                            Roo.each(ar, function(a) {
+                                if (a[0] == v) {
+                                    ret = a[1];
+                                    return false;
+                                }
+                            });
+                            return ret;
+                        }
+                         _this.grid.footer.onClick('first');
+                    },
+                    rowdblclick: function (g, ri, e)
+                    {
+                        
+                        _this.dialog.show(g.getDataSource().getAt(ri).data, function() {
+                           g.footer.onClick('refresh');
+                        });
+                    }
+                },
+                dataSource : {
+                    xtype : 'Store',
+                    reader: Pman.Readers.Projects,
+                    listeners : {
+                        beforeload: function (_self, o)
+                        {
+                            if (!_this.searchBox) {
+                                return false;
+                            }  
+                            o.params = o.params ? o.params : {};
+                                                    o.params['query[project_search]'] = _this.searchBox.getValue();
+                                                    o.params['query[project_filter]'] = _this.filter;
+                        }
+                    },
+                    sortInfo: {field:'code', direction:'DESC'},
+                    remoteSort : true,
+                    proxy : {
+                        xtype : 'HttpProxy',
+                        method : 'GET',
+                        url: baseURL + '/Roo/Projects.php'
+                    }
+                },
+                colModel : [
+                    {
+                        header : 'Type',
+                        width : 70,
+                        dataIndex : 'type',
+                        renderer: function(v) {return _this.typeToString(v); }
+                    },
+                    {
+                        header : 'Code',
+                        width : 90,
+                        dataIndex : 'code',
+                        renderer: function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        header : 'Project Name',
+                        width : 300,
+                        dataIndex : 'name',
+                        renderer: function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        header : 'Client ',
+                        width : 100,
+                        dataIndex : 'client_id_name',
+                        renderer: function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        header : 'Remarks',
+                        width : 300,
+                        dataIndex : 'remarks',
+                        renderer: function(v) { return String.format('{0}', v); }
+                    }
+                ],
+                footer : {
+                    xtype : 'PagingToolbar',
+                    pageSize : 25,
+                    displayInfo : true,
+                    displayMsg : "Displaying Projects  {0} - {1} of {2}",
+                    emptyMsg : "No Projects found"
+                },
+                toolbar : {
+                    xtype : 'Toolbar',
+                    items : [
+                        {
+                            text : "Add",
+                            xtype : 'Button',
+                            cls : 'x-btn-text-icon',
+                            icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
+                            listeners : {
+                                click: function()
+                                        {
+                                            _this.dialog.show( { id : 0 }, function() {
+                                                _this.grid.footer.onClick('first');
+                                
+                                            }); 
+                                
+                                        }
+                                        
+                            }
+                        },
+                        {
+                            text : "Edit",
+                            xtype : 'Button',
+                            cls : 'x-btn-text-icon',
+                            icon: Roo.rootURL + 'images/default/tree/leaf.gif',
+                            listeners : {
+                                click: function()
+                                        {
+                                            var s = _this.grid.getSelectionModel().getSelections();
+                                            if (!s.length || (s.length > 1))  {
+                                                Roo.MessageBox.alert("Error", s.length ? "Select only one Project" : "Select a Project");
+                                                return;
+                                            }
+                                            
+                                            _this.dialog.show(s[0].data, function() {
+                                                _this.grid.footer.onClick('refresh');
+                                               }); 
+                                            
+                                        }
+                                        
+                            }
+                        },
+                        {
+                            xtype : 'Separator',
+                            xns: Roo.Toolbar
+                        },
+                        {
+                            xtype : 'TextItem',
+                            xns: Roo.Toolbar,
+                            text : "Search:"
+                        },
+                        {
+                            xtype : 'TextField',
+                            xns: Roo.form,
+                            listeners : {
+                                render: function (_self)
+                                {
+                                   _this.searchBox = _self;
+                                },
+                                specialkey: function (_self, e)
+                                {
+                                    if(e.getKey() == 13) {
+                                        _this.grid.footer.onClick('first');
+                                    }
+                                }
+                            },
+                            width : 135
+                        },
+                        {
+                            xtype : 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                click: function (_self, e)
+                                {
+                                 _this.grid.footer.onClick('first');
+                                }
+                            },
+                            icon: rootURL + '/Pman/templates/images/search.gif',
+                            cls : 'x-btn-icon'
+                        },
+                        {
+                            xtype : 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                click: function (_self, e)
+                                {
+                                    _this.searchBox.setValue('');
+                                    _this.grid.footer.onClick('first');
+                                }
+                            },
+                            icon: rootURL + '/Pman/templates/images/edit-clear.gif',
+                            cls : 'x-btn-icon'
+                        },
+                        {
+                            xtype : 'Separator',
+                            xns: Roo.Toolbar
+                        },
+                        {
+                            xtype : 'TextItem',
+                            xns: Roo.Toolbar,
+                            text : "Show:"
+                        },
+                        {
+                            xtype : 'Button',
+                            xns: Roo.Toolbar,
+                            text : "All",
+                            listeners : {
+                                toggle: function (_self, st)
+                                {
+                                if (st) { _this.filter = 'P,N,U'; } 
+                                    _this.grid.footer.onClick('first');
+                                }
+                            },
+                            toggleGroup : 'pgrp',
+                            pressed : false,
+                            enableToggle : true
+                        },
+                        {
+                            xtype : 'Button',
+                            xns: Roo.Toolbar,
+                            text : "Projects",
+                            listeners : {
+                                toggle: function (_self, st)
+                                {
+                                if (st) { _this.filter = 'P,U'; } 
+                                    _this.grid.footer.onClick('first');
+                                }
+                            },
+                            toggleGroup : 'pgrp',
+                            pressed : true,
+                            enableToggle : true
+                        },
+                        {
+                            xtype : 'Button',
+                            xns: Roo.Toolbar,
+                            text : "Non-Projects",
+                            listeners : {
+                                toggle: function (_self, st)
+                                {
+                                if (st) { _this.filter = 'N'; } 
+                                    _this.grid.footer.onClick('first');
+                                }
+                            },
+                            toggleGroup : 'pgrp',
+                            pressed : false,
+                            enableToggle : true
+                        },
+                        {
+                            xtype : 'Button',
+                            xns: Roo.Toolbar,
+                            text : "Closed",
+                            listeners : {
+                                toggle: function (_self, st)
+                                {
+                                if (st) { _this.filter = 'X,C'; } 
+                                    _this.grid.footer.onClick('first');
+                                }
+                            },
+                            toggleGroup : 'pgrp',
+                            pressed : false,
+                            enableToggle : true
+                        }
+                    ]
+                },
+                selModel : {
+                    xtype : 'RowSelectionModel',
+                    xns: Roo.grid,
+                    singleSelect : true
+                }
+            },
+            region : 'center'
+        });
+
+        
+        
+    }
+}
diff --git a/old/Pman.Tab.Contacts.js b/old/Pman.Tab.Contacts.js
new file mode 100644 (file)
index 0000000..08d7ba2
--- /dev/null
@@ -0,0 +1,75 @@
+//<script type="text/javascript">
+/**
+ * 
+ * The contacts..
+ * 
+ * -- this should implement personlist.!!!!
+ */
+Pman.on('beforeload', function()
+{
+    if (!Pman.hasPerm('Core.Person', 'E')) {
+        return;
+    }
+   
+    
+    
+    Pman.register({
+        modKey : '040-pman-tab-contacts',
+        module : Pman.Tab.Contacts,
+        region : 'center',
+        parent : Pman.Tab.ContactsMgr,
+        name : "Contacts List"
+    });
+
+    
+});
+Pman.Tab.Contacts = new Pman.Tab.PersonList({
+        id: 'contacts',
+        type: 2,
+        title : "Contacts",
+        itemDisplayName : "Contact",
+        permName : 'Core.Person',
+        getLeftSelections : function() {
+        
+            return Pman.Tab.ContactGrps.grid ? 
+                Pman.Tab.ContactGrps.grid.getSelectionModel().getSelections() : [];
+        },
+        beforeload: function(t, o) {
+                //console.log(o.params);
+            var _this= Pman.Tab.Contacts;
+            o.params['query[person_not_internal]'] = 1;
+            o.params['query[search]'] = _this.searchBox.getValue();
+            
+            var tms = _this.getLeftSelections();
+            
+            if (tms.length) {
+                o.params['query[in_group]'] = tms[0].data.id;
+            }
+            //o.params['query[name]'] = _this.searchBox.getValue();
+            o.params['query[type]'] = _this.type; // group type..
+            
+            
+            
+        }, 
+        columns : function()
+        {
+            return [
+                this.c_project_id_code(),
+                this.c_company_id_name(),
+                this.c_name(),
+                this.c_role(),
+                this.c_phone(),
+                this.c_fax(),
+                this.c_email() 
+            ]
+        },
+        dialog: function () {
+            return Pman.Dialog.PersonEdit;
+        },
+        bulkAdd : function() {
+            return Pman.Dialog.PersonBulkAdd;
+        },  
+        newDefaults : function() {  return { id : 0 }; }
+
+    
+    });
\ No newline at end of file
diff --git a/old/Pman.Tab.ContactsMgr.js b/old/Pman.Tab.ContactsMgr.js
new file mode 100644 (file)
index 0000000..1e3f730
--- /dev/null
@@ -0,0 +1,89 @@
+//<script type="text/javascript">
+
+// Contacts Manager 
+// left - list of groups.
+// right - People...
+
+
+Pman.on('beforeload', function()
+{
+    
+    if (!Pman.hasPerm('Core.Person', 'E')) {
+        return;
+    }
+    // anyone with admin can see this.....
+    
+    Pman.register({
+        modKey : '060-pman-tab-contactsmgr',
+        module : Pman.Tab.ContactsMgr,
+        region : 'center',
+        parent : Pman.Tab.Admin,
+        name : "Contacts Manager",
+        permname : 'Admin.Contacts',
+    });
+        
+});
+
+
+Pman.Tab.ContactsMgr = {
+    grid : false,
+    panel : false,
+    title : false, 
+    add : function(parentLayout, region) {
+        
+
+        if (this.panel) {
+            parentLayout.getRegion(region).showPanel(this.panel);
+            return;
+        }
+     
+        
+        this.layout = new Ext.BorderLayout(
+            parentLayout.getEl().createChild({tag:'div'}),
+            {
+               
+                west : {
+                    autoScroll:true,
+                    hideTabs: true,
+                    titlebar: true,
+                    split:true,
+                    initialSize: 250
+                },
+                center: {
+                    autoScroll:true,
+                    hideTabs: false,
+                     tabPosition: 'top'
+                   
+                }
+            }
+        );
+        
+        
+       
+        this.tab = parentLayout.add(region,  new Ext.NestedLayoutPanel(
+            this.layout, {title: this.title || "Contacts Manager", background : true}));
+        var _this = this;
+        this.tab.on('activate', function() {
+            if (_this.layout.getRegion('west').panels.length) {
+                _this.layout.getRegion('west').showPanel(0);
+                Pman.Tab.ContactGrps.refresh();
+            } else {
+                Pman.Tab.Contacts.loadFirst();
+            }
+            _this.layout.getRegion('center').showPanel(0);
+            
+            
+            
+             
+            
+        });
+    },
+    donelayout : false //,
+    
+    //show: function (parentLayout, region)
+   // {
+     //   this.add(parentLayout, region);
+   //     
+
+    //} 
+};
\ No newline at end of file
diff --git a/old/Pman.Tab.ProjectMgr.js b/old/Pman.Tab.ProjectMgr.js
new file mode 100644 (file)
index 0000000..99b08ea
--- /dev/null
@@ -0,0 +1,359 @@
+//<script type="text/javascript">
+  
+// tab on left...  
+Pman.on('beforeload', function()
+{
+    //                case 1 : Pman.Tab.Projects.add(this.mainLayout, 'west'); break;
+    
+    return;
+    if (!Pman.hasPerm('Core.Projects_All', 'E')) {
+        return;
+    }
+    Pman.register({
+        modKey : '010-pman-tab-projectmgr',
+        module : Pman.Tab.ProjectsMgr,
+        region : 'center',
+        parent : Pman.Tab.Admin,
+        name : "Project Manager"
+    });
+});
+   
+
+Pman.Tab.ProjectsMgr = {
+    grid : false,
+    panel : false,
+    disabled:  false,
+    filter : 'P,N,U',
+    searchBox : false,
+    add : function(parentLayout, region) {
+        if (this.disabled) {
+            return;
+        }
+        // add to the menu!!
+        Pman.subMenuItems.push({
+                seqid : 401,
+                text: "Add Project",
+                cls: 'x-btn-text-icon',
+                icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
+                
+                handler : function() {
+                    Pman.Dialog.CoreProject.show( 
+                        { 
+                            id : 0
+                        },
+                        function(data) {
+                            Pman.refreshActivePanel();
+                    }); 
+                }
+        });
+        Pman.subMenuItems.push( new Roo.menu.Separator({
+            seqid : 402
+        }));
+        
+        
+        if (this.panel) {
+            parentLayout.getRegion(region).showPanel(this.panel);
+            return;
+        }
+     
+        
+        this.innerLayout = new Ext.BorderLayout(
+            parentLayout.getEl().createChild({tag:'div'}),
+            {
+               
+                center: {
+                    autoScroll:true,
+                    hideTabs: true
+                }
+            }
+        );
+
+        var _this = this;
+
+        this.tab = parentLayout.add(region,  new Ext.NestedLayoutPanel(
+            this.innerLayout, {title: "Projects", background: true}));
+            
+        this.tab.on('activate', function() {
+           // console.log('activate');
+            _this.delayedCreate();
+            _this.paging.onClick('refresh');
+        });
+    },
+    delayedCreate :  function() 
+    {
+        if (this.grid) {
+            return;
+        }
+        var _this = this;
+        this.innerLayout.beginUpdate();
+        var refreshPager = function() {
+            _this.paging.onClick('refresh');
+        }
+
+        var frm = this.innerLayout.getEl().createChild({tag:'div'});
+        //this.grid = new Ext.grid.EditorGrid(frm,  {
+        this.grid = new Ext.grid.Grid(frm,  {
+                id: 'grid-projectsmgr',
+                ds:   new Ext.data.Store({
+                    // load using HTTP
+                    proxy: new Ext.data.HttpProxy({
+                        url: baseURL + '/Roo/Projects.php',
+                        method: 'GET'
+                    }),
+                    remoteSort: true,
+                    reader: Pman.Readers.Projects,
+                     
+                    listeners : {
+                        
+                        beforeload: function(t, o) {
+                            //console.log(o.params);
+                            // teams!?!
+                            o.params = o.params ? o.params : {};
+                            o.params['query[project_search]'] = _this.searchBox.getValue();
+                            o.params['query[project_filter]'] = _this.filter;
+                            
+                            
+                        },
+                        loadexception : Pman.loadException
+                    
+                    },
+                    sortInfo: {
+                        field: 'code', direction: 'DESC'
+                    }
+                }),
+                cm: new Ext.grid.ColumnModel(
+                    [
+                    {
+                    //    id : 'Projects-type',
+                        header : "Type",
+                        dataIndex : 'type',
+                        sortable : true,
+                        width : 130,
+                        renderer : function(v)
+                        {
+                            return _this.typeToString(v)
+                        }
+                    },
+                    
+                    {
+                       // id : 'Projects-code',
+                        header : "Code",
+                        dataIndex : 'code',
+                        sortable : true,
+                        width : 70
+                    }, 
+                    {
+                     //   id : 'Projects-name',
+                        header : "Project Name",
+                        dataIndex : 'name',
+                        sortable : true,
+                        width : 300
+                    },
+                    {
+                     //   id : 'Projects-name',
+                        header : "Client",
+                        dataIndex : 'client_id_name',
+                        sortable : true,
+                        width : 150
+                    },
+                    {
+                     //   id : 'Projects-name',
+                        header : "Team",
+                        dataIndex : 'team_id_name',
+                        sortable : true,
+                        width : 100
+                    },
+                    
+                    
+                    {
+                        id : 'projects-remarks',
+                        header : "Remarks",
+                        dataIndex : 'remarks',
+                        sortable : true,
+                        width : 300
+                    }  ]
+                ),
+                autoExpandColumn: 'projects-remarks' , // fixme!!!!
+                clicksToEdit : 1,
+                
+                loadMask: true,
+
+                listeners: {
+                    
+                    rowdblclick : function(g, ri, e) {
+                        var s = g.getDataSource().getAt(ri).data;
+                      
+                        _dialog.show(s, refreshPager); 
+                    }
+                }
+                 
+        });
+        this.panel  = this.innerLayout.add('center',  new Ext.GridPanel(this.grid ,
+            { fitToframe: true,fitContainer: true })
+        );
+        this.grid.render();
+        var gridFoot = this.grid.getView().getFooterPanel(true);
+        this.paging = new Ext.PagingToolbar(gridFoot, this.grid.getDataSource(), {
+            pageSize: 25,
+            displayInfo: true,
+            displayMsg: "",
+            emptyMsg: ""
+        });
+        var grid = this.grid;
+        var gridHead = this.grid.getView().getHeaderPanel(true);
+        var tb = new Ext.Toolbar(gridHead);
+        
+       
+        this.searchBox = new Ext.form.TextField({
+            name: 'search',
+            width:135,
+            listeners : {
+                specialkey : function(f,e)
+                {
+                    
+                    if (e.getKey() == 13) {
+                        
+                        refreshPager();
+                    } 
+                   
+                
+                }
+            }
+         
+        });
+    
+       
+        var _dialog = Pman.Dialog.CoreProject;
+        tb.add(
+            {
+                text: "Add",
+                cls: 'x-btn-text-icon',
+                icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
+                handler : function(){
+                    _dialog.show( { id: 0 }, refreshPager); 
+                }
+            }, 
+            {
+                text: "Edit",
+                cls: 'x-btn-text-icon',
+                icon: Ext.rootURL + 'images/default/tree/leaf.gif',
+                   
+                handler : function(){
+                    var s = grid.getSelectionModel().getSelections();
+                    if (!s.length || (s.length > 1))  {
+                        Ext.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                        return;
+                    }
+                    _dialog.show(s[0].data, refreshPager); 
+                }
+            }, '-',
+            'Search: ',
+            this.searchBox,
+            {
+                
+               
+                icon: rootURL + '/Pman/templates/images/search.gif', // icons can also be specified inline
+                cls: 'x-btn-icon',
+                qtip: "Search",
+                handler : function () {
+                    //_this.grid.getSelectionModel().clearSelections();
+                    refreshPager();
+                }
+            },   
+             {
+                
+               
+                icon: rootURL + '/Pman/templates/images/edit-clear.gif', // icons can also be specified inline
+                cls: 'x-btn-icon',
+                qtip: "Reset Search",
+                handler : function () {
+                    _this.searchBox.setValue('');
+                    //_this.grid.getSelectionModel().clearSelections();
+                    refreshPager();
+                }
+            },
+            '-',
+            'Show : ',
+            {
+                text: "All",
+                toggleGroup : 'pgrp',
+                pressed : true,
+                enableToggle: true,
+                toggleHandler : function(b, st) { if (st) { _this.filter = 'P,N,U'; } refreshPager();}
+            },
+            {
+                text: "Projects",
+                toggleGroup : 'pgrp',
+                pressed : false,
+                enableToggle: true,
+                toggleHandler : function(b, st) { if (st) { _this.filter = 'P,U'; } refreshPager();}
+            },
+            {
+                text: "Non-Projects",
+                toggleGroup : 'pgrp',
+                pressed : false,
+                enableToggle: true,
+                toggleHandler : function(b, st) { if (st) { _this.filter = 'N'; } refreshPager();}
+            },
+            {
+                text: "Closed",
+                toggleGroup : 'pgrp',
+                pressed : false,
+                enableToggle: true,
+                toggleHandler : function(b, st) { if (st) { _this.filter = 'X,C'; } refreshPager();}
+            }
+             
+        );
+        
+            
+        //this.toolbar = tb;
+        // add stuff to toolbar?
+        this.innerLayout.endUpdate();
+        
+         // _this.paging.onClick('refresh');
+        
+    },
+    show: function (parentLayout, region)
+    {
+        this.add(parentLayout, region);
+        this.grid.getDataSource().load({
+            params: {
+                start:0, 
+                limit:25
+            }
+        });
+
+    },
+    
+    getTypes: function()
+    {
+        //return Pman.Dialog.Projects.getTypes();
+        // we need to decide where this list goes.. 
+        return [
+            [  'U' , "Project (Unconfirmed)" ],
+            [  'P' , "Project" ],
+            [  'C' , "Project (Closed)" ],
+            [  'N' , "Non-Project" ],
+            [  'X' , "Non-Project (Closed)" ]
+        
+        ];
+    },
+    typeToString : function(v)
+    {
+        var ar = this.getTypes();
+        var ret = '';
+        Ext.each(ar, function(a) {
+            if (a[0] == v) {
+                ret = a[1];
+                return false;
+            }
+        });
+        return ret;
+    }
+    
+    
+    
+};   
+