PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminImageManager.js
index 28ec0cd..514d28d 100644 (file)
@@ -10,29 +10,26 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
  _strings : {
   'ef797d5638c2e1c6b6225b2247541ea5' :"Upload Image or File:",
   'd9787032e54a7facd5c7b1db2ae61c7b' :"Image Manager",
+  '53ab4599d0106e32d015649175a70d7b' :"<i class=\"fa fa-filter\"></i> Filter",
   '37c1097cf82226d511586ecd99ed97cf' :"search for image",
   'cdb6b6bab1fd18b9dbfe3fb84a5d34ae' :"<i class=\"fa fa-search\"></i>",
   '5350277f16d9998c57fa7e1d17be2a76' :"<i class=\"fa fa-upload\"></i> Upload Image",
   '14834a16229091f47cf1810177d07916' :"Created Date:",
-  'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
   '1a0ce561842e3caef9098f46ecaa1dcf' :"Add Images with Settings",
-  '7dce122004969d56ae2e0245cb754d35' :"Edit",
   '78d0f5aac952e2ce840a381976a3b01e' :"Image Details",
   '708ea0e601087e73c4764d5086e3ea3c' :"File Name:",
   'e0a53da57dd79cca5d3b6a7c42e463ef' :"File Type:",
   '3f986fa4066f6bded1376eb69de18da2' :"File Size:",
+  '179d4ab94c43ccb7cd6d2b3d82c7fe1f' :"Show images for this email",
   'd3d2e617335f08df83599665eef8a418' :"Close",
   '84378f54966381befd040dafbdc221d6' :"<i class=\"fa fa-plus\"></i> Add into the email",
   '361bacb1a72a350ee34e2f31a6a91dab' :"Alignment:",
-  '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
-  'f48f7c7bccb5e29c83d87984c49ad8d4' :"Show image for this email",
+  '2cd3a1900dd0060540b418b2a60f6eec' :"Show all images",
   'ed807858fcb68abdd180481f1fcba5c5' :"<i class=\"fa fa-trash\"></i> Delete",
   '031fa343a28d221a25d2bcd942437174' :"Alternate Text:",
   '48ccf48dcf2218a413ce473262f21a0c' :"Width: ",
   'd0042a700e9bdf79689d63ee6846dc0e' :"Description:",
-  'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
   'd6d93f0d6b7c6018d8949e73ed6efb6c' :"<i class=\"fa fa-save\"></i> Save Changes",
-  'aba9f7d7443652e858969bfc280690b1' :"Manage Groups",
   'e933dc24fb245d863a43b4fefe9b45f5' :"Height:"
  },
  _named_strings : {
@@ -118,7 +115,13 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
       items  : [
        {
         xtype : 'Column',
-        sm : 8,
+        md : 12,
+        listeners : {
+         render : function (_self)
+          {
+              _this.masonryBlock = this;
+          }
+        },
         xns : Roo.bootstrap,
         '|xns' : 'Roo.bootstrap',
         items  : [
@@ -134,6 +137,8 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
             {
                 if (action.type == 'setdata') { 
                     
+                    _this.showType = 'public';
+                    
                     this.url = _this.data._url ? baseURL + _this.data._url : baseURL + '/Roo/Images.php';
                     
                     this.el.dom.action = this.url;
@@ -210,10 +215,8 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
                   
                   _this.uploadDL.inputEl().on("change",function(){
                       
-                      _this.form.findField('onid').setValue(_this.showTypeBtn.isActive() ? _this.data.onid : 0);
+                      _this.form.findField('onid').setValue((_this.showType == 'private') ? _this.data.onid : 0);
                       _this.form.doAction('submit');
-                      
-                      //_this.dialog.uploadProgress.defer(1000, _this.dialog);
                   });
                   
                   
@@ -268,6 +271,7 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
          },
          {
           xtype : 'Container',
+          cls : 'col-md-12',
           listeners : {
            render : function (_self)
             {
@@ -292,12 +296,13 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
              {
               xtype : 'Column',
               md : 8,
+              sm : 12,
               xns : Roo.bootstrap,
               '|xns' : 'Roo.bootstrap',
               items  : [
                {
                 xtype : 'Button',
-                html : _this._strings['aba9f7d7443652e858969bfc280690b1'] /* Manage Groups */,
+                html : _this._strings['53ab4599d0106e32d015649175a70d7b'] /* <i class="fa fa-filter"></i> Filter */,
                 xns : Roo.bootstrap,
                 '|xns' : 'Roo.bootstrap',
                 menu : {
@@ -307,45 +312,15 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
                  items  : [
                   {
                    xtype : 'MenuItem',
-                   fa : 'fa fa-plus',
-                   html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
-                   isContainer : false,
-                   preventDefault : true,
-                   listeners : {
-                    click : function (_self, e)
-                     {
-                         Pman.Dialog.BAdminGroups.show({ id : 0 }, function(res){
-                             _this.group_grid.store.load({});
-                         });
-                     }
-                   },
-                   xns : Roo.bootstrap,
-                   '|xns' : 'Roo.bootstrap'
-                  },
-                  {
-                   xtype : 'MenuItem',
-                   fa : 'fa fa-pencil',
-                   html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
+                   html : _this._strings['179d4ab94c43ccb7cd6d2b3d82c7fe1f'] /* Show images for this email */,
                    isContainer : false,
                    preventDefault : true,
                    listeners : {
                     click : function (_self, e)
                      {
-                         var sel = _this.group_grid.getSelectionModel().getSelected();
+                         _this.showType = 'private';
                          
-                         if(!sel){
-                             Roo.bootstrap.MessageBox.alert('Error', 'Please select a group');
-                             return;
-                         }
-                         
-                         if(sel.data.id * 1 < 1){
-                             Roo.bootstrap.MessageBox.alert('Error', 'The selected group is not editable');
-                             return;
-                         }
-                         
-                         Pman.Dialog.BAdminGroups.show({ id : sel.data.id }, function(res){
-                             _this.group_grid.store.load({});
-                         });
+                         _this.masonry.load();
                      }
                    },
                    xns : Roo.bootstrap,
@@ -353,66 +328,15 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
                   },
                   {
                    xtype : 'MenuItem',
-                   fa : 'fa fa-trash',
-                   html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
+                   html : _this._strings['2cd3a1900dd0060540b418b2a60f6eec'] /* Show all images */,
                    isContainer : false,
                    preventDefault : true,
                    listeners : {
                     click : function (_self, e)
                      {
-                         var sel = _this.group_grid.getSelectionModel().getSelected();
-                         
-                         if(!sel){
-                             Roo.bootstrap.MessageBox.alert('Error', 'Please select a group');
-                             return;
-                         }
-                         
-                         if(sel.data.id * 1 < 1){
-                             Roo.bootstrap.MessageBox.alert('Error', 'The selected group is not editable');
-                             return;
-                         }
-                         
-                         var deleteIt = function()
-                         {
-                             new Pman.Request({
-                                 url: baseURL + '/Roo/Core_group',
-                                 method: 'POST',
-                                 params: {
-                                     _delete : sel.data.id
-                                 },
-                                 success: function(res){
-                                     _this.group_grid.store.load({});
-                                     return;
-                                 }
-                             });
-                         }
-                         
-                         Roo.bootstrap.MessageBox.confirm('Confirm', 'Are you sure to delete the group?',function(ret) {
-                             
-                             if(ret == 'no'){
-                                 return;
-                             }
-                             
-                             deleteIt();
-                             
-                          }, this);
-                         
+                         _this.showType = 'public';
                          
-                     }
-                   },
-                   xns : Roo.bootstrap,
-                   '|xns' : 'Roo.bootstrap'
-                  },
-                  {
-                   xtype : 'MenuItem',
-                   fa : 'fa fa-refresh',
-                   html : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
-                   isContainer : false,
-                   preventDefault : true,
-                   listeners : {
-                    click : function (_self, e)
-                     {
-                         _this.group_grid.store.load({});
+                         _this.masonry.load();
                      }
                    },
                    xns : Roo.bootstrap,
@@ -421,30 +345,10 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
                  ]
                 }
                },
-               {
-                xtype : 'Button',
-                html : _this._strings['f48f7c7bccb5e29c83d87984c49ad8d4'] /* Show image for this email */,
-                pressed : false,
-                style : 'float:left;',
-                listeners : {
-                 render : function (_self)
-                  {
-                      _this.showTypeBtn = this;
-                  },
-                 toggle : function (b, e, pressed)
-                  {
-                      _this.showTypeBtn.setText(!pressed ? 'Show all images' : 'Show image for this email');
-                      
-                      _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;',
+                style : 'width: 200px; margin-left: 15px;display: inline-block; margin-bottom: 0px; vertical-align: middle;',
                 listeners : {
                  render : function (_self)
                   {
@@ -484,12 +388,14 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
               xtype : 'Column',
               cls : 'text-right',
               md : 4,
+              sm : 12,
               xns : Roo.bootstrap,
               '|xns' : 'Roo.bootstrap',
               items  : [
                {
                 xtype : 'Button',
                 html : _this._strings['5350277f16d9998c57fa7e1d17be2a76'] /* <i class="fa fa-upload"></i> Upload Image */,
+                size : 'sm',
                 weight : 'primary',
                 listeners : {
                  click : function (_self, e)
@@ -510,6 +416,7 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
                {
                 xtype : 'Button',
                 html : _this._strings['ed807858fcb68abdd180481f1fcba5c5'] /* <i class="fa fa-trash"></i> Delete */,
+                size : 'sm',
                 style : 'margin-left: 15px;',
                 weight : 'default',
                 listeners : {
@@ -594,14 +501,19 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
                     
                     _this.masonry.clearAll();
                     
+                    var params = {
+                        ontable : 'core_email',
+                        'search[filename]' : _this.searchBox.getValue()
+                    };
+                    
+                    if(_this.showType == 'private'){
+                        params.onid = _this.data.onid;
+                    }
+                    
                     new Pman.Request({
                         url: baseURL + '/Roo/Images',
                         method: 'GET',
-                        params: {
-                            ontable : 'core_email',
-                            onid : _this.showTypeBtn.isActive() ? _this.data.onid : 0,
-                            'search[filename]' : _this.searchBox.getValue()
-                        },
+                        params: params,
                         success: function(ret) {
                             
                             if(!ret.data.length){
@@ -630,10 +542,14 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
                                             
                                             _this.deleteBtn.hide();
                                             
+                                            _this.masonryBlock.el.removeClass(['col-md-12','col-md-8']).addClass('col-md-12');
+                                            
                                             if(!this.isSelected()){
                                                 return;
                                             }
                                             
+                                            _this.masonryBlock.el.removeClass(['col-md-12','col-md-8']).addClass('col-md-8');
+                                            
                                             if(_this.masonry.getSelected().length == 1){
                                                 _this.deleteBtn.show();
                                             }
@@ -693,7 +609,7 @@ Roo.apply(Pman.Dialog.BAdminImageManager.prototype, {
        },
        {
         xtype : 'Column',
-        sm : 4,
+        md : 4,
         xns : Roo.bootstrap,
         '|xns' : 'Roo.bootstrap',
         items  : [