[docs] docs - heins modified icconfig.sdf

docs@icdevgroup.org docs@icdevgroup.org
Sun Sep 1 17:28:01 2002


User:      heins
Date:      2002-09-01 15:07:07 GMT
Modified:  .        icconfig.sdf
Log:
* Document AcceptRedirect, additions to Pragma, DirectoryIndex

Revision  Changes    Path
1.70      +142 -4    docs/icconfig.sdf


rev 1.70, prev_rev 1.69
Index: icconfig.sdf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /anon_cvs/repository/docs/icconfig.sdf,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- icconfig.sdf	12 Aug 2002 02:09:52 -0000	1.69
+++ icconfig.sdf	1 Sep 2002 15:07:06 -0000	1.70
@@ -1,10 +1,10 @@
 !init OPT_LOOK=3D"akopia"; OPT_STYLE=3D"manual"
-# $Id: icconfig.sdf,v 1.69 2002/08/12 02:09:52 mheins Exp $
+# $Id: icconfig.sdf,v 1.70 2002/09/01 15:07:06 mheins Exp $
=20
 !define DOC_NAME "Configuration Reference"
 !define DOC_TYPE ""
 !define DOC_CODE "icconfig"
-!define DOC_VERSION substr('$Revision: 1.69 $',11, -2)
+!define DOC_VERSION substr('$Revision: 1.70 $',11, -2)
 !define DOC_STATUS "Draft"
 !define DOC_PROJECT "Interchange"
 !define DOC_URL "http://interchange.redhat.com/doc/icconfig.html"
@@ -112,6 +112,33 @@
=20
 Following is an alphabetical listing of all global configuration directive=
s.
=20
+H2: AcceptRedirect *global*
+
+Enables processing of HTTP server redirects, i.e. when handling ErrorDocum=
ent
+for Apache. For instance, if you have in Apache httpd.conf:
+
+!block example
+	## Setting in httpd.conf
+	ErrorDocument 404 /cgi-bin/foundation
+!endblock
+
+At that point, a request for /somedir/index.html that is not found will be
+equivalent to /cgi-bin/foundation/somedir/index.html and will be
+indistinguishable from the Apache-served page by the client.
+
+!block example
+	AcceptRedirect  Yes
+!endblock
+
+A Yes/No directive, default C<No>.
+
+Caution should be taken not to enable the ErrorDocument to redirect to
+Interchange globally -- it would render you subject to a
+denial-of-service attack at random URLs, i.e. a flood of MS Windows
+"Code Red" attacks. It is recommended that you enable it only for
+specific directories, as Apache or another HTTP server will stand up
+much better under such a flood.
+
 H2: ActionMap *global*
=20
 Allows setting of Interchange form actions, usually with a Perl subroutine.
@@ -1510,11 +1537,29 @@
 present, even if its contents are blank, it is returned. Example: in
 the case of this catalog.cfg entry:
=20
-        DirConfig   Variable   templates/foundation/regions
+!block example
+	DirConfig Variable templates/foundation/regions
+!endblock
=20
 If the file NOLEFT_TOP is present at catalog config time, __NOLEFT_TOP__ w=
ill
 equal C<[include templates/foundation/regions/NOLEFT_TOP]>.
=20
+H2: DirectoryIndex
+
+If C<DirectoryIndex> is set, and a page would normally be defined as
+missing, it's value is appended (with a separating / if appropriate) and
+the resulting page is looked for. To get the behavior normally
+associated with an HTTP server, where "index.html" is looked for in a
+directory, do:
+
+!block example
+	DirectoryIndex   index.html
+!endblock
+
+Default is blank, disabling the behavior.
+
+.NOTE: Unlike Apache, only one value is accepted.
+
 H2: DisplayErrors
=20
 If the administrator has enabled DisplayErrors globally, setting this to "=
Yes" will display the error returned from Interchange in case something is =
wrong with embedded Perl programs, tags, or Interchange itself. Usually, th=
is will be used during development or debugging. Default is No.
@@ -1899,6 +1944,97 @@
=20
 LI1: dynamic_variables_file_only
=20
+LI1: init_page
+
+Defines a {{CMD[jump=3D"icconfig.html#Sub"]Sub}} or
+{{CMD[jump=3D"icconfig.html#GlobalSub *global*"]GlobalSub}} which will run
+before page Variable processing. A *reference* to the contents of the
+page is passed to the routine.
+
+For instance, if a page was found that did not have a @_VARIABLE_@ in
+it, you could wrap it with a template:
+
+!block example
+    Pragma  init_page=20=20
+	Sub <<EOS
+	sub wrap_page {
+		my $pref =3D shift;
+		return if $$pref =3D~ m{\@_[A-Z][\w+]_\@};
+		$$pref =3D~ m{<!--+ title:\s*(.*?)\s+-->}
+			and $Scratch->{page_title} =3D $1;
+		$$pref =3D <<EOF;
+	\@_MYTEMPLATE_TOP_\@
+	<!--BEGIN CONTENT -->
+	$$pref
+	<!-- END CONTENT -->
+	\@_MYTEMPLATE_BOTTOM_\@
+	EOF
+=09=09
+		return;
+	}
+	EOS
+!endblock
+
+
+LI1: post_page
+
+Defines a {{CMD[jump=3D"icconfig.html#Sub"]Sub}} or
+{{CMD[jump=3D"icconfig.html#GlobalSub *global*"]GlobalSub}} which will run
+after page Variable processing but before tag interpolation. A
+*reference* to the contents of the page is passed to the routine.
+
+Example -- you want your users to be able to edit pages and just put
+in <A href=3D"someotherpage.html">. You can use post_page to handle
+this. To do so, put in catalog.cfg:
+
+!block example
+  Pragma   post_page=3Drelative_urls
+
+  ### Take hrefs like <A HREF=3D"about.html"> and make relative to current
+  ### directory
+  Sub <<EOR
+  sub relative_urls {
+      my $page =3D shift;
+      my @dirs =3D split "/", $Tag->var('MV_PAGE', 1);
+      pop @dirs;
+      my $basedir =3D join  "/", @dirs;
+      $basedir ||=3D '';
+      $basedir .=3D '/' if $basedir;
+
+      my $sub =3D sub {
+          my ($entire, $pre, $url) =3D @_;
+          return $entire if $url =3D~ /^\w+:/;
+          my($page, $form) =3D split /\?/, $url, 2;
+          my $u =3D $Tag->area({
+                    href =3D> "$basedir$page",
+                    form =3D> $form,
+                });
+          return qq{$pre"$u"};
+      };
+      $$page =3D~ s{
+              (
+                  (
+                  <a \s+ (?:[^>]+?\s+)?
+                      href \s*=3D\s*
+                  )
+                      (["']) ([^\s"'>]+) \3
+
+              )}
+              {
+                  $sub->($1,$2,$4)
+              }gsiex;
+      return;
+  }
+  EOR
+!endblock
+
+LI1: pre_page
+
+Defines a {{CMD[jump=3D"icconfig.html#Sub"]Sub}}
+or {{CMD[jump=3D"icconfig.html#GlobalSub *global*"]GlobalSub}} which will
+run after page Variable processing but before tag interpolation. A
+*reference* to the contents of the page is passed to the routine.
+
 LI1: no_image_rewrite
=20
 Prevents image locations in pages from being altered by Interchange. Added=
 in Interchange 4.7.0.
@@ -2266,7 +2402,9 @@
=20
 H2: SpecialPage
=20
-Sets a special page to other than its default value. Can be set as many ti=
mes as necessary. Will have no effect if not one of the Interchange Require=
d Pages.
+Sets a special page to other than its default value. Can be set as many
+times as necessary. Will have no effect if not one of the Interchange
+Required Pages.
=20
 !block example
    SpecialPage         checkout ord/checkout