[portal-commits] JBoss Portal SVN: r12932 - in branches/JBoss_Portal_Branch_2_7/core/src: bin/portal-core-war/js and 1 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Tue Mar 3 12:45:11 EST 2009


Author: wesleyhales
Date: 2009-03-03 12:45:11 -0500 (Tue, 03 Mar 2009)
New Revision: 12932

Added:
   branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/js/login.js
Modified:
   branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/css/login.css
   branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp
Log:
JBPORTAL-2320

Modified: branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/css/login.css
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/css/login.css	2009-03-03 13:35:24 UTC (rev 12931)
+++ branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/css/login.css	2009-03-03 17:45:11 UTC (rev 12932)
@@ -59,6 +59,8 @@
    width: 255px;
    font-weight: bold;
    text-align: right;
+   padding: 0;
+
 }
 
 div.login-container div.login-content div.form-field {

Added: branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/js/login.js
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/js/login.js	                        (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/bin/portal-core-war/js/login.js	2009-03-03 17:45:11 UTC (rev 12932)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+
+if (typeof JBossPortal == 'undefined') {
+    var JBossPortal = {
+        login : { }
+    };
+}
+
+JBossPortal.login = function() {
+
+
+    //namespace login functions and variables
+
+    var isModal = true;
+
+    return{
+        /**
+         * Gets the current display status of the login box (modal or page) sets global variable and
+         * performs dynamic rendering options for login box
+         *
+         * @public
+         * @type Function
+         * @name displayStatus
+         * @return {void}
+         */
+        displayStatus : function() {
+            alert(window.parent.frames.length);
+            if (window.parent.frames.length >= 1)
+            {
+                //loaded as modal
+                //hide the error messages bix, because you will not get them in modal
+                //document.getElementById('login-error-message').style.display = 'none';
+                //document.getElementById('login-error-message').style.visibility = 'hidden';
+            }
+            else
+            {
+                isModal = false;
+                try
+                {
+\\
+                    if (document.getElementById('login-content').scrollHeight > 0)
+                    {
+                        document.body.style.paddingTop = ((document.documentElement.clientHeight / 2) - document.getElementById('login-content').scrollHeight) + 'px';
+                    }
+//                    else
+//                    {
+//                        //for ie7
+//                        alert((document.getElementById('login-content').offsetHeight - (document.body.clientHeight / 2)) + 'px');
+//                        document.body.style.paddingTop = ((document.getElementById('login-content').offsetHeight - (document.body.clientHeight / 2)) + 'px');
+//                    }
+                }
+                catch(e)
+                {
+                    //swallow
+                }
+                //give the cancel button back button functionality (hackish) but there is no other way
+                //to get returning page
+                document.getElementById('login-cancel').onclick = function()
+                {
+                    self.history.go(-1);
+                };
+                document.getElementById('login-submit').style.right = '';
+            }
+        },
+
+        /**
+         * set focus on username
+         *
+         * @public
+         * @type Function
+         * @name setFocusOnLoginForm
+         * @return {void}
+         */
+        setFocusOnLoginForm : function() {
+            try
+            {
+                document.loginform.j_username.focus();
+            }
+            catch (e)
+            {
+            }
+
+        }
+    };
+
+}();

Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp	2009-03-03 13:35:24 UTC (rev 12931)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp	2009-03-03 17:45:11 UTC (rev 12932)
@@ -25,105 +25,71 @@
 <%@page import="java.util.ResourceBundle" %>
 
 <%
-   ResourceBundle rb = ResourceBundle.getBundle("Resource", request.getLocale());
+    ResourceBundle rb = ResourceBundle.getBundle("Resource", request.getLocale());
 %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-   <title><%= rb.getString("LOGIN_TITLE")%></title>
+    <title><%= rb.getString("LOGIN_TITLE")%>
+    </title>
 
-   <script>
-      var isModal = true;
-      function displayStatus(){
-          if(window.parent.frames.length > 0){
-              //loaded as modal
-          }else{
-              try{
-                  //normal page
-                  isModal = false;
-                  document.body.style.paddingTop = ((window.innerHeight / 2) - document.getElementById('login-content').offsetHeight) + 'px';
-                  //document.getElementById('login-cancel').value = "<< Back";
-                  document.getElementById('login-cancel').onclick = function(){self.history.go(-1)};
-                  document.getElementById('login-submit').style.right = '';
-              }catch(e){
-                  //swallow
-              }
-          }
-      }
-      function setFocusOnLoginForm()
-      {
-         try
-         {
-            document.loginform.j_username.focus();
-         }
-         catch (e)
-         {
-         }
-      }
+    <script type="text/javascript" src="/portal-core/js/login.js"></script>
 
-   </script>
-
-   <link rel="stylesheet" href="/portal-core/css/login.css" type="text/css"/>
+    <link rel="stylesheet" href="/portal-core/css/login.css" type="text/css"/>
 </head>
-<body onload="displayStatus();setFocusOnLoginForm();">
+<body onload="JBossPortal.login.setFocusOnLoginForm();JBossPortal.login.displayStatus();">
 
 <div class="login-container">
 
 
-   <div class="login-header">
-       <%--text title--%>
-       <%--<h2><%= rb.getString("LOGIN_TITLE") %></h2>--%>
-       <%--img title--%>
-       <img src="/portal-core/images/logo-small-blue.gif" width="118px" height="17px"alt=""/>
-   </div>
-   <div class="login-content" id="login-content">
-      <div class="error-message"
-           style="<%=(request.getAttribute(!UserStatus.OK.equals("org.jboss.portal.userStatus") ? "" : "display:none"))%>;">
-         <%
+    <div class="login-header">
+        <%--text title--%>
+        <%--<h2><%= rb.getString("LOGIN_TITLE") %></h2>--%>
+        <%--img title--%>
+        <img src="/portal-core/images/logo-small-blue.gif" width="118px" height="17px" alt=""/>
+    </div>
+    <div class="login-content" id="login-content">
+        <div class="error-message" id="login-error-message"
+             style="<%=(request.getAttribute(!UserStatus.OK.equals("org.jboss.portal.userStatus") ? "" : "display:none"))%>;">
+            <%
 
-            if (UserStatus.DISABLE.equals(request.getAttribute("org.jboss.portal.userStatus")))
-            {
-               out.println(rb.getString("ACCOUNT_DISABLED"));
-            }
-            else if (UserStatus.WRONGPASSWORD.equals(request.getAttribute("org.jboss.portal.userStatus")) || UserStatus.UNEXISTING.equals(request.getAttribute("org.jboss.portal.userStatus")))
-            {
-               out.println(rb.getString("ACCOUNT_INEXISTING_OR_WRONG_PASSWORD"));
-            }
-            else if (UserStatus.NOTASSIGNEDTOROLE.equals(request.getAttribute("org.jboss.portal.userStatus")))
-            {
-               out.println(rb.getString("ACCOUNT_NOTASSIGNEDTOROLE"));
-            }
-         %>
-      </div>
-      <form method="post" action="<%= response.encodeURL("j_security_check") %>" name="loginform" id="loginForm"
-            target="_parent">
-         <div class="form-field">
-            <label for="j_username"><%= rb.getString("LOGIN_USERNAME") %>
-            </label>
-            <input type="text" name="j_username" id="j_username" value=""/>
-         </div>
-         <div class="form-field">
-            <label for="j_password"><%= rb.getString("LOGIN_PASSWORD") %>
-            </label>
-            <input type="password" name="j_password" id="j_password" value=""/>
-         </div>
-         <br class="clear"/>
-
-         <div class="button-container">
+                if (UserStatus.DISABLE.equals(request.getAttribute("org.jboss.portal.userStatus"))) {
+                    out.println(rb.getString("ACCOUNT_DISABLED"));
+                } else if (UserStatus.WRONGPASSWORD.equals(request.getAttribute("org.jboss.portal.userStatus")) || UserStatus.UNEXISTING.equals(request.getAttribute("org.jboss.portal.userStatus"))) {
+                    out.println(rb.getString("ACCOUNT_INEXISTING_OR_WRONG_PASSWORD"));
+                } else if (UserStatus.NOTASSIGNEDTOROLE.equals(request.getAttribute("org.jboss.portal.userStatus"))) {
+                    out.println(rb.getString("ACCOUNT_NOTASSIGNEDTOROLE"));
+                }
+            %>
+        </div>
+        <form method="post" action="<%= response.encodeURL("j_security_check") %>" name="loginform" id="loginForm"
+              target="_parent" style="margin:0;padding:0">
+            <div class="form-field">
+                <label for="j_username"><%= rb.getString("LOGIN_USERNAME") %>
+                </label>
+                <input type="text" style="width:155px;" name="j_username" id="j_username" value=""/>
+            </div>
+            <div class="form-field">
+                <label for="j_password"><%= rb.getString("LOGIN_PASSWORD") %>
+                </label>
+                <input type="password" style="width:155px;" name="j_password" id="j_password" value=""/>
+            </div>
             <br class="clear"/>
-            <input type="button" name="cancel" id="login-cancel"
-                   value="<%= rb.getString("LOGIN_CANCEL")  %>" class="cancel-button"
-                   onclick="window.parent.hideContentModal('login-modal');"/>
-            <br class="clear"/>
-            <input type="submit" name="login" id="login-submit"
-                   value="<%= rb.getString("LOGIN_SUBMIT")  %>" class="login-button"/>
-         </div>
-         <br class="clear"/>
-      </form>
 
-   </div>
+            <div class="button-container">
+                <br class="clear"/>
+                <input type="button" name="cancel" id="login-cancel"
+                       value="<%= rb.getString("LOGIN_CANCEL")  %>" class="cancel-button"
+                       onclick="window.parent.hideContentModal('login-modal');"/>
+                <br class="clear"/>
+                <input type="submit" name="login" id="login-submit"
+                       value="<%= rb.getString("LOGIN_SUBMIT")  %>" class="login-button"/>
+            </div>
+        </form>
+
+    </div>
 </div>
 </body>
 </html>




More information about the portal-commits mailing list