Got rid of all of the .m.html templates and is_mobile cruft
[citadel.git] / webcit / subst.c
index 3a9d26169f6142024c90f1d8338b76f08a23e011..67d5de31437099085f45823104af659310f58ba4 100644 (file)
@@ -529,7 +529,7 @@ void GetTemplateTokenString(StrBuf *Target,
                *Value = ChrPtr(Buf);
                *len = StrLength(Buf);
                /* we can't free it here, so we put it into the subst so its discarded later on. */
-               ///SVPUTBuf(TKEY(N), Buf, 0);
+               PutRequestLocalMem(Buf, HFreeStrBuf);
                break;
 
        default:
@@ -1225,7 +1225,7 @@ void *load_template(WCTemplate *NewTemplate)
        NewTemplate->Data = NewStrBufPlain(NULL, statbuf.st_size + 1);
        if (StrBufReadBLOB(NewTemplate->Data, &fd, 1, statbuf.st_size, &Err) < 0) {
                close(fd);
-               lprintf(1, "ERROR: reading template '%s' - %s<br />\n",
+               lprintf(1, "ERROR: reading template '%s' - %s<br>\n",
                        ChrPtr(NewTemplate->FileName), strerror(errno));
                //FreeWCTemplate(NewTemplate);/////tODO
                return NULL;
@@ -1681,14 +1681,8 @@ const StrBuf *DoTemplate(const char *templatename, long len, StrBuf *Target, WCT
                TP = &LocalTP;
        }
 
-       if (WC->is_mobile > 0) {
-               Static = WirelessTemplateCache;
-               StaticLocal = WirelessLocalTemplateCache;
-       }
-       else {
-               Static = TemplateCache;
-               StaticLocal = LocalTemplateCache;
-       }
+       Static = TemplateCache;
+       StaticLocal = LocalTemplateCache;
 
        if (len == 0)
        {
@@ -1886,8 +1880,10 @@ void tmpl_iterate_subtmpl(StrBuf *Target, WCTemplputParams *TP)
                        if (GetHash(SortHash, SKEY(BSort), &vSortBy) &&
                            (vSortBy != NULL)) {
                                SortBy = (SortStruct*)vSortBy;
+                               /* first check whether its intended for us... */
+                               if ((SortBy->ContextType == It->ContextType)&&
                                /** Ok, its us, lets see in which direction we should sort... */
-                               if (havebstr("SortOrder")) {
+                                   (havebstr("SortOrder"))) {
                                        int SortOrder;
                                        SortOrder = LBSTR("SortOrder");
                                        if (SortOrder != 0)