Webadmin: Make this work with the browser cache

This moves all static webadmin files (images, css) to the data/ subdirectory
of the skin dir. The webadmin module is changed to redirect requests to
/<skin name>/ to that data directory. The skins are changed to use the
new URL when linking to their stuff. (I only needed to change the path to
the main.css file in each Header.tmpl. Since the .css and the images are now
in the same directory, relative URLs work just fine).

This means that we now generate different URLs after changing the webadmin
skins and the browser cache can do its thing.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1481 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-04-06 16:00:23 +00:00
parent 694b60d53b
commit 3b9a9c2b80
18 changed files with 19 additions and 23 deletions

View File

@@ -367,9 +367,13 @@ bool CWebAdminSock::OnPageRequest(const CString& sURI, CString& sPageRet) {
return false;
}
const CString& sSkin = GetModule()->GetSkinName();
CString sTmp = sURI;
m_Template["SessionUser"] = GetUser();
m_Template["SessionIP"] = GetRemoteIP();
m_Template["Tag"] = CZNC::GetTag();
m_Template["Skin"] = sSkin;
if (IsAdmin()) {
m_Template["IsAdmin"] = "true";
@@ -384,17 +388,9 @@ bool CWebAdminSock::OnPageRequest(const CString& sURI, CString& sPageRet) {
m_Template["Title"] = "Main Page";
m_Template["Action"] = "home";
PrintPage(sPageRet, "Main.tmpl");
} else if (sURI.Equals("/css/", false, 5)) {
SetDocRoot(GetSkinDir() + "/css");
PrintFile(sURI.substr(5), "text/css");
return false;
} else if (sURI.Equals("/img/", false, 5)) {
SetDocRoot(GetSkinDir() + "/img");
PrintFile(sURI.substr(5));
return false;
} else if (sURI.Equals("/js/", false, 4)) {
SetDocRoot(GetSkinDir() + "/js");
PrintFile(sURI.substr(4), "application/x-javascript");
} else if (sTmp.TrimPrefix("/" + sSkin + "/")) {
SetDocRoot(GetSkinDir() + "/data");
PrintFile(sTmp);
return false;
} else if (sURI == "/home") {
m_Template["Title"] = "Main Page";