PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminImageManager.bjs
index 4463b85..890ca82 100644 (file)
@@ -23,7 +23,6 @@
   "84378f54966381befd040dafbdc221d6" : "<i class=\"fa fa-plus\"></i> Add into the email",
   "361bacb1a72a350ee34e2f31a6a91dab" : "Alignment:",
   "2cd3a1900dd0060540b418b2a60f6eec" : "Show all images",
-  "f48f7c7bccb5e29c83d87984c49ad8d4" : "Show image for this email",
   "ed807858fcb68abdd180481f1fcba5c5" : "<i class=\"fa fa-trash\"></i> Delete",
   "031fa343a28d221a25d2bcd942437174" : "Alternate Text:",
   "48ccf48dcf2218a413ce473262f21a0c" : "Width: ",
      "$ xns" : "Roo.bootstrap",
      "items" : [
       {
+       "listeners" : {
+        "render" : "function (_self)\n{\n    _this.masonryBlock = this;\n}"
+       },
+       "Number md" : 12,
        "xtype" : "Column",
        "$ xns" : "Roo.bootstrap",
-       "Number sm" : 8,
        "items" : [
         {
          "listeners" : {
           "actionfailed" : "function (_self, action)\n{\n    if (action.type == 'submit') {\n        Roo.log(\"Upload error\");\n        Roo.log(action);\n        \n        try {\n            \n            Roo.MessageBox.alert(\"Error\", action.result.errorMsg.split(/\\n/).join('<BR/>'));\n            \n        } catch(e) {\n            \n            Roo.MessageBox.alert(\"Error\", \"Saving failed = fix errors and try again\");\n        }\n        return;\n    }\n    \n    Roo.MessageBox.alert(\"Error\", \"Error loading details\"); \n}",
-          "actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') { \n        \n        _this.showType = 'All';\n        \n        this.url = _this.data._url ? baseURL + _this.data._url : baseURL + '/Roo/Images.php';\n        \n        this.el.dom.action = this.url;\n        \n        if (typeof(_this.data.timeout) != 'undefined') {\n            this.timeout = _this.data.timeout;\n        }\n        \n        this.findField('UPLOAD_IDENTIFIER').setValue(\n            (new Date() * 1) + '' + Math.random());\n        \n        _this.masonry.load();\n        \n        return;\n    }\n     \n   \n    if (action.type == 'load') {\n        \n        _this.data = action.result.data;\n        \n        return;\n    }\n    \n    \n    if (action.type == 'submit') { // only submitted here if we are \n        \n        _this.masonry.load();\n        \n        return; \n    }\n \n\n    \n}\n",
+          "actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') { \n        \n        _this.showType = 'public';\n        \n        this.url = _this.data._url ? baseURL + _this.data._url : baseURL + '/Roo/Images.php';\n        \n        this.el.dom.action = this.url;\n        \n        if (typeof(_this.data.timeout) != 'undefined') {\n            this.timeout = _this.data.timeout;\n        }\n        \n        this.findField('UPLOAD_IDENTIFIER').setValue(\n            (new Date() * 1) + '' + Math.random());\n        \n        _this.masonry.load();\n        \n        return;\n    }\n     \n   \n    if (action.type == 'load') {\n        \n        _this.data = action.result.data;\n        \n        return;\n    }\n    \n    \n    if (action.type == 'submit') { // only submitted here if we are \n        \n        _this.masonry.load();\n        \n        return; \n    }\n \n\n    \n}\n",
           "render" : "function (_self)\n{\n    _this.form = this;\n    \n}"
          },
          "style" : "display: none;",
@@ -91,7 +93,7 @@
          "items" : [
           {
            "listeners" : {
-            "render" : "function (_self)\n{\n    _this.uploadDL = this;\n    \n    _this.uploadDL.inputEl().on(\"change\",function(){\n        \n        _this.form.findField('onid').setValue(_this.showTypeBtn.isActive() ? _this.data.onid : 0);\n        _this.form.doAction('submit');\n        \n        //_this.dialog.uploadProgress.defer(1000, _this.dialog);\n    });\n    \n    \n}"
+            "render" : "function (_self)\n{\n    _this.uploadDL = this;\n    \n    _this.uploadDL.inputEl().on(\"change\",function(){\n        \n        _this.form.findField('onid').setValue((_this.showType == 'private') ? _this.data.onid : 0);\n        _this.form.doAction('submit');\n    });\n    \n    \n}"
            },
            "String name" : "imageUpload",
            "xtype" : "Input",
          "listeners" : {
           "render" : "function (_self)\n{\n    _this.container = this;\n    \n}"
          },
+         "String cls" : "col-md-12",
          "xtype" : "Container",
          "$ xns" : "Roo.bootstrap",
          "items" : [
            "$ xns" : "Roo.bootstrap",
            "items" : [
             {
-             "Number md" : 12,
+             "Number md" : 8,
              "xtype" : "Column",
              "$ xns" : "Roo.bootstrap",
+             "Number sm" : 12,
              "items" : [
               {
                "xtype" : "Button",
                "$ xns" : "Roo.bootstrap",
                "String html" : "<i class=\"fa fa-filter\"></i> Filter",
-               "String style" : "float:left;",
                "items" : [
                 {
                  "xtype" : "Menu",
                   },
                   {
                    "listeners" : {
-                    "click" : "function (_self, e)\n{\n    _this.masonry.load();\n}"
+                    "click" : "function (_self, e)\n{\n    _this.showType = 'public';\n    \n    _this.masonry.load();\n}"
                    },
                    "Boolean preventDefault" : true,
                    "xtype" : "MenuItem",
                 }
                ]
               },
-              {
-               "listeners" : {
-                "toggle" : "function (b, e, pressed)\n{\n    _this.showTypeBtn.setText(!pressed ? 'Show all images' : 'Show image for this email');\n    \n    _this.masonry.load();\n}",
-                "render" : "function (_self)\n{\n    _this.showTypeBtn = this;\n}"
-               },
-               "bool pressed" : false,
-               "xtype" : "Button",
-               "$ xns" : "Roo.bootstrap",
-               "String html" : "Show image for this email",
-               "String style" : "float:left;"
-              },
               {
                "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}",
                "xtype" : "Input",
                "string placeholder" : "search for image",
                "$ xns" : "Roo.bootstrap",
-               "String style" : "float:left; width: 300px; margin-left: 15px;",
+               "String style" : "width: 200px; margin-left: 15px;display: inline-block; margin-bottom: 0px; vertical-align: middle;",
                "items" : [
                 {
                  "listeners" : {
              "String cls" : "text-right",
              "xtype" : "Column",
              "$ xns" : "Roo.bootstrap",
+             "Number sm" : 12,
              "items" : [
               {
                "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}"
                },
+               "String size" : "sm",
                "xtype" : "Button",
                "$ xns" : "Roo.bootstrap",
                "String html" : "<i class=\"fa fa-upload\"></i> Upload Image",
                 "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 size" : "sm",
                "String weight" : "default",
                "xtype" : "Button",
                "$ xns" : "Roo.bootstrap",
                 "render" : "function (_self)\n{\n    _this.masonry = this;\n    \n}"
                },
                "Boolean isLayoutInstant" : false,
-               "| function load" : "function() \n{\n    _this.setting_form.reset();\n    _this.detail_form.reset();\n    \n    _this.setting_form.hide();\n    _this.detail_form.hide();\n    \n    _this.masonry.clearAll();\n    \n    new Pman.Request({\n        url: baseURL + '/Roo/Images',\n        method: 'GET',\n        params: {\n            ontable : 'core_email',\n            onid : _this.showTypeBtn.isActive() ? _this.data.onid : 0,\n            'search[filename]' : _this.searchBox.getValue()\n        },\n        success: function(ret) {\n            \n            if(!ret.data.length){\n                return;\n            }\n            \n            Roo.each(ret.data, function(r){\n                \n                _this.masonry.addBrick({\n                    size: 'md',\n                    boxWidth: 150,\n                    cls: 'coba-image-mgmt-masonry-brick',\n                    active: false,\n                    activeClass: 'active',\n                    preventDefault: true,\n                    bgimage : baseURL + '/Images/' + r.id + '/' + r.filename.replace('%', '-'),\n                    imageObj: r,\n                    listeners : {\n                        click : function (_self)\n                        {\n                            _this.setting_form.reset();\n                            _this.detail_form.reset();\n                            \n                            _this.setting_form.hide();\n                            _this.detail_form.hide();\n                            \n                            _this.deleteBtn.hide();\n                            \n                            if(!this.isSelected()){\n                                return;\n                            }\n                            \n                            if(_this.masonry.getSelected().length == 1){\n                                _this.deleteBtn.show();\n                            }\n                            \n                            new Pman.Request({\n                                url: baseURL + '/Roo/Images.php',\n                                method : 'GET',\n                                params : {\n                                    _id: _self.imageObj.id\n                                }, \n                                success : function(rr) {\n                                    \n                                    _this.setting_form.show();\n                                    _this.detail_form.show();\n                                    \n                                    _this.detail_form.setValues(rr.data);\n                                    _this.setting_form.setValues(rr.data);\n                                    \n                                    _this.setting_form.findField('align').setValue(\"left\");\n                                    \n                                    _self.imageObj = rr.data;\n                                }\n                            });\n                            \n                        }\n                     }\n                })\n                \n            });\n            \n            _this.masonry.initial();\n            \n         },\n         \n         failure: function(res) {\n             Roo.log('cannot read Coba/Roo/Images');\n         }\n     });\n}",
+               "| function load" : "function() \n{\n    _this.setting_form.reset();\n    _this.detail_form.reset();\n    \n    _this.setting_form.hide();\n    _this.detail_form.hide();\n    \n    _this.masonry.clearAll();\n    \n    var params = {\n        ontable : 'core_email',\n        'search[filename]' : _this.searchBox.getValue()\n    };\n    \n    if(_this.showType == 'private'){\n        params.onid = _this.data.onid;\n    }\n    \n    new Pman.Request({\n        url: baseURL + '/Roo/Images',\n        method: 'GET',\n        params: params,\n        success: function(ret) {\n            \n            if(!ret.data.length){\n                return;\n            }\n            \n            Roo.each(ret.data, function(r){\n                \n                _this.masonry.addBrick({\n                    size: 'md',\n                    boxWidth: 150,\n                    cls: 'coba-image-mgmt-masonry-brick',\n                    active: false,\n                    activeClass: 'active',\n                    preventDefault: true,\n                    bgimage : baseURL + '/Images/' + r.id + '/' + r.filename.replace('%', '-'),\n                    imageObj: r,\n                    listeners : {\n                        click : function (_self)\n                        {\n                            _this.setting_form.reset();\n                            _this.detail_form.reset();\n                            \n                            _this.setting_form.hide();\n                            _this.detail_form.hide();\n                            \n                            _this.deleteBtn.hide();\n                            \n                            _this.masonryBlock.el.removeClass(['col-md-12','col-md-8']).addClass('col-md-12');\n                            \n                            if(!this.isSelected()){\n                                return;\n                            }\n                            \n                            _this.masonryBlock.el.removeClass(['col-md-12','col-md-8']).addClass('col-md-8');\n                            \n                            if(_this.masonry.getSelected().length == 1){\n                                _this.deleteBtn.show();\n                            }\n                            \n                            new Pman.Request({\n                                url: baseURL + '/Roo/Images.php',\n                                method : 'GET',\n                                params : {\n                                    _id: _self.imageObj.id\n                                }, \n                                success : function(rr) {\n                                    \n                                    _this.setting_form.show();\n                                    _this.detail_form.show();\n                                    \n                                    _this.detail_form.setValues(rr.data);\n                                    _this.setting_form.setValues(rr.data);\n                                    \n                                    _this.setting_form.findField('align').setValue(\"left\");\n                                    \n                                    _self.imageObj = rr.data;\n                                }\n                            });\n                            \n                        }\n                     }\n                })\n                \n            });\n            \n            _this.masonry.initial();\n            \n         },\n         \n         failure: function(res) {\n             Roo.log('cannot read Coba/Roo/Images');\n         }\n     });\n}",
                "Number boxWidth" : 250,
                "xtype" : "LayoutMasonry",
                "$ xns" : "Roo.bootstrap",
        ]
       },
       {
+       "Number md" : 4,
        "xtype" : "Column",
        "$ xns" : "Roo.bootstrap",
-       "Number sm" : 4,
        "items" : [
         {
          "xtype" : "Row",