* Replaced occurrences of User.visisted with User.modified

* Set application's charset to UTF8
 * Added Layout.getFile() method returning the layout's directory as helma.File
 * Simplified Layout.getSkinPath() method (still work in progress)
 * Replaced occurrences of Site.language with Site.locale
 * Modified some wording
 * Added slight b/w compatibility fix in Story.macro_filter() method
 * Added timex factor in Story.getDelta() method to prevent counting  edits as site updates in-beteen 10 minutes
 * Moved site-related aspect hooks to Site prototype of compatibility module
 * Removed obsolete conversion code in compatibility module (has moved to updater app)
 * Re-included spacer_macro() method in compat. module
 * Temporarily overwrote HopObject.renderSkin() method to debug skin rendering process
 * Replaced individual legacy macros of Layout prototype by appropriate code in onUnhandledMacro() method (compat.)
 * Reflect legacy macros of Layout prototype in value() method of compat. module
 * Added and improved compatibility methods
 * Implemented support for renamed prototypes in updater app (still needs to be applied for database, too)
This commit is contained in:
Tobi Schäfer 2007-10-21 16:49:16 +00:00
parent 1df1c87525
commit aa11e5db88
23 changed files with 578 additions and 650 deletions

View file

@ -366,7 +366,7 @@ Admin.prototype.filterUsers = function(data) {
sql += "order by name "; break;
case "0":
default:
sql += "order by visited "; break;
sql += "order by modified "; break;
}
(data.dir == 1) || (sql += "desc");
this.users.subnodeRelation = sql;

View file

@ -232,7 +232,7 @@ If this site is open it will replace the default front page.
<a href="<% item.url %>"><% item.url %></a></div>
<div class="small">
registered: <% item.created | format "yyyy-MM-dd HH:mm" %><br />
last visit: <% item.visited | format "yyyy-MM-dd HH:mm" %>
last visit: <% item.modified | format "yyyy-MM-dd HH:mm" %>
</div>
</td>
<td class="small" valign="top" align="right">

View file

@ -206,12 +206,7 @@ Image.prototype.getFile = function(name) {
name || (name = this.name);
if (this.parent_type === "Layout") {
var layout = this.parent || res.handlers.layout;
res.push();
res.write("layouts/");
res.write(layout.name);
res.write("/");
res.write(name);
return layout.site.getStaticFile(res.pop());
return layout.getFile() + "/" + name;
}
var site = this.parent || res.handlers.site;
return site.getStaticFile("images/" + name);

View file

@ -285,19 +285,22 @@ Layout.prototype.getImage = function(name, fallback) {
return null;
};
Layout.prototype.getFile = function() {
return this.site.getStaticFile("layouts/" + this.name);
};
Layout.prototype.getSkinPath = function() {
// FIXME: Do we need this or not?
/* if (!this.site) {
return [app.dir];
} */
var skinPath = [];
var skinPath = [this.getFile().toString()];
this.parent && (skinPath.push(this.parent.getFile().toString()));
return skinPath;
var layout = this;
do {
res.push();
res.write(getProperty("staticPath"));
layout.site && res.write(layout.site.name + "/");
res.write("layouts/");
res.write(layout.alias);
res.write(layout.name);
skinPath.push(res.pop());
} while (layout = layout.parent);
return skinPath;

View file

@ -202,7 +202,7 @@ Root.prototype.updates_xml_action = function() {
feed.setLink(root.href());
feed.setTitle(root.title);
feed.setDescription(root.tagline);
feed.setLanguage(root.language.replace("_", "-"));
feed.setLanguage(root.locale.replace("_", "-"));
feed.setPublishedDate(now);
var entries = new java.util.ArrayList();
var entry, description;

View file

@ -34,8 +34,8 @@ Site.getWebHookModes = defineConstants(Site, "disabled", "enabled");
this.handleMetadata("archiveMode");
this.handleMetadata("commentMode");
this.handleMetadata("email");
this.handleMetadata("language");
this.handleMetadata("lastUpdate");
this.handleMetadata("locale");
this.handleMetadata("longDateFormat");
this.handleMetadata("notificationMode");
this.handleMetadata("notifiedOfBlocking");
@ -72,8 +72,7 @@ Site.prototype.constructor = function(name, title) {
notificationMode: Site.DISABLED,
pageMode: Site.DAYS,
pageSize: 3,
language: locale.getLanguage(),
country: locale.getCountry(),
locale: locale.toString(),
timeZone: root.getTimeZone().getID(),
longDateFormat: LONGDATEFORMAT,
shortDateFormat: SHORTDATEFORMAT
@ -117,6 +116,8 @@ Site.prototype.getPermission = function(action) {
Site.prototype.main_action = function() {
res.data.body = this.renderSkinAsString("Site#main");
res.data.body += '\n<script type="text/javascript" src="' +
root.getStaticUrl("jquery-1.1.3.1.pack.js") + '"></script>\n';
res.data.title = this.title;
this.renderSkin("page");
logAction();
@ -157,7 +158,7 @@ Site.prototype.getFormOptions = function(name) {
return Site.getArchiveModes();
case "commentMode":
return Site.getCommentModes();
case "language":
case "locale":
return getLocales();
case "layout":
return this.getLayouts();
@ -213,7 +214,7 @@ Site.prototype.update = function(data) {
timeZone: data.timeZone,
longDateFormat: data.longDateFormat,
shortDateFormat: data.shortDateFormat,
language: data.language,
locale: data.locale,
layout: Layout.getById(data.layout)
});
this.touch();
@ -268,7 +269,7 @@ Site.prototype.getXml = function() {
feed.setLink(this.href());
feed.setTitle(this.title);
feed.setDescription(this.tagline);
feed.setLanguage(this.language.replace("_", "-"));
feed.setLanguage(this.locale.replace("_", "-"));
feed.setPublishedDate(now);
/*
@ -427,6 +428,7 @@ Site.prototype.robots_txt_action = function() {
Site.prototype.getMacroHandler = function(name) {
switch (name) {
case "archive":
case "files":
case "images":
case "layouts":
@ -471,8 +473,7 @@ Site.prototype.calendar_macro = function(param) {
};
Site.prototype.age_macro = function(param) {
//res.write(this.createtime.getAge());
res.write(Math.floor((new Date() - this.createtime) / Date.ONEDAY));
res.write(Math.floor((new Date() - this.created) / Date.ONEDAY));
return;
};
@ -513,16 +514,13 @@ Site.prototype.getLayouts = function() {
};
Site.prototype.getLocale = function() {
var locale, language, country;
var locale;
if (locale = this.cache.locale) {
return locale;
}
if (language = this.language) {
if (country = this.country) {
locale = new java.util.Locale(language, country);
} else {
locale = new java.util.Locale(language);
}
} else if (this.locale) {
var parts = this.locale.split("_");
locale = new java.util.Locale(parts[0] || String.EMPTY,
parts[1] || String.EMPTY, parts.splice(2).join("_"));
} else {
locale = java.util.Locale.getDefault();
}

View file

@ -109,7 +109,7 @@ REGEDIT4
</tr>
<tr>
<td class="small">Language:</td>
<td><% site.select language %></td>
<td><% site.select locale %></td>
</tr>
<tr>
<td class="small">Time zone:</td>

View file

@ -73,7 +73,7 @@
<div class="boxheader">calendar</div>
<div class="box"><% site.calendar %></div>
<div class="boxheader">recent postings</div>
<div class="boxheader">recent updates</div>
<div class="box"><% list postings skin=Story#history %></div>
<div class="boxline"></div><br />

View file

@ -440,7 +440,7 @@ Story.prototype.format_filter = function(value, param, mode) {
};
Story.prototype.macro_filter = function(value, param) {
var skin = createSkin(format(value));
var skin = value.constructor === String ? createSkin(format(value)) : value;
skin.allowMacro("image");
skin.allowMacro("this.image");
skin.allowMacro("site.image");
@ -509,5 +509,7 @@ Story.prototype.getDelta = function(data) {
delta += deltify(data.key, this.metadata.get(key))
}
}
return delta;
// In-between updates (10 min) get zero delta
var timex = (new Date - this.modified) > Date.ONEMINUTE * 10 ? 1 : 0;
return delta * timex;
};

View file

@ -46,7 +46,6 @@ User.prototype.constructor = function(data) {
salt: session.data.token,
email: data.email,
status: User.REGULAR,
visited: now,
created: now,
modified: now
});
@ -87,7 +86,7 @@ User.prototype.update = function(data) {
};
User.prototype.touch = function() {
this.modified = this.visited = new Date;
this.modified = new Date;
return;
};

View file

@ -32,7 +32,6 @@ name
email
status
visited
created
modified

View file

@ -25,6 +25,7 @@
rootId = 1
rootPrototype = Root
charset = UTF8
skinCharset = UTF8
requestTimeout = 300