src/org/openbravo/erpCommon/security/Login.html
author David Baz Fayos <david.baz@openbravo.com>
Mon, 15 Nov 2010 21:07:13 +0100
changeset 8931 1f11251c235a
parent 8926 a43c5a0f4d5f
child 8934 5faadb5a9864
permissions -rw-r--r--
[login] Small fixes in Login.html js
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@8931
    33
<script language="JavaScript" type="text/javascript" id="cacheMsg">var cacheMsg = 'xx';</script>
david@8931
    34
<script language="JavaScript" type="text/javascript" id="browserMsg">var browserMsg = 'xx';</script>
asier@8923
    35
asier@8910
    36
<script type="text/javascript">
asier@8910
    37
  function redirectWhenPopup() {
asier@8910
    38
    var permission = false;
asier@8910
    39
    try {
asier@8910
    40
      if (top.opener.parent.frames['appFrame']) {
asier@8910
    41
        permission = true;
asier@8910
    42
      }
asier@8910
    43
    }
asier@8910
    44
    catch (e) {}
asier@8910
    45
    if (permission && top.opener) {
asier@8910
    46
      top.opener.parent.location.href = top.document.location.href;
asier@8910
    47
      top.window.close();
asier@8910
    48
    }
asier@8910
    49
  }
asier@8910
    50
asier@8910
    51
  function redirectWhenInsideMDI() {
asier@8910
    52
    if (typeof isWindowInMDIPage !== 'undefined' && isWindowInMDIPage) {
david@8918
    53
      var LayoutMDI = null;
david@8918
    54
      if (isWindowInMDIPopup && parent.opener) {
david@8918
    55
        LayoutMDI = parent.opener.getFrame('LayoutMDI'); // Since getFrame('LayoutMDI') function frameset checks equals the current opened Login_FS.html modal popup
david@8918
    56
      } else {
david@8918
    57
        LayoutMDI = getFrame('LayoutMDI');
david@8918
    58
      }
asier@8910
    59
      if (LayoutMDI && typeof parent.document.getElementById('framesetMenu') === 'object') {
asier@8910
    60
        LayoutMDI.location.href = parent.window.location.href;
asier@8910
    61
      }
asier@8910
    62
    }
asier@8910
    63
  }
asier@8910
    64
asier@8910
    65
  function hideMenuFrame() {
asier@8910
    66
    if (parent.document.getElementById('framesetMenu')) {
asier@8910
    67
      parent.document.getElementById('framesetMenu').cols = parent.document.getElementById('framesetMenu').cols.replace(parent.menuWidth, '0%');
asier@8910
    68
    }
asier@8910
    69
  }
david@8918
    70
</script>
david@8918
    71
<script type="text/javascript">
david@8918
    72
  function setLoginMessage(type, text) {
david@8931
    73
    if (type === 'Error') {
david@8918
    74
      var msgContainer = document.getElementById('errorMsg');
david@8931
    75
      msgContainer.innerHTML = text.replace(/\n/g, '<br>').replace(/\\n/g, '<br>');
david@8931
    76
      msgContainer.style.display = '';
david@8931
    77
    } else if (type === 'Warning') {
david@8931
    78
      alert(text.replace(/<br>/g, '\n'));
asier@8910
    79
    }
asier@8910
    80
  }
asier@8921
    81
asier@8921
    82
  function resetMessage(){
asier@8921
    83
    var msgContainer = document.getElementById('errorMsg');
david@8931
    84
    msgContainer.innerHTML = '';
david@8931
    85
    msgContainer.style.display = 'none';
asier@8921
    86
  }
david@8918
    87
</script>
david@8918
    88
<script type="text/javascript">
david@8918
    89
  function buttonOK_click() {
david@8918
    90
    var target;
david@8918
    91
    try {
david@8918
    92
      if (parent.frameMenu) {
david@8931
    93
        target = '_parent';
david@8918
    94
      } else {
david@8931
    95
        target = '_self';
david@8918
    96
      }
david@8918
    97
    } catch (e) {
david@8931
    98
      target = '_self';
david@8918
    99
    }
david@8931
   100
    disableButton('buttonOK');
david@8931
   101
    submitXmlHttpRequest(loginResult, document.frmIdentificacion, 'DEFAULT', '../secureApp/LoginHandler.html', false, null, null);
david@8918
   102
    return false;
david@8918
   103
  }
asier@8919
   104
asier@8919
   105
  function loginResult(paramXMLParticular, XMLHttpRequestObj) {
david@8931
   106
     var strText = '';
david@8931
   107
     if (getReadyStateHandler(XMLHttpRequestObj, null, false)) {
asier@8919
   108
       if (XMLHttpRequestObj.responseText) {
asier@8919
   109
         strText = XMLHttpRequestObj.responseText;
asier@8919
   110
       }
asier@8919
   111
       strText = strText.toString();
david@8931
   112
       var result = eval('('+strText+')');
asier@8919
   113
       processResult(result);
asier@8919
   114
     }
asier@8919
   115
  }
asier@8919
   116
asier@8919
   117
  function processResult(result){
asier@8919
   118
    if (result.showMessage) {
david@8931
   119
      setLoginMessage(result.messageType, result.messageTitle + '\n' + result.messageText);
david@8931
   120
      document.frmIdentificacion.password.value = '';
asier@8926
   121
      setWindowElementFocus(document.frmIdentificacion.password);
asier@8919
   122
    }
asier@8919
   123
david@8931
   124
    if (!result.showMessage || result.messageType === 'Warning') {
david@8931
   125
      var target;
david@8931
   126
      if (parent.document.getElementById('framesetMenu')) {
david@8931
   127
        target = parent.window;
david@8931
   128
      } else {
david@8931
   129
        target = window;
david@8931
   130
      }
david@8931
   131
      target.location = result.target;
asier@8923
   132
    } else {
david@8931
   133
      enableButton('buttonOK');
asier@8923
   134
    }
asier@8919
   135
  }
david@8918
   136
</script>
david@8918
   137
<script type="text/javascript">
asier@8910
   138
  function beforeLoadDo() {
asier@8910
   139
    redirectWhenPopup();
asier@8910
   140
    redirectWhenInsideMDI();
asier@8910
   141
    hideMenuFrame();
asier@8910
   142
  }
asier@8910
   143
asier@8910
   144
  function onLoadDo() {
david@8918
   145
    this.windowTables = new Array(
david@8918
   146
      new windowTableId('client', 'buttonOK')
david@8918
   147
    );
david@8918
   148
    setWindowTableParentElement();
david@8918
   149
    enableShortcuts('edition');
asier@8923
   150
asier@8923
   151
    if ((!revisionControl('8847')) || (isOpsInstance() != isOpsInstanceCached())) {
david@8931
   152
      setLoginMessage('Warning', cacheMsg);
asier@8923
   153
    }
asier@8923
   154
asier@8923
   155
    if (!checkBrowserCompatibility()) {
david@8931
   156
      setLoginMessage('Warning', browserMsg);
asier@8923
   157
    }
asier@8910
   158
  }
asier@8910
   159
</script>
david@8918
   160
<script type="text/javascript">
david@8918
   161
  beforeLoadDo();
david@8918
   162
</script>
asier@8910
   163
</head>
david@8918
   164
<body onload="onLoadDo();">
asier@8910
   165
david@8918
   166
  <div class="Login_Main" id="client">
asier@8910
   167
david@8918
   168
    <div class="container">
asier@8910
   169
david@8918
   170
      <div class="logbox">
david@8918
   171
        <form method="post" action="../secureApp/LoginHandler.html" name="frmIdentificacion" id="frmFormulario" autocomplete="off">
david@8918
   172
david@8918
   173
            <div style="height: 115px; text-align: center;">
david@8918
   174
              <div style="padding-top: 25px;"><a href="#" class="Login_Img_Link"><img class="Login_Logo_Company" src="../../../../../web/images/blank.gif" /></a></div>
david@8918
   175
            </div>
david@8918
   176
            <div style="height: 162px !important;">
david@8918
   177
              <dl>
david@8918
   178
                <dt>
david@8918
   179
                  <label for="user" class="LabelText Login_LabelText">User name</label>
david@8918
   180
                </dt>
david@8918
   181
                <dd>
asier@8921
   182
                  <input class="dojoValidateValid Login_TextBox" type="text" maxlength="60" name="user" onKeyDown="resetMessage(); return true;" />
david@8918
   183
                </dd>
david@8918
   184
                <dt>
david@8918
   185
                  <label for="password" class="LabelText Login_LabelText">Password</label>
david@8918
   186
                </dt>
david@8918
   187
                <dd>
asier@8921
   188
                  <input class="dojoValidateValid Login_TextBox" type="password" maxlength="40" name="password" onKeyDown="resetMessage(); return true;" />
david@8918
   189
                </dd>
david@8918
   190
              </dl>
david@8918
   191
              <div id="errorMsg" class="LabelText Login_ErrorMsg_LabelText" style="display: none;">The username or password you entered is not correct.</div>
david@8918
   192
            </div>
david@8918
   193
            <div class="button">
david@8918
   194
              <div>
david@8918
   195
                <button type="button" 
david@8918
   196
                  id="buttonOK" 
david@8918
   197
                  class="ButtonLink" 
david@8918
   198
                  onclick="buttonOK_click();" 
david@8918
   199
                  onfocus="buttonEvent('onfocus', this); window.status='Login'; return true;" 
david@8918
   200
                  onblur="buttonEvent('onblur', this);" 
david@8918
   201
                  onkeyup="buttonEvent('onkeyup', this);" 
david@8918
   202
                  onkeydown="buttonEvent('onkeydown', this);" 
david@8918
   203
                  onkeypress="buttonEvent('onkeypress', this);" 
david@8918
   204
                  onmouseup="buttonEvent('onmouseup', this);" 
david@8918
   205
                  onmousedown="buttonEvent('onmousedown', this);" 
david@8918
   206
                  onmouseover="buttonEvent('onmouseover', this); window.status='Login'; return true;" 
david@8918
   207
                  onmouseout="buttonEvent('onmouseout', this);">
david@8918
   208
                  <table class="Button" id="fieldTable">
david@8918
   209
                    <tr>
david@8918
   210
                      <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@8918
   211
                      <td class="Button_text Button_width">Login</td>
david@8918
   212
                      <td class="Button_right"></td>
david@8918
   213
                    </tr>
david@8918
   214
                  </table>
david@8918
   215
                </button>
david@8918
   216
              </div>
david@8918
   217
            </div>
david@8918
   218
david@8918
   219
        </form>
david@8918
   220
      </div>
david@8918
   221
          
david@8918
   222
      <div class="login-top">
david@8918
   223
        <div>
david@8918
   224
          <img class="Main_NavBar_logo" src="../../../../../web/images/blank.gif" />
david@8918
   225
          <span style="margin-left: 520px; font-size: 70px; font-style: italic; font-weight: bold; color: #7F7F7F; font-family:'lucida sans',sans-serif;">3.0</span>
asier@8910
   226
        </div>
david@8918
   227
        <span style="display: block; margin-top: 215px; color: #afafaf; font-size: .9em;line-height: 0.9em; width: 14em; text-align: center; padding-bottom: 34px;">&copy; Copyright Openbravo <br />
david@8918
   228
        2001-2010</span>
david@8918
   229
      </div>
david@8918
   230
david@8918
   231
      <div style="position: relative; left: 110px; text-align: center; width: 100%;">
david@8918
   232
        <div style="width: 260px; position: relative; float: left;">
david@8918
   233
          <div style="text-align: center;" class="LabelText Login_LabelText">For support, contact:</div>
david@8918
   234
          <div style="text-align: center;"><a href="#" class="Login_Img_Link"><img class="Login_Logo_Support" src="../../../../../web/images/blank.gif" /></a></div>
asier@8910
   235
        </div>
david@8918
   236
        <div style="width: 350px; position: relative; float: left;">
david@8918
   237
          <div style="text-align: center;" class="LabelText Login_LabelText">Project hosted at:</div>
david@8918
   238
          <div style="text-align: center;"><a href="#" class="Login_Img_Link"><img class="Login_Logo_OBForge" src="../../../../../web/images/blank.gif" /></a></div>
david@8918
   239
        </div>
david@8918
   240
      </div>
asier@8910
   241
david@8918
   242
    </div>
asier@8910
   243
david@8918
   244
  </div>
asier@8910
   245
david@8918
   246
</body>
david@8918
   247
</html>