From: Wilfried Göesgens Date: Thu, 5 Aug 2010 21:07:38 +0000 (+0000) Subject: * finish off ROOMPIC hard coded callback, thanks the_mgt for starting the template X-Git-Tag: v8.01~959 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=d517bbde0e16f4c6f4352c55ed9b45b9491d7166 * finish off ROOMPIC hard coded callback, thanks the_mgt for starting the template --- diff --git a/libcitadel/lib/libcitadel.h b/libcitadel/lib/libcitadel.h index 3949e8752..e6e097d4e 100644 --- a/libcitadel/lib/libcitadel.h +++ b/libcitadel/lib/libcitadel.h @@ -102,6 +102,8 @@ typedef enum __GPEXWhichPolicy { #define VIEW_WIKI 6 /* Wiki view */ #define VIEW_CALBRIEF 7 /* Brief Calendar view */ #define VIEW_JOURNAL 8 /* Journal view */ +#define VIEW_MAX 8 /* increment me... */ + #define VIEW_BLOG 9 /* Blog view (not yet implemented) */ diff --git a/webcit/roomops.c b/webcit/roomops.c index 6226ada8a..aa771800f 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -276,67 +276,6 @@ void readinfo(StrBuf *Target, WCTemplputParams *TP) } - - -/* - * Display room banner icon. - * The server doesn't actually need the room name, but we supply it in - * order to keep the browser from using a cached icon from another room. - */ -void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP) -{ - char buf[SIZ]; - - serv_puts("OIMG _roompic_"); - serv_getln(buf, sizeof buf); - if (buf[0] == '2') { - wc_printf("CurRoom.name)); - wc_printf("\">"); - serv_puts("CLOS"); - serv_getln(buf, sizeof buf); - } - else if (WC->CurRoom.view == VIEW_ADDRESSBOOK) { - wc_printf("\"\"" - ); - } - else if ( (WC->CurRoom.view == VIEW_CALENDAR) || (WC->CurRoom.view == VIEW_CALBRIEF) ) { - wc_printf("\"\"" - ); - } - else if (WC->CurRoom.view == VIEW_TASKS) { - wc_printf("\"\"" - ); - } - else if (WC->CurRoom.view == VIEW_NOTES) { - wc_printf("\"\"" - ); - } - else if (WC->CurRoom.view == VIEW_MAILBOX) { - wc_printf("\"\"" - ); - } - else { - wc_printf("\"\"" - ); - } - -} - - - /* * Display the current view and offer an option to change it */ @@ -468,7 +407,6 @@ void embed_room_banner(char *got, int navbar_style) { extract_int(&got[4], 2), with_files ); - svcallback("ROOMPIC", embed_room_graphic); svcallback("ROOMINFO", readinfo); svcallback("VIEWOMATIC", embed_view_o_matic); svcallback("SEARCHOMATIC", embed_search_o_matic); @@ -992,6 +930,41 @@ void LoadRoomXA (void) FreeStrBuf (&Buf); } + +void LoadXRoomPic(void) +{ + wcsession *WCC = WC; + StrBuf *Buf; + + if (WCC->CurRoom.XHaveRoomPicLoaded) + return; + + WCC->CurRoom.XHaveRoomPicLoaded = 1; + Buf = NewStrBuf(); + serv_puts("OIMG _roompic_"); + StrBuf_ServGetln(Buf); + if (GetServerStatus(Buf, NULL) != 2) { + WCC->CurRoom.XHaveRoomPic = 0; + } else { + WCC->CurRoom.XHaveRoomPic = 1; + } + serv_puts("CLOS"); + StrBuf_ServGetln(Buf); + GetServerStatus(Buf, NULL); + FreeStrBuf (&Buf); +} + +int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + + if (WCC == NULL) + return 0; + + LoadXRoomPic(); + return WCC->CurRoom.XHaveRoomPic == 1; +} + void tmplput_CurrentRoomPass(StrBuf *Target, WCTemplputParams *TP) { wcsession *WCC = WC; @@ -3389,7 +3362,11 @@ int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP) if ((WCC == NULL) || (TP->Tokens->nParameters < 3)) - return 0; + { + return ((WCC->CurRoom.view < VIEW_BBS) || + (WCC->CurRoom.view > VIEW_MAX)); + } + return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS); } @@ -3490,7 +3467,7 @@ InitModule_ROOMOPS RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE); RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE); RegisterConditional(HKEY("COND:THISROOM:DEFAULT_VIEW"), 0, ConditionalThisRoomDefView, CTX_NONE); - + RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE); REGISTERTokenParamDefine(QR_PERMANENT); REGISTERTokenParamDefine(QR_INUSE); diff --git a/webcit/roomops.h b/webcit/roomops.h index 470220d40..37a9471b7 100644 --- a/webcit/roomops.h +++ b/webcit/roomops.h @@ -100,6 +100,10 @@ typedef struct _folder { int UsersNewMAilboxMessages; /* should we notify the user about new messages? */ int IsTrash; + int XHaveRoomPic; + int XHaveRoomPicLoaded; + + HashList *IgnetCfgs[maxRoomNetCfg]; }folder; diff --git a/webcit/static/t/roombanner.html b/webcit/static/t/roombanner.html index 70b3e8a69..73ffa829d 100644 --- a/webcit/static/t/roombanner.html +++ b/webcit/static/t/roombanner.html @@ -2,7 +2,7 @@