PM 940 "ProcessMaker" Email Server Frontend" SOLVED

> Se agrega marcas para el modulo Email Server para la version de la Comunidad.
This commit is contained in:
Luis Fernando Saisa Lopez
2015-01-15 17:01:37 -04:00
parent 5d0f35ced3
commit 40178fdc1f
9 changed files with 163 additions and 45 deletions

View File

@@ -314,40 +314,50 @@ function database_upgrade($command, $args) {
}
}
//There records in table "EMAIL_SERVER"
$criteria = new Criteria("workflow");
//There records in table "EMAIL_SERVER"
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(EmailServerPeer::MESS_UID);
$criteria->setOffset(0);
$criteria->setLimit(1);
$criteria->addSelectColumn(EmailServerPeer::MESS_UID);
$criteria->setOffset(0);
$criteria->setLimit(1);
$rsCriteria = EmailServerPeer::doSelectRS($criteria);
$rsCriteria = EmailServerPeer::doSelectRS($criteria);
if (!$rsCriteria->next()) {
//Insert the first record
$emailConfiguration = System::getEmailConfiguration();
if (!$rsCriteria->next()) {
//Insert the first record
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
if (count($emailConfiguration) > 0) {
$arrayData = array();
$emailConfiguration = System::getEmailConfiguration();
$arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];
$arrayData["MESS_SERVER"] = $emailConfiguration["MESS_SERVER"];
$arrayData["MESS_PORT"] = (int)($emailConfiguration["MESS_PORT"]);
$arrayData["MESS_RAUTH"] = (int)($emailConfiguration["MESS_RAUTH"]);
$arrayData["MESS_ACCOUNT"] = $emailConfiguration["MESS_ACCOUNT"];
$arrayData["MESS_PASSWORD"] = $emailConfiguration["MESS_PASSWORD"];
$arrayData["MESS_FROM_MAIL"] = $emailConfiguration["MESS_FROM_MAIL"];
$arrayData["MESS_FROM_NAME"] = $emailConfiguration["MESS_FROM_NAME"];
$arrayData["SMTPSECURE"] = $emailConfiguration["SMTPSecure"];
$arrayData["MESS_TRY_SEND_INMEDIATLY"] = (int)($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]);
$arrayData["MAIL_TO"] = $emailConfiguration["MAIL_TO"];
$arrayData["MESS_DEFAULT"] = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;
if (count($emailConfiguration) > 0) {
$arrayData = array();
$emailSever = new \ProcessMaker\BusinessModel\EmailServer();
$arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];
$arrayData["MESS_SERVER"] = $emailConfiguration["MESS_SERVER"];
$arrayData["MESS_PORT"] = (int)($emailConfiguration["MESS_PORT"]);
$arrayData["MESS_RAUTH"] = (int)($emailConfiguration["MESS_RAUTH"]);
$arrayData["MESS_ACCOUNT"] = $emailConfiguration["MESS_ACCOUNT"];
$arrayData["MESS_PASSWORD"] = $emailConfiguration["MESS_PASSWORD"];
$arrayData["MESS_FROM_MAIL"] = $emailConfiguration["MESS_FROM_MAIL"];
$arrayData["MESS_FROM_NAME"] = $emailConfiguration["MESS_FROM_NAME"];
$arrayData["SMTPSECURE"] = $emailConfiguration["SMTPSecure"];
$arrayData["MESS_TRY_SEND_INMEDIATLY"] = (int)($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]);
$arrayData["MAIL_TO"] = $emailConfiguration["MAIL_TO"];
$arrayData["MESS_DEFAULT"] = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;
$emailSever->create($arrayData);
}
}
$arrayData = $emailSever->create($arrayData);
} else {
/*----------------------------------********---------------------------------*/
if (true) {
//
} else {
/*----------------------------------********---------------------------------*/
$arrayData = $emailSever->create2(array("MESS_ENGINE" => "MAIL"));
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
}
}
}
function delete_app_from_table($con, $tableName, $appUid, $col="APP_UID") {

View File

@@ -224,6 +224,17 @@ class Installer
fclose($fp);
$this->setPartner();
$this->setAdmin();
/*----------------------------------********---------------------------------*/
if (true) {
//
} else {
/*----------------------------------********---------------------------------*/
$querySql = ("INSERT INTO EMAIL_SERVER(MESS_ENGINE) VALUES('MAIL')");
$this->run_query($querySql);
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
}
return $test;
}

View File

@@ -85,7 +85,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
* The value for the smtpsecure field.
* @var string
*/
protected $smtpsecure = '';
protected $smtpsecure = 'No';
/**
* The value for the mess_try_send_inmediatly field.
@@ -475,7 +475,7 @@ abstract class BaseEmailServer extends BaseObject implements Persistent
$v = (string) $v;
}
if ($this->smtpsecure !== $v || $v === '') {
if ($this->smtpsecure !== $v || $v === 'No') {
$this->smtpsecure = $v;
$this->modifiedColumns[] = EmailServerPeer::SMTPSECURE;
}

View File

@@ -4204,7 +4204,7 @@
<column name="MESS_PASSWORD" type="VARCHAR" size="256" required="true" default="" />
<column name="MESS_FROM_MAIL" type="VARCHAR" size="256" required="true" default="" />
<column name="MESS_FROM_NAME" type="VARCHAR" size="256" required="true" default="" />
<column name="SMTPSECURE" type="VARCHAR" size="3" required="true" default="" />
<column name="SMTPSECURE" type="VARCHAR" size="3" required="true" default="No" />
<column name="MESS_TRY_SEND_INMEDIATLY" type="INTEGER" required="true" default="0" />
<column name="MAIL_TO" type="VARCHAR" size="256" required="true" default="" />
<column name="MESS_DEFAULT" type="INTEGER" required="true" default="0" />

View File

@@ -784,6 +784,16 @@ class Installer extends Controller
'" . mysql_real_escape_string( serialize( array ('LANG' => 'en','STATUS' => 'active'
) ) ) . "'
)" );
/*----------------------------------********---------------------------------*/
if (true) {
//
} else {
/*----------------------------------********---------------------------------*/
$this->mysqlQuery("INSERT INTO EMAIL_SERVER(MESS_ENGINE) VALUES('MAIL')");
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
}
// Change admin user
@@ -927,7 +937,7 @@ class Installer extends Controller
return $info;
}
}
$this->installLog( G::LoadTranslation('ID_INDEX_FILE_UPDATED', SYS_LANG, Array($indexFileUpdated, $sysConf['default_lang'],$sysConf['default_skin'])));
$this->installLog( G::LoadTranslation('ID_INSTALL_SUCESS') );
@@ -1080,6 +1090,16 @@ class Installer extends Controller
'" . addslashes( serialize( array ('LANG' => 'en','STATUS' => 'active'
) ) ) . "'
)" );
/*----------------------------------********---------------------------------*/
if (true) {
//
} else {
/*----------------------------------********---------------------------------*/
$this->mssqlQuery("INSERT INTO EMAIL_SERVER(MESS_ENGINE) VALUES('MAIL')");
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
}
//change admin user

View File

@@ -2427,7 +2427,7 @@ CREATE TABLE `EMAIL_SERVER`
`MESS_PASSWORD` VARCHAR(256) default '' NOT NULL,
`MESS_FROM_MAIL` VARCHAR(256) default '' NOT NULL,
`MESS_FROM_NAME` VARCHAR(256) default '' NOT NULL,
`SMTPSECURE` VARCHAR(3) default 'NO' NOT NULL,
`SMTPSECURE` VARCHAR(3) default 'No' NOT NULL,
`MESS_TRY_SEND_INMEDIATLY` INTEGER default 0 NOT NULL,
`MAIL_TO` VARCHAR(256) default '' NOT NULL,
`MESS_DEFAULT` INTEGER default 0 NOT NULL,

View File

@@ -36,7 +36,7 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1 ) {
//settings options
// $G_TMP_MENU->AddIdRawOption('LOGO', 'uplogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png', '', 'settings');
$G_TMP_MENU->AddIdRawOption('LOGO', '../admin/pmLogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png','', 'settings');
$G_TMP_MENU->AddIdRawOption("EMAILS", "../emailServer/emailServer", G::LoadTranslation("ID_EMAIL_SERVER_TITLE"), "icon-email-settings1.png", "", "settings");
$G_TMP_MENU->AddIdRawOption("EMAIL_SERVER", "../emailServer/emailServer", G::LoadTranslation("ID_EMAIL_SERVER_TITLE"), "icon-email-settings1.png", "", "settings");
$G_TMP_MENU->AddIdRawOption('CALENDAR', 'calendarList', G::LoadTranslation('ID_CALENDAR'), 'icon-calendar.png', '', 'settings' );
//if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1)
// $G_TMP_MENU->AddIdRawOption('CASES_LIST_SETUP', '../cases/casesListSetup', G::LoadTranslation('ID_CASES_LIST_SETUP'), "",'', 'settings');

View File

@@ -788,6 +788,60 @@ class EmailServer
}
}
/**
* Create Email Server by data
*
* @param array $arrayData Data
*
* return array Return data of the new Email Server created
*/
public function create2(array $arrayData)
{
try {
//Create
$cnn = \Propel::getConnection("workflow");
try {
$emailServer = new \EmailServer();
$emailServer->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
$emailServerUid = \ProcessMaker\Util\Common::generateUID();
$emailServer->setMessUid($emailServerUid);
if ($emailServer->validate()) {
$cnn->begin();
$result = $emailServer->save();
$cnn->commit();
if (isset($arrayData["MESS_DEFAULT"]) && (int)($arrayData["MESS_DEFAULT"]) == 1) {
$this->setEmailServerDefaultByUid($emailServerUid);
}
//Return
return $this->getEmailServer($emailServerUid);
} else {
$msg = "";
foreach ($emailServer->getValidationFailures() as $validationFailure) {
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
}
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
}
} catch (\Exception $e) {
$cnn->rollback();
throw $e;
}
} catch (\Exception $e) {
throw $e;
}
}
/**
* Update Email Server
*

View File

@@ -60,7 +60,7 @@ emailServer.application = {
smtpSecure: smtpSecure,
sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0,
mailTo: Ext.getCmp("txtMailTo").getValue(),
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0,
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0
};
} else {
//MAIL
@@ -72,7 +72,7 @@ emailServer.application = {
fromName: Ext.getCmp("txtFromName").getValue(),
sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0,
mailTo: Ext.getCmp("txtMailTo").getValue(),
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0,
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0
};
}
break;
@@ -98,7 +98,7 @@ emailServer.application = {
smtpSecure: smtpSecure,
sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0,
mailTo: Ext.getCmp("txtMailTo").getValue(),
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0,
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0
};
} else {
//MAIL
@@ -111,7 +111,7 @@ emailServer.application = {
fromName: Ext.getCmp("txtFromName").getValue(),
sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0,
mailTo: Ext.getCmp("txtMailTo").getValue(),
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0,
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0
};
}
break;
@@ -144,7 +144,7 @@ emailServer.application = {
smtpSecure: smtpSecure,
sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0,
mailTo: Ext.getCmp("txtMailTo").getValue(),
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0,
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0
};
} else {
//MAIL
@@ -156,7 +156,7 @@ emailServer.application = {
fromName: Ext.getCmp("txtFromName").getValue(),
sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0,
mailTo: Ext.getCmp("txtMailTo").getValue(),
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0,
emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0
};
}
break;
@@ -287,7 +287,6 @@ emailServer.application = {
emailServerSetMailTo(Ext.getCmp("chkSendTestMail").checked);
Ext.getCmp("txtMailTo").setValue(record.get("MAIL_TO"));
Ext.getCmp("chkEmailServerDefault").setValue((parseInt(record.get("MESS_DEFAULT")) == 1)? true : false);
winData.setTitle(_("ID_EMAIL_SERVER_EDIT"));
@@ -883,7 +882,7 @@ emailServer.application = {
if (typeof(record) != "undefined") {
Ext.MessageBox.confirm(
_("ID_CONFIRM"),
"Do you want to delete the Email Server?",
_("ID_EMAIL_SERVER_DELETE_WARNING_MESSAGE"),
function (btn)
{
if (btn == "yes") {
@@ -996,7 +995,7 @@ emailServer.application = {
{id: "MESS_UID", dataIndex: "MESS_UID", hidden: true, header: "uid_emailServer", width: 0, hideable: false, align: "left"},
{id: "MESS_ENGINE", dataIndex: "MESS_ENGINE", hidden: false, header: _("EMAIL_ENGINE"), width: 80, hideable: true, align: "left"},
{id: "MESS_SERVER", dataIndex: "MESS_SERVER", hidden: false, header: _("ID_SERVER"), width: 150, hideable: true, align: "center", renderer: rendererMessServer},
{id: "MESS_PORT", dataIndex: "MESS_PORT", hidden: false, header: _("ID_EMAIL_SERVER_PORT"), width: 50, hideable: true, align: "center", renderer: rendererMessPort}, //lsl - viene de (X)
{id: "MESS_PORT", dataIndex: "MESS_PORT", hidden: false, header: _("ID_EMAIL_SERVER_PORT"), width: 50, hideable: true, align: "center", renderer: rendererMessPort},
{id: "MESS_RAUTH", dataIndex: "MESS_RAUTH", hidden: true, header: _("REQUIRE_AUTHENTICATION"), width: 50, hideable: false, align: "left"},
{id: "MESS_ACCOUNT", dataIndex: "MESS_ACCOUNT", hidden: false, header: _("ID_EMAIL_SERVER_ACCOUNT_FROM"), width: 130, hideable: true, align: "left"},
{id: "MESS_PASSWORD", dataIndex: "MESS_PASSWORD", hidden: true, header: _("ID_PASSWORD"), width: 130, hideable: false, align: "left"},
@@ -1005,7 +1004,7 @@ emailServer.application = {
{id: "SMTPSECURE", dataIndex: "SMTPSECURE", hidden: false, header: _("USE_SECURE_CONNECTION"), width: 140, hideable: true, align: "center", renderer: rendererMessSmtpSecure},
{id: "MESS_TRY_SEND_INMEDIATLY", dataIndex: "MESS_TRY_SEND_INMEDIATLY", hidden: true, header: _("SEND_TEST_MAIL"), width: 50, hideable: false, align: "left"},
{id: "MAIL_TO", dataIndex: "MAIL_TO", hidden: false, header: _("MAIL_TO"), width: 150, hideable: true, align: "left"},
{id: "MESS_DEFAULT", dataIndex: "MESS_DEFAULT", hidden: false, header: _("ID_EMAIL_SERVER_DEFAULT"), width: 50, hideable: true, align: "center", renderer: rendererMessDefault} //lsl - viene de (Y)
{id: "MESS_DEFAULT", dataIndex: "MESS_DEFAULT", hidden: false, header: _("ID_EMAIL_SERVER_DEFAULT"), width: 50, hideable: true, align: "center", renderer: rendererMessDefault}
]
});
@@ -1025,6 +1024,21 @@ emailServer.application = {
}
});
var arrayAux1 = [];
/*----------------------------------********---------------------------------*/
arrayAux1.push(btnNew);
arrayAux1.push("-");
/*----------------------------------********---------------------------------*/
arrayAux1.push(btnEdit);
/*----------------------------------********---------------------------------*/
arrayAux1.push(btnDelete);
arrayAux1.push("->");
arrayAux1.push(txtSearch);
arrayAux1.push(btnTextClear);
arrayAux1.push(btnSearch);
/*----------------------------------********---------------------------------*/
var grdpnlMain = new Ext.grid.GridPanel({
id: "grdpnlMain",
@@ -1037,9 +1051,11 @@ emailServer.application = {
enableColumnResize: true,
enableHdMenu: true,
tbar: [btnNew, "-", btnEdit, btnDelete, "->", txtSearch, btnTextClear, btnSearch],
tbar: arrayAux1,
/*----------------------------------********---------------------------------*/
bbar: pagingData,
/*----------------------------------********---------------------------------*/
title: _("ID_EMAIL_SERVER_TITLE"),
border: false,
@@ -1061,10 +1077,17 @@ emailServer.application = {
}
});
var arrayAux2 = [];
arrayAux2.push(btnEdit);
/*----------------------------------********---------------------------------*/
arrayAux2.push(btnDelete);
/*----------------------------------********---------------------------------*/
var mnuContext = new Ext.menu.Menu({
id: "mnuContext",
items: [btnEdit, btnDelete]
items: arrayAux2
});
//Initialize events