BUG 8875 "Feature: New ExtJS based Login & Main ProcessMaker inter..." 3rd

- fixed compatibilities to user default redirection after login
-  user experience simplified compatibilities with uxmodern interface
This commit is contained in:
Erik Amaru Ortiz
2012-04-05 12:52:33 -04:00
parent 7dac53be11
commit 561832bb06
15 changed files with 336 additions and 518 deletions

View File

@@ -31,6 +31,11 @@ class Controller
* @var string - response type var. possibles values: json|plain
*/
private $responseType = '';
/**
* @var string - layout to pass skinEngine
*/
private $layout = '';
/**
* Magic setter method

View File

@@ -666,23 +666,17 @@ class G
$G_CONTENT = $objContent;
$G_TEMPLATE = $strTemplate;
$G_SKIN = $strSkin;
//echo 'x'; g::dump($G_PUBLISH); die;
try {
///////G::LoadSkin( $strSkin );
//G::skinEngine($strSkin);
$file = G::ExpandPath( "skinEngine" ) . "skinEngine.php";
include $file;
$skinEngine = new SkinEngine($G_TEMPLATE, $G_SKIN, $G_CONTENT);
$skinEngine->setLayout($layout);
$skinEngine->dispatch();
}
catch ( Exception $e ) {
echo $aMessage['MESSAGE'] = $e->getMessage();
die;
$aMessage['MESSAGE'] = $e->getMessage();
global $G_PUBLISH;
global $G_MAIN_MENU;
global $G_SUB_MENU;
@@ -706,18 +700,6 @@ class G
die;
}
}
function skinEngine($strSkin){
// $file = G::ExpandPath( "skinEngine" ) . "skinEngine.php";
// require_once( $file );
$file = G::ExpandPath( "skinEngine" ) . "class.skinEngine.php";
//die($file);
include $file;
$skinEngine = new SkinEngine();
$skinEngine->dispatch();
}
/**
* Load a skin
@@ -994,18 +976,8 @@ class G
while ( count ( $URI_VARS ) > 0 && $exit == 0) {
$SYS_TARGET .= '/' . array_shift($URI_VARS);
}
// if ($SYS_TARGET == 'login') {
// if (isset($config['default_lang']) && !empty($config['default_lang'])) {
// $SYS_LANG = $config['default_lang'];
// }
// if (isset($config['default_skin']) && !empty($config['default_skin'])) {
// $SYS_SKIN = $config['default_skin'];
// }
// }
/* Fix to prevent use uxs skin outside siplified interface, because that skin is not compatible with others interfaces*/
/* Fix to prevent use uxs skin outside siplified interface,
because that skin is not compatible with others interfaces*/
if ($SYS_SKIN == 'uxs' && $SYS_COLLECTION !== 'home') {
$SYS_SKIN = 'classic';
}

View File

@@ -933,15 +933,25 @@ class System {
//Get Skin Config files
$skinListArray = array();
$customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml");
$configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
array_unshift($customSkins, $configurationFile);
// getting al base skins
$baseSkins = glob(G::ExpandPath("skinEngine") . '*/config.xml');
// filtering no public skins (uxs, simplified)
foreach ($baseSkins as $i => $skinName) {
if (strpos($skinName, 'simplified') !== false || strpos($skinName, 'uxs') !== false) {
unset($baseSkins[$i]);
}
}
$customSkins = array_merge($baseSkins, $customSkins);
//Read and parse each Configuration File
foreach ($customSkins as $key => $configInformation) {
$folderId = str_replace(G::ExpandPath("skinEngine") . 'base', "", str_replace(PATH_CUSTOM_SKINS, "", str_replace("/config.xml", "", $configInformation)));
$folderId = basename(dirname($configInformation));
if ($folderId == "") {
$folderId = "classic";
if ($folderId == 'base') {
$folderId = 'classic';
}
$xmlConfiguration = file_get_contents($configInformation);

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,6 @@ class Admin extends Controller
foreach ($skinsList['skins'] as $skin) {
$skins[] = array($skin['SKIN_FOLDER_ID'], $skin['SKIN_NAME']);
}
$skins[] = array('uxmodern', 'uxmodern');
foreach ($timeZonesList as $tz) {
$timeZones[] = array($tz, $tz);

View File

@@ -91,9 +91,16 @@ class adminProxy extends HttpProxyController
}
G::update_php_ini($envFile, $updatedConf);
if (substr($sysConf['default_skin'], 0, 2) == 'ux') {
$urlPart = '/main/login';
}
else {
$urlPart = '/login/login';
}
$this->success = true;
$this->restart = $restart;
$this->url = '/sys' . SYS_SYS . '/' . $sysConf['default_lang'] . '/' . $sysConf['default_skin'] . $urlPart;
$this->message = 'Saved Successfully';
}

View File

@@ -76,19 +76,29 @@ class Home extends Controller
return;
}
require_once 'classes/model/UsersProperties.php';
G::LoadClass('process');
G::LoadClass('case');
$userProperty = new UsersProperties();
$process = new Process();
$case = new Cases();
G::loadClass('system');
$sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini');
//Get ProcessStatistics Info
$start = 0;
$limit = '';
$proData = $process->getAllProcesses($start, $limit);
$processList = $case->getStartCasesPerType ( $_SESSION ['USER_LOGGED'], 'category');
$switchLink = '../classic/cases/main'; //'../' . $this->lastSkin . '/cases/main';
$processList = $case->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category');
$switchLink = $userProperty->getUserLocation($_SESSION['USER_LOGGED']);
if (substr($sysConf['default_skin'], 0, 2) == 'ux') {
$_SESSION['_defaultUserLocation'] = $switchLink;
$switchLink = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main';
}
unset($processList[0]);

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,6 @@
try {
if (!$RBAC->singleSignOn) {
if (!isset($_POST['form']) ) {
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error');
G::header('Location: login');
@@ -43,9 +42,7 @@ try {
}
$uid = $RBAC->VerifyLogin($usr , $pwd);
$RBAC->cleanSessionFiles(72); //cleaning session files older than 72 hours
$sPwd = 'currentPwd';
switch ($uid) {
//The user does doesn't exist
@@ -85,8 +82,6 @@ try {
break;
}
$$sPwd = $pwd;
//to avoid empty string in user field. This will avoid a weird message "this row doesn't exist"
if ( !isset($uid) ) {
$uid = -1;
@@ -141,9 +136,9 @@ try {
//Execute the SSO Script from plugin
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ( $oPluginRegistry->existsTrigger ( PM_LOGIN ) ) {
$lSession="";
$loginInfo = new loginInfo ($usr, $pwd, $lSession );
$oPluginRegistry->executeTriggers ( PM_LOGIN , $loginInfo );
$lSession="";
$loginInfo = new loginInfo ($usr, $pwd, $lSession );
$oPluginRegistry->executeTriggers ( PM_LOGIN , $loginInfo );
}
$_SESSION['USER_LOGGED'] = $uid;
$_SESSION['USR_USERNAME'] = $usr;
@@ -225,88 +220,76 @@ try {
$c = file_get_contents(PATH_DATA_SITE . PATH_SEP . '.server_info');
if(md5($c) != md5($cput)){
file_put_contents(PATH_DATA_SITE . PATH_SEP . '.server_info', $cput);
}
}
}
/* Check password using policy - Start */
require_once 'classes/model/UsersProperties.php';
$oUserProperty = new UsersProperties();
if (!$RBAC->singleSignOn) {
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($_SESSION['USER_LOGGED'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($currentPwd)))));
$aErrors = $oUserProperty->validatePassword($_POST['form']['USR_PASSWORD'], $aUserProperty['USR_LAST_UPDATE_DATE'], $aUserProperty['USR_LOGGED_NEXT_TIME']);
if (!empty($aErrors)) {
if (!defined('NO_DISPLAY_USERNAME')) {
define('NO_DISPLAY_USERNAME', 1);
}
$aFields = array();
$aFields['DESCRIPTION'] = '<span style="font-weight:normal;">';
$aFields['DESCRIPTION'] .= G::LoadTranslation('ID_POLICY_ALERT').':<br /><br />';
foreach ($aErrors as $sError) {
switch ($sError) {
case 'ID_PPP_MINIMUM_LENGTH':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MINIMUM_LENGTH . '<br />';
$aFields[substr($sError, 3)] = PPP_MINIMUM_LENGTH;
break;
case 'ID_PPP_MAXIMUM_LENGTH':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MAXIMUM_LENGTH . '<br />';
$aFields[substr($sError, 3)] = PPP_MAXIMUM_LENGTH;
break;
case 'ID_PPP_EXPIRATION_IN':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . '<br />';
$aFields[substr($sError, 3)] = PPP_EXPIRATION_IN;
break;
default:
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).'<br />';
$aFields[substr($sError, 3)] = 1;
break;
}
}
$aFields['DESCRIPTION'] .= '<br />' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY') . '<br /><br /></span>';
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/changePassword', '', $aFields, 'changePassword');
G::RenderPage('publish');
die;
}
if (isset($_REQUEST['form']['URL']) && $_REQUEST['form']['URL'] != '') {
$sLocation = $_REQUEST['form']['URL'];
}
else {
if (isset($_REQUEST['u']) && $_REQUEST['u'] != '') {
$sLocation = $_REQUEST['u'];
}
else {
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
}
}
// getting default user location
if (isset($_REQUEST['form']['URL']) && $_REQUEST['form']['URL'] != '') {
$sLocation = $_REQUEST['form']['URL'];
}
else {
if (isset($_REQUEST['form']['URL']) && $_REQUEST['form']['URL'] != '') {
$sLocation = $_REQUEST['form']['URL'];
if (isset($_REQUEST['u']) && $_REQUEST['u'] != '') {
$sLocation = $_REQUEST['u'];
}
else {
if (isset($_REQUEST['u']) && $_REQUEST['u'] != '') {
$sLocation = $_REQUEST['u'];
}
else {
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
}
$sLocation = $oUserProperty->redirectTo($_SESSION['USER_LOGGED'], $lang);
}
}
if ($RBAC->singleSignOn) {
G::header('Location: ' . $sLocation);
die();
}
$aUserProperty = $oUserProperty->loadOrCreateIfNotExists($_SESSION['USER_LOGGED'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($pwd)))));
$aErrors = $oUserProperty->validatePassword($_POST['form']['USR_PASSWORD'], $aUserProperty['USR_LAST_UPDATE_DATE'], $aUserProperty['USR_LOGGED_NEXT_TIME']);
$oHeadPublisher =& headPublisher::getSingleton();
if (!empty($aErrors)) {
if (!defined('NO_DISPLAY_USERNAME')) {
define('NO_DISPLAY_USERNAME', 1);
}
$aFields = array();
$aFields['DESCRIPTION'] = '<span style="font-weight:normal;">';
$aFields['DESCRIPTION'] .= G::LoadTranslation('ID_POLICY_ALERT').':<br /><br />';
foreach ($aErrors as $sError) {
switch ($sError) {
case 'ID_PPP_MINIMUM_LENGTH':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MINIMUM_LENGTH . '<br />';
$aFields[substr($sError, 3)] = PPP_MINIMUM_LENGTH;
break;
case 'ID_PPP_MAXIMUM_LENGTH':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).': ' . PPP_MAXIMUM_LENGTH . '<br />';
$aFields[substr($sError, 3)] = PPP_MAXIMUM_LENGTH;
break;
case 'ID_PPP_EXPIRATION_IN':
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . '<br />';
$aFields[substr($sError, 3)] = PPP_EXPIRATION_IN;
break;
default:
$aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError).'<br />';
$aFields[substr($sError, 3)] = 1;
break;
}
}
$aFields['DESCRIPTION'] .= '<br />' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY') . '<br /><br /></span>';
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/changePassword', '', $aFields, 'changePassword');
G::RenderPage('publish');
die;
}
$oHeadPublisher = &headPublisher::getSingleton();
$oHeadPublisher->extJsInit = true;
$oHeadPublisher->addExtJsScript('login/init', false); //adding a javascript file .js
$oHeadPublisher->assign('uriReq', $sLocation);
G::RenderPage('publish', 'extJs');
//G::header('Location: ' . $sLocation);
die;
}
catch ( Exception $e ) {
$aMessage['MESSAGE'] = $e->getMessage();

View File

@@ -456,8 +456,8 @@ class SkinEngine
$viewFile = isset($contentFiles[0]) ? $contentFiles[0] : '';
if (empty($this->layout)) {
$smarty->template_dir = PATH_TPL;
$tpl = $viewFile;
$smarty->template_dir = PATH_TPL;
$tpl = $viewFile . '.html';
}
else {
$smarty->template_dir = $this->layoutFile['dirname'];

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<skinConfiguration>
<information>
<id>00000000000000000000000000000001</id>
<name>Classic</name>
<description>Classic/default skin</description>
<id>00000000000000000000000000000002</id>
<name>UxModern</name>
<description>UxModern skin</description>
<author>ProcessMaker Team</author>
<version>1.0</version>
<createDate>2011-02-27</createDate>
<modifiedDate>2011-02-28</modifiedDate>
<createDate>2012-04-05</createDate>
<modifiedDate>2012-04-05</modifiedDate>
</information>
<cssFiles>
<skin>

View File

@@ -2,6 +2,7 @@ Ext.onReady(function(){
var cmbSkins = new Ext.form.ComboBox({
fieldLabel : _('ID_DEFAULT_SKIN'),
id : 'default_skin',
hiddenName : 'default_skin',
store : new Ext.data.ArrayStore({
fields: ['ID', 'NAME'],
@@ -31,6 +32,7 @@ Ext.onReady(function(){
var cmbLang = new Ext.form.ComboBox({
fieldLabel : _('ID_DEFAULT_LANGUAGE'),
id : 'default_lang',
hiddenName : 'default_lang',
store : new Ext.data.ArrayStore({
fields: ['ID', 'NAME'],
@@ -161,13 +163,12 @@ function saveSettings()
if(response.restart) {
PMExt.confirm(_('ID_CONFIRM'), _('ID_SYSTEM_REDIRECT_CONFIRM'), function(){
if (typeof window.parent.parent != 'undefined')
window.parent.parent.location.href = '/';
window.parent.parent.location.href = response.url;
if (typeof window.parent != 'undefined')
window.parent.location.href = '/';
window.parent.location.href = response.url;
else
window.location.href = '/';
window.location.href = response.url;
});
}
else

View File

@@ -98,6 +98,24 @@ Main.configureComponents = function()
this.configuration.userMenu = {}
this.configuration.userMenu.items = new Array();
if (switchInterface) {
this.configuration.userMenu.items.push({
text : _("ID_SWITCH_INTERFACE"),
iconCls: 'ss_sprite ss_arrow_switch',
handler: function() {
var url = '../uxs/home';
if (typeof parent != 'undefined') {
parent.location.href = url;
}
else {
location.href = url;
}
}
});
}
this.configuration.userMenu.items.push({
text : _("ID_VIEW_EDIT_PROFILE"),
icon: '/images/profile-picture.png',

View File

@@ -419,6 +419,7 @@ Login.submit = function()
Login.submiting = true;
document.getElementById('language').value = Ext.getCmp('language').getValue();
document.forms[0].action = '../login/authentication';
document.forms[0].submit();
return;

View File

@@ -196,10 +196,10 @@ Login.initComponents = function()
data : languages
}),
listeners : {
afterrender : function(){
afterrender : function() {
var store = languagesCmb.getStore();
var i = store.findExact('id', defaultLang, 0);
if (i > -1){
if (i > -1) {
Ext.getCmp('language').setValue(store.getAt(i).data.id);
Ext.getCmp('language').setRawValue(store.getAt(i).data.name);
}
@@ -275,12 +275,12 @@ Login.submit = function()
}
Login.submiting = true;
document.getElementById('language').value = Ext.getCmp('language').getValue();
document.forms[0].action = '../login/sysLoginVerify';
document.forms[0].submit();
return;
Login.form.getForm().submit({
method: 'POST',
//waitTitle: '',