sync
[Pman.Admin] / Pman.Dialog.AdminEnumImages.js
index ea7c555..9ac979c 100644 (file)
@@ -112,7 +112,7 @@ Pman.Dialog.AdminEnumImages = {
          {
            
             var s =  _self.getDataSource().getAt(rowIndex);
-              Pman.Dialog.PressReleaseImage.show(s.data, function() {
+              Pman.Dialog.Image.show(s.data, function() {
                          _this.grid.footer.onClick('first');
                         }); 
          }
@@ -168,17 +168,18 @@ Pman.Dialog.AdminEnumImages = {
            click : function()
             {
                 var s = _this.grid.getSelectionModel().getSelections();
+                
                 if (!s || s.length != 1) {
                     Roo.MessageBox.alert("Error", "Select a single image to edit");
                    return;
                  }
                  var data = _this.grid.getDataSource().getById(s[0].data.id).data;
-                
-                         Pman.Dialog.PressReleaseImage.show(data, function() {
-                            _this.grid.footer.onClick('first');
-                           }); 
+                 
+                 Pman.Dialog.Image.show(data, function() {
+                    _this.grid.footer.onClick('first');
+                   });
                         
-                    }
+            }
           },
           xns : Roo,
           '|xns' : 'Roo'
@@ -190,9 +191,38 @@ Pman.Dialog.AdminEnumImages = {
           text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
           listeners : {
            click : function()
-                    {
-                    Pman.genericDelete(_this, 'Images'); 
+            {
+                var ids = [];
+                
+                var sc = _this.grid.getSelectionModel().getSelections();
+                
+                if (!sc.length) {
+                    Roo.MessageBox.alert("Error", "Select rows by clicking the row");
+                    return;
+                }
+                Roo.each(sc, function(v){
+                    ids.push(v.id);
+                });
+                Roo.MessageBox.confirm(
+                    "Confirm", 
+                    "Confirm Deletion of selected rows (some rows can not be deleted if they are referenced elsewhere", 
+                    function(res) {
+                        if(res != 'yes') {
+                            return;
+                        }
+                        new Pman.Request({
+                            method : 'POST',
+                            url : baseURL + '/Roo/Images',
+                            params : {
+                                _delete  : ids.join(',')
+                            },
+                            success : function() {
+                                _this.grid.footer.onClick('refresh');
+                            }
+                        });
                     }
+                );
+            }
           },
           xns : Roo.Toolbar,
           '|xns' : 'Roo.Toolbar'