Initial revision

This commit is contained in:
Robert Gaggl 2001-06-18 08:57:33 +00:00
parent 1ba4e8011b
commit bbfcb3d4f4
104 changed files with 3100 additions and 0 deletions

38
code/SkinMgr/macros.js Normal file
View file

@ -0,0 +1,38 @@
/**
* macro renders filebased-skins as list
*/
function skins_macro(param) {
renderPrefix(param);
for (var i in app.skinfiles) {
res.write("<B>" + i + "</B><BR>");
for (var j in app.skinfiles[i]) {
res.write("&bull;&nbsp;");
res.write("<A HREF=\"" + this.href() + "?proto=" + i + "&name=" + j + "\">");
res.write(j);
res.write("</A><BR>");
}
}
renderSuffix(param);
}
/**
* macro calls a form-skin for editing a skin-source
*/
function skineditor_macro(param) {
renderPrefix(param);
if (req.data.proto && req.data.name) {
// user wants to edit a skin, so we try to get it:
var currProto = this.__parent__.skinmanager.get(req.data.proto);
if (currProto && currProto.get(req.data.name)) {
var currSkin = currProto.get(req.data.name);
currSkin.renderSkin("edit");
} else {
var newSkin = new skin();
newSkin.renderSkin("edit");
}
}
renderSuffix(param);
}

14
code/SkinMgr/main.hac Normal file
View file

@ -0,0 +1,14 @@
// check if user is logged in and is the owner of this weblog
this.checkPermissions();
if (req.data.submit == "cancel")
res.redirect(this.href());
else if (req.data.submit == "save")
this.saveSkin();
res.skin = "main";
res.title = "Antville - " + this.__parent__.title;
res.head = this.__parent__.renderSkinAsString("style");
res.body = this.__parent__.renderSkinAsString("header");
res.body += this.renderSkinAsString("main");

7
code/SkinMgr/main.skin Normal file
View file

@ -0,0 +1,7 @@
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD NOWRAP><FONT SIZE="-1"><% this.skins %></FONT></TD>
<TD WIDTH="20" NOWRAP>&nbsp;</TD>
<TD VALIGN="TOP" NOWRAP><% this.skineditor %></TD>
</TR>
</TABLE>

View file

@ -0,0 +1,26 @@
/**
* function evaluates skin
*/
function saveSkin() {
if (req.data.proto && req.data.name) {
var currProto = this.__parent__.skinmanager.get(req.data.proto);
if (currProto) {
var currSkin = currProto.get(req.data.name);
}
if (!currSkin && req.data.skin) {
var currSkin = new skin();
currSkin.creator = user;
currSkin.createtime = new Date();
currSkin.name = req.data.name;
currSkin.proto = req.data.proto;
this.__parent__.skinmanager.add(currSkin);
} else if (!req.data.skin) {
currProto.remove(currSkin);
}
if (req.data.skin)
currSkin.skin = req.data.skin;
res.message = "Changes were saved successfully!";
}
res.redirect(this.href() + "?proto=" + req.data.proto + "&name=" + req.data.name);
}

View file

@ -0,0 +1,14 @@
/**
* function checks if user is allowed to edit skins of this weblog
*/
function checkPermissions() {
if (!user.uid) {
res.message = "Please login before!";
user.cache.referer = this.href();
res.redirect(this.__parent__.members.href("login"));
} else if (this.__parent__.owner != user) {
res.message = "Sorry, you're not allowed to edit skins";
res.redirect(this.href());
}
}