src/org/openbravo/erpCommon/security/Login.html
author David Baz Fayos <david.baz@openbravo.com>
Tue, 16 Nov 2010 17:00:51 +0100
changeset 8937 ebdd64b7e73b
parent 8936 5e97328b240d
child 8938 a692a026d0bd
permissions -rw-r--r--
[login] Assigned css classname to Login window
asier@8910
     1
<!--
asier@8910
     2
 *************************************************************************
asier@8910
     3
 * The contents of this file are subject to the Openbravo  Public  License
asier@8910
     4
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
asier@8910
     5
 * Version 1.1  with a permitted attribution clause; you may not  use this
asier@8910
     6
 * file except in compliance with the License. You  may  obtain  a copy of
asier@8910
     7
 * the License at http://www.openbravo.com/legal/license.html 
asier@8910
     8
 * Software distributed under the License  is  distributed  on  an "AS IS"
asier@8910
     9
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
asier@8910
    10
 * License for the specific  language  governing  rights  and  limitations
asier@8910
    11
 * under the License. 
asier@8910
    12
 * The Original Code is Openbravo ERP. 
asier@8910
    13
 * The Initial Developer of the Original Code is Openbravo SLU 
david@8918
    14
 * All portions are Copyright (C) 2010 Openbravo SLU 
asier@8910
    15
 * All Rights Reserved. 
asier@8910
    16
 * Contributor(s):  ______________________________________.
asier@8910
    17
 ************************************************************************
asier@8910
    18
-->
asier@8910
    19
david@8918
    20
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
david@8918
    21
<head>
asier@8910
    22
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
asier@8910
    23
<title>Openbravo</title>
asier@8910
    24
<link rel="shortcut icon" href="../../../../../web/images/favicon.ico" type="image/x-icon" id="favicon" />
asier@8910
    25
<link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Openbravo_ERP_250.css" id="paramCSS" />
david@8918
    26
<script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
asier@8910
    27
<script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
david@8931
    28
<script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
asier@8920
    29
<script language="JavaScript" src="../../../../../web/js/appStatus.js" type="text/javascript"></script>
asier@8920
    30
<script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
asier@8923
    31
<script language="JavaScript" src="../utility/CheckCleanCache.js?cache=true" type="text/javascript"></script>
asier@8923
    32
<script language="JavaScript" src="../utility/CheckCleanCache.js?cache=false" type="text/javascript"></script>
david@8937
    33
<script type="text/javascript" id="visualPrefs">var showCompanyLogo = true, showSupportLogo = true, showOBForgeLogo = true, urlCompany = "http://www.openbravo.com/", urlSupport = "http://support.openbravo.com/", urlOBForge = "http://forge.openbravo.com/";/* Parameters retreived from Login.java */</script>
david@8931
    34
<script language="JavaScript" type="text/javascript" id="cacheMsg">var cacheMsg = 'xx';</script>
david@8931
    35
<script language="JavaScript" type="text/javascript" id="browserMsg">var browserMsg = 'xx';</script>
asier@8923
    36
asier@8910
    37
<script type="text/javascript">
asier@8910
    38
  function redirectWhenPopup() {
asier@8910
    39
    var permission = false;
asier@8910
    40
    try {
asier@8910
    41
      if (top.opener.parent.frames['appFrame']) {
asier@8910
    42
        permission = true;
asier@8910
    43
      }
asier@8910
    44
    }
asier@8910
    45
    catch (e) {}
asier@8910
    46
    if (permission && top.opener) {
asier@8910
    47
      top.opener.parent.location.href = top.document.location.href;
asier@8910
    48
      top.window.close();
asier@8910
    49
    }
asier@8910
    50
  }
asier@8910
    51
asier@8910
    52
  function redirectWhenInsideMDI() {
asier@8910
    53
    if (typeof isWindowInMDIPage !== 'undefined' && isWindowInMDIPage) {
david@8918
    54
      var LayoutMDI = null;
david@8918
    55
      if (isWindowInMDIPopup && parent.opener) {
david@8918
    56
        LayoutMDI = parent.opener.getFrame('LayoutMDI'); // Since getFrame('LayoutMDI') function frameset checks equals the current opened Login_FS.html modal popup
david@8918
    57
      } else {
david@8918
    58
        LayoutMDI = getFrame('LayoutMDI');
david@8918
    59
      }
asier@8910
    60
      if (LayoutMDI && typeof parent.document.getElementById('framesetMenu') === 'object') {
asier@8910
    61
        LayoutMDI.location.href = parent.window.location.href;
asier@8910
    62
      }
asier@8910
    63
    }
asier@8910
    64
  }
asier@8910
    65
asier@8910
    66
  function hideMenuFrame() {
asier@8910
    67
    if (parent.document.getElementById('framesetMenu')) {
asier@8910
    68
      parent.document.getElementById('framesetMenu').cols = parent.document.getElementById('framesetMenu').cols.replace(parent.menuWidth, '0%');
asier@8910
    69
    }
asier@8910
    70
  }
david@8918
    71
</script>
david@8918
    72
<script type="text/javascript">
david@8918
    73
  function setLoginMessage(type, text) {
david@8931
    74
    if (type === 'Error') {
david@8918
    75
      var msgContainer = document.getElementById('errorMsg');
david@8931
    76
      msgContainer.innerHTML = text.replace(/\n/g, '<br>').replace(/\\n/g, '<br>');
david@8931
    77
      msgContainer.style.display = '';
david@8931
    78
    } else if (type === 'Warning') {
david@8931
    79
      alert(text.replace(/<br>/g, '\n'));
asier@8910
    80
    }
asier@8910
    81
  }
asier@8921
    82
asier@8921
    83
  function resetMessage(){
asier@8921
    84
    var msgContainer = document.getElementById('errorMsg');
david@8931
    85
    msgContainer.innerHTML = '';
david@8931
    86
    msgContainer.style.display = 'none';
asier@8921
    87
  }
david@8918
    88
</script>
david@8918
    89
<script type="text/javascript">
david@8918
    90
  function buttonOK_click() {
david@8934
    91
    if (focusedWindowElement.id === "user" && document.getElementById('user').value === "") {
david@8934
    92
      return true;
david@8934
    93
    } else if (focusedWindowElement.id === "user" && document.getElementById('password').value === "") {
david@8937
    94
      setTimeout(function() { // To manage browser autocomplete feature if it is active
david@8934
    95
       if (focusedWindowElement.id === "user" && document.getElementById('password').value === "") {
david@8934
    96
         setWindowElementFocus(document.getElementById('password')) 
david@8934
    97
       } else {
david@8934
    98
         return true;
david@8934
    99
       }
david@8934
   100
      }, 10);
david@8934
   101
    } else if (focusedWindowElement.id === "password" && document.getElementById('password').value === "") {
david@8934
   102
      return true;
david@8934
   103
    } else if (focusedWindowElement.id === "password" && document.getElementById('user').value === "") {
david@8934
   104
      setWindowElementFocus(document.getElementById('user'))
david@8934
   105
    } else {
david@8934
   106
      disableButton('buttonOK');
david@8934
   107
      submitXmlHttpRequest(loginResult, document.frmIdentificacion, 'DEFAULT', '../secureApp/LoginHandler.html', false, null, null);
david@8934
   108
    }
david@8918
   109
    return false;
david@8918
   110
  }
asier@8919
   111
asier@8919
   112
  function loginResult(paramXMLParticular, XMLHttpRequestObj) {
david@8931
   113
     var strText = '';
david@8931
   114
     if (getReadyStateHandler(XMLHttpRequestObj, null, false)) {
asier@8919
   115
       if (XMLHttpRequestObj.responseText) {
asier@8919
   116
         strText = XMLHttpRequestObj.responseText;
asier@8919
   117
       }
asier@8919
   118
       strText = strText.toString();
david@8931
   119
       var result = eval('('+strText+')');
asier@8919
   120
       processResult(result);
asier@8919
   121
     }
asier@8919
   122
  }
asier@8919
   123
asier@8919
   124
  function processResult(result){
asier@8919
   125
    if (result.showMessage) {
david@8931
   126
      setLoginMessage(result.messageType, result.messageTitle + '\n' + result.messageText);
david@8934
   127
      document.getElementById('password').value = '';
david@8934
   128
      setWindowElementFocus('password', 'id');
asier@8919
   129
    }
asier@8919
   130
david@8931
   131
    if (!result.showMessage || result.messageType === 'Warning') {
david@8931
   132
      var target;
asier@8936
   133
      try {
asier@8936
   134
        if (parent.frameMenu) {
asier@8936
   135
          target = '_parent';
asier@8936
   136
        } else {
asier@8936
   137
          target = '_self';
asier@8936
   138
        }
asier@8936
   139
      } catch (e) {
asier@8936
   140
        target = '_self';
david@8931
   141
      }
asier@8935
   142
      submitCommandForm('DEFAULT', false, null, result.target, target, true);
asier@8923
   143
    } else {
david@8931
   144
      enableButton('buttonOK');
asier@8923
   145
    }
asier@8919
   146
  }
david@8918
   147
</script>
david@8918
   148
<script type="text/javascript">
david@8937
   149
  function manageVisualPreferences() {
david@8937
   150
    var bottomLogos = document.getElementById('BottomLogos_Container');
david@8937
   151
    if (showSupportLogo && showOBForgeLogo) {
david@8937
   152
      bottomLogos.className = "Login_BottomLogos_Container_Support_OBForge";
david@8937
   153
    } else if (showSupportLogo) {
david@8937
   154
      bottomLogos.className = "Login_BottomLogos_Container_Support";
david@8937
   155
    } else if (showOBForgeLogo) {
david@8937
   156
      bottomLogos.className = "Login_BottomLogos_Container_OBForge";
david@8937
   157
    } else {
david@8937
   158
      bottomLogos.className = "Login_BottomLogos_Container_None";
david@8937
   159
    }
david@8937
   160
david@8937
   161
    if (showCompanyLogo && urlCompany !== "") {
david@8937
   162
      document.getElementById('CompanyLogo_Container').innerHTML = '<a href="' + urlCompany + '" class="Login_Img_Link">' + document.getElementById('CompanyLogo_Container').innerHTML + '</a>';
david@8937
   163
    }
david@8937
   164
david@8937
   165
    if (showSupportLogo && urlSupport !== "") {
david@8937
   166
      document.getElementById('SupportLogo_Container').innerHTML = '<a href="' + urlSupport + '" class="Login_Img_Link">' + document.getElementById('SupportLogo_Container').innerHTML + '</a>';
david@8937
   167
    }
david@8937
   168
david@8937
   169
    if (showOBForgeLogo && urlOBForge !== "") {
david@8937
   170
      document.getElementById('OBForgeLogo_Container').innerHTML = '<a href="' + urlOBForge + '" class="Login_Img_Link">' + document.getElementById('OBForgeLogo_Container').innerHTML + '</a>';
david@8937
   171
    }
david@8937
   172
david@8937
   173
    if (showCompanyLogo) {
david@8937
   174
      document.getElementById('CompanyLogo_Container').style.display = ""
david@8937
   175
    }
david@8937
   176
    bottomLogos.style.display = "";
david@8937
   177
  }
david@8937
   178
</script>
david@8937
   179
<script type="text/javascript">
asier@8910
   180
  function beforeLoadDo() {
asier@8910
   181
    redirectWhenPopup();
asier@8910
   182
    redirectWhenInsideMDI();
asier@8910
   183
    hideMenuFrame();
asier@8910
   184
  }
asier@8910
   185
asier@8910
   186
  function onLoadDo() {
david@8937
   187
    manageVisualPreferences();
david@8918
   188
    this.windowTables = new Array(
david@8918
   189
      new windowTableId('client', 'buttonOK')
david@8918
   190
    );
david@8918
   191
    setWindowTableParentElement();
david@8918
   192
    enableShortcuts('edition');
david@8934
   193
    setWindowElementFocus('user', 'id');
asier@8923
   194
asier@8923
   195
    if ((!revisionControl('8847')) || (isOpsInstance() != isOpsInstanceCached())) {
david@8931
   196
      setLoginMessage('Warning', cacheMsg);
asier@8923
   197
    }
asier@8923
   198
asier@8923
   199
    if (!checkBrowserCompatibility()) {
david@8931
   200
      setLoginMessage('Warning', browserMsg);
asier@8923
   201
    }
asier@8910
   202
  }
asier@8910
   203
</script>
david@8918
   204
<script type="text/javascript">
david@8918
   205
  beforeLoadDo();
david@8918
   206
</script>
asier@8910
   207
</head>
david@8918
   208
<body onload="onLoadDo();">
asier@8910
   209
david@8918
   210
  <div class="Login_Main" id="client">
asier@8910
   211
david@8937
   212
    <div class="Login_Container">
asier@8910
   213
david@8937
   214
      <div class="Login_LogForm">
david@8918
   215
        <form method="post" action="../secureApp/LoginHandler.html" name="frmIdentificacion" id="frmFormulario" autocomplete="off">
asier@8935
   216
            <input type="hidden" name="Command" value="" />
david@8937
   217
david@8937
   218
            <div class="Login_LogForm_CompanyLogo_Container">
david@8937
   219
              <div class="Login_LogForm_CompanyLogo" id="CompanyLogo_Container" style="display: none;"><img class="Login_Logo_Company" src="../../../../../web/images/blank.gif" /></div>
david@8918
   220
            </div>
david@8937
   221
            <div class="Login_LogForm_Input_Container">
david@8918
   222
              <dl>
david@8918
   223
                <dt>
david@8918
   224
                  <label for="user" class="LabelText Login_LabelText">User name</label>
david@8918
   225
                </dt>
david@8918
   226
                <dd>
david@8934
   227
                  <input class="dojoValidateValid Login_TextBox" type="text" maxlength="60" name="user" onKeyDown="resetMessage(); return true;" id="user"/>
david@8918
   228
                </dd>
david@8918
   229
                <dt>
david@8918
   230
                  <label for="password" class="LabelText Login_LabelText">Password</label>
david@8918
   231
                </dt>
david@8918
   232
                <dd>
david@8934
   233
                  <input class="dojoValidateValid Login_TextBox" type="password" maxlength="40" name="password" onKeyDown="resetMessage(); return true;" id="password"/>
david@8918
   234
                </dd>
david@8918
   235
              </dl>
david@8937
   236
              <div id="errorMsg" class="LabelText Login_ErrorMsg_LabelText" style="display: none">xx</div>
david@8918
   237
            </div>
david@8937
   238
            <div class="Login_LogForm_Button_Container">
david@8937
   239
              <div class="Login_LogForm_Button">
david@8918
   240
                <button type="button" 
david@8918
   241
                  id="buttonOK" 
david@8918
   242
                  class="ButtonLink" 
david@8918
   243
                  onclick="buttonOK_click();" 
david@8918
   244
                  onfocus="buttonEvent('onfocus', this); window.status='Login'; return true;" 
david@8918
   245
                  onblur="buttonEvent('onblur', this);" 
david@8918
   246
                  onkeyup="buttonEvent('onkeyup', this);" 
david@8918
   247
                  onkeydown="buttonEvent('onkeydown', this);" 
david@8918
   248
                  onkeypress="buttonEvent('onkeypress', this);" 
david@8918
   249
                  onmouseup="buttonEvent('onmouseup', this);" 
david@8918
   250
                  onmousedown="buttonEvent('onmousedown', this);" 
david@8918
   251
                  onmouseover="buttonEvent('onmouseover', this); window.status='Login'; return true;" 
david@8918
   252
                  onmouseout="buttonEvent('onmouseout', this);">
david@8918
   253
                  <table class="Button" id="fieldTable">
david@8918
   254
                    <tr>
david@8918
   255
                      <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Login" title="Login" src="../../../../../web/images/blank.gif" border="0" id="fieldButton" /></td>
david@8937
   256
                      <td class="Button_text Button_width">Log in</td>
david@8918
   257
                      <td class="Button_right"></td>
david@8918
   258
                    </tr>
david@8918
   259
                  </table>
david@8918
   260
                </button>
david@8918
   261
              </div>
david@8918
   262
            </div>
david@8918
   263
david@8918
   264
        </form>
david@8918
   265
      </div>
david@8918
   266
          
david@8937
   267
      <div class="Login_TopLogos_Container">
david@8918
   268
        <div>
david@8918
   269
          <img class="Main_NavBar_logo" src="../../../../../web/images/blank.gif" />
david@8937
   270
          <span class="Login_TopLogos_VersionNumber">3.0</span>
asier@8910
   271
        </div>
david@8937
   272
        <span class="Login_TopLogos_CopyrightText">&copy; Copyright Openbravo <br />
david@8918
   273
        2001-2010</span>
david@8918
   274
      </div>
david@8918
   275
david@8937
   276
      <div class="Login_BottomLogos_Container_Support_OBForge" id="BottomLogos_Container" style="display: none;">
david@8937
   277
        <div class="Login_BottomLogos_SupportLogo_Container">
david@8937
   278
          <div class="LabelText Login_LabelText Login_BottomLogos_SupportLogo_Text">For support, contact:</div>
david@8937
   279
          <div class="Login_BottomLogos_SupportLogo_Logo_Container" id="SupportLogo_Container"><img class="Login_Logo_Support" src="../../../../../web/images/blank.gif" /></div>
asier@8910
   280
        </div>
david@8937
   281
        <div class="Login_BottomLogos_OBForgeLogo_Container">
david@8937
   282
          <div class="LabelText Login_LabelText Login_BottomLogos_OBForgeLogo_Text">Project hosted at:</div>
david@8937
   283
          <div class="Login_BottomLogos_OBForgeLogo_Logo_Container" id="OBForgeLogo_Container"><img class="Login_Logo_OBForge" src="../../../../../web/images/blank.gif" /></div>
david@8918
   284
        </div>
david@8918
   285
      </div>
david@8918
   286
    </div>
asier@8910
   287
david@8918
   288
  </div>
asier@8910
   289
david@8918
   290
</body>
david@8918
   291
</html>