At 23:10 2000-11-07, Santiago Gala wrote:
>In the current CVS HEAD branch, just switched, JLoginUser and other
>actions and
>screens coming from jyve have been moved back to packages
>
>org.apache.jetspeed.turbine.screen/action/...
>
>so that we can modify them as needed to adapt to current Turbine.
>
>They have not been cleaned of a lot of jyve code, this work is still pending.
Ok, let's give it a start.
Here is an update of org.apache.jetspeed.turbine.screens.Login.java (see
diff below).
I basically just removed some jyve stuff and replaced the hardcoded
JLoginAction with the login action that is specified in
TurbineResources.properties.
Opinions?
ingo.
Index: Login.java
===================================================================
RCS file:
/products/cvs/jetspeed/jetspeed/src/java/org/apache/jetspeed/turbine/screens/Login.java,v
retrieving revision 1.2
diff -u -r1.2 Login.java
--- Login.java 2000/11/06 12:50:00 1.2
+++ Login.java 2000/11/08 10:08:50
@@ -60,16 +60,12 @@
import java.sql.*;
// External Stuff
-import org.apache.turbine.modules.*;
-import org.apache.turbine.services.*;
-import org.apache.turbine.services.localization.*;
import org.apache.turbine.util.*;
+import org.apache.turbine.modules.Screen;
+import org.apache.turbine.services.localization.Localization;
import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.turbine.om.security.*;
-import org.apache.turbine.util.db.*;
-import org.apache.turbine.util.db.pool.*;
-import com.workingdogs.village.*;
-import org.apache.ecs.*;
+import org.apache.ecs.ConcreteElement;
+import org.apache.ecs.StringElement;
import org.apache.ecs.html.*;
public class Login extends Screen
@@ -82,45 +78,10 @@
if ( screen == null )
screen = TurbineResources.getString( "jyve.mainmenu" );
- Form form = new Form ( new DynamicURI ( data, screen,
"JLoginUser", true ).toString()
- , Form.POST );
+ Form form = new Form( ( new DynamicURI( data, screen,
TurbineResources.getString( "action.login" ), true ) ).toString(), "POST");
form.addElement ( new Input ( Input.hidden, "nextscreen", screen ) );
- // this is used to send people to the right place
- // after having clicked Show Edit Commands
- // This has to be done with hidden fields because the guest user
is wiped out
- // when they log in.
- Integer project_id = (Integer) data.getUser().getTemp("project_id",
- data.getParameters().getInteger("project_id", -1 ) );
- if ( project_id != null && project_id.intValue() != -1 )
- {
- form.addElement ( new Input ( Input.hidden, "project_id",
project_id ) );
- }
- Integer faq_id = (Integer) data.getUser().getTemp("faq_id",
- data.getParameters().getInteger("faq_id", -1 ) );
- if ( faq_id != null && faq_id.intValue() != -1 )
- {
- form.addElement ( new Input ( Input.hidden, "faq_id", faq_id ) );
- }
- Integer topic_id = (Integer) data.getUser().getTemp("topic_id",
- data.getParameters().getInteger("topic_id", -1 ) );
- if ( topic_id != null && topic_id.intValue() != -1 )
- {
- form.addElement ( new Input ( Input.hidden, "topic_id",
topic_id ) );
- }
- Integer question_id = (Integer) data.getUser().getTemp("question_id",
- data.getParameters().getInteger("question_id", -1 ) );
- if ( question_id != null && question_id.intValue() != -1 )
- {
- form.addElement ( new Input ( Input.hidden, "question_id",
question_id ) );
- }
- Integer answer_id = (Integer) data.getUser().getTemp("answer_id",
- data.getParameters().getInteger("answer_id", -1 ) );
- if ( answer_id != null && answer_id.intValue() != -1 )
- {
- form.addElement ( new Input ( Input.hidden, "answer_id",
answer_id ) );
- }
Boolean showEdit = (Boolean)data.getParameters().getBool("showedit");
form.addElement ( new Input ( Input.hidden, "showedit",
showEdit.toString() ) );
============================ The new Login.java ==============================
package org.apache.jetspeed.turbine.screens;
/*
* Copyright (c) 1997-1999 The Java Apache Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Java Apache
* Project for use in the Apache JServ servlet engine project
* <http://java.apache.org/>."
*
* 4. The names "Apache JServ", "Apache JServ Servlet Engine", "Jyve",
* "Apache Jyve", "Jyve Project", "Apache Jyve Project" and
* "Java Apache Project" must not be used to endorse or promote products
* derived from this software without prior written permission.
*
* 5. Products derived from this software may not be called "Apache JServ"
* nor may "Apache" nor "Apache JServ" appear in their names without
* prior written permission of the Java Apache Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Java Apache
* Project for use in the Apache JServ servlet engine project
* <http://java.apache.org/>."
*
* THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Java Apache Group. For more information
* on the Java Apache Project and the Apache JServ Servlet Engine project,
* please see <http://java.apache.org/>.
*
*/
// JDK Stuff
import java.sql.*;
// External Stuff
import org.apache.turbine.util.*;
import org.apache.turbine.modules.Screen;
import org.apache.turbine.services.localization.Localization;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.StringElement;
import org.apache.ecs.html.*;
public class Login extends Screen
{
public ConcreteElement doBuild( RunData data ) throws Exception
{
data.setTitle(Localization.getString("LOGIN_TITLE"));
String screen = data.getParameters().getString("nextscreen", null);
if ( screen == null )
screen = TurbineResources.getString( "jyve.mainmenu" );
Form form = new Form( ( new DynamicURI( data, screen,
TurbineResources.getString( "action.login" ), true ) ).toString(), "POST");
form.addElement ( new Input ( Input.hidden, "nextscreen", screen ) );
Boolean showEdit = (Boolean)data.getParameters().getBool("showedit");
form.addElement ( new Input ( Input.hidden, "showedit",
showEdit.toString() ) );
form.addElement ( new StringElement
(Localization.getString("LOGIN_USERNAMEMSG")));
form.addElement ( new BR() );
form.addElement (
new Input ( Input.text, "username",
data.getParameters().getString("username", ""))
.setSize(12).setMaxlength(25));
form.addElement ( new BR() );
form.addElement ( new StringElement
(Localization.getString("LOGIN_PASSWORDMSG")));
form.addElement ( new BR() );
form.addElement (
new Input ( Input.password, "password", "" )
.setSize(12).setMaxlength(25));
form.addElement ( new BR() );
form.addElement (
new Input ( Input.submit, "submit",
Localization.getString("LOGIN_LOGINBTN") ));
A a = new A();
a.setHref(
new DynamicURI(data, "NewAccount")
.addPathInfo("nextscreen", screen )
.toString()
).addElement(Localization.getString("LOGIN_CREATENEWACCOUNT"));
form.addElement ( new P() );
form.addElement ( a );
return form;
}
}
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]