Initial revision
This commit is contained in:
parent
1ba4e8011b
commit
bbfcb3d4f4
104 changed files with 3100 additions and 0 deletions
2
code/Root/header.skin
Normal file
2
code/Root/header.skin
Normal file
|
@ -0,0 +1,2 @@
|
|||
<P><FONT SIZE="+3"><B>Antville</B> </FONT><% response.message %></P>
|
||||
<% root.loginstatus %>
|
37
code/Root/macros.js
Normal file
37
code/Root/macros.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* macro rendering loginStatus of user
|
||||
* valid params: - loginSkin
|
||||
* - logoutSkin
|
||||
*/
|
||||
|
||||
function loginstatus_macro(param) {
|
||||
if (user.uid)
|
||||
this.members.renderSkin("statusloggedin");
|
||||
else if (getActionName() != "login")
|
||||
this.members.renderSkin("statusloggedout");
|
||||
}
|
||||
|
||||
/**
|
||||
* macro renders the 10 freshest weblogs
|
||||
*/
|
||||
|
||||
function webloglist_macro(param) {
|
||||
if (this.size()) {
|
||||
renderPrefix(param);
|
||||
for (var i=0;i<(this.size() > 10 ? 10 : this.size());i++) {
|
||||
if (this.get(i).isOnline() && this.get(i).lastupdate)
|
||||
this.get(i).renderSkin("preview");
|
||||
}
|
||||
renderSuffix(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* macro renders the number of weblogs
|
||||
*/
|
||||
|
||||
function weblogcounter_macro(param) {
|
||||
renderPrefix(param);
|
||||
res.write(this.size());
|
||||
renderSuffix(param);
|
||||
}
|
6
code/Root/main.hac
Normal file
6
code/Root/main.hac
Normal file
|
@ -0,0 +1,6 @@
|
|||
res.skin = "main";
|
||||
|
||||
res.head = this.renderSkinAsString("style");
|
||||
res.title = "Antville";
|
||||
res.body = this.renderSkinAsString("header");
|
||||
res.body += this.renderSkinAsString("main");
|
7
code/Root/main.skin
Normal file
7
code/Root/main.skin
Normal file
|
@ -0,0 +1,7 @@
|
|||
<P>This is Antville, a small but fancy Weblog-Application build with <% this.link to="http://helma.org" text="Helma Object Publisher" %></P>
|
||||
|
||||
<P>If you don't own a Weblog yourself, you can <% this.link to="new" text="create one" %></P>
|
||||
|
||||
<P><B>Status:</B></P>
|
||||
<% this.weblogcounter %> WebLogs created<BR>
|
||||
<% this.webloglist prefix="<BR>last updated weblogs:" %><P>
|
22
code/Root/new.hac
Normal file
22
code/Root/new.hac
Normal file
|
@ -0,0 +1,22 @@
|
|||
res.skin = "main";
|
||||
res.title = "Antville - creating a new Weblog";
|
||||
res.head = this.renderSkinAsString("style");
|
||||
|
||||
if (!user.uid) {
|
||||
res.message = "Please login first";
|
||||
user.cache.referer = this.href("new");
|
||||
res.redirect(root.members.href("login"));
|
||||
} else {
|
||||
if (req.data.submit == "cancel")
|
||||
res.redirect(root.href());
|
||||
else if (user.isBlocked())
|
||||
res.redirect(root.href());
|
||||
else if (user.getWeblog()) {
|
||||
res.message = "You already own a Weblog! You'll need a new account to create another one.";
|
||||
res.redirect(root.members.href("register"));
|
||||
} else
|
||||
var newLog = this.evalNewWeblog();
|
||||
|
||||
res.body = this.renderSkinAsString("header");
|
||||
res.body += this.renderSkinAsString("new",newLog);
|
||||
}
|
7
code/Root/new.skin
Normal file
7
code/Root/new.skin
Normal file
|
@ -0,0 +1,7 @@
|
|||
<FORM METHOD="POST">
|
||||
|
||||
<P>Title: <% this.input type="text" name="title" %><BR>
|
||||
Alias: <% this.input type="text" name="alias" %><BR>
|
||||
<% this.input type="button" value="create" %> <% this.input type="button" value="cancel" %></P>
|
||||
|
||||
</FORM>
|
79
code/Root/objectFunctions.js
Normal file
79
code/Root/objectFunctions.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* evaluating new weblog
|
||||
*/
|
||||
|
||||
function evalNewWeblog() {
|
||||
var newLog = new weblog();
|
||||
if (req.data.title && req.data.alias) {
|
||||
newLog.title = req.data.title;
|
||||
newLog.alias = req.data.alias;
|
||||
if (this.checkIfExists(newLog.alias)) {
|
||||
res.message = "Sorry, we already have a weblog with this alias!";
|
||||
newLog.error = true;
|
||||
} else {
|
||||
// now we can safely create a new weblog
|
||||
this.createNewWeblog(newLog);
|
||||
}
|
||||
} else {
|
||||
newLog.error = true;
|
||||
newLog.title = newLog.alias = "";
|
||||
if (!res.message) res.message = "Please fill in the form to create your new Weblog!";
|
||||
}
|
||||
return (newLog);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if alias is already in use
|
||||
*/
|
||||
|
||||
function checkIfExists(alias) {
|
||||
if (this.get(alias))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new weblog
|
||||
*/
|
||||
|
||||
function createNewWeblog(newLog) {
|
||||
newLog.owner = user;
|
||||
newLog.creator = user;
|
||||
newLog.createtime = new Date();
|
||||
newLog.online = 0;
|
||||
newLog.discussions = 1;
|
||||
newLog.archive = 1;
|
||||
newLog.blocked = 0;
|
||||
newLog.birthdate = new Date();
|
||||
newLog.textfont = "Arial, Helvetica, sans-serif";
|
||||
newLog.textsize = "10pt";
|
||||
newLog.textcolor = "000000";
|
||||
newLog.linkcolor = "0000FF";
|
||||
newLog.alinkcolor = "FF0000";
|
||||
newLog.vlinkcolor = "0000CC";
|
||||
newLog.titlefont = "Arial, Helvetica, sans-serif";
|
||||
newLog.titlesize = "12pt";
|
||||
newLog.titlecolor = "CC0000";
|
||||
newLog.days = 3;
|
||||
newLog.createImgDirectory()
|
||||
this.add(newLog);
|
||||
user.weblog = newLog;
|
||||
res.message = "Your weblog was created successfully! Have fun!";
|
||||
res.redirect(newLog.href());
|
||||
}
|
||||
|
||||
/**
|
||||
* alias of image has changed, so we remove it and add it again with it's new alias
|
||||
*/
|
||||
|
||||
function changeAlias(currImg) {
|
||||
// var oldAlias = currImg.alias;
|
||||
currImg.setParent(this);
|
||||
this.remove(currImg);
|
||||
this.set(currImg.alias,null);
|
||||
currImg.alias = req.data.alias;
|
||||
this.add(currImg);
|
||||
return;
|
||||
}
|
||||
|
39
code/Root/style.skin
Normal file
39
code/Root/style.skin
Normal file
|
@ -0,0 +1,39 @@
|
|||
<STYLE TYPE="text/css">
|
||||
<!--
|
||||
|
||||
body { font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10pt;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.calendar { border: 1px solid black;
|
||||
}
|
||||
|
||||
.calendarHeader { font-size: 8pt;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
background-color: #666666;
|
||||
}
|
||||
|
||||
.calendarDay { font-size: 8pt;
|
||||
font-weight: normal;
|
||||
border: 1px solid #666666;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calendarSelectedDay { font-size: 8pt;
|
||||
font-weight: normal;
|
||||
border: 1px solid #666666;
|
||||
background-color: #FFFFFF;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calendarFooter { font-size: 8pt;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
background-color: #999999;
|
||||
}
|
||||
|
||||
// -->
|
||||
</STYLE>
|
8
code/Root/type.properties
Normal file
8
code/Root/type.properties
Normal file
|
@ -0,0 +1,8 @@
|
|||
_subnodes=weblog.ID
|
||||
_properties=weblog.ALIAS
|
||||
_properties.aresubnodes=true
|
||||
_subnodes.order=LASTUPDATE desc
|
||||
_subnodes.loadmode=aggressive
|
||||
|
||||
|
||||
members=[mountpoint]membership
|
Loading…
Add table
Add a link
Reference in a new issue