PM-3793 "Alert/update user profile if browser/computer..." SOLVED

Issue:
    Alert/update user profile if browser/computer timezone is different to profile timezone
Cause:
    New feature
Solution:
    Added functionality
This commit is contained in:
Victor Saisa Lopez
2015-11-27 15:38:27 -04:00
parent 626cfd55fe
commit d6052f0593
16 changed files with 392 additions and 118 deletions

View File

@@ -0,0 +1,32 @@
<script type="text/javascript">
{$form.JS}
</script>
<form id="{$form_id}" method="post" enctype="multipart/form-data" action="{$form_action}" class="form-signin" style="margin:0px;" accept-charset="UTF-8" role="form">
{$form.BROWSER_TIME_ZONE_OFFSET}
{$form.USR_USERNAME}
{$form.USR_PASSWORD}
{$form.USR_TIME_ZONE}
{$form.BROWSER_TIME_ZONE}
<fieldset>
<label class="panel-login">
<div class="login_result" style="text-align: left;">
{php}echo G::LoadTranslation("ID_TIME_ZONE_LOGIN_DESCRIPTION1");{/php}
{php}echo G::LoadTranslation("ID_TIME_ZONE_LOGIN_DESCRIPTION2");{/php}
{php}echo G::LoadTranslation("ID_TIME_ZONE_LOGIN_DESCRIPTION3");{/php}
<br />
<br />
<span id="details">{php}echo G::LoadTranslation("ID_TIME_ZONE_LOGIN_DESCRIPTION_DETAILS");{/php}</span>
</div>
</label>
</fieldset>
<fieldset>
{$form.BTNOK}
</fieldset>
</form>
<script src="/lib/pmdynaform/libs/respondjs/respond.min.js"></script>
<script src="/lib/pmdynaform/libs/html5shiv/html5shiv.js"></script>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlform" name="login/TimeZoneAlert" enabletemplate="1">
<BROWSER_TIME_ZONE_OFFSET type="hidden" />
<USR_USERNAME type="hidden" />
<USR_PASSWORD type="hidden" />
<USR_TIME_ZONE type="hidden" />
<BROWSER_TIME_ZONE type="hidden" />
<BTNOK type="submit">
<en></en>
</BTNOK>
<JS type="javascript">
<![CDATA[
window.onload= function ()
{
document.getElementById("form[BROWSER_TIME_ZONE_OFFSET]").value = getBrowserTimeZoneOffset();
var strHtml = document.getElementById("details").innerHTML;
strHtml = stringReplace("\\{0\\}", document.getElementById("form[USR_TIME_ZONE]").value, strHtml);
strHtml = stringReplace("\\{1\\}", document.getElementById("form[BROWSER_TIME_ZONE]").value, strHtml);
document.getElementById("details").innerHTML = strHtml;
document.getElementById("form[BTNOK]").value = _("ID_OK");
if (document.getElementById("form[BTNOK]").classList == undefined) {
document.getElementById("form[BTNOK]").className = "button-login-success";
} else {
document.getElementById("form[BTNOK]").classList.remove("module_app_button___gray");
document.getElementById("form[BTNOK]").classList.add("button-login-success");
}
};
]]>
</JS>
</dynaForm>

View File

@@ -2,6 +2,7 @@
id="{$form_id}" name="{$form_name}" action="{$form_action}" method="post" encType="multipart/form-data" onsubmit="return validateForm('{$form_objectRequiredFields}');">
<input type="hidden" class="notValidateThisFields" name="__notValidateThisFields__" id="__notValidateThisFields__" value="{$form_objectRequiredFields}" />
<input type="hidden" name="DynaformRequiredFields" id="DynaformRequiredFields" value="{$form_objectRequiredFields}" />
{$form.BROWSER_TIME_ZONE_OFFSET}
<div style="display: none;"> {$form.USR_PASSWORD}</div>
<fieldset>
<label class="panel-login">
@@ -11,7 +12,7 @@
{$form.USR_PASSWORD_MASK}
{$form.USER_LANG}
{$form.URL}
</fieldset>
<fieldset>
<label class="panel-login">
@@ -20,14 +21,14 @@
<br>
{$form.BSUBMIT}
{$form.FORGOT_PASWORD_LINK}
</fieldset>
<script type="text/javascript">
{$form.JS}
</script>
</form>
<script src="/lib/pmdynaform/libs/respondjs/respond.min.js"></script>
<script src="/lib/pmdynaform/libs/html5shiv/html5shiv.js"></script>
<script src="/lib/pmdynaform/libs/html5shiv/html5shiv.js"></script>
<script type="text/javascript">
try {literal}{{/literal} dynaformSetFocus();}catch(e){literal}{{/literal}}
</script>

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="login" version="1.0" basedir="" xmlform_type="NORMAL" width="400px" enabletemplate="1">
<BROWSER_TIME_ZONE_OFFSET type="hidden" />
<TITLE type="title">
<en><![CDATA[Login]]></en>
</TITLE>
@@ -38,34 +40,34 @@ function getElementsByClassNameIE8(node, classname) {
window.onload= function(){
var inputUser,
inputPass;
if(document.getElementById('form[USR_USERNAME]').placeholder == undefined && document.getElementById('form[BSUBMIT]').classList == undefined){
if(document.getElementById('form[USR_USERNAME]').placeholder == undefined && document.getElementById('form[BSUBMIT]').classList == undefined){
document.getElementById('form[USR_USERNAME]').value = _('ID_USER');
document.getElementById('form[USR_PASSWORD_MASK]').value = _('ID_PASSWORD');
document.getElementById('form[BSUBMIT]').className = "button-login-success";
inputUser = document.getElementById('form[USR_USERNAME]');
inputPass = document.getElementById('form[USR_PASSWORD_MASK]');
inputUser.attachEvent("onclick", function (){
if(_('ID_USER') == inputUser.value){
inputUser.value="";
}
}
});
inputUser.attachEvent("onblur", function (){
if(inputUser.value == ""){
inputUser.value=_('ID_USER');
}
}
});
inputPass.attachEvent("onclick", function (){
if(_('ID_PASSWORD') == inputPass.value){
inputPass.value="";
}
}
});
inputPass.attachEvent("onblur", function (){
if(inputPass.value == ""){
inputPass.value = _('ID_PASSWORD');
}
}
});
@@ -74,7 +76,7 @@ window.onload= function(){
document.getElementById('form[USR_PASSWORD_MASK]').placeholder = _('ID_PASSWORD');
document.getElementById('form[BSUBMIT]').classList.remove('module_app_button___gray');
document.getElementById('form[BSUBMIT]').classList.add('button-login-success');
}
}
};
// enable/disable forgot password link
@@ -158,8 +160,9 @@ leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function()
document.getElementById("form[USR_PASSWORD]").value = document.getElementById("form[USR_PASSWORD_MASK]").value;
document.getElementById("form[USR_PASSWORD_MASK]").value = "";
document.getElementById("form[BROWSER_TIME_ZONE_OFFSET]").value = getBrowserTimeZoneOffset();
if(!navigator.userAgent.indexOf("MSIE 8.0")>0)
document.getElementById("form[USR_PASSWORD_MASK]").setAttribute("type", "text");
document.getElementById("form[USR_PASSWORD_MASK]").setAttribute("type", "text");
document.login.submit();
}.extend(document.getElementById('form[BSUBMIT]')));

View File

@@ -2,14 +2,15 @@
<input type="hidden" class="notValidateThisFields" name="__notValidateThisFields__" id="__notValidateThisFields__" value="{$form_objectRequiredFields}" />
<input type="hidden" name="DynaformRequiredFields" id="DynaformRequiredFields" value="{$form_objectRequiredFields}" />
<input type="hidden" name="__DynaformName__" id="__DynaformName__" value="{$form_name}" />
{$form.BROWSER_TIME_ZONE_OFFSET}
<div style="display: none;"> {$form.USR_PASSWORD}</div>
<fieldset>
<label class="panel-login">
<div class="login_result"></div>
</label>
{$form.USR_USERNAME}
{$form.USR_PASSWORD_MASK}
{$form.USR_PASSWORD_MASK}
</fieldset>
<fieldset>
<label class="panel-login">
@@ -17,13 +18,14 @@
</label>
{$form.USER_ENV}
{$form.USER_LANG}
<br>
{$form.BSUBMIT}
{$form.BSUBMIT}
</fieldset>
<script src="/lib/pmdynaform/libs/respondjs/respond.min.js"></script>
<script src="/lib/pmdynaform/libs/html5shiv/html5shiv.js"></script>
<script type="text/javascript">
<script src="/lib/pmdynaform/libs/html5shiv/html5shiv.js"></script>
<script type="text/javascript">
{$form.JS}
</script>
</form>

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="sysLogin" version="1.0" basedir="" xmlform_type="NORMAL" width="400px" enabletemplate="1">
<BROWSER_TIME_ZONE_OFFSET type="hidden" />
<TITLE type="title">
<en><![CDATA[Login]]></en>
</TITLE>
@@ -44,7 +46,7 @@ function createEvent(elem, event, fn) {
window.onload= function(){
var inputUser,
inputWs,
inputPass;
inputPass;
if(document.getElementById('form[USR_USERNAME]').placeholder === undefined && document.getElementById('form[BSUBMIT]').classList == undefined){
document.getElementById('form[USR_USERNAME]').value = _('ID_USER');
document.getElementById('form[USR_PASSWORD_MASK]').value = _('ID_PASSWORD');
@@ -52,49 +54,49 @@ window.onload= function(){
document.getElementById('form[BSUBMIT]').className = "button-login-success";
inputUser = document.getElementById('form[USR_USERNAME]');
inputPass = document.getElementById('form[USR_PASSWORD_MASK]');
inputWs = document.getElementById('form[USER_ENV]');
inputWs = document.getElementById('form[USER_ENV]');
inputUser.attachEvent("onclick", function (){
if(_('ID_USER') == inputUser.value){
inputUser.value="";
}
}
});
inputUser.attachEvent("onblur", function (){
if(inputUser.value == ""){
inputUser.value=_('ID_USER');
}
}
});
inputPass.attachEvent("onclick", function (){
if(_('ID_PASSWORD') == inputPass.value){
inputPass.value="";
}
}
});
inputPass.attachEvent("onblur", function (){
if(inputPass.value == ""){
inputPass.value = _('ID_PASSWORD');
}
}
});
inputWs.attachEvent("onclick", function (){
if(_('ID_WORKSPACE') == inputWs.value){
inputWs.value="";
}
}
});
inputWs.attachEvent("onblur", function (){
if(inputWs.value == ""){
inputWs.value = _('ID_WORKSPACE');
}
}
});
}else{
document.getElementById('form[USR_USERNAME]').placeholder = _('ID_USER');
document.getElementById('form[USR_PASSWORD_MASK]').placeholder = _('ID_PASSWORD');
document.getElementById('form[USER_ENV]').placeholder = _('ID_WORKSPACE');
document.getElementById('form[BSUBMIT]').classList.remove('module_app_button___gray');
document.getElementById('form[BSUBMIT]').classList.add('button-login-success');
document.getElementById('form[BSUBMIT]').classList.add('button-login-success');
}
};
@@ -131,9 +133,10 @@ leimnud.event.add(document.getElementById('form[USER_ENV]'), 'keypress', functio
leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
createCookie("pm_sys_sys", "{\"sys_sys\": \"" + getField("USER_ENV").value + "\"}", 365);
document.getElementById('form[USR_PASSWORD]').value = document.getElementById('form[USR_PASSWORD_MASK]').value;
document.getElementById('form[USR_PASSWORD_MASK]').value = '';
document.getElementById('form[USR_PASSWORD_MASK]').value = '';
document.getElementById("form[BROWSER_TIME_ZONE_OFFSET]").value = getBrowserTimeZoneOffset();
if(!navigator.userAgent.indexOf("MSIE 8.0")>0)
document.getElementById("form[USR_PASSWORD_MASK]").setAttribute("type", "text");
document.getElementById("form[USR_PASSWORD_MASK]").setAttribute("type", "text");
document.sysLogin.submit();
}.extend(document.getElementById('form[BSUBMIT]')));