install-wwwdata:
- test -d $(DESTDIR)$(WWWDIR)/static.local || mkdir -p $(DESTDIR)$(WWWDIR)/static.local
- test -d $(DESTDIR)$(WWWDIR)/static || mkdir -p $(DESTDIR)$(WWWDIR)/static
+ test -d $(DESTDIR)$(WWWDIR)/static.local/t || mkdir -p $(DESTDIR)$(WWWDIR)/static.local/t
+ test -d $(DESTDIR)$(WWWDIR)/static/t || mkdir -p $(DESTDIR)$(WWWDIR)/static/t
for i in `find static -type f | grep -v .svn`; do \
$(INSTALL) $$i $(DESTDIR)$(WWWDIR)/$$i; \
done
+++ /dev/null
-<!-- start beginbox.html-->
-<div class="box">
-<div class="boxlabel"><?BOXTITLE></div>
-<div class="boxcontent">
-<!-- end beginbox.html-->
+++ /dev/null
-<!-- start beginbox.html-->
-<div class="box">
-<div class="boxlabel"><?BOXTITLE></div>
-<div class="boxcontent">
-<!-- end beginbox.html-->
+++ /dev/null
-<! start beginbox_nt.html>
-<table border=1 cellspacing=0 cellpadding=0 width=100%><tr><td>
-<table border=0 cellspacing=0 cellpadding=3 width=100%>
-<tr><td bgcolor="#FFFFFF">
-<! end beginbox_nt.html>
+++ /dev/null
-<html>
-<head>
-<title>Real-time chat: <?ROOMNAME></title>
-</head>
-
-<frameset rows="*, 1, 70" framespacing="0" border="false" frameborder="0">
-
- <frame name="chat_transcript" src="about:blank" scrolling="yes">
- </frame>
-
- <frame name="chat_recv" src="chat_recv" scrolling="no">
- </frame>
-
- <frame name="chat_send" src="chat_send" scrolling="no">
- </frame>
-
-</frameset>
-
-<body bgcolor="#ffffff" link="#ff0000">
-<noframes>
-<div align="center">
-This function requires a browser that can support frames.
-</div>
-</noframes>
-</body>
-
-</html>
+++ /dev/null
-</div></div>
+++ /dev/null
-</div></div>
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
-<meta name="MSSmartTagsPreventParsing" content="TRUE" >
-<meta name="keywords" content="groupware messaging collaboration" >
-<link href="static/niftyCorners.css" rel="stylesheet" type="text/css">
-<link href="static/webcit.css" rel="stylesheet" type="text/css">
-<link href="static/datepicker.css" rel="stylesheet" type="text/css">
-<link href="static/bt.css" rel="stylesheet" type="text/css">
-
-<?CSSLOCAL>
-<script type="text/javascript" src="static/prototype.js"></script>
-<script type="text/javascript" src="static/scriptaculous.js"></script>
-<script type="text/javascript" src="static/niftycube.js"></script>
-<script type="text/javascript" src="static/BubbleTooltips.js"></script>
-<script type="text/javascript" src="static/datepicker-dev.js"></script>
-<script type="text/javascript" src="static/table.js"></script>
-<script type="text/javascript" src="static/wclib.js"></script>
-</head>
-<body>
-<div id="global">
-<!-- end head.html -->
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
-<meta name="MSSmartTagsPreventParsing" content="TRUE" >
-<meta name="keywords" content="groupware messaging collaboration" >
-<link href="static/mobile.css" rel="stylesheet" type="text/css">
-<script type="text/javascript" src="static/mobile.js"></script>
-<meta name="viewport" content="width=device-width"/>
-</head>
-<body>
-<div id="global">
-<!-- end head.html -->
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
-<meta name="MSSmartTagsPreventParsing" content="TRUE" >
-<meta name="keywords" content="groupware messaging collaboration" >
-<link href="/static/mobile.css" rel="stylesheet" type="text/css">
-<script type="text/javascript" src="/static/mobile.js"></script>
-<meta name="viewport" content="width=980, initial-scale = 0.5"/>
-<base href="/"/>
-</head>
-<body>
-<div class="sticky">
- <div class="mcontrols">
- <button onmousedown="history.go(-1)">Back to message list</button> <button>Reply to this
- message</button> <button>Move to trash</button>
- </div>
-</div>
-<div id="vcontent">
+++ /dev/null
-<! newstartpage.html start>
-<div class="room_banner" >
-<div align=center >
-<h1>New start page</h1>
-
-</div></div>
-<div id="content">
-<div align=center>
-<font size=+2>Your start page has been changed.</font> </div>
-<br /><br />
-<div align=center>
-<i>(Note: this does not change your browser's home page.
-It changes the page you begin on when you log on to <?SERV_HUMANNODE>).</i>
-<br /><br />
-
-<a href="javascript:history.back()">Back...</a>
-</div>
-</div>
-<! newstartpage.html end>
\ No newline at end of file
+++ /dev/null
-<?=beginbox>
-<?HELLO>
-<div class="login_message"><?MESG></div>
-<form action="openid_login" method="POST" class="box" id="login_form">
- <label for="uname"><?OPENID_BOX></label>
- <input type="text" name="openid_url" id="uname" class="openid_urlarea"> <br>
- <label for="lname"><?LANGUAGE_BOX></label>
- <?DO_LANGUAGE_BOX> <br>
- <div class="logbuttons">
- <input type="submit" name="login_action" value="<?LOGIN_BUTTON>" class="logbutton">
- <input type="submit" name="exit_action" value="<?EXIT_BUTTON>" class="logbutton">
- <br>
- </div>
-</form>
-<?OFFER_CONVENTIONAL_LOGIN>
-<div class="login_image"><img src="image&name=hello"></div>
-<div class="login_infos"><?LOGIN_INSTRUCTIONS></div>
-<?=endbox>
+++ /dev/null
-<?=beginbox>
-<?HELLO>
-<div class="login_infos">
- <img src="static/openid-small.gif"><?VERIFIED><br />
- <?REASON><br />
- <?ACTION_REQUESTED><br />
-</div>
-<form action="openid_manual_create" method="POST" class="box" id="login_form">
- <input type="hidden" NAME="openid_url" VALUE="<?CLAIMED_ID>">
- <label for="uname"><?USERNAME_BOX></label>
- <input type="text" name="name" id="uname" > <br>
- <div class="logbuttons">
- <input type="submit" name="newuser_action" value="<?NEWUSER_BUTTON>" class="logbutton" >
- <input type="submit" name="exit_action" value="<?EXIT_BUTTON>" class="logbutton">
- <br>
- </div>
-</form>
-<?=endbox>
+++ /dev/null
- <div id="banner">
- <h1>Configure Push Email</h1>
- </div>
-
- <div id="content" class="config_service">
- <!-- NOT beginbox -->
- <div class="box">
- <div class="boxlabel"><?BOXTITLE></div>
- <div class="boxcontent">
- <!-- still not begin box -->
- <!-- Begin Push email configure -->
-
- <div id="pushemail">
- <div class="instructions">
- <p>If your administrator has enabled the functionality, Citadel can notify a
- Funambol server that you haved recieved new email and automatically syncronize
- any devices you have with the Funambol client installed.</p>
-
- <p>Alternatively, if the administrator has configured it, Citadel can send a
- text message to you when new mail arrives.</p>
- </div>
-
- <form id="pushconfig" method="post" action="save_pushemail">
- <p class="option"><input type="radio" name="pushsetting" value=
- "funambol" <?PUSH_FNBL>><strong>Notify Funambol server</strong></p>
-
- <p class="option"><input type="radio" name="pushsetting" value=
- "textmessage" <?PUSH_TEXT>><strong>Send a text message</strong> to... <input type="text"
- name="user_sms_number" size="20" <?SMSNUM> > (Use international format, without any
- leading zeros, spaces or hypens, like +61415011501)</p>
-
- <p class="option"><input type="radio" name="pushsetting" value=
- "none" <?PUSH_NONE>><strong>Don't send any notifications</strong></p>
-
- <p><input type="submit" name="submit" value="Save settings"></p>
- </form>
- <br>
- <br>
- </div>
- </div>
- </div>
+++ /dev/null
-<!-- start roombanner.html -->
-<div class="room_banner" >
-<?ROOMPIC>
-<h1><?ROOMNAME></h1>
-<?ROOMINFO>
-<p class="nummsgs"><?NUMMSGS></p>
-</div>
-<ul class="room_actions">
-<li class="start_page"><?START></li>
-<li class="search"><?SEARCHOMATIC></li>
-<li class="view"><?VIEWOMATIC></li>
-</ul>
-<!-- end roombanner.html -->
+++ /dev/null
-<!-- start roombanner.html -->
-<div class="room_banner" >
-<h1 class="roomname"><?ROOMPIC> <?ROOMNAME></h1>
-<p><?ROOMINFO> <?NUMMSGS></p>
-<p><?START> <?SEARCHOMATIC></p>
-</div>
-<!-- end roombanner.html -->
--- /dev/null
+<!-- start beginbox.html-->
+<div class="box">
+<div class="boxlabel"><?BOXTITLE></div>
+<div class="boxcontent">
+<!-- end beginbox.html-->
--- /dev/null
+<!-- start beginbox.html-->
+<div class="box">
+<div class="boxlabel"><?BOXTITLE></div>
+<div class="boxcontent">
+<!-- end beginbox.html-->
--- /dev/null
+<! start beginbox_nt.html>
+<table border=1 cellspacing=0 cellpadding=0 width=100%><tr><td>
+<table border=0 cellspacing=0 cellpadding=3 width=100%>
+<tr><td bgcolor="#FFFFFF">
+<! end beginbox_nt.html>
--- /dev/null
+<html>
+<head>
+<title>Real-time chat: <?ROOMNAME></title>
+</head>
+
+<frameset rows="*, 1, 70" framespacing="0" border="false" frameborder="0">
+
+ <frame name="chat_transcript" src="about:blank" scrolling="yes">
+ </frame>
+
+ <frame name="chat_recv" src="chat_recv" scrolling="no">
+ </frame>
+
+ <frame name="chat_send" src="chat_send" scrolling="no">
+ </frame>
+
+</frameset>
+
+<body bgcolor="#ffffff" link="#ff0000">
+<noframes>
+<div align="center">
+This function requires a browser that can support frames.
+</div>
+</noframes>
+</body>
+
+</html>
--- /dev/null
+</div></div>
--- /dev/null
+</div></div>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
+<meta name="MSSmartTagsPreventParsing" content="TRUE" >
+<meta name="keywords" content="groupware messaging collaboration" >
+<link href="static/niftyCorners.css" rel="stylesheet" type="text/css">
+<link href="static/webcit.css" rel="stylesheet" type="text/css">
+<link href="static/datepicker.css" rel="stylesheet" type="text/css">
+<link href="static/bt.css" rel="stylesheet" type="text/css">
+
+<?CSSLOCAL>
+<script type="text/javascript" src="static/prototype.js"></script>
+<script type="text/javascript" src="static/scriptaculous.js"></script>
+<script type="text/javascript" src="static/niftycube.js"></script>
+<script type="text/javascript" src="static/BubbleTooltips.js"></script>
+<script type="text/javascript" src="static/datepicker-dev.js"></script>
+<script type="text/javascript" src="static/table.js"></script>
+<script type="text/javascript" src="static/wclib.js"></script>
+</head>
+<body>
+<div id="global">
+<!-- end head.html -->
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
+<meta name="MSSmartTagsPreventParsing" content="TRUE" >
+<meta name="keywords" content="groupware messaging collaboration" >
+<link href="static/mobile.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="static/mobile.js"></script>
+<meta name="viewport" content="width=device-width"/>
+</head>
+<body>
+<div id="global">
+<!-- end head.html -->
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title><?CURRENT_USER> - <?SERV_HUMANNODE></title>
+<meta name="MSSmartTagsPreventParsing" content="TRUE" >
+<meta name="keywords" content="groupware messaging collaboration" >
+<link href="/static/mobile.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="/static/mobile.js"></script>
+<meta name="viewport" content="width=980, initial-scale = 0.5"/>
+<base href="/"/>
+</head>
+<body>
+<div class="sticky">
+ <div class="mcontrols">
+ <button onmousedown="history.go(-1)">Back to message list</button> <button>Reply to this
+ message</button> <button>Move to trash</button>
+ </div>
+</div>
+<div id="vcontent">
--- /dev/null
+<! newstartpage.html start>
+<div class="room_banner" >
+<div align=center >
+<h1>New start page</h1>
+
+</div></div>
+<div id="content">
+<div align=center>
+<font size=+2>Your start page has been changed.</font> </div>
+<br /><br />
+<div align=center>
+<i>(Note: this does not change your browser's home page.
+It changes the page you begin on when you log on to <?SERV_HUMANNODE>).</i>
+<br /><br />
+
+<a href="javascript:history.back()">Back...</a>
+</div>
+</div>
+<! newstartpage.html end>
\ No newline at end of file
--- /dev/null
+<?=beginbox>
+<?HELLO>
+<div class="login_message"><?MESG></div>
+<form action="openid_login" method="POST" class="box" id="login_form">
+ <label for="uname"><?OPENID_BOX></label>
+ <input type="text" name="openid_url" id="uname" class="openid_urlarea"> <br>
+ <label for="lname"><?LANGUAGE_BOX></label>
+ <?DO_LANGUAGE_BOX> <br>
+ <div class="logbuttons">
+ <input type="submit" name="login_action" value="<?LOGIN_BUTTON>" class="logbutton">
+ <input type="submit" name="exit_action" value="<?EXIT_BUTTON>" class="logbutton">
+ <br>
+ </div>
+</form>
+<?OFFER_CONVENTIONAL_LOGIN>
+<div class="login_image"><img src="image&name=hello"></div>
+<div class="login_infos"><?LOGIN_INSTRUCTIONS></div>
+<?=endbox>
--- /dev/null
+<?=beginbox>
+<?HELLO>
+<div class="login_infos">
+ <img src="static/openid-small.gif"><?VERIFIED><br />
+ <?REASON><br />
+ <?ACTION_REQUESTED><br />
+</div>
+<form action="openid_manual_create" method="POST" class="box" id="login_form">
+ <input type="hidden" NAME="openid_url" VALUE="<?CLAIMED_ID>">
+ <label for="uname"><?USERNAME_BOX></label>
+ <input type="text" name="name" id="uname" > <br>
+ <div class="logbuttons">
+ <input type="submit" name="newuser_action" value="<?NEWUSER_BUTTON>" class="logbutton" >
+ <input type="submit" name="exit_action" value="<?EXIT_BUTTON>" class="logbutton">
+ <br>
+ </div>
+</form>
+<?=endbox>
--- /dev/null
+ <div id="banner">
+ <h1>Configure Push Email</h1>
+ </div>
+
+ <div id="content" class="config_service">
+ <!-- NOT beginbox -->
+ <div class="box">
+ <div class="boxlabel"><?BOXTITLE></div>
+ <div class="boxcontent">
+ <!-- still not begin box -->
+ <!-- Begin Push email configure -->
+
+ <div id="pushemail">
+ <div class="instructions">
+ <p>If your administrator has enabled the functionality, Citadel can notify a
+ Funambol server that you haved recieved new email and automatically syncronize
+ any devices you have with the Funambol client installed.</p>
+
+ <p>Alternatively, if the administrator has configured it, Citadel can send a
+ text message to you when new mail arrives.</p>
+ </div>
+
+ <form id="pushconfig" method="post" action="save_pushemail">
+ <p class="option"><input type="radio" name="pushsetting" value=
+ "funambol" <?PUSH_FNBL>><strong>Notify Funambol server</strong></p>
+
+ <p class="option"><input type="radio" name="pushsetting" value=
+ "textmessage" <?PUSH_TEXT>><strong>Send a text message</strong> to... <input type="text"
+ name="user_sms_number" size="20" <?SMSNUM> > (Use international format, without any
+ leading zeros, spaces or hypens, like +61415011501)</p>
+
+ <p class="option"><input type="radio" name="pushsetting" value=
+ "none" <?PUSH_NONE>><strong>Don't send any notifications</strong></p>
+
+ <p><input type="submit" name="submit" value="Save settings"></p>
+ </form>
+ <br>
+ <br>
+ </div>
+ </div>
+ </div>
--- /dev/null
+<!-- start roombanner.html -->
+<div class="room_banner" >
+<?ROOMPIC>
+<h1><?ROOMNAME></h1>
+<?ROOMINFO>
+<p class="nummsgs"><?NUMMSGS></p>
+</div>
+<ul class="room_actions">
+<li class="start_page"><?START></li>
+<li class="search"><?SEARCHOMATIC></li>
+<li class="view"><?VIEWOMATIC></li>
+</ul>
+<!-- end roombanner.html -->
--- /dev/null
+<!-- start roombanner.html -->
+<div class="room_banner" >
+<h1 class="roomname"><?ROOMPIC> <?ROOMNAME></h1>
+<p><?ROOMINFO> <?NUMMSGS></p>
+<p><?START> <?SEARCHOMATIC></p>
+</div>
+<!-- end roombanner.html -->
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <dirent.h>
+#include <errno.h>
#include "webcit.h"
#include "webserver.h"
* \brief Display a variable-substituted template
* \param templatename template file to load
*/
-void *load_template(const char *templatename, long len) {
- HashList *pCache;
- HashList *Static;
- HashList *StaticLocal;
- StrBuf *flat_filename;
- char filename[PATH_MAX];
+void *load_template(StrBuf *filename, StrBuf *Key, HashList *PutThere)
+{
int fd;
struct stat statbuf;
const char *pS, *pE, *pch, *Err;
int pos;
- struct stat mystat;
WCTemplate *NewTemplate;
- flat_filename = NewStrBufPlain(templatename, len);
- if (WC->is_mobile) {
- Static = WirelessTemplateCache;
- StaticLocal = WirelessLocalTemplateCache;
- StrBufAppendBufPlain(flat_filename, HKEY(".m.html"), 0);
- }
- else {
- Static = TemplateCache;
- StaticLocal = LocalTemplateCache;
- StrBufAppendBufPlain(flat_filename, HKEY(".html"), 0);
- }
-
- strcpy(filename, static_dirs[1]);
- strcat(filename, ChrPtr(flat_filename));
- pCache = StaticLocal;
- if (stat(filename, &mystat) == -1)
- {
- pCache = Static;
- strcpy(filename, static_dirs[0]);
- strcat(filename, ChrPtr(flat_filename));
- }
-
- fd = open(filename, O_RDONLY);
+ fd = open(ChrPtr(filename), O_RDONLY);
if (fd <= 0) {
wprintf(_("ERROR: could not open template "));
wprintf("'%s' - %s<br />\n",
- (const char*)templatename, strerror(errno));
+ ChrPtr(filename), strerror(errno));
return NULL;
}
if (fstat(fd, &statbuf) == -1) {
wprintf(_("ERROR: could not stat template "));
wprintf("'%s' - %s<br />\n",
- (const char*)templatename, strerror(errno));
+ ChrPtr(filename), strerror(errno));
return NULL;
}
FreeWCTemplate(NewTemplate);
wprintf(_("ERROR: reading template "));
wprintf("'%s' - %s<br />\n",
- (const char*)templatename, strerror(errno));
+ ChrPtr(filename), strerror(errno));
return NULL;
}
close(fd);
PutNewToken(NewTemplate, NewTemlpateSubstitute(pS, pts, pte));
pch ++;
}
- Put(pCache, filename, strlen(filename), NewTemplate, FreeWCTemplate);
+ Put(PutThere, ChrPtr(Key), StrLength(Key), NewTemplate, FreeWCTemplate);
return NewTemplate;
}
if (!GetHash(StaticLocal, templatename, len, &vTmpl) &&
!GetHash(Static, templatename, len, &vTmpl)) {
- vTmpl = load_template(templatename, len);
- //////TODO: lock this!
+ printf ("didn't find %s\n", templatename);
+ return;
}
if (vTmpl == NULL)
return;
}
+int LoadTemplateDir(const char *DirName, HashList *wireless, HashList *big)
+{
+ StrBuf *FileName;
+ StrBuf *Tag;
+ StrBuf *Dir;
+ DIR *filedir = NULL;
+ struct dirent *filedir_entry;
+ int d_namelen;
+ int d_without_ext;
+ int IsMobile;
+
+ Dir = NewStrBuf();
+ StrBufPrintf(Dir, "%s/t", DirName);
+ filedir = opendir (ChrPtr(Dir));
+ if (filedir == NULL) {
+ return 0;
+ }
+
+ FileName = NewStrBuf();
+ Tag = NewStrBuf();
+ while ((filedir_entry = readdir(filedir)))
+ {
+ char *MinorPtr;
+ char *PStart;
+#ifdef _DIRENT_HAVE_D_NAMELEN
+ d_namelen = filedir_entry->d_namelen;
+#else
+ d_namelen = strlen(filedir_entry->d_name);
+#endif
+ d_without_ext = d_namelen;
+ while ((d_without_ext > 0) && (filedir_entry->d_name[d_without_ext] != '.'))
+ d_without_ext --;
+ if ((d_without_ext == 0) || (d_namelen < 3))
+ continue;
+
+ IsMobile = (strstr(filedir_entry->d_name, ".m.html")!= NULL);
+ PStart = filedir_entry->d_name;
+ StrBufPrintf(FileName, "%s/t/%s", ChrPtr(Dir), filedir_entry->d_name);
+ MinorPtr = strchr(filedir_entry->d_name, '.');
+ if (MinorPtr != NULL)
+ *MinorPtr = '\0';
+ StrBufPlain(Tag, filedir_entry->d_name, MinorPtr - filedir_entry->d_name);
+
+
+ printf("%s %d %s\n",ChrPtr(FileName), IsMobile, ChrPtr(Tag));
+ load_template(FileName, Tag, (IsMobile)?wireless:big);
+ }
+ closedir(filedir);
+ FreeStrBuf(&FileName);
+ FreeStrBuf(&Tag);
+ FreeStrBuf(&Dir);
+ return 1;
+}
+
+void InitTemplateCache(void)
+{
+
+ LoadTemplateDir(static_dirs[0],
+ WirelessTemplateCache,
+ TemplateCache);
+ LoadTemplateDir(static_dirs[1],
+ WirelessLocalTemplateCache,
+ LocalTemplateCache);
+
+
+}
+
void
InitModule_SUBST
(void)
const char foobuf[32];
const char *nix(void *vptr) {snprintf(foobuf, 32, "%0x", (long) vptr); return foobuf;}
#endif
+void InitTemplateCache(void);
/*
* \brief Here's where it all begins.
WirelessLocalTemplateCache = NewHash(1, NULL);
TemplateCache = NewHash(1, NULL);
LocalTemplateCache = NewHash(1, NULL);
+ InitTemplateCache();
initialise_modules();