rename email component
authorjohn <john@roojs.com>
Wed, 6 Dec 2017 03:49:57 +0000 (11:49 +0800)
committerjohn <john@roojs.com>
Wed, 6 Dec 2017 03:49:57 +0000 (11:49 +0800)
Pman.Dialog.BAdminCoreEmail.bjs [deleted file]
Pman.Dialog.BAdminImportUrl.bjs [moved from Pman.Dialog.BAdminCoreImportUrl.bjs with 92% similarity]
Pman.Dialog.BAdminImportUrl.js [new file with mode: 0644]

diff --git a/Pman.Dialog.BAdminCoreEmail.bjs b/Pman.Dialog.BAdminCoreEmail.bjs
deleted file mode 100644 (file)
index 2e9962a..0000000
+++ /dev/null
@@ -1,758 +0,0 @@
-{
- "name" : "Pman.Dialog.BAdminCoreEmail",
- "parent" : "",
- "title" : "Pman.Dialog.BAdminCoreEmail",
- "path" : "/home/johns/gitlive/Pman.BAdmin/Pman.Dialog.BAdminCoreEmail.bjs",
- "permname" : "",
- "modOrder" : "001",
- "strings" : {
-  "dc0de523c25be298ba751c63c694109e" : "Responsive Email (1)",
-  "2df994fe4798f819768c87824ec15ced" : "Email address:",
-  "843627586c62e389041a4d8800143974" : "Searching",
-  "d300e4dc3731ba320cbd6aafb9168b06" : "<i class=\"fa fa-repeat\"></i> Convert HTML to Text",
-  "ecc28898262b5b932c0a9e77315f31f7" : "<i class='fa fa-camera'></i> Images /Attachments",
-  "9e6cfe444e5e2a180173ca6b1a621415" : "<i class='fa fa-minus'></i> Delete",
-  "71d7f75db6d01a9c60670fda5a41e629" : "Subjects:",
-  "a0ffbff9bc1fb40496f2b7b07f710732" : "Message Editor",
-  "4cd559a2b504a2bb3b2c26628c7a9184" : "<i class='fa fa-file-text'></i> Use Template",
-  "2c466a2c159463f1d9ef5a7b57b52827" : "Select BCC Group",
-  "76348cf9ddb92acc65440418b185db2d" : "File Name",
-  "396ecabf0cd1f9503e591418851ef406" : "Edit / Create Message",
-  "73ea6b4441cdced246d236b22c8f991c" : "HTML File",
-  "31bb2f6e9b8fb11cbb7fb63c6025223f" : "Select Template",
-  "3858712080cb3d846ea206d1d1070674" : "Test Class (for system reference only):",
-  "296993584750e6ab52793cf0e6fbe27a" : "Display Order",
-  "0a5fecb1d88a50f47cc2ed2fd985c304" : "BCC Group:",
-  "b78a3223503896721cca1303f776159b" : "Title",
-  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
-  "c4ca4238a0b923820dcc509a6f75849b" : "1",
-  "1e6d57e813355689e9c77e947d73ad8f" : "From:",
-  "e3e8fe3bbe6bed494a417c58c4fcf4be" : "<i class='fa fa-plus'></i> Add",
-  "292f75d54a6892cfe18a93e64230112a" : "Mailout Name:",
-  "5feb9bf3c03b32635135006cbacb9542" : "Insert Field",
-  "b9c49611cfda3259a2b837b39489e650" : "Add Image",
-  "222be0de36fcd69d624f72a2ba121b4e" : "<i class=\"fa fa-cog\"></i> Image Manager",
-  "e44b145bd8b49b06e0ad2ced1ad56466" : "Plain Text",
-  "c9cc8cce247e49bae79f15173ce97354" : "Save",
-  "b3724add3f98fe41c39cc0e56edc18bc" : "<i class='fa fa-clipboard'></i> Import",
-  "e6b391a8d2c4d45902a23a8b6585703d" : "URL",
-  "36a65bbd12f7586ea1f9b0be4e8848aa" : "HTML Editor"
- },
- "items" : [
-  {
-   "string fitwindow" : true,
-   "xtype" : "Modal",
-   "$ xns" : "Roo.bootstrap",
-   "String title" : "Edit / Create Message",
-   "items" : [
-    {
-     "listeners" : {
-      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
-     },
-     "xtype" : "Button",
-     "$ xns" : "Roo.bootstrap",
-     "String html" : "Cancel",
-     "* prop" : "buttons[]",
-     "string name" : "cancel",
-     "$ String weight" : "'default'"
-    },
-    {
-     "listeners" : {
-      "click" : "function (_self, e)\n{\n\n    // do some checks?\n    _this.form.preValidate(function(res) {\n        if (!res) {\n            return; //failed.\n        }\n        //_this.form.doAction(\"submit\");\n    });\n\n}"
-     },
-     "xtype" : "Button",
-     "$ xns" : "Roo.bootstrap",
-     "String html" : "Save",
-     "* prop" : "buttons[]",
-     "string name" : "save",
-     "$ String weight" : "'primary'"
-    },
-    {
-     "xtype" : "Border",
-     "$ xns" : "Roo.bootstrap.layout",
-     "items" : [
-      {
-       "String tabPosition" : "top",
-       "xtype" : "Region",
-       "$ xns" : "Roo.bootstrap.layout",
-       "Boolean alwaysShowTabs" : true,
-       "* prop" : "center"
-      },
-      {
-       "Boolean fitContainer" : true,
-       "xtype" : "Content",
-       "Boolean fitToFrame" : true,
-       "$ xns" : "Roo.bootstrap.panel",
-       "String region" : "center",
-       "String title" : "Message Editor",
-       "Boolean autoScroll" : true,
-       "Boolean background" : false,
-       "string tpl" : "<a href=\"#\"><span class=\"icon\"><i class=\"fa fa-pencil\"></i></span>  <span unselectable=\"on\" title=\"{text}\">{text}</span><span class=\"badge\">{badge}</span></a>",
-       "items" : [
-        {
-         "xtype" : "Container",
-         "$ xns" : "Roo.bootstrap",
-         "items" : [
-          {
-           "xtype" : "Row",
-           "$ xns" : "Roo.bootstrap",
-           "String style" : "margin-top: 20px; margin-bottom: 20px;",
-           "items" : [
-            {
-             "Number md" : 4,
-             "xtype" : "Column",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "xtype" : "ButtonGroup",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "xtype" : "Button",
-                 "$ xns" : "Roo.bootstrap",
-                 "String html" : "<i class='fa fa-clipboard'></i> Import",
-                 "items" : [
-                  {
-                   "xtype" : "Menu",
-                   "$ xns" : "Roo.bootstrap",
-                   "* prop" : "menu",
-                   "items" : [
-                    {
-                     "listeners" : {
-                      "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminCoreImportUrl.show({\n        target : '/Core/ImportMailMessage.php'\n    }, function(data) {\n        if  (data) {\n          //  Roo.log(data);\n            _this.form.findField('bodytext').setValue(data);\n        }\n    });\n}"
-                     },
-                     "xtype" : "MenuItem",
-                     "$ xns" : "Roo.bootstrap",
-                     "String html" : "URL"
-                    },
-                    {
-                     "listeners" : {
-                      "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminImage.show({\n        _url : baseURL + '/Core/ImportMailMessage.php'\n    }, function(data) {\n        if  (data) {\n            _this.form.findField('bodytext').setValue(data);\n        }\n    });\n}"
-                     },
-                     "xtype" : "MenuItem",
-                     "$ xns" : "Roo.bootstrap",
-                     "String html" : "HTML File"
-                    }
-                   ]
-                  }
-                 ]
-                },
-                {
-                 "xtype" : "Button",
-                 "$ xns" : "Roo.bootstrap",
-                 "String html" : "<i class='fa fa-file-text'></i> Use Template",
-                 "items" : [
-                  {
-                   "xtype" : "Menu",
-                   "$ xns" : "Roo.bootstrap",
-                   "* prop" : "menu",
-                   "items" : [
-                    {
-                     "listeners" : {
-                      "click" : "function (_self, e)\n{\n\n    var l = document.location;\n    new Pman.Request({\n\n        url : baseURL + '/Core/ImportMailMessage.php',\n\n        method: 'POST',\n        mask : \"Loading\",\n        params : {\n              importUrl : l.protocol +'//' + l.host +   rootURL + '/Pman/Crm/mail_templates/responsive1.html'\n       },\n        success : function (res) {\n\n         _this.form.findField('bodytext').setValue(res.data);\n        }\n  \n    });\n}"
-                     },
-                     "xtype" : "MenuItem",
-                     "$ xns" : "Roo.bootstrap",
-                     "String html" : "Responsive Email (1)"
-                    }
-                   ]
-                  }
-                 ]
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "Number md" : 8,
-             "xtype" : "Column",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "listeners" : {
-                "select" : "function (combo, record, index)\n{\n   \n/*\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n*/    \n    if(!record){\n        return;\n    }\n    _this.form.findField('bodytext').setValue(record.data.content);\n\n}"
-               },
-               "Boolean selectOnFocus" : true,
-               "Boolean allowBlank" : true,
-               "Number pageSize" : 20,
-               "String name" : "template",
-               "String valueField" : "file",
-               "Boolean typeAhead" : true,
-               "xtype" : "ComboBox",
-               "Boolean editable" : false,
-               "String triggerAction" : "all",
-               "string placeholder" : "Select Template",
-               "Boolean alwaysQuery" : true,
-               "$ xns" : "Roo.bootstrap",
-               "String hiddenName" : "template",
-               "String displayField" : "file",
-               "Boolean forceSelection" : true,
-               "items" : [
-                {
-                 "listeners" : {
-                  "beforeload" : "function (_self, o){\n    o.params = o.params || {};\n}\n"
-                 },
-                 "$ Object sortInfo" : "{ direction : 'DESC', field: 'file' }",
-                 "xtype" : "Store",
-                 "boolean remoteSort" : true,
-                 "$ xns" : "Roo.data",
-                 "* prop" : "store",
-                 "items" : [
-                  {
-                   "xtype" : "HttpProxy",
-                   "$ xns" : "Roo.data",
-                   "String method" : "GET",
-                   "* prop" : "proxy",
-                   "$ String url" : "baseURL + '/Core/MailTemplateList.php'"
-                  },
-                  {
-                   "$ Array fields" : "[{\"name\":\"file\",\"type\":\"string\"},{\"name\":\"content\",\"type\":\"string\"}]",
-                   "xtype" : "JsonReader",
-                   "String root" : "data",
-                   "$ xns" : "Roo.data",
-                   "String id" : "name",
-                   "* prop" : "reader",
-                   "String totalProperty" : "total"
-                  }
-                 ]
-                }
-               ]
-              }
-             ]
-            }
-           ]
-          },
-          {
-           "listeners" : {
-            "actionfailed" : "function (_self, action)\n{\n    if (action.type == 'submit') {\n    }\n}",
-            "actioncomplete" : "function(_self,action)\n{\n   \n    if (action.type == 'setdata') {\n    \n        setInterval(_this.form.findField('bodytext').autosave, 5000);\n        \n        _this.data.module = _this.data.module || 'crm_mailing_list_message';\n        _this.form.url = baseURL + '/Roo/' + _this.data.module;\n        \n        //_this.html_preview.hide();\n        //_this.preview_btn.hide();\n            \n        if(_this.data.id*1 > 0){\n            _this.dialog.el.mask(\"Loading\");\n            this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }})\n            //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n            \n            //_this.html_preview.show();\n            //_this.preview_btn.show();\n            \n        } else {\n            _this.form.setValues({\n                'from_name' : Pman.Login.authUser.name,\n                'from_email' : Pman.Login.authUser.email\n            });\n        }\n       return;\n    }\n    if (action.type == 'load') {\n        _this.dialog.el.unmask();\n        \n        _this.form.findField('bodytext').originalValue = _this.form.findField('bodytext').getValue();\n        \n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.el.unmask();\n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, action.result.data);\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
-            "render" : "function (_self)\n{\n    _this.form = this;\n}"
-           },
-           "$ string preValidate" : "function(done_callback) {\n    \n    Roo.MessageBox.progress(\"Uploading Images\", \"Uploading\");\n    \n    if(!_this.form.findField('bodytext').editorcore.sourceEditMode){\n        _this.form.findField('bodytext').syncValue();\n    }else{\n        _this.form.findField('bodytext').pushValue();\n    }\n    \n    var html = _this.form.findField('bodytext').getValue();\n    \n    var s = Roo.get(_this.form.findField('bodytext').editorcore.doc.documentElement);\n    \n    var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\n    \n    \n    var nodes = [];\n    \n    s.select('img[src]').each(function(i) {\n        nodes.push(i.dom);\n    });\n    \n    \n    var total = nodes.length;\n    \n    var mkimg = function() {\n        if (!nodes.length) {\n              Roo.MessageBox.hide();\n              _this.form.findField('bodytext').syncValue();\n              done_callback(true);\n              _this.form.doAction(\"submit\");\n              return;\n        }\n        var i = nodes.pop(); \n        \n        var n = i.getAttribute('src').match(/(baseURL|server_baseurl)/);\n        \n        if(n){\n            mkimg();\n            return;\n        }\n        \n        n = i.getAttribute('src').match(/^http(.*)/);\n       \n        if(!n ){\n            mkimg();\n            return;\n        }\n        \n        \n        \n        new Pman.Request({\n            url : baseURL + '/Roo/Images.php',\n            method : 'POST',\n            params : {\n                onid : _this.form.findField('id').getValue(),\n                ontable : ontable ,\n                _remote_upload : i.src\n            },\n            success : function(res){\n                if(res.success == true){      \n                    i.setAttribute('src', res.data);\n                    Roo.MessageBox.updateProgress( (total - nodes.length) / total , \"Done \" + (total - nodes.length) + '/' + total);\n                }\n                mkimg();\n            }\n        });\n       \n    }\n    mkimg();\n}\n",
-           "xtype" : "Form",
-           "$ xns" : "Roo.bootstrap",
-           "String method" : "POST",
-           "$ String url" : "baseURL + '/Roo/crm_mailing_list_message.php'",
-           "items" : [
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "Number md" : 8,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "Boolean allowBlank" : false,
-                 "String name" : "name",
-                 "xtype" : "Input",
-                 "string fieldLabel" : "Mailout Name:",
-                 "$ xns" : "Roo.bootstrap",
-                 "Number labelWidth" : 3
-                }
-               ]
-              },
-              {
-               "Number md" : 4,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "listeners" : {
-                  "check" : "function (_self, checked)\n{\n    var boxLabel = 'Enabled - will be sent out';\n    \n    if(!checked){\n        boxLabel = 'Disabled - will NOT be sent out';\n    }\n    \n    //this.setBoxLabel(boxLabel);\n}"
-                 },
-                 "String name" : "active",
-                 "Boolean checked" : true,
-                 "xtype" : "CheckBox",
-                 "String valueOff" : 0,
-                 "String boxLabel" : "Enabled - will be sent out",
-                 "$ xns" : "Roo.bootstrap",
-                 "string value" : 1
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "Number md" : 8,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "string name" : "from_name",
-               "items" : [
-                {
-                 "Boolean allowBlank" : false,
-                 "String name" : "from_name",
-                 "xtype" : "Input",
-                 "string fieldLabel" : "From:",
-                 "$ xns" : "Roo.bootstrap",
-                 "Number labelWidth" : 3
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "Number md" : 8,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "Boolean allowBlank" : false,
-                 "String name" : "from_email",
-                 "xtype" : "Input",
-                 "string fieldLabel" : "Email address:",
-                 "$ xns" : "Roo.bootstrap",
-                 "Number labelWidth" : 3
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "Number md" : 8,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "Number pageSize" : 20,
-                 "Boolean allowBlank" : true,
-                 "String loadingText" : "Searching",
-                 "String name" : "bcc_group_name",
-                 "Number minChars" : 2,
-                 "String valueField" : "id",
-                 "Boolean typeAhead" : true,
-                 "xtype" : "ComboBox",
-                 "Boolean editable" : false,
-                 "String triggerAction" : "all",
-                 "String labelAlign" : "left",
-                 "string fieldLabel" : "BCC Group:",
-                 "Boolean alwaysQuery" : true,
-                 "string placeholder" : "Select BCC Group",
-                 "$ xns" : "Roo.bootstrap",
-                 "Number labelWidth" : 3,
-                 "String hiddenName" : "bcc_group",
-                 "String displayField" : "name",
-                 "Boolean forceSelection" : true,
-                 "items" : [
-                  {
-                   "listeners" : {
-                    "beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params._direct_return = 1;\n}\n"
-                   },
-                   "$ Object sortInfo" : "{ direction : 'ASC', field: 'name' }",
-                   "xtype" : "Store",
-                   "boolean remoteSort" : true,
-                   "$ xns" : "Roo.data",
-                   "* prop" : "store",
-                   "items" : [
-                    {
-                     "xtype" : "HttpProxy",
-                     "$ xns" : "Roo.data",
-                     "String method" : "GET",
-                     "* prop" : "proxy",
-                     "$ String url" : "baseURL + '/Roo/Core_group'"
-                    },
-                    {
-                     "$ Array fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"id\",\"type\":\"int\"}]",
-                     "xtype" : "JsonReader",
-                     "String root" : "data",
-                     "$ xns" : "Roo.data",
-                     "String id" : "name",
-                     "* prop" : "reader",
-                     "String totalProperty" : "total"
-                    }
-                   ]
-                  }
-                 ]
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "Number md" : 8,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "Boolean allowBlank" : false,
-                 "String name" : "subject",
-                 "xtype" : "Input",
-                 "string fieldLabel" : "Subjects:",
-                 "$ xns" : "Roo.bootstrap",
-                 "Number labelWidth" : 3
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "String header" : "HTML Editor",
-                 "String panel" : "primary",
-                 "xtype" : "Container",
-                 "$ xns" : "Roo.bootstrap",
-                 "items" : [
-                  {
-                   "xtype" : "Row",
-                   "$ xns" : "Roo.bootstrap",
-                   "items" : [
-                    {
-                     "Number md" : 4,
-                     "xtype" : "Column",
-                     "$ xns" : "Roo.bootstrap",
-                     "items" : [
-                      {
-                       "listeners" : {
-                        "render" : "function (_self)\n{\n    _this.extendimgselect = _self;\n}",
-                        "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save message first\");\n        return false;\n    }\n}",
-                        "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    \n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    \n    var editor = _this.form.findField('bodytext').editorcore;\n    var curnode = editor.getSelectedNode();\n    \n    if (curnode && curnode.tagName == 'IMG') {\n        curnode.src= String.format('{0}/Images/{1}/{2}#image-{1}',\n                baseURL,  record.data.id, record.data.filename\n            );\n            // note -forces an update... hopefully...\n        editor.owner.fireEvent('editorevent', editor, false);\n    } else {\n    \n        editor.insertAtCursor(\n            String.format('<img src=\"{0}/Images/{1}/{2}#image-{1}\">',\n            baseURL,  record.data.id, record.data.filename\n            )\n        );\n\n    }\n    \n }"
-                       },
-                       "String loadingText" : "Searching",
-                       "String valueField" : "id",
-                       "Boolean typeAhead" : true,
-                       "xtype" : "ComboBox",
-                       "Boolean editable" : false,
-                       "String triggerAction" : "all",
-                       "String labelAlign" : "left",
-                       "string placeholder" : "Add Image",
-                       "Boolean alwaysQuery" : true,
-                       "$ xns" : "Roo.bootstrap",
-                       "String/Roo.Template tpl" : "<li>\n    <a>\n        <div class=\"row\" style=\"white-space: nowrap\">\n            <div class=\"col-md-4\">\n                <img \n                    src=\"{public_baseURL}/Core/Images/Thumb/150x150/{id}.jpg\" \n                    height=\"70\" \n                    width=\"70\"\n                >\n            </div>\n            <div class=\"col-md-8\">\n                <b>{filename}</b>\n            </div>\n        </div>\n    </a>\n</li>",
-                       "Number labelWidth" : 4,
-                       "String displayField" : "filename",
-                       "Boolean forceSelection" : true,
-                       "items" : [
-                        {
-                         "listeners" : {
-                          "beforeload" : "function (_self, o){\n    \n    o.params = o.params || {};\n    \n    var id = _this.form.findField('id').getValue() * 1;\n    if (!id) {\n        Roo.MessageBox.alert(\"Error\", \"Save email template first\");\n        return false;\n    }\n    o.params.onid = id;\n    o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\n    \n    // o.params.imgtype = 'PressRelease';\n    //o.params['query[imagesize]'] = '150x150';\n    // set more here\n}\n"
-                         },
-                         "Object sortInfo" : "{ direction : 'ASC', field: 'id' }",
-                         "xtype" : "Store",
-                         "boolean remoteSort" : true,
-                         "$ xns" : "Roo.data",
-                         "* prop" : "store",
-                         "items" : [
-                          {
-                           "xtype" : "HttpProxy",
-                           "$ xns" : "Roo.data",
-                           "String method" : "GET",
-                           "* prop" : "proxy",
-                           "$ String url" : "baseURL + '/Roo/Images.php'"
-                          },
-                          {
-                           "$ Array fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"filename\",\"type\":\"string\"},{\"name\":\"url_thumb\",\"type\":\"string\"}]",
-                           "xtype" : "JsonReader",
-                           "String root" : "data",
-                           "$ xns" : "Roo.data",
-                           "String id" : "id",
-                           "* prop" : "reader",
-                           "String totalProperty" : "total"
-                          }
-                         ]
-                        }
-                       ]
-                      }
-                     ]
-                    },
-                    {
-                     "Number md" : 2,
-                     "xtype" : "Column",
-                     "$ xns" : "Roo.bootstrap",
-                     "items" : [
-                      {
-                       "listeners" : {
-                        "render" : "function (_self)\n{\n    _this.unsubscribeselect = _self;\n}",
-                        "select" : "function (combo, record, index)\n{\n    Roo.log(record);\n    (function() { \n        combo.setValue('');\n    }).defer(100);\n    var editor = _this.form.findField('bodytext').editorcore;\n    \n    if(record.data.name == 'Unsubscribe'){\n        editor.insertAtCursor(\n            String.format('<a href=\"{0}\">{1}</a>',\n                record.data.type,  record.data.name\n            )\n        );\n        return;     \n    }\n    \n    editor.insertAtCursor(\n        String.format('{0}',\n            record.data.type\n        )\n    );\n    \n }"
-                       },
-                       "String loadingText" : "Searching",
-                       "String valueField" : "id",
-                       "Boolean typeAhead" : true,
-                       "xtype" : "ComboBox",
-                       "Boolean editable" : false,
-                       "String triggerAction" : "all",
-                       "String labelAlign" : "left",
-                       "string placeholder" : "Insert Field",
-                       "Boolean alwaysQuery" : true,
-                       "$ xns" : "Roo.bootstrap",
-                       "Number labelWidth" : 4,
-                       "String displayField" : "name",
-                       "Boolean forceSelection" : true,
-                       "items" : [
-                        {
-                         "xtype" : "SimpleStore",
-                         "$ data" : "[ \n    [ '{person.firstname}', \"First Name\"],\n    [ '{person.lastname}' , \"Last Name\"],\n    [ '{person.name}', \"Full Name\"],\n    [ '#unsubscribe', \"Unsubscribe\"]\n]\n",
-                         "$ fields" : "[  'type', 'name']",
-                         "$ xns" : "Roo.data",
-                         "* prop" : "store"
-                        }
-                       ]
-                      }
-                     ]
-                    },
-                    {
-                     "Number md" : 2,
-                     "xtype" : "Column",
-                     "$ xns" : "Roo.bootstrap",
-                     "items" : [
-                      {
-                       "listeners" : {
-                        "click" : "function (_self, e)\n{\n    Pman.Dialog.BAdminImageManager.show({});\n    \n}"
-                       },
-                       "String weight" : "primary",
-                       "xtype" : "Button",
-                       "$ xns" : "Roo.bootstrap",
-                       "String html" : "<i class=\"fa fa-cog\"></i> Image Manager"
-                      }
-                     ]
-                    }
-                   ]
-                  },
-                  {
-                   "listeners" : {
-                    "savedpreview" : "function (_self)\n{\n    var id = _this.form.findField('id').getValue() * 1;\n    \n    var successFn = function(res){\n        return res.data.POST.source;\n    };\n    \n    var params = {\n        action : 'AUTOSAVE',\n        remarks : 'BODY',\n        on_id : (id < 1) ? 0 : id,\n        on_table : 'crm_mailing_list_message',\n        successFn : successFn\n    };\n    \n    \n    /*\n    Pman.Dialog.CoreAutoSavePreview.show(params, function(res){\n        _self.setValue(res);\n        _self.originalValue = res;\n    });\n    */\n}",
-                    "autosave" : "function (_self)\n{\n    Roo.log('autosave');\n    \n    var id = _this.form.findField('id').getValue() * 1;\n    \n    if(!_self.editorcore.sourceEditMode){\n        _self.syncValue();\n    }else{\n        _self.pushValue();\n    }\n    \n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Events.php',\n        method :'POST',\n        params : {\n            id : 0,\n            action : 'AUTOSAVE',\n            on_id : (id > 0) ? id : 0,\n            on_table : 'crm_mailing_list_message',\n            remarks : 'BODY',\n            source: _self.getValue()\n        },\n        success : function() {\n            _self.originalValue = _self.getValue();\n            \n        },\n        failure : function() \n        {\n            Roo.log('body autosave failed?!');\n        }\n    });\n    \n}"
-                   },
-                   "String name" : "bodytext",
-                   "| function autosave" : "function() {\n    \n    var body = _this.form.findField('bodytext');\n    \n    //if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){  /////////isDirty() has not defined\n    \n    if(!body.wrap.isVisible(true) || body.getValue() == ''){\n        Roo.log('body not dirty');\n        return;\n    }\n    \n    Roo.log('body dirty, auto save!');\n    \n    body.fireEvent('autosave', body);\n   \n}\n",
-                   "xtype" : "HtmlEditor",
-                   "$ xns" : "Roo.bootstrap"
-                  }
-                 ]
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "Number md" : 12,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "String style" : "text-align: center;",
-               "items" : [
-                {
-                 "listeners" : {
-                  "click" : "function (_self, e)\n{\n    var h = _this.form.findField('bodytext').getValue();\n    var p = _this.form.findField('plaintext');\n    \n    new Pman.Request({\r\n        url : baseURL + '/Core/ImportMailMessage.php',\r\n        method : 'POST',\r\n        params : {\n          bodytext : h,\r\n          _convertToPlain : true,\n          _check_unsubscribe : true\r\n        }, \r\n        success : function(res) {\r\n            if(res.success == true){\n               p.setValue(res.data);\n            }\r\n        }\r\n    });\n    \n}"
-                 },
-                 "xtype" : "Button",
-                 "$ xns" : "Roo.bootstrap",
-                 "String html" : "<i class=\"fa fa-repeat\"></i> Convert HTML to Text"
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "listeners" : {
-              "click" : "function (_self, e)\n{\n    var h = _this.form.findField('bodytext').getValue();\n    var p = _this.form.findField('plaintext');\n    \n    new Pman.Request({\r\n        url : baseURL + '/Core/ImportMailMessage.php',\r\n        method : 'POST',\r\n        params : {\n          bodytext : h,\r\n          _convertToPlain : true,\n          _check_unsubscribe : true\r\n        }, \r\n        success : function(res) {\r\n            if(res.success == true){\n               p.setValue(res.data);\n            }\r\n        }\r\n    });\n    \n}"
-             },
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "String header" : "Plain Text",
-                 "xtype" : "Container",
-                 "String panel" : "primary",
-                 "$ xns" : "Roo.bootstrap",
-                 "items" : [
-                  {
-                   "String name" : "plaintext",
-                   "xtype" : "TextArea",
-                   "$ xns" : "Roo.bootstrap"
-                  }
-                 ]
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "xtype" : "Row",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "Number md" : 12,
-               "xtype" : "Column",
-               "$ xns" : "Roo.bootstrap",
-               "items" : [
-                {
-                 "String name" : "text_class",
-                 "xtype" : "Input",
-                 "string fieldLabel" : "Test Class (for system reference only):",
-                 "String labelAlign" : "left",
-                 "String inputType" : "hidden",
-                 "$ xns" : "Roo.bootstrap",
-                 "Number labelWidth" : 6
-                }
-               ]
-              }
-             ]
-            },
-            {
-             "String name" : "id",
-             "xtype" : "Input",
-             "$ xns" : "Roo.bootstrap",
-             "Number labelWidth" : 3
-            }
-           ]
-          }
-         ]
-        }
-       ]
-      },
-      {
-       "listeners" : {
-        "activate" : "function (_self)\n{\n    if (_this.igrid) {\n        \n        _this.igrid.store.load();\n    }\n}",
-        "render" : "function (_self)\n{\n    if (_this.igrid) {\n        \n        _this.igrid.store.load();\n    }\n}"
-       },
-       "Boolean fitContainer" : true,
-       "xtype" : "Grid",
-       "Boolean fitToFrame" : true,
-       "String region" : "center",
-       "$ xns" : "Roo.bootstrap.panel",
-       "String title" : "<i class='fa fa-camera'></i> Images /Attachments",
-       "Boolean background" : true,
-       "Boolean closable" : false,
-       "items" : [
-        {
-         "listeners" : {
-          "render" : "function (_self)\n{\n    _this.igrid = this;\n    \n    if (this.store) {\n        this.store.load();\n    }\n}"
-         },
-         "xtype" : "Table",
-         "Boolean rowSelection" : true,
-         "$ xns" : "Roo.bootstrap",
-         "Boolean loadMask" : true,
-         "* prop" : "grid",
-         "items" : [
-          {
-           "listeners" : {
-            "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    if (typeof(_this.data) == 'undefined') {\n        \n        return false;\n    }\n    \n    if(_this.data.id * 1 >= 0)\n    {\n        o.params.onid = _this.data.id;\n\n        o.params.ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\n    }\n}"
-           },
-           "$ Object sortInfo" : "{ field : 'filename', direction: 'ASC' }",
-           "xtype" : "Store",
-           "boolean remoteSort" : true,
-           "$ xns" : "Roo.data",
-           "* prop" : "store",
-           "items" : [
-            {
-             "xtype" : "HttpProxy",
-             "$ xns" : "Roo.data",
-             "String method" : "GET",
-             "* prop" : "proxy",
-             "$ String url" : "baseURL + '/Roo/Images.php'"
-            },
-            {
-             "$ Array fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filename',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_onid',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_width',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_height',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_created',\n        'type': 'date'\n    },\n    {\n        'name': 'parent_image_id_imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_descript',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_title',\n        'type': 'string'\n    }\n]",
-             "xtype" : "JsonReader",
-             "String root" : "data",
-             "$ xns" : "Roo.data",
-             "String id" : "id",
-             "* prop" : "reader",
-             "String totalProperty" : "total"
-            }
-           ]
-          },
-          {
-           "String header" : "File Name",
-           "Number md" : 4,
-           "String dataIndex" : "filename",
-           "xtype" : "ColumnModel",
-           "$ xns" : "Roo.grid",
-           "$ string renderer" : "function(v,x,r)\n{\n    var width = r.data.width;\n    var height = r.data.height;\n    Roo.log(r.data);\n    if(width > 50){\n        height = Math.round(height * 50 / width);\n        width = 50;\n    }\n    \n   return '<img src=\"' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '\" width=\"' + width + '\" height=\"' + height + '\" /> ' + r.data.filename;\n}",
-           "* prop" : "cm[]"
-          },
-          {
-           "String header" : "Title",
-           "String dataIndex" : "title",
-           "Number md" : 4,
-           "xtype" : "ColumnModel",
-           "$ xns" : "Roo.grid",
-           "$ string renderer" : "function(v) \n{\n    return String.format('{0}', v); \n}",
-           "* prop" : "cm[]"
-          },
-          {
-           "String header" : "Display Order",
-           "Number md" : 4,
-           "String dataIndex" : "displayorder",
-           "xtype" : "ColumnModel",
-           "$ xns" : "Roo.grid",
-           "$ string renderer" : "function(v) \n{\n    return String.format('{0}', v); \n}",
-           "* prop" : "cm[]"
-          }
-         ]
-        },
-        {
-         "xtype" : "NavSimplebar",
-         "$ xns" : "Roo.bootstrap",
-         "* prop" : "toolbar",
-         "items" : [
-          {
-           "Number md" : 12,
-           "xtype" : "Column",
-           "$ xns" : "Roo.bootstrap",
-           "items" : [
-            {
-             "xtype" : "ButtonGroup",
-             "$ xns" : "Roo.bootstrap",
-             "items" : [
-              {
-               "listeners" : {
-                "click" : "function (_self, e)\n{\n    var id = _this.form.findField('id').getValue();\n    \n    if(id*1 < 1){\n        Roo.MessageBox.alert('Error', 'Please save the email template first');\n        return;\n    }\n    \n    var ontable = (_this.data.module) ? _this.data.module : 'crm_mailing_list_message';\n    \n    Pman.Dialog.BAdminImage.show( { id : 0, onid: id, ontable: ontable }, function() {\n        \n        _this.igrid.store.load();\n    });\n}"
-               },
-               "xtype" : "Button",
-               "$ xns" : "Roo.bootstrap",
-               "String html" : "<i class='fa fa-plus'></i> Add"
-              },
-              {
-               "listeners" : {
-                "click" : "function (_self, e)\n{\n    var s = _this.igrid.selModel.getSelected();\n    \n    if (!s || isNaN(s.id *1)) {\n        \n        Roo.MessageBox.alert(\"Error\", \"Select a image\"); \n        return;\n    }\n    \n    Roo.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 : s.id\n            },\n            success : function()\n            {\n                Roo.log('Got Success!!');\n                _this.igrid.store.load();\n            }\n        });\n    });\n}"
-               },
-               "xtype" : "Button",
-               "$ xns" : "Roo.bootstrap",
-               "String html" : "<i class='fa fa-minus'></i> Delete"
-              }
-             ]
-            }
-           ]
-          }
-         ]
-        }
-       ]
-      }
-     ]
-    }
-   ]
-  }
- ]
-}
\ No newline at end of file
similarity index 92%
rename from Pman.Dialog.BAdminCoreImportUrl.bjs
rename to Pman.Dialog.BAdminImportUrl.bjs
index b5b0f2f..25dd667 100644 (file)
@@ -1,8 +1,8 @@
 {
- "name" : "Pman.Dialog.BAdminCoreImportUrl",
+ "name" : "Pman.Dialog.BAdminImportUrl",
  "parent" : "",
- "title" : "Pman.Dialog.BAdminCoreImportUrl",
- "path" : "/home/johns/gitlive/Pman.BAdmin/Pman.Dialog.BAdminCoreImportUrl.bjs",
+ "title" : "Pman.Dialog.BAdminImportUrl",
+ "path" : "/home/johns/gitlive/Pman.BAdmin/Pman.Dialog.BAdminImportUrl.bjs",
  "permname" : "",
  "modOrder" : "001",
  "strings" : {
diff --git a/Pman.Dialog.BAdminImportUrl.js b/Pman.Dialog.BAdminImportUrl.js
new file mode 100644 (file)
index 0000000..769da96
--- /dev/null
@@ -0,0 +1,130 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Dialog');
+
+Pman.Dialog.BAdminImportUrl= function() {}
+Roo.apply(Pman.Dialog.BAdminImportUrl.prototype, {
+
+ _strings : {
+  'c8c55f55be8cbe3141db7e26ab0a8b4e' :"Import URL",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  'e0aa021e21dddbd6d8cecec71e9cf564' :"OK",
+  'e6b391a8d2c4d45902a23a8b6585703d' :"URL"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+  var _this = this;
+  this.dialog = Roo.factory({
+    xtype : 'Modal',
+    title : _this._strings['c8c55f55be8cbe3141db7e26ab0a8b4e'] /* Import URL */,
+    xns : Roo.bootstrap,
+    '|xns' : 'Roo.bootstrap',
+    buttons : [
+     {
+      xtype : 'Button',
+      html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
+      weight : 'default',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.dialog.hide();
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     },
+     {
+      xtype : 'Button',
+      html : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
+      weight : 'primary',
+      listeners : {
+       click : function (_self, e)
+        {
+            _this.form.doAction("submit");
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap'
+     }
+    ],
+    items  : [
+     {
+      xtype : 'Form',
+      method : 'POST',
+      url : baseURL,
+      listeners : {
+       actioncomplete : function (_self, action)
+        {
+             if (action.type == 'setdata') {
+                if(_this.data.target){
+                    _this.form.url = baseURL + _this.data.target;
+                }\r
+               // _this.dialog.el.mask("Loading");\r
+               // if(_this.data.id*1 > 0)\r
+               //     this.load({ method: 'GET', params: { '_id' : _this.data.id }});\r
+               \r
+               return;\r
+            }\r
+            if (action.type == 'load') {\r
+         \r
+                return;\r
+            }\r
+            if (action.type =='submit') {\r
+            \r
+                //action.result.data\r
+                _this.dialog.hide();\r
+            //    Roo.log(_this.callback);\r
+                 if (_this.callback) {\r
+                    _this.callback.call(_this, action.result.data);\r
+                 }\r
+                 _this.form.reset();\r
+                 return;\r
+            }
+        },
+       render : function (_self)
+        {
+            _this.form = this;
+        }
+      },
+      xns : Roo.bootstrap,
+      '|xns' : 'Roo.bootstrap',
+      items  : [
+       {
+        xtype : 'Input',
+        fieldLabel : _this._strings['e6b391a8d2c4d45902a23a8b6585703d'] /* URL */,
+        labelAlign : 'left',
+        labelWidth : 1,
+        name : 'importUrl',
+        xns : Roo.bootstrap,
+        '|xns' : 'Roo.bootstrap'
+       }
+      ]
+     }
+    ]
+   }  );
+ }
+});
+Roo.apply(Pman.Dialog.BAdminImportUrl, Pman.Dialog.BAdminImportUrl.prototype);