{ "id": "roo-file-285", "name": "Pman.Tab.AdminCountries", "parent": "Pman.Tab.AdminContactsManager", "title": "Pman.Tab.AdminCountries", "path": "/home/chris/gitlive/Pman.Admin/Pman.Tab.AdminCountries.bjs", "items": [ { "listeners": { "activate": "function (_self)\n{\n _this.panel = this;\n if (_this.grid){\n _this.grid.ds.load({});\n }\n}" }, "background": true, "fitContainer": true, "fitToFrame": true, "region": "west", "tableName": "Person", "title": "Countries", "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": "country", "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._distinct = 'country';\n o.params._columns = 'country,country_tr';\n o.params.limit = 9999;\n o.params._hideEmptyCountry = 1;\n}", "load": "function (_self, records, options)\n{\n var sm = _this.grid.getSelectionModel();\n if (!sm.getSelections().length) {\n sm.selectFirstRow();\n }\n Pman.Tab.AdminContacts.grid.footer.onClick('first');\n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'country_tr', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/Clipping.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": "colModel[]", "dataIndex": "country", "header": "Country", "width": 200, "xtype": "ColumnModel", "|renderer": "function(v,x,r)\n{\n if(v*1 == -1){\n return String.format('{0}', r.data.country_tr);\n }\n \n return String.format('{0}', r.data.country_tr);\n}", "|xns": "Roo.grid" }, { "listeners": { "afterselectionchange": "function (_self)\n{\n// Pman.Tab.AdminContacts.grid.footer.onClick('first');\n var c = Pman.Tab.AdminContactsManager.layout.getRegion('center');\n c.getActivePanel().grid.footer.onClick('first');\n \n}" }, "*prop": "sm", "singleSelect": true, "xtype": "RowSelectionModel", "|xns": "Roo.grid" }, { "listeners": { "drop": "function (source, e, data)\n{\n //Roo.log(\"DROP\");\n \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 = _this.grid.getSelectionModel().isSelected(ri);;\n\n //var isToGroup = rid && rid.id > 0;\n this.success = false;\n \n if (isFromGroup){\n return;\n }\n var targetCountry = rid.country;\n var action = 'add';\n \n if (targetCountry*1 == -1) {\n action = 'sub';\n //return 'x-dd-drop-ok-sub'; \n }\n // build a list of selections.\n var sels = [];\n \n for (var i=0; i < data.selections.length; i++){\n var c = data.selections[i].data.countries.split(',');\n if(c.indexOf(targetCountry) > -1){\n //Roo.log(\"skipped : \"+data.selections[i].data.id);\n continue;\n }\n //Roo.log(data.selections[i].data);\n sels.push(data.selections[i].data.id);\n }\n \n if(sels.length < 1){\n Roo.MessageBox.alert('Error', 'No person add to group');\n return;\n }\n \n new Pman.Request({\n url: baseURL + '/Core/GroupCountries.php',\n params: {\n action : action,\n country: (targetCountry != -1) ? targetCountry : _this.grid.getSelectionModel().getSelected().data.country,\n user_ids : sels.join(',')\n },\n method: 'POST', \n success : function(res) {\n Pman.Tab.AdminContacts.grid.footer.onClick('refresh');\n //var data = res.data\n //refreshPager();\n // \n // do we need to do anything??\n //if (isFromGroup) {\n // Pman.Tab.AdminContacts.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 return;\n\n}", "over": "function (source, e, data)\n{\n //Roo.log(\"dragover\");\n \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 \n var isFromGroup = _this.grid.getSelectionModel().isSelected(ri);\n \n //Roo.log(\", isFromGroup:\" + isFromGroup);\n \n if (isFromGroup) {\n this.valid = false;\n return;\n }\n \n if(rid.country*1 == -1) {\n this.valid = 'ok-sub'; \n return;\n } \n \n this.valid = 'ok-add';\n}" }, "*prop": "dropTarget", "ddGroup": "groupDD", "xtype": "DropTarget", "|xns": "Roo.dd" } ] } ] } ], "permname": "", "modOrder": "001" }