You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2012/08/01 15:48:27 UTC
svn commit: r1367993 - in
/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth:
login.js login.xhtml
Author: lofwyr
Date: Wed Aug 1 13:48:27 2012
New Revision: 1367993
URL: http://svn.apache.org/viewvc?rev=1367993&view=rev
Log:
removing JavaScript from the pages
Added:
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.js
Modified:
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml
Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.js?rev=1367993&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.js (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.js Wed Aug 1 13:48:27 2012
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+jQuery(document).ready(function() {
+
+ jQuery("a[data-login]").click(function() {
+ var link = jQuery(this);
+ var login = link.data("login");
+ jQuery(Tobago.Utils.escapeClientId("page:j_username")).val(login.username);
+ jQuery(Tobago.Utils.escapeClientId("page:j_password")).val(login.password).focus();
+ return false;
+ });
+
+ jQuery("form").submit(function() {
+ jQuery(Tobago.Utils.escapeClientId("page:j_username")).attr("name", "j_username");
+ jQuery(Tobago.Utils.escapeClientId("page:j_password")).attr("name", "j_password");
+ jQuery(Tobago.Utils.escapeClientId("page::form")).attr("action", Tobago.contextPath.value + "/j_security_check");
+ });
+
+});
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml?rev=1367993&r1=1367992&r2=1367993&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-addressbook/src/main/webapp/auth/login.xhtml Wed Aug 1 13:48:27 2012
@@ -19,7 +19,6 @@
<f:view xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:tx="http://myfaces.apache.org/tobago/extension"
- xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
locale="#{controller.language}">
<tc:loadBundle basename="resource" var="bundle"/>
@@ -29,6 +28,8 @@
<tc:gridLayout rows="*;auto;*" columns="*;400px;*"/>
</f:facet>
+ <tc:script file="auth/login.js"/>
+
<tc:cell spanX="3"/>
<tc:cell/>
@@ -42,12 +43,16 @@
<tc:gridLayout rows="20px;20px" columns="2*;*"/>
</f:facet>
<tc:out value="#{bundle.loginIntro}"/>
- <tc:link inline="true" onclick="fillInGuest()" label="guest/guest"
- image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"/>
+ <tc:link label="guest/guest" image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"
+ onclick="/*fixme*/">
+ <tc:dataAttribute name="login" value='{"username": "guest", "password":"guest"}'/>
+ </tc:link>
<tc:cell/>
- <tc:link inline="true" onclick="fillInAdmin()" label="admin/admin"
- image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"/>
+ <tc:link label="admin/admin" image="image/org/tango-project/tango-icon-theme/16x16/apps/system-users.png"
+ onclick="/*fixme*/">
+ <tc:dataAttribute name="login" value='{"username": "admin", "password":"admin"}'/>
+ </tc:link>
</tc:panel>
<tx:in fieldId="j_username" label="#{bundle.loginUser}"/>
@@ -66,34 +71,5 @@
<tc:cell/>
<tc:cell spanX="3"/>
- <tc:script onsubmit="prepareLoginForm();">
- function prepareLoginForm() {
- var user = document.getElementById("page:j_username");
- user.name = "j_username";
- var pass = document.getElementById("page:j_password");
- pass.name = "j_password";
- var form = document.getElementById("page::form");
- form.action = "${pageContext.request.contextPath}/j_security_check";
- }
- </tc:script>
-
- <tc:script>
- function fillInGuest() {
- fillIn("guest");
- }
-
- function fillInAdmin() {
- fillIn("admin");
- }
-
- function fillIn(name) {
- var user = document.getElementById("page:j_username");
- user.value = name;
- var pass = document.getElementById("page:j_password");
- pass.value = name;
- pass.focus();
- }
- </tc:script>
-
</tc:page>
</f:view>