Back to index

webcit  8.12-dfsg
Functions | Variables
roomviews.c File Reference
#include "webcit.h"
#include "webserver.h"

Go to the source code of this file.

Functions

void initialize_viewdefs (void)
void tmplput_ROOM_COLLECTIONTYPE (StrBuf *Target, WCTemplputParams *TP)
int ConditionalRoomHasGroupdavContent (StrBuf *Target, WCTemplputParams *TP)
int ConditionalIsRoomtype (StrBuf *Target, WCTemplputParams *TP)
void tmplput_CurrentRoomViewString (StrBuf *Target, WCTemplputParams *TP)
void tmplput_RoomViewString (StrBuf *Target, WCTemplputParams *TP)
int ConditionalIsAllowedDefaultView (StrBuf *Target, WCTemplputParams *TP)
int ConditionalThisRoomDefView (StrBuf *Target, WCTemplputParams *TP)
int ConditionalThisRoomCurrView (StrBuf *Target, WCTemplputParams *TP)
int ConditionalThisRoomHaveView (StrBuf *Target, WCTemplputParams *TP)
void tmplput_ROOM_VIEW (StrBuf *Target, WCTemplputParams *TP)
void tmplput_ROOM_DEFVIEW (StrBuf *Target, WCTemplputParams *TP)
void tmplput_CurrentRoomDefView (StrBuf *Target, WCTemplputParams *TP)
void InitModule_ROOMVIEWS (void)

Variables

char * viewdefs [VIEW_MAX]
ROOM_VIEWS allowed_default_views [VIEW_MAX]
ROOM_VIEWS exchangeable_views [VIEW_MAX][VIEW_MAX]

Function Documentation

int ConditionalIsAllowedDefaultView ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 165 of file roomviews.c.

{
       wcsession *WCC = WC;
       long CheckThis;
       
       if (WCC == NULL)
              return 0;

       CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
       if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
       {
              LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
                             "Roomview [%ld] not valid\n", 
                             CheckThis);
              return 0;
       }

       return allowed_default_views[CheckThis] != 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ConditionalIsRoomtype ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 108 of file roomviews.c.

{
       wcsession *WCC = WC;

       if ((WCC == NULL) ||
           (TP->Tokens->nParameters < 3))
       {
              return ((WCC->CurRoom.view < VIEW_BBS) || 
                     (WCC->CurRoom.view > VIEW_MAX));
       }

       return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ConditionalRoomHasGroupdavContent ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 92 of file roomviews.c.

{
       folder *Folder = (folder *)CTX;

       syslog(0, "-> %s: %d\n", ChrPtr(Folder->name), Folder->view);

       return ((Folder->view == VIEW_CALENDAR) || 
              (Folder->view == VIEW_TASKS) || 
              (Folder->view == VIEW_ADDRESSBOOK) ||
              (Folder->view == VIEW_NOTES) ||
              (Folder->view == VIEW_JOURNAL) );
}

Here is the caller graph for this function:

int ConditionalThisRoomCurrView ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 197 of file roomviews.c.

{
       wcsession *WCC = WC;
       long CheckThis;

       if (WCC == NULL)
              return 0;

       CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
       return CheckThis == WCC->CurRoom.view;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ConditionalThisRoomDefView ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 185 of file roomviews.c.

{
       wcsession *WCC = WC;
       long CheckThis;

       if (WCC == NULL)
              return 0;

       CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
       return CheckThis == WCC->CurRoom.defview;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ConditionalThisRoomHaveView ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 209 of file roomviews.c.

{
       wcsession *WCC = WC;
       long CheckThis;
       
       if (WCC == NULL)
              return 0;

       CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
       if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
       {
              LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
                             "Roomview [%ld] not valid\n", 
                             CheckThis);
              return 0;
       }

       return exchangeable_views [WCC->CurRoom.defview][CheckThis] ;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void initialize_viewdefs ( void  )

Definition at line 49 of file roomviews.c.

                               {
       viewdefs[VIEW_BBS]          = _("Bulletin Board");
       viewdefs[VIEW_MAILBOX]             = _("Mail Folder");
       viewdefs[VIEW_ADDRESSBOOK]  = _("Address Book");
       viewdefs[VIEW_CALENDAR]            = _("Calendar");
       viewdefs[VIEW_TASKS]        = _("Task List");
       viewdefs[VIEW_NOTES]        = _("Notes List");
       viewdefs[VIEW_WIKI]         = _("Wiki");
       viewdefs[VIEW_CALBRIEF]            = _("Calendar List");
       viewdefs[VIEW_JOURNAL]             = _("Journal");
       viewdefs[VIEW_DRAFTS]              = _("Drafts");
       viewdefs[VIEW_BLOG]         = _("Blog");
}

Here is the caller graph for this function:

void InitModule_ROOMVIEWS ( void  )

Definition at line 250 of file roomviews.c.

{
       initialize_viewdefs();

       RegisterNamespace("THISROOM:VIEW_STRING", 0, 1, tmplput_CurrentRoomViewString, NULL, CTX_NONE);
       RegisterNamespace("ROOM:VIEW_STRING", 1, 2, tmplput_RoomViewString, NULL, CTX_NONE);

       RegisterConditional(HKEY("COND:ALLOWED_DEFAULT_VIEW"), 0, ConditionalIsAllowedDefaultView, CTX_NONE);
       RegisterConditional(HKEY("COND:THISROOM:DEFAULT_VIEW"), 0, ConditionalThisRoomDefView, CTX_NONE);
       RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE);
       RegisterNamespace("ROOM:INFO:DEFVIEW", 0, 1, tmplput_ROOM_DEFVIEW, NULL, CTX_ROOMS);

       RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);

       RegisterConditional(HKEY("COND:THISROOM:HAVE_VIEW"), 0, ConditionalThisRoomHaveView, CTX_NONE);
       RegisterConditional(HKEY("COND:ROOM:dav_CONTENT"), 0, ConditionalRoomHasGroupdavContent, CTX_ROOMS);

       RegisterConditional(HKEY("COND:THISROOM:CURR_VIEW"), 0, ConditionalThisRoomCurrView, CTX_NONE);
       RegisterNamespace("ROOM:INFO:VIEW", 0, 1, tmplput_ROOM_VIEW, NULL, CTX_ROOMS);

       RegisterNamespace("ROOM:INFO:COLLECTIONTYPE", 0, 1, tmplput_ROOM_COLLECTIONTYPE, NULL, CTX_ROOMS);



}

Here is the call graph for this function:

Here is the caller graph for this function:

void tmplput_CurrentRoomDefView ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 241 of file roomviews.c.

{
       wcsession *WCC = WC;

       StrBufAppendPrintf(Target, "%d", WCC->CurRoom.defview);
}

Here is the caller graph for this function:

void tmplput_CurrentRoomViewString ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 123 of file roomviews.c.

{
       wcsession *WCC = WC;
       StrBuf *Buf;

       if ((WCC == NULL) ||
           (WCC->CurRoom.defview >= VIEW_MAX) || 
           (WCC->CurRoom.defview < VIEW_BBS))
       {
              LogTemplateError(Target, "Token", ERR_PARM2, TP,
                             "Roomview [%ld] not valid\n", 
                             (WCC != NULL)? 
                             WCC->CurRoom.defview : -1);
              return;
       }

       Buf = NewStrBufPlain(_(viewdefs[WCC->CurRoom.defview]), -1);
       StrBufAppendTemplate(Target, TP, Buf, 0);
       FreeStrBuf(&Buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tmplput_ROOM_COLLECTIONTYPE ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 64 of file roomviews.c.

{
       folder *Folder = (folder *)CTX;
       
       switch(Folder->view) {
       case VIEW_CALENDAR:
              StrBufAppendBufPlain(Target, HKEY("vevent"), 0);
              break;
       case VIEW_TASKS:
              StrBufAppendBufPlain(Target, HKEY("vtodo"), 0);
              break;
       case VIEW_ADDRESSBOOK:
              StrBufAppendBufPlain(Target, HKEY("vcard"), 0);
              break;
       case VIEW_NOTES:
              StrBufAppendBufPlain(Target, HKEY("vnotes"), 0);
              break;
       case VIEW_JOURNAL:
              StrBufAppendBufPlain(Target, HKEY("vjournal"), 0);
              break;
       case VIEW_WIKI:
              StrBufAppendBufPlain(Target, HKEY("wiki"), 0);
              break;
       }
}

Here is the caller graph for this function:

void tmplput_ROOM_DEFVIEW ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 234 of file roomviews.c.

{
       folder *Folder = (folder *)CTX;
       StrBufAppendPrintf(Target, "%d", Folder->defview);
}

Here is the caller graph for this function:

void tmplput_ROOM_VIEW ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 229 of file roomviews.c.

{
       folder *Folder = (folder *)CTX;
       StrBufAppendPrintf(Target, "%d", Folder->view);
}

Here is the caller graph for this function:

void tmplput_RoomViewString ( StrBuf *  Target,
WCTemplputParams TP 
)

Definition at line 144 of file roomviews.c.

{
       long CheckThis;
       StrBuf *Buf;

       CheckThis = GetTemplateTokenNumber(Target, TP, 0, 0);
       if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
       {
              LogTemplateError(Target, "Token", ERR_PARM2, TP,
                             "Roomview [%ld] not valid\n", 
                             CheckThis);
              return;
       }

       Buf = NewStrBufPlain(_(viewdefs[CheckThis]), -1);
       StrBufAppendTemplate(Target, TP, Buf, 0);
       FreeStrBuf(&Buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

ROOM_VIEWS allowed_default_views[VIEW_MAX]
Initial value:
 {
       1, 
       1, 
       1, 
       1, 
       1, 
       1, 
       1, 
       0, 
       0, 
       0, 
       1  
}

Definition at line 14 of file roomviews.c.

ROOM_VIEWS exchangeable_views[VIEW_MAX][VIEW_MAX]
Initial value:
 {
       { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 },      
       { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 },      
       { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },      
       { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },      
       { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },      
       { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },      
       { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 },      
       { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },      
       { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 },      
       { 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1 },      
       { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }       
}

Definition at line 32 of file roomviews.c.

char* viewdefs[VIEW_MAX]

Definition at line 8 of file roomviews.c.