src/org/openbravo/erpCommon/security/Login.html
author David Baz Fayos <david.baz@openbravo.com>
Tue, 16 Nov 2010 17:38:23 +0100
changeset 8939 9fc0db14b6ba
parent 8938 a692a026d0bd
child 8940 f3283c3028e7
permissions -rw-r--r--
[login] Assigned css classname to Login window - name change
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@8939
    33
<script language="JavaScript" type="text/javascript" id="visualPrefs2">var showCompanyLogo = true, showSupportLogo = true, showForgeLogo = true, urlCompany = 'http://www.openbravo.com/', urlSupport = 'http://support.openbravo.com/';/* Parameters retreived from Login.java */</script>
david@8939
    34
<script language="JavaScript" type="text/javascript">var urlForge = 'http://forge.openbravo.com/';</script>
david@8931
    35
<script language="JavaScript" type="text/javascript" id="cacheMsg">var cacheMsg = 'xx';</script>
david@8931
    36
<script language="JavaScript" type="text/javascript" id="browserMsg">var browserMsg = 'xx';</script>
asier@8923
    37
asier@8910
    38
<script type="text/javascript">
asier@8910
    39
  function redirectWhenPopup() {
asier@8910
    40
    var permission = false;
asier@8910
    41
    try {
asier@8910
    42
      if (top.opener.parent.frames['appFrame']) {
asier@8910
    43
        permission = true;
asier@8910
    44
      }
asier@8910
    45
    }
asier@8910
    46
    catch (e) {}
asier@8910
    47
    if (permission && top.opener) {
asier@8910
    48
      top.opener.parent.location.href = top.document.location.href;
asier@8910
    49
      top.window.close();
asier@8910
    50
    }
asier@8910
    51
  }
asier@8910
    52
asier@8910
    53
  function redirectWhenInsideMDI() {
asier@8910
    54
    if (typeof isWindowInMDIPage !== 'undefined' && isWindowInMDIPage) {
david@8918
    55
      var LayoutMDI = null;
david@8918
    56
      if (isWindowInMDIPopup && parent.opener) {
david@8918
    57
        LayoutMDI = parent.opener.getFrame('LayoutMDI'); // Since getFrame('LayoutMDI') function frameset checks equals the current opened Login_FS.html modal popup
david@8918
    58
      } else {
david@8918
    59
        LayoutMDI = getFrame('LayoutMDI');
david@8918
    60
      }
asier@8910
    61
      if (LayoutMDI && typeof parent.document.getElementById('framesetMenu') === 'object') {
asier@8910
    62
        LayoutMDI.location.href = parent.window.location.href;
asier@8910
    63
      }
asier@8910
    64
    }
asier@8910
    65
  }
asier@8910
    66
asier@8910
    67
  function hideMenuFrame() {
asier@8910
    68
    if (parent.document.getElementById('framesetMenu')) {
asier@8910
    69
      parent.document.getElementById('framesetMenu').cols = parent.document.getElementById('framesetMenu').cols.replace(parent.menuWidth, '0%');
asier@8910
    70
    }
asier@8910
    71
  }
david@8918
    72
</script>
david@8918
    73
<script type="text/javascript">
david@8918
    74
  function setLoginMessage(type, text) {
david@8931
    75
    if (type === 'Error') {
david@8918
    76
      var msgContainer = document.getElementById('errorMsg');
david@8931
    77
      msgContainer.innerHTML = text.replace(/\n/g, '<br>').replace(/\\n/g, '<br>');
david@8931
    78
      msgContainer.style.display = '';
david@8931
    79
    } else if (type === 'Warning') {
david@8931
    80
      alert(text.replace(/<br>/g, '\n'));
asier@8910
    81
    }
asier@8910
    82
  }
asier@8921
    83
asier@8921
    84
  function resetMessage(){
asier@8921
    85
    var msgContainer = document.getElementById('errorMsg');
david@8931
    86
    msgContainer.innerHTML = '';
david@8931
    87
    msgContainer.style.display = 'none';
asier@8921
    88
  }
david@8918
    89
</script>
david@8918
    90
<script type="text/javascript">
david@8918
    91
  function buttonOK_click() {
david@8939
    92
    if (focusedWindowElement.id === 'user' && document.getElementById('user').value === '') {
david@8934
    93
      return true;
david@8939
    94
    } else if (focusedWindowElement.id === 'user' && document.getElementById('password').value === '') {
david@8937
    95
      setTimeout(function() { // To manage browser autocomplete feature if it is active
david@8939
    96
       if (focusedWindowElement.id === 'user' && document.getElementById('password').value === '') {
david@8934
    97
         setWindowElementFocus(document.getElementById('password')) 
david@8934
    98
       } else {
david@8934
    99
         return true;
david@8934
   100
       }
david@8934
   101
      }, 10);
david@8939
   102
    } else if (focusedWindowElement.id === 'password' && document.getElementById('password').value === '') {
david@8934
   103
      return true;
david@8939
   104
    } else if (focusedWindowElement.id === 'password' && document.getElementById('user').value === '') {
david@8934
   105
      setWindowElementFocus(document.getElementById('user'))
david@8934
   106
    } else {
david@8934
   107
      disableButton('buttonOK');
david@8934
   108
      submitXmlHttpRequest(loginResult, document.frmIdentificacion, 'DEFAULT', '../secureApp/LoginHandler.html', false, null, null);
david@8934
   109
    }
david@8918
   110
    return false;
david@8918
   111
  }
asier@8919
   112
asier@8919
   113
  function loginResult(paramXMLParticular, XMLHttpRequestObj) {
david@8931
   114
     var strText = '';
david@8931
   115
     if (getReadyStateHandler(XMLHttpRequestObj, null, false)) {
asier@8919
   116
       if (XMLHttpRequestObj.responseText) {
asier@8919
   117
         strText = XMLHttpRequestObj.responseText;
asier@8919
   118
       }
asier@8919
   119
       strText = strText.toString();
david@8931
   120
       var result = eval('('+strText+')');
asier@8919
   121
       processResult(result);
asier@8919
   122
     }
asier@8919
   123
  }
asier@8919
   124
asier@8919
   125
  function processResult(result){
asier@8919
   126
    if (result.showMessage) {
david@8931
   127
      setLoginMessage(result.messageType, result.messageTitle + '\n' + result.messageText);
david@8934
   128
      document.getElementById('password').value = '';
david@8934
   129
      setWindowElementFocus('password', 'id');
asier@8919
   130
    }
asier@8919
   131
david@8931
   132
    if (!result.showMessage || result.messageType === 'Warning') {
david@8931
   133
      var target;
asier@8936
   134
      try {
asier@8936
   135
        if (parent.frameMenu) {
asier@8936
   136
          target = '_parent';
asier@8936
   137
        } else {
asier@8936
   138
          target = '_self';
asier@8936
   139
        }
asier@8936
   140
      } catch (e) {
asier@8936
   141
        target = '_self';
david@8931
   142
      }
asier@8935
   143
      submitCommandForm('DEFAULT', false, null, result.target, target, true);
asier@8923
   144
    } else {
david@8931
   145
      enableButton('buttonOK');
asier@8923
   146
    }
asier@8919
   147
  }
david@8918
   148
</script>
david@8918
   149
<script type="text/javascript">
david@8937
   150
  function manageVisualPreferences() {
david@8937
   151
    var bottomLogos = document.getElementById('BottomLogos_Container');
david@8939
   152
    if (showSupportLogo && showForgeLogo) {
david@8939
   153
      bottomLogos.className = 'Login_BottomLogos_Container_Support_Forge';
david@8937
   154
    } else if (showSupportLogo) {
david@8939
   155
      bottomLogos.className = 'Login_BottomLogos_Container_Support';
david@8939
   156
    } else if (showForgeLogo) {
david@8939
   157
      bottomLogos.className = 'Login_BottomLogos_Container_Forge';
david@8937
   158
    } else {
david@8939
   159
      bottomLogos.className = 'Login_BottomLogos_Container_None';
david@8937
   160
    }
david@8937
   161
david@8939
   162
    if (showCompanyLogo && urlCompany !== '') {
david@8937
   163
      document.getElementById('CompanyLogo_Container').innerHTML = '<a href="' + urlCompany + '" class="Login_Img_Link">' + document.getElementById('CompanyLogo_Container').innerHTML + '</a>';
david@8937
   164
    }
david@8937
   165
david@8939
   166
    if (showSupportLogo && urlSupport !== '') {
david@8937
   167
      document.getElementById('SupportLogo_Container').innerHTML = '<a href="' + urlSupport + '" class="Login_Img_Link">' + document.getElementById('SupportLogo_Container').innerHTML + '</a>';
david@8937
   168
    }
david@8937
   169
david@8939
   170
    if (showForgeLogo && urlForge !== '') {
david@8939
   171
      document.getElementById('ForgeLogo_Container').innerHTML = '<a href="' + urlForge + '" class="Login_Img_Link">' + document.getElementById('ForgeLogo_Container').innerHTML + '</a>';
david@8937
   172
    }
david@8937
   173
david@8937
   174
    if (showCompanyLogo) {
david@8939
   175
      document.getElementById('CompanyLogo_Container').style.display = ''
david@8937
   176
    }
david@8939
   177
    bottomLogos.style.display = '';
david@8937
   178
  }
david@8937
   179
</script>
david@8937
   180
<script type="text/javascript">
asier@8910
   181
  function beforeLoadDo() {
asier@8910
   182
    redirectWhenPopup();
asier@8910
   183
    redirectWhenInsideMDI();
asier@8910
   184
    hideMenuFrame();
asier@8910
   185
  }
asier@8910
   186
asier@8910
   187
  function onLoadDo() {
david@8937
   188
    manageVisualPreferences();
david@8918
   189
    this.windowTables = new Array(
david@8918
   190
      new windowTableId('client', 'buttonOK')
david@8918
   191
    );
david@8918
   192
    setWindowTableParentElement();
david@8918
   193
    enableShortcuts('edition');
david@8934
   194
    setWindowElementFocus('user', 'id');
asier@8923
   195
asier@8923
   196
    if ((!revisionControl('8847')) || (isOpsInstance() != isOpsInstanceCached())) {
david@8931
   197
      setLoginMessage('Warning', cacheMsg);
asier@8923
   198
    }
asier@8923
   199
asier@8923
   200
    if (!checkBrowserCompatibility()) {
david@8931
   201
      setLoginMessage('Warning', browserMsg);
asier@8923
   202
    }
asier@8910
   203
  }
asier@8910
   204
</script>
david@8918
   205
<script type="text/javascript">
david@8918
   206
  beforeLoadDo();
david@8918
   207
</script>
asier@8910
   208
</head>
david@8918
   209
<body onload="onLoadDo();">
asier@8910
   210
david@8918
   211
  <div class="Login_Main" id="client">
asier@8910
   212
david@8937
   213
    <div class="Login_Container">
asier@8910
   214
david@8937
   215
      <div class="Login_LogForm">
david@8918
   216
        <form method="post" action="../secureApp/LoginHandler.html" name="frmIdentificacion" id="frmFormulario" autocomplete="off">
asier@8935
   217
            <input type="hidden" name="Command" value="" />
david@8937
   218
david@8937
   219
            <div class="Login_LogForm_CompanyLogo_Container">
david@8937
   220
              <div class="Login_LogForm_CompanyLogo" id="CompanyLogo_Container" style="display: none;"><img class="Login_Logo_Company" src="../../../../../web/images/blank.gif" /></div>
david@8918
   221
            </div>
david@8937
   222
            <div class="Login_LogForm_Input_Container">
david@8918
   223
              <dl>
david@8918
   224
                <dt>
david@8918
   225
                  <label for="user" class="LabelText Login_LabelText">User name</label>
david@8918
   226
                </dt>
david@8918
   227
                <dd>
david@8934
   228
                  <input class="dojoValidateValid Login_TextBox" type="text" maxlength="60" name="user" onKeyDown="resetMessage(); return true;" id="user"/>
david@8918
   229
                </dd>
david@8918
   230
                <dt>
david@8918
   231
                  <label for="password" class="LabelText Login_LabelText">Password</label>
david@8918
   232
                </dt>
david@8918
   233
                <dd>
david@8934
   234
                  <input class="dojoValidateValid Login_TextBox" type="password" maxlength="40" name="password" onKeyDown="resetMessage(); return true;" id="password"/>
david@8918
   235
                </dd>
david@8918
   236
              </dl>
david@8937
   237
              <div id="errorMsg" class="LabelText Login_ErrorMsg_LabelText" style="display: none">xx</div>
david@8918
   238
            </div>
david@8937
   239
            <div class="Login_LogForm_Button_Container">
david@8937
   240
              <div class="Login_LogForm_Button">
david@8918
   241
                <button type="button" 
david@8918
   242
                  id="buttonOK" 
david@8918
   243
                  class="ButtonLink" 
david@8918
   244
                  onclick="buttonOK_click();" 
david@8918
   245
                  onfocus="buttonEvent('onfocus', this); window.status='Login'; return true;" 
david@8918
   246
                  onblur="buttonEvent('onblur', this);" 
david@8918
   247
                  onkeyup="buttonEvent('onkeyup', this);" 
david@8918
   248
                  onkeydown="buttonEvent('onkeydown', this);" 
david@8918
   249
                  onkeypress="buttonEvent('onkeypress', this);" 
david@8918
   250
                  onmouseup="buttonEvent('onmouseup', this);" 
david@8918
   251
                  onmousedown="buttonEvent('onmousedown', this);" 
david@8918
   252
                  onmouseover="buttonEvent('onmouseover', this); window.status='Login'; return true;" 
david@8918
   253
                  onmouseout="buttonEvent('onmouseout', this);">
david@8918
   254
                  <table class="Button" id="fieldTable">
david@8918
   255
                    <tr>
david@8918
   256
                      <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
   257
                      <td class="Button_text Button_width">Log in</td>
david@8918
   258
                      <td class="Button_right"></td>
david@8918
   259
                    </tr>
david@8918
   260
                  </table>
david@8918
   261
                </button>
david@8918
   262
              </div>
david@8918
   263
            </div>
david@8918
   264
david@8918
   265
        </form>
david@8918
   266
      </div>
david@8918
   267
          
david@8937
   268
      <div class="Login_TopLogos_Container">
david@8918
   269
        <div>
david@8918
   270
          <img class="Main_NavBar_logo" src="../../../../../web/images/blank.gif" />
david@8937
   271
          <span class="Login_TopLogos_VersionNumber">3.0</span>
asier@8910
   272
        </div>
david@8937
   273
        <span class="Login_TopLogos_CopyrightText">&copy; Copyright Openbravo <br />
david@8918
   274
        2001-2010</span>
david@8918
   275
      </div>
david@8918
   276
david@8939
   277
      <div class="Login_BottomLogos_Container_Support_Forge" id="BottomLogos_Container" style="display: none;">
david@8937
   278
        <div class="Login_BottomLogos_SupportLogo_Container">
david@8937
   279
          <div class="LabelText Login_LabelText Login_BottomLogos_SupportLogo_Text">For support, contact:</div>
david@8937
   280
          <div class="Login_BottomLogos_SupportLogo_Logo_Container" id="SupportLogo_Container"><img class="Login_Logo_Support" src="../../../../../web/images/blank.gif" /></div>
asier@8910
   281
        </div>
david@8939
   282
        <div class="Login_BottomLogos_ForgeLogo_Container">
david@8939
   283
          <div class="LabelText Login_LabelText Login_BottomLogos_ForgeLogo_Text">Project hosted at:</div>
david@8939
   284
          <div class="Login_BottomLogos_ForgeLogo_Logo_Container" id="ForgeLogo_Container"><img class="Login_Logo_Forge" src="../../../../../web/images/blank.gif" /></div>
david@8918
   285
        </div>
david@8918
   286
      </div>
david@8918
   287
    </div>
asier@8910
   288
david@8918
   289
  </div>
asier@8910
   290
david@8918
   291
</body>
david@8918
   292
</html>