Pman.Tab.AdminCountries.bjs
authorChris <chris@roojs.com>
Wed, 19 Mar 2014 05:35:30 +0000 (13:35 +0800)
committerChris <chris@roojs.com>
Wed, 19 Mar 2014 05:35:30 +0000 (13:35 +0800)
Pman.Tab.AdminCountries.js

Pman.Tab.AdminCountries.bjs
Pman.Tab.AdminCountries.js

index 9de8b6b..7fed863 100644 (file)
@@ -80,7 +80,7 @@
                         },
                         {
                             "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            \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}",
+                                "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",
index 4fce070..46a5bb1 100644 (file)
@@ -269,7 +269,7 @@ Pman.Tab.AdminCountries = new Roo.XComponent({
                                 },
                                 method: 'POST',  
                                 success : function(res) {
-                                    
+                                    Pman.Tab.AdminContacts.grid.footer.onClick('refresh');
                                     //var data = res.data
                                     //refreshPager();
                                     //