* follow api-change in several places
authorWilfried Göesgens <willi@citadel.org>
Sun, 7 Dec 2008 11:34:05 +0000 (11:34 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sun, 7 Dec 2008 11:34:05 +0000 (11:34 +0000)
* new longint-vector replacer if you just want to blast some numbers in tiny templates
* urlpart replacers so you can easily reference the actual api-name in templates (actualy needs to be enabled by the registerer of the api callback)
* cleanup and templatize the bbview-selector bar

14 files changed:
webcit/addressbook_popup.c
webcit/auth.c
webcit/calendar_view.c
webcit/inetconf.c
webcit/messages.c
webcit/netconf.c
webcit/preferences.c
webcit/static/t/msg_listselector.html [new file with mode: 0644]
webcit/static/t/select_messageindex.html [new file with mode: 0644]
webcit/static/t/select_messageindex_all.html [new file with mode: 0644]
webcit/subst.c
webcit/summary.c
webcit/webcit.c
webcit/webcit.h

index b8be3e77aef133608ee40476287ec737ea748c66..3cb23ebddbd3366b2b4c947cf73fd5f4f5dc16f2 100644 (file)
@@ -67,7 +67,7 @@ void display_address_book_middle_div(void) {
        }
 
        SortByHashKey(List, 1);
-       it = GetNewHashPos();
+       it = GetNewHashPos(List, 0);
        while (GetNextHashPos(List, it, &len, &VCName, &Namee)) {
                wprintf("<option value=\"");
                urlescputs((char*)Namee);
@@ -135,7 +135,7 @@ void display_address_book_inner_div() {
 
                }
                SortByHashKey(List, 1);
-               it = GetNewHashPos();
+               it = GetNewHashPos(List, 0);
                while (GetNextHashPos(List, it, &len, &VCName, &Namee)) {
                        wprintf("<option value=\"");
                        escputs((char*)Namee);
@@ -160,7 +160,7 @@ void display_address_book_inner_div() {
 
                }
                SortByHashKey(List, 1);
-               it = GetNewHashPos();
+               it = GetNewHashPos(List, 0);
                while (GetNextHashPos(List, it, &len, &VCName, (void**)&Namee)) {
                        wprintf("<option value=\"");
                        escputs((char*)Namee);
index 618956d615a3e02c61f5446f212b8ead5b8e3688..e8c627399d25bcb38700e8e723181219a8a3b6a1 100644 (file)
@@ -364,7 +364,7 @@ void finalize_openid_login(void)
                                const char *HKey;
                                HashPos *Cursor;
                                
-                               Cursor = GetNewHashPos ();
+                               Cursor = GetNewHashPos (WCC->urlstrings, 0);
                                while (GetNextHashPos(WCC->urlstrings, Cursor, &HKLen, &HKey, &U)) {
                                        u = (urlcontent*) U;
                                        if (!strncasecmp(u->url_key, "openid.", 7)) {
index f982945e1750620422ae43622cee169146e26c9a..14112d0932918217dd91821ace59899a7f90276a 100644 (file)
@@ -216,7 +216,7 @@ void calendar_month_view_display_events(int year, int month, int day)
        /*
         * Now loop through our list of events to see which ones occur today.
         */
-       Pos = GetNewHashPos();
+       Pos = GetNewHashPos(WCC->disp_cal_items, 0);
        while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
                Cal = (disp_cal*)vCal;
                all_day_event = 0;
@@ -385,7 +385,7 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
        day = today_tm.tm_mday;
        year = today_tm.tm_year + 1900;
 
-       Pos = GetNewHashPos();
+       Pos = GetNewHashPos(WCC->disp_cal_items, 0);
        while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
                Cal = (disp_cal*)vCal;
                p = icalcomponent_get_first_property(Cal->cal, ICAL_DTSTART_PROPERTY);
@@ -825,7 +825,7 @@ void calendar_day_view_display_events(time_t thetime,
 
        /* Now loop through our list of events to see which ones occur today.
         */
-       Pos = GetNewHashPos();
+       Pos = GetNewHashPos(WCC->disp_cal_items, 0);
        while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
                Cal = (disp_cal*)vCal;
 
@@ -1266,7 +1266,7 @@ void calendar_summary_view(void) {
        now = time(NULL);
        localtime_r(&now, &today_tm);
 
-       Pos = GetNewHashPos();
+       Pos = GetNewHashPos(WCC->disp_cal_items, 0);
        while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
                Cal = (disp_cal*)vCal;
                p = icalcomponent_get_first_property(Cal->cal,
@@ -1511,7 +1511,7 @@ void do_tasks_view(void) {
                              task_completed_cmp);
        }
 
-       Pos = GetNewHashPos();
+       Pos = GetNewHashPos(WCC->disp_cal_items, 0);
        while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
                Cal = (disp_cal*)vCal;
                wprintf("<tr><td>");
index 8814784fb9a974427708b3b156db8a2ee3fa5191..10313f16740041a59e1880eb479cb694c9f19f3c 100644 (file)
@@ -157,7 +157,7 @@ void new_save_inetconf(void) {
                                return;
                        }
                        if (GetCount(Hash) > 0) {
-                               where = GetNewHashPos();
+                               where = GetNewHashPos(Hash, 0);
                                while (GetNextHashPos(Hash, where, &KeyLen, &Key, &vStr)) {
                                        Str = (StrBuf*) vStr;
                                        if ((Str!= NULL) && (StrLength(Str) > 0))
index 1d13f92b8600d6a34487cd3d96b231a691313fbd..269d1da7945bb1a57480cdf058e1e92f16a4a695 100644 (file)
@@ -220,7 +220,7 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, in
                        StrBufAppendBuf(Msg->reply_to, Msg->from, 0);
                }
        }
-       it = GetNewHashPos();
+       it = GetNewHashPos(Msg->AllAttach, 0);
        while (GetNextHashPos(Msg->AllAttach, it, &len, &Key, &vMime) && 
               (vMime != NULL)) {
                wc_mime_attachment *Mime = (wc_mime_attachment*) vMime;
@@ -946,6 +946,63 @@ inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
 }
 
 
+void DrawMessageSummarySelector(StrBuf *BBViewToolBar, long maxmsgs, long startmsg)
+{
+       struct wcsession *WCC = WC;
+       message_summary* Msg;
+       int lo, hi, n;
+       int i = 0;
+       long StartMsg;
+       void *vMsg;
+       long hklen;
+       const char *key;
+       int done = 0;
+       int nItems;
+       HashPos *At;
+       long vector[16];
+       StrBuf *Selector = NewStrBuf();
+
+       At = GetNewHashPos(WCC->summ, (lbstr("SortOrder") == 1)? -maxmsgs : maxmsgs);
+       nItems = GetCount(WCC->summ);
+       
+       vector[0] = 7;
+       vector[1] = startmsg;
+       vector[2] = maxmsgs;
+       vector[3] = 0;
+       vector[4] = 1;
+
+       while (!done) {
+               lo = GetHashPosCounter(At);
+               if (lo + maxmsgs > nItems) {
+                       hi = nItems;
+               }
+               else {
+                       hi = lo + maxmsgs;
+               }
+               done = !GetNextHashPos(WCC->summ, At, &hklen, &key, &vMsg);
+               Msg = (message_summary*) vMsg;
+               n = (Msg==NULL)? 0 : Msg->msgnum;
+               if (i == 0)
+                       StartMsg = n;
+               vector[4] = lo;
+               vector[5] = hi;
+               vector[6] = n;
+               FlushStrBuf(BBViewToolBar); /** abuse our target buffer to contstruct one item in it */
+               DoTemplate(HKEY("select_messageindex"), BBViewToolBar, &vector, CTX_LONGVECTOR);
+               StrBufAppendBuf(Selector, BBViewToolBar, 0);
+               i++;
+       }
+       vector[6] = StartMsg;
+       FlushStrBuf(BBViewToolBar);
+       DoTemplate(HKEY("select_messageindex_all"), BBViewToolBar, &vector, CTX_LONGVECTOR);
+       StrBufAppendBuf(Selector, BBViewToolBar, 0);
+       
+       FlushStrBuf(BBViewToolBar);
+       DoTemplate(HKEY("msg_listselector"), BBViewToolBar, Selector, CTX_STRBUF);
+       FreeStrBuf(&Selector);
+}
+
+
 /*
  * command loop for reading messages
  *
@@ -960,8 +1017,7 @@ void readloop(char *oper)
        char buf[SIZ];
        char old_msgs[SIZ];
        int a = 0;
-       int b = 0;
-       int n;
+       ///int b = 0;
        int nummsgs;
        long startmsg = 0;
        int maxmsgs;
@@ -975,13 +1031,12 @@ void readloop(char *oper)
        int is_tasks = 0;
        int is_notes = 0;
        int is_bbview = 0;
-       int lo, hi;
        int lowest_displayed = (-1);
        int highest_displayed = 0;
        addrbookent *addrbook = NULL;
        int num_ab = 0;
        int bbs_reverse = 0;
-       struct wcsession *WCC = WC;     /* This is done to make it run faster; WC is a function */
+       struct wcsession *WCC = WC;
        HashPos *at;
        const char *HashKey;
        long HKLen;
@@ -1087,11 +1142,6 @@ void readloop(char *oper)
        }
 
 
-
-
-
-
-
        output_headers(1, 1, 1, 0, 0, 0);
 
        /*
@@ -1137,7 +1187,7 @@ void readloop(char *oper)
                if (buf[0] == '2') {
                        strcpy(old_msgs, &buf[4]);
                }
-               at = GetNewHashPos();
+               at = GetNewHashPos(WCC->summ, 0);
                while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                        /** Are you a new message, or an old message? */
                        Msg = (message_summary*) vMsg;
@@ -1170,111 +1220,15 @@ void readloop(char *oper)
         * If we're not currently looking at ALL requested
         * messages, then display the selector bar
         */
-       if (is_bbview) {
-               const char *selected;
-               StrBuf *Selector = NewStrBuf();
+       if (is_bbview)  {
                BBViewToolBar = NewStrBuf();
-/////          DoTemplate("bbview_scrollbar");
-               /** begin bbview scroller */
-               StrBufAppendPrintf(BBViewToolBar, "<form name=\"msgomatictop\" class=\"selector_top\" > \n <p>");
-               StrBufAppendPrintf(BBViewToolBar, _("Reading #"));//// TODO this isn't used, should it? : , lowest_displayed, highest_displayed);
-
-               StrBufAppendPrintf(BBViewToolBar, "<select name=\"whichones\" size=\"1\" "
-                                  "OnChange=\"location.href=msgomatictop.whichones.options"
-                                  "[selectedIndex].value\">\n");
+               maxmsgs = 20; //// todo?
 
-               if (bbs_reverse) {
-                       for (b=nummsgs-1; b>=0; b = b - maxmsgs) {
-                               hi = b + 1;
-                               lo = b - maxmsgs + 2;
-                               if (lo < 1) lo = 1;
-                               
-                               Msg = GetMessagePtrAt(lo-1, WCC->summ);
-                               n = (Msg==NULL)? 0 : Msg->msgnum;
-                               selected = ((n == startmsg) ? "selected" : "");
-                               
-                               StrBufAppendPrintf(Selector, 
-                                                  "<option %s value="
-                                                  "\"%s"
-                                                  "&startmsg=%ld"
-                                                  "&maxmsgs=%d"
-                                                  "&is_summary=%d\">"
-                                                  "%d-%d</option> \n",
-                                                  selected,
-                                                  oper,
-
-
-                                                  maxmsgs,
-                                                  is_summary,
-                                                  hi, lo);
-                       }
-               }
-               else {
-                       for (b=0; b<nummsgs; b = b + maxmsgs) {
-                               lo = b + 1;
-                               hi = b + maxmsgs + 1;
-                               if (hi > nummsgs) hi = nummsgs;
-
-                               Msg = GetMessagePtrAt(b, WCC->summ);
-                               n = (Msg==NULL)? 0 : Msg->msgnum;
-                               selected = ((n == startmsg) ? "selected" : "");
-                               Msg = GetMessagePtrAt(lo-1,  WCC->summ);
-                               StrBufAppendPrintf(Selector, 
-                                                  "<option %s value="
-                                                  "\"%s"
-                                                  "&startmsg=%ld"
-                                                  "&maxmsgs=%d"
-                                                  "&is_summary=%d\">"
-                                                  "%d-%d</option> \n",
-                                                  selected,
-                                                  oper,
-                                                  (Msg==NULL)? 0 : Msg->msgnum,
-                                                  maxmsgs,
-                                                  is_summary,
-                                                  lo, hi);
-                       }
-               }
-
-               StrBufAppendBuf(BBViewToolBar, Selector, 0);
-
-               Msg = GetMessagePtrAt(0,  WCC->summ);
-
-               StrBufAppendPrintf(BBViewToolBar, "<option value=\"%s?startmsg=%ld"
-                       "&maxmsgs=9999999&is_summary=0\">",
-                       oper,
-                       (Msg==NULL)? 0 : Msg->msgnum);
-               StrBufAppendPrintf(BBViewToolBar, _("All"));
-
-               StrBufAppendPrintf(BBViewToolBar, "</option>");
-               StrBufAppendPrintf(BBViewToolBar, "</select> ");
-               StrBufAppendPrintf(BBViewToolBar, _("of %d messages."), nummsgs);
-
-               /** forward/reverse */
-               StrBufAppendPrintf(BBViewToolBar, "<input type=\"radio\" %s name=\"direction\" value=\"\""
-                       "OnChange=\"location.href='%s?sortby=forward'\"",  
-                       (bbs_reverse ? "" : "checked"),
-                       oper
-               );
-               StrBufAppendPrintf(BBViewToolBar, ">");
-               StrBufAppendPrintf(BBViewToolBar, _("oldest to newest"));
-               StrBufAppendPrintf(BBViewToolBar, "&nbsp;&nbsp;&nbsp;&nbsp;");
-
-               StrBufAppendPrintf(BBViewToolBar, "<input type=\"radio\" %s name=\"direction\" value=\"\""
-                       "OnChange=\"location.href='%s?sortby=reverse'\"", 
-                       (bbs_reverse ? "checked" : ""),
-                       oper
-               );
-               StrBufAppendPrintf(BBViewToolBar, ">");
-               StrBufAppendPrintf(BBViewToolBar, _("newest to oldest"));
-               StrBufAppendPrintf(BBViewToolBar, "\n");
-       
-               StrBufAppendPrintf(BBViewToolBar, "</p></form>\n");
+               DrawMessageSummarySelector(BBViewToolBar, maxmsgs, startmsg);
                StrBufAppendBuf(WCC->WBuf, BBViewToolBar, 0);
-               /** end bbview scroller */
-               FreeStrBuf(&Selector);
        }
                        
-       at = GetNewHashPos();
+       at = GetNewHashPos(WCC->summ, 0);
        while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                Msg = (message_summary*) vMsg;          
                if ((Msg->msgnum >= startmsg) && (num_displayed < maxmsgs)) {
@@ -1470,7 +1424,7 @@ void post_mime_to_server(void) {
                HashPos  *it;
 
                /* Add in the attachments */
-               it = GetNewHashPos();
+               it = GetNewHashPos(WCC->attachments, 0);
                while (GetNextHashPos(WCC->attachments, it, &len, &Key, &vAtt)) {
                        att = (wc_attachment*)vAtt;
                        encoded_length = ((att->length * 150) / 100);
@@ -1945,10 +1899,10 @@ void
 InitModule_MSG
 (void)
 {
-       WebcitAddUrlHandler(HKEY("readnew"), readnew, 0);
-       WebcitAddUrlHandler(HKEY("readold"), readold, 0);
-       WebcitAddUrlHandler(HKEY("readfwd"), readfwd, 0);
-       WebcitAddUrlHandler(HKEY("headers"), headers, 0);
+       WebcitAddUrlHandler(HKEY("readnew"), readnew, NEED_URL);
+       WebcitAddUrlHandler(HKEY("readold"), readold, NEED_URL);
+       WebcitAddUrlHandler(HKEY("readfwd"), readfwd, NEED_URL);
+       WebcitAddUrlHandler(HKEY("headers"), headers, NEED_URL);
        WebcitAddUrlHandler(HKEY("do_search"), do_search, 0);
        WebcitAddUrlHandler(HKEY("display_enter"), display_enter, 0);
        WebcitAddUrlHandler(HKEY("post"), post_message, 0);
index 67195404683dba3a0b5226ddfd1ebd1bd201395f..bd48e76315cc3263d919493a74d277381ad16fee 100644 (file)
@@ -138,7 +138,7 @@ void save_net_conf(HashList *Nodelist)
        serv_getln(buf, sizeof buf);
        if (buf[0] == '4') {
                if ((Nodelist != NULL) && (GetCount(Nodelist) > 0)) {
-                       where = GetNewHashPos();
+                       where = GetNewHashPos(Nodelist, 0);
                        Buf = NewStrBuf();
                        while (GetNextHashPos(Nodelist, where, &KeyLen, &Key, &vNode)) {
                                Node = (NodeConf*) vNode;
index 382667f38e89f9f1860dff8b2172ea2e5c042831..086a244e31ffb996e05b932398e6e7b595ec614f 100644 (file)
@@ -175,7 +175,7 @@ void save_preferences(void) {
 #ifdef DBG_PREFS_HASH
                dbg_PrintHash(Hash, PrintPref, NULL);
 #endif
-               HashPos = GetNewHashPos();
+               HashPos = GetNewHashPos(Hash, 0);
                while (GetNextHashPos(Hash, HashPos, &len, &Key, &Value)!=0)
                {
                        size_t nchars;
diff --git a/webcit/static/t/msg_listselector.html b/webcit/static/t/msg_listselector.html
new file mode 100644 (file)
index 0000000..ef6bd03
--- /dev/null
@@ -0,0 +1,23 @@
+<form name="msgomatictop" class="selector_top" >
+<p><?_("Reading #")>
+<select name="whichones" size="1" 
+       OnChange="location.href=msgomatictop.whichones.options[selectedIndex].value">
+<?CONTEXTSTR>
+</select>
+
+<input type="radio" name="direction" value="" 
+  OnChange="location.href='<?URLPART(1)>?SortBy=date&SortOrder=0'"
+  <?%("COND:BSTR", 1, "SortOrder", 1, "", "checked")>
+>
+<?_("oldest to newest")> 
+
+&nbsp;&nbsp;&nbsp;&nbsp;
+
+<input type="radio" name="direction" value="" 
+  OnChange="location.href='<?URLPART(1)>?SortBy=date&SortOrder=1'"
+  <?%("COND:BSTR", 1, "SortOrder", 1, "checked", "")>
+>
+<?_("newest to oldest")>
+</p>
+</form>
+
diff --git a/webcit/static/t/select_messageindex.html b/webcit/static/t/select_messageindex.html
new file mode 100644 (file)
index 0000000..a6db1fb
--- /dev/null
@@ -0,0 +1 @@
+<option <?%("COND:LONGVECTOR", 1, 1, 6, "selected", "")> value="<?URLPART(1)>&startmsg=<?LONGVECTOR(6)>&maxmsgs=<?LONGVECTOR(4)>&is_summary=0&SortBy=date&SortOrder=<?BSTR("SortOrder")>"><?LONGVECTOR(4)>-<?LONGVECTOR(5)></option>
diff --git a/webcit/static/t/select_messageindex_all.html b/webcit/static/t/select_messageindex_all.html
new file mode 100644 (file)
index 0000000..2a69b1c
--- /dev/null
@@ -0,0 +1 @@
+<option <?%("COND:LONGVECTOR", 1, 1, 6, "selected", "")> value="<?URLPART(1)>&startmsg=<?LONGVECTOR(6)>&maxmsgs=9999999&is_summary=0&SortBy=date&SortOrder=<?BSTR("SortOrder")>"><?_("All")></option>
index ce0cd8d1b95bf599b52d7b650fe0e736cd2123c9..2593732906661027b9f5d6b782de491d6d8a3ada 100644 (file)
@@ -1556,7 +1556,7 @@ void tmpl_iterate_subtmpl(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, vo
                List = It->StaticList;
 
        SubBuf = NewStrBuf();
-       it = GetNewHashPos();
+       it = GetNewHashPos(List, 0);
        while (GetNextHashPos(List, it, &len, &Key, &vContext)) {
                svprintf(HKEY("ITERATE:ODDEVEN"), WCS_STRING, "%s", 
                         (oddeven) ? "odd" : "even");
@@ -2075,6 +2075,91 @@ void tmplput_SORT_ORDER(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void
 }
 
 
+void tmplput_long_vector(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+       long *LongVector = (long*) Context;
+
+       if ((Tokens->Params[0]->Type == TYPE_LONG) && 
+           (Tokens->Params[0]->lvalue <= LongVector[0]))
+       {
+               StrBufAppendPrintf(Target, "%ld", LongVector[Tokens->Params[0]->lvalue]);
+       }
+       else
+       {
+               if (Tokens->Params[0]->Type == TYPE_LONG) {
+                       lprintf(1, "longvector [%s] (in '%s' line %ld); needs a long Parameter![%s]\n", 
+                               Tokens->Params[0]->Start,
+                               ChrPtr(Tokens->FileName),
+                               Tokens->Line,
+                               ChrPtr(Tokens->FlatToken));
+                       StrBufAppendPrintf(
+                               Target, 
+                               "<pre>\nlongvector [%s] (in '%s' line %ld); needs a numerical Parameter!\n[%s]\n</pre>\n", 
+                               Tokens->Params[0]->Start,
+                               ChrPtr(Tokens->FileName),
+                               Tokens->Line,
+                               ChrPtr(Tokens->FlatToken));
+               }
+               else {
+                       lprintf(1, "longvector [%s] (in '%s' line %ld); doesn't have %ld Parameters,"
+                               " its just the size of %ld![%s]\n", 
+                               Tokens->Params[0]->Start,
+                               ChrPtr(Tokens->FileName),
+                               Tokens->Line,
+                               Tokens->Params[0]->lvalue,
+                               LongVector[0],
+                               ChrPtr(Tokens->FlatToken));
+                       StrBufAppendPrintf(
+                               Target, 
+                               "<pre>\nlongvector [%s] (in '%s' line %ld); doesn't have %ld Parameters,"
+                               " its just the size of %ld!\n[%s]\n</pre>\n", 
+                               Tokens->Params[0]->Start,
+                               ChrPtr(Tokens->FileName),
+                               Tokens->Line,
+                               Tokens->Params[0]->lvalue,
+                               LongVector[0],
+                               ChrPtr(Tokens->FlatToken));             
+               }
+       }
+}
+
+
+
+int ConditionalLongVector(WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+       long *LongVector = (long*) Context;
+
+       if ((Tokens->Params[2]->Type == TYPE_LONG) && 
+           (Tokens->Params[2]->lvalue <= LongVector[0])&&
+           (Tokens->Params[3]->Type == TYPE_LONG) && 
+           (Tokens->Params[3]->lvalue <= LongVector[0]))
+       {
+               return LongVector[Tokens->Params[2]->lvalue] == LongVector[Tokens->Params[3]->lvalue];
+       }
+       else
+       {
+               if ((Tokens->Params[2]->Type == TYPE_LONG) ||
+                   (Tokens->Params[2]->Type == TYPE_LONG)) {
+                       lprintf(1, "ConditionalLongVector [%s] (in '%s' line %ld); needs two long Parameter![%s]\n", 
+                               Tokens->Params[0]->Start,
+                               ChrPtr(Tokens->FileName),
+                               Tokens->Line,
+                               ChrPtr(Tokens->FlatToken));
+               }
+               else {
+                       lprintf(1, "longvector [%s] (in '%s' line %ld); doesn't have %ld / %ld Parameters,"
+                               " its just the size of %ld![%s]\n", 
+                               Tokens->Params[0]->Start,
+                               ChrPtr(Tokens->FileName),
+                               Tokens->Line,
+                               Tokens->Params[2]->lvalue,
+                               Tokens->Params[3]->lvalue,
+                               LongVector[0],
+                               ChrPtr(Tokens->FlatToken));
+               }
+       }
+       return 0;
+}
 
 void 
 InitModule_SUBST
@@ -2087,8 +2172,10 @@ InitModule_SUBST
        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);
+       RegisterNamespace("LONGVECTOR", 1, 1, tmplput_long_vector, CTX_LONGVECTOR);
        RegisterConditional(HKEY("COND:SUBST"), 3, ConditionalVar, CTX_NONE);
        RegisterConditional(HKEY("COND:CONTEXTSTR"), 3, ConditionalContextStr, CTX_STRBUF);
+       RegisterConditional(HKEY("COND:LONGVECTOR"), 4, ConditionalLongVector, CTX_LONGVECTOR);
 }
 
 /*@}*/
index c18b57b81b05a08a2ef590dbded5a9680e7ee25a..41d2aa025828dfd6b2fd70b74752122c0bf4a9ce 100644 (file)
@@ -98,7 +98,7 @@ void tasks_section(void) {
                wprintf("</i><br />\n");
        }
        else {
-               at = GetNewHashPos();
+               at = GetNewHashPos(WCC->summ, 0);
                while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                        Msg = (message_summary*) vMsg;          
                        display_task(Msg, 0);
@@ -138,7 +138,7 @@ void calendar_section(void) {
                wprintf("</i><br />\n");
        }
        else {
-               at = GetNewHashPos();
+               at = GetNewHashPos(WCC->summ, 0);
                while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                        Msg = (message_summary*) vMsg;          
                        load_calendar_item(Msg, 0, &c);
index 24d0de34858536f38c9f8008527f1e70eec30dbe..095082ccb8b55a5998de9b9348b0c462fa0f2c7d 100644 (file)
@@ -171,7 +171,7 @@ void dump_vars(void)
        const char *HKey;
        HashPos *Cursor;
        
-       Cursor = GetNewHashPos ();
+       Cursor = GetNewHashPos (WCC->urlstrings, 0);
        while (GetNextHashPos(WCC->urlstrings, Cursor, &HKLen, &HKey, &U)) {
                u = (urlcontent*) U;
                wprintf("%38s = %s\n", u->url_key, ChrPtr(u->url_data));
@@ -1948,7 +1948,21 @@ void tmplput_csslocal(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *
                        csslocal, 0);
 }
 
+void tmplput_url_part(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
+{
+       StrBuf *UrlBuf;
+       struct wcsession *WCC = WC;
+       
+       if (WCC != NULL) {
+               if (Tokens->Params[0]->lvalue == 0)
+                       UrlBuf = WCC->UrlFragment1;
+               else
+                       UrlBuf = WCC->UrlFragment2;
 
+               StrBufAppendTemplate(Target, nArgs, Tokens, Context, ContextType,
+                                    UrlBuf, 1);
+       }
+}
 
 
 
@@ -1973,6 +1987,7 @@ InitModule_WEBCIT
        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("URLPART", 1, 2, tmplput_url_part, CTX_NONE);
        RegisterNamespace("CSSLOCAL", 0, 0, tmplput_csslocal, CTX_NONE);
        RegisterNamespace("IMPORTANTMESSAGE", 0, 0, tmplput_importantmessage, CTX_NONE);
        RegisterNamespace("OFFERSTARTPAGE", 0, 0, offer_start_page, CTX_NONE);
index 4e2e3f016abcbd20038bc7ffce9ce90130c2f411..1303daf8b732271c4ded77cb02cc94c31c2c0cf0 100644 (file)
@@ -321,6 +321,8 @@ typedef struct _wcsubst {
 #define CTX_MIME_ATACH 10
 #define CTX_ATT 11
 #define CTX_STRBUF 12
+#define CTX_LONGVECTOR 13
+
 
 void RegisterNS(const char *NSName, long len, 
                int nMinArgs,