}
}
-int ConditionalAide(WCTemplateToken *Token, void *Context)
+int ConditionalAide(WCTemplateToken *Token, void *Context, int ContextType)
{
return (WC->is_aide == 0);
}
-int ConditionalRoomAide(WCTemplateToken *Token, void *Context)
+int ConditionalRoomAide(WCTemplateToken *Token, void *Context, int ContextType)
{
return (WC->is_room_aide == 0);
}
WebcitAddUrlHandler(HKEY("changepw"), changepw, 0);
WebcitAddUrlHandler(HKEY("termquit"), do_logout, 0);
- RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide);
- RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide);
+ RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
return ;
}
}
-void tmpl_nonce(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmpl_nonce(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
StrBufAppendPrintf(Target, "%ld",
InitModule_CONTEXT
(void)
{
- RegisterNamespace("NONCE", 0, 0, tmpl_nonce);
+ RegisterNamespace("NONCE", 0, 0, tmpl_nonce, 0);
}
* depending on the browser locale change the sequence of the
* language chooser.
*/
-void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context) {
+void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType) {
int i;
#ifndef HAVE_USELOCALE
char *Lang = getenv("LANG");
}
-void tmplput_iconbar(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_iconbar(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
WebcitAddUrlHandler(HKEY("iconbar_ajax_rooms"), do_iconbar_roomlist, AJAX);
WebcitAddUrlHandler(HKEY("display_customize_iconbar"), display_customize_iconbar, 0);
WebcitAddUrlHandler(HKEY("commit_iconbar"), commit_iconbar, 0);
- RegisterNamespace("ICONBAR", 0, 0, tmplput_iconbar);
+ RegisterNamespace("ICONBAR", 0, 0, tmplput_iconbar, 0);
}
SVPutBuf("SERVCFG:INET:HOSTNAME", vContext, 1);
}
-void DeleteInectConfHash(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context)
+void DeleteInectConfHash(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
if (WCC->InetCfg == NULL)
{
WebcitAddUrlHandler(HKEY("display_inetconf"), display_inetconf, 0);
WebcitAddUrlHandler(HKEY("save_inetconf"), new_save_inetconf, AJAX);
- RegisterIterator("SERVCFG:INET", 1, NULL, GetInetConfHash, InetCfgSubst, NULL);
- RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInectConfHash);
+ RegisterIterator("SERVCFG:INET", 1, NULL, GetInetConfHash, InetCfgSubst, NULL, CTX_INETCFG);
+ RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInectConfHash, CTX_INETCFG);
}
{
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("display_main_menu"), NULL, NULL);
+ DoTemplate(HKEY("display_main_menu"), NULL, NULL, 0);
end_burst();
/*
{
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("display_aide_menu"), NULL, NULL);
+ DoTemplate(HKEY("display_aide_menu"), NULL, NULL, 0);
end_burst();
/*
output_headers(1, 1, 2, 0, 0, 0);
}
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("display_serverrestart"), NULL, NULL);
+ DoTemplate(HKEY("display_serverrestart"), NULL, NULL, 0);
end_burst();
lingering_close(WC->http_sock);
sleeeeeeeeeep(10);
{
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("display_serverrestartpage"), NULL, NULL);
+ DoTemplate(HKEY("display_serverrestartpage"), NULL, NULL, 0);
end_burst();
}
else
serv_getln(buf, sizeof buf); // should we care?
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("display_serverrestartpagedo"), NULL, NULL);
+ DoTemplate(HKEY("display_serverrestartpagedo"), NULL, NULL, 0);
end_burst();
}
}
}
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("display_aide_menu"), NULL, NULL);
+ DoTemplate(HKEY("display_aide_menu"), NULL, NULL, 0);
end_burst();
}
}
WebcitAddUrlHandler(HKEY("display_confirm_delete_node"), display_confirm_delete_node, 0);
WebcitAddUrlHandler(HKEY("delete_node"), delete_node, 0);
WebcitAddUrlHandler(HKEY("display_add_node"), display_add_node, 0);
- RegisterIterator("NODECONFIG", 0, NULL, load_netconf, NodeCfgSubst, DeleteHash);
+ RegisterIterator("NODECONFIG", 0, NULL, load_netconf, NodeCfgSubst, DeleteHash, CTX_NODECONF);
}
/*@}*/
v = vnote_new_from_msg(msgnum);
if (v) {
- display_vnote_div(v);
+// display_vnote_div(v);
+ DoTemplate(HKEY("vnoteitem"),
+ v, WC->WBuf, CTX_VNOTE);
+
/* uncomment these lines to see ugly debugging info
wprintf("<script type=\"text/javascript\">");
readloop("readfwd");
}
+
+void tmpl_vcard_put_posleft(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%d", v->pos_left);
+}
+
+void tmpl_vcard_put_postop(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%d", v->pos_top);
+}
+
+void tmpl_vcard_put_poswidth(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%d", v->pos_width);
+}
+
+void tmpl_vcard_put_posheight(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%d", v->pos_height);
+}
+
+void tmpl_vcard_put_posheight2(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%d", (v->pos_height / 16) - 5);
+}
+
+void tmpl_vcard_put_width2(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%d", (v->pos_width / 9) - 1);
+}
+
+void tmpl_vcard_put_color(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%02X%02X%02X", v->color_red, v->color_green, v->color_blue);
+}
+
+void tmpl_vcard_put_bgcolor(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendPrintf(Target, "%02X%02X%02X", v->color_red/2, v->color_green/2, v->color_blue/2);
+}
+
+void tmpl_vcard_put_message(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrEscAppend(Target, NULL, v->body, 0, 0); ///TODO?
+}
+
+void tmpl_vcard_put_uid(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
+{
+ struct vnote *v = (struct vnote *) Context;
+ StrBufAppendBufPlain(Target, v->uid, -1, 0);
+}
+
void
InitModule_NOTES
(void)
{
WebcitAddUrlHandler(HKEY("add_new_note"), add_new_note, 0);
WebcitAddUrlHandler(HKEY("ajax_update_note"), ajax_update_note, 0);
+
+ RegisterNamespace("VNOTE:POS:LEFT", 0, 0, tmpl_vcard_put_posleft, CTX_VNOTE);
+ RegisterNamespace("VNOTE:POS:TOP", 0, 0, tmpl_vcard_put_postop, CTX_VNOTE);
+ RegisterNamespace("VNOTE:POS:WIDTH", 0, 0, tmpl_vcard_put_poswidth, CTX_VNOTE);
+ RegisterNamespace("VNOTE:POS:HEIGHT", 0, 0, tmpl_vcard_put_posheight, CTX_VNOTE);
+ RegisterNamespace("VNOTE:POS:HEIGHT2", 0, 0, tmpl_vcard_put_posheight2, CTX_VNOTE);
+ RegisterNamespace("VNOTE:POS:WIDTH2", 0, 0, tmpl_vcard_put_width2, CTX_VNOTE);
+ RegisterNamespace("VNOTE:COLOR", 0, 0, tmpl_vcard_put_color, CTX_VNOTE);
+ RegisterNamespace("VNOTE:BGCOLOR", 0, 0,tmpl_vcard_put_bgcolor, CTX_VNOTE);
+ RegisterNamespace("VNOTE:MSG", 0, 1, tmpl_vcard_put_message, CTX_VNOTE);
+ RegisterNamespace("VNOTE:UID", 0, 0, tmpl_vcard_put_uid, CTX_VNOTE);
}
#define PRF_YESNO 4
-void tmplput_CFG_Value(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context)
+void tmplput_CFG_Value(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
{
StrBuf *Setting;
if (get_PREFERENCE(Token->Params[0]->Start,
StrBufAppendBuf(Target, Setting, 0);
}
-void tmplput_CFG_Descr(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context)
+void tmplput_CFG_Descr(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
{
const char *SettingStr;
SettingStr = PrefGetLocalStr(Token->Params[0]->Start,
SVPutBuf("ZONENAME", Zone, 1);
}
-int ConditionalPreference(WCTemplateToken *Token, void *Context)
+int ConditionalPreference(WCTemplateToken *Token, void *Context, int ContextType)
{
StrBuf *Pref;
RegisterPreference("default_header_charset", _("Default character set for email headers:") ,PRF_STRING);
RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO);
- RegisterNamespace("PREF:VALUE", 1, 1, tmplput_CFG_Value);
- RegisterNamespace("PREF:DESCR", 1, 1, tmplput_CFG_Descr);
- RegisterIterator("PREF:ZONE", 0, ZoneHash, NULL, CfgZoneTempl, NULL);
+ RegisterNamespace("PREF:VALUE", 1, 1, tmplput_CFG_Value, CTX_SESSION);
+ RegisterNamespace("PREF:DESCR", 1, 1, tmplput_CFG_Descr, CTX_SESSION);
+ RegisterIterator("PREF:ZONE", 0, ZoneHash, NULL, CfgZoneTempl, NULL, CTX_PREF);
- RegisterConditional(HKEY("COND:PREF"), 4, ConditionalPreference);
+ RegisterConditional(HKEY("COND:PREF"), 4, ConditionalPreference, CTX_NONE);
}
/*@}*/
/**
* \brief read this room's info file (set v to 1 for verbose mode)
*/
-void readinfo(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context)
+void readinfo(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
{
char buf[256];
char briefinfo[128];
* keep the browser from using a cached icon from
* another room.
*/
-void embed_room_graphic(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context) {
+void embed_room_graphic(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType) {
char buf[SIZ];
serv_puts("OIMG _roompic_");
/**
* \brief Display the current view and offer an option to change it
*/
-void embed_view_o_matic(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context) {
+void embed_view_o_matic(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType) {
int i;
wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
/**
* \brief Display a search box
*/
-void embed_search_o_matic(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context) {
+void embed_search_o_matic(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType) {
wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<label for=\"search_name\">");
/** offer the ability to switch views */
wprintf("<ul class=\"room_actions\">\n");
wprintf("<li class=\"start_page\">");
- offer_start_page(NULL, 0, NULL, NULL);
+ offer_start_page(NULL, 0, NULL, NULL, CTX_NONE);
wprintf("</li>");
wprintf("<li><form name=\"roomlistomatic\">\n"
"<select name=\"newview\" size=\"1\" "
}
-void tmplput_RoomName(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_RoomName(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, WC->wc_roomname, 1, 1);
}
smart_goto(bstr("room"));
}
-void tmplput_roombanner(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_roombanner(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
wprintf("<div id=\"banner\">\n");
embed_room_banner(NULL, navbar_default);
}
-void tmplput_ungoto(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_ungoto(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
}
-int ConditionalHaveUngoto(WCTemplateToken *Tokens, void *Context)
+int ConditionalHaveUngoto(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
(strcasecmp(WCC->ugname, WCC->wc_roomname) == 0));
}
-int ConditinalRoomHasQRVisidir(WCTemplateToken *Tokens, void *Context)
+int ConditionalRoomHasQRVisidir(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
((WCC->room_flags & QR_VISDIR) != 0));
}
-int ConditionalHaveRoomeditRights(WCTemplateToken *Tokens, void *Context)
+int ConditionalHaveRoomeditRights(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
InitModule_ROOMOPS
(void)
{
- RegisterNamespace("ROOMNAME", 0, 0, tmplput_RoomName);
+ RegisterNamespace("ROOMNAME", 0, 0, tmplput_RoomName, 0);
WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, 0);
WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
- RegisterNamespace("ROOMBANNER", 0, 0, tmplput_roombanner);
- RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditinalRoomHasQRVisidir);
- RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto);
- RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights);
+ RegisterNamespace("ROOMBANNER", 0, 0, tmplput_roombanner, 0);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHasQRVisidir, CTX_NONE);
+ RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
- RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto);
+ RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
}
/*@}*/
display_aide_menu();
}
-void tmplput_servcfg(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_servcfg(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
void *vBuf;
}
}
-int ConditionalServCfg(WCTemplateToken *Tokens, void *Context)
+int ConditionalServCfg(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
void *vBuf;
else return 0;
}
-int ConditionalServCfgSubst(WCTemplateToken *Tokens, void *Context)
+int ConditionalServCfgSubst(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
void *vBuf;
InitModule_SITECONFIG
(void)
{
- WebcitAddUrlHandler(HKEY("display_siteconfig"), display_siteconfig, 0);
- WebcitAddUrlHandler(HKEY("siteconfig"), siteconfig, 0);
+ WebcitAddUrlHandler(HKEY("display_siteconfig"), display_siteconfig, CTX_NONE);
+ WebcitAddUrlHandler(HKEY("siteconfig"), siteconfig, CTX_NONE);
- RegisterNamespace("SERV:CFG", 1, 1, tmplput_servcfg);
- RegisterConditional(HKEY("COND:SERVCFG"), 3, ConditionalServCfg);
- RegisterConditional(HKEY("COND:SERVCFG:SUBST"), 4, ConditionalServCfgSubst);
+ RegisterNamespace("SERV:CFG", 1, 1, tmplput_servcfg, CTX_SITECFG);
+ RegisterConditional(HKEY("COND:SERVCFG"), 3, ConditionalServCfg, CTX_NONE);
+ RegisterConditional(HKEY("COND:SERVCFG:SUBST"), 4, ConditionalServCfgSubst, CTX_NONE);
}
/*@}*/
--- /dev/null
+
+
+<div id="note-<?VNOTE:UID>"
+ class="stickynote_outer"
+ style=" left: <?VNOTE:POS:LEFT>px; top: <?VNOTE:POS:TOP>px; width: <?VNOTE:POS:WIDTH>px; height: <?VNOTE:POS:HEIGHT>px; background-color: #<?VNOTE:COLOR>">
+<!--begin title bar div-->
+<div id='titlebar-<?VNOTE:UID>'
+ class="stickynote_titlebar"
+ onMouseDown="NotesDragMouseDown(event,'<?VNOTE:UID>')"
+ style=" background-color: #<?VNOTE:BGCOLOR>"
+>
+<table border=0 cellpadding=0 cellspacing=0 valign=middle width=100%%><tr>
+<td align=left valign=middle>
+<img onclick="NotesClickPalette(event,'<?VNOTE:UID>')" src="static/8paint16.gif">
+</td>
+<td></td><!-- nothing in the title bar, it's just for dragging-->
+<td align=right valign=middle>
+ <img onclick="DeleteStickyNote(event,'<?VNOTE:UID>','<?_("Delete this note?")>')"
+ src="static/closewindow.gif">
+</td></tr></table>
+</div>
+<!--end title bar div; begin body div-->
+<div id="notebody-<?VNOTE:UID>" class="stickynote_body">
+ <?VNOTE:MSG("X")>
+</div>
+<!--end body div-->
+<script type="text/javascript">
+ new Ajax.InPlaceEditor('notebody-<?VNOTE:UID>', 'ajax_update_note?note_uid=<?VNOTE:UID>',
+{
+ rows:<?VNOTE:POS:HEIGHT2>,
+ cols:<?VNOTE:POS:WIDTH2>,
+ onEnterHover:false,
+ onLeaveHover:false,
+ okText:'<?_("Save")>',
+ cancelText:'<?_("Cancel")>',
+ clickToEditText:'<?_("Click on any note to edit it.")>'
+});
+</script>
+<div id="resize-<?VNOTE:UID>"
+ class="stickynote_resize" onMouseDown="NotesResizeMouseDown(event,'<?VNOTE:UID>')"> </div>
+
+<div id="palette-<?VNOTE:UID>" class="stickynote_palette">
+ <table border=0 cellpadding=0 cellspacing=0>
+ <tr>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',128,128,128,'#808080','#404040')" bgcolor="#808080"> </td>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',255,128,128,'#ff8080','#7f4040')" bgcolor="#ff8080"> </td>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',128,128,255,'#8080ff','#40407f')" bgcolor="#8080ff"> </td>
+ </tr><tr>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',255,255,128,'#ffff80','#7f7f40')" bgcolor="#ffff80"> </td>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',128,255,128,'#80ff80','#407f40')" bgcolor="#80ff80"> </td>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',255,128,255,'#ff80ff','#7f407f')" bgcolor="#ff80ff"> </td>
+ </tr><tr>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',128,255,255,'#80ffff','#407f7f')" bgcolor="#80ffff"> </td>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',255,128,128,'#ff8080','#7f4040')" bgcolor="#ff8080"> </td>
+ <td onClick="NotesClickColor(event,'<?VNOTE:UID>',128,128,128,'#808080','#404040')" bgcolor="#808080"> </td>
+ </tr>
+ </table>
+</div></div>
+
+<div id="resize-<?VNOTE:UID>"
+ class="stickynote_resize"
+ onMouseDown="NotesResizeMouseDown(event,'<?VNOTE:UID>')">
+</div>
+<!--end resize handle div-->
+
+
typedef struct _HashHandler {
int nMinArgs;
int nMaxArgs;
+ int ContextRequired;
WCHandlerFunc HandlerFunc;
}HashHandler;
void *load_template(StrBuf *filename, StrBuf *Key, HashList *PutThere);
-void RegisterNS(const char *NSName, long len, int nMinArgs, int nMaxArgs, WCHandlerFunc HandlerFunc)
+void RegisterNS(const char *NSName,
+ long len,
+ int nMinArgs,
+ int nMaxArgs,
+ WCHandlerFunc HandlerFunc,
+ int ContextRequired)
{
HashHandler *NewHandler;
NewHandler->nMinArgs = nMinArgs;
NewHandler->nMaxArgs = nMaxArgs;
NewHandler->HandlerFunc = HandlerFunc;
+ NewHandler->ContextRequired = ContextRequired;
Put(GlobalNS, NSName, len, NewHandler, NULL);
}
* \brief Print the value of a variable
* \param keyname get a key to print
*/
-void print_value_of(StrBuf *Target, WCTemplateToken *Token, void *Context) {
+void print_value_of(StrBuf *Target, WCTemplateToken *Token, void *Context, int ContextType) {
struct wcsession *WCC = WC;
wcsubst *ptr;
void *vVar;
/*if (WCC->vars != NULL) PrintHash(WCC->vars, VarPrintTransition, VarPrintEntry);*/
/// TODO: debricated!
if (Token->pName[0] == '=') {
- DoTemplate(Token->pName+1, Token->NameEnd - 1, NULL, NULL);
+ DoTemplate(Token->pName+1, Token->NameEnd - 1, NULL, NULL, 0);
}
//////TODO: if param[1] == "U" -> urlescape
pvo_do_cmd(Target, ptr->wcs_value);
break;
case WCS_FUNCTION:
- (*ptr->wcs_function) (Target, Token->nParameters, Token, Context);
+ (*ptr->wcs_function) (Target, Token->nParameters, Token, Context, ContextType);
break;
case WCS_STRBUF:
case WCS_STRBUF_REF:
-int EvaluateConditional(StrBuf *Target, WCTemplateToken *Token, WCTemplate *pTmpl, void *Context, int Neg, int state)
+int EvaluateConditional(StrBuf *Target, WCTemplateToken *Token, WCTemplate *pTmpl, void *Context, int Neg, int state, int ContextType)
{
void *vConditional = NULL;
ConditionalStruct *Cond;
ChrPtr(Token->FlatToken));
return 0;
}
- if (Cond->CondF(Token, Context) == Neg)
+ if (Cond->CondF(Token, Context, ContextType) == Neg)
return Token->Params[1]->lvalue;
return 0;
}
-int EvaluateToken(StrBuf *Target, WCTemplateToken *Token, WCTemplate *pTmpl, void *Context, int state)
+int EvaluateToken(StrBuf *Target, WCTemplateToken *Token, WCTemplate *pTmpl, void *Context, int state, int ContextType)
{
HashHandler *Handler;
void *vVar;
// much output, since pName is not terminated...
// lprintf(1,"Doing token: %s\n",Token->pName);
+
switch (Token->Flags) {
case SV_GETTEXT:
TmplGettext(Target, Token->nParameters, Token);
break;
case SV_CONDITIONAL: /** Forward conditional evaluation */
- return EvaluateConditional(Target, Token, pTmpl, Context, 1, state);
+ return EvaluateConditional(Target, Token, pTmpl, Context, 1, state, ContextType);
break;
case SV_NEG_CONDITIONAL: /** Reverse conditional evaluation */
- return EvaluateConditional(Target, Token, pTmpl, Context, 0, state);
+ return EvaluateConditional(Target, Token, pTmpl, Context, 0, state, ContextType);
break;
case SV_CUST_STR_CONDITIONAL: /** Conditional put custom strings from params */
if (Token->nParameters >= 6) {
- if (EvaluateConditional(Target, Token, pTmpl, Context, 0, state))
+ if (EvaluateConditional(Target, Token, pTmpl, Context, 0, state, ContextType))
StrBufAppendBufPlain(Target,
Token->Params[5]->Start,
Token->Params[5]->len,
break;
case SV_SUBTEMPL:
if (Token->nParameters == 1)
- DoTemplate(Token->Params[0]->Start, Token->Params[0]->len, NULL, NULL);
+ DoTemplate(Token->Params[0]->Start, Token->Params[0]->len, NULL, NULL, ContextType);
break;
case SV_PREEVALUATED:
Handler = (HashHandler*) Token->PreEval;
+ if ((Handler->ContextRequired != CTX_NONE) &&
+ (Handler->ContextRequired != ContextType)) {
+ lprintf(1, "Handler [%s] (in '%s' line %ld); "
+ "requires context of type %ld, have %ld [%s]\n",
+ Token->pName,
+ ChrPtr(pTmpl->FileName),
+ Token->Line,
+ Handler->ContextRequired,
+ ContextType,
+ ChrPtr(Token->FlatToken));
+ StrBufAppendPrintf(
+ Target,
+ "<pre>\nHandler [%s] (in '%s' line %ld);"
+ " requires context of type %ld, have %ld!\n[%s]\n</pre>\n",
+ Token->pName,
+ ChrPtr(pTmpl->FileName),
+ Token->Line,
+ Handler->ContextRequired,
+ ContextType,
+ ChrPtr(Token->FlatToken));
+ return -1;
+
+ }
Handler->HandlerFunc(Target,
Token->nParameters,
Token,
- Context);
+ Context,
+ ContextType);
break;
default:
if (GetHash(GlobalNS, Token->pName, Token->NameEnd, &vVar)) {
Handler = (HashHandler*) vVar;
- if ((Token->nParameters < Handler->nMinArgs) ||
- (Token->nParameters > Handler->nMaxArgs)) {
+ if ((Handler->ContextRequired != CTX_NONE) &&
+ (Handler->ContextRequired != ContextType)) {
+ lprintf(1, "Handler [%s] (in '%s' line %ld); "
+ "requires context of type %ld, have %ld [%s]\n",
+ Token->pName,
+ ChrPtr(pTmpl->FileName),
+ Token->Line,
+ Handler->ContextRequired,
+ ContextType,
+ ChrPtr(Token->FlatToken));
+ StrBufAppendPrintf(
+ Target,
+ "<pre>\nHandler [%s] (in '%s' line %ld);"
+ " requires context of type %ld, have %ld!\n[%s]\n</pre>\n",
+ Token->pName,
+ ChrPtr(pTmpl->FileName),
+ Token->Line,
+ Handler->ContextRequired,
+ ContextType,
+ ChrPtr(Token->FlatToken));
+ return -1;
+ }
+ else if ((Token->nParameters < Handler->nMinArgs) ||
+ (Token->nParameters > Handler->nMaxArgs)) {
lprintf(1, "Handler [%s] (in '%s' line %ld); "
"doesn't work with %ld params [%s]\n",
Token->pName,
Handler->HandlerFunc(Target,
Token->nParameters,
Token,
- Context); /*TODO: subset of that */
+ Context,
+ ContextType); /*TODO: subset of that */
}
}
else {
- print_value_of(Target, Token, Context);
+ print_value_of(Target, Token, Context, ContextType);
}
}
return 0;
}
-void ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, void *Context)
+void ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, void *Context, int ContextType)
{
WCTemplate *pTmpl = Tmpl;
int done = 0;
"<pre>\nError loading Template [%s]\n See Logfile for details\n</pre>\n",
ChrPtr(Tmpl->FileName));
return;
-
-
}
}
StrBufAppendBufPlain(
Target, pData,
pTmpl->Tokens[i]->pTokenStart - pData, 0);
- state = EvaluateToken(Target, pTmpl->Tokens[i], pTmpl, Context, state);
+ state = EvaluateToken(Target, pTmpl->Tokens[i], pTmpl, Context, state, ContextType);
while ((state != 0) && (i+1 < pTmpl->nTokensUsed)) {
/* condition told us to skip till its end condition */
i++;
pTmpl,
Context,
pTmpl->Tokens[i]->Flags,
- state))
+ state,
+ ContextType))
state = 0;
}
}
* \brief Display a variable-substituted template
* \param templatename template file to load
*/
-void DoTemplate(const char *templatename, long len, void *Context, StrBuf *Target)
+void DoTemplate(const char *templatename, long len, void *Context, StrBuf *Target, int ContextType)
{
HashList *Static;
HashList *StaticLocal;
}
if (vTmpl == NULL)
return;
- ProcessTemplate(vTmpl, Target, Context);
+ ProcessTemplate(vTmpl, Target, Context, ContextType);
}
int LoadTemplateDir(const char *DirName, HashList *wireless, HashList *big)
LocalTemplateCache);
}
-void tmplput_serv_ip(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_serv_ip(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrBufAppendPrintf(Target, "%d", WC->ctdl_pid);
}
-void tmplput_serv_nodename(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_serv_nodename(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, serv_info.serv_nodename, 0, 0);
}
-void tmplput_serv_humannode(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_serv_humannode(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, serv_info.serv_humannode, 0, 0);
}
-void tmplput_serv_fqdn(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_serv_fqdn(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, serv_info.serv_fqdn, 0, 0);
}
-void tmmplput_serv_software(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmmplput_serv_software(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, serv_info.serv_software, 0, 0);
}
-void tmplput_serv_rev_level(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_serv_rev_level(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrBufAppendPrintf(Target, "%d.%02d",
serv_info.serv_rev_level / 100,
serv_info.serv_rev_level % 100);
}
-void tmmplput_serv_bbs_city(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmmplput_serv_bbs_city(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, serv_info.serv_bbs_city, 0, 0);
}
-void tmplput_current_user(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_current_user(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, WC->wc_fullname, 0, 0);
}
-void tmplput_current_room(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_current_room(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrEscAppend(Target, NULL, WC->wc_roomname, 0, 0);
}
typedef struct _HashIterator {
HashList *StaticList;
int AdditionalParams;
+ int ContextType;
RetrieveHashlistFunc GetHash;
HashDestructorFunc Destructor;
SubTemplFunc DoSubTemplate;
} HashIterator;
-void tmpl_iterate_subtmpl(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmpl_iterate_subtmpl(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
void *vIt;
HashIterator *It;
SubBuf = NewStrBuf();
it = GetNewHashPos();
while (GetNextHashPos(List, it, &len, &Key, &vContext)) {
- svprintf(HKEY("ITERATE:ODDEVEN"), WCS_STRING, "%s", (oddeven)?"odd":"even");
- svprintf(HKEY("ITERATE:KEY"), WCS_STRING, "%s",Key);
+ svprintf(HKEY("ITERATE:ODDEVEN"), WCS_STRING, "%s",
+ (oddeven) ? "odd" : "even");
+ svprintf(HKEY("ITERATE:KEY"), WCS_STRING, "%s", Key);
+
It->DoSubTemplate(SubBuf, vContext, Tokens);
DoTemplate(Tokens->Params[1]->Start,
Tokens->Params[1]->len,
- vContext, SubBuf);
+ vContext, SubBuf,
+ It->ContextType);
StrBufAppendBuf(Target, SubBuf, 0);
FlushStrBuf(SubBuf);
It->Destructor(&List);
}
-int ConditionalVar(WCTemplateToken *Tokens, void *Context)
+int ConditionalVar(WCTemplateToken *Tokens, void *Context, int ContextType)
{
void *vsubst;
wcsubst *subst;
&vsubst))
return 0;
subst = (wcsubst*) vsubst;
+ if ((subst->ContextRequired != CTX_NONE) &&
+ (subst->ContextRequired != ContextType)) {
+ lprintf(1," WARNING: Conditional requires Context: [%ld]!\n", Tokens->Params[2]->Start);
+ return -1;
+ }
+
switch(subst->wcs_type) {
case WCS_FUNCTION:
return (subst->wcs_function!=NULL);
return (subst->lvalue == Tokens->Params[3]->lvalue);
default:
lprintf(1," WARNING: invalid type: [%ld]!\n", subst->wcs_type);
+ return -1;
}
return 0;
}
HashList *StaticList,
RetrieveHashlistFunc GetHash,
SubTemplFunc DoSubTempl,
- HashDestructorFunc Destructor)
+ HashDestructorFunc Destructor,
+ int ContextType)
{
HashIterator *It = (HashIterator*)malloc(sizeof(HashIterator));
It->StaticList = StaticList;
It->GetHash = GetHash;
It->DoSubTemplate = DoSubTempl;
It->Destructor = Destructor;
+ It->ContextType = ContextType;
Put(Iterators, Name, len, It, NULL);
}
void RegisterConditional(const char *Name, long len,
int nParams,
- WCConditionalFunc CondF)
+ WCConditionalFunc CondF,
+ int ContextRequired)
{
ConditionalStruct *Cond = (ConditionalStruct*)malloc(sizeof(ConditionalStruct));
Cond->nParams = nParams;
Cond->CondF = CondF;
+ Cond->ContextRequired = ContextRequired;
Put(Contitionals, Name, len, Cond, NULL);
}
-void tmpl_do_boxed(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmpl_do_boxed(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
if (nArgs == 2) {
StrBuf *Headline = NewStrBuf();
DoTemplate(Tokens->Params[1]->Start,
Tokens->Params[1]->len,
Context,
- Headline);
+ Headline,
+ ContextType);
SVPutBuf("BOXTITLE", Headline, 0);
}
-
- DoTemplate(HKEY("beginbox"), Context, Target);
+
+ DoTemplate(HKEY("beginbox"), Context, Target, ContextType);
DoTemplate(Tokens->Params[0]->Start,
Tokens->Params[0]->len,
Context,
- Target);
- DoTemplate(HKEY("endbox"), Context, Target);
+ Target,
+ ContextType);
+ DoTemplate(HKEY("endbox"), Context, Target, ContextType);
}
-void tmpl_do_tabbed(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmpl_do_tabbed(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrBuf **TabNames;
int i, ntabs, nTabs;
DoTemplate(Tokens->Params[i * 2]->Start,
Tokens->Params[i * 2]->len,
Context,
- TabNames[i]);
+ TabNames[i],
+ ContextType);
}
else {
/** A Tab without subject? we can't count that, add it as silent */
DoTemplate(Tokens->Params[i * 2 + 1]->Start,
Tokens->Params[i * 2 + 1]->len,
Context,
- Target);
+ Target,
+ ContextType);
StrEndTab(Target, i, nTabs);
}
}
InitModule_SUBST
(void)
{
- RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip);
- RegisterNamespace("SERV:NODENAME", 0, 0, tmplput_serv_nodename);
- RegisterNamespace("SERV:HUMANNODE", 0, 0, tmplput_serv_humannode);
- RegisterNamespace("SERV:FQDN", 0, 0, tmplput_serv_fqdn);
- RegisterNamespace("SERV:SOFTWARE", 0, 0, tmmplput_serv_software);
- RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level);
- RegisterNamespace("SERV:BBS_CITY", 0, 0, tmmplput_serv_bbs_city);
-/// RegisterNamespace("SERV:LDAP_SUPP", 0, 0, tmmplput_serv_ldap_enabled);
- RegisterNamespace("CURRENT_USER", 0, 0, tmplput_current_user);
- RegisterNamespace("CURRENT_ROOM", 0, 0, tmplput_current_room);
- RegisterNamespace("ITERATE", 2, 100, tmpl_iterate_subtmpl);
- RegisterNamespace("DOBOXED", 1, 2, tmpl_do_boxed);
- RegisterNamespace("DOTABBED", 2, 100, tmpl_do_tabbed);
- RegisterConditional(HKEY("COND:SUBST"), 3, ConditionalVar);
+ RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip, CTX_NONE);
+ RegisterNamespace("SERV:NODENAME", 0, 0, tmplput_serv_nodename, CTX_NONE);
+ RegisterNamespace("SERV:HUMANNODE", 0, 0, tmplput_serv_humannode, CTX_NONE);
+ RegisterNamespace("SERV:FQDN", 0, 0, tmplput_serv_fqdn, CTX_NONE);
+ RegisterNamespace("SERV:SOFTWARE", 0, 0, tmmplput_serv_software, CTX_NONE);
+ RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level, CTX_NONE);
+ RegisterNamespace("SERV:BBS_CITY", 0, 0, tmmplput_serv_bbs_city, CTX_NONE);
+/// RegisterNamespace("SERV:LDAP_SUPP", 0, 0, tmmplput_serv_ldap_enabled, 0);
+ RegisterNamespace("CURRENT_USER", 0, 0, tmplput_current_user, CTX_NONE);
+ RegisterNamespace("CURRENT_ROOM", 0, 0, tmplput_current_room, CTX_NONE);
+ RegisterNamespace("ITERATE", 2, 100, tmpl_iterate_subtmpl, CTX_NONE);
+ RegisterNamespace("DOBOXED", 1, 2, tmpl_do_boxed, CTX_NONE);
+ RegisterNamespace("DOTABBED", 2, 100, tmpl_do_tabbed, CTX_NONE);
+ RegisterConditional(HKEY("COND:SUBST"), 3, ConditionalVar, CTX_NONE);
}
/*@}*/
wprintf("</h2></div>");
wprintf("<ul class=\"room_actions\">\n");
wprintf("<li class=\"start_page\">");
- offer_start_page(NULL, 0, NULL, NULL);
+ offer_start_page(NULL, 0, NULL, NULL, CTX_NONE);
wprintf("</li></ul>");
wprintf("</div>");
const StrBuf *Tmpl = sbstr("template");
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(ChrPtr(Tmpl), StrLength(Tmpl), NULL, NULL);
+ DoTemplate(ChrPtr(Tmpl), StrLength(Tmpl), NULL, NULL, 0);
end_burst();
}
/*
* Offer to make any page the user's "start page."
*/
-void offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context) {
+void offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType) {
wprintf("<a href=\"change_start_page?startpage=");
urlescputs(WC->this_page);
wprintf("\">");
}
-int ConditionalImportantMesage(WCTemplateToken *Tokens, void *Context)
+int ConditionalImportantMesage(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
if (WCC != NULL)
return 0;
}
-void tmplput_importantmessage(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_importantmessage(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
}
}
-int ConditionalBstr(WCTemplateToken *Tokens, void *Context)
+int ConditionalBstr(WCTemplateToken *Tokens, void *Context, int ContextType)
{
if(Tokens->nParameters == 1)
return HaveBstr(Tokens->Params[0]->Start,
Tokens->Params[1]->Start) == 0;
}
-void tmplput_bstr(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+void tmplput_bstr(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
StrBufAppendBuf(Target,
SBstr(Tokens->Params[0]->Start,
WebcitAddUrlHandler(HKEY("mimepart"), view_mimepart, NEED_URL);
WebcitAddUrlHandler(HKEY("mimepart_download"), download_mimepart, NEED_URL);
WebcitAddUrlHandler(HKEY("diagnostics"), diagnostics, NEED_URL);
- RegisterConditional(HKEY("COND:IMPMSG"), 0, ConditionalImportantMesage);
- RegisterConditional(HKEY("COND:BSTR"), 1, ConditionalBstr);
- RegisterNamespace("BSTR", 1, 2, tmplput_bstr);
- RegisterNamespace("IMPORTANTMESSAGE", 0, 0, tmplput_importantmessage);
- RegisterNamespace("OFFERSTARTPAGE", 0, 0, offer_start_page);
+
+ RegisterConditional(HKEY("COND:IMPMSG"), 0, ConditionalImportantMesage, CTX_NONE);
+ RegisterConditional(HKEY("COND:BSTR"), 1, ConditionalBstr, CTX_NONE);
+ RegisterNamespace("BSTR", 1, 2, tmplput_bstr, CTX_NONE);
+ RegisterNamespace("IMPORTANTMESSAGE", 0, 0, tmplput_importantmessage, CTX_NONE);
+ RegisterNamespace("OFFERSTARTPAGE", 0, 0, offer_start_page, CTX_NONE);
}
TemplateParam *Params[MAXPARAM];
} WCTemplateToken;
-typedef void (*WCHandlerFunc)(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context);
+typedef void (*WCHandlerFunc)(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType);
/**
char wcs_key[32]; /**< copy of our hashkey for debugging */
StrBuf *wcs_value; /**< if we're a string, keep it here */
long lvalue; /**< type long? keep data here */
+ int ContextRequired; /**< do we require a context type? */
WCHandlerFunc wcs_function; /**< funcion hook ???*/
} wcsubst;
+#define CTX_NONE 0
+#define CTX_SITECFG 1
+#define CTX_SESSION 2
+#define CTX_INETCFG 3
+#define CTX_VNOTE 4
+#define CTX_WHO 5
+#define CTX_PREF 6
+#define CTX_NODECONF 7
+
void RegisterNS(const char *NSName, long len,
int nMinArgs,
int nMaxArgs,
- WCHandlerFunc HandlerFunc);
-#define RegisterNamespace(a, b, c, d) RegisterNS(a, sizeof(a)-1, b, c, d)
+ WCHandlerFunc HandlerFunc,
+ int ContextRequired);
+#define RegisterNamespace(a, b, c, d, e) RegisterNS(a, sizeof(a)-1, b, c, d, e)
-typedef int (*WCConditionalFunc)(WCTemplateToken *Token, void *Context);
+typedef int (*WCConditionalFunc)(WCTemplateToken *Token, void *Context, int ContextType);
typedef struct _ConditionalStruct {
int nParams;
+ int ContextRequired;
WCConditionalFunc CondF;
} ConditionalStruct;
void RegisterConditional(const char *Name, long len,
int nParams,
- WCConditionalFunc CondF);
+ WCConditionalFunc CondF,
+ int ContextRequired);
HashList *StaticList,
RetrieveHashlistFunc GetHash,
SubTemplFunc DoSubTempl,
- HashDestructorFunc Destructor);
-#define RegisterIterator(a, b, c, d, e, f) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f)
+ HashDestructorFunc Destructor,
+ int ContextType);
+#define RegisterIterator(a, b, c, d, e, f, g) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f, g)
void SVPut(char *keyname, size_t keylen, int keytype, char *Data);
#define svput(a, b, c) SVPut(a, sizeof(a) - 1, b, c)
void SVPUTBuf(const char *keyname, int keylen, const StrBuf *Buf, int ref);
#define SVPutBuf(a, b, c); SVPUTBuf(a, sizeof(a) - 1, b, c)
-void DoTemplate(const char *templatename, long len, void *Context, StrBuf *Target);
-#define do_template(a, b) DoTemplate(a, sizeof(a) -1, b, NULL);
+void DoTemplate(const char *templatename, long len, void *Context, StrBuf *Target, int ContextType);
+#define do_template(a, b) DoTemplate(a, sizeof(a) -1, b, NULL, 0);
void url_do_template(void);
int CompareSubstToToken(TemplateParam *ParamToCompare, TemplateParam *ParamToLookup);
int is_msg_in_mset(char *mset, long msgnum);
void display_addressbook(long msgnum, char alpha);
-void offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context);
+void offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType);
void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext);
void output_html(char *, int);
void do_listsub(void);
int CtdlDecodeQuotedPrintable(char *decoded, char *encoded, int sourcelen);
void spawn_another_worker_thread(void);
void display_rss(char *roomname, StrBuf *request_method);
-void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context);
+void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType);
void set_selected_language(const char *);
void go_selected_language(void);
void stop_selected_language(void);
WebcitAddUrlHandler(HKEY("terminate_session"), _terminate_session, 0);
WebcitAddUrlHandler(HKEY("edit_me"), edit_me, 0);
- RegisterIterator("WHOLIST", 0, NULL, GetWholistHash, WholistSubst, DeleteWholistHash);
+ RegisterIterator("WHOLIST", 0, NULL, GetWholistHash, WholistSubst, DeleteWholistHash, CTX_WHO);
}