Pman.Dialog.BAdminImageManager.bjs
authorEdward <edward@roojs.com>
Mon, 19 Nov 2018 02:37:24 +0000 (10:37 +0800)
committerEdward <edward@roojs.com>
Mon, 19 Nov 2018 02:37:24 +0000 (10:37 +0800)
Pman.Dialog.BAdminImageManager.js

Pman.Dialog.BAdminImageManager.bjs
Pman.Dialog.BAdminImageManager.js

index 77a1de0..5b0b21f 100644 (file)
            "$ xns" : "Roo.bootstrap",
            "items" : [
             {
-             "Number md" : 12,
+             "Number md" : 6,
+             "xtype" : "Column",
+             "$ xns" : "Roo.bootstrap",
+             "items" : [
+              {
+               "xtype" : "Button",
+               "$ xns" : "Roo.bootstrap",
+               "String html" : "<i class=\"fa fa-filter\"></i> Filter",
+               "String style" : "float:left;",
+               "items" : [
+                {
+                 "xtype" : "Menu",
+                 "$ xns" : "Roo.bootstrap",
+                 "* prop" : "menu",
+                 "items" : [
+                  {
+                   "listeners" : {
+                    "click" : "function (_self, e)\n{\n    _this.showType = 'private';\n    \n    _this.masonry.load();\n}"
+                   },
+                   "Boolean preventDefault" : true,
+                   "xtype" : "MenuItem",
+                   "$ xns" : "Roo.bootstrap",
+                   "Boolean isContainer" : false,
+                   "String html" : "Show images for this email"
+                  },
+                  {
+                   "listeners" : {
+                    "click" : "function (_self, e)\n{\n    _this.showType = 'public';\n    \n    _this.masonry.load();\n}"
+                   },
+                   "Boolean preventDefault" : true,
+                   "xtype" : "MenuItem",
+                   "$ xns" : "Roo.bootstrap",
+                   "Boolean isContainer" : false,
+                   "String html" : "Show all images"
+                  }
+                 ]
+                }
+               ]
+              },
+              {
+               "listeners" : {
+                "specialkey" : "function (_self, e)\n{    \n    \n    var image_name = \"\";\n    \n    if(e.keyCode == e.ENTER) {\n        _this.masonry.clearAll();\n        _this.masonry.load();\n    \n    }\n}",
+                "render" : "function (_self)\n{\n    _this.searchBox = this;\n}"
+               },
+               "xtype" : "Input",
+               "string placeholder" : "search for image",
+               "$ xns" : "Roo.bootstrap",
+               "String style" : "float:left; width: 300px; margin-left: 15px;",
+               "items" : [
+                {
+                 "listeners" : {
+                  "click" : "function (_self, e)\n{\n    _this.masonry.clearAll();\n    _this.masonry.load();\n}"
+                 },
+                 "xtype" : "Button",
+                 "$ xns" : "Roo.bootstrap",
+                 "String html" : "<i class=\"fa fa-search\"></i>",
+                 "* prop" : "after"
+                }
+               ]
+              },
+              {
+               "listeners" : {
+                "render" : "function (_self)\n{\n    _this.deleteBtn = this;\n    \n    this.hide();\n}",
+                "click" : "function (_self, e)\n{\n    if (_this.masonry.getSelected().length > 1) {\n        Roo.bootstrap.MessageBox.alert('Cannot delete the images !','Please select one image only');\n        return;\n    }\n    \n    if (_this.masonry.getSelected().length < 1) {\n        Roo.bootstrap.MessageBox.alert('Cannot delete any image!', 'Please select an image');\n        return;\n    }\n    \n    Roo.bootstrap.MessageBox.confirm(\"Confirm\", \"Are sure you want to delete this image?\", function (v){\n        if (v != 'yes') {\n            return;\n        }\n        \n        new Pman.Request({\n            url : baseURL + '/Roo/Images.php',\n            method: 'POST',\n            params : {\n                _delete : Roo.bootstrap.MasonryBrick.get(_this.masonry.getSelected()[0]).imageObj.id\n            },\n            success : function()\n            {\n//                _this.masonry.removeBrick(_this.masonry.getSelected()[0]);\n                _this.masonry.load();\n            }\n        });\n    });\n}"
+               },
+               "String weight" : "default",
+               "xtype" : "Button",
+               "$ xns" : "Roo.bootstrap",
+               "String html" : "<i class=\"fa fa-trash\"></i> Delete",
+               "String style" : "margin-left: 15px; float:right;"
+              },
+              {
+               "listeners" : {
+                "click" : "function (_self, e)\n{\n    var id = _this.data.onid;\n    \n    if(id*1 < 1){\n        Roo.MessageBox.alert('Error', 'Please save the email template first');\n        return;\n    }\n    \n    _this.uploadDL.inputEl().dom.click();\n}"
+               },
+               "xtype" : "Button",
+               "$ xns" : "Roo.bootstrap",
+               "String html" : "<i class=\"fa fa-upload\"></i> Upload Image",
+               "string weight" : "primary",
+               "String style" : "float:right;"
+              }
+             ]
+            },
+            {
+             "Number md" : 6,
              "xtype" : "Column",
              "$ xns" : "Roo.bootstrap",
              "items" : [
index d7ec588..1079bbd 100644 (file)
@@ -291,7 +291,166 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
             items  : [
              {
               xtype : 'Column',
-              md : 12,
+              md : 6,
+              xns : Roo.bootstrap,
+              '|xns' : 'Roo.bootstrap',
+              items  : [
+               {
+                xtype : 'Button',
+                html : _this._strings['53ab4599d0106e32d015649175a70d7b'] /* <i class="fa fa-filter"></i> Filter */,
+                style : 'float:left;',
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap',
+                menu : {
+                 xtype : 'Menu',
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap',
+                 items  : [
+                  {
+                   xtype : 'MenuItem',
+                   html : _this._strings['179d4ab94c43ccb7cd6d2b3d82c7fe1f'] /* Show images for this email */,
+                   isContainer : false,
+                   preventDefault : true,
+                   listeners : {
+                    click : function (_self, e)
+                     {
+                         _this.showType = 'private';
+                         
+                         _this.masonry.load();
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  },
+                  {
+                   xtype : 'MenuItem',
+                   html : _this._strings['2cd3a1900dd0060540b418b2a60f6eec'] /* Show all images */,
+                   isContainer : false,
+                   preventDefault : true,
+                   listeners : {
+                    click : function (_self, e)
+                     {
+                         _this.showType = 'public';
+                         
+                         _this.masonry.load();
+                     }
+                   },
+                   xns : Roo.bootstrap,
+                   '|xns' : 'Roo.bootstrap'
+                  }
+                 ]
+                }
+               },
+               {
+                xtype : 'Input',
+                placeholder : _this._strings['37c1097cf82226d511586ecd99ed97cf'] /* search for image */,
+                style : 'float:left; width: 300px; margin-left: 15px;',
+                listeners : {
+                 render : function (_self)
+                  {
+                      _this.searchBox = this;
+                  },
+                 specialkey : function (_self, e)
+                  {    
+                      
+                      var image_name = "";
+                      
+                      if(e.keyCode == e.ENTER) {
+                          _this.masonry.clearAll();
+                          _this.masonry.load();
+                      
+                      }
+                  }
+                },
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap',
+                after : {
+                 xtype : 'Button',
+                 html : _this._strings['cdb6b6bab1fd18b9dbfe3fb84a5d34ae'] /* <i class="fa fa-search"></i> */,
+                 listeners : {
+                  click : function (_self, e)
+                   {
+                       _this.masonry.clearAll();
+                       _this.masonry.load();
+                   }
+                 },
+                 xns : Roo.bootstrap,
+                 '|xns' : 'Roo.bootstrap'
+                }
+               },
+               {
+                xtype : 'Button',
+                html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
+                style : 'margin-left: 15px; float:right;',
+                weight : 'default',
+                listeners : {
+                 click : function (_self, e)
+                  {
+                      if (_this.masonry.getSelected().length > 1) {
+                          Roo.bootstrap.MessageBox.alert('Cannot delete the images !','Please select one image only');
+                          return;
+                      }
+                      
+                      if (_this.masonry.getSelected().length < 1) {
+                          Roo.bootstrap.MessageBox.alert('Cannot delete any image!', 'Please select an image');
+                          return;
+                      }
+                      
+                      Roo.bootstrap.MessageBox.confirm("Confirm", "Are sure you want to delete this image?", function (v){
+                          if (v != 'yes') {
+                              return;
+                          }
+                          
+                          new Pman.Request({
+                              url : baseURL + '/Roo/Images.php',
+                              method: 'POST',
+                              params : {
+                                  _delete : Roo.bootstrap.MasonryBrick.get(_this.masonry.getSelected()[0]).imageObj.id
+                              },
+                              success : function()
+                              {
+                  //                _this.masonry.removeBrick(_this.masonry.getSelected()[0]);
+                                  _this.masonry.load();
+                              }
+                          });
+                      });
+                  },
+                 render : function (_self)
+                  {
+                      _this.deleteBtn = this;
+                      
+                      this.hide();
+                  }
+                },
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               },
+               {
+                xtype : 'Button',
+                html : _this._strings['5350277f16d9998c57fa7e1d17be2a76'] /* <i class="fa fa-upload"></i> Upload Image */,
+                style : 'float:right;',
+                weight : 'primary',
+                listeners : {
+                 click : function (_self, e)
+                  {
+                      var id = _this.data.onid;
+                      
+                      if(id*1 < 1){
+                          Roo.MessageBox.alert('Error', 'Please save the email template first');
+                          return;
+                      }
+                      
+                      _this.uploadDL.inputEl().dom.click();
+                  }
+                },
+                xns : Roo.bootstrap,
+                '|xns' : 'Roo.bootstrap'
+               }
+              ]
+             },
+             {
+              xtype : 'Column',
+              md : 6,
               xns : Roo.bootstrap,
               '|xns' : 'Roo.bootstrap',
               items  : [