head	1.14;
access;
symbols
	TIGRIS_1_1_0RC2:1.12
	TIGRIS_1_1_0RC1:1.12
	TIGRIS_1_1:1.12.0.4
	TIGRIS_1_0_8:1.12
	TIGRIS_1_0_8RC3:1.12
	TIGRIS_1_0_8RC2:1.12
	TIGRIS_1_0_8RC1:1.12
	TIGRIS_1_0_7:1.12
	TIGRIS_1_0_7RC3:1.12
	TIGRIS_1_0_7RC2:1.12
	TIGRIS_1_0_7RC1:1.12
	TIGRIS_1_0_6:1.12
	TIGRIS_1_0_6RC5:1.12
	TIGRIS_1_0_6RC4:1.12
	TIGRIS_1_0_6RC3:1.12
	TIGRIS_1_0_6RC2:1.12
	TIGRIS_1_0_6RC1:1.12
	TIGRIS_1_0_5:1.12
	TIGRIS_1_0_5RC6:1.12
	TIGRIS_1_0_5RC5:1.12
	TIGRIS_1_0_5RC4:1.12
	TIGRIS_1_0_5RC3:1.12
	TIGRIS_1_0_5RC2:1.12
	TIGRIS_1_0_5RC1:1.12
	TIGRIS_1_0_4:1.12
	TIGRIS_1_0_3:1.12
	TIGRIS_1_0_2:1.12
	TIGRIS_1_0_1:1.12
	TIGRIS_1_0:1.12.0.6
	TIGRIS_1_0_0:1.12
	TIGRIS_1_0_0_RC1:1.12.0.2
	TIGRIS_0_9_2_4:1.9
	TIGRIS_0_9_2_3:1.9
	HELM_PEER_PORT_BRANCH:1.11.0.2
	TURBINE_PEER:1.11
	TIGRIS_0_9_2_1:1.11
	TIGRIS_0_9_2:1.9.0.6
	TIGRIS_0_9_0:1.9.0.4
	TIGRIS_0_8_4:1.9.0.2
	NEWHELM:1.1.1.1
	TIGRIS_NOV_12_2000:1.1.1
	OLDHELM:1.6.0.4
	TIGRIS_NOV_11_2000:1.6
	TIGRIS_SEP_13_2000:1.6.0.2
	TIGRIS_BASELINE:1.6;
locks; strict;
comment	@# @;


1.14
date	2001.05.21.20.16.48;	author dlr;	state dead;
branches;
next	1.13;

1.13
date	2001.05.21.20.16.23;	author dlr;	state Exp;
branches;
next	1.12;

1.12
date	2001.03.27.09.07.41;	author lucas;	state Exp;
branches;
next	1.11;

1.11
date	2001.01.26.18.29.07;	author edk;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	2001.01.26.05.24.07;	author edk;	state dead;
branches;
next	1.9;

1.9
date	2000.11.21.01.37.08;	author dlr;	state Exp;
branches;
next	1.8;

1.8
date	2000.11.21.01.24.43;	author dlr;	state Exp;
branches;
next	1.7;

1.7
date	2000.11.12.22.57.32;	author dlr;	state Exp;
branches;
next	1.6;

1.6
date	2000.09.20.03.13.17;	author brian;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2000.04.26.02.05.38;	author jrobbins;	state Exp;
branches;
next	1.4;

1.4
date	2000.04.18.00.10.34;	author jrobbins;	state Exp;
branches;
next	1.3;

1.3
date	2000.02.03.04.21.33;	author jrobbins;	state Exp;
branches;
next	1.2;

1.2
date	2000.01.31.02.41.53;	author jrobbins;	state Exp;
branches;
next	1.1;

1.1
date	2000.01.30.01.59.38;	author jrobbins;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.11.12.21.16.26;	author dlr;	state Exp;
branches;
next	;

1.6.2.1
date	2000.12.15.07.43.54;	author edk;	state Exp;
branches;
next	;

1.11.2.1
date	2001.01.28.01.02.19;	author dlr;	state dead;
branches;
next	;


desc
@@


1.14
log
@edk and I believe that ContentHelmNoodle has replaced TView.
@
text
@/* ================================================================
 * Copyright (c) 2000 Collab.Net.  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. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by Collab.Net (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of Collab.Net.
 * 
 * THIS SOFTWARE IS PROVIDED ``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 COLLAB.NET 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 Collab.Net.
 */


package org.tigris.helm.publish;

import java.util.*;

import org.apache.turbine.util.Log;
import org.apache.turbine.util.TurbineException;

import org.apache.velocity.context.Context;

import org.joist.security.RedirectException;

import org.tigris.helm.security.BaseHelmServlet;
import org.tigris.helm.tool.ContextAPI;

/**
 * Display a HTML page wrapped with the branding templates.
 */
public class TView extends BaseHelmServlet
{
    private static final boolean DEBUG = false;
   
    /**
     *  Displays the html
     */
	protected String processRequest(Context context)
        throws TurbineException, RedirectException
    {
	// Let the superclass do it's part.
	// also sets $page and $documentRoot
	String templateName =  super.processRequest(context);

	context.put("page", ContextAPI.getParameter(context, "page"));
	context.put("documentRoot", myProperties.getProperty("documentRoot"));

	String page = getParameter(context, "page");
	if (page.indexOf("community/") > 0)
    {
        context.put("showCommunity", Boolean.TRUE);
    }
	if (page.indexOf("news/") > 0) context.put("showNews", Boolean.TRUE);
	if (page.indexOf("tools/") > 0) context.put("showTools", Boolean.TRUE);
	
	// echo the project name into the context
	// the project argument is set in the apache RewriteRules
	String project = getParameter(context, "project");

	// if it is not set, try to guess it from the host name, 
        // dealing with some vhosting issues
        String domain = myProperties.getProperty("hostname");
	
	if (project == null || project.length() == 0)
    {
	    String httpAndServer = getHttpAndServer(context);
	    int dot = httpAndServer.indexOf('.', 7);
        if (httpAndServer.startsWith(domain, 7))
        { 
            // Default the vhost.
            project = "www";
        }
        else
        {
            project = httpAndServer.substring(7, dot);
        }
	}

	if (DEBUG) Log.debug("project=" + project);

	// change document root to take into account virtual hosting
	String apacheDocRoot = getInitParameter("documentRoot");
	//String apacheDocRoot = myProperties.getProperty("documentRoot");
	if (DEBUG) Log.debug("apacheDocRoot=" + apacheDocRoot);

	String projectDocRoot = apacheDocRoot + '/' + project + "/www";
	context.put("projectDocRoot", projectDocRoot);

	return templateName;
    }
}
@


1.13
log
@Adding my changes before removing this file.
@
text
@@


1.12
log
@Begone Java 1.1
@
text
@a50 2
import java.sql.*;
import javax.servlet.http.*;
d52 9
a60 3
import org.joist.security.*;
import org.webmacro.util.*;
import org.webmacro.servlet.*;
d63 3
a65 4
  * Display an html page through the standard template.
  */

public class TView extends org.joist.publish.View
d67 1
a67 2
    static private Log log = new Log("TView", "TView");
    static private boolean debug = true;
d72 2
a73 3
	protected String
    processRequest (Connection connection, WebContext context)
	throws HandlerException, RedirectException
d77 1
a77 1
	String templateName =  super.processRequest(connection, context);
d79 8
a86 2
	String page = context.getForm("page");
	if (page.indexOf("community/") > 0) context.put("showCommunity", Boolean.TRUE);
d92 1
a92 1
	String project = context.getForm("project");
d98 2
a99 1
	if (project == null || project.length() == 0) {
d102 9
a110 5
            if (httpAndServer.startsWith(domain, 7)) { //default vhost ... www
                project = "www";
            } else {
                project = httpAndServer.substring(7, dot);
            }
d113 1
a113 1
	if (debug) log.debug("project=" + project);
d118 1
a118 1
	if (debug) log.debug("apacheDocRoot=" + apacheDocRoot);
d120 1
a120 1
	String projectDocRoot = apacheDocRoot + "/" + project + "/www";
@


1.11
log
@readding all the files as part of the process of returning to the way
things were as of tuesday
@
text
@a50 1
import com.sun.java.util.collections.*;
@


1.11.2.1
log
@Porting to the Turbine Peer system.  -dlr and leonardr
@
text
@@


1.10
log
@revert this stuff to its state as of 2001/01/24 12:42:00 GMT -- with
the following exceptions, which have some different modifications so
they'll work with changes which have happened in joist:

ProjectNewsEdit.java
SkinManager.java
SkinStyleElementValueManager.java
StyleElementManager.java
StyleManager.java

it compiles.  i dunno if it works, though.
@
text
@@


1.9
log
@Corrected method call.
@
text
@@


1.8
log
@Made use of new UnsecureServlet method (for better abstraction).
@
text
@d93 1
a93 1
	    String httpAndServer = getHttpAndServer();
@


1.7
log
@Resolved merge conflicts.
@
text
@d93 1
a93 1
	    String httpAndServer = context.get("httpAndServer").toString();
@


1.6
log
@
Obtained from:
Submitted by:
Reviewed by:

Moved from org.helm to org.tigris.helm
Moved from org/helm to org/tigris/helm

perl -pi.bak -e, how I love thee

note: this update was done POST-CVS-REPOSITORY surgury.  In order to
get this right, you may need to remove the directories

$CVSROOT/helm/java/org/helm
$CVSROOT/helm/data/htdoc/look/www/org/helm
$CVSROOT/helm/templates/org/helm

before doing the "CVS update" call, since those directories don't
exist anymore and CVS will try to create lockfiles for you in them,
giving you an error.
@
text
@d88 4
a91 1
	// if it is not set, try to guess it from the host name, assumes vhosting
d95 5
a99 1
	    project = httpAndServer.substring(7, dot);
d101 1
a101 1
	
@


1.6.2.1
log
@attempt to set Last-Modified header for caching proxies & smart clients
@
text
@a49 3
import java.text.SimpleDateFormat;
import java.io.File;
import java.util.Date;
a103 13

	try {
	    File file = new File(projectDocRoot, page);
	    Date lastModDate = new Date(file.lastModified());
	    SimpleDateFormat formatter =
		new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z");
	    String lastMod = formatter.format(lastModDate);
	    HttpServletResponse resp = context.getResponse();
	    resp.setHeader("Last-Modified", lastMod);
	    if (debug) log.info("set Last-Modified to : " + lastMod);
	} catch (Exception e) {
	    if (debug) log.info("unable to set Last-Modified: " + e.toString());
	}
@


1.5
log
@now if the project is specified explicitly it will use that, otherwise it will look at the vhost name
@
text
@d48 1
a48 1
package org.helm.publish;
@


1.4
log
@switched from collections2.jar to collections.jar
@
text
@d86 8
a93 3
	String httpAndServer = context.get("httpAndServer").toString();
	int dot = httpAndServer.indexOf('.', 7);
	String project = httpAndServer.substring(7, dot);
@


1.3
log
@Added tigris.org license
PR:
Obtained from:
Submitted by:
Reviewed by:
@
text
@d51 1
@


1.2
log
@updated TView since some of it was moved into joist; made copyrights consistent
@
text
@d1 46
a46 1
// Copyright (c) 2000 Collab.Net, Inc. All Rights Reserved.
@


1.1
log
@initial checking
@
text
@d1 1
a1 1
// Copyright (c) 2000 Collab.Net, Inc.
d3 1
a3 1
package org.tigris.publish;
a14 5
  *
  * @@author David C. Pellegrini <A HREF="mailto:davidp@@collab.net">davidp@@collab.net</A>,
  * @@version $Revision: 1.1 $
  *
  * Copyright (c) 1999 Collab.Net, Inc.
d33 5
d40 4
a43 3
	String project = (String) context.getForm("project");
	context.put("project", project);

@


1.1.1.1
log
@Merging newhelm tree into helm, as per IZ issue #557.  Previous major version of helm is tagged TIGRIS_NOV_11_2000.
@
text
@d1 1
a1 45
/* ================================================================
 * Copyright (c) 2000 Collab.Net.  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. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by Collab.Net (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of Collab.Net.
 * 
 * THIS SOFTWARE IS PROVIDED ``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 COLLAB.NET 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 Collab.Net.
 */
d3 1
a3 2

package org.tigris.helm.publish;
d15 5
a37 5
	String page = context.getForm("page");
	if (page.indexOf("community/") > 0) context.put("showCommunity", Boolean.TRUE);
	if (page.indexOf("news/") > 0) context.put("showNews", Boolean.TRUE);
	if (page.indexOf("tools/") > 0) context.put("showTools", Boolean.TRUE);
	
d40 2
a41 15
	String project = context.getForm("project");

	// if it is not set, try to guess it from the host name, 
        // dealing with some vhosting issues
        String domain = myProperties.getProperty("hostname");
	
	if (project == null || project.length() == 0) {
	    String httpAndServer = context.get("httpAndServer").toString();
	    int dot = httpAndServer.indexOf('.', 7);
            if (httpAndServer.startsWith(domain, 7)) { //default vhost ... www
                project = "www";
            } else {
                project = httpAndServer.substring(7, dot);
            }
	}
@


