Merged 3.0.1.8 into MT-10

This commit is contained in:
Gustavo Cruz
2016-03-23 19:07:45 -04:00
44 changed files with 1133 additions and 520 deletions

View File

@@ -225,7 +225,7 @@ class pmDynaform
$json->optionsSql[] = $option;
}
} catch (Exception $e) {
}
}
break;
@@ -605,7 +605,7 @@ class pmDynaform
$data[$json->variable === "" ? $json->id : $json->variable] = $row[0];
}
} catch (Exception $e) {
}
}
}
@@ -649,6 +649,7 @@ class pmDynaform
$javascript = "
<script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . ";
var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
var pm_run_outside_main_app = \"\";
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\";
@@ -704,6 +705,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
@@ -776,6 +778,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = '" . $this->fields["PM_RUN_OUTSIDE_MAIN_APP"] . "';\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = '" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "';\n" .
@@ -828,6 +831,7 @@ class pmDynaform
$javascrip = "
<script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . ";
var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";
var pm_run_outside_main_app = null;
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->fields["PRO_UID"] . "_" . $this->fields["CURRENT_DYNAFORM"] . "\";
@@ -867,6 +871,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = null;\n" .
@@ -904,6 +909,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $this->fields["CURRENT_DYNAFORM"] . "';\n" .
"var __DynaformName__ = null;\n" .
@@ -937,7 +943,8 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>" .
"var sysLang = '" . SYS_LANG . "';\n" .
"var jsonData = " . G::json_encode($json) . ";" .
"var jsonData = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
$js .
"</script>";
@@ -958,6 +965,7 @@ class pmDynaform
$javascrip = "" .
"<script type='text/javascript'>\n" .
"var jsondata = " . G::json_encode($json) . ";\n" .
"var httpServerHostname = \"" . System::getHttpServerHostnameRequestsFrontEnd() . "\";\n" .
"var pm_run_outside_main_app = null;\n" .
"var dyn_uid = '" . $currentDynaform . "';\n" .
"var __DynaformName__ = null;\n" .
@@ -1217,7 +1225,7 @@ class pmDynaform
/**
* You obtain an array of elements according to search criteria.
*
*
* @param object $json
* @param string $id
* @param string $for
@@ -1549,7 +1557,7 @@ class pmDynaform
/**
* Returns the value converted to string if it is not null.
*
*
* @param string $string
* @return string
*/

View File

@@ -71,7 +71,8 @@ class System
'safari_cookie_lifetime' => 1,
'error_reporting' => "",
'display_errors' => 'On',
'system_utc_time_zone' => 0
'system_utc_time_zone' => 0,
'server_hostname_requests_frontend' => ''
);
/**
@@ -1252,6 +1253,26 @@ class System
return self::$debug;
}
/**
* Get the complete name of the server host configured for requests Front-End (e.g. https://127.0.0.1:81)
*
* @return string Returns an string with the complete name of the server host configured for requests Front-End
*/
public static function getHttpServerHostnameRequestsFrontEnd()
{
try {
$arraySystemConfiguration = self::getSystemConfiguration();
$serverHostname = $arraySystemConfiguration['server_hostname_requests_frontend'];
$serverHostname = ($serverHostname != '')? $serverHostname : $_SERVER['HTTP_HOST'];
//Return
return ((G::is_https())? 'https://' : 'http://') . $serverHostname;
} catch (Exception $e) {
throw $e;
}
}
}
// end System class

View File

@@ -2157,7 +2157,7 @@ class workspaceTools
while($dataset->next()) {
$aRow = $dataset->getRow();
$oAppCache = new AppCacheView();
$aCount = $oAppCache->getAllCounters( $aTypes, $aRow['USR_UID'] );
$aCount = $oAppCache->getAllCounters($aTypes, $aRow['USR_UID'], false);
$newData = array(
'USR_UID' => $aRow['USR_UID'],
'USR_TOTAL_INBOX' => $aCount['to_do'],

View File

@@ -34,18 +34,18 @@ class AppCacheView extends BaseAppCacheView
public $confCasesList;
public $pathToAppCacheFiles;
public function getAllCounters($aTypes, $userUid, $processSummary = false)
public function getAllCounters($aTypes, $userUid, $flagPausedSupervisor = true)
{
$aResult = array();
foreach ($aTypes as $type) {
$aResult[$type] = $this->getListCounters($type, $userUid, $processSummary);
$aResult[$type] = $this->getListCounters($type, $userUid, $flagPausedSupervisor);
}
return $aResult;
}
public function getListCounters($type, $userUid, $processSummary)
public function getListCounters($type, $userUid, $flagPausedSupervisor = true)
{
$distinct = true;
@@ -65,7 +65,7 @@ class AppCacheView extends BaseAppCacheView
$distinct = false;
break;
case 'paused':
$criteria = $this->getPausedCountCriteria($userUid);
$criteria = $this->getPausedCountCriteria($userUid, $flagPausedSupervisor);
break;
case 'completed':
$criteria = $this->getCompletedCountCriteria($userUid);
@@ -520,9 +520,10 @@ class AppCacheView extends BaseAppCacheView
* gets the PAUSED cases list criteria
* param $userUid the current userUid
* param $doCount if true this will return the criteria for count cases only
* @param bool $flagSupervisor Flag to include the records of the supervisor
* @return Criteria object $Criteria
*/
public function getPaused($userUid, $doCount)
public function getPaused($userUid, $doCount, $flagSupervisor = true)
{
//adding configuration fields from the configuration options
//and forming the criteria object
@@ -538,12 +539,17 @@ class AppCacheView extends BaseAppCacheView
//$criteria->add(AppCacheViewPeer::USR_UID, $userUid);
if (!empty($userUid)) {
$criteria->add(
$criteria->getNewCriterion(AppCacheViewPeer::USR_UID, $userUid)->addOr(
$criteria->getNewCriterion(AppCacheViewPeer::PRO_UID, $aProcesses, Criteria::IN))
);
$criterionAux = $criteria->getNewCriterion(AppCacheViewPeer::USR_UID, $userUid, Criteria::EQUAL);
if ($flagSupervisor && !empty($aProcesses)) {
$criterionAux = $criterionAux->addOr(
$criteria->getNewCriterion(AppCacheViewPeer::PRO_UID, $aProcesses, Criteria::IN)
);
}
$criteria->add($criterionAux);
} else {
if (count($aProcesses) > 0) {
if ($flagSupervisor && !empty($aProcesses)) {
$criteria->add(AppCacheViewPeer::PRO_UID, $aProcesses, Criteria::IN);
}
}
@@ -568,11 +574,12 @@ class AppCacheView extends BaseAppCacheView
/**
* gets the PAUSED cases list criteria for count
* param $userUid the current userUid
* @param bool $flagSupervisor Flag to include the records of the supervisor
* @return Criteria object $Criteria
*/
public function getPausedCountCriteria($userUid)
public function getPausedCountCriteria($userUid, $flagSupervisor = true)
{
return $this->getPaused($userUid, true);
return $this->getPaused($userUid, true, $flagSupervisor);
}
/**

View File

@@ -1,4 +1,3 @@
;Setting Android
android[url] = "https://android.googleapis.com/gcm/send"
android[serverApiKey] = "AIzaSyALwyLUYtZDcJQr54V5rxhZjoWnOLWCSvc"

View File

@@ -6580,8 +6580,8 @@ msgstr "Do you want to assign all available users to this role?"
# TRANSLATION
# LABEL/ID_MSG_AJAX_FAILURE
#: LABEL/ID_MSG_AJAX_FAILURE
msgid "Some error has occurred. Try again later."
msgstr "Some error has occurred. Try again later."
msgid "An error has occurred. Please contact your system administrator."
msgstr "An error has occurred. Please contact your system administrator."
# TRANSLATION
# LABEL/ID_FINISH

View File

@@ -86,6 +86,7 @@ class Designer extends Controller
$this->setVar("SYS_SYS", SYS_SYS);
$this->setVar("SYS_LANG", SYS_LANG);
$this->setVar("SYS_SKIN", SYS_SKIN);
$this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd());
if ($debug) {
if (! file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) {

View File

@@ -105,6 +105,9 @@ class Home extends Controller
foreach ($processList as $key => $valueProcess) {
foreach ($proData as $keyPro => $valuePro) {
if (!isset($valueProcess['pro_uid'])) {
$valueProcess['pro_uid'] = '';
}
if ($valueProcess['pro_uid'] == $valuePro['PRO_UID']) {
$processesList[] = $valueProcess;
}

View File

@@ -31,7 +31,7 @@ class StrategicDashboard extends Controller
$user = new Users();
$user = $user->load($RBAC->aUserInfo['USER_INFO']['USR_UID']);
$this->usrUnitCost = $this->currencySymbolToShow($user);
$this->urlProxy = '/api/1.0/' . SYS_SYS . '/';
$this->urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/';
//change
$clientId = 'x-pm-local-client';
$client = $this->getClientCredentials($clientId);
@@ -144,7 +144,7 @@ class StrategicDashboard extends Controller
public function formDashboard ($data)
{
try {
$this->includeExtJS( 'strategicDashboard/formDashboard', true, true );
$this->setView( 'strategicDashboard/formDashboard' );
@@ -164,7 +164,7 @@ class StrategicDashboard extends Controller
public function formEditDashboard ($data)
{
try {
$this->includeExtJS( 'strategicDashboard/formDashboard', true, true );
$this->setView( 'strategicDashboard/formDashboard' );
@@ -196,7 +196,7 @@ class StrategicDashboard extends Controller
$this->setVar('usrId', $this->usrId);
$this->setVar('credentials', $this->clientToken);
$this->setVar('unitCost', $this->usrUnitCost);
$translation = $this->getTranslations();
$this->setVar('translation', $translation);
$this->render();

View File

@@ -3622,7 +3622,7 @@ SELECT 'LABEL','ID_ASSIGNED_USERS','en','ASSIGNED USERS','2014-01-15'
UNION ALL
SELECT 'LABEL','ID_MSG_CONFIRM_ASSIGN_ALL_USERS','en','Do you want to assign all available users to this role?','2014-01-15'
UNION ALL
SELECT 'LABEL','ID_MSG_AJAX_FAILURE','en','Some error has occurred. Try again later.','2014-10-21'
SELECT 'LABEL','ID_MSG_AJAX_FAILURE','en','An error has occurred. Please contact your system administrator.','2014-10-21'
UNION ALL
SELECT 'LABEL','ID_FINISH','en','Finish','2014-01-15'
UNION ALL

View File

@@ -2528,7 +2528,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_AVAILABLE_USERS','en','AVAILABLE USERS','2014-01-15') ,
( 'LABEL','ID_ASSIGNED_USERS','en','ASSIGNED USERS','2014-01-15') ,
( 'LABEL','ID_MSG_CONFIRM_ASSIGN_ALL_USERS','en','Do you want to assign all available users to this role?','2014-01-15') ,
( 'LABEL','ID_MSG_AJAX_FAILURE','en','Some error has occurred. Try again later.','2014-10-21') ,
( 'LABEL','ID_MSG_AJAX_FAILURE','en','An error has occurred. Please contact your system administrator.','2014-10-21') ,
( 'LABEL','ID_FINISH','en','Finish','2014-01-15') ,
( 'LABEL','ID_USERS_SUCCESS_DELETE','en','User has been deleted correctly.','2014-01-15') ,
( 'LABEL','ID_ASSIGN_ALL_GROUPS','en','Assign All Groups','2014-01-15') ,

View File

@@ -44,7 +44,7 @@ $(window).load(function () {
action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid;
}
url = location.protocol + '//' + location.host;
url += '/sys' + workspace + '/en/neoclassic/cases/' + action;
method = 'POST';
}
@@ -55,7 +55,7 @@ $(window).load(function () {
};
}
var data = jsondata;
window.project = new PMDynaform.core.Project({
window.dynaform = new PMDynaform.core.Project({
data: data,
onBeforePrintHandler : function () {
var nodeClone = $(".pmdynaform-container").clone();
@@ -71,7 +71,7 @@ $(window).load(function () {
},
formAjax: loadAjaxParams(),
keys: {
server: location.host,
server: httpServerHostname,
projectId: prj_uid,
workspace: workspace
},
@@ -108,7 +108,15 @@ $(window).load(function () {
form.appendChild(arrayRequired);
dyn_forward = document.getElementById("dyn_forward");
dyn_forward.onclick = function () {
if (window.project.getForms()[0].isValid()) {
if (window.dynaform.getForms()[0].isValid()) {
window.dynaform.getForms()[0].applySuccess();
//Destroy modal previous
if($('#modalProgressBar').length > 0){
$('#modalProgressBar').remove();
}
//Show Modal for nex step
var viewModalSubmit = new PMDynaform.view.ModalProgressBar();
viewModalSubmit.render();
form.submit();
}
return false;

View File

@@ -1,3 +1,3 @@
PM.Sessions.register();
localStorage.setItem('ID_BLOCKER_MSG', PM.Sessions.getCookie('PM-Warning'));
PM.Sessions.setLabel('ID_BLOCKER_MSG', PM.Sessions.getCookie('PM-Warning'));

View File

@@ -2,40 +2,41 @@ PM.Sessions = (function () {
var Sessions = function () {
if (window.location.pathname.indexOf("login") === -1 &&
window.location.pathname.indexOf("sysLogin") === -1 &&
this.getCookie('PM-TabPrimary') != 101010010) {
this.getCookie('PM-TabPrimary') !== '101010010') {
this.isClose = (this.getLabel('mainWindowClose') === "true");
if (this.isClose && parent.parent.parent.window.name === "") {
this.register();
}
this.checkTab();
}
};
Sessions.prototype.register = function () {
this.setLabel('mainWindowClose', false);
window.name = this.getCookie('PM-TabPrimary');
};
Sessions.prototype.checkTab = function () {
var ieVersion,
msg;
if (parent.parent.parent.window.name !== this.getCookie('PM-TabPrimary') && parent.parent.parent.window.name.indexOf(this.getCookie('PM-TabPrimary')) === -1 ) {
msg,
win;
if (window.name === this.getCookie('PM-TabPrimary')) {
this.setLabel('mainWindowClose', false);
}
if (parent.parent.parent.window.name !== this.getCookie('PM-TabPrimary') &&
parent.parent.parent.window.name.indexOf(this.getCookie('PM-TabPrimary')) === -1 ) {
ieVersion = this.detectBrowser();
msg = this.getLabel('ID_BLOCKER_MSG');
win = window.open('', '_self', '');
if (ieVersion && ieVersion <= 11) {
window.open('', '_self', '');
window.document.execCommand('Stop');
if (confirm(msg)) {
window.close();
}
} else if (ieVersion && ieVersion <= 12) {
window.open('', '_self', '');
window.document.execCommand('Stop');
if (confirm(msg)) {
window.close();
}
win.document.execCommand('Stop');
win.open("/errors/block.php","_self");
} else if (ieVersion && ieVersion <= 13) {
win.document.execCommand('Stop');
win.open("/errors/block.php","_self");
} else {
window.open('', '_self', '');
window.stop();
if (confirm(msg)) {
window.close();
}
win.stop();
win.open("/errors/block.php","_self");
}
}
};
@@ -105,14 +106,28 @@ PM.Sessions = (function () {
this.createCookie(name,"",-1);
};
Sessions.prototype.setLabel = function(nameLabel) {
localStorage.setItem(nameLabel, _(nameLabel));
Sessions.prototype.setLabel = function(nameLabel, labelValue) {
localStorage.setItem(nameLabel, labelValue);
};
Sessions.prototype.getLabel = function(nameLabel) {
return localStorage.getItem(nameLabel);
};
Sessions.prototype.addEventHandler = function (elem, eventType, handler) {
if (elem.addEventListener)
elem.addEventListener(eventType, handler, false);
else if (elem.attachEvent)
elem.attachEvent('on' + eventType, handler);
};
Sessions.prototype.isClose = false;
return new Sessions();
})();
PM.Sessions.addEventHandler(window, "unload",function () {
if (window.name === PM.Sessions.getCookie('PM-TabPrimary')){
PM.Sessions.setLabel('mainWindowClose', true);
}
});

View File

@@ -133,7 +133,7 @@ while ($rsSql->next()) {
}
if (count($arrayTabItem) > 0) {
$urlProxy = '/api/1.0/' . SYS_SYS . '/consolidated/';
$urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/consolidated/';
$clientId = 'x-pm-local-client';
$client = getClientCredentials($clientId);
$authCode = getAuthorizationCode($client);
@@ -178,7 +178,7 @@ if (count($arrayTabItem) > 0) {
$headPublisher->assign("FORMATS", $conf->getFormats());
$headPublisher->assign("urlProxy", $urlProxy);
$headPublisher->assign('credentials', $clientToken );
$ieVersion = null;
if(preg_match("/^.*\(.*MSIE (\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch) || preg_match("/^.*\(.*rv.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)){
$ieVersion = intval($arrayMatch[1]);

View File

@@ -83,7 +83,7 @@ if ($oServerConf->isRtl( SYS_LANG )) {
$urlProxy = 'casesMenuLoader?action=getAllCounters&r=';
/*----------------------------------********---------------------------------*/
$urlProxy = '/api/1.0/' . SYS_SYS . '/system/counters-lists?r=';
$urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/system/counters-lists?r=';
$clientId = 'x-pm-local-client';
$client = getClientCredentials($clientId);
$authCode = getAuthorizationCode($client);

View File

@@ -29,5 +29,8 @@ $G_ID_MENU_SELECTED = 'DASHBOARD';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'dashboard/load' );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
G::RenderPage( 'publish' );

View File

@@ -63,6 +63,11 @@ $oHeadPublisher->addContent( 'departments/departmentUsers' ); //adding a html fi
G::LoadClass( 'configuration' );
$c = new Configurations();
$arrayConfigPage = $c->getConfiguration('departmentUsersList', 'pageSize', null, $_SESSION['USER_LOGGED']);
$arrayConfig = [];
$arrayConfig['pageSize'] = (isset($arrayConfigPage['pageSize']))? $arrayConfigPage['pageSize'] : 20;
$dep = new Department();
$dep->Load( $_GET['dUID'] );
@@ -73,6 +78,7 @@ $depart['DEP_MANAGER'] = $dep->getDepManager();
$oHeadPublisher->assign( 'DEPARTMENT', $depart );
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
$oHeadPublisher->assign('CONFIG', $arrayConfig);
G::RenderPage( 'publish', 'extJs' );

View File

@@ -22,12 +22,6 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$_REQUEST = $filter->xssFilterHard($_REQUEST);
function LookForChildren ($parent, $level, $aDepUsers)
{
G::LoadClass( 'configuration' );
@@ -251,7 +245,7 @@ switch ($_POST['action']) {
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
$managerName = $aRow['USR_USERNAME'] ? " - Department Manager: ".$aRow['USR_USERNAME'] : 'No Manager';
$managerName = $aRow['USR_USERNAME'] ? " - Department Manager: ".$aRow['USR_USERNAME'] : 'No Manager';
}
}
@@ -282,55 +276,43 @@ switch ($_POST['action']) {
echo '{success: true}';
break;
case 'assignedUsers':
$filter = isset( $_POST['textFilter'] ) ? $_POST['textFilter'] : '';
$dep_uid = $_REQUEST['dUID'];
$oDept = new Department();
$oDept->Load( $dep_uid );
$manager = $oDept->getDepManager();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
if ($filter != '') {
$oCriteria->add( $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE ) ) ) );
}
$oCriteria->add( UsersPeer::DEP_UID, $dep_uid );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$aUsers[] = $oDataset->getRow();
$index = sizeof( $aUsers ) - 1;
$aUsers[$index]['USR_SUPERVISOR'] = ($manager == $aUsers[$index]['USR_UID']) ? true : false;
}
echo '{users:' . G::json_encode( $aUsers ) . '}';
break;
case 'availableUsers':
$filter = isset( $_POST['textFilter'] ) ? $_POST['textFilter'] : '';
$dep_uid = $_REQUEST['dUID'];
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL );
$response = [];
if ($filter != '') {
$oCriteria->add( $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE ) ) ) );
try {
$option = $_POST['option'];
$departmentUid = $_POST['departmentUid'];
$pageSize = $_POST['pageSize'];
$filter = $_POST['filter'];
$sortField = (isset($_POST['sort']) && $_POST['sort'] != 'USR_USERNAME')? $_POST['sort']: '';
$sortDir = (isset($_POST['dir']))? $_POST['dir']: 'ASC';
$start = (isset($_POST['start']))? $_POST['start']: 0;
$limit = (isset($_POST['limit']))? $_POST['limit']: $pageSize;
$department = new \ProcessMaker\BusinessModel\Department();
$result = $department->getUsers(
$departmentUid,
$option,
['filter' => $filter, 'filterOption' => ''],
$sortField,
$sortDir,
$start,
$limit
);
$response['status'] = 'OK';
$response['success'] = true;
$response['resultTotal'] = $result['total'];
$response['resultRoot'] = $result['data'];
} catch (Exception $e) {
$response['status'] = 'ERROR';
$response['message'] = $e->getMessage();
}
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$aUsers[] = $oDataset->getRow();
}
echo '{users:' . G::json_encode( $aUsers ) . '}';
echo G::json_encode($response);
break;
case 'assignDepartmentToUserMultiple':
$DEP_UID = $_REQUEST['DEP_UID'];

View File

@@ -413,7 +413,7 @@ try {
}
$configS = System::getSystemConfiguration('', '', SYS_SYS);
$activeSession = array_key_exists('session_block', $configS) ? !(int)$configS['session_block']:true;
$activeSession = isset($configS['session_block']) ? !(int)$configS['session_block']:true;
if ($activeSession){
setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
}

View File

@@ -338,7 +338,7 @@ $flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword'])
? $oConf->aConfig['login_enableForgotPassword']
: 'off';
setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'),'*'), time() + (24 * 60 * 60), SYS_CURRENT_URI);
setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), time() + (24 * 60 * 60), SYS_URI);
setcookie("PM-TabPrimary", uniqid(), time() + (24 * 60 * 60), '/');
$oHeadPublisher->addScriptCode("var flagForgotPassword = '$flagForgotPassword';");

View File

@@ -1,42 +1,32 @@
<?php
/**
* data_rolesUsers.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$response = [];
$ROL_UID = $_GET['rUID'];
$TYPE_DATA = $_GET["type"];
try {
$option = $_POST['option'];
$roleUid = $_POST['roleUid'];
global $RBAC;
$pageSize = $_POST['pageSize'];
$filter = $_POST['filter'];
$filter = (isset( $_REQUEST['textFilter'] )) ? $_REQUEST['textFilter'] : '';
$sortField = (isset($_POST['sort']))? $_POST['sort']: 'USR_FIRSTNAME';
$sortDir = (isset($_POST['dir']))? $_POST['dir']: 'ASC';
$start = (isset($_POST['start']))? $_POST['start']: 0;
$limit = (isset($_POST['limit']))? $_POST['limit']: $pageSize;
if ($TYPE_DATA == 'list')
$oDataset = $RBAC->getRoleUsers( $ROL_UID, $filter );
if ($TYPE_DATA == 'show')
$oDataset = $RBAC->getAllUsers( $ROL_UID, $filter );
$roleUser = new \ProcessMaker\BusinessModel\Role\User();
$rows = Array ();
while ($oDataset->next()) {
$rows[] = $oDataset->getRow();
$result = $roleUser->getUsers(
$roleUid, $option, ['filter' => $filter, 'filterOption' => ''], $sortField, $sortDir, $start, $limit
);
$response['status'] = 'OK';
$response['success'] = true;
$response['resultTotal'] = $result['total'];
$response['resultRoot'] = $result['data'];
} catch (Exception $e) {
$response['status'] = 'ERROR';
$response['message'] = $e->getMessage();
}
echo '{users: ' . G::json_encode( $rows ) . '}';
echo G::json_encode($response);

View File

@@ -48,8 +48,15 @@ $G_ID_SUB_MENU_SELECTED = 'ROLES';
$G_PUBLISH = new Publisher();
$configuration = new Configurations();
$arrayConfigPage = $configuration->getConfiguration('roleUsersPermissionsList', 'pageSize', null, $_SESSION['USER_LOGGED']);
$arrayConfig = [];
$arrayConfig['pageSize'] = (isset($arrayConfigPage['pageSize']))? $arrayConfigPage['pageSize'] : 20;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->assign("PARTNER_FLAG", (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false);
$oHeadPublisher->assign('CONFIG', $arrayConfig);
$oHeadPublisher->addExtJsScript( 'roles/rolesUsersPermission', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'roles/rolesUsersPermission' ); //adding a html file .html.

View File

@@ -42,5 +42,8 @@ else {
}
$G_PUBLISH->AddContent( 'view', 'setup/main_Load' );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
G::RenderPage( 'publish' );

View File

@@ -34,6 +34,9 @@ $G_ID_MENU_SELECTED = 'DASHBOARD+';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'strategicDashboard/load' );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
G::RenderPage( 'publish' );

View File

@@ -25,6 +25,9 @@
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'MY_ACCOUNT';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
if (isset( $_GET['type'] )) {
$G_PUBLISH->AddContent( 'view', 'users/usersReload' );

View File

@@ -0,0 +1,105 @@
<?php
if (function_exists("http_response_code")) {
http_response_code(200);
}
$http = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https" : "http";
$host = $_SERVER["SERVER_NAME"] . (($_SERVER["SERVER_PORT"] != "80") ? ":" . $_SERVER["SERVER_PORT"] : "");
$urlLogin = $http . "://" . $host . "/sys/en/neoclassic/login/login";
$urlHome = $urlLogin;
if (isset($_GET["url"]) && $_GET["url"] != "") {
$url = urldecode($_GET["url"]);
$url = explode("/", $url);
$sysSys = "";
$sysLang = "";
$sysSkin = "";
if (isset($url[1]) && preg_match("/^sys(.+)$/", $url[1], $match)) {
$sysSys = $match[1];
// Check if sys path exists
$checkDir = PATH_DATA . "sites/" . $sysSys;
if (!is_dir($checkDir)) {
$sysSys = '';
}
}
if (isset($url[2])) {
$sysLang = $url[2];
}
if (isset($url[3])) {
$sysSkin = $url[3];
// Check if sys path exists
$checkDir = PATH_SKIN_ENGINE . $sysSkin;
if (!is_dir($checkDir)) {
// Try this again
$checkDir = PATH_CUSTOM_SKINS . $sysSkin;
if (!is_dir($checkDir)) {
$sysSkin = '';
}
}
}
if ($sysSys != "" && $sysLang != "" && $sysSkin != "") {
$urlLogin = $http . "://" . $host . "/sys" . $sysSys . "/" . $sysLang . "/" . $sysSkin . "/login/login";
$urlHome = $http . "://" . $host . "/sys" . $sysSys . "/" . $sysLang . "/" . $sysSkin . "/cases/main";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon"/>
<link href="../lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css" rel="stylesheet">
<link href="css2/block.css" type="text/css" rel="stylesheet"/>
</head>
<body class="nav-md special-page" style="margin: 0px; overflow: auto;">
<div class="container body ">
<div class="main_container">
<!-- page content -->
<div class="col-md-12">
<div class="col-middle">
<div class="text-center">
<p><img src="images/fa-hand-pointer-o.png"></p>
</div>
<div class="text-center text-error">
<h1>Hi there, please check your tabs!</h1>
<p><b>A browser instance of ProcessMaker is actually open.</b> You can start only one at the time.
For more information:
</p>
<div class="mid_center">
<a type="button" class="btn btn-success btn-lg" href="http://wiki.processmaker.com">Click here
to see our Wiki</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<!-- footer content -->
<div id="footer">
<div class="container">
<p><img src="images/processmaker.logow.png"></p>
<p class="muted credit">Supplied free of charge with no support, certification, warranty, maintenance nor indemnity by ProcessMaker and its Certified Partners<br>
Copyright © 2003-2015 ProcessMaker, Inc. All rights reserved. </p>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,92 @@
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: "Helvetica Neue", Roboto, Arial, "Droid Sans", sans-serif;
font-size: 13px;
font-weight: 400;
line-height: 1.471;
}
.special-page {
color: #fff;
background: #3397e2;
}
.container {
width: 100%;
padding: 0;
}
.col-md-55, .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
float: left;
padding-right: 10px;
padding-left: 10px;
}
.col-middle {
margin-top: 5%;
}
.text-center {
text-align: center;
}
p {
margin: 0 0 10px;
}
img {
vertical-align: middle;
border: 0;
}
.text-error {
background: rgba(255,255,255,0.9);
color: #000;
padding: 25px 0;
margin: 120px 0;
}
h1 {
margin-top: 10px;
margin-bottom: 10px;
font-family: 'Montserrat', sans-serif;
font-size: 36px;
font-weight: 500;
line-height: 1.1;
color: inherit;
margin: 0.67em 0;
}
b, strong {
font-weight: bold;
}
.mid_center {
width: 370px;
margin: 0 auto;
text-align: center;
padding: 10px 20px;
}
.btn-success {
border: none;
box-shadow: none;
border-radius: 2px;
font-size: 1.4rem;
cursor: pointer;
background: #1fbc99;
border: 1px solid #1ba385;
}
.buttons, button, .btn {
margin-right: 5px;
}
#push, #footer {
height: 60px;
text-align: center;
color: #fff;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -2694,30 +2694,22 @@ class Cases
}
//Number records total
$criteriaCount = clone $criteria;
$criteriaCount->clearSelectColumns();
$criteriaCount->addSelectColumn('COUNT(' . \UsersPeer::USR_UID . ') AS NUM_REC');
$rsCriteriaCount = \UsersPeer::doSelectRS($criteriaCount);
$rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$result = $rsCriteriaCount->next();
$row = $rsCriteriaCount->getRow();
$numRecTotal = (int)($row['NUM_REC']);
$numRecTotal = \UsersPeer::doCount($criteria);
//Query
$conf = new \Configurations();
$sortFieldDefault = \UsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable();
if (!is_null($sortField) && trim($sortField) != '') {
$sortField = strtoupper($sortField);
if (in_array(\UsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) {
$sortField = \UsersPeer::TABLE_NAME . '.' . $sortField;
} else {
$sortField = \UsersPeer::USR_FIRSTNAME;
$sortField = $sortFieldDefault;
}
} else {
$sortField = \UsersPeer::USR_FIRSTNAME;
$sortField = $sortFieldDefault;
}
if (!is_null($sortDir) && trim($sortDir) != '' && strtoupper($sortDir) == 'DESC') {

View File

@@ -146,95 +146,6 @@ class Department
return $aDepts;
}
/**
* Get list for Assigned User
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*/
public function getAssignedUser($dep_uid)
{
$dep_uid = Validator::depUid($dep_uid);
$oDept = new \Department();
$oDept->Load( $dep_uid );
$manager = $oDept->getDepManager();
$oCriteria = new \Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL );
$oCriteria->add( UsersPeer::DEP_UID, $dep_uid );
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$dataTemp = $oDataset->getRow();
$aUsers[] = array_change_key_case($dataTemp, CASE_LOWER);
$index = sizeof( $aUsers ) - 1;
$aUsers[$index]['usr_supervisor'] = ($manager == $aUsers[$index]['usr_uid']) ? true : false;
}
return $aUsers;
}
/**
* Get list for Available User
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*/
public function getAvailableUser($dep_uid, $start = 0, $limit = 0, $search = '')
{
$dep_uid = Validator::depUid($dep_uid);
$start = (int)$start;
$start = abs($start);
if ($start != 0) {
$start+1;
}
$limit = (int)$limit;
$limit = abs($limit);
if ($limit == 0) {
$limit = 25;
} else {
$limit = (int)$limit;
}
$oCriteria = new \Criteria( 'workflow' );
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME );
$oCriteria->addSelectColumn( UsersPeer::USR_STATUS );
$oCriteria->add( UsersPeer::DEP_UID, '' );
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL );
$oCriteria->setLimit( $limit );
$oCriteria->setOffset( $start );
if ($search != '') {
$oCriteria->add( $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $search . '%', \Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $search . '%', \Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $search . '%', \Criteria::LIKE ) ) ) );
}
$oDataset = UsersPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$aUsers = array ();
while ($oDataset->next()) {
$dataTemp = $oDataset->getRow();
$aUsers[] = array_change_key_case($dataTemp, CASE_LOWER);
}
return $aUsers;
}
/**
* Assign User to Department
*
@@ -323,6 +234,217 @@ class Department
}
}
/**
* Get custom record
*
* @param array $record Record
*
* @return array Return an array with custom record
*/
private function __getUserCustomRecordFromRecord(array $record)
{
try {
$recordc = [
'usr_uid' => $record['USR_UID'],
'usr_username' => $record['USR_USERNAME'],
'usr_firstname' => $record['USR_FIRSTNAME'],
'usr_lastname' => $record['USR_LASTNAME'],
'usr_status' => $record['USR_STATUS']
];
if (isset($record['USR_SUPERVISOR'])) {
$recordc['usr_supervisor'] = $record['USR_SUPERVISOR'];
}
return $recordc;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get all Users of a Department (Assigned/Available)
*
* @param string $departmentUid Unique id of Department
* @param string $option Option (ASSIGNED, AVAILABLE)
* @param array $arrayFilterData Data of the filters
* @param string $sortField Field name to sort
* @param string $sortDir Direction of sorting (ASC, DESC)
* @param int $start Start
* @param int $limit Limit
* @param bool $flagRecord Flag that set the "getting" of record
* @param bool $throwException Flag to throw the exception (This only if the parameters are invalid)
* (TRUE: throw the exception; FALSE: returns FALSE)
*
* @return array Return an array with all Users of a Department, ThrowTheException/FALSE otherwise
*/
public function getUsers(
$departmentUid,
$option,
array $arrayFilterData = null,
$sortField = null,
$sortDir = null,
$start = null,
$limit = null,
$flagRecord = true,
$throwException = true
) {
try {
$arrayUser = array();
$numRecTotal = 0;
//Verify data and Set variables
$flagFilter = !is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']);
$result = \ProcessMaker\BusinessModel\Validator::validatePagerDataByPagerDefinition(
['$start' => $start, '$limit' => $limit],
['$start' => '$start', '$limit' => '$limit']
);
if ($result !== true) {
if ($throwException) {
throw new \Exception($result);
} else {
return false;
}
}
$arrayDepartmentData = $this->getDepartmentRecordByPk(
$departmentUid, ['$departmentUid' => '$departmentUid'], $throwException
);
if ($arrayDepartmentData === false) {
return false;
}
//Set variables
$filterName = 'filter';
if ($flagFilter) {
$arrayAux = [
'' => 'filter',
'LEFT' => 'lfilter',
'RIGHT' => 'rfilter'
];
$filterName = $arrayAux[
(isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : ''
];
}
//Get data
if (!is_null($limit) && (string)($limit) == '0') {
return [
'total' => $numRecTotal,
'start' => (int)((!is_null($start))? $start : 0),
'limit' => (int)((!is_null($limit))? $limit : 0),
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
'data' => $arrayUser
];
}
//Query
$criteria = new \Criteria('workflow');
$criteria->addSelectColumn(\UsersPeer::USR_UID);
$criteria->addSelectColumn(\UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
$criteria->addSelectColumn(\UsersPeer::USR_STATUS);
$criteria->add(\UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL);
switch ($option) {
case 'ASSIGNED':
$criteria->add(\UsersPeer::DEP_UID, $departmentUid, \Criteria::EQUAL);
break;
case 'AVAILABLE':
$criteria->add(\UsersPeer::DEP_UID, '', \Criteria::EQUAL);
break;
}
if ($flagFilter && trim($arrayFilterData['filter']) != '') {
$arraySearch = [
'' => '%' . $arrayFilterData['filter'] . '%',
'LEFT' => $arrayFilterData['filter'] . '%',
'RIGHT' => '%' . $arrayFilterData['filter']
];
$search = $arraySearch[
(isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : ''
];
$criteria->add(
$criteria->getNewCriterion(\UsersPeer::USR_USERNAME, $search, \Criteria::LIKE)->addOr(
$criteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, $search, \Criteria::LIKE)->addOr(
$criteria->getNewCriterion(\UsersPeer::USR_LASTNAME, $search, \Criteria::LIKE)))
);
}
//Number records total
$numRecTotal = \UsersPeer::doCount($criteria);
//Query
$conf = new \Configurations();
$sortFieldDefault = \UsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable();
if (!is_null($sortField) && trim($sortField) != '') {
$sortField = strtoupper($sortField);
if (in_array(\UsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) {
$sortField = \UsersPeer::TABLE_NAME . '.' . $sortField;
} else {
$sortField = $sortFieldDefault;
}
} else {
$sortField = $sortFieldDefault;
}
if (!is_null($sortDir) && trim($sortDir) != '' && strtoupper($sortDir) == 'DESC') {
$criteria->addDescendingOrderByColumn($sortField);
} else {
$criteria->addAscendingOrderByColumn($sortField);
}
if (!is_null($start)) {
$criteria->setOffset((int)($start));
}
if (!is_null($limit)) {
$criteria->setLimit((int)($limit));
}
$rsCriteria = \UsersPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
switch ($option) {
case 'ASSIGNED':
$record['USR_SUPERVISOR'] = $record['USR_UID'] == $arrayDepartmentData['DEP_MANAGER'];
break;
case 'AVAILABLE':
break;
}
$arrayUser[] = ($flagRecord)? $record : $this->__getUserCustomRecordFromRecord($record);
}
//Return
return [
'total' => $numRecTotal,
'start' => (int)((!is_null($start))? $start : 0),
'limit' => (int)((!is_null($limit))? $limit : 0),
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
'data' => $arrayUser
];
} catch (\Exception $e) {
throw $e;
}
}
/**
* Put Set Manager User
*

View File

@@ -1257,11 +1257,18 @@ class Light
*/
public function getConfiguration()
{
$sysConf = \System::getSystemConfiguration('', '', SYS_SYS);
$sysConf = \Bootstrap::getSystemConfiguration('','',SYS_SYS);
$multiTimeZone = false;
//Set Time Zone
/*----------------------------------********---------------------------------*/
if (\PMLicensedFeatures::getSingleton()->verifyfeature
('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
$multiTimeZone = (int)($sysConf['system_utc_time_zone']) == 1;
}
/*----------------------------------********---------------------------------*/
$offset = timezone_offset_get( new \DateTimeZone( $sysConf['time_zone'] ), new \DateTime() );
$response['timeZone'] = sprintf( "GMT%s%02d:%02d", ( $offset >= 0 ) ? '+' : '-', abs( $offset / 3600 ), abs( ($offset % 3600) / 60 ) );
$response['multiTimeZone'] = (isset($sysConf['system_utc_time_zone']) && $sysConf['system_utc_time_zone'])
?true:false;
$response['multiTimeZone'] = $multiTimeZone;
$fields = \System::getSysInfo();
$response['version'] = $fields['PM_VERSION'];

View File

@@ -14,34 +14,47 @@ namespace ProcessMaker\BusinessModel\Light;
class PushMessageIOS
{
var $url = 'ssl://gateway.sandbox.push.apple.com:2195';
var $passphrase = "sample";
var $pemFile;
var $devices = array();
var $response = array();
private $url = 'ssl://gateway.sandbox.push.apple.com:2195';
private $passphrase = "sample";
private $pemFile = 'mobileios.pem';
private $devices = array();
private $response = array();
/**
* Sete server notification Ios
* @param $url string the url server
*/
function setUrl($url){
public function setUrl($url)
{
$this->url = $url;
}
/**
* Constructor
* @param $passphrase update your private key's
* Set key passphrase
* @param string $passphrase update your private key's
*/
function setKey($passphrase){
public function setKey($passphrase)
{
$this->passphrase = $passphrase;
}
/**
* Set the devices token to send to
* @param $deviceIds array of device tokens to send to
* Set name file .pem
* @param string $file name file .pem
*/
function setDevices($devicesToken)
public function setPemFile($file)
{
if(is_array($devicesToken)){
$file = file_exists(PATH_CONFIG . $file)?$file:'mobileios.pem';
$this->pemFile = $file;
}
/**
* Set the devices token to send to
* @param array $devicesToken of device tokens to send to
*/
public function setDevices($devicesToken)
{
if (is_array($devicesToken)) {
$this->devices = $devicesToken;
} else {
$this->devices = array($devicesToken);
@@ -53,27 +66,30 @@ class PushMessageIOS
*/
public function setSettingNotification()
{
$conf = \System::getSystemConfiguration( PATH_CONFIG . 'mobile.ini' );
$conf = \System::getSystemConfiguration(PATH_CONFIG . 'mobile.ini');
$this->setUrl($conf['apple']['url']);
$this->setKey($conf['apple']['passphrase']);
$this->setPemFile($conf['apple']['pemFile']);
}
/**
* Send the message to the device
* @param $message the message to send
* @return mixed
* @param $message string the message to send
* @param $data object for payload body
* @return array
* @throws \Exception
*/
function send($message, $data)
public function send($message, $data)
{
if(!is_array($this->devices) || count($this->devices) == 0){
if (!is_array($this->devices) || count($this->devices) == 0) {
$this->error("No devices set");
}
if(strlen($this->passphrase) < 8){
if (strlen($this->passphrase) < 8) {
$this->error("Server API Key not set");
}
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', PATH_CONFIG . 'mobileios.pem');
stream_context_set_option($ctx, 'ssl', 'local_cert', PATH_CONFIG . $this->pemFile);
stream_context_set_option($ctx, 'ssl', 'passphrase', $this->passphrase);
// Open a connection to the APNS server
@@ -88,7 +104,7 @@ class PushMessageIOS
$body['aps'] = array(
'alert' => $message,
'sound' => 'default',
'data' => $data
'data' => $data
);
} else {
$body['aps'] = array(
@@ -112,7 +128,7 @@ class PushMessageIOS
$fp = stream_socket_client($this->url, $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp) {
throw (new \Exception( \G::LoadTranslation( 'ID_FAILED' ).': ' ."$err $errstr"));
throw (new \Exception(\G::LoadTranslation('ID_FAILED') . ': ' . "$err $errstr"));
} else {
//echo 'Apple service is online. ' . '<br />';
}
@@ -138,7 +154,8 @@ class PushMessageIOS
return $this->response;
}
function error($msg){
public function error($msg)
{
echo "Android send notification failed with error:";
echo "\t" . $msg;
}

View File

@@ -217,48 +217,6 @@ class User
}
}
/**
* Get criteria for User
*
* @param string $roleUid Unique id of Role
* @param array $arrayUserUidExclude Unique id of Users to exclude
*
* return object
*/
public function getUserCriteria($roleUid, array $arrayUserUidExclude = null)
{
try {
$criteria = new \Criteria("rbac");
$criteria->addSelectColumn(\RbacUsersPeer::USR_UID);
$criteria->addSelectColumn(\RbacUsersPeer::USR_USERNAME);
$criteria->addSelectColumn(\RbacUsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(\RbacUsersPeer::USR_LASTNAME);
$criteria->addSelectColumn(\RbacUsersPeer::USR_STATUS);
$criteria->addAlias("USR", \RbacUsersPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\RbacUsersPeer::USR_UID, "USR.USR_UID", \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
if ($roleUid != "") {
$criteria->addJoin(\UsersRolesPeer::USR_UID, \RbacUsersPeer::USR_UID, \Criteria::LEFT_JOIN);
$criteria->add(\UsersRolesPeer::ROL_UID, $roleUid, \Criteria::EQUAL);
}
$criteria->add("USR.USR_USERNAME", "", \Criteria::NOT_EQUAL);
if (!is_null($arrayUserUidExclude) && is_array($arrayUserUidExclude)) {
$criteria->add(\RbacUsersPeer::USR_UID, $arrayUserUidExclude, \Criteria::NOT_IN);
}
return $criteria;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data of a User from a record
*
@@ -299,7 +257,11 @@ class User
try {
$arrayUser = array();
//Verify data
$numRecTotal = 0;
//Verify data and Set variables
$flagFilter = !is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']);
$process = new \ProcessMaker\BusinessModel\Process();
$role = new \ProcessMaker\BusinessModel\Role();
@@ -314,56 +276,89 @@ class User
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
//Get data
if (!is_null($limit) && $limit . "" == "0") {
return $arrayUser;
//Set variables
$filterName = 'filter';
if ($flagFilter) {
$arrayAux = [
'' => 'filter',
'LEFT' => 'lfilter',
'RIGHT' => 'rfilter'
];
$filterName = $arrayAux[
(isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : ''
];
}
//SQL
//Get data
if (!is_null($limit) && (string)($limit) == '0') {
return [
'total' => $numRecTotal,
'start' => (int)((!is_null($start))? $start : 0),
'limit' => (int)((!is_null($limit))? $limit : 0),
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
'data' => $arrayUser
];
}
//Query
$criteria = new \Criteria('rbac');
$criteria->addSelectColumn(\RbacUsersPeer::USR_UID);
$criteria->addSelectColumn(\RbacUsersPeer::USR_USERNAME);
$criteria->addSelectColumn(\RbacUsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(\RbacUsersPeer::USR_LASTNAME);
$criteria->addSelectColumn(\RbacUsersPeer::USR_STATUS);
$criteria->addJoin(\RbacUsersPeer::USR_UID, \UsersRolesPeer::USR_UID, \Criteria::LEFT_JOIN);
$criteria->add(\RbacUsersPeer::USR_USERNAME, '', \Criteria::NOT_EQUAL);
switch ($option) {
case "USERS":
//Criteria
$criteria = $this->getUserCriteria($roleUid);
$criteria->add(\UsersRolesPeer::ROL_UID, $roleUid, \Criteria::EQUAL);
break;
case "AVAILABLE-USERS":
//Get Uids
$arrayUid = array();
$criteria = $this->getUserCriteria($roleUid);
$rsCriteria = \RbacUsersPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayUid[] = $row["USR_UID"];
}
//Criteria
$criteria = $this->getUserCriteria("", $arrayUid);
$criteria->add(\UsersRolesPeer::ROL_UID, $roleUid, \Criteria::NOT_EQUAL);
break;
}
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]) && trim($arrayFilterData["filter"]) != "") {
if ($flagFilter && trim($arrayFilterData['filter']) != '') {
$arraySearch = [
'' => '%' . $arrayFilterData['filter'] . '%',
'LEFT' => $arrayFilterData['filter'] . '%',
'RIGHT' => '%' . $arrayFilterData['filter']
];
$search = $arraySearch[
(isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : ''
];
$criteria->add(
$criteria->getNewCriterion(\RbacUsersPeer::USR_USERNAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)->addOr(
$criteria->getNewCriterion(\RbacUsersPeer::USR_FIRSTNAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)->addOr(
$criteria->getNewCriterion(\RbacUsersPeer::USR_LASTNAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)))
$criteria->getNewCriterion(\RbacUsersPeer::USR_USERNAME, $search, \Criteria::LIKE)->addOr(
$criteria->getNewCriterion(\RbacUsersPeer::USR_FIRSTNAME, $search, \Criteria::LIKE)->addOr(
$criteria->getNewCriterion(\RbacUsersPeer::USR_LASTNAME, $search, \Criteria::LIKE)))
);
}
//SQL
if (!is_null($sortField) && trim($sortField) != "") {
//Number records total
$numRecTotal = \RbacUsersPeer::doCount($criteria);
//Query
$conf = new \Configurations();
$sortFieldDefault = \RbacUsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable();
if (!is_null($sortField) && trim($sortField) != '') {
$sortField = strtoupper($sortField);
if (in_array($sortField, array("USR_UID", "USR_USERNAME", "USR_FIRSTNAME", "USR_LASTNAME", "USR_STATUS"))) {
$sortField = \RbacUsersPeer::TABLE_NAME . "." . $sortField;
if (in_array(\RbacUsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) {
$sortField = \RbacUsersPeer::TABLE_NAME . '.' . $sortField;
} else {
$sortField = \RbacUsersPeer::USR_USERNAME;
$sortField = $sortFieldDefault;
}
} else {
$sortField = \RbacUsersPeer::USR_USERNAME;
$sortField = $sortFieldDefault;
}
if (!is_null($sortDir) && trim($sortDir) != "" && strtoupper($sortDir) == "DESC") {
@@ -390,7 +385,13 @@ class User
}
//Return
return $arrayUser;
return [
'total' => $numRecTotal,
'start' => (int)((!is_null($start))? $start : 0),
'limit' => (int)((!is_null($limit))? $limit : 0),
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
'data' => $arrayUser
];
} catch (\Exception $e) {
throw $e;
}

View File

@@ -64,8 +64,12 @@ class Department extends Api
{
try {
$oDepartment = new \ProcessMaker\BusinessModel\Department();
$response = $oDepartment->getAssignedUser($dep_uid);
return $response;
$response = $oDepartment->getUsers(
$dep_uid, 'ASSIGNED', null, null, null, null, null, false
);
return $response['data'];
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -82,12 +86,16 @@ class Department extends Api
* @return array
*
*/
public function doGetAvailableUser($dep_uid, $start = 0, $limit = 0, $search = '')
public function doGetAvailableUser($dep_uid, $start = null, $limit = null, $search = null)
{
try {
$oDepartment = new \ProcessMaker\BusinessModel\Department();
$response = $oDepartment->getAvailableUser($dep_uid, $start, $limit, $search);
return $response;
$response = $oDepartment->getUsers(
$dep_uid, 'AVAILABLE', ['filter' => $search, 'filterOption' => ''], null, null, $start, $limit, false
);
return $response['data'];
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}

View File

@@ -25,7 +25,8 @@ class Light extends Api
//return lists
'date',
'delegateDate',
'dueDate'
'dueDate',
'delRiskDate'
];
/**
* Get list counters

View File

@@ -38,9 +38,13 @@ class User extends Api
public function doGetUsers($rol_uid, $filter = null, $start = null, $limit = null)
{
try {
$response = $this->roleUser->getUsers($rol_uid, (preg_match("/^.*\/users$/", $this->restler->url))? "USERS" : "AVAILABLE-USERS", array("filter" => $filter), null, null, $start, $limit);
$option = (preg_match('/^.*\/users$/', $this->restler->url))? 'USERS' : 'AVAILABLE-USERS';
return $response;
$response = $this->roleUser->getUsers(
$rol_uid, $option, ['filter' => $filter, 'filterOption' => ''], null, null, $start, $limit
);
return $response['data'];
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}

View File

@@ -20,8 +20,6 @@ new Ext.KeyMap(document, {
}
});
var storeP;
var storeA;
var cmodelP;
var smodelA;
var smodelP;
@@ -45,7 +43,16 @@ var sw_func_auth;
var sw_form_changed;
var sw_user_summary;
var pagingUser;
var pagingAvailableUser;
Ext.onReady(function(){
var loadMaskGridLoading = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING_GRID")});
//Variables
var pageSizeU = parseInt(CONFIG.pageSize);
var pageSizeA = parseInt(CONFIG.pageSize);
sw_func_groups = false;
//sw_func_reassign = false;
sw_func_auth = false;
@@ -63,7 +70,7 @@ Ext.onReady(function(){
handler: CancelEditMembersAction
//hidden: true
});
supervisorButton = new Ext.Action({
text: _('ID_SET_MANAGER'),
iconCls: 'button_menu_ext ss_sprite ss_user_edit',
@@ -83,42 +90,164 @@ Ext.onReady(function(){
iconCls: 'button_menu_ext ss_sprite ss_arrow_redo',
handler: BackToUsers
});
contextMenu = new Ext.menu.Menu({
items: [supervisorButton]
});
storeP = new Ext.data.GroupingStore( {
proxy : new Ext.data.HttpProxy({
url: 'departments_Ajax?action=assignedUsers&dUID=' + DEPARTMENT.DEP_UID
}),
reader : new Ext.data.JsonReader( {
root: 'users',
fields : [
{name : 'USR_UID'},
{name : 'USR_USERNAME'},
{name : 'USR_FIRSTNAME'},
{name : 'USR_LASTNAME'},
{name : 'USR_SUPERVISOR'},
{name : 'USR_STATUS'}
]
})
//Stores
var storePageSize = new Ext.data.SimpleStore({
fields: ["size"],
data: [["20"], ["30"], ["40"], ["50"], ["100"]],
autoLoad: true
});
storeA = new Ext.data.GroupingStore( {
proxy : new Ext.data.HttpProxy({
url: 'departments_Ajax?action=availableUsers&dUID=' + DEPARTMENT.DEP_UID
}),
reader : new Ext.data.JsonReader( {
root: 'users',
fields : [
{name : 'USR_UID'},
{name : 'USR_USERNAME'},
{name : 'USR_FIRSTNAME'},
{name : 'USR_LASTNAME'},
{name : 'USR_STATUS'}
]
})
var storeUser = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: "departments_Ajax",
method: "POST"
}),
reader: new Ext.data.JsonReader({
root: "resultRoot",
totalProperty: "resultTotal",
fields: [
{name: "USR_UID"},
{name: "USR_USERNAME"},
{name: "USR_FIRSTNAME"},
{name: "USR_LASTNAME"},
{name: "USR_SUPERVISOR"},
{name: "USR_STATUS"}
]
}),
remoteSort: true,
listeners: {
beforeload: function (store)
{
loadMaskGridLoading.show();
this.baseParams = {
"option": "ASSIGNED",
"departmentUid": DEPARTMENT.DEP_UID,
"pageSize": pageSizeU,
"filter": searchTextP.getValue(),
"action": "assignedUsers"
};
},
load: function (store, record, opt)
{
loadMaskGridLoading.hide();
}
}
});
var storeAvailableUser = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: "departments_Ajax",
method: "POST"
}),
reader: new Ext.data.JsonReader({
root: "resultRoot",
totalProperty: "resultTotal",
fields: [
{name: "USR_UID"},
{name: "USR_USERNAME"},
{name: "USR_FIRSTNAME"},
{name: "USR_LASTNAME"},
{name: "USR_STATUS"}
]
}),
remoteSort: true,
listeners: {
beforeload: function (store)
{
loadMaskGridLoading.show();
this.baseParams = {
"option": "AVAILABLE",
"departmentUid": DEPARTMENT.DEP_UID,
"pageSize": pageSizeA,
"filter": searchTextA.getValue(),
"action": "availableUsers"
};
},
load: function (store, record, opt)
{
loadMaskGridLoading.hide();
}
}
});
//Components
var cboPageSizeUser = new Ext.form.ComboBox({
id: "cboPageSizeUser",
mode: "local",
triggerAction: "all",
store: storePageSize,
valueField: "size",
displayField: "size",
width: 50,
editable: false,
listeners: {
select: function (combo, record, index)
{
pageSizeU = parseInt(record.data["size"]);
pagingUser.pageSize = pageSizeU;
pagingUser.moveFirst();
}
}
});
pagingUser = new Ext.PagingToolbar({
id: "pagingUser",
pageSize: pageSizeU,
store: storeUser,
displayInfo: true,
displayMsg: _("ID_GRID_PAGE_DISPLAYING_ITEMS"),
emptyMsg: _("ID_NO_RECORDS_FOUND"),
items: ["-", _("ID_PAGE_SIZE") + "&nbsp;", cboPageSizeUser]
});
var cboPageSizeAvailableUser = new Ext.form.ComboBox({
id: "cboPageSizeAvailableUser",
mode: "local",
triggerAction: "all",
store: storePageSize,
valueField: "size",
displayField: "size",
width: 50,
editable: false,
listeners: {
select: function (combo, record, index)
{
pageSizeA = parseInt(record.data["size"]);
pagingAvailableUser.pageSize = pageSizeA;
pagingAvailableUser.moveFirst();
}
}
});
pagingAvailableUser = new Ext.PagingToolbar({
id: "pagingAvailableUser",
pageSize: pageSizeA,
store: storeAvailableUser,
displayInfo: true,
displayMsg: _("ID_GRID_PAGE_DISPLAYING_ITEMS"),
emptyMsg: _("ID_NO_RECORDS_FOUND"),
items: ["-", _("ID_PAGE_SIZE") + "&nbsp;", cboPageSizeAvailableUser]
});
cmodelP = new Ext.grid.ColumnModel({
@@ -214,7 +343,7 @@ Ext.onReady(function(){
title : _('ID_AVAILABLE_USERS'),
region : 'center',
ddGroup : 'assignedGridDDGroup',
store : storeA,
store: storeAvailableUser,
cm : cmodelP,
sm : smodelA,
enableDragDrop : true,
@@ -232,7 +361,7 @@ Ext.onReady(function(){
columnLines : false,
viewConfig : {forceFit:true},
tbar: [cancelEditMembersButton,{xtype: 'tbfill'},'-',searchTextA,clearTextButtonA],
//bbar: [{xtype: 'tbfill'}, cancelEditMembersButton],
bbar: pagingAvailableUser,
listeners: {rowdblclick: AssignGroupsAction},
hidden: true
});
@@ -241,7 +370,7 @@ Ext.onReady(function(){
layout : 'fit',
title : _('ID_ASSIGNED_USERS'),
ddGroup : 'availableGridDDGroup',
store : storeP,
store: storeUser,
cm : cmodelP,
sm : smodelP,
enableDragDrop : true,
@@ -259,21 +388,21 @@ Ext.onReady(function(){
columnLines : false,
viewConfig : {forceFit:true},
tbar: [editMembersButton,'-',supervisorButton, NoSupervisorButton,{xtype: 'tbfill'},'-',searchTextP,clearTextButtonP],
//bbar: [{xtype: 'tbfill'},editMembersButton],
bbar: pagingUser,
listeners: {rowdblclick: function(){
(availableGrid.hidden)? DoNothing() : RemoveGroupsAction();
}
}
});
assignedGrid.on('rowcontextmenu',
assignedGrid.on('rowcontextmenu',
function (grid, rowIndex, evt) {
var sm = grid.getSelectionModel();
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
},
this
);
assignedGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
assignedGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
@@ -315,12 +444,15 @@ Ext.onReady(function(){
tbar: ['<b>'+_('ID_DEPARTMENT') + ' : ' + DEPARTMENT.DEP_TITLE + '</b>',{xtype: 'tbfill'},backButton]
});
cboPageSizeUser.setValue(pageSizeU);
cboPageSizeAvailableUser.setValue(pageSizeA);
//LOAD ALL PANELS
viewport = new Ext.Viewport({
layout: 'border',
items: [northPanel, UsersPanel]
});
RefreshUsers();
DDLoadUsers();
@@ -477,12 +609,12 @@ RemoveAllGroupsAction = function(){
//Function DoSearch Available
DoSearchA = function(){
availableGrid.store.load({params: {textFilter: searchTextA.getValue()}});
pagingAvailableUser.moveFirst();
};
//Function DoSearch Assigned
DoSearchP = function(){
assignedGrid.store.load({params: {textFilter: searchTextP.getValue()}});
pagingUser.moveFirst();
};
//Load Grid By Default Available Members
@@ -516,11 +648,11 @@ CancelEditMembersAction = function(){
if (rowsSelected.length == 1){
supervisorButton.enable();
NoSupervisorButton.enable();
}
}
else{
supervisorButton.disable();
NoSupervisorButton.disable();
}
}
UsersPanel.doLayout();
};

View File

@@ -28,6 +28,7 @@
var SYS_SYS = "{$SYS_SYS}";
var SYS_LANG = "{$SYS_LANG}";
var SYS_SKIN = "{$SYS_SKIN}";
var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}";
</script>
<script type="text/javascript" src="/lib-dev/js/wz_jsgraphics.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery-1.10.2.min.js"></script>
@@ -81,6 +82,7 @@
var SYS_SYS = "{$SYS_SYS}";
var SYS_LANG = "{$SYS_LANG}";
var SYS_SKIN = "{$SYS_SKIN}";
var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}";
</script>
<script type="text/javascript" src="/lib/js/mafe-{$buildhash}.js"></script>

View File

@@ -26,8 +26,6 @@ var storeA;
var cmodelP;
var smodelA;
var smodelP;
var storeU;
var storeX;
var cmodelU;
var smodelU;
var smodelX;
@@ -54,6 +52,9 @@ var removeUAllButton;
var backButton;
var editForm;
var pagingUser;
var pagingAvailableUser;
var sw_func_permissions;
var sw_func_users;
@@ -83,12 +84,12 @@ GridByDefaultP = function(){
//Function DoSearch Available
DoSearchU = function(){
availableUGrid.store.load({params: {textFilter: searchTextU.getValue()}});
pagingAvailableUser.moveFirst();
};
//Function DoSearch Assigned
DoSearchX = function(){
assignedUGrid.store.load({params: {textFilter: searchTextX.getValue()}});
pagingUser.moveFirst();
};
//Load Grid By Default Available Members
@@ -149,6 +150,11 @@ CancelEditPermissionsActionU = function(){
Ext.onReady(function(){
var loadMaskUserPermission = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING_GRID")});
//Variables
var pageSizeU = parseInt(CONFIG.pageSize);
var pageSizeA = parseInt(CONFIG.pageSize);
sw_func_permissions = false;
sw_func_users = false;
@@ -404,34 +410,154 @@ Ext.onReady(function(){
});
storeU = new Ext.data.GroupingStore({
proxy : new Ext.data.HttpProxy({
url: 'data_rolesUsers?rUID=' + ROLES.ROL_UID + '&type=list'
}),
reader : new Ext.data.JsonReader( {
root: 'users',
fields : [
{name : 'USR_UID'},
{name : 'USR_USERNAME'},
{name : 'USR_FIRSTNAME'},
{name : 'USR_LASTNAME'}
]
})
//Stores
var storePageSize = new Ext.data.SimpleStore({
fields: ["size"],
data: [["20"], ["30"], ["40"], ["50"], ["100"]],
autoLoad: true
});
storeX = new Ext.data.GroupingStore({
proxy : new Ext.data.HttpProxy({
url: 'data_rolesUsers?rUID=' + ROLES.ROL_UID + '&type=show'
}),
reader : new Ext.data.JsonReader( {
root: 'users',
fields : [
{name : 'USR_UID'},
{name : 'USR_USERNAME'},
{name : 'USR_FIRSTNAME'},
{name : 'USR_LASTNAME'}
]
})
var storeUser = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: "data_rolesUsers",
method: "POST"
}),
reader: new Ext.data.JsonReader({
root: "resultRoot",
totalProperty: "resultTotal",
fields: [
{name: 'USR_UID'},
{name: 'USR_USERNAME'},
{name: 'USR_FIRSTNAME'},
{name: 'USR_LASTNAME'}
]
}),
remoteSort: true,
listeners: {
beforeload: function (store)
{
loadMaskUserPermission.show();
this.baseParams = {
"option": "USERS",
"roleUid": ROLES.ROL_UID,
"pageSize": pageSizeU,
"filter": searchTextX.getValue()
};
},
load: function (store, record, opt)
{
loadMaskUserPermission.hide();
}
}
});
var storeAvailableUser = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: "data_rolesUsers",
method: "POST"
}),
reader: new Ext.data.JsonReader({
root: "resultRoot",
totalProperty: "resultTotal",
fields: [
{name: 'USR_UID'},
{name: 'USR_USERNAME'},
{name: 'USR_FIRSTNAME'},
{name: 'USR_LASTNAME'}
]
}),
remoteSort: true,
listeners: {
beforeload: function (store)
{
loadMaskUserPermission.show();
this.baseParams = {
"option": "AVAILABLE-USERS",
"roleUid": ROLES.ROL_UID,
"pageSize": pageSizeA,
"filter": searchTextU.getValue()
};
},
load: function (store, record, opt)
{
loadMaskUserPermission.hide();
}
}
});
//Components
var cboPageSizeUser = new Ext.form.ComboBox({
id: "cboPageSizeUser",
mode: "local",
triggerAction: "all",
store: storePageSize,
valueField: "size",
displayField: "size",
width: 50,
editable: false,
listeners: {
select: function (combo, record, index)
{
pageSizeU = parseInt(record.data["size"]);
pagingUser.pageSize = pageSizeU;
pagingUser.moveFirst();
}
}
});
pagingUser = new Ext.PagingToolbar({
id: "pagingUser",
pageSize: pageSizeU,
store: storeUser,
displayInfo: true,
displayMsg: _("ID_GRID_PAGE_DISPLAYING_ITEMS"),
emptyMsg: _("ID_NO_RECORDS_FOUND"),
items: ["-", _("ID_PAGE_SIZE") + "&nbsp;", cboPageSizeUser]
});
var cboPageSizeAvailableUser = new Ext.form.ComboBox({
id: "cboPageSizeAvailableUser",
mode: "local",
triggerAction: "all",
store: storePageSize,
valueField: "size",
displayField: "size",
width: 50,
editable: false,
listeners: {
select: function (combo, record, index)
{
pageSizeA = parseInt(record.data["size"]);
pagingAvailableUser.pageSize = pageSizeA;
pagingAvailableUser.moveFirst();
}
}
});
pagingAvailableUser = new Ext.PagingToolbar({
id: "pagingAvailableUser",
pageSize: pageSizeA,
store: storeAvailableUser,
displayInfo: true,
displayMsg: _("ID_GRID_PAGE_DISPLAYING_ITEMS"),
emptyMsg: _("ID_NO_RECORDS_FOUND"),
items: ["-", _("ID_PAGE_SIZE") + "&nbsp;", cboPageSizeAvailableUser]
});
cmodelU = new Ext.grid.ColumnModel({
@@ -510,7 +636,7 @@ Ext.onReady(function(){
title : _('ID_AVAILABLE_USERS'),
region : 'center',
ddGroup : 'assignedUGridDDGroup',
store : storeX,
store: storeAvailableUser,
cm : cmodelU,
sm : smodelX,
enableDragDrop : true,
@@ -528,7 +654,7 @@ Ext.onReady(function(){
columnLines : false,
viewConfig : {forceFit:true},
tbar: [cancelEditPermissionsUButton,{xtype: 'tbfill'},'-',searchTextU, clearTextButtonU],
//bbar: [{xtype: 'tbfill'}, assignUAllButton],
bbar: pagingAvailableUser,
listeners: {rowdblclick: AssignUserAction},
hidden : true
});
@@ -537,7 +663,7 @@ Ext.onReady(function(){
layout : 'fit',
title : _('ID_ASSIGNED_USERS'),
ddGroup : 'availableUGridDDGroup',
store : storeU,
store: storeUser,
cm : cmodelU,
sm : smodelU,
enableDragDrop : false,
@@ -554,7 +680,8 @@ Ext.onReady(function(){
frame : false,
columnLines : false,
viewConfig : {forceFit:true},
tbar : [editPermissionsUButton,{xtype: 'tbfill'},'-',searchTextX, clearTextButtonX]
tbar: [editPermissionsUButton, {xtype: "tbfill"}, "-", searchTextX, clearTextButtonX],
bbar: pagingUser
});
buttonsUPanel = new Ext.Panel({
@@ -613,6 +740,9 @@ Ext.onReady(function(){
}
});
cboPageSizeUser.setValue(pageSizeU);
cboPageSizeAvailableUser.setValue(pageSizeA);
//LOAD ALL PANELS
viewport = new Ext.Viewport({
layout: 'border',