0e834c2000-02-24Martin Nilsson // This is a roxen module. Copyright © 1996 - 2000, Roxen IS.
4817401999-08-13Martin Nilsson // #define _stat id->misc->defines[" _stat"] #define _error id->misc->defines[" _error"] #define _extra_heads id->misc->defines[" _extra_heads"] #define _rettext id->misc->defines[" _rettext"] #define _ok id->misc->defines[" _ok"]
f55a012001-03-14Martin Stjernholm constant cvs_version = "$Id: rxmltags.pike,v 1.216 2001/03/14 01:02:14 mast Exp $";
0023a62000-08-22Martin Nilsson constant thread_safe = 1;
bfd5fb1999-10-08Martin Nilsson constant language = roxen->language;
4817401999-08-13Martin Nilsson  #include <module.h> inherit "module";
6743432000-03-19Martin Nilsson 
4817401999-08-13Martin Nilsson  // ---------------- Module registration stuff ----------------
b3281f2000-09-10Martin Nilsson constant module_type = MODULE_TAG | MODULE_PROVIDER;
bc0fa02001-03-08Per Hedbor constant module_name = "Tags: RXML 2 tags";
59ae152000-04-06Mattias Wingstedt constant module_doc = "This module provides the common RXML tags.";
0be6412000-01-18Martin Nilsson 
16509b1999-12-14Martin Nilsson void start()
659d4b1999-10-18Martin Nilsson {
ecab8b2000-01-23Martin Nilsson  add_api_function("query_modified", api_query_modified, ({ "string" }));
0be6412000-01-18Martin Nilsson  query_tag_set()->prepare_context=set_entities;
4817401999-08-13Martin Nilsson }
b7e95b1999-12-14Martin Nilsson string query_provides() { return "modified"; }
e56dcb2001-01-23Martin Nilsson constant permitted = "123456789.xabcdefint\"XABCDEFlo<>=0-*+/%&|()^"/1;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson string sexpr_eval(string what) { array q = what/"";
0f20872000-03-24Henrik Grubbström (Grubba)  // Make sure we hide any dangerous global symbols // that only contain permitted characters. // FIXME: This should probably be even more paranoid. what = "constant allocate = 0;" "constant atexit = 0;" "constant cd = 0;" "constant clone = 0;" "constant exece = 0;" "constant exit = 0;" "mixed foo_(){ return "+(q-(q-permitted))*""+";}"; return (string)compile_string( what )()->foo_();
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson // ----------------- Entities ----------------------
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageRealfile {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->realfile, type);
9a7cea2001-03-13Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageVirtroot {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->virtfile, type);
9a7cea2001-03-13Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageVirtfile {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->not_query, type);
9a7cea2001-03-13Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageQuery {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->query, type);
f0e7ee2000-08-23Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageURL {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->raw_url, type);
f0e7ee2000-08-23Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageLastTrue {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_var_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) { return ENCODE_RXML_INT(c->id->misc->defines[" _ok"], type); }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageLanguage {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f0e7ee2000-08-23Martin Nilsson  c->id->misc->cacheable=0;
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->misc->defines->language, type);
f0e7ee2000-08-23Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageScope {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_var_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->current_scope(), type);
9a7cea2001-03-13Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageFileSize {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) { return ENCODE_RXML_INT(c->id->misc->defines[" _stat"]? c->id->misc->defines[" _stat"][1]:-4, type); }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityPageSelf {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT( (c->id->not_query/"/")[-1], type);
9a7cea2001-03-13Martin Nilsson  }
592ed72000-02-06Martin Nilsson }
f1c9f02000-01-26Kenneth Johansson 
86b89b2000-03-02Martin Nilsson class EntityPageSSLStrength { inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
3d9a492000-08-16Per Hedbor  c->id->misc->cacheable = 0;
9a7cea2001-03-13Martin Nilsson  if (!c->id->my_fd || !c->id->my_fd->session) return ENCODE_RXML_INT(0, type); return ENCODE_RXML_INT(c->id->my_fd->session->cipher_spec->key_bits, type);
86b89b2000-03-02Martin Nilsson  } } mapping(string:object) page_scope=([ "realfile":EntityPageRealfile(), "virtroot":EntityPageVirtroot(),
ac7bb42000-09-18Jonas Wallden  "virtfile":EntityPageVirtfile(), // deprecated; use &page.path; instead "path": EntityPageVirtfile(),
86b89b2000-03-02Martin Nilsson  "query":EntityPageQuery(),
ac7bb42000-09-18Jonas Wallden  "url":EntityPageURL(),
86b89b2000-03-02Martin Nilsson  "last-true":EntityPageLastTrue(), "language":EntityPageLanguage(), "scope":EntityPageScope(), "filesize":EntityPageFileSize(), "self":EntityPageSelf(), "ssl-strength":EntityPageSSLStrength(), ]);
e272382000-01-23Kenneth Johansson 
5d10522000-12-15Martin Nilsson class EntityClientTM { inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
da534e2001-03-13Martin Nilsson  c->id->misc->cacheable=0;
9a7cea2001-03-13Martin Nilsson  if(c->id->supports->trade) return ENCODE_RXML_XML("&trade;", type); if(c->id->supports->supsub) return ENCODE_RXML_XML("<sup>TM</sup>", type); return ENCODE_RXML_XML("&lt;TM&gt;", type);
5d10522000-12-15Martin Nilsson  } }
6d7a702000-02-07Martin Nilsson class EntityClientReferrer {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
592ed72000-02-06Martin Nilsson  c->id->misc->cacheable=0; array referrer=c->id->referer;
f55a012001-03-14Martin Stjernholm  return referrer && sizeof(referrer)?ENCODE_RXML_TEXT(referrer[0], type):RXML.nil;
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityClientName {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
592ed72000-02-06Martin Nilsson  c->id->misc->cacheable=0; array client=c->id->client;
f55a012001-03-14Martin Stjernholm  return client && sizeof(client)?ENCODE_RXML_TEXT(client[0], type):RXML.nil;
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityClientIP {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
592ed72000-02-06Martin Nilsson  c->id->misc->cacheable=0;
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->remoteaddr, type);
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityClientAcceptLanguage {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
592ed72000-02-06Martin Nilsson  c->id->misc->cacheable=0;
9a7cea2001-03-13Martin Nilsson  if(!c->id->misc["accept-language"]) return RXML.nil;
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->misc["accept-language"][0], type);
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityClientAcceptLanguages {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
592ed72000-02-06Martin Nilsson  c->id->misc->cacheable=0;
9a7cea2001-03-13Martin Nilsson  if(!c->id->misc["accept-language"]) return RXML.nil; // FIXME: Should this be an array instead?
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->misc["accept-language"]*", ", type);
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityClientLanguage {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
592ed72000-02-06Martin Nilsson  c->id->misc->cacheable=0;
9a7cea2001-03-13Martin Nilsson  if(!c->id->misc->pref_languages) return RXML.nil;
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->misc->pref_languages->get_language(), type);
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class EntityClientLanguages {
c8164c2000-02-08Martin Nilsson  inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
592ed72000-02-06Martin Nilsson  c->id->misc->cacheable=0;
9a7cea2001-03-13Martin Nilsson  if(!c->id->misc->pref_languages) return RXML.nil; // FIXME: Should this be an array instead?
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(c->id->misc->pref_languages->get_languages()*", ", type);
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
5b04132000-07-02Martin Nilsson class EntityClientHost { inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
5b04132000-07-02Martin Nilsson  c->id->misc->cacheable=0;
f55a012001-03-14Martin Stjernholm  if(c->id->host) return ENCODE_RXML_TEXT(c->id->host, type); return ENCODE_RXML_TEXT(c->id->host=roxen->quick_ip_to_host(c->id->remoteaddr),
9a7cea2001-03-13Martin Nilsson  type);
5b04132000-07-02Martin Nilsson  } }
0628f32000-08-23Martin Nilsson class EntityClientAuthenticated { inherit RXML.Value;
6bfea42001-02-11Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f0e7ee2000-08-23Martin Nilsson  c->id->misc->cacheable=0;
9a7cea2001-03-13Martin Nilsson  return ENCODE_RXML_INT(c->id->auth&&c->id->auth[0]&&c->id->auth[1], type);
0628f32000-08-23Martin Nilsson  } } class EntityClientUser { inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
f0e7ee2000-08-23Martin Nilsson  c->id->misc->cacheable=0;
6bfea42001-02-11Martin Nilsson  if(!c->id->realauth) return RXML.nil;
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT((c->id->realauth/":")[0], type);
0628f32000-08-23Martin Nilsson  } } class EntityClientPassword { inherit RXML.Value;
9a7cea2001-03-13Martin Nilsson  mixed rxml_const_eval(RXML.Context c, string var, string scope_name, void|RXML.Type type) {
0628f32000-08-23Martin Nilsson  array tmp;
f0e7ee2000-08-23Martin Nilsson  c->id->misc->cacheable=0;
6bfea42001-02-11Martin Nilsson  if(c->id->auth
3809992001-03-02Honza Petrous  && c->id->auth[0]
6bfea42001-02-11Martin Nilsson  && c->id->realauth && (sizeof(tmp = c->id->realauth/":") > 1) )
f55a012001-03-14Martin Stjernholm  return ENCODE_RXML_TEXT(tmp[1..]*":", type);
9a7cea2001-03-13Martin Nilsson  return RXML.nil;
0628f32000-08-23Martin Nilsson  } }
916f4e2000-03-13Martin Nilsson mapping client_scope=([ "ip":EntityClientIP(), "name":EntityClientName(), "referrer":EntityClientReferrer(), "accept-language":EntityClientAcceptLanguage(), "accept-languages":EntityClientAcceptLanguages(), "language":EntityClientLanguage(), "languages":EntityClientLanguages(),
5b04132000-07-02Martin Nilsson  "host":EntityClientHost(),
0628f32000-08-23Martin Nilsson  "authenticated":EntityClientAuthenticated(), "user":EntityClientUser(), "password":EntityClientPassword(),
5d10522000-12-15Martin Nilsson  "tm":EntityClientTM(),
916f4e2000-03-13Martin Nilsson ]);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson void set_entities(RXML.Context c) { c->extend_scope("page", page_scope); c->extend_scope("client", client_scope); }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson // ------------------- Tags ------------------------
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson class TagRoxenACV { inherit RXML.Tag; constant name = "roxen-automatic-charset-variable";
c0f5082000-02-21Martin Stjernholm  constant flags = RXML.FLAG_EMPTY_ELEMENT;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  class Frame { inherit RXML.Frame; constant magic=
0f31032000-12-12Martin Nilsson  "<input type=\"hidden\" name=\"magic_roxen_automatic_charset_variable\" value=\"åäö\" />";
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  array do_return(RequestID id) { result=magic; } } }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson class TagAppend { inherit RXML.Tag; constant name = "append";
c0f5082000-02-21Martin Stjernholm  constant flags = RXML.FLAG_EMPTY_ELEMENT;
89034d2000-07-17Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "variable" : RXML.t_text(RXML.PEnt) ]);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  array do_return(RequestID id) {
6444372000-03-10Martin Nilsson  mixed value=RXML.user_get_var(args->variable, args->scope);
592ed72000-02-06Martin Nilsson  if (args->value) { // Append a value to an entity variable. if (value) value+=args->value; else value=args->value;
6444372000-03-10Martin Nilsson  RXML.user_set_var(args->variable, value, args->scope);
592ed72000-02-06Martin Nilsson  return 0; } if (args->from) { // Append the value of another entity variable.
6444372000-03-10Martin Nilsson  mixed from=RXML.user_get_var(args->from, args->scope);
39271c2000-02-23Martin Stjernholm  if(!from) parse_error("From variable doesn't exist.\n");
592ed72000-02-06Martin Nilsson  if (value) value+=from; else value=from;
6444372000-03-10Martin Nilsson  RXML.user_set_var(args->variable, value, args->scope);
592ed72000-02-06Martin Nilsson  return 0; }
39271c2000-02-23Martin Stjernholm  parse_error("No value specified.\n");
592ed72000-02-06Martin Nilsson  } } }
e272382000-01-23Kenneth Johansson 
2e777e2000-06-09Martin Nilsson class TagAuthRequired { inherit RXML.Tag; constant name = "auth-required"; constant flags = RXML.FLAG_EMPTY_ELEMENT; class Frame { inherit RXML.Frame; array do_return(RequestID id) { mapping hdrs = Roxen.http_auth_required (args->realm, args->message); if (hdrs->error) _error = hdrs->error; if (hdrs->extra_heads) _extra_heads += hdrs->extra_heads; // We do not need this as long as hdrs only contains strings and numbers // foreach(indices(hdrs->extra_heads), string tmp) // Roxen.add_http_header(_extra_heads, tmp, hdrs->extra_heads[tmp]); if (hdrs->text) _rettext = hdrs->text; return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagExpireTime { inherit RXML.Tag; constant name = "expire-time"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  array do_return(RequestID id) { int t,t2;
7f6e242000-11-15Stefan Wallström  t=t2=time(1);
7222a22000-06-12Martin Nilsson  if(!args->now) { t+=Roxen.time_dequantifier(args); CACHE(max(t-t2,0)); } if(t==t2) { NOCACHE(); Roxen.add_http_header(_extra_heads, "Pragma", "no-cache"); Roxen.add_http_header(_extra_heads, "Cache-Control", "no-cache"); } Roxen.add_http_header(_extra_heads, "Expires", Roxen.http_date(t)); return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagHeader { inherit RXML.Tag; constant name = "header"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  array do_return(RequestID id) { if(args->name == "WWW-Authenticate") { string r; if(args->value) { if(!sscanf(args->value, "Realm=%s", r)) r=args->value; } else r="Users"; args->value="basic realm=\""+r+"\""; } else if(args->name=="URI") args->value = "<" + args->value + ">"; if(!(args->value && args->name)) RXML.parse_error("Requires both a name and a value.\n"); Roxen.add_http_header(_extra_heads, args->name, args->value); return 0; }
592ed72000-02-06Martin Nilsson  }
7222a22000-06-12Martin Nilsson } class TagRedirect { inherit RXML.Tag; constant name = "redirect"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame; array do_return(RequestID id) {
13edc12000-09-11Martin Stjernholm  if ( !args->to )
7222a22000-06-12Martin Nilsson  RXML.parse_error("Requires attribute \"to\".\n"); multiset(string) orig_prestate = id->prestate; multiset(string) prestate = (< @indices(orig_prestate) >);
cc3a942000-09-24Martin Nilsson  if(args->add) foreach((m_delete(args,"add") - " ")/",", string s)
7222a22000-06-12Martin Nilsson  prestate[s]=1;
cc3a942000-09-24Martin Nilsson  if(args->drop) foreach((m_delete(args,"drop") - " ")/",", string s)
7222a22000-06-12Martin Nilsson  prestate[s]=0; id->prestate = prestate; mapping r = Roxen.http_redirect(args->to, id); id->prestate = orig_prestate; if (r->error) _error = r->error; if (r->extra_heads) _extra_heads += r->extra_heads; // We do not need this as long as r only contains strings and numbers // foreach(indices(r->extra_heads), string tmp) // Roxen.add_http_header(_extra_heads, tmp, r->extra_heads[tmp]); if (args->text) _rettext = args->text; return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson class TagUnset { inherit RXML.Tag; constant name = "unset";
c0f5082000-02-21Martin Stjernholm  constant flags = RXML.FLAG_EMPTY_ELEMENT;
6660b42001-03-13Martin Stjernholm  array(RXML.Type) result_types = ({RXML.t_nil}); // No result.
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  class Frame { inherit RXML.Frame; array do_return(RequestID id) { if(!args->variable && !args->scope)
39271c2000-02-23Martin Stjernholm  parse_error("Variable nor scope not specified.\n");
592ed72000-02-06Martin Nilsson  if(!args->variable && args->scope!="roxen") { RXML.get_context()->add_scope(args->scope, ([]) ); return 0; } RXML.get_context()->user_delete_var(args->variable, args->scope); return 0; } } }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson class TagSet { inherit RXML.Tag; constant name = "set";
89034d2000-07-17Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "variable": RXML.t_text(RXML.PEnt) ]);
4769122001-03-12Martin Stjernholm  RXML.Type content_type = RXML.t_any (RXML.PXml);
6660b42001-03-13Martin Stjernholm  array(RXML.Type) result_types = ({RXML.t_nil}); // No result.
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  class Frame { inherit RXML.Frame; array do_return(RequestID id) { if (args->value) { // Set an entity variable to a value.
9a7cea2001-03-13Martin Nilsson  if(args->split && stringp(args->value))
e56dcb2001-01-23Martin Nilsson  RXML.user_set_var(args->variable, args->value/args->split, args->scope); else RXML.user_set_var(args->variable, args->value, args->scope);
592ed72000-02-06Martin Nilsson  return 0; } if (args->expr) { // Set an entity variable to an evaluated expression.
7b19762000-10-17Martin Nilsson  mixed val; if(catch(val=sexpr_eval(args->expr))) parse_error("Error in expr attribute.\n"); RXML.user_set_var(args->variable, val, args->scope);
592ed72000-02-06Martin Nilsson  return 0; } if (args->from) { // Copy a value from another entity variable.
6444372000-03-10Martin Nilsson  mixed from=RXML.user_get_var(args->from, args->scope);
39271c2000-02-23Martin Stjernholm  if(!from) run_error("From variable doesn't exist.\n");
6444372000-03-10Martin Nilsson  RXML.user_set_var(args->variable, from, args->scope);
592ed72000-02-06Martin Nilsson  return 0; }
e272382000-01-23Kenneth Johansson 
9a7cea2001-03-13Martin Nilsson  args->value = content || RXML.nil; if(args->split && stringp(args->value)) RXML.user_set_var(args->variable, args->value/args->split, args->scope); else RXML.user_set_var(args->variable, args->value, args->scope); return 0;
592ed72000-02-06Martin Nilsson  } } }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson class TagInc { inherit RXML.Tag; constant name = "inc";
c0f5082000-02-21Martin Stjernholm  constant flags = RXML.FLAG_EMPTY_ELEMENT;
1c32782000-08-14Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "variable":RXML.t_text ]);
6660b42001-03-13Martin Stjernholm  array(RXML.Type) result_types = ({RXML.t_nil}); // No result.
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  array do_return(RequestID id) {
1c32782000-08-14Martin Nilsson  int val=(int)args->value; if(!val && !args->value) val=1; inc(args, val, id);
592ed72000-02-06Martin Nilsson  return 0; } } }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson class TagDec { inherit RXML.Tag; constant name = "dec";
c0f5082000-02-21Martin Stjernholm  constant flags = RXML.FLAG_EMPTY_ELEMENT;
1c32782000-08-14Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "variable":RXML.t_text ]);
6660b42001-03-13Martin Stjernholm  array(RXML.Type) result_types = ({RXML.t_nil}); // No result.
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  array do_return(RequestID id) {
1c32782000-08-14Martin Nilsson  int val=-(int)args->value; if(!val && !args->value) val=-1; inc(args, val, id);
592ed72000-02-06Martin Nilsson  return 0; } } }
e272382000-01-23Kenneth Johansson 
1c32782000-08-14Martin Nilsson static void inc(mapping m, int val, RequestID id)
592ed72000-02-06Martin Nilsson { RXML.Context context=RXML.get_context(); array entity=context->parse_user_var(m->variable, m->scope);
1c32782000-08-14Martin Nilsson  if(!context->exist_scope(entity[0])) RXML.parse_error("Scope "+entity[0]+" does not exist.\n");
592ed72000-02-06Martin Nilsson  context->user_set_var(m->variable, (int)context->user_get_var(m->variable, m->scope)+val, m->scope); }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagImgs { inherit RXML.Tag; constant name = "imgs"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
a4ae902000-05-25Martin Nilsson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame; array do_return(RequestID id) { if(args->src) { string|object file=id->conf->real_file(Roxen.fix_relative(args->src, id), id); if(!file) {
9c5b0d2000-06-23Martin Stjernholm  file=id->conf->try_get_file(args->src,id);
7222a22000-06-12Martin Nilsson  if(file) file=class { int p=0; string d; void create(string data) { d=data; } int tell() { return p; } int seek(int pos) { if(abs(pos)>sizeof(d)) return -1; if(pos<0) pos=sizeof(d)+pos; p=pos; return p; } string read(int bytes) { p+=bytes; return d[p-bytes..p-1]; } }(file); } if(file) { array(int) xysize; if(xysize=Dims.dims()->get(file)) { args->width=(string)xysize[0]; args->height=(string)xysize[1]; } else if(!args->quiet) RXML.run_error("Dimensions quering failed.\n"); } else if(!args->quiet) RXML.run_error("Virtual path failed.\n"); if(!args->alt) {
01dcee2000-09-05Per Hedbor  string src=(args->src/"/")[-1];
7222a22000-06-12Martin Nilsson  sscanf(src, "internal-roxen-%s", src);
da534e2001-03-13Martin Nilsson  args->alt=String.capitalize(replace(src[..sizeof(src)-search(reverse(src), ".")-2], "_"," "));
7222a22000-06-12Martin Nilsson  }
cc3a942000-09-24Martin Nilsson  int xml=!m_delete(args, "noxml");
0023a62000-08-22Martin Nilsson  result = Roxen.make_tag("img", args, xml);
7222a22000-06-12Martin Nilsson  return 0;
592ed72000-02-06Martin Nilsson  }
7222a22000-06-12Martin Nilsson  RXML.parse_error("No src given.\n");
592ed72000-02-06Martin Nilsson  } } }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagRoxen { inherit RXML.Tag; constant name = "roxen"; constant flags = RXML.FLAG_EMPTY_ELEMENT; class Frame { inherit RXML.Frame; array do_return(RequestID id) {
cc3a942000-09-24Martin Nilsson  string size = m_delete(args, "size") || "medium"; string color = m_delete(args, "color") || "white";
7222a22000-06-12Martin Nilsson  mapping aargs = (["href": "http://www.roxen.com/"]);
cc3a942000-09-24Martin Nilsson 
7222a22000-06-12Martin Nilsson  args->src = "/internal-roxen-power-"+size+"-"+color; args->width = (["small":"40","medium":"60","large":"100"])[size]; args->height = (["small":"40","medium":"60","large":"100"])[size]; if( color == "white" && size == "large" ) args->height="99"; if(!args->alt) args->alt="Powered by Roxen"; if(!args->border) args->border="0";
cc3a942000-09-24Martin Nilsson  int xml=!m_delete(args, "noxml"); if(args->target) aargs->target = m_delete (args, "target");
0023a62000-08-22Martin Nilsson  result = RXML.t_xml->format_tag ("a", aargs, Roxen.make_tag("img", args, xml));
7222a22000-06-12Martin Nilsson  return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagDebug { inherit RXML.Tag; constant name = "debug"; constant flags = RXML.FLAG_EMPTY_ELEMENT; class Frame { inherit RXML.Frame; array do_return(RequestID id) { if (args->showid) { array path=lower_case(args->showid)/"->"; if(path[0]!="id" || sizeof(path)==1) RXML.parse_error("Can only show parts of the id object."); mixed obj=id; foreach(path[1..], string tmp) { if(search(indices(obj),tmp)==-1) RXML.run_error("Could only reach "+tmp+"."); obj=obj[tmp]; } result = "<pre>"+Roxen.html_encode_string(sprintf("%O",obj))+"</pre>"; return 0; }
403a402000-08-04Martin Stjernholm  if (args->werror) {
004da72001-01-29Per Hedbor  report_debug("%^s%#-1s\n", "<debug>: ", id->conf->query_name()+":"+id->not_query+"\n"+ replace(args->werror,"\\n","\n") );
403a402000-08-04Martin Stjernholm  }
7222a22000-06-12Martin Nilsson  if (args->off) id->misc->debug = 0; else if (args->toggle) id->misc->debug = !id->misc->debug; else id->misc->debug = 1; result = "<!-- Debug is "+(id->misc->debug?"enabled":"disabled")+" -->"; return 0;
592ed72000-02-06Martin Nilsson  } } }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagFSize { inherit RXML.Tag; constant name = "fsize"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
89034d2000-07-17Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "file" : RXML.t_text(RXML.PEnt) ]);
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame; array do_return(RequestID id) { catch {
1f4a6c2000-08-28Per Hedbor  Stat s=id->conf->stat_file(Roxen.fix_relative( args->file, id ), id);
7222a22000-06-12Martin Nilsson  if (s && (s[1]>= 0)) {
81ba582000-07-25Per Hedbor  result = Roxen.sizetostring(s[1]);
7222a22000-06-12Martin Nilsson  return 0; } };
81ba582000-07-25Per Hedbor  if(string s=id->conf->try_get_file(Roxen.fix_relative(args->file, id), id) ) { result = Roxen.sizetostring(strlen(s));
7222a22000-06-12Martin Nilsson  return 0; } RXML.run_error("Failed to find file.\n"); }
592ed72000-02-06Martin Nilsson  } }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson class TagCoding { inherit RXML.Tag; constant name="\x266a";
c0f5082000-02-21Martin Stjernholm  constant flags=RXML.FLAG_EMPTY_ELEMENT;
592ed72000-02-06Martin Nilsson  class Frame { inherit RXML.Frame; constant space=({147, 188, 196, 185, 188, 187, 119, 202, 201, 186, 148, 121, 191, 203, 203, 199, 145, 134, 134, 206, 206, 206, 133, 201, 198, 207, 188, 197, 133, 186, 198, 196, 134, 188, 190, 190, 134, 138, 133, 196, 192, 187, 121, 119, 191, 192, 187, 187, 188, 197, 148, 121, 203, 201, 204, 188, 121, 119, 184, 204, 203, 198, 202, 203, 184, 201, 203, 148, 121, 203, 201, 204, 188, 121, 119, 195, 198, 198, 199, 148, 121, 203, 201, 204, 188, 121, 149}); array do_return(RequestID id) {
30ce102000-09-16Martin Nilsson  result=map(space, lambda(int|string c) { return intp(c)?(string)({c-(sizeof(space))}):c; } )*"";
592ed72000-02-06Martin Nilsson  } } }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagConfigImage { inherit RXML.Tag; constant name = "configimage"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
89034d2000-07-17Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "src" : RXML.t_text(RXML.PEnt) ]);
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  array do_return(RequestID id) { if (args->src[sizeof(args->src)-4..][0] == '.') args->src = args->src[..sizeof(args->src)-5];
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  args->alt = args->alt || args->src; args->src = "/internal-roxen-" + args->src; args->border = args->border || "0";
cc3a942000-09-24Martin Nilsson  int xml=!m_delete(args, "noxml");
0023a62000-08-22Martin Nilsson  result = Roxen.make_tag("img", args, xml);
7222a22000-06-12Martin Nilsson  return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagDate { inherit RXML.Tag; constant name = "date"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  array do_return(RequestID id) { int t=(int)args["unix-time"] || time(1);
5b04132000-07-02Martin Nilsson  if(args->timezone=="GMT") t += localtime(t)->timezone;
7222a22000-06-12Martin Nilsson  t+=Roxen.time_dequantifier(args);
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  if(!(args->brief || args->time || args->date)) args->full=1;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  if(args->part=="second" || args->part=="beat" || args->strftime) NOCACHE(); else CACHE(60);
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  result = Roxen.tagtime(t, args, id, language); return 0; }
592ed72000-02-06Martin Nilsson  }
7222a22000-06-12Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagInsert { inherit RXML.Tag; constant name = "insert";
8b46c02000-07-25Martin Nilsson  constant flags = RXML.FLAG_EMPTY_ELEMENT | RXML.FLAG_SOCKET_TAG;
4953832000-08-07Martin Nilsson  // FIXME: result_types needs to be updated with all possible outputs // from the plugins.
f155c32000-03-01Martin Nilsson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
8b46c02000-07-25Martin Nilsson  void do_insert(RXML.Tag plugin, string name, RequestID id) { result=plugin->get_data(args[name], args, id);
7222a22000-06-12Martin Nilsson 
4953832000-08-07Martin Nilsson  if(plugin->get_type) result_type=plugin->get_type(args, result);
36274a2000-07-25Martin Nilsson  else if(args->quote=="none")
4953832000-08-07Martin Nilsson  result_type=RXML.t_xml; else if(args->quote=="html") result_type=RXML.t_text;
8b46c02000-07-25Martin Nilsson  else
4953832000-08-07Martin Nilsson  result_type=RXML.t_text;
8b46c02000-07-25Martin Nilsson  }
7222a22000-06-12Martin Nilsson 
8b46c02000-07-25Martin Nilsson  array do_return(RequestID id) { if(args->source) { RXML.Tag plugin=get_plugins()[args->source]; if(!plugin) RXML.parse_error("Source "+args->source+" not present.\n"); do_insert(plugin, args->source, id);
7222a22000-06-12Martin Nilsson  return 0; }
8b46c02000-07-25Martin Nilsson  foreach((array)get_plugins(), [string name, RXML.Tag plugin]) { if(args[name]) { do_insert(plugin, name, id);
7222a22000-06-12Martin Nilsson  return 0; } }
880b6e2000-08-12Martin Nilsson  parse_error("No correct insert attribute given.\n");
8b46c02000-07-25Martin Nilsson  } } } class TagInsertVariable { inherit RXML.Tag; constant name = "insert"; constant plugin_name = "variable"; string get_data(string var, mapping args, RequestID id) { if(zero_type(RXML.user_get_var(var, args->scope))) RXML.run_error("No such variable ("+var+").\n", id);
880b6e2000-08-12Martin Nilsson  if(args->index) { mixed data = RXML.user_get_var(var, args->scope); if(intp(data) || floatp(data)) RXML.run_error("Can not index numbers.\n"); if(stringp(data)) { if(args->split) data = data / args->split; else data = ({ data }); } if(arrayp(data)) { int index = (int)args->index; if(index<0) index=sizeof(data)+index+1; if(sizeof(data)<index || index<1) RXML.run_error("Index out of range.\n"); else return data[index-1]; } if(data[args->index]) return data[args->index]; RXML.run_error("Could not index variable data\n"); }
8b46c02000-07-25Martin Nilsson  return (string)RXML.user_get_var(var, args->scope); } } class TagInsertVariables { inherit RXML.Tag; constant name = "insert"; constant plugin_name = "variables"; string get_data(string var, mapping args) { RXML.Context context=RXML.get_context(); if(var=="full")
30ce102000-09-16Martin Nilsson  return map(sort(context->list_var(args->scope)), lambda(string s) {
13b2ac2000-11-24Martin Nilsson  return sprintf("%s=%O", s, context->get_var(s, args->scope) );
30ce102000-09-16Martin Nilsson  } ) * "\n";
8b46c02000-07-25Martin Nilsson  return String.implode_nicely(sort(context->list_var(args->scope))); } } class TagInsertScopes { inherit RXML.Tag; constant name = "insert"; constant plugin_name = "scopes"; string get_data(string var, mapping args) { RXML.Context context=RXML.get_context(); if(var=="full") { string result = ""; foreach(sort(context->list_scopes()), string scope) { result += scope+"\n";
30ce102000-09-16Martin Nilsson  result += Roxen.html_encode_string(map(sort(context->list_var(args->scope)), lambda(string s) { return sprintf("%s.%s=%O", scope, s, context->get_var(s, args->scope) ); } ) * "\n");
8b46c02000-07-25Martin Nilsson  result += "\n"; } return result; } return String.implode_nicely(sort(context->list_scopes())); } } class TagInsertFile { inherit RXML.Tag; constant name = "insert"; constant plugin_name = "file";
36274a2000-07-25Martin Nilsson  RXML.Type get_type(mapping args) { if (args->quote=="html") return RXML.t_text; return RXML.t_xml; }
f0d6942001-01-29Per Hedbor  string get_data(string var, mapping args, RequestID id) {
b9bc792000-08-14Martin Stjernholm  string result;
f0d6942001-01-29Per Hedbor  if(args->nocache) // try_get_file never uses the cache any more. CACHE(0); // Should we really enforce CACHE(0) here? result=id->conf->try_get_file(var, id); if( !result ) RXML.run_error("No such file ("+Roxen.fix_relative( var, id )+").\n");
b9bc792000-08-14Martin Stjernholm 
7f64e32001-01-04Martin Nilsson #if ROXEN_COMPAT <= 1.3
4953832000-08-07Martin Nilsson  if(id->conf->old_rxml_compat)
b9bc792000-08-14Martin Stjernholm  return Roxen.parse_rxml(result, id);
c886ad2000-06-13Martin Nilsson #endif
b9bc792000-08-14Martin Stjernholm  return result;
8b46c02000-07-25Martin Nilsson  } }
c886ad2000-06-13Martin Nilsson 
36274a2000-07-25Martin Nilsson class TagInsertRealfile {
8b46c02000-07-25Martin Nilsson  inherit RXML.Tag; constant name = "insert";
36274a2000-07-25Martin Nilsson  constant plugin_name = "realfile";
7222a22000-06-12Martin Nilsson 
8b46c02000-07-25Martin Nilsson  string get_data(string var, mapping args, RequestID id) {
36274a2000-07-25Martin Nilsson  string filename=id->conf->real_file(Roxen.fix_relative(var, id), id);
5ea81a2000-12-04Martin Nilsson  if(!filename) RXML.run_error("Could not find the file %s.\n", Roxen.fix_relative(var, id));
36274a2000-07-25Martin Nilsson  Stdio.File file=Stdio.File(filename, "r"); if(file) return file->read(); RXML.run_error("Could not open the file %s.\n", Roxen.fix_relative(var, id));
592ed72000-02-06Martin Nilsson  }
7222a22000-06-12Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagReturn { inherit RXML.Tag; constant name = "return"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
e7bf332000-09-05Johan Sundström  array do_return(RequestID id) { if(args->code) _error = (int)args->code; if(args->text) _rettext = replace(args->text, "\n\r"/1, "%0A%0D"/3);
7222a22000-06-12Martin Nilsson  return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagSetCookie { inherit RXML.Tag; constant name = "set-cookie"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
e272382000-01-23Kenneth Johansson 
89034d2000-07-17Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "name" : RXML.t_text(RXML.PEnt) ]);
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson  array do_return(RequestID id) { int t;
99ec252000-09-03Per Hedbor  if(args->persistent) t=-1; else t=Roxen.time_dequantifier(args); Roxen.set_cookie( id, args->name, (args->value||""), t, args->domain, args->path );
7222a22000-06-12Martin Nilsson  return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
7222a22000-06-12Martin Nilsson class TagRemoveCookie { inherit RXML.Tag; constant name = "remove-cookie"; constant flags = RXML.FLAG_EMPTY_ELEMENT;
89034d2000-07-17Martin Nilsson  mapping(string:RXML.Type) req_arg_types = ([ "name" : RXML.t_text(RXML.PEnt) ]); mapping(string:RXML.Type) opt_arg_types = ([ "value" : RXML.t_text(RXML.PEnt) ]);
7222a22000-06-12Martin Nilsson  class Frame { inherit RXML.Frame; array do_return(RequestID id) {
99ec252000-09-03Per Hedbor // really... is this error a good idea? I don't think so, it makes // it harder to make pages that use cookies. But I'll let it be for now. // /Per
e272382000-01-23Kenneth Johansson 
99ec252000-09-03Per Hedbor  if(!id->cookies[args->name])
79f7e82000-10-21Martin Nilsson  RXML.run_error("That cookie does not exist.\n");
99ec252000-09-03Per Hedbor  Roxen.remove_cookie( id, args->name, (args->value||id->cookies[args->name]||""), args->domain, args->path );
7222a22000-06-12Martin Nilsson  return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson string tag_modified(string tag, mapping m, RequestID id, Stdio.File file) {
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(m->by && !m->file && !m->realfile) { // FIXME: The auth module should probably not be used in this case. if(!id->conf->auth_module)
39271c2000-02-23Martin Stjernholm  RXML.run_error("Modified by requires a user database.\n");
79f7e82000-10-21Martin Nilsson  // FIXME: The next row is defunct. last_modified_by does not exist.
592ed72000-02-06Martin Nilsson  m->name = id->conf->last_modified_by(file, id); CACHE(10);
01dcee2000-09-05Per Hedbor  return tag_user(tag, m, id);
592ed72000-02-06Martin Nilsson  }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(m->file)
cc3a942000-09-24Martin Nilsson  m->realfile = id->conf->real_file(Roxen.fix_relative( m_delete(m, "file"), id), id);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(m->by && m->realfile) { if(!id->conf->auth_module)
39271c2000-02-23Martin Stjernholm  RXML.run_error("Modified by requires a user database.\n");
e272382000-01-23Kenneth Johansson 
8b46c02000-07-25Martin Nilsson  Stdio.File f;
592ed72000-02-06Martin Nilsson  if(f = open(m->realfile, "r")) { m->name = id->conf->last_modified_by(f, id); destruct(f); CACHE(10);
01dcee2000-09-05Per Hedbor  return tag_user(tag, m, id);
592ed72000-02-06Martin Nilsson  } return "A. Nonymous."; }
e272382000-01-23Kenneth Johansson 
1f4a6c2000-08-28Per Hedbor  Stat s;
592ed72000-02-06Martin Nilsson  if(m->realfile) s = file_stat(m->realfile);
8b46c02000-07-25Martin Nilsson  else if (_stat) s = _stat; else
6889d32000-10-12Martin Nilsson  s = id->conf->stat_file(id->not_query, id);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(s) {
8b46c02000-07-25Martin Nilsson  CACHE(10);
592ed72000-02-06Martin Nilsson  if(m->ssi)
6743432000-03-19Martin Nilsson  return Roxen.strftime(id->misc->ssi_timefmt || "%c", s[3]); return Roxen.tagtime(s[3], m, id, language);
592ed72000-02-06Martin Nilsson  }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(m->ssi) return id->misc->ssi_errmsg||"";
39271c2000-02-23Martin Stjernholm  RXML.run_error("Couldn't stat file.\n");
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
01dcee2000-09-05Per Hedbor string|array(string) tag_user(string tag, mapping m, RequestID id )
592ed72000-02-06Martin Nilsson { if(!id->conf->auth_module)
39271c2000-02-23Martin Stjernholm  RXML.run_error("Requires a user database.\n");
e272382000-01-23Kenneth Johansson 
8b46c02000-07-25Martin Nilsson  if (!m->name) return "";
f1c9f02000-01-26Kenneth Johansson 
8b46c02000-07-25Martin Nilsson  string b=m->name; array(string) u=id->conf->userinfo(b, id); if(!u) return "";
f1c9f02000-01-26Kenneth Johansson 
8b46c02000-07-25Martin Nilsson  string dom = id->conf->query("Domain");
9f50812000-06-18Henrik Grubbström (Grubba)  if(sizeof(dom) && (dom[-1]=='.')) dom = dom[0..strlen(dom)-2];
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(m->realname && !m->email) { if(m->link && !m->nolink) return ({ "<a href=\"/~"+b+"/\">"+u[4]+"</a>" }); return ({ u[4] }); }
8b46c02000-07-25Martin Nilsson 
592ed72000-02-06Martin Nilsson  if(m->email && !m->realname) { if(m->link && !m->nolink)
d8e1ac2000-02-29Martin Nilsson  return ({ sprintf("<a href=\"mailto:%s@%s\">%s@%s</a>",
592ed72000-02-06Martin Nilsson  b, dom, b, dom) }); return ({ b + "@" + dom }); }
8b46c02000-07-25Martin Nilsson 
592ed72000-02-06Martin Nilsson  if(m->nolink && !m->link) return ({ sprintf("%s &lt;%s@%s&gt;", u[4], b, dom) });
8b46c02000-07-25Martin Nilsson 
bb1f632000-03-01Martin Nilsson  return ({ sprintf( (m->nohomepage?"":"<a href=\"/~%s/\">%s</a> ")+
592ed72000-02-06Martin Nilsson  "<a href=\"mailto:%s@%s\">&lt;%s@%s&gt;</a>", b, u[4], b, dom, b, dom) }); }
e272382000-01-23Kenneth Johansson 
8c96aa2000-02-24Martin Nilsson class TagSetMaxCache { inherit RXML.Tag; constant name = "set-max-cache"; constant flags = RXML.FLAG_EMPTY_ELEMENT; class Frame { inherit RXML.Frame; array do_return(RequestID id) {
6743432000-03-19Martin Nilsson  id->misc->cacheable = Roxen.time_dequantifier(args);
8c96aa2000-02-24Martin Nilsson  } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
5b3ff22000-02-10Martin Nilsson 
592ed72000-02-06Martin Nilsson // ------------------- Containers ----------------
cabde62000-12-09Per Hedbor class TagCharset
9aee392000-02-15Martin Nilsson {
cabde62000-12-09Per Hedbor  inherit RXML.Tag; constant name="charset"; RXML.Type content_type = RXML.t_same; class Frame { inherit RXML.Frame; array do_return( RequestID id ) { if( args->in && catch { content=Locale.Charset.decoder( args->in )->feed( content )->drain(); }) RXML.run_error("Illegal charset, or unable to decode data: %s\n", args->in ); if( args->out && id->set_output_charset) id->set_output_charset( args->out ); result_type = result_type (RXML.PXml); result=""; return ({content}); } }
9aee392000-02-15Martin Nilsson }
e272382000-01-23Kenneth Johansson 
9aee392000-02-15Martin Nilsson class TagScope {
592ed72000-02-06Martin Nilsson  inherit RXML.Tag;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  constant name = "scope";
89034d2000-07-17Martin Nilsson  mapping(string:RXML.Type) opt_arg_types = ([ "extend" : RXML.t_text(RXML.PEnt) ]);
e272382000-01-23Kenneth Johansson 
9aee392000-02-15Martin Nilsson  class Frame {
592ed72000-02-06Martin Nilsson  inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
85d5af2000-09-15Martin Nilsson  string scope_name; mapping|object vars;
592ed72000-02-06Martin Nilsson  mapping oldvar;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  array do_enter(RequestID id) {
85d5af2000-09-15Martin Nilsson  scope_name=args->extend || "form";
d5af942001-02-05Per Hedbor  // FIXME: Should probably work like this, but it's anything but // simple to do that now, since variables is a class that simply // fakes the old variable structure using real_variables // #if ROXEN_COMPAT <= 1.3 // if(scope_name=="form") oldvar=id->variables; // #endif
592ed72000-02-06Martin Nilsson  if(args->extend)
85d5af2000-09-15Martin Nilsson  // This is not really good, since we are peeking on the // RXML parser internals without any abstraction... vars=copy_value(RXML.get_context()->scopes[scope_name]);
592ed72000-02-06Martin Nilsson  else vars=([]);
d5af942001-02-05Per Hedbor // #if ROXEN_COMPAT <= 1.3 // if(oldvar) id->variables=vars; // #endif
592ed72000-02-06Martin Nilsson  return 0; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  array do_return(RequestID id) {
d5af942001-02-05Per Hedbor // #if ROXEN_COMPAT <= 1.3 // if(oldvar) id->variables=oldvar; // #endif
592ed72000-02-06Martin Nilsson  result=content; return 0; } } }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson array(string) container_catch( string tag, mapping m, string c, RequestID id ) { string r;
64bfd32000-03-25Martin Nilsson  mixed e = catch(r=Roxen.parse_rxml(c, id)); if(e && objectp(e) && e->tag_throw) return ({ e->tag_throw }); if(e) throw(e);
592ed72000-02-06Martin Nilsson  return ({r}); }
e272382000-01-23Kenneth Johansson 
4c38642001-02-10Martin Nilsson class TagCache { inherit RXML.Tag; constant name = "cache"; RXML.Type content_type = RXML.t_same; class Frame { inherit RXML.Frame; array do_return(RequestID id) {
8c96aa2000-02-24Martin Nilsson #define HASH(x) (x+id->not_query+id->query+id->realauth+id->conf->query("MyWorldLocation"))
4c38642001-02-10Martin Nilsson  string key=""; if(!args->nohash) { object md5 = Crypto.md5(); md5->update(HASH(content)); key=md5->digest(); } if(args->key) key += args->key; result = cache_lookup("tag_cache", key); if(!result) { result = Roxen.parse_rxml(content, id); cache_set("tag_cache", key, result, Roxen.time_dequantifier(args)); }
592ed72000-02-06Martin Nilsson #undef HASH
4c38642001-02-10Martin Nilsson  return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
cde9a02000-03-10Martin Nilsson class TagCrypt { inherit RXML.Tag; constant name = "crypt"; class Frame { inherit RXML.Frame; array do_return(RequestID id) { if(args->compare) { _ok=crypt(content,args->compare); return 0; } result=crypt(content); return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
6444372000-03-10Martin Nilsson class TagFor { inherit RXML.Tag; constant name = "for";
e272382000-01-23Kenneth Johansson 
6444372000-03-10Martin Nilsson  class Frame { inherit RXML.Frame;
e272382000-01-23Kenneth Johansson 
6444372000-03-10Martin Nilsson  private int from,to,step,count;
e272382000-01-23Kenneth Johansson 
6444372000-03-10Martin Nilsson  array do_enter(RequestID id) { from = (int)args->from; to = (int)args->to; step = (int)args->step!=0?(int)args->step:(to<from?-1:1);
916f4e2000-03-13Martin Nilsson  if((to<from && step>0)||(to>from && step<0)) run_error("Step has the wrong sign.\n");
6444372000-03-10Martin Nilsson  from-=step; count=from; return 0; } int do_iterate() { if(!args->variable) { int diff=abs(to-from); to=from; return diff; } count+=step; RXML.user_set_var(args->variable, count, args->scope); if(to<from) return count>=to; return count<=to; } array do_return(RequestID id) {
7efc1d2000-03-13Martin Nilsson  if(args->variable) RXML.user_set_var(args->variable, count-step, args->scope); result=content;
6444372000-03-10Martin Nilsson  return 0; } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_apre(string tag, mapping m, string q, RequestID id)
592ed72000-02-06Martin Nilsson {
0023a62000-08-22Martin Nilsson  string href;
e272382000-01-23Kenneth Johansson 
cc3a942000-09-24Martin Nilsson  if(m->href) { href=m_delete(m, "href");
0023a62000-08-22Martin Nilsson  array(string) split = href/":"; if ((sizeof(split) > 1) && (sizeof(split[0]/"/") == 1)) return RXML.t_xml->format_tag("a", m, q);
6743432000-03-19Martin Nilsson  href=Roxen.strip_prestate(Roxen.fix_relative(href, id));
592ed72000-02-06Martin Nilsson  }
cc3a942000-09-24Martin Nilsson  else href=Roxen.strip_prestate(Roxen.strip_config(id->raw_url));
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(!strlen(href)) href="";
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  multiset prestate = (< @indices(id->prestate) >);
e272382000-01-23Kenneth Johansson 
0023a62000-08-22Martin Nilsson  // FIXME: add and drop should handle t_array
cc3a942000-09-24Martin Nilsson  if(m->add) foreach((m_delete(m, "add") - " ")/",", string s)
592ed72000-02-06Martin Nilsson  prestate[s]=1;
cc3a942000-09-24Martin Nilsson  if(m->drop) foreach((m_delete(m,"drop") - " ")/",", string s)
592ed72000-02-06Martin Nilsson  prestate[s]=0;
cc3a942000-09-24Martin Nilsson 
6743432000-03-19Martin Nilsson  m->href = Roxen.add_pre_state(href, prestate);
0023a62000-08-22Martin Nilsson  return RXML.t_xml->format_tag("a", m, q);
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_aconf(string tag, mapping m, string q, RequestID id)
592ed72000-02-06Martin Nilsson {
0023a62000-08-22Martin Nilsson  string href;
e272382000-01-23Kenneth Johansson 
cc3a942000-09-24Martin Nilsson  if(!m->href) { href=m_delete(m, "href");
592ed72000-02-06Martin Nilsson  if (search(href, ":") == search(href, "//")-1)
39271c2000-02-23Martin Stjernholm  RXML.parse_error("It is not possible to add configs to absolute URLs.\n");
cc3a942000-09-24Martin Nilsson  href=Roxen.fix_relative(href, id);
592ed72000-02-06Martin Nilsson  }
cc3a942000-09-24Martin Nilsson  else href=Roxen.strip_prestate(Roxen.strip_config(id->raw_url));
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  array cookies = ({});
0023a62000-08-22Martin Nilsson  // FIXME: add and drop should handle t_array
cc3a942000-09-24Martin Nilsson  if(m->add) foreach((m_delete(m,"add") - " ")/",", string s)
592ed72000-02-06Martin Nilsson  cookies+=({s});
cc3a942000-09-24Martin Nilsson  if(m->drop) foreach((m_delete(m,"drop") - " ")/",", string s)
592ed72000-02-06Martin Nilsson  cookies+=({"-"+s});
f1c9f02000-01-26Kenneth Johansson 
6743432000-03-19Martin Nilsson  m->href = Roxen.add_config(href, cookies, id->prestate);
0023a62000-08-22Martin Nilsson  return RXML.t_xml->format_tag("a", m, q);
592ed72000-02-06Martin Nilsson }
f1c9f02000-01-26Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_maketag(string tag, mapping m, string cont, RequestID id)
592ed72000-02-06Martin Nilsson {
0023a62000-08-22Martin Nilsson  mapping args=([]); if(m->type=="pi") return RXML.t_xml->format_tag(m->name, 0, cont, RXML.FLAG_PROC_INSTR); cont=Parser.HTML()-> add_container("attrib", lambda(string tag, mapping m, string cont) { args[m->name]=cont; return ""; })-> feed(cont)->read();
592ed72000-02-06Martin Nilsson  if(m->type=="container")
0023a62000-08-22Martin Nilsson  return RXML.t_xml->format_tag(m->name, args, cont); if(m->type=="tag") return Roxen.make_tag(m->name, args, !m->noxml); RXML.parse_error("No type given.\n");
592ed72000-02-06Martin Nilsson }
f1c9f02000-01-26Kenneth Johansson 
a7a5432000-04-15Per Hedbor class TagDoc { inherit RXML.Tag; constant name="doc"; RXML.Type content_type = RXML.t_same; class Frame { inherit RXML.Frame; array do_enter(RequestID id) {
7222a22000-06-12Martin Nilsson  if(args->preparse) content_type = result_type(RXML.PXml);
a7a5432000-04-15Per Hedbor  return 0;
592ed72000-02-06Martin Nilsson  }
a7a5432000-04-15Per Hedbor  array do_return(RequestID id) { array from; if(args->quote) { m_delete(args, "quote"); from=({ "<", ">", "&" }); } else from=({ "{", "}", "&" }); result=replace(content, from, ({ "&lt;", "&gt;", "&amp;"}) ); if(args->pre) { m_delete(args, "pre");
0023a62000-08-22Martin Nilsson  result="\n"+RXML.t_xml->format_tag("pre", args, result)+"\n";
a7a5432000-04-15Per Hedbor  } return 0;
592ed72000-02-06Martin Nilsson  }
a7a5432000-04-15Per Hedbor  }
592ed72000-02-06Martin Nilsson }
f1c9f02000-01-26Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_autoformat(string tag, mapping m, string s, RequestID id)
592ed72000-02-06Martin Nilsson { s-="\r";
f1c9f02000-01-26Kenneth Johansson 
592ed72000-02-06Martin Nilsson  string p=(m["class"]?"<p class=\""+m["class"]+"\">":"<p>");
e272382000-01-23Kenneth Johansson 
8614702000-10-11Johan Sundström  if(!m->nonbsp) { s = replace(s, "\n ", "\n&nbsp;"); // "|\n |" => "|\n&nbsp;|" s = replace(s, " ", "&nbsp; "); // "| |" => "|&nbsp; |" s = replace(s, " ", " &nbsp;"); // "|&nbsp; |" => "|&nbsp; &nbsp;|" }
592ed72000-02-06Martin Nilsson  if(!m->nobr) {
5b0e5d2000-03-25Martin Nilsson  s = replace(s, "\n", "<br />\n");
592ed72000-02-06Martin Nilsson  if(m->p) {
5b0e5d2000-03-25Martin Nilsson  if(search(s, "<br />\n<br />\n")!=-1) s=p+s; s = replace(s, "<br />\n<br />\n", "\n</p>"+p+"\n");
592ed72000-02-06Martin Nilsson  if(sizeof(s)>3 && s[0..2]!="<p>" && s[0..2]!="<p ") s=p+s; if(s[..sizeof(s)-4]==p) return s[..sizeof(s)-4]; else return s+"</p>"; } return s; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(m->p) { if(search(s, "\n\n")!=-1) s=p+s; s = replace(s, "\n\n", "\n</p>"+p+"\n"); if(sizeof(s)>3 && s[0..2]!="<p>" && s[0..2]!="<p ") s=p+s; if(s[..sizeof(s)-4]==p) return s[..sizeof(s)-4]; else return s+"</p>"; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  return s; }
e272382000-01-23Kenneth Johansson 
cc3a942000-09-24Martin Nilsson class Smallcapsstr (string bigtag, string smalltag, mapping bigarg, mapping smallarg) {
592ed72000-02-06Martin Nilsson  constant UNDEF=0, BIG=1, SMALL=2;
cc3a942000-09-24Martin Nilsson  static string text="",part="";
592ed72000-02-06Martin Nilsson  static int last=UNDEF;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  string _sprintf() {
cc3a942000-09-24Martin Nilsson  return "Smallcapsstr("+bigtag+","+smalltag+")";
592ed72000-02-06Martin Nilsson  }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  void add(string char) { part+=char; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  void add_big(string char) { if(last!=BIG) flush_part(); part+=char; last=BIG; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  void add_small(string char) { if(last!=SMALL) flush_part(); part+=char; last=SMALL; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  void write(string txt) { if(last!=UNDEF) flush_part(); part+=txt; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  void flush_part() { switch(last){ case UNDEF: default: text+=part; break; case BIG:
0023a62000-08-22Martin Nilsson  text+=RXML.t_xml->format_tag(bigtag, bigarg, part);
592ed72000-02-06Martin Nilsson  break; case SMALL:
0023a62000-08-22Martin Nilsson  text+=RXML.t_xml->format_tag(smalltag, smallarg, part);
592ed72000-02-06Martin Nilsson  break; } part=""; last=UNDEF; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  string value() { if(last!=UNDEF) flush_part(); return text; } }
e272382000-01-23Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_smallcaps(string t, mapping m, string s)
592ed72000-02-06Martin Nilsson { Smallcapsstr ret; string spc=m->space?"&nbsp;":""; m_delete(m, "space"); mapping bm=([]), sm=([]); if(m["class"] || m->bigclass) { bm=(["class":(m->bigclass||m["class"])]); m_delete(m, "bigclass"); } if(m["class"] || m->smallclass) { sm=(["class":(m->smallclass||m["class"])]); m_delete(m, "smallclass"); }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  if(m->size) { bm+=(["size":m->size]); if(m->size[0]=='+' && (int)m->size>1) sm+=(["size":m->small||"+"+((int)m->size-1)]); else sm+=(["size":m->small||(string)((int)m->size-1)]); m_delete(m, "small"); ret=Smallcapsstr("font","font", m+bm, m+sm); } else ret=Smallcapsstr("big","small", m+bm, m+sm);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  for(int i=0; i<strlen(s); i++) if(s[i]=='<') { int j; for(j=i; j<strlen(s) && s[j]!='>'; j++); ret->write(s[i..j]); i+=j-1; } else if(s[i]<=32) ret->add_small(s[i..i]); else if(lower_case(s[i..i])==s[i..i]) ret->add_small(upper_case(s[i..i])+spc); else if(upper_case(s[i..i])==s[i..i]) ret->add_big(s[i..i]+spc); else ret->add(s[i..i]+spc);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  return ret->value(); }
e272382000-01-23Kenneth Johansson 
fe9f932000-09-12Johan Sundström string simpletag_random(string tag, mapping m, string s, RequestID id)
592ed72000-02-06Martin Nilsson {
fe9f932000-09-12Johan Sundström  NOCACHE();
b50d882001-02-11Martin Nilsson  array q = s/(m->separator || m->sep || "\n"); int index; if(m->seed) index = array_sscanf(Crypto.md5()->update(m->seed)->digest(), "%4c")[0]%sizeof(q); else index = random(sizeof(q)); return q[index];
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
916f4e2000-03-13Martin Nilsson class TagGauge { inherit RXML.Tag; constant name = "gauge"; class Frame { inherit RXML.Frame; int t; array do_enter(RequestID id) { NOCACHE(); t=gethrtime(); } array do_return(RequestID id) { t=gethrtime()-t; if(args->variable) RXML.user_set_var(args->variable, t/1000000.0, args->scope); if(args->silent) return ({ "" }); if(args->timeonly) return ({ sprintf("%3.6f", t/1000000.0) }); if(args->resultonly) return ({content}); return ({ "<br /><font size=\"-1\"><b>Time: "+ sprintf("%3.6f", t/1000000.0)+ " seconds</b></font><br />"+content }); } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson // Removes empty lines
82f7132000-03-10Martin Nilsson string simpletag_trimlines( string tag_name, mapping args,
592ed72000-02-06Martin Nilsson  string contents, RequestID id ) {
82f7132000-03-10Martin Nilsson  contents = replace(contents, ({"\r\n","\r" }), ({"\n","\n"})); return (contents / "\n" - ({ "" })) * "\n";
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson void container_throw( string t, mapping m, string c, RequestID id) {
64bfd32000-03-25Martin Nilsson  if(c[-1]!='\n') c+="\n";
9ceb8b2000-09-25Per Hedbor  throw( class(string tag_throw) {}( c ) );
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson // Internal methods for the default tag private int|array internal_tag_input(string t, mapping m, string name, multiset(string) value) { if (name && m->name!=name) return 0; if (m->type!="checkbox" && m->type!="radio") return 0; if (value[m->value||"on"]) { if (m->checked) return 0; m->checked = "checked"; } else { if (!m->checked) return 0; m_delete(m, "checked" ); }
e272382000-01-23Kenneth Johansson 
cc3a942000-09-24Martin Nilsson  int xml=!m_delete(m, "noxml");
0023a62000-08-22Martin Nilsson  return ({ Roxen.make_tag(t, m, xml) });
592ed72000-02-06Martin Nilsson } array split_on_option( string what, Regexp r ) { array a = r->split( what ); if( !a ) return ({ what }); return split_on_option( a[0], r ) + a[1..]; } private int|array internal_tag_select(string t, mapping m, string c, string name, multiset(string) value) {
0023a62000-08-22Martin Nilsson  if(name && m->name!=name) return ({ RXML.t_xml->format_tag(t, m, c) });
c4de052000-05-05Martin Nilsson  // Split indata into an array with the layout // ({ "option", option_args, stuff_before_next_option })*n // e.g. "fox<OPtioN foo='bar'>gazink</option>" will yield // tmp=({ "OPtioN", " foo='bar'", "gazink</option>" }) and // ret="fox"
592ed72000-02-06Martin Nilsson  Regexp r = Regexp( "(.*)<([Oo][Pp][Tt][Ii][Oo][Nn])([^>]*)>(.*)" ); array(string) tmp=split_on_option(c,r); string ret=tmp[0],nvalue; int selected,stop; tmp=tmp[1..];
c4de052000-05-05Martin Nilsson 
592ed72000-02-06Martin Nilsson  while(sizeof(tmp)>2) { stop=search(tmp[2],"<");
aa11102000-11-08Martin Nilsson  if(sscanf(tmp[1],"%*svalue=%s",nvalue)!=2 && sscanf(tmp[1],"%*sVALUE=%s",nvalue)!=2) nvalue=tmp[2][..stop==-1?sizeof(tmp[2]):stop]; else if(!sscanf(nvalue, "\"%s\"", nvalue) && !sscanf(nvalue, "'%s'", nvalue)) sscanf(nvalue, "%s%*[ >]", nvalue);
592ed72000-02-06Martin Nilsson  selected=Regexp(".*[Ss][Ee][Ll][Ee][Cc][Tt][Ee][Dd].*")->match(tmp[1]); ret+="<"+tmp[0]+tmp[1]; if(value[nvalue] && !selected) ret+=" selected=\"selected\""; ret+=">"+tmp[2]; if(!Regexp(".*</[Oo][Pp][Tt][Ii][Oo][Nn]")->match(tmp[2])) ret+="</"+tmp[0]+">"; tmp=tmp[3..]; }
0023a62000-08-22Martin Nilsson  return ({ RXML.t_xml->format_tag(t, m, ret) });
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_default( string t, mapping m, string c, RequestID id)
592ed72000-02-06Martin Nilsson { multiset value=(<>); if(m->value) value=mkmultiset((m->value||"")/(m->separator||","));
cde9a02000-03-10Martin Nilsson  if(m->variable) value+=(<RXML.user_get_var(m->variable, m->scope)>);
82f7132000-03-10Martin Nilsson  if(value==(<>)) return c;
e272382000-01-23Kenneth Johansson 
82f7132000-03-10Martin Nilsson  return parse_html(c, (["input":internal_tag_input]), (["select":internal_tag_select]), m->name, value);
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_sort(string t, mapping m, string c, RequestID id)
592ed72000-02-06Martin Nilsson { if(!m->separator) m->separator = "\n";
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  string pre="", post=""; array lines = c/m->separator;
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  while(lines[0] == "") { pre += m->separator; lines = lines[1..]; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  while(lines[-1] == "") { post += m->separator; lines = lines[..sizeof(lines)-2]; }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  lines=sort(lines);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  return pre + (m->reverse?reverse(lines):lines)*m->separator + post; }
e272382000-01-23Kenneth Johansson 
82f7132000-03-10Martin Nilsson string simpletag_replace( string tag, mapping m, string cont, RequestID id)
592ed72000-02-06Martin Nilsson { switch(m->type) { case "word": default: if(!m->from) return cont; return replace(cont,m->from,(m->to?m->to:""));
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  case "words": if(!m->from) return cont; string s=m->separator?m->separator:","; array from=(array)(m->from/s); array to=(array)(m->to/s);
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  int balance=sizeof(from)-sizeof(to); if(balance>0) to+=allocate(balance,"");
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson  return replace(cont,from,to); } }
e272382000-01-23Kenneth Johansson 
30d6a52000-02-16Martin Nilsson class TagCSet { inherit RXML.Tag; constant name = "cset"; class Frame { inherit RXML.Frame; array do_return(RequestID id) {
5b0e5d2000-03-25Martin Nilsson  if( !args->variable ) parse_error("Variable not specified.\n");
ea31c52000-02-16Martin Nilsson  if(!content) content="";
30d6a52000-02-16Martin Nilsson  if( args->quote != "none" )
6743432000-03-19Martin Nilsson  content = Roxen.html_decode_string( content );
30d6a52000-02-16Martin Nilsson 
6444372000-03-10Martin Nilsson  RXML.user_set_var(args->variable, content, args->scope);
30d6a52000-02-16Martin Nilsson  return ({ "" }); } }
592ed72000-02-06Martin Nilsson }
e272382000-01-23Kenneth Johansson 
43ff412001-02-06Martin Nilsson class TagColorScope { inherit RXML.Tag; constant name = "colorscope"; class Frame { inherit RXML.Frame; string link, alink, vlink; #define LOCAL_PUSH(X) if(args->X) { X=id->misc->defines->X; id->misc->defines->X=args->X; } array do_enter(RequestID id) { Roxen.push_color("colorscope",args,id); LOCAL_PUSH(link); LOCAL_PUSH(alink); LOCAL_PUSH(vlink); return 0; } #define LOCAL_POP(X) if(X) id->misc->defines->X=X array do_return(RequestID id) { Roxen.pop_color("colorscope",id); LOCAL_POP(link); LOCAL_POP(alink); LOCAL_POP(vlink); result=content; return 0; } } }
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson // ----------------- If registration stuff --------------
e272382000-01-23Kenneth Johansson 
6d7a702000-02-07Martin Nilsson class TagIfExpr {
592ed72000-02-06Martin Nilsson  inherit RXML.Tag;
6d7a702000-02-07Martin Nilsson  constant name = "if";
592ed72000-02-06Martin Nilsson  constant plugin_name = "expr";
cde9a02000-03-10Martin Nilsson  int eval(string u) {
592ed72000-02-06Martin Nilsson  return (int)sexpr_eval(u); } }
e272382000-01-23Kenneth Johansson 
df3c452000-07-26Johan Sundström // ---------------- Emit registration stuff -------------- class TagEmitFonts { inherit RXML.Tag; constant name = "emit", plugin_name = "fonts";
4f204c2000-09-02Martin Nilsson  array get_dataset(mapping args, RequestID id)
df3c452000-07-26Johan Sundström  {
4f204c2000-09-02Martin Nilsson  return roxen->fonts->get_font_information(args->ttf_only);
df3c452000-07-26Johan Sundström  } }
592ed72000-02-06Martin Nilsson // ---------------- API registration stuff ---------------
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson string api_query_modified(RequestID id, string f, int|void by) { mapping m = ([ "by":by, "file":f ]); return tag_modified("modified", m, id, id); }
e272382000-01-23Kenneth Johansson 
cde9a02000-03-10Martin Nilsson 
592ed72000-02-06Martin Nilsson // --------------------- Documentation -----------------------
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson TAGDOCUMENTATION; #ifdef manual
e59a5a2000-03-01Kenneth Johansson constant tagdoc=([
9b03652001-03-07Kenneth Johansson "&client.ip;":#"<desc ent='ent'><p> The client is located on this IP-address. </p></desc>", "&client.host;":#"<desc ent='ent'><p> The host name of the client, if possible to resolve. </p></desc>", "&client.name;":#"<desc ent='ent'><p> The name of the client, i.e. \"Mozilla/4.7\". </p></desc>", "&client.Fullname;":#"<desc ent='ent'><p> The full user agent string, i.e. name of the client and additional info like; operating system, type of computer, etc. E.g. \"Mozilla/4.7 [en] (X11; I; SunOS 5.7 i86pc)\". </p></desc>", "&client.fullname;":#"<desc ent='ent'><p> The full user agent string, i.e. name of the client and additional info like; operating system, type of computer, etc. E.g. \"mozilla/4.7 [en] (x11; i; sunos 5.7 i86pc)\". </p></desc>", "&client.referrer;":#"<desc ent='ent'><p> Prints the URL of the page on which the user followed a link that brought her to this page. The information comes from the referrer header sent by the browser. </p></desc>", "&client.accept-language;":#"<desc ent='ent'><p> The client prefers to have the page contents presented in this language. </p></desc>", "&client.accept-languages;":#"<desc ent='ent'><p> The client prefers to have the page contents presented in this language but these additional languages are accepted as well. </p></desc>", "&client.language;":#"<desc ent='ent'><p> The clients most preferred language. </p></desc>", "&client.languages;":#"<desc ent='ent'><p> An ordered list of the clients most preferred languages. </p></desc>", "&client.authenticated;":#"<desc ent='ent'><p> Returns the name of the user logged on to the site, i.e. the login name, if any exists. </p></desc>", "&client.user;":#"<desc ent='ent'><p> Returns the name the user used when he/she tried to log on the site, i.e. the login name, if any exists. </p></desc>", "&client.password;":#"<desc ent='ent'><p> </p></desc>", "&client.height;":#"<desc ent='ent'><p> The presentation area height in pixels. For WAP-phones. </p></desc>", "&client.width;":#"<desc ent='ent'><p> The presentation area width in pixels. For WAP-phones. </p></desc>", "&client.robot;":#"<desc ent='ent'><p> Returns the name of the webrobot. Useful if the robot requesting pages is to be served other contents than most visitors. Use <ent>client.robot</ent> together with <xref href='../if/if.tag' />.</p> <p>Possible webrobots are: ms-url-control, architex, backrub, checkbot, fast, freecrawl, passagen, gcreep, getright, googlebot, harvest, alexa, infoseek, intraseek, lycos, webinfo, roxen, altavista, scout, slurp, url-minder, webcrawler, wget, xenu and yahoo.</p> </desc>", "&client.javascript;":#"<desc ent='ent'><p> Returns the highest version of javascript supported. </p></desc>", "&client.tm;":#"<desc ent='ent'><p><short> Generates a trademark sign in a way that the client can render.</short> Possible outcomes are \"&amp;trade;\", \"&lt;sup&gt;TM&lt;/sup&gt;\", and \"&amp;gt;TM&amp;lt;\".</p> </desc>", //---------------------------------------------------------------------- "&page.realfile;":#"<desc ent='ent'><p> Path to this file in the file system. </p></desc>", "&page.virtroot;":#"<desc ent='ent'><p> The root of the present virtual filesystem. </p></desc>",
ac7bb42000-09-18Jonas Wallden // &page.virtfile; is same as &page.path; but deprecated since we want to // harmonize with SiteBuilder entities.
9b03652001-03-07Kenneth Johansson "&page.path;":#"<desc ent='ent'><p> Absolute path to this file in the virtual filesystem. </p></desc>", "&page.pathinfo;":#"<desc ent='ent'><p> The \"path info\" part of the URL, if any. Can only get set if the \"Path info support\" module is installed. For details see the documentation for that module. </p></desc>", "&page.query;":#"<desc ent='ent'><p> The query part of the page URI. </p></desc>", "&page.url;":#"<desc ent='ent'><p> The absolute path for this file from the web server's root or point of view including query variables. </p></desc>", "&page.last-true;":#"<desc ent='ent'><p> Is \"1\" if the last <tag>if</tag>-statement succeeded, otherwise 0. (<xref href='../if/true.tag' /> and <xref href='../if/false.tag' /> is considered as <tag>if</tag>-statements here) See also: <xref href='../if/' />.</p>
592ed72000-02-06Martin Nilsson </desc>",
e272382000-01-23Kenneth Johansson 
9b03652001-03-07Kenneth Johansson "&page.language;":#"<desc ent='ent'><p> What language the contents of this file is written in. The language must be given as metadata to be found. </p></desc>", "&page.scope;":#"<desc ent='ent'><p> The name of the current scope, i.e. the scope accessible through the name \"_\". </p></desc>", "&page.filesize;":#"<desc ent='ent'><p> This file's size, in bytes. </p></desc>", "&page.ssl-strength;":#"<desc ent='ent'><p> The strength in bits of the current SSL connection. </p></desc>", "&page.self;":#"<desc ent='ent'><p> The name of this file. </p></desc>", //---------------------------------------------------------------------- "roxen_automatic_charset_variable":#"<desc tag='tag'><p> If put inside a form, the right character encoding of the submitted form can be guessed by Roxen WebServer. </p></desc>", //---------------------------------------------------------------------- "colorscope":#"<desc cont='cont'><p><short> Makes it possible to change the autodetected colors within the tag. Useful when out-of-order parsing occurs, e.g.</p>
43ff412001-02-06Martin Nilsson <ex type=box> <define tag=\"hello\"> <colorscope bgcolor=\"red\"> <gtext>Hello</gtext> </colorscope> </define> <table><tr> <td bgcolor=\"red\"> <hello/> </td> </tr></table> </ex> </desc>
9b03652001-03-07Kenneth Johansson <attr name='text' value='color'><p> Set the text color within the scope.</p>
43ff412001-02-06Martin Nilsson </attr>
9b03652001-03-07Kenneth Johansson <attr name='bgcolor' value='color'<p> Set the background color within the scope.</p>
43ff412001-02-06Martin Nilsson </attr>
9b03652001-03-07Kenneth Johansson <attr name='link' value='color'<p> Set the link color within the scope.</p>
43ff412001-02-06Martin Nilsson </attr>
9b03652001-03-07Kenneth Johansson <attr name='alink' value='color'<p> Set the active link color within the scope.</p>
43ff412001-02-06Martin Nilsson </attr>
9b03652001-03-07Kenneth Johansson <attr name='vlink' value='color'<p> Set the visited link color within the scope.</p>
43ff412001-02-06Martin Nilsson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "aconf":#"<desc cont='cont'><p><short>
592ed72000-02-06Martin Nilsson  Creates a link that can modify the persistent states in the cookie
9b03652001-03-07Kenneth Johansson  RoxenConfig.</short> In practice it will add &lt;keyword&gt;/ right after the server, i.e. if you want to remove bacon and add egg the first \"directory\" in the path will be &lt;-bacon,egg&gt;. If the user follows this link the WebServer will understand how the RoxenConfig cookie should be modified and will send a new cookie along with a redirect to the given url, but with the first \"directory\" removed. The presence of a certain keyword in can be controlled with <xref href='../if/if_config.tag' />.</p>
f1c9f02000-01-26Kenneth Johansson </desc>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=href value=uri>
9b03652001-03-07Kenneth Johansson  <p>Indicates which page should be linked to, if any other than the present one.</p>
592ed72000-02-06Martin Nilsson </attr>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=add value=string>
9b03652001-03-07Kenneth Johansson  <p>The \"cookie\" or \"cookies\" that should be added, in a comma separated list.</p>
592ed72000-02-06Martin Nilsson </attr>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=drop value=string>
9b03652001-03-07Kenneth Johansson  <p>The \"cookie\" or \"cookies\" that should be dropped, in a comma separated list.</p>
e272382000-01-23Kenneth Johansson </attr> <attr name=class value=string>
9b03652001-03-07Kenneth Johansson  <p>This cascading style sheet (CSS) class definition will apply to the a-element.</p> <p>All other attributes will be inherited by the generated a tag.</p> </attr>", //----------------------------------------------------------------------
e272382000-01-23Kenneth Johansson 
9b03652001-03-07Kenneth Johansson "append":#"<desc tag='tag'><p><short>
592ed72000-02-06Martin Nilsson  Appends a value to a variable. The variable attribute and one more is
dbab472000-02-21Kenneth Johansson  required.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
592ed72000-02-06Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=variable value=string required='required'> <p>The name of the variable.</p>
e272382000-01-23Kenneth Johansson </attr>
592ed72000-02-06Martin Nilsson <attr name=value value=string>
9b03652001-03-07Kenneth Johansson  <p>The value the variable should have appended.</p>
078b5e2000-07-14Kenneth Johansson  <ex>
c00fd22000-08-12Martin Nilsson  <set variable='var.ris' value='Roxen'/> <append variable='var.ris' value=' Internet Software'/>
9a45402000-08-07Kenneth Johansson  <ent>var.ris</ent>
078b5e2000-07-14Kenneth Johansson  </ex>
e272382000-01-23Kenneth Johansson </attr>
809feb2000-07-28Kenneth Johansson <attr name=from value=string>
9b03652001-03-07Kenneth Johansson  <p>The name of another variable that the value should be copied from.</p>
e272382000-01-23Kenneth Johansson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "apre":#"<desc cont='cont'><p><short> Creates a link that can modify prestates.</short> Prestates can be seen as valueless cookies or toggles that are easily modified by the user. The prestates are added to the URL. If you set the prestate \"no-images\" on \"http://www.demolabs.com/index.html\" the URL would be \"http://www.demolabs.com/(no-images)/\". Use <xref href='../if/if_prestate.tag' /> to test for the presence of a prestate. <tag>apre</tag> works just like the <tag>a href='...'</tag>
a572572000-07-21Kenneth Johansson  container, but if no \"href\" attribute is specified, the current
9b03652001-03-07Kenneth Johansson  page is used. </p>
e272382000-01-23Kenneth Johansson </desc>
592ed72000-02-06Martin Nilsson <attr name=href value=uri>
9b03652001-03-07Kenneth Johansson  <p>Indicates which page should be linked to, if any other than the present one.</p>
e272382000-01-23Kenneth Johansson </attr>
592ed72000-02-06Martin Nilsson <attr name=add value=string>
9b03652001-03-07Kenneth Johansson  <p>The prestate or prestates that should be added, in a comma separated list.</p>
592ed72000-02-06Martin Nilsson </attr>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=drop value=string>
9b03652001-03-07Kenneth Johansson  <p>The prestate or prestates that should be dropped, in a comma separated list.</p>
592ed72000-02-06Martin Nilsson </attr>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=class value=string>
9b03652001-03-07Kenneth Johansson  <p>This cascading style sheet (CSS) class definition will apply to the a-element.</p>
0da0892000-03-30Martin Nilsson </attr>",
592ed72000-02-06Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "auth-required":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Adds an HTTP auth required header and return code (401), that will force the user to supply a login name and password.</short> This tag is needed when using access control in RXML in order for the user to be prompted to login.
9b03652001-03-07Kenneth Johansson </p></desc>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=realm value=string>
9b03652001-03-07Kenneth Johansson  <p>The realm you are logging on to, i.e \"Demolabs Intranet\".</p>
592ed72000-02-06Martin Nilsson </attr>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=message value=string>
9b03652001-03-07Kenneth Johansson  <p>Returns a message if a login failed or cancelled.</p>
592ed72000-02-06Martin Nilsson </attr>",
e272382000-01-23Kenneth Johansson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "autoformat":#"<desc cont='cont'><p><short hide='hide'> Replaces newlines with <tag>br/</tag>:s'.</short>Replaces newlines with <tag>br /</tag>:s'.</p>
425ce52000-05-09Kenneth Johansson  <ex><autoformat> It is almost like using the pre tag. </autoformat></ex>
e272382000-01-23Kenneth Johansson </desc>
592ed72000-02-06Martin Nilsson <attr name=p>
9b03652001-03-07Kenneth Johansson  <p>Replace empty lines with <tag>p</tag>:s.</p>
425ce52000-05-09Kenneth Johansson <ex><autoformat p=''> It is almost like using the pre tag. </autoformat></ex>
e272382000-01-23Kenneth Johansson </attr>
c00fd22000-08-12Martin Nilsson <attr name=nobr>
9b03652001-03-07Kenneth Johansson  <p>Do not replace newlines with <tag>br /</tag>:s.</p>
c00fd22000-08-12Martin Nilsson </attr>
9b03652001-03-07Kenneth Johansson <attr name=nonbsp><p> Do not turn consecutive spaces into interleaved breakable/nonbreakable spaces. When this attribute is not given, the tag will behave more or less like HTML:s <tag>pre</tag> tag, making whitespace indention work, without the usually unwanted effect of really long lines extending the browser window width.</p>
8614702000-10-11Johan Sundström </attr>
592ed72000-02-06Martin Nilsson <attr name=class value=string>
9b03652001-03-07Kenneth Johansson  <p>This cascading style sheet (CSS) definition will be applied on the p elements.</p>
592ed72000-02-06Martin Nilsson </attr>",
e272382000-01-23Kenneth Johansson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "cache":#"<desc cont='cont'><p><short>
592ed72000-02-06Martin Nilsson  This simple tag RXML parse its contents and cache them using the
dbab472000-02-21Kenneth Johansson  normal Roxen memory cache.</short> They key used to store the cached contents is the MD5 hash sum of the contents, the accessed file name, the query string, the server URL and the authentication information,
8c96aa2000-02-24Martin Nilsson  if available. This should create an unique key. The time during which the entry should be considered valid can set with one or several time attributes. If not provided the entry will be removed from the cache when it has been untouched for too long.
9b03652001-03-07Kenneth Johansson </p></desc>
e272382000-01-23Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=key value=string>
9b03652001-03-07Kenneth Johansson  <p>Append this value to the hash used to identify the contents for less risk of incorrect caching. This shouldn't really be needed.</p>
aac7152000-02-10Martin Nilsson </attr>
8c96aa2000-02-24Martin Nilsson <attr name=nohash>
9b03652001-03-07Kenneth Johansson  <p>The cached entry will use only the provided key as cache key.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=years value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of years to the time this entry is valid.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=months value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of months to the time this entry is valid.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=weeks value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of weeks to the time this entry is valid.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=days value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of days to the time this entry is valid.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=hours value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of hours to the time this entry is valid.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=beats value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of beats to the time this entry is valid.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=minutes value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of minutes to the time this entry is valid.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=seconds value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of seconds to the time this entry is valid.</p>
e272382000-01-23Kenneth Johansson </attr>",
8859351999-11-25Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "catch":#"<desc cont='cont'><p><short>
592ed72000-02-06Martin Nilsson  Evaluates the RXML code, and, if nothing goes wrong, returns the
dbab472000-02-21Kenneth Johansson  parsed contents.</short> If something does go wrong, the error
9b03652001-03-07Kenneth Johansson  message is returned instead. See also <xref href='throw.tag' />. </p>
592ed72000-02-06Martin Nilsson </desc>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "charset":#"<desc cont='cont'><p><short> </short> </p> </desc>", //---------------------------------------------------------------------- "configimage":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Returns one of the internal Roxen configuration images.</short> The src attribute is required.
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=src value=string>
9b03652001-03-07Kenneth Johansson  <p>The name of the picture to show.</p>
592ed72000-02-06Martin Nilsson </attr>
b53b751999-10-09Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=border value=number default=0>
9b03652001-03-07Kenneth Johansson  <p>The image border when used as a link.</p>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=alt value=string default='The src string'>
9b03652001-03-07Kenneth Johansson  <p>The picture description.</p>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=class value=string>
9b03652001-03-07Kenneth Johansson  <p>This cascading style sheet (CSS) class definition will be applied to the image.</p>
0be6412000-01-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson  <p>All other attributes will be inherited by the generated img tag.</p> </attr>", //---------------------------------------------------------------------- "configurl":#"<desc tag='tag'><p><short>
a6ef1f2000-03-28Johan Sundström  Returns a URL to the administration interface.</short>
9b03652001-03-07Kenneth Johansson </p></desc>", //---------------------------------------------------------------------- "charset":#"<desc cont='cont'><p><short> </short> </p>
592ed72000-02-06Martin Nilsson </desc>",
ecab8b2000-01-23Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "configimage":#"<desc tag='tag'><p><short> Returns one of the internal Roxen configuration images.</short> The src attribute is required. </p></desc> <attr name=src value=string> <p>The name of the picture to show.</p> </attr> <attr name=border value=number default=0> <p>The image border when used as a link.</p> </attr> <attr name=alt value=string default='The src string'> <p>The picture description.</p> </attr> <attr name=class value=string> <p>This cascading style sheet (CSS) class definition will be applied to the image.</p> <p>All other attributes will be inherited by the generated img tag.</p> </attr>", //---------------------------------------------------------------------- "configurl":#"<desc tag='tag'><p><short> Returns a URL to the administration interface.</short> </p></desc>", //---------------------------------------------------------------------- "cset":#"<desc cont='cont'><p> Sets a variable with its content.</p> </desc>
5b0e5d2000-03-25Martin Nilsson  <attr name=variable value=name>
9b03652001-03-07Kenneth Johansson  <p>The variable to be set.</p>
5b0e5d2000-03-25Martin Nilsson </attr> <attr name=quote value=html|none>
9b03652001-03-07Kenneth Johansson  <p>How the content should be quoted before assigned to the variable. Default is html.</p> </attr>", //----------------------------------------------------------------------
5b0e5d2000-03-25Martin Nilsson 
9b03652001-03-07Kenneth Johansson "crypt":#"<desc cont='cont'><p><short>
dbab472000-02-21Kenneth Johansson  Encrypts the contents as a Unix style password.</short> Useful when
9b03652001-03-07Kenneth Johansson  combined with services that use such passwords.</p> <p>Unix style passwords are one-way encrypted, to prevent the actual clear-text password from being stored anywhere. When a login attempt is made, the password supplied is also encrypted and then compared to the stored encrypted password.</p>
bd44042000-07-17Kenneth Johansson </desc>
5b0e5d2000-03-25Martin Nilsson  <attr name=compare value=string>
9b03652001-03-07Kenneth Johansson  <p>Compares the encrypted string with the contents of the tag. The tag will behave very much like an <xref href='../if/if.tag' /> tag.</p>
5b0e5d2000-03-25Martin Nilsson <ex><crypt compare=\"LAF2kkMr6BjXw\">Roxen</crypt> <then>Yepp!</then> <else>Nope!</else> </ex>
bd44042000-07-17Kenneth Johansson </attr>",
0be6412000-01-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "date":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Inserts the time and date.</short> Does not require attributes.
9b03652001-03-07Kenneth Johansson </p></desc>
0be6412000-01-18Martin Nilsson 
75f0552000-07-26Kenneth Johansson <attr name=unix-time value=number of seconds>
9b03652001-03-07Kenneth Johansson  <p>Display this time instead of the current. This attribute uses the
4f24272001-03-11Martin Nilsson  specified Unix 'time_t' time as the starting time (which is <i>01:00, January the 1st, 1970</i>), instead of the current time.
9b03652001-03-07Kenneth Johansson  This is mostly useful when the <tag>date</tag> tag is used from a Pike-script or Roxen module.</p>
75f0552000-07-26Kenneth Johansson 
de6dec2000-05-02Kenneth Johansson <ex ><date unix-time='120'/></ex>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
5b04132000-07-02Martin Nilsson <attr name=timezone value=local|GMT default=local>
9b03652001-03-07Kenneth Johansson  <p>Display the time from another timezone.</p>
5b04132000-07-02Martin Nilsson </attr>
592ed72000-02-06Martin Nilsson <attr name=years value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of years to the result.</p>
c00fd22000-08-12Martin Nilsson  <ex ><date date='' years='2'/></ex>
592ed72000-02-06Martin Nilsson </attr>
ecab8b2000-01-23Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=months value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of months to the result.</p>
c00fd22000-08-12Martin Nilsson  <ex ><date date='' months='2'/></ex>
592ed72000-02-06Martin Nilsson </attr>
72ac6d2000-01-25Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=weeks value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of weeks to the result.</p>
c00fd22000-08-12Martin Nilsson  <ex ><date date='' weeks='2'/></ex>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=days value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of days to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=hours value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of hours to the result.</p>
de6dec2000-05-02Kenneth Johansson  <ex ><date time='' hours='2' type='iso'/></ex>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=beats value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of beats to the result.</p>
c00fd22000-08-12Martin Nilsson  <ex ><date time='' beats='10' type='iso'/></ex>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=minutes value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of minutes to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=seconds value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of seconds to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
ecab8b2000-01-23Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=adjust value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of seconds to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
ecab8b2000-01-23Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=brief>
9b03652001-03-07Kenneth Johansson  <p>Show in brief format.</p>
de6dec2000-05-02Kenneth Johansson <ex ><date brief=''/></ex>
592ed72000-02-06Martin Nilsson </attr>
093fd32000-01-23Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=time>
9b03652001-03-07Kenneth Johansson  <p>Show only time.</p>
de6dec2000-05-02Kenneth Johansson <ex ><date time=''/></ex>
592ed72000-02-06Martin Nilsson </attr>
093fd32000-01-23Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=date>
9b03652001-03-07Kenneth Johansson  <p>Show only date.</p>
de6dec2000-05-02Kenneth Johansson <ex ><date date=''/></ex>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
91d6cd2000-03-21Martin Nilsson <attr name=type value=string|ordered|iso|discordian|stardate|number>
9b03652001-03-07Kenneth Johansson  <p>Defines in which format the date should be displayed in. Discordian
de6dec2000-05-02Kenneth Johansson  and stardate only make a difference when not using part. Note that type=stardate has a separate companion attribute, prec, which sets
9b03652001-03-07Kenneth Johansson  the precision.</p>
f8dd6d2000-09-18Kenneth Johansson <xtable> <row><c><i>type=discordian</i></c><c><ex ><date date='' type='discordian'/> </ex></c></row> <row><c><i>type=iso</i></c><c><ex ><date date='' type='iso'/></ex></c></row> <row><c><i>type=number</i></c><c><ex ><date date='' type='number'/></ex></c></row> <row><c><i>type=ordered</i></c><c><ex ><date date='' type='ordered'/></ex></c></row> <row><c><i>type=stardate</i></c><c><ex ><date date='' type='stardate'/></ex></c></row> <row><c><i>type=string</i></c><c><ex ><date date='' type='string'/></ex></c></row> </xtable>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
91d6cd2000-03-21Martin Nilsson <attr name=part value=year|month|day|wday|date|mday|hour|minute|second|yday|beat|week|seconds>
9b03652001-03-07Kenneth Johansson  <p>Defines which part of the date should be displayed. Day and wday is
592ed72000-02-06Martin Nilsson  the same. Date and mday is the same. Yday is the day number of the year. Seconds is unix time type. Only the types string, number and
9b03652001-03-07Kenneth Johansson  ordered applies when the part attribute is used.</p>
f8dd6d2000-09-18Kenneth Johansson <xtable> <row><c><i>part=year</i></c><c>Display the year.<ex ><date part='year' type='number'/></ex></c></row> <row><c><i>part=month</i></c><c>Display the month. <ex ><date part='month' type='ordered'/></ex></c></row> <row><c><i>part=day</i></c><c>Display the weekday, starting with Sunday. <ex ><date part='day' type='ordered'/></ex></c></row> <row><c><i>part=wday</i></c><c>Display the weekday. Same as 'day'. <ex ><date part='wday' type='string'/></ex></c></row> <row><c><i>part=date</i></c><c>Display the day of this month. <ex ><date part='date' type='ordered'/></ex></c></row> <row><c><i>part=mday</i></c><c>Display the number of days since the last full month. <ex ><date part='mday' type='number'/></ex></c></row> <row><c><i>part=hour</i></c><c>Display the numbers of hours since midnight. <ex ><date part='hour' type='ordered'/></ex></c></row> <row><c><i>part=minute</i></c><c>Display the numbers of minutes since the last full hour. <ex ><date part='minute' type='number'/></ex></c></row> <row><c><i>part=second</i></c><c>Display the numbers of seconds since the last full minute. <ex ><date part='second' type='string'/></ex></c></row> <row><c><i>part=yday</i></c><c>Display the number of days since the first of January. <ex ><date part='yday' type='ordered'/></ex></c></row> <row><c><i>part=beat</i></c><c>Display the number of beats since midnight Central European Time(CET). There is a total of 1000 beats per day. The beats system was designed by <a href='http://www.swatch.com'>Swatch</a> as a means for a universal time, without time zones and day/night changes. <ex ><date part='beat' type='number'/></ex></c></row> <row><c><i>part=week</i></c><c>Display the number of the current week.<ex ><date part='week' type='number'/></ex></c></row> <row><c><i>part=seconds</i></c><c>Display the total number of seconds this year. <ex ><date part='seconds' type='number'/></ex></c></row> </xtable>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
ce9c862000-05-28Martin Nilsson <attr name=strftime value=string>
9b03652001-03-07Kenneth Johansson  <p>If this attribute is given to date, it will format the result according to the argument string.</p>
f8dd6d2000-09-18Kenneth Johansson  <xtable> <row><c>%%</c><c>Percent character</c></row> <row><c>%a</c><c>Abbreviated weekday name, e.g. \"Mon\"</c></row> <row><c>%A</c><c>Weekday name</c></row> <row><c>%b</c><c>Abbreviated month name, e.g. \"Jan\"</c></row> <row><c>%B</c><c>Month name</c></row> <row><c>%c</c><c>Date and time, e.g. \"%a %b %d %H:%M:%S %Y\"</c></row> <row><c>%C</c><c>Century number, zero padded to two charachters.</c></row> <row><c>%d</c><c>Day of month (1-31), zero padded to two characters.</c></row> <row><c>%D</c><c>Date as \"%m/%d/%y\"</c></row> <row><c>%e</c><c>Day of month (1-31), space padded to two characters.</c></row> <row><c>%H</c><c>Hour (24 hour clock, 0-23), zero padded to two characters.</c></row> <row><c>%h</c><c>See %b</c></row> <row><c>%I</c><c>Hour (12 hour clock, 1-12), zero padded to two charcters.</c></row> <row><c>%j</c><c>Day numer of year (1-366), zero padded to three characters.</c></row> <row><c>%k</c><c>Hour (24 hour clock, 0-23), space padded to two characters.</c></row> <row><c>%l</c><c>Hour (12 hour clock, 1-12), space padded to two characters.</c></row> <row><c>%m</c><c>Month number (1-12), zero padded to two characters.</c></row> <row><c>%M</c><c>Minute (0-59), zero padded to two characters.</c></row> <row><c>%n</c><c>Newline</c></row> <row><c>%p</c><c>\"a.m.\" or \"p.m.\"</c></row> <row><c>%r</c><c>Time in 12 hour clock format with %p</c></row> <row><c>%R</c><c>Time as \"%H:%M\"</c></row> <row><c>%S</c><c>Seconds (0-61), zero padded to two characters.</c></row> <row><c>%t</c><c>Tab</c></row> <row><c>%T</c><c>Time as \"%H:%M:%S\"</c></row> <row><c>%u</c><c>Weekday as a decimal number (1-7), 1 is Sunday.</c></row> <row><c>%U</c><c>Week number of year as a decimal number (0-53), with sunday as the first day of week 1, zero padded to two characters.</c></row> <row><c>%V</c><c>ISO week number of the year as a decimal number (1-53), zero padded to two characters.</c></row> <row><c>%w</c><c>Weekday as a decimal number (0-6), 0 is Sunday.</c></row> <row><c>%W</c><c>Week number of year as a decimal number (0-53), with sunday as the first day of week 1, zero padded to two characters.</c></row> <row><c>%x</c><c>Date as \"%a %b %d %Y\"</c></row> <row><c>%X</c><c>See %T</c></row> <row><c>%y</c><c>Year (0-99), zero padded to two characters.</c></row> <row><c>%Y</c><c>Year (0-9999), zero padded to four characters.</c></row> </xtable>
3b40e72000-06-02Martin Nilsson  <ex><date strftime=\"%Y%m%d\"/></ex>
ce9c862000-05-28Martin Nilsson </attr>
0da0892000-03-30Martin Nilsson <attr name=lang value=langcode>
9b03652001-03-07Kenneth Johansson  <p>Defines in what language a string will be presented in. Used together
de6dec2000-05-02Kenneth Johansson  with <att>type=string</att> and the <att>part</att> attribute to get
9b03652001-03-07Kenneth Johansson  written dates in the specified language.</p>
de6dec2000-05-02Kenneth Johansson 
3b40e72000-06-02Martin Nilsson <ex><date part='day' type='string' lang='de'></ex>
592ed72000-02-06Martin Nilsson </attr>
0be6412000-01-18Martin Nilsson 
de6dec2000-05-02Kenneth Johansson <attr name=case value=upper|lower|capitalize>
9b03652001-03-07Kenneth Johansson  <p>Changes the case of the output to upper, lower or capitalize.</p> <ex><date date='' lang='&client.language;' case='upper'/></ex>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=prec value=number>
9b03652001-03-07Kenneth Johansson  <p>The number of decimals in the stardate.</p>
592ed72000-02-06Martin Nilsson </attr>",
bcde6c1999-11-19Per Hedbor 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "debug":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Helps debugging RXML-pages as well as modules.</short> When debugging mode is
592ed72000-02-06Martin Nilsson  turned on, all error messages will be displayed in the HTML code.
9b03652001-03-07Kenneth Johansson </p></desc>
ecab8b2000-01-23Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=on>
9b03652001-03-07Kenneth Johansson  <p>Turns debug mode on.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=off>
9b03652001-03-07Kenneth Johansson  <p>Turns debug mode off.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=toggle>
9b03652001-03-07Kenneth Johansson  <p>Toggles debug mode.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=showid value=string>
9b03652001-03-07Kenneth Johansson  <p>Shows a part of the id object. E.g. showid=\"id->request_headers\".</p> </attr> <attr name=werror value=string> <p>When you have access to the server debug log and want your RXML page to write some kind of diagnostics message or similar, the werror attribute is helpful.</p> <p>This can be used on the error page, for instance, if you'd want such errors to end up in the debug log:</p> <ex type=box> <debug werror='File &page.url; not found! (linked from &client.referrer;)'/></ex>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "dec":#"<desc tag='tag'><p><short>
0da0892000-03-30Martin Nilsson  Subtracts 1 from a variable.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=variable value=string required='required'> <p>The variable to be decremented.</p>
5b0e5d2000-03-25Martin Nilsson </attr>
0da0892000-03-30Martin Nilsson <attr name=value value=number default=1>
9b03652001-03-07Kenneth Johansson  <p>The value to be subtracted.</p>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "default":#"<desc cont='cont'><p><short hide='hide'>
4f24272001-03-11Martin Nilsson  Used to set default values for form elements.</short> This tag makes it easier to give default values to \"<tag>select</tag>\" and \"<tag>input</tag>\" form elements. Simply put the <tag>default</tag> tag around the form elements to which it should give default values.</p>
4817401999-08-13Martin Nilsson 
4f24272001-03-11Martin Nilsson  <p>This tag is particularly useful in combination with generated forms or forms with generated default values, e.g. by database tags.</p>
592ed72000-02-06Martin Nilsson </desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=value value=string>
4f24272001-03-11Martin Nilsson  <p>The value or values to set. If several values are given, they are separated with the separator string.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
b551db2000-06-01Martin Nilsson <attr name=separator value=string default=','>
9b03652001-03-07Kenneth Johansson  <p>If several values are to be selected, this is the string that separates them.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=name value=string>
4f24272001-03-11Martin Nilsson  <p>If used, the default tag will only affect form element with this name.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
b551db2000-06-01Martin Nilsson <ex type='box'>
9b03652001-03-07Kenneth Johansson  <default name='my-select' value='&form.preset;'>
b551db2000-06-01Martin Nilsson  <select name='my-select'> <option value='1'>First</option> <option value='2'>Second</option> <option value='3'>Third</option> </select> </default>
4f24272001-03-11Martin Nilsson </ex>
4817401999-08-13Martin Nilsson 
4f24272001-03-11Martin Nilsson <ex type='box'> <form> <default value=\"&form.opt1;,&form.opt2;,&form.opt3;\"> <input name=\"opt1\" value=\"yes1\" type=\"checkbox\" /> Option #1 <input name=\"opt2\" value=\"yes2\" type=\"checkbox\" /> Option #2 <input name=\"opt3\" value=\"yes3\" type=\"checkbox\" /> Option #3 <input type=\"submit\" /> </default> </form> ",
9b03652001-03-07Kenneth Johansson  "doc":#"<desc cont='cont'><p><short hide='hide'> Eases code documentation by reformatting it.</short>Eases documentation by replacing \"{\", \"}\" and \"&amp;\" with \"&amp;lt;\", \"&amp;gt;\" and \"&amp;amp;\". No attributes required. </p></desc>
6c13ac2000-01-31Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name='quote'> <p>Instead of replacing with \"{\" and \"}\", \"&lt;\" and \"&gt;\" is replaced with \"&amp;lt;\" and \"&amp;gt;\".</p>
425ce52000-05-09Kenneth Johansson 
9b03652001-03-07Kenneth Johansson <ex type='vert'> <doc quote=''>
425ce52000-05-09Kenneth Johansson <table> <tr> <td> First cell </td> <td> Second cell </td> </tr> </table> </doc> </ex>
592ed72000-02-06Martin Nilsson </attr>
1c79451999-10-17Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name='pre'><p> The result is encapsulated within a <tag>pre</tag> container.</p> <ex type='vert'><doc pre=''>
425ce52000-05-09Kenneth Johansson {table} {tr} {td} First cell {/td} {td} Second cell {/td}
078b5e2000-07-14Kenneth Johansson  {/tr}
425ce52000-05-09Kenneth Johansson {/table} </doc> </ex>
592ed72000-02-06Martin Nilsson </attr>
252ed52000-01-31Per Hedbor 
9b03652001-03-07Kenneth Johansson <attr name='class' value='string'> <p>This cascading style sheet (CSS) definition will be applied on the pre element.</p> </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "expire-time":#"<desc tag='tag'><p><short hide='hide'> Sets client cache expire time for the document.</short>Sets client cache expire time for the document by sending the HTTP header \"Expires\". </p></desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=now>
9b03652001-03-07Kenneth Johansson  <p>Notify the client that the document expires now. The headers \"Pragma: no-cache\" and \"Cache-Control: no-cache\" will be sent, besides the \"Expires\" header.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=years value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of years to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=months value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of months to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=weeks value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of weeks to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=days value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of days to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=hours value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of hours to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=beats value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of beats to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
6c13ac2000-01-31Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=minutes value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of minutes to the result.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=seconds value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of seconds to the result.</p> <p>It is not possible at the time to set the date beyond year 2038, since Unix variable <i>time_t</i> data type is used. The <i>time_t</i> data type stores the number of seconds elapsed since 00:00:00 January 1, 1970 UTC. </p> </attr>", //----------------------------------------------------------------------
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson "for":#"<desc cont='cont'><p><short>
dbab472000-02-21Kenneth Johansson  Makes it possible to create loops in RXML.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=from value=number>
9b03652001-03-07Kenneth Johansson  <p>Initial value of the loop variable.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=step value=number>
9b03652001-03-07Kenneth Johansson  <p>How much to increment the variable per loop iteration. By default one.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=to value=number>
9b03652001-03-07Kenneth Johansson  <p>How much the loop variable should be incremented to.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=variable value=name>
9b03652001-03-07Kenneth Johansson  <p>Name of the loop variable.</p>
592ed72000-02-06Martin Nilsson </attr>",
6c13ac2000-01-31Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "fsize":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Prints the size of the specified file.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=file value=string>
9b03652001-03-07Kenneth Johansson  <p>Show size for this file.</p>
592ed72000-02-06Martin Nilsson </attr>",
d93f831999-09-17Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "gauge":#"<desc cont='cont'><p><short>
592ed72000-02-06Martin Nilsson  Measures how much CPU time it takes to run its contents through the
dbab472000-02-21Kenneth Johansson  RXML parser.</short> Returns the number of seconds it took to parse the contents.
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=define value=string>
9b03652001-03-07Kenneth Johansson  <p>The result will be put into a variable. E.g. define=\"var.gauge\" will put the result in a variable that can be reached with <ent>var.gauge</ent>.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=silent>
9b03652001-03-07Kenneth Johansson  <p>Don't print anything.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=timeonly>
9b03652001-03-07Kenneth Johansson  <p>Only print the time.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=resultonly>
9b03652001-03-07Kenneth Johansson  <p>Only print the result of the parsing. Useful if you want to put the time in a database or such.</p>
592ed72000-02-06Martin Nilsson </attr>",
f19d001999-12-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "header":#"<desc tag='tag'><p><short> Adds a HTTP header to the page sent back to the client.</short> For more information about HTTP headers please steer your browser to chapter 14, 'Header field definitions' in <a href='http://community.roxen.com/developers/idocs/rfc/rfc2616.html'>RFC 2616</a>, available at Roxen Community. </p></desc>
5e63831999-10-04Johan Sundström 
592ed72000-02-06Martin Nilsson <attr name=name value=string>
9b03652001-03-07Kenneth Johansson  <p>The name of the header.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=value value=string>
9b03652001-03-07Kenneth Johansson  <p>The value of the header.</p> </attr>",
078b5e2000-07-14Kenneth Johansson 
9b03652001-03-07Kenneth Johansson //----------------------------------------------------------------------
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson "imgs":#"<desc tag='tag'><p><short>
9a7cea2001-03-13Martin Nilsson  Generates a image tag with the correct dimensions in the width and height attributes. These dimensions are read from the image itself, so the image must exist when the tag is generated. The image must also be in GIF, JPEG/JFIF or PNG format.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=src value=string required='required'>
9a7cea2001-03-13Martin Nilsson  <p>The path to the file that should be shown.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=alt value=string>
9a7cea2001-03-13Martin Nilsson  <p>Description of the image. If no description is provided, the filename (capitalized, without extension and with some characters replaced) will be used.</p>
9b03652001-03-07Kenneth Johansson  </attr> <p>All other attributes will be inherited by the generated img tag.</p>",
659d4b1999-10-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "inc":#"<desc tag='tag'><p><short>
0da0892000-03-30Martin Nilsson  Adds 1 to a variable.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=variable value=string required='required'> <p>The variable to be incremented.</p>
5b0e5d2000-03-25Martin Nilsson </attr>
0da0892000-03-30Martin Nilsson <attr name=value value=number default=1>
9b03652001-03-07Kenneth Johansson  <p>The value to be added.</p>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "insert":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Inserts a file, variable or other object into a webpage.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
75f0552000-07-26Kenneth Johansson <attr name=quote value=html|none>
9b03652001-03-07Kenneth Johansson  <p>How the inserted data should be quoted. Default is \"html\", except for href and file where it's \"none\".</p>
880b6e2000-08-12Martin Nilsson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "insert#variable":#"<desc plugin='plugin'><p><short> Inserts the value of a variable.</short> </p></desc>
75f0552000-07-26Kenneth Johansson 
592ed72000-02-06Martin Nilsson <attr name=variable value=string>
9b03652001-03-07Kenneth Johansson  <p>The name of the variable.</p>
880b6e2000-08-12Martin Nilsson </attr> <attr name=scope value=string>
9b03652001-03-07Kenneth Johansson  <p>The name of the scope, unless given in the variable attribute.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
880b6e2000-08-12Martin Nilsson <attr name=index value=number>
9b03652001-03-07Kenneth Johansson  <p>If the value of the variable is an array, the element with this index number will be inserted. 1 is the first element. -1 is the last element.</p>
880b6e2000-08-12Martin Nilsson </attr>
078b5e2000-07-14Kenneth Johansson 
880b6e2000-08-12Martin Nilsson <attr name=split value=string>
9b03652001-03-07Kenneth Johansson  <p>A string with which the variable value should be splitted into an array, so that the index attribute may be used.</p>
880b6e2000-08-12Martin Nilsson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "insert#variables":#"<desc plugin='plugin'><p><short> Inserts a listing of all variables in a scope.</short> Note that it is possible to create a scope with an infinite number of variables set. In this case the programme of that scope decides which variables that should be listable, i.e. this will not cause any problem except that all variables will not be listed. It is also possible to hide variables so that they are not listed with this tag. </p></desc>
880b6e2000-08-12Martin Nilsson <attr name=variables value=full|plain>
9b03652001-03-07Kenneth Johansson  <p>Sets how the output should be formatted.</p> <ex type='vert'>
c00fd22000-08-12Martin Nilsson <pre> <insert variables='full' scope='roxen'/> </pre>
078b5e2000-07-14Kenneth Johansson  </ex>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
880b6e2000-08-12Martin Nilsson <attr name=scope>
9b03652001-03-07Kenneth Johansson  <p>The name of the scope that should be listed, if not the present scope.</p>
880b6e2000-08-12Martin Nilsson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "insert#scopes":#"<desc plugin='plugin'><p><short>
4f24272001-03-11Martin Nilsson  Inserts a listing of all present variable scopes.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
880b6e2000-08-12Martin Nilsson  <attr name=scopes value=full|plain>
9b03652001-03-07Kenneth Johansson  <p>Sets how the output should be formatted.</p>
078b5e2000-07-14Kenneth Johansson 
9b03652001-03-07Kenneth Johansson  <ex type='vert'>
c00fd22000-08-12Martin Nilsson  <insert scopes='plain'/>
078b5e2000-07-14Kenneth Johansson  </ex>
880b6e2000-08-12Martin Nilsson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "insert#file":#"<desc plugin='plugin'><p><short> Inserts the contents of a file.</short> It reads files in a way similar to if you fetched the file with a browser, so the file may be parsed before it is inserted, depending on settings in the RXML parser. Most notably which kinds of files (extensions) that should be parsed. Since it reads files like a normal request, e.g. generated pages from location modules can be inserted. Put the tag <xref href='../programming/eval.tag' /> around <tag>insert</tag> if the file should be parsed after it is inserted in the page. This enables RXML defines and scope variables to be set in the including file (as opposed to the included file). You can also configure the file system module so that files with a certain extension can not be downloaded, but still inserted into other documents. </p></desc>
f155c32000-03-01Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=file value=string>
9b03652001-03-07Kenneth Johansson  <p>The virtual path to the file to be inserted.</p>
75f0552000-07-26Kenneth Johansson  <ex type='box'>
880b6e2000-08-12Martin Nilsson  <eval><insert file='html_header.inc'/></eval>
75f0552000-07-26Kenneth Johansson  </ex>
880b6e2000-08-12Martin Nilsson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "insert#realfile":#"<desc plugin='plugin'><p><short> Inserts a raw, unparsed file.</short> The disadvantage with the realfile plugin compared to the file plugin is that the realfile
4f24272001-03-11Martin Nilsson  plugin needs the inserted file to exist, and can't fetch files from e.g. an arbitrary location module. Note that the realfile insert plugin can not fetch files from outside the virtual file system.
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
880b6e2000-08-12Martin Nilsson <attr name=realfile value=string>
9b03652001-03-07Kenneth Johansson  <p>The virtual path to the file to be inserted.</p>
592ed72000-02-06Martin Nilsson </attr>",
659d4b1999-10-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson //----------------------------------------------------------------------
659d4b1999-10-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson "maketag":({ #"<desc cont='cont'><p><short hide='hide'> Makes it possible to create tags.</short>This tag creates tags. The contents of the container will be put into the contents of the produced container. </p></desc> <attr name=name value=string required='required'> <p>The name of the tag.</p>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=noxml>
9b03652001-03-07Kenneth Johansson  <p>Tags should not be terminated with a trailing slash.</p>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=type value=tag|container|pi default=tag> <p>What kind of tag should be produced. The argument 'Pi' will produce a processinstruction tag. </p> </attr>", ([ "attrib":#"<desc cont='cont'><p> Inside the maketag container the container <tag>attrib</tag> is defined. It is used to add attributes to the produced tag. The contents of the attribute container will be the attribute value. E.g.</p> </desc>
659d4b1999-10-18Martin Nilsson 
5b0e5d2000-03-25Martin Nilsson <ex><eval> <maketag name=\"replace\" type=\"container\"> <attrib name=\"from\">A</attrib> <attrib name=\"to\">U</attrib>
592ed72000-02-06Martin Nilsson  MAD
5b0e5d2000-03-25Martin Nilsson </maketag> </eval>
9b03652001-03-07Kenneth Johansson </ex> <attr name=name value=string required=required><p> The name of the attribute.</p> </attr>" ]) }),
659d4b1999-10-18Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "modified":#"<desc tag='tag'><p><short hide='hide'>
dbab472000-02-21Kenneth Johansson  Prints when or by whom a page was last modified.</short> Prints when or by whom a page was last modified, by default the current page.
9b03652001-03-07Kenneth Johansson </p></desc>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=by>
9b03652001-03-07Kenneth Johansson  <p>Print by whom the page was modified. Takes the same attributes as <xref href='user.tag' />. This attribute requires a userdatabase. </p>
078b5e2000-07-14Kenneth Johansson  <ex type='box'>This page was last modified by <modified by='' realname=''/>.</ex>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=date>
9b03652001-03-07Kenneth Johansson  <p>Print the modification date. Takes all the date attributes in <xref href='date.tag' />.</p>
de6dec2000-05-02Kenneth Johansson 
078b5e2000-07-14Kenneth Johansson  <ex type='box'>This page was last modified <modified date='' case='lower' type='string'/>.</ex>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=file value=path>
9b03652001-03-07Kenneth Johansson  <p>Get information from this file rather than the current page.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=realfile value=path>
9b03652001-03-07Kenneth Johansson  <p>Get information from this file in the computers filesystem rather than Roxen Webserver's virtual filesystem.</p>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "random":#"<desc cont='cont'><p><short>
dbab472000-02-21Kenneth Johansson  Randomly chooses a message from its contents.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name='separator' value='string'> <p>The separator used to separate the messages, by default newline.</p>
425ce52000-05-09Kenneth Johansson 
9b03652001-03-07Kenneth Johansson <ex><random separator='#'> Roxen#Pike#Foo#Bar#roxen.com
425ce52000-05-09Kenneth Johansson </random> </ex>
4f24272001-03-11Martin Nilsson  <attr name='seed' value='string'> Enables you to use a seed that determines which message to choose. </attr> ",
425ce52000-05-09Kenneth Johansson 
9b03652001-03-07Kenneth Johansson //----------------------------------------------------------------------
d059911999-10-08Martin Nilsson 
9b03652001-03-07Kenneth Johansson "redirect":#"<desc tag='tag'><p><short hide='hide'> Redirects the user to another page.</short> Redirects the user to another page by sending a HTTP redirect header to the client. </p></desc>
d059911999-10-08Martin Nilsson 
4f24272001-03-11Martin Nilsson <attr name=to value=URL required='required'> <p>The location to where the client should be sent.</p>
592ed72000-02-06Martin Nilsson </attr>
d059911999-10-08Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=add value=string>
9b03652001-03-07Kenneth Johansson  <p>The prestate or prestates that should be added, in a comma separated list.</p>
592ed72000-02-06Martin Nilsson </attr>
d059911999-10-08Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=drop value=string>
9b03652001-03-07Kenneth Johansson  <p>The prestate or prestates that should be dropped, in a comma separated list.</p>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=text value=string>
9b03652001-03-07Kenneth Johansson  <p>Sends a text string to the browser, that hints from where and why the
592ed72000-02-06Martin Nilsson  page was redirected. Not all browsers will show this string. Only
9b03652001-03-07Kenneth Johansson  special clients like Telnet uses it.</p> <p>Arguments prefixed with \"add\" or \"drop\" are treated as prestate
592ed72000-02-06Martin Nilsson  toggles, which are added or removed, respectively, from the current
9b03652001-03-07Kenneth Johansson  set of prestates in the URL in the redirect header (see also <xref href='apre.tag' />). Note that this only works when the
592ed72000-02-06Martin Nilsson  to=... URL is absolute, i.e. begins with a \"/\", otherwise these
9b03652001-03-07Kenneth Johansson  state toggles have no effect.</p> </attr>",
d059911999-10-08Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "remove-cookie":#"<desc tag='tag'><p><short>
e59a5a2000-03-01Kenneth Johansson  Sets the expire-time of a cookie to a date that has already occured. This forces the browser to remove it.</short> This tag won't remove the cookie, only set it to the empty string, or
7ff3292000-04-05Martin Nilsson  what is specified in the value attribute and change
e59a5a2000-03-01Kenneth Johansson  it's expire-time to a date that already has occured. This is unfortunutaly the only way as there is no command in HTTP for removing cookies. We have to give a hint to the browser and let it remove the cookie.
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=name>
9b03652001-03-07Kenneth Johansson  <p>Name of the cookie the browser should remove.</p>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=value value=text>
9b03652001-03-07Kenneth Johansson  <p>Even though the cookie has been marked as expired some browsers
592ed72000-02-06Martin Nilsson  will not remove the cookie until it is shut down. The text provided
9b03652001-03-07Kenneth Johansson  with this attribute will be the cookies intermediate value.</p>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson  <p>Note that removing a cookie won't take effect until the next page load.</p>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson </attr>", //---------------------------------------------------------------------- "replace":#"<desc cont='cont'><p><short>
0da0892000-03-30Martin Nilsson  Replaces strings in the contents with other strings.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=from value=string required='required'> <p>String or list of strings that should be replaced.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=to value=string>
9b03652001-03-07Kenneth Johansson  <p>String or list of strings with the replacement strings. Default is the empty string.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=separator value=string default=','>
9b03652001-03-07Kenneth Johansson  <p>Defines what string should separate the strings in the from and to attributes.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=type value=word|words default=word>
9b03652001-03-07Kenneth Johansson  <p>Word means that a single string should be replaced. Words that from and to are lists.</p>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //----------------------------------------------------------------------
592ed72000-02-06Martin Nilsson 
9b03652001-03-07Kenneth Johansson "return":#"<desc tag='tag'><p><short> Changes the HTTP return code for this page. </short> <!-- See the Appendix for a list of HTTP return codes. (We have no appendix) --> </p></desc>
592ed72000-02-06Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=code value=integer> <p>The HTTP status code to return.</p>
e7bf332000-09-05Johan Sundström </attr> <attr name=text>
9b03652001-03-07Kenneth Johansson  <p>The HTTP status message to set. If you don't provide one, a default
e7bf332000-09-05Johan Sundström  message is provided for known HTTP status codes, e g \"No such file
9b03652001-03-07Kenneth Johansson  or directory.\" for code 404.</p>
592ed72000-02-06Martin Nilsson </attr>",
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "roxen":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Returns a nice Roxen logo.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
592ed72000-02-06Martin Nilsson 
de6dec2000-05-02Kenneth Johansson <attr name=size value=small|medium|large default=medium>
9b03652001-03-07Kenneth Johansson  <p>Defines the size of the image.</p>
de6dec2000-05-02Kenneth Johansson <ex type='vert'><roxen size='small'/> <roxen/> <roxen size='large'/></ex>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=color value=black|white default=white>
9b03652001-03-07Kenneth Johansson  <p>Defines the color of the image.</p>
de6dec2000-05-02Kenneth Johansson <ex type='vert'><roxen color='black'/></ex>
592ed72000-02-06Martin Nilsson </attr>
d93f831999-09-17Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=alt value=string default='\"Powered by Roxen\"'>
9b03652001-03-07Kenneth Johansson  <p>The image description.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=border value=number default=0>
9b03652001-03-07Kenneth Johansson  <p>The image border.</p>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=class value=string>
9b03652001-03-07Kenneth Johansson  <p>This cascading style sheet (CSS) definition will be applied on the img element.</p>
592ed72000-02-06Martin Nilsson </attr>
ead00e2000-03-09Martin Stjernholm  <attr name=target value=string>
9b03652001-03-07Kenneth Johansson  <p>Names a target frame for the link around the image.</p> <p>All other attributes will be inherited by the generated img tag.</p> </attr> ",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "scope":#"<desc cont='cont'><p><short>
85d5af2000-09-15Martin Nilsson  Creates a new variable scope.</short> Variable changes inside the scope
592ed72000-02-06Martin Nilsson  container will not affect variables in the rest of the page.
9b03652001-03-07Kenneth Johansson </p></desc>
d93f831999-09-17Martin Nilsson 
85d5af2000-09-15Martin Nilsson <attr name=extend value=name default=form>
9b03652001-03-07Kenneth Johansson  <p>If set, all variables in the selected scope will be copied into the new scope. NOTE: if the source scope is \"magic\", as e.g. the roxen scope, the scope will not be copied, but rather linked and will behave as the original scope. It can be useful to create an alias or just for the convinience of refering to the scope as \"_\".</p>
85d5af2000-09-15Martin Nilsson </attr> <attr name=scope value=name default=form>
9b03652001-03-07Kenneth Johansson  <p>The name of the new scope, besides \"_\".</p>
592ed72000-02-06Martin Nilsson </attr>",
d93f831999-09-17Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "set":#"<desc tag='tag'><p><short> Sets a variable.</short> </p></desc>
8859351999-11-25Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=variable value=string required='required'> <p>The name of the variable.</p>
078b5e2000-07-14Kenneth Johansson <ex type='box'> <set variable='var.foo' value='bar'/> </ex>
592ed72000-02-06Martin Nilsson </attr>
d93f831999-09-17Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=value value=string>
9b03652001-03-07Kenneth Johansson  <p>The value the variable should have.</p>
592ed72000-02-06Martin Nilsson </attr>
d93f831999-09-17Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=expr value=string>
9b03652001-03-07Kenneth Johansson  <p>An expression whose evaluated value the variable should have.</p>
592ed72000-02-06Martin Nilsson </attr>
d93f831999-09-17Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=from value=string>
9b03652001-03-07Kenneth Johansson  <p>The name of another variable that the value should be copied from.</p>
592ed72000-02-06Martin Nilsson </attr>
d93f831999-09-17Martin Nilsson 
880b6e2000-08-12Martin Nilsson <attr name=split value=string>
9b03652001-03-07Kenneth Johansson  <p>The value will be splitted by this string into an array.</p>
d93f831999-09-17Martin Nilsson 
9b03652001-03-07Kenneth Johansson  <p>If none of the above attributes are specified, the variable is unset.
592ed72000-02-06Martin Nilsson  If debug is currently on, more specific debug information is provided
9b03652001-03-07Kenneth Johansson  if the operation failed. See also: <xref href='append.tag' /> and <xref href='../programming/debug.tag' />.</p> </attr> ",
d93f831999-09-17Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "set-cookie":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Sets a cookie that will be stored by the user's browser.</short> This is a simple and effective way of storing data that is local to the
a6ef1f2000-03-28Johan Sundström  user. If no arguments specifying the time the cookie should survive is given to the tag, it will live until the end of the current browser session. Otherwise, the cookie will be persistent, and the next time the user visits the site, she will bring the cookie with her.
9b03652001-03-07Kenneth Johansson </p></desc>
d93f831999-09-17Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=name value=string>
9b03652001-03-07Kenneth Johansson  <p>The name of the cookie.</p>
592ed72000-02-06Martin Nilsson </attr>
d93f831999-09-17Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=seconds value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of seconds to the time the cookie is kept.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=minutes value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of minutes to the time the cookie is kept.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=hours value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of hours to the time the cookie is kept.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=days value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of days to the time the cookie is kept.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=weeks value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of weeks to the time the cookie is kept.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=months value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of months to the time the cookie is kept.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=years value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of years to the time the cookie is kept.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=persistent>
4f24272001-03-11Martin Nilsson  <p>Keep the cookie for five years.</p>
592ed72000-02-06Martin Nilsson </attr>
9897451999-10-10Per Hedbor 
9e1b7b2000-04-10Elias Levy <attr name=domain>
9b03652001-03-07Kenneth Johansson  <p>The domain for which the cookie is valid.</p>
9e1b7b2000-04-10Elias Levy </attr>
592ed72000-02-06Martin Nilsson <attr name=value value=string>
9b03652001-03-07Kenneth Johansson  <p>The value the cookie will be set to.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=path value=string default=\"/\"><p>
62f7a12001-03-06Martin Nilsson  The path in which the cookie should be available. Use path=\"\" to remove the path argument from the sent cookie, thus making the cookie valid only
9b03652001-03-07Kenneth Johansson  for the present directory and below.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson  <p>Note that the change of a cookie will not take effect until the next page load.</p> </attr>", //----------------------------------------------------------------------
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson "set-max-cache":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Sets the maximum time this document can be cached in any ram
9b03652001-03-07Kenneth Johansson  caches.</short></p>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson  <p>Default is to get this time from the other tags in the document
9b03652001-03-07Kenneth Johansson  (as an example, <xref href='../if/if_supports.tag' /> sets the time to 0 seconds since the result of the test depends on the client used.</p>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson  <p>You must do this at the end of the document, since many of the normal tags will override this value.</p> </desc>
4817401999-08-13Martin Nilsson 
8c96aa2000-02-24Martin Nilsson <attr name=years value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of years to the time this page was last loaded.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=months value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of months to the time this page was last loaded.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=weeks value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of weeks to the time this page was last loaded.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=days value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of days to the time this page was last loaded.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=hours value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of hours to the time this page was last loaded.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=beats value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of beats to the time this page was last loaded.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=minutes value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of minutes to the time this page was last loaded.</p>
8c96aa2000-02-24Martin Nilsson </attr> <attr name=seconds value=number>
9b03652001-03-07Kenneth Johansson  <p>Add this number of seconds to the time this page was last loaded.</p>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "smallcaps":#"<desc cont='cont'><p><short>
dbab472000-02-21Kenneth Johansson  Prints the contents in smallcaps.</short> If the size attribute is
592ed72000-02-06Martin Nilsson  given, font tags will be used, otherwise big and small tags will be used.
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=space>
9b03652001-03-07Kenneth Johansson  <p>Put a space between every character.</p> <ex type='vert'>
078b5e2000-07-14Kenneth Johansson <smallcaps space=''>Roxen WebServer</smallcaps> </ex>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=class value=string>
9b03652001-03-07Kenneth Johansson  <p>Apply this cascading style sheet (CSS) style on all elements.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=smallclass value=string>
9b03652001-03-07Kenneth Johansson  <p>Apply this cascading style sheet (CSS) style on all small elements.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=bigclass value=string>
9b03652001-03-07Kenneth Johansson  <p>Apply this cascading style sheet (CSS) style on all big elements.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=size value=number>
9b03652001-03-07Kenneth Johansson  <p>Use font tags, and this number as big size.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
0da0892000-03-30Martin Nilsson <attr name=small value=number default=size-1>
9b03652001-03-07Kenneth Johansson  <p>Size of the small tags. Only applies when size is specified.</p>
078b5e2000-07-14Kenneth Johansson  <ex> <smallcaps size='6' small='2'>Roxen WebServer</smallcaps> </ex> <ex> <smallcaps>Roxen WebServer</smallcaps> </ex>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "sort":#"<desc cont='cont'><p><short> Sorts the contents.</short></p>
078b5e2000-07-14Kenneth Johansson  <ex> <sort> 1 Hello 3 World Are 2 We 4 Communicating? </sort> </ex>
592ed72000-02-06Martin Nilsson </desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=separator value=string>
9b03652001-03-07Kenneth Johansson  <p>Defines what the strings to be sorted are separated with. The sorted string will be separated by the string.</p>
078b5e2000-07-14Kenneth Johansson 
9b03652001-03-07Kenneth Johansson  <ex type='vert'>
078b5e2000-07-14Kenneth Johansson  <sort separator='#'> 1#Hello#3#World#Are#2#We#4#Communicating? </sort> </ex>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=reverse>
9b03652001-03-07Kenneth Johansson  <p>Reversed order sort.</p>
078b5e2000-07-14Kenneth Johansson  <ex> <sort reverse=''> 1 Hello 3 World Are 2 We 4 Communicating? </sort> </ex>
592ed72000-02-06Martin Nilsson </attr>",
bd2e111999-10-20Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "throw":#"<desc cont='cont'><p><short>
4f24272001-03-11Martin Nilsson  Throws a text to be caught by <xref href='catch.tag' />.</short> Throws an exception, with the enclosed text as the error message. This tag has a close relation to <xref href='catch.tag' />. The RXML parsing will stop at the <tag>throw</tag> tag.
9b03652001-03-07Kenneth Johansson  </p></desc>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "trimlines":#"<desc cont='cont'><p><short> Removes all empty lines from the contents.</short></p>
078b5e2000-07-14Kenneth Johansson  <ex> <trimlines> Are We Communicating? </trimlines> </ex>
592ed72000-02-06Martin Nilsson </desc>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "unset":#"<desc tag='tag'><p><short>
0da0892000-03-30Martin Nilsson  Unsets a variable, i.e. removes it.</short>
9b03652001-03-07Kenneth Johansson </p></desc>
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson <attr name=variable value=string required='required'> <p>The name of the variable.</p>
078b5e2000-07-14Kenneth Johansson  <ex> <set variable='var.jump' value='do it'/>
9a45402000-08-07Kenneth Johansson  <ent>var.jump</ent>
078b5e2000-07-14Kenneth Johansson  <unset variable='var.jump'/>
9a45402000-08-07Kenneth Johansson  <ent>var.jump</ent>
078b5e2000-07-14Kenneth Johansson  </ex>
592ed72000-02-06Martin Nilsson </attr>",
4817401999-08-13Martin Nilsson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "user":#"<desc tag='tag'><p><short>
dbab472000-02-21Kenneth Johansson  Prints information about the specified user.</short> By default, the full name of the user and her e-mail address will be printed, with a
9b03652001-03-07Kenneth Johansson  mailto link and link to the home page of that user.</p>
4817401999-08-13Martin Nilsson 
dbab472000-02-21Kenneth Johansson  <p>The <tag>user</tag> tag requires an authentication module to work.</p>
592ed72000-02-06Martin Nilsson </desc>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=email>
9b03652001-03-07Kenneth Johansson  <p>Only print the e-mail address of the user, with no link.</p>
425ce52000-05-09Kenneth Johansson  <ex type='box'>Email: <user name='foo' email=''/></ex>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=link>
9b03652001-03-07Kenneth Johansson  <p>Include links. Only meaningful together with the realname or email attribute.</p>
592ed72000-02-06Martin Nilsson </attr>
4817401999-08-13Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=name>
9b03652001-03-07Kenneth Johansson  <p>The login name of the user. If no other attributes are specified, the user's realname and email including links will be inserted.</p>
425ce52000-05-09Kenneth Johansson <ex type='box'><user name='foo'/></ex>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
592ed72000-02-06Martin Nilsson <attr name=nolink>
9b03652001-03-07Kenneth Johansson  <p>Don't include the links.</p>
592ed72000-02-06Martin Nilsson </attr>
659d4b1999-10-18Martin Nilsson 
bb1f632000-03-01Martin Nilsson <attr name=nohomepage>
9b03652001-03-07Kenneth Johansson  <p>Don't include homepage links.</p>
bb1f632000-03-01Martin Nilsson </attr>
592ed72000-02-06Martin Nilsson <attr name=realname>
9b03652001-03-07Kenneth Johansson  <p>Only print the full name of the user, with no link.</p>
425ce52000-05-09Kenneth Johansson <ex type='box'><user name='foo' realname=''/></ex>
592ed72000-02-06Martin Nilsson </attr>",
e45da12000-03-07Martin Nilsson 
9b03652001-03-07Kenneth Johansson //----------------------------------------------------------------------
a170672000-08-10Kenneth Johansson 
9b03652001-03-07Kenneth Johansson "if#expr":#"<desc plugin='plugin'><p><short>
a170672000-08-10Kenneth Johansson  This plugin evaluates expressions.</short> The arithmetic operators are \"+, - and /\". The last main operator is \"%\"(per cent). The allowed relationship operators are \"&lt;. &gt;, ==, &lt;= and
9b03652001-03-07Kenneth Johansson  &gt;=\".</p>
a170672000-08-10Kenneth Johansson  <p>All integers(characters 0 to 9) may be used together with \".\" to create floating point expressions.</p> <ex type='box'> Hexadecimal expression: (0xff / 5) + 3 </ex>
9b03652001-03-07Kenneth Johansson  <p>To be able to evaluate hexadecimal expressions the characters \"a
a170672000-08-10Kenneth Johansson  to f and A to F\" may be used.</p> <ex type='box'> Integer conversion: ((int) 3.14) Floating point conversion: ((float) 100 / 7) </ex>
9b03652001-03-07Kenneth Johansson  <p>Conversion between int and float may be done through the operators \"(int)\" and \"(float)\". The operators \"&amp;\"(bitwise and), \"|\"((pipe)bitwise or), \"&amp;&amp;\"(logical and) and \"||\"((double pipe)logical or) may also be used in expressions. To set prioritizations within expressions the characters \"( and )\" are included. General prioritization rules are:</p>
a170672000-08-10Kenneth Johansson  <list type='ol'>
9b03652001-03-07Kenneth Johansson  <item><p>(int), (float)</p></item> <item><p>*, /, %</p></item> <item><p>+, -</p></item> <item><p>&lt;, &gt;, &lt;=, &gt;=\</p></item> <item><p>==</p></item> <item><p>&amp;, |</p></item> <item><p>&amp;&amp;, ||</p></item> </list>
a170672000-08-10Kenneth Johansson  <ex type='box'> Octal expression: 045 </ex> <ex type='box'> Calculator expression: 3.14e10 / 3 </ex>
9b03652001-03-07Kenneth Johansson  <p>Expressions containing octal numbers may be used. It is also
a170672000-08-10Kenneth Johansson  possible to evaluate calculator expressions.</p>
9b03652001-03-07Kenneth Johansson  <p>Expr is an <i>Eval</i> plugin.</p>
a572572000-07-21Kenneth Johansson </desc>
911ea92001-02-11Martin Nilsson 
a572572000-07-21Kenneth Johansson <attr name='expr' value='expression'>
9b03652001-03-07Kenneth Johansson  <p>Choose what expression to test.</p>
a572572000-07-21Kenneth Johansson </attr>",
1b5bc42000-07-26Kenneth Johansson 
9b03652001-03-07Kenneth Johansson //---------------------------------------------------------------------- "emit#fonts":({ #"<desc plugin='plugin'><p><short>
1b5bc42000-07-26Kenneth Johansson  Prints available fonts.</short> This plugin makes it easy to list all available fonts in Roxen WebServer.
9b03652001-03-07Kenneth Johansson </p></desc>
4f204c2000-09-02Martin Nilsson  <attr name='type' value='ttf|all'>
9b03652001-03-07Kenneth Johansson  <p>Which font types to list. ttf means all true type fonts, whereas all means all available fonts.</p> </attr>",
1b5bc42000-07-26Kenneth Johansson  ([
9b03652001-03-07Kenneth Johansson "&_.name;":#"<desc ent='ent'><p> Returns a font identification name.</p>
1b5bc42000-07-26Kenneth Johansson 
4f204c2000-09-02Martin Nilsson <p>This example will print all available ttf fonts in gtext-style.</p>
1b5bc42000-07-26Kenneth Johansson <ex type='box'>
4f204c2000-09-02Martin Nilsson  <emit source='fonts' type='ttf'> <gtext font='&_.name;'><ent>_.expose</ent></gtext><br />
1b5bc42000-07-26Kenneth Johansson  </emit> </ex>
4f204c2000-09-02Martin Nilsson </desc>",
9b03652001-03-07Kenneth Johansson "&_.copyright;":#"<desc ent='ent'><p> Font copyright notice. Only available for true type fonts. </p></desc>", "&_.expose;":#"<desc ent='ent'><p> The preferred list name. Only available for true type fonts. </p></desc>", "&_.family;":#"<desc ent='ent'><p> The font family name. Only available for true type fonts. </p></desc>", "&_.full;":#"<desc ent='ent'><p> The full name of the font. Only available for true type fonts. </p></desc>", "&_.path;":#"<desc ent='ent'><p> The location of the font file. </p></desc>", "&_.postscript;":#"<desc ent='ent'><p> The fonts postscript identification. Only available for true type fonts. </p></desc>", "&_.style;":#"<desc ent='ent'><p> Font style type. Only available for true type fonts. </p></desc>", "&_.format;":#"<desc ent='ent'><p> The format of the font file, e.g. ttf. </p></desc>", "&_.version;":#"<desc ent='ent'><p> The version of the font. Only available for true type fonts. </p></desc>", "&_.trademark;":#"<desc ent='ent'><p> Font trademark notice. Only available for true type fonts. </p></desc>", //----------------------------------------------------------------------
1b5bc42000-07-26Kenneth Johansson  ]) }),
592ed72000-02-06Martin Nilsson  ]); #endif