goto DONE;
}
}
+ svputlong("RCPTREQUIRED", recipient_required);
+ svputlong("SUBJREQUIRED", recipient_required || subject_required);
DoTemplate(HKEY("edit_message"), NULL, NULL, CTX_NONE);
address_book_popup();
wDumpContent(1);
(strcasecmp(WCC->ugname, WCC->wc_roomname) == 0));
}
-int ConditionalRoomHasQRVisidir(WCTemplateToken *Tokens, void *Context, int ContextType)
+
+
+
+int ConditionalRoomHas_QR_PERMANENT(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_PERMANENT) != 0));
+}
+
+int ConditionalRoomHas_QR_INUSE(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_INUSE) != 0));
+}
+
+int ConditionalRoomHas_QR_PRIVATE(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_PRIVATE) != 0));
+}
+
+int ConditionalRoomHas_QR_PASSWORDED(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_PASSWORDED) != 0));
+}
+
+int ConditionalRoomHas_QR_GUESSNAME(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_GUESSNAME) != 0));
+}
+
+int ConditionalRoomHas_QR_DIRECTORY(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_DIRECTORY) != 0));
+}
+
+int ConditionalRoomHas_QR_UPLOAD(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_UPLOAD) != 0));
+}
+
+int ConditionalRoomHas_QR_DOWNLOAD(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_DOWNLOAD) != 0));
+}
+
+int ConditionalRoomHas_QR_VISDIR(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
((WCC->room_flags & QR_VISDIR) != 0));
}
+int ConditionalRoomHas_QR_ANONONLY(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_ANONONLY) != 0));
+}
+
+int ConditionalRoomHas_QR_ANONOPT(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_ANONOPT) != 0));
+}
+
+int ConditionalRoomHas_QR_NETWORK(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_NETWORK) != 0));
+}
+
+int ConditionalRoomHas_QR_PREFONLY(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_PREFONLY) != 0));
+}
+
+int ConditionalRoomHas_QR_READONLY(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_READONLY) != 0));
+}
+
+int ConditionalRoomHas_QR_MAILBOX(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+ struct wcsession *WCC = WC;
+
+ return ((WCC!=NULL) &&
+ ((WCC->room_flags & QR_MAILBOX) != 0));
+}
+
+
+
+
+
+
int ConditionalHaveRoomeditRights(WCTemplateToken *Tokens, void *Context, int ContextType)
{
struct wcsession *WCC = WC;
WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
RegisterNamespace("ROOMBANNER", 0, 0, tmplput_roombanner, 0);
- RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHasQRVisidir, CTX_NONE);
+
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
+ RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
+
RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
<input type="hidden" name="references" value="<?BSTR("references")>">
<p class="send_edit_msg">
- <input type="submit" name="send_button" value="<?_("Send message")>">
- <input type="submit" name="send_button" value="<?_("Post message")>"> TODO
+<?!("COND:SUBST", 1, "RCPTREQUIRED")><input type="submit" name="send_button" value="<?_("Send message")>"><?!("X", 1)>
+<??("COND:SUBST", 2, "RCPTREQUIRED")><input type="submit" name="send_button" value="<?_("Post message")>"><?!("X", 2)>
+
<input type="submit" name="cancel_button" value="<?_("Cancel")>">
</p>
<img src="static/newmess3_24x.gif" class="imgedit"> <?DATE:NOW:STR>
<tr><th><label for="from_id" > <i><?_("from")></i> </label></th><td colspan="2">
<select name="display_name" size=1 id="from_id">
<?ITERATE("PREF:VALID:EMAIL:NAME", "section_msg_sender_name_select")>
+<?!("COND:ROOM:FLAGS:QR_ANONOPT", 3)>
+<option <?%("COND:BSTR", 1, "__ANONYMOUS__", "selected", "")> value="__ANONYMOUS__"><?_("Anonymous")></option>
+<?!("X", 3)>
</select>
+
+<?!("COND:SUBST", 4, "RCPTREQUIRED")>
<select name="my_email_addr" size=1>
<?ITERATE("PREF:VALID:EMAIL:ADDR", "section_msg_sender_from_select")>
</select>
+<?!("X", 4)>
+
<i><?_("in")></i> <?ROOMNAME></td></tr>
+
+<?!("COND:SUBST", 5, "RCPTREQUIRED")>
<tr>
<th><label for="recp_id"> <?_("To:")></label></th>
<td><input autocomplete="off" type="text" name="recp" id="recp_id" value="<?BSTR("recp", "H")>" size=45 maxlength=1000 />
<script type="text/javascript">
activate_entmsg_autocompleters();
-</script>
+</script>
+<??("X", 5)>
<tr>
<th><label for="subject_id" >
- <?_("Subject:")><?_("Subject (optional):")><TODO>
+ <?!("COND:SUBST", 6, "SUBJREQUIRED")><?_("Subject:")><?!("X", 6)>
+ <??("COND:SUBST", 7, "SUBJREQUIRED")><?_("Subject (optional):")><??("X", 7)>
</label></th>
<td colspan="2">
<input type="text" name="subject" id="subject_id" value="<?BSTR("subject", "U")>" size=45 maxlength=70>
<div class="message_header">
<span><?MAIL:SUMM:DATESTR></span>
<?_("from ")>
- <??("COND:MAIL:ANON",1)><a href="showuser?who=<?MAIL:SUMM:FROM("Q")>">"<?MAIL:SUMM:FROM("X")>"
-<?!("MAIL:SUMM:RFCA", 2)><<?MAIL:SUMM:RFCA>></a><?!("X", 2)>
-<??("MAIL:SUMM:RFCA", 3)></a> @ <?SERV:NODENAME><??("X", 3)>
+ <??("COND:MAIL:ANON",1)>
+<?!("MAIL:SUMM:RFCA", 2)><a href="showuser?who=<?MAIL:SUMM:FROM("Q")>">"<?MAIL:SUMM:FROM("X")>"<<?MAIL:SUMM:RFCA>></a><?!("X", 2)>
+<??("MAIL:SUMM:RFCA", 3)><a href="showuser?who=<?MAIL:SUMM:FROM("Q")>"><?MAIL:SUMM:FROM("X")></a> @ <?SERV:NODENAME><??("X", 3)>
<??("X", 1)>
<?!("COND:MAIL:ANON", 4)>***<??("X", 4)>
<p style="visibility: hidden;" id="msg<?MAIL:SUMM:N>" class="msgbuttons">
- <a href="display_enter?recp=<?MAIL:SUMM:FROM("U")>&references=<?MAIL:SUMM:INREPLYTO("U")>%3C<?MAIL:SUMM:RFCA("U")>%3E&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Re:%%20", "Re:")>"><span>[</span><?_("Reply")><span>]</span></a>
+ <a href="display_enter?recp=%22<?MAIL:SUMM:FROM("U")>%22%3C<?MAIL:SUMM:RFCA("U")>%3E&references=<?MAIL:SUMM:INREPLYTO("U")>%3C<?MAIL:SUMM:RFCA("U")>%3E&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Re:%%20", "Re:")>"><span>[</span><?_("Reply")><span>]</span></a>
<a href="display_enter?replyquote=<?MAIL:SUMM:N>&recp=<?MAIL:SUMM:FROM("U")>&references=<?MAIL:SUMM:INREPLYTO("U")>%3C<?MAIL:SUMM:RFCA("U")>%3E&subject=<?MAIL:SUMM:SUBJECT("U", 0, "Re:%%20", "Re:")>"><span>[</span><?_("ReplyQuoted")><span>]</span></a>
int nArgs,
WCTemplateToken *Tokens,
void *Context, int ContextType,
- StrBuf *Source, int FormatTypeIndex)
+ const StrBuf *Source, int FormatTypeIndex)
{
+ struct wcsession *WCC;
+ StrBuf *Buf;
char EscapeAs = ' ';
-
+ if ((FormatTypeIndex < Tokens->nParameters) &&
+ (Tokens->Params[FormatTypeIndex]->Type == TYPE_STR) &&
+ (Tokens->Params[FormatTypeIndex]->len == 1)) {
+ EscapeAs = *Tokens->Params[FormatTypeIndex]->Start;
+ }
switch(EscapeAs)
{
-
+ case 'H':
+ WCC = WC;
+ Buf = NewStrBufPlain(NULL, StrLength(Buf));
+ StrBuf_RFC822_to_Utf8(Buf,
+ Source,
+ (WCC!=NULL)? WCC->DefaultCharset : NULL,
+ NULL);
+ StrEscAppend(Target, Buf, NULL, 0, 0);
+ FreeStrBuf(&Buf);
+ break;
case 'X':
StrEscAppend(Target, Source, NULL, 0, 0);
break;
return (state != 0)?Token->Params[1]->lvalue:0;
Cond = (ConditionalStruct *) Token->PreEval;
+ if (Cond == NULL) {
+ lprintf(1, "Conditional [%s] (in '%s' line %ld); unknown![%s]\n",
+ Token->Params[0]->Start,
+ ChrPtr(pTmpl->FileName),
+ Token->Line,
+ ChrPtr(Token->FlatToken));
+ return 1;
+ }
if (Token->nParameters < Cond->nParams) {
lprintf(1, "Conditional [%s] (in '%s' line %ld); needs %ld Params![%s]\n",
void tmplput_trailing_javascript(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *vContext, int ContextType)
{
struct wcsession *WCC = WC;
- StrBufAppendBuf(WCC->WBuf, WCC->trailing_javascript, 0);
+
+ if (WCC != NULL)
+ StrBufAppendTemplate(Target, nArgs, Tokens, vContext, ContextType,
+ WCC->trailing_javascript, 0);
}
/*
struct wcsession *WCC = WC;
if (WCC != NULL) {
+/*
+ StrBufAppendTemplate(Target, nArgs, Tokens, Context, ContextType,
+ WCC->ImportantMessage, 0);
+*/
+ WCC->ImportantMessage[0] = '\0';
StrEscAppend(Target, NULL, WCC->ImportantMessage, 0, 0);
WCC->ImportantMessage[0] = '\0';
}
void tmplput_bstr(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
{
- StrBufAppendBuf(Target,
- SBstr(Tokens->Params[0]->Start,
- Tokens->Params[0]->len), 0);
+ const StrBuf *Buf = SBstr(Tokens->Params[0]->Start,
+ Tokens->Params[0]->len);
+ if (Buf != NULL)
+ StrBufAppendTemplate(Target, nArgs, Tokens,
+ Context, ContextType,
+ Buf, 1);
}
int nArgs,
WCTemplateToken *Tokens,
void *Context, int ContextType,
- StrBuf *Source, int FormatTypeIndex);
+ const StrBuf *Source, int FormatTypeIndex);