Index: openacs-4/packages/redirect/redirect.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/redirect/redirect.info,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/redirect/redirect.info	29 Sep 2003 13:17:37 -0000	1.1
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!-- Generated by the OpenACS Package Manager -->
+
+<package key="redirect" url="http://openacs.org/repository/apm/packages/redirect" type="apm_application">
+    <package-name>Redirect</package-name>
+    <pretty-plural>Redirects</pretty-plural>
+    <initial-install-p>f</initial-install-p>
+    <singleton-p>f</singleton-p>
+    
+    <version name="0.3" url="http://openacs.org/repository/download/apm/redirect-0.3.apm">
+        <owner url="mailto:tils@tils.net">Tilmann Singer</owner>
+        <summary>Simple package that redirects from the URL it is mounted on to another URL.</summary>
+        <release-date>2003-09-29</release-date>
+        <description format="text/plain">Simple package that redirects from the URL it is mounted on to another URL. Useful when you have moved content to a new place but don't want old links to break.
+
+The new URL can be entered with a parameter setting.
+
+Note that it does not pass through requests to another application, e.g. one that is running on apache. Use the gatekeeper package for this.</description>
+
+        <!-- No dependency information -->
+
+        <callbacks>
+        </callbacks>
+        <parameters>
+            <parameter datatype="string"  min_n_values="1"  max_n_values="1"  name="NewURL"  description="The URL to redirect to. E.g. /some/path/ or http://myserver.com/some/path/"/>
+            <parameter datatype="number"  min_n_values="1"  max_n_values="1"  name="PermanentRedirect"  default="1" description="Indicate to the requesting browser that this is a permanent redirect. The browser might react by updating a bookmark to the new url for example. Leave set to true if unsure."/>
+            <parameter datatype="number"  min_n_values="1"  max_n_values="1"  name="PreservePathRemainings"  default="1" description="Wether to preserve the remainings of the requested path, e.g. if set to true then the redirect /some/old/path/bla/bla goes to /some/new/path/bla/bla, otherwise it goes to /some/new/path/, regardless of what followed the request. In most cases makes sense to leave set to true."/>
+        </parameters>
+
+    </version>
+</package>
Index: openacs-4/packages/redirect/www/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/redirect/www/index.vuh,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/redirect/www/index.vuh	29 Sep 2003 13:17:37 -0000	1.1
@@ -0,0 +1,58 @@
+ad_page_contract {
+
+    Redirect to the NewURL parameter setting of this package.
+
+}
+
+
+set new_url [parameter::get -parameter NewURL]
+
+if { [empty_string_p $new_url] } {
+    ad_return_error "NewURL not set" "The NewURL parameter of this redirect package is not set, so a redirect is not possible. Please set the parameter in the site-map."
+    ad_script_abort
+}
+
+if { !([util_complete_url_p $new_url] || [util_absolute_path_p $new_url]) } {
+    ad_return_error "NewURL must be an absolute path" "The NewURL parameter must either start with '/' or with a protocol and server, like 'http://myserver.com/'."
+    ad_script_abort
+}
+
+# transform url to an absolute path - copied from ad_returnredirect
+if { ![util_complete_url_p $new_url]} {
+    # /foo/bar.tcl style - prepend the current location:
+    set new_url [util_current_location]$new_url
+}
+
+if { [parameter::get -parameter PreservePathRemainings -default 1] } {
+    # append remaining path elements to new url
+    set new_url "[string trimright $new_url /]/[ad_conn path_info]"
+    if { ![empty_string_p [ad_conn query]] } {
+        append new_url "?[ad_conn query]"
+    }
+}
+
+ns_set put [ns_conn outputheaders] Location $new_url
+
+if { [parameter::get -parameter PermanentRedirect -default 1] } {
+    # permanent redirect
+    ns_return 301 text/html "<html>
+<head><title>Redirection</title></head>
+<body>
+<h2>Redirection</h2>
+<a href=\"$new_url\">The requested URL has moved here permanently.</a>
+</body>
+</html>
+"
+} else {
+    # non-permanent redirect
+    ns_return 302 text/html "<html>
+<head><title>Redirection</title></head>
+<body>
+<h2>Redirection</h2>
+<a href=\"$new_url\">The requested URL has moved here.</a>
+</body>
+</html>
+"
+}
+
+return
Index: openacs-4/packages/redirect/www/doc/index.html
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/redirect/www/doc/index.html,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/redirect/www/doc/index.html	29 Sep 2003 13:17:37 -0000	1.1
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
+<title>Documentation for the Redirect package</title>
+</head>
+
+<body>
+<h1>Documentation for the Redirect package</h1>
+
+<h2>Introduction</h2>
+
+This is a simple package that sends a redirect to another location,
+depending on its parameter settings. It is intended for the situation
+when you moved parts of your site to another location in order to
+reorganise your site, but don't want old links such as users
+bookmarks, links from remote sites, external search engine hits
+etc. to break.
+
+<h2>Usage</h2>
+
+Mount it at the old location using the openacs site-map, and set its
+NewURL parameter to the new location. E.g. when you moved a tree of
+your site from '/some/old/path/' to '/newurl/' then mount an instance
+of redirect at '/some/old/path/', and set its NewURL parameter to
+'/newurl/'.
+
+
+<h2>Parameters</h2>
+
+<h3>NewURL</h3>
+
+The URL to redirect to. E.g. /some/path/ or http://anotherserver.com/some/path/.
+<p>
+
+Relative paths like 'some/other/path/' are not possible.
+
+
+<h3>PreservePathRemainings</h3>
+
+Wether to preserve the remainings of the requested path, e.g. if set
+to true then the redirect /some/old/path/bla/bla goes to
+/some/new/path/bla/bla, otherwise it goes to /some/new/path/,
+regardless of what followed the request. In most cases makes sense to
+leave set to true.
+
+<p>
+
+This also includes query parameters, so that a request for
+'/some/old/path/bla?item_id=100' gets redirected to
+'/newurl/bla?item_id=100' when set to true.
+
+
+<h3>PermanentRedirect</h3>
+
+Indicate to the requesting browser that this is a permanent
+redirect. The browser might react by updating a bookmark to the new
+url for example. Leave set to true if unsure.
+
+<p>
+
+Note that this results in different http status codes. A permanent
+redirect is http status 301, a non-permanent is 302. See general http
+documentation for more info about the consequences.
+
+<h2>Pass Through of Requests</h2>
+
+This package does not pass through http requests - see the gatekeeper
+package for this functionality. (Maybe gatekeeper will be merged into
+this package some day though.)
+
+
+<hr>
+<address></address>
+<!-- hhmts start -->Last modified: Mon Sep 29 13:10:03 GMT 2003 <!-- hhmts end -->
+</body> </html>