BUG 8919 La opcion "user experience" se puede aplicar al usuario Admin

- The validation doesn't consider the enter key when select a value
- Modify the logic of the validation
This commit is contained in:
Julio Cesar Laura
2012-06-18 18:49:24 -04:00
parent c440b2d30d
commit 1eee9e85d9
2 changed files with 188 additions and 184 deletions

View File

@@ -24,7 +24,7 @@
*/ */
class adminProxy extends HttpProxyController class adminProxy extends HttpProxyController
{ {
public function saveSystemConf($httpData) public function saveSystemConf($httpData)
{ {
G::loadClass('system'); G::loadClass('system');
@@ -34,7 +34,7 @@ class adminProxy extends HttpProxyController
if (!file_exists($envFile) ) { // if ini file doesn't exists if (!file_exists($envFile) ) { // if ini file doesn't exists
if (!is_writable(PATH_CONFIG)) { if (!is_writable(PATH_CONFIG)) {
throw new Exception('The enviroment config directory is not writable. <br/>Please give write permission to directory: /workflow/engine/config'); throw new Exception('The enviroment config directory is not writable. <br/>Please give write permission to directory: /workflow/engine/config');
} }
$content = ";\r\n"; $content = ";\r\n";
$content .= "; ProcessMaker System Bootstrap Configuration\r\n"; $content .= "; ProcessMaker System Bootstrap Configuration\r\n";
@@ -44,7 +44,7 @@ class adminProxy extends HttpProxyController
} }
else { else {
if (!is_writable($envFile)) { if (!is_writable($envFile)) {
throw new Exception('The enviroment ini file file is not writable. <br/>Please give write permission to file: /workflow/engine/config/env.ini'); throw new Exception('The enviroment ini file file is not writable. <br/>Please give write permission to file: /workflow/engine/config/env.ini');
} }
} }
@@ -71,7 +71,7 @@ class adminProxy extends HttpProxyController
$updatedConf['memory_limit'] = $httpData->memory_limit; $updatedConf['memory_limit'] = $httpData->memory_limit;
} }
if ($updateRedirector) { if ($updateRedirector) {
if (!file_exists(PATH_HTML . 'index.html')) { if (!file_exists(PATH_HTML . 'index.html')) {
throw new Exception('The index.html file is not writable on workflow/public_html directory.'); throw new Exception('The index.html file is not writable on workflow/public_html directory.');
@@ -145,13 +145,13 @@ class adminProxy extends HttpProxyController
function calendarValidate($httpData) { function calendarValidate($httpData) {
$httpData=array_unique((array)$httpData); $httpData=array_unique((array)$httpData);
$message = ''; $message = '';
$oldName = isset($_POST['oldName'])? $_POST['oldName']:''; $oldName = isset($_POST['oldName'])? $_POST['oldName']:'';
switch ($_POST['action']){ switch ($_POST['action']){
case 'calendarName': case 'calendarName':
require_once ('classes/model/CalendarDefinition.php'); require_once ('classes/model/CalendarDefinition.php');
$oCalendar = new CalendarDefinition(); $oCalendar = new CalendarDefinition();
$aCalendars = $oCalendar->getCalendarList(false,true); $aCalendars = $oCalendar->getCalendarList(false,true);
$aCalendarDefinitions = end($aCalendars); $aCalendarDefinitions = end($aCalendars);
foreach($aCalendarDefinitions as $aDefinitions) { foreach($aCalendarDefinitions as $aDefinitions) {
@@ -162,7 +162,7 @@ class adminProxy extends HttpProxyController
} }
if ($aDefinitions['CALENDAR_NAME'] != $_POST['name']){ if ($aDefinitions['CALENDAR_NAME'] != $_POST['name']){
$validated = true; $validated = true;
} }
else { else {
if ($aDefinitions['CALENDAR_NAME'] != $oldName) { if ($aDefinitions['CALENDAR_NAME'] != $oldName) {
$validated = false; $validated = false;
@@ -182,28 +182,29 @@ class adminProxy extends HttpProxyController
function uxGroupUpdate($httpData) function uxGroupUpdate($httpData)
{ {
require_once 'classes/model/Groupwf.php'; G::LoadClass('groups');
$data = (array) G::json_decode($httpData->groups); $groups = new Groups();
$users = $groups->getUsersOfGroup($httpData->GRP_UID);
$group = GroupwfPeer::retrieveByPK($data['GRP_UID']); $success = true;
$group->setGrpUx($data['GRP_UX']); $usersAdmin = '';
$group->save(); foreach ($users as $user) {
if ($user['USR_ROLE'] == 'PROCESSMAKER_ADMIN' && ($httpData->GRP_UX == 'SIMPLIFIED' || $httpData->GRP_UX == 'SINGLE')) {
$g = new Groupwf(); $success = false;
//$row = $group->toArray(BasePeer::TYPE_FIELDNAME); $usersAdmin .= $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME'] . ', ';
$row = $g->Load($group->getGrpUid()); }
$row['CON_VALUE'] = $row['GRP_TITLE']; }
if ($success) {
$uxList = self::getUxTypesList(); $group = GroupwfPeer::retrieveByPK($httpData->GRP_UID);
$row['GRP_UX'] = $uxList[$group->getGrpUx()]; $group->setGrpUx($httpData->GRP_UX);
$group->save();
return array('success' => true, 'message'=>'done', 'groups'=>$row); }
return array('success' => $success, 'users' => $usersAdmin);
} }
function getUxTypesList($type = 'assoc') function getUxTypesList($type = 'assoc')
{ {
$list = array(); $list = array();
if ($type == 'assoc') { if ($type == 'assoc') {
$list = array( $list = array(
'NORMAL' => 'Normal', 'NORMAL' => 'Normal',
@@ -224,11 +225,11 @@ class adminProxy extends HttpProxyController
return $list; return $list;
} }
function calendarSave() function calendarSave()
{ {
//{ $_POST['BUSINESS_DAY'] //{ $_POST['BUSINESS_DAY']
$businessDayArray = G::json_decode($_POST['BUSINESS_DAY']); $businessDayArray = G::json_decode($_POST['BUSINESS_DAY']);
$businessDayFixArray = array(); $businessDayFixArray = array();
for($i=0;$i<sizeof($businessDayArray);$i++) { for($i=0;$i<sizeof($businessDayArray);$i++) {
$businessDayFixArray[$i+1]['CALENDAR_BUSINESS_DAY'] = $businessDayArray[$i]->CALENDAR_BUSINESS_DAY; $businessDayFixArray[$i+1]['CALENDAR_BUSINESS_DAY'] = $businessDayArray[$i]->CALENDAR_BUSINESS_DAY;
$businessDayFixArray[$i+1]['CALENDAR_BUSINESS_START'] = $businessDayArray[$i]->CALENDAR_BUSINESS_START; $businessDayFixArray[$i+1]['CALENDAR_BUSINESS_START'] = $businessDayArray[$i]->CALENDAR_BUSINESS_START;
@@ -236,57 +237,57 @@ class adminProxy extends HttpProxyController
} }
$_POST['BUSINESS_DAY'] = $businessDayFixArray; $_POST['BUSINESS_DAY'] = $businessDayFixArray;
//} //}
//{ $_POST['CALENDAR_WORK_DAYS'] //{ $_POST['CALENDAR_WORK_DAYS']
$calendarWorkDaysArray = G::json_decode($_POST['CALENDAR_WORK_DAYS']); $calendarWorkDaysArray = G::json_decode($_POST['CALENDAR_WORK_DAYS']);
$calendarWorkDaysFixArray = array(); $calendarWorkDaysFixArray = array();
for($i=0;$i<sizeof($calendarWorkDaysArray);$i++) { for($i=0;$i<sizeof($calendarWorkDaysArray);$i++) {
$calendarWorkDaysFixArray[$i] = $calendarWorkDaysArray[$i].""; $calendarWorkDaysFixArray[$i] = $calendarWorkDaysArray[$i]."";
} }
$_POST['CALENDAR_WORK_DAYS'] = $calendarWorkDaysFixArray; $_POST['CALENDAR_WORK_DAYS'] = $calendarWorkDaysFixArray;
//} //}
//{ $_POST['HOLIDAY'] //{ $_POST['HOLIDAY']
$holidayArray = G::json_decode($_POST['HOLIDAY']); $holidayArray = G::json_decode($_POST['HOLIDAY']);
$holidayFixArray = array(); $holidayFixArray = array();
for($i=0;$i<sizeof($holidayArray);$i++) { for($i=0;$i<sizeof($holidayArray);$i++) {
$holidayFixArray[$i+1]['CALENDAR_HOLIDAY_NAME'] = $holidayArray[$i]->CALENDAR_HOLIDAY_NAME; $holidayFixArray[$i+1]['CALENDAR_HOLIDAY_NAME'] = $holidayArray[$i]->CALENDAR_HOLIDAY_NAME;
$holidayFixArray[$i+1]['CALENDAR_HOLIDAY_START'] = $holidayArray[$i]->CALENDAR_HOLIDAY_START; $holidayFixArray[$i+1]['CALENDAR_HOLIDAY_START'] = $holidayArray[$i]->CALENDAR_HOLIDAY_START;
$holidayFixArray[$i+1]['CALENDAR_HOLIDAY_END'] = $holidayArray[$i]->CALENDAR_HOLIDAY_END; $holidayFixArray[$i+1]['CALENDAR_HOLIDAY_END'] = $holidayArray[$i]->CALENDAR_HOLIDAY_END;
} }
$_POST['HOLIDAY'] = $holidayFixArray; $_POST['HOLIDAY'] = $holidayFixArray;
//} //}
//[ CALENDAR_STATUS BUSINESS_DAY_STATUS HOLIDAY_STATUS //[ CALENDAR_STATUS BUSINESS_DAY_STATUS HOLIDAY_STATUS
if($_POST['BUSINESS_DAY_STATUS']=="INACTIVE") { if($_POST['BUSINESS_DAY_STATUS']=="INACTIVE") {
unset($_POST['BUSINESS_DAY_STATUS']); unset($_POST['BUSINESS_DAY_STATUS']);
} }
if($_POST['HOLIDAY_STATUS']=="INACTIVE") { if($_POST['HOLIDAY_STATUS']=="INACTIVE") {
unset($_POST['HOLIDAY_STATUS']); unset($_POST['HOLIDAY_STATUS']);
} }
//] //]
$form = $_POST; $form = $_POST;
G::LoadClass('calendar'); G::LoadClass('calendar');
$calendarObj=new calendar(); $calendarObj=new calendar();
$calendarObj->saveCalendarInfo($form); $calendarObj->saveCalendarInfo($form);
echo "{success: true}"; echo "{success: true}";
} }
/** /**
* getting the kind of the authentication source * getting the kind of the authentication source
* @param object $params * @param object $params
* @return array $data * @return array $data
*/ */
function testingOption($params){ function testingOption($params){
$data['success'] = true; $data['success'] = true;
$data['optionAuthS'] = $params->optionAuthS; $data['optionAuthS'] = $params->optionAuthS;
return $data; return $data;
}// end testingOption function }// end testingOption function
/** /**
* saving the authentication source data * saving the authentication source data
* @param object $params * @param object $params
@@ -333,19 +334,19 @@ class adminProxy extends HttpProxyController
$RBAC->updateAuthSource($aFields); $RBAC->updateAuthSource($aFields);
} }
$data=array(); $data=array();
$data['success'] = true; $data['success'] = true;
return $data; return $data;
}//end saveAuthSoruces function }//end saveAuthSoruces function
/** /**
* for Test email configuration * for Test email configuration
* @autor Alvaro <alvaro@colosa.com> * @autor Alvaro <alvaro@colosa.com>
*/ */
public function testConnection($params) { public function testConnection($params) {
G::LoadClass('net'); G::LoadClass('net');
G::LoadThirdParty('phpmailer', 'class.smtp'); G::LoadThirdParty('phpmailer', 'class.smtp');
if ($_POST['typeTest'] == 'MAIL') if ($_POST['typeTest'] == 'MAIL')
{ {
define("SUCCESSFUL", 'SUCCESSFUL'); define("SUCCESSFUL", 'SUCCESSFUL');
@@ -361,41 +362,41 @@ class adminProxy extends HttpProxyController
$_POST['MESS_PASSWORD'] = ''; $_POST['MESS_PASSWORD'] = '';
$_POST['TO'] = $mail_to; $_POST['TO'] = $mail_to;
$_POST['SMTPAuth'] = true; $_POST['SMTPAuth'] = true;
try { try {
$resp = $this->sendTestMail(); $resp = $this->sendTestMail();
} catch (Exception $error) { } catch (Exception $error) {
$resp = new stdclass(); $resp = new stdclass();
$reps->status = false; $reps->status = false;
$resp->msg = $error->getMessage(); $resp->msg = $error->getMessage();
} }
if($resp->status){ if($resp->status){
echo '{"sendMail":true, "msg":"' . $resp->msg . '"}'; echo '{"sendMail":true, "msg":"' . $resp->msg . '"}';
} else { } else {
echo '{"sendMail":false, "msg":"' . $resp->msg . '"}'; echo '{"sendMail":false, "msg":"' . $resp->msg . '"}';
} }
die; die;
} }
$step = $_POST['step']; $step = $_POST['step'];
$server = $_POST['server']; $server = $_POST['server'];
$user = $_POST['user']; $user = $_POST['user'];
$passwd = $_POST['passwd']; $passwd = $_POST['passwd'];
$passwdHide = $_POST['passwdHide']; $passwdHide = $_POST['passwdHide'];
if (trim($passwdHide) != '') { if (trim($passwdHide) != '') {
$passwd = $passwdHide; $passwd = $passwdHide;
$passwdHide = ''; $passwdHide = '';
} }
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT'); $passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos( $passwdDec, 'hash:' ) !== false) { if (strpos( $passwdDec, 'hash:' ) !== false) {
list($hash, $pass) = explode(":", $passwdDec); list($hash, $pass) = explode(":", $passwdDec);
$_POST['passwd'] = $pass; $_POST['passwd'] = $pass;
} }
$port = $_POST['port']; $port = $_POST['port'];
$auth_required = $_POST['req_auth']; $auth_required = $_POST['req_auth'];
$UseSecureCon = $_POST['UseSecureCon']; $UseSecureCon = $_POST['UseSecureCon'];
@@ -403,82 +404,82 @@ class adminProxy extends HttpProxyController
$Mailto = $_POST['eMailto']; $Mailto = $_POST['eMailto'];
$SMTPSecure = $_POST['UseSecureCon']; $SMTPSecure = $_POST['UseSecureCon'];
$Server = new NET($server); $Server = new NET($server);
$smtp = new SMTP; $smtp = new SMTP;
$timeout = 10; $timeout = 10;
$hostinfo = array(); $hostinfo = array();
$srv=$_POST['server']; $srv=$_POST['server'];
switch ($step) { switch ($step) {
case 1: case 1:
$this->success = $Server->getErrno() == 0; $this->success = $Server->getErrno() == 0;
$this->msg = $this->result ? 'success' : $Server->error; $this->msg = $this->result ? 'success' : $Server->error;
break; break;
case 2: case 2:
$Server->scannPort($port); $Server->scannPort($port);
$this->success = $Server->getErrno() == 0; //'Successfull'.$smtp->status; $this->success = $Server->getErrno() == 0; //'Successfull'.$smtp->status;
$this->msg = $this->result ? '' : $Server->error; $this->msg = $this->result ? '' : $Server->error;
break; break;
case 3: //try to connect to host case 3: //try to connect to host
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) { if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$server = $hostinfo[1]; $server = $hostinfo[1];
$port = $hostinfo[2]; $port = $hostinfo[2];
} }
else { else {
$host = $srv; $host = $srv;
} }
$tls = (strtoupper($SMTPSecure) == 'tls'); $tls = (strtoupper($SMTPSecure) == 'tls');
$ssl = (strtoupper($SMTPSecure) == 'ssl'); $ssl = (strtoupper($SMTPSecure) == 'ssl');
$this->success = $smtp->Connect(($ssl ? 'ssl://':'').$server, $port, $timeout); $this->success = $smtp->Connect(($ssl ? 'ssl://':'').$server, $port, $timeout);
$this->msg = $this->result ? '' : $Server->error; $this->msg = $this->result ? '' : $Server->error;
break; break;
case 4: //try login to host case 4: //try login to host
if($auth_required == 'true') { if($auth_required == 'true') {
try { try {
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) { if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$server = $hostinfo[1]; $server = $hostinfo[1];
$port = $hostinfo[2]; $port = $hostinfo[2];
} }
else { else {
$server = $srv; $server = $srv;
} }
if (strtoupper($UseSecureCon)=='TLS') { if (strtoupper($UseSecureCon)=='TLS') {
$tls = 'tls'; $tls = 'tls';
} }
if (strtoupper($UseSecureCon)=='SSL') { if (strtoupper($UseSecureCon)=='SSL') {
$tls = 'ssl'; $tls = 'ssl';
} }
$tls = (strtoupper($UseSecureCon) == 'tls'); $tls = (strtoupper($UseSecureCon) == 'tls');
$ssl = (strtoupper($UseSecureCon) == 'ssl'); $ssl = (strtoupper($UseSecureCon) == 'ssl');
$server = $_POST['server']; $server = $_POST['server'];
if(strtoupper($UseSecureCon) == 'SSL') { if(strtoupper($UseSecureCon) == 'SSL') {
$resp = $smtp->Connect(('ssl://').$server, $port, $timeout); $resp = $smtp->Connect(('ssl://').$server, $port, $timeout);
} }
else { else {
$resp = $smtp->Connect($server, $port, $timeout); $resp = $smtp->Connect($server, $port, $timeout);
} }
if ($resp) { if ($resp) {
$hello = $_SERVER['SERVER_NAME']; $hello = $_SERVER['SERVER_NAME'];
$smtp->Hello($hello); $smtp->Hello($hello);
if (strtoupper($UseSecureCon) == 'TLS') { if (strtoupper($UseSecureCon) == 'TLS') {
$smtp->Hello($hello); $smtp->Hello($hello);
} }
if( $smtp->Authenticate($user, $passwd) ) { if( $smtp->Authenticate($user, $passwd) ) {
$this->success = true; $this->success = true;
} }
else { else {
$this->success = false; $this->success = false;
@@ -492,7 +493,7 @@ class adminProxy extends HttpProxyController
} }
catch (Exception $e) { catch (Exception $e) {
$this->success = false; $this->success = false;
$this->msg = $e->getMessage(); $this->msg = $e->getMessage();
} }
} }
else { else {
@@ -500,10 +501,10 @@ class adminProxy extends HttpProxyController
$this->msg = 'No authentication required!'; $this->msg = 'No authentication required!';
} }
break; break;
case 5: //send a test mail case 5: //send a test mail
if($SendaTestMail == 'true') { if($SendaTestMail == 'true') {
try { try {
$_POST['FROM_NAME'] = 'Process Maker O.S. [Test mail]'; $_POST['FROM_NAME'] = 'Process Maker O.S. [Test mail]';
$_POST['FROM_EMAIL'] = $user; $_POST['FROM_EMAIL'] = $user;
$_POST['MESS_ENGINE'] = 'PHPMAILER'; $_POST['MESS_ENGINE'] = 'PHPMAILER';
@@ -512,73 +513,73 @@ class adminProxy extends HttpProxyController
$_POST['MESS_ACCOUNT'] = $user; $_POST['MESS_ACCOUNT'] = $user;
$_POST['MESS_PASSWORD'] = $passwd; $_POST['MESS_PASSWORD'] = $passwd;
$_POST['TO'] = $Mailto; $_POST['TO'] = $Mailto;
if($auth_required == 'true') { if($auth_required == 'true') {
$_POST['SMTPAuth'] = true; $_POST['SMTPAuth'] = true;
} }
else { else {
$_POST['SMTPAuth'] = false; $_POST['SMTPAuth'] = false;
} }
if (strtolower($_POST["UseSecureCon"]) != "no") { if (strtolower($_POST["UseSecureCon"]) != "no") {
$_POST["SMTPSecure"] = $_POST["UseSecureCon"]; $_POST["SMTPSecure"] = $_POST["UseSecureCon"];
} }
if ($_POST['UseSecureCon'] == 'ssl') { if ($_POST['UseSecureCon'] == 'ssl') {
$_POST['MESS_SERVER'] = 'ssl://'.$_POST['MESS_SERVER']; $_POST['MESS_SERVER'] = 'ssl://'.$_POST['MESS_SERVER'];
} }
$resp = $this->sendTestMail(); $resp = $this->sendTestMail();
if ($resp->status == '1') { if ($resp->status == '1') {
$this->success=true; $this->success=true;
} }
else { else {
$this->success=false; $this->success=false;
$this->msg=$smtp->error['error']; $this->msg=$smtp->error['error'];
} }
} }
catch (Exception $e) { catch (Exception $e) {
$this->success = false; $this->success = false;
$this->msg = $e->getMessage(); $this->msg = $e->getMessage();
} }
} }
else { else {
$this->success=true; $this->success=true;
$this->msg='jump this step'; $this->msg='jump this step';
} }
break; break;
} }
} }
/** /**
* for send email configuration * for send email configuration
* @autor Alvaro <alvaro@colosa.com> * @autor Alvaro <alvaro@colosa.com>
*/ */
public function sendTestMail() { public function sendTestMail() {
global $G_PUBLISH; global $G_PUBLISH;
G::LoadClass("system"); G::LoadClass("system");
G::LoadClass('spool'); G::LoadClass('spool');
$sFrom = ($_POST['FROM_NAME'] != '' ? $_POST['FROM_NAME'] . ' ' : '') . '<' . $_POST['FROM_EMAIL'] . '>'; $sFrom = ($_POST['FROM_NAME'] != '' ? $_POST['FROM_NAME'] . ' ' : '') . '<' . $_POST['FROM_EMAIL'] . '>';
$sSubject = G::LoadTranslation('ID_MESS_TEST_SUBJECT'); $sSubject = G::LoadTranslation('ID_MESS_TEST_SUBJECT');
$msg = G::LoadTranslation('ID_MESS_TEST_BODY'); $msg = G::LoadTranslation('ID_MESS_TEST_BODY');
switch ($_POST['MESS_ENGINE']) { switch ($_POST['MESS_ENGINE']) {
case 'MAIL': case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1'); $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break; break;
case 'PHPMAILER': case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2'); $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break; break;
case 'OPENMAIL': case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3'); $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break; break;
} }
$sBodyPre = new TemplatePower(PATH_TPL . 'admin' . PATH_SEP . 'email.tpl'); $sBodyPre = new TemplatePower(PATH_TPL . 'admin' . PATH_SEP . 'email.tpl');
$sBodyPre->prepare(); $sBodyPre->prepare();
$sBodyPre->assign('server', $_SERVER['SERVER_NAME']); $sBodyPre->assign('server', $_SERVER['SERVER_NAME']);
$sBodyPre->assign('date', date('H:i:s')); $sBodyPre->assign('date', date('H:i:s'));
@@ -586,7 +587,7 @@ class adminProxy extends HttpProxyController
$sBodyPre->assign('engine', $engine); $sBodyPre->assign('engine', $engine);
$sBodyPre->assign('msg', $msg); $sBodyPre->assign('msg', $msg);
$sBody = $sBodyPre->getOutputContent(); $sBody = $sBodyPre->getOutputContent();
$oSpool = new spoolRun(); $oSpool = new spoolRun();
$oSpool->setConfig( $oSpool->setConfig(
array( array(
@@ -599,7 +600,7 @@ class adminProxy extends HttpProxyController
'SMTPSecure' => isset($_POST['SMTPSecure'])?$_POST['SMTPSecure']:'none' 'SMTPSecure' => isset($_POST['SMTPSecure'])?$_POST['SMTPSecure']:'none'
) )
); );
$oSpool->create( $oSpool->create(
array( array(
'msg_uid' => '', 'msg_uid' => '',
@@ -618,10 +619,10 @@ class adminProxy extends HttpProxyController
'app_msg_attach'=>'' // Added By Ankit 'app_msg_attach'=>'' // Added By Ankit
) )
); );
$oSpool->sendMail(); $oSpool->sendMail();
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
if ($oSpool->status == 'sent') { if ($oSpool->status == 'sent') {
$o->status = true; $o->status = true;
$o->success = true; $o->success = true;
@@ -632,36 +633,36 @@ class adminProxy extends HttpProxyController
$o->success = false; $o->success = false;
$o->msg = $oSpool->error; $o->msg = $oSpool->error;
} }
return $o; return $o;
} }
/** /**
* getting Save email configuration * getting Save email configuration
* @autor Alvaro <alvaro@colosa.com> * @autor Alvaro <alvaro@colosa.com>
*/ */
public function saveConfiguration() { public function saveConfiguration() {
require_once 'classes/model/Configuration.php'; require_once 'classes/model/Configuration.php';
try { try {
$oConfiguration = new Configuration(); $oConfiguration = new Configuration();
$aFields['MESS_PASSWORD'] = $_POST['passwd']; $aFields['MESS_PASSWORD'] = $_POST['passwd'];
if ($_POST['passwdHide'] != '') { if ($_POST['passwdHide'] != '') {
$aFields['MESS_PASSWORD'] = $_POST['passwdHide']; $aFields['MESS_PASSWORD'] = $_POST['passwdHide'];
} }
$aFields['MESS_PASSWORD_HIDDEN'] = ''; $aFields['MESS_PASSWORD_HIDDEN'] = '';
$aPasswd = G::decrypt($aFields['MESS_PASSWORD'],'EMAILENCRYPT'); $aPasswd = G::decrypt($aFields['MESS_PASSWORD'],'EMAILENCRYPT');
if ((strpos( $aPasswd, 'hash:') !== true) && ($aFields['MESS_PASSWORD'] != '')) { // for plain text if ((strpos( $aPasswd, 'hash:') !== true) && ($aFields['MESS_PASSWORD'] != '')) { // for plain text
$aFields['MESS_PASSWORD'] = 'hash:'.$aFields['MESS_PASSWORD']; $aFields['MESS_PASSWORD'] = 'hash:'.$aFields['MESS_PASSWORD'];
$aFields['MESS_PASSWORD'] = G::encrypt($aFields['MESS_PASSWORD'],'EMAILENCRYPT'); $aFields['MESS_PASSWORD'] = G::encrypt($aFields['MESS_PASSWORD'],'EMAILENCRYPT');
} }
$aFields['MESS_ENABLED'] = isset($_POST['EnableEmailNotifications']) ? $_POST['EnableEmailNotifications'] : ''; $aFields['MESS_ENABLED'] = isset($_POST['EnableEmailNotifications']) ? $_POST['EnableEmailNotifications'] : '';
$aFields['MESS_ENABLED'] = ($aFields['MESS_ENABLED'] == 'true') ? '1' : $aFields['MESS_ENABLED']; $aFields['MESS_ENABLED'] = ($aFields['MESS_ENABLED'] == 'true') ? '1' : $aFields['MESS_ENABLED'];
$aFields['MESS_ENGINE'] = $_POST['EmailEngine']; $aFields['MESS_ENGINE'] = $_POST['EmailEngine'];
$aFields['MESS_SERVER'] = trim($_POST['server']); $aFields['MESS_SERVER'] = trim($_POST['server']);
$aFields['MESS_RAUTH'] = isset($_POST['req_auth']) ? $_POST['req_auth'] : ''; $aFields['MESS_RAUTH'] = isset($_POST['req_auth']) ? $_POST['req_auth'] : '';
$aFields['MESS_RAUTH'] = ($aFields['MESS_RAUTH'] == 'true') ? '1' : $aFields['MESS_RAUTH']; $aFields['MESS_RAUTH'] = ($aFields['MESS_RAUTH'] == 'true') ? '1' : $aFields['MESS_RAUTH'];
@@ -680,7 +681,7 @@ class adminProxy extends HttpProxyController
$ProUid=''; $ProUid='';
$UsrUid=''; $UsrUid='';
$AppUid=''; $AppUid='';
if($oConfiguration->exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)) { if($oConfiguration->exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)) {
$oConfiguration->update( $oConfiguration->update(
array( array(
@@ -693,7 +694,7 @@ class adminProxy extends HttpProxyController
) )
); );
$this->success='true'; $this->success='true';
$this->msg='Saved'; $this->msg='Saved';
} }
else { else {
$oConfiguration->create( $oConfiguration->create(
@@ -706,35 +707,35 @@ class adminProxy extends HttpProxyController
'APP_UID' => '' 'APP_UID' => ''
) )
); );
$this->success='true'; $this->success='true';
$this->msg='Saved'; $this->msg='Saved';
} }
} }
catch (Exception $e) { catch (Exception $e) {
$this->success= false; $this->success= false;
$this->msg = $e->getMessage(); $this->msg = $e->getMessage();
} }
} }
/** /**
* loadFields for email configuration * loadFields for email configuration
* @autor Alvaro <alvaro@colosa.com> * @autor Alvaro <alvaro@colosa.com>
*/ */
public function loadFields() { public function loadFields() {
G::loadClass('configuration'); G::loadClass('configuration');
$oConfiguration = new Configurations(); $oConfiguration = new Configurations();
$oConfiguration->loadConfig($x, 'Emails','','','',''); $oConfiguration->loadConfig($x, 'Emails','','','','');
$fields = $oConfiguration->aConfig; $fields = $oConfiguration->aConfig;
if (count($fields) > 0) { if (count($fields) > 0) {
$this->success = (count($fields) > 0); $this->success = (count($fields) > 0);
$passwd = $fields['MESS_PASSWORD']; $passwd = $fields['MESS_PASSWORD'];
$passwdDec = G::decrypt($passwd,'EMAILENCRYPT'); $passwdDec = G::decrypt($passwd,'EMAILENCRYPT');
if (strpos( $passwdDec, 'hash:' ) !== false) { if (strpos( $passwdDec, 'hash:' ) !== false) {
list($hash, $pass) = explode(":", $passwdDec); list($hash, $pass) = explode(":", $passwdDec);
$fields['MESS_PASSWORD'] = $pass; $fields['MESS_PASSWORD'] = $pass;
} }
} }
$this->data = $fields; $this->data = $fields;
} }
@@ -998,7 +999,7 @@ class adminProxy extends HttpProxyController
$aMessage1 = array(); $aMessage1 = array();
$fileName = trim(str_replace(' ', '_', $namefile)); $fileName = trim(str_replace(' ', '_', $namefile));
$fileName = self::changeNamelogo($fileName); $fileName = self::changeNamelogo($fileName);
G::uploadFile($tmpFile, $dir, 'tmp' . $fileName); G::uploadFile($tmpFile, $dir, 'tmp' . $fileName);
try { try {
@@ -1009,7 +1010,7 @@ class adminProxy extends HttpProxyController
$arrayInfo = getimagesize($dir . '/' . 'tmp' . $fileName); $arrayInfo = getimagesize($dir . '/' . 'tmp' . $fileName);
$typeMime = $arrayInfo[2]; $typeMime = $arrayInfo[2];
} }
if ($typeMime == $allowedTypeArray['index' . base64_encode($_FILES['img']['type'])]) { if ($typeMime == $allowedTypeArray['index' . base64_encode($_FILES['img']['type'])]) {
$error = false; $error = false;
try { try {

View File

@@ -20,16 +20,16 @@ var dateFormat;
Ext.onReady(function(){ Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.QuickTips.init(); Ext.QuickTips.init();
fullNameFormat = CONFIG.fullNameFormat; fullNameFormat = CONFIG.fullNameFormat;
dateFormat = CONFIG.dateFormat; dateFormat = CONFIG.dateFormat;
pageSize = parseInt(CONFIG.pageSize); pageSize = parseInt(CONFIG.pageSize);
searchButton = new Ext.Action({ searchButton = new Ext.Action({
text: _('ID_SEARCH'), text: _('ID_SEARCH'),
handler: DoSearch handler: DoSearch
}); });
searchText = new Ext.form.TextField ({ searchText = new Ext.form.TextField ({
id: 'searchTxt', id: 'searchTxt',
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
@@ -48,13 +48,13 @@ Ext.onReady(function(){
} }
} }
}); });
clearTextButton = new Ext.Action({ clearTextButton = new Ext.Action({
text: 'X', text: 'X',
ctCls:'pm_search_x_button', ctCls:'pm_search_x_button',
handler: GridByDefault handler: GridByDefault
}); });
smodel = new Ext.grid.RowSelectionModel({ smodel = new Ext.grid.RowSelectionModel({
singleSelect: true, singleSelect: true,
listeners:{ listeners:{
@@ -113,7 +113,7 @@ Ext.onReady(function(){
writer: writer, // <-- plug a DataWriter into the store just as you would a Reader writer: writer, // <-- plug a DataWriter into the store just as you would a Reader
autoSave: true // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton. autoSave: true // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
}); });
comboPageSize = new Ext.form.ComboBox({ comboPageSize = new Ext.form.ComboBox({
typeAhead : false, typeAhead : false,
mode : 'local', mode : 'local',
@@ -135,9 +135,9 @@ Ext.onReady(function(){
} }
} }
}); });
comboPageSize.setValue(pageSize); comboPageSize.setValue(pageSize);
bbarpaging = new Ext.PagingToolbar({ bbarpaging = new Ext.PagingToolbar({
pageSize: pageSize, pageSize: pageSize,
store: store, store: store,
@@ -146,7 +146,7 @@ Ext.onReady(function(){
emptyMsg: _('ID_GRID_PAGE_NO_USERS_MESSAGE'), emptyMsg: _('ID_GRID_PAGE_NO_USERS_MESSAGE'),
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize] items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
}); });
cmodel = new Ext.grid.ColumnModel({ cmodel = new Ext.grid.ColumnModel({
columns: [ columns: [
{id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false}, {id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
@@ -186,7 +186,7 @@ Ext.onReady(function(){
} }
] ]
}); });
usersGrid = new Ext.grid.EditorGridPanel({ usersGrid = new Ext.grid.EditorGridPanel({
title: 'Users', title: 'Users',
//region: 'center', //region: 'center',
@@ -211,7 +211,7 @@ Ext.onReady(function(){
bbar: bbarpaging, bbar: bbarpaging,
listeners: { listeners: {
rowdblclick: function(){ rowdblclick: function(){
} }
}, },
view: new Ext.grid.GroupingView({ view: new Ext.grid.GroupingView({
@@ -223,10 +223,7 @@ Ext.onReady(function(){
// GROUPS // GROUPS
var proxyGroups = new Ext.data.HttpProxy({ var proxyGroups = new Ext.data.HttpProxy({
api: { api: {
read : '../groups/groups_Ajax?action=groupsList', read: '../groups/groups_Ajax?action=groupsList'
//create : 'app.php/users/create',
update: '../adminProxy/uxGroupUpdate'//,
//destroy: 'app.php/users/destroy'
} }
}); });
@@ -250,14 +247,11 @@ Ext.onReady(function(){
writeAllFields: false writeAllFields: false
}); });
storeGroups = new Ext.data.GroupingStore( { storeGroups = new Ext.data.GroupingStore({
// proxy: new Ext.data.HttpProxy({
// url: '../groups/groups_Ajax?action=groupsList'
// }),
proxy: proxyGroups, proxy: proxyGroups,
reader: readerGroups, reader: readerGroups,
writer: writerGroups, // <-- plug a DataWriter into the store just as you would a Reader writer: writerGroups, // <-- plug a DataWriter into the store just as you would a Reader
autoSave: true // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton. autoSave: false // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
}); });
cmodelGroups = new Ext.grid.ColumnModel({ cmodelGroups = new Ext.grid.ColumnModel({
@@ -285,22 +279,31 @@ Ext.onReady(function(){
editable: false, editable: false,
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
fields: ['id', 'name'], fields: ['id', 'name'],
data : uxTypes data : uxTypes
}), }),
listeners: { listeners: {
select: function(a, b) { select: function(a, b) {
var uidGroup = groupsGrid.getSelectionModel().selection['record'].data['GRP_UID'];
Ext.Ajax.request({ Ext.Ajax.request({
url: '../users/users_Ajax?function=usersAdminGroupExtJS', url: '../adminProxy/uxGroupUpdate',
params: { GRP_UID: uidGroup }, params: {GRP_UID: groupsGrid.getSelectionModel().selection['record'].data['GRP_UID'],
success: function(result, request) { GRP_UX: Ext.getCmp('GRP_UXCombo').getValue()},
var res = Ext.decode(result.responseText); success: function(result, request) {
if ((res.reponse == 'true') && (Ext.getCmp('GRP_UXCombo').getValue()!='SWITCHABLE') && (Ext.getCmp('GRP_UXCombo').getValue()!='NORMAL')) { var response = Ext.decode(result.responseText);
PMExt.warning(_('ID_WARNING'), _('ID_ADMINS_CANT_USE_UXS')+'<br/> <b>'+_('ID_USERS_LIST')+':</b> '+res.users); if (!response.success) {
Ext.getCmp('GRP_UXCombo').setValue('NORMAL'); a.setValue('NORMAL');
PMExt.warning(_('ID_WARNING'), _('ID_ADMINS_CANT_USE_UXS') + '<br/> <b>' + _('ID_USERS_LIST') + ':</b> ' + response.users);
}
else {
a.fireEvent('blur');
} }
} }
}); });
},
specialkey: function (f, e) {
if (e.getKey() == e.ENTER) {
return false;
}
return true;
} }
} }
}) })
@@ -344,7 +347,7 @@ Ext.onReady(function(){
text: _('ID_SEARCH'), text: _('ID_SEARCH'),
handler: DoSearchGroups handler: DoSearchGroups
}); });
var searchTextGroups = new Ext.form.TextField ({ var searchTextGroups = new Ext.form.TextField ({
id: 'searchTxtGroups', id: 'searchTxtGroups',
ctCls:'pm_search_text_field', ctCls:'pm_search_text_field',
@@ -359,7 +362,7 @@ Ext.onReady(function(){
} }
} }
}); });
var clearTextButtonGroups = new Ext.Action({ var clearTextButtonGroups = new Ext.Action({
text: 'X', text: 'X',
ctCls:'pm_search_x_button', ctCls:'pm_search_x_button',
@@ -367,7 +370,7 @@ Ext.onReady(function(){
}); });
groupsGrid = new Ext.grid.EditorGridPanel({ groupsGrid = new Ext.grid.EditorGridPanel({
title : _('ID_GROUPS'), title : _('ID_GROUPS'),
//region: 'center', //region: 'center',
layout: 'fit', layout: 'fit',
id: 'groupsGrid', id: 'groupsGrid',
@@ -435,7 +438,7 @@ render_status = function(v){
//Render Due Date //Render Due Date
render_duedate = function(v,x,s){ render_duedate = function(v,x,s){
if (s.data.DUE_DATE_OK) if (s.data.DUE_DATE_OK)
return _DF(v); return _DF(v);
else else
return '<font color="red">' + _DF(v) + '</font>'; return '<font color="red">' + _DF(v) + '</font>';
}; };
@@ -452,7 +455,7 @@ GridByDefault = function(){
//Do Search Function //Do Search Function
DoSearch = function(){ DoSearch = function(){
usersGrid.store.load({params: {textFilter: searchText.getValue()}}); usersGrid.store.load({params: {textFilter: searchText.getValue()}});
}; };
GridByDefaultGroups = function(){ GridByDefaultGroups = function(){
@@ -462,7 +465,7 @@ GridByDefaultGroups = function(){
//Do Search Function //Do Search Function
DoSearchGroups = function(){ DoSearchGroups = function(){
groupsGrid.store.load({params: {textFilter: Ext.getCmp('searchTxtGroups').getValue()}}); groupsGrid.store.load({params: {textFilter: Ext.getCmp('searchTxtGroups').getValue()}});
}; };