bac94e2004-06-05Marc Dirix // This is a ChiliMoon module. Copyright © 1996 - 2001, Roxen IS.
d4e9742000-02-24Martin Nilsson 
9c20b91996-11-20Per Hedbor // This is a small sample module. It is intended to show a simple example // of a container.
3272521999-12-14Martin Nilsson  // This variable is shown in the configinterface as the version of the module.
bac94e2004-06-05Marc Dirix constant cvs_version = "$Id: fnord.pike,v 1.19 2004/06/05 15:19:44 _cvs_dirix Exp $";
6682b91997-08-31Peter Bortas 
bac94e2004-06-05Marc Dirix // Tell ChiliMoon that this module is threadsafe. That is there is no
6682b91997-08-31Peter Bortas // request specific data in global variables.
6aae862000-07-02Martin Nilsson constant thread_safe=1;
6682b91997-08-31Peter Bortas 
3272521999-12-14Martin Nilsson // Include and inherit code that is needed in every module.
9c20b91996-11-20Per Hedbor #include <module.h> inherit "module";
3272521999-12-14Martin Nilsson 
79ca872000-11-24Per Hedbor // Some defines for the translation system // //<locale-token project="mod_fnord">LOCALE</locale-token>
77ca342004-05-23Marc Dirix //#define LOCALE(X,Y) _STR_LOCALE("mod_fnord",X,Y)
79ca872000-11-24Per Hedbor // end of the locale related stuff
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // Documentation:
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // The purpose of this module is to allow comments in the SPML source // that are invisible to average viewers, but can be seen with the // right magic incantation. Fnord! The special text is rendered in // the "sample" font, if available, which makes it possible for // someone looking at the mixed output to distinguish text that is for // public consumption from that which is restricted.
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // See also <COMMENT> which is similar, but always removes the // enclosed text.
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // If you have a section of text (with markup, if desired) that you // may be planning on adding later, but don't want to generally // activate (the pointers may not have all been done, yet) you can use // this. It has other uses, too.
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // This is not a secure way to hide text, I would like to see a // version that requires authentication to turn on the "hidden" text, // but this simple version does not do that.
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // To use this in your SPML, enter the "hidden" text between a <FNORD> // and </FNORD>, you can include any additional markup you desire. // You may want to have a <P> or two to set it off, or use // <BLOCKQUOTE> inside. Here's a simple example:
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // The text that everyone sees. <FNORD>With some they // don't.</FNORD> And then some they do.
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // Since the excised text may be part of a sentence flow, its removal // may disrupt the readability. In this case an ALT attribute can be // used on the FNORD to give text for the mundanes to see. This text // should not have markup (some kinds might work, but others might // not). Here's an example of how that might be used:
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // This server <FNORD ALT="provides">will provide, when we // actually get to it,</FNORD> complete source for the ...
3272521999-12-14Martin Nilsson 
9c20b91996-11-20Per Hedbor // The way the normally hidden text is made visible is by including // "fnord" in the prestates (i.e. add "/(fnord)" before the "filename" // part of the URL). // Michael A. Patton <>
d024df2000-03-17Martin Nilsson // This is the code for the actual container. By naming it "simpletag_"
bac94e2004-06-05Marc Dirix // it is automatically recognized by ChiliMoon as the code for a tag.
9c20b91996-11-20Per Hedbor  // First, check the 'request_id->prestate' multiset for the presence // of 'fnord'. If it is there, show the contents, otherwise, if there // is an 'alt' text, display it, if not, simply return an empty string
d024df2000-03-17Martin Nilsson string simpletag_fnord(string tag_name, mapping arguments, string contents,
3272521999-12-14Martin Nilsson  RequestID id ) { if (id->prestate->fnord) return contents; if (arguments->alt) return arguments->alt;
f0bcef2002-06-14Martin Nilsson  if (arguments["show-fnord"])
77ca342004-05-23Marc Dirix  return "FNORD";
3272521999-12-14Martin Nilsson  return "";
9c20b91996-11-20Per Hedbor }
a8124d2000-02-12Martin Nilsson // Some constants that are needed to register the module in the RXML parser.
b3281f2000-09-10Martin Nilsson constant module_type = MODULE_TAG;
f0bcef2002-06-14Martin Nilsson constant module_name = "Fnord!"; constant module_doc = ("Adds an extra container tag, &lt;fnord&gt; that's supposed " "to make things invisible unless the \"fnord\" prestate is present." "<p>This module is here as an example of how to write a " "very simple RXML-parsing module.</p>" );
3272521999-12-14Martin Nilsson  // Last, but not least, we want a documentation that can be integrated in the // online manual. The mapping tagdoc maps from container names to it's description. TAGDOCUMENTATION; #ifdef manual
ce8fb02001-09-21Johan Sundström constant tagdoc=(["fnord":#"<desc type='cont'>The fnord container tag hides its "
3272521999-12-14Martin Nilsson  "contents for the user, unless the fnord prestate is used.</desc>" "<attr name=alt value=string>An alternate text that should be written " "in place of the hidden text.</attr>"]); #endif