move inbound email to core

This commit is contained in:
yuri
2015-05-06 10:40:22 +03:00
parent 2efa0c0ca7
commit 0b77c4cdfe
22 changed files with 71 additions and 72 deletions
@@ -20,7 +20,7 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
namespace Espo\Modules\Crm\Controllers;
namespace Espo\Controllers;
class InboundEmail extends \Espo\Core\Controllers\Record
{
@@ -18,9 +18,9 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
namespace Espo\Modules\Crm\Entities;
namespace Espo\Entities;
class InboundEmail extends \Espo\Core\ORM\Entity
{
@@ -10,7 +10,6 @@
"Call": "Call",
"Task": "Task",
"Case": "Case",
"InboundEmail": "Inbound Email",
"Document": "Document",
"Campaign": "Campaign",
"TargetList": "Target List"
@@ -26,7 +25,6 @@
"Call": "Calls",
"Task": "Tasks",
"Case": "Cases",
"InboundEmail": "Inbound Emails",
"Document": "Documents",
"Campaign": "Campaigns",
"TargetList": "Target Lists"
@@ -12,6 +12,7 @@
"ExternalAccount": "External Account",
"Extension": "Extension",
"Dashboard": "Dashboard",
"InboundEmail": "Inbound Email Account",
"Stream": "Stream",
"Import": "Import"
},
@@ -28,6 +29,7 @@
"ExternalAccount": "External Accounts",
"Extension": "Extensions",
"Dashboard": "Dashboard",
"InboundEmail": "Inbound Email Accounts",
"Stream": "Stream",
"Import": "Import Results"
},
@@ -43,7 +43,7 @@
}
},
"labels": {
"Create InboundEmail": "Create Inbound Email",
"Create InboundEmail": "Create Email Account",
"IMAP": "IMAP",
"Actions": "Actions",
"Main": "Main"
@@ -27,7 +27,7 @@
[
{"name":"monitoredFolders"},{"name":"password"}
],
[{"name": "testConnection", "customLabel": null, "view": "Crm:InboundEmail.Fields.TestConnection"}]
[{"name": "testConnection", "customLabel": null, "view": "InboundEmail.Fields.TestConnection"}]
]
},
{
@@ -1,8 +1,8 @@
{
"recordViews":{
"detail":"Crm:InboundEmail.Record.Detail",
"edit":"Crm:InboundEmail.Record.Edit",
"list":"Crm:InboundEmail.Record.List"
"detail":"InboundEmail.Record.Detail",
"edit":"InboundEmail.Record.Edit",
"list":"InboundEmail.Record.List"
},
"formDependency": {
"createCase": {
@@ -31,7 +31,7 @@
"type": "varchar",
"required": true,
"default": "INBOX",
"view": "Crm:InboundEmail.Fields.Folders"
"view": "InboundEmail.Fields.Folders"
},
"fetchData": {
"type": "text",
@@ -57,7 +57,7 @@
},
"targetUserPosition": {
"type": "enum",
"view": "Crm:InboundEmail.Fields.TargetUserPosition",
"view": "InboundEmail.Fields.TargetUserPosition",
"tooltip": true
},
"reply": {
@@ -2,6 +2,5 @@
"entity": true,
"layouts": false,
"tab": false,
"acl": false,
"module": "Crm"
"acl": false
}
@@ -20,7 +20,7 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
namespace Espo\Modules\Crm\Services;
namespace Espo\Services;
use \Espo\ORM\Entity;
@@ -17,20 +17,20 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
Espo.define('Controllers.InboundEmail', 'Controllers.Record', function (Dep) {
Espo.define('Crm:Controllers.InboundEmail', 'Controllers.Record', function (Dep) {
return Dep.extend({
checkAccess: function () {
if (this.getUser().isAdmin()) {
return true;
}
return false;
},
});
});
});
@@ -17,36 +17,36 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Fields.Folder', 'Views.Fields.Base', function (Dep) {
Espo.define('Views.InboundEmail.Fields.Folder', 'Views.Fields.Base', function (Dep) {
return Dep.extend({
editTemplate: 'crm:inbound-email.fields.folder.edit',
editTemplate: 'inbound-email.fields.folder.edit',
events: {
'click [data-action="selectFolder"]': function () {
'click [data-action="selectFolder"]': function () {
var self = this;
this.notify('Please wait...');
var data = {
host: this.model.get('host'),
port: this.model.get('port'),
ssl: this.model.get('ssl'),
username: this.model.get('username'),
};
if (this.model.has('password')) {
data.password = this.model.get('password');
} else {
if (!this.model.isNew()) {
data.password = this.model.get('password');
} else {
if (!this.model.isNew()) {
data.id = this.model.id;
}
}
$.ajax({
type: 'GET',
url: 'InboundEmail/action/getFolders',
@@ -56,23 +56,23 @@ Espo.define('Crm:Views.InboundEmail.Fields.Folder', 'Views.Fields.Base', functio
xhr.errorIsHandled = true;
},
}).done(function (folders) {
this.createView('modal', 'Crm:InboundEmail.Modals.SelectFolder', {
folders: folders
this.createView('modal', 'InboundEmail.Modals.SelectFolder', {
folders: folders
}, function (view) {
self.notify(false);
view.render();
self.listenToOnce(view, 'select', function (folder) {
self.listenToOnce(view, 'select', function (folder) {
view.close();
self.addFolder(folder);
self.addFolder(folder);
});
});
}.bind(this));
}
}.bind(this));
}
},
addFolder: function (folder) {
this.$element.val(folder);
},
});
});
});
@@ -17,24 +17,24 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Fields.Folders', 'Crm:Views.InboundEmail.Fields.Folder', function (Dep) {
Espo.define('Views.InboundEmail.Fields.Folders', 'Views.InboundEmail.Fields.Folder', function (Dep) {
return Dep.extend({
addFolder: function (folder) {
return Dep.extend({
addFolder: function (folder) {
var value = this.$element.val();
var folders = [];
var folders = [];
if (value != '') {
folders = value.split(',');
}
if (!~folders.indexOf(folder)) {
folders.push(folder);
folders.push(folder);
}
this.$element.val(folders.join(','));
},
});
});
});
@@ -19,7 +19,7 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Fields.TargetUserPosition', 'Views.Fields.Enum', function (Dep) {
Espo.define('Views.InboundEmail.Fields.TargetUserPosition', 'Views.Fields.Enum', function (Dep) {
return Dep.extend({
@@ -27,7 +27,7 @@ Espo.define('Crm:Views.InboundEmail.Fields.TargetUserPosition', 'Views.Fields.En
Dep.prototype.setup.call(this);
this.translatedOptions = {
'': '--' + this.translate('All') + '--'
'': '--' + this.translate('All') + '--'
};
this.params.options = [''];
@@ -19,7 +19,7 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Fields.TestConnection', 'Views.EmailAccount.Fields.TestConnection', function (Dep) {
Espo.define('Views.InboundEmail.Fields.TestConnection', 'Views.EmailAccount.Fields.TestConnection', function (Dep) {
return Dep.extend({
@@ -17,31 +17,31 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Modals.SelectFolder', 'Views.Modal', function (Dep) {
Espo.define('Views.InboundEmail.Modals.SelectFolder', 'Views.Modal', function (Dep) {
return Dep.extend({
cssName: 'select-folder-modal',
template: 'crm:inbound-email.modals.select-folder',
template: 'inbound-email.modals.select-folder',
data: function () {
return {
folders: this.options.folders,
};
},
events: {
'click button[data-action="select"]': function (e) {
var value = $(e.currentTarget).data('value');
this.trigger('select', value);
},
},
setup: function () {
this.buttons = [
{
name: 'cancel',
@@ -49,8 +49,8 @@ Espo.define('Crm:Views.InboundEmail.Modals.SelectFolder', 'Views.Modal', functio
onClick: function (dialog) {
dialog.close();
}
}
];
}
];
},
@@ -19,7 +19,7 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Record.Detail', 'Views.Record.Detail', function (Dep) {
Espo.define('Views.InboundEmail.Record.Detail', 'Views.Record.Detail', function (Dep) {
return Dep.extend({
@@ -19,7 +19,7 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Record.Edit', ['Views.Record.Edit', 'Crm:Views.InboundEmail.Record.Detail'], function (Dep, Detail) {
Espo.define('Views.InboundEmail.Record.Edit', ['Views.Record.Edit', 'Views.InboundEmail.Record.Detail'], function (Dep, Detail) {
return Dep.extend({
@@ -30,7 +30,7 @@ Espo.define('Crm:Views.InboundEmail.Record.Edit', ['Views.Record.Edit', 'Crm:Vie
},
afterRender: function () {
Dep.prototype.afterRender.call(this);
Dep.prototype.afterRender.call(this);
Detail.prototype.initSslFieldListening.call(this);
},
@@ -19,7 +19,7 @@
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Crm:Views.InboundEmail.Record.List', 'Views.Record.List', function (Dep) {
Espo.define('Views.InboundEmail.Record.List', 'Views.Record.List', function (Dep) {
return Dep.extend({