* Replaced most remaining occurrences of getMessage() method calls with adequate gettext() method calls

* Removed obsolete Root.getSiteList() method
 * Moved searchview.skin as #result subskin into Story.skin
 * Fixed alignment of calendar month
This commit is contained in:
Tobi Schäfer 2008-01-13 16:44:09 +00:00
parent 78b2261e88
commit 77255296dc
14 changed files with 54 additions and 99 deletions

View file

@ -479,7 +479,7 @@ Admin.prototype.blockPrivateSites = function() {
var recipient = site.email ? site.email : site.creator.email;
warning.addTo(recipient);
warning.setFrom(root.sys_email);
warning.setSubject(getMessage("mail.blockWarning", site.title));
warning.setSubject(gettext("Attention! Your site {0} will soon be blocked!", site.title));
var sp = new Object();
sp.site = site.alias;
sp.url = site.href();
@ -544,7 +544,7 @@ Admin.prototype.deleteInactiveSites = function() {
var recipient = site.email ? site.email : site.creator.email;
warning.addTo(recipient);
warning.setFrom(root.sys_email);
warning.setSubject(getMessage("mail.deleteWarning", site.title));
warning.setSubject(gettext("Attention! Your site {0} will soon be deleted!", site.title));
var sp = new Object();
sp.site = site.alias;
sp.url = site.href();

View file

@ -276,48 +276,3 @@ Root.prototype.getCreationPermission = function() {
Root.prototype.processHref = function(href) {
return app.properties.defaulthost + href;
};
// FIXME!
Root.prototype.getSiteList = function(limit, show, scroll) {
return;
if (show && show == "all")
var collection = root.publicSites;
else
var collection = root;
var size = collection.size();
if (!size)
return;
var idx = parseInt (req.data.start, 10);
var scroll = (!scroll || scroll == "no" ? false : true);
if (isNaN(idx) || idx > size-1 || idx < 0)
idx = 0;
if (scroll && idx > 0) {
var sp = new Object();
sp.url = root.href("list") + "?start=" + Math.max(0, idx-limit);
sp.text = getMessage("Site.previousPage");
res.data.prevpage = renderSkinAsString("prevpagelink", sp);
}
var cnt = 0;
collection.prefetchChildren(idx, limit);
res.push();
while (cnt < limit && idx < size) {
var s = collection.get(idx++);
if (!s.blocked && s.online) {
s.renderSkin("Site#list");
cnt++;
}
}
res.data.sitelist = res.pop();
if (scroll && idx < size) {
var sp = new Object();
sp.url = root.href("list") + "?start=" + idx;
sp.text = getMessage("Site.nextPage");
res.data.nextpage = renderSkinAsString("nextpagelink", sp);
}
return;
};

View file

@ -395,7 +395,7 @@ Site.prototype.search_action = function() {
res.push();
while (rows.next()) {
ref = Story.getById(rows.getColumnItem("id"));
ref.renderSkin("Story#preview");
ref.renderSkin("Story#result");
counter += 1;
}
rows.release();

View file

@ -664,6 +664,7 @@ ul.skinmgrTree li div {
}
.calendar {
text-align: center;
color: <% value "small font color" %>;
font-family: <% value "small font" %>;
font-size: <% value "small font size" %>;

View file

@ -150,7 +150,7 @@ Skin.prototype.diff_action = function() {
} else {
var diff = originalSkin.diff(this.getSource());
if (!diff) {
res.data.status = getMessage("Skin.diff.noDiffFound");
res.data.status = gettext("No differences were found");
} else {
res.push();
var sp = new Object();
@ -186,11 +186,8 @@ Skin.prototype.diff_action = function() {
}
}
res.data.body = this.renderSkinAsString("diff");
res.data.title = getMessage("Skin.diff.displayTitle", {
skinProto: this.proto,
skinName: this.name,
layoutTitle: this.layout.title
});
res.data.title = gettext("Diffs for {0}/{1}.skin of layout {2}",
this.proto, this.name, this.layout.title);
this.layout.skins.renderSkin("Site#page");
return;
};

View file

@ -49,6 +49,10 @@
</div>
</div>
<% #result %>
<br /><% story.summary %>
<div class="small">by <% story.creator %> (<% story.modified short %>)</div>
<% #top %>
<tr>
<td align="right" valign="baseline" class="small"><% param.position %></td>

View file

@ -1,3 +0,0 @@
<br /><% story.content part="title" as="link" %><br />
<% story.content part="text" limit="200" suffix="&nbsp;..." %>
<div class="small">by <% story.creator %> (<% story.modifytime format="short" %>)</div>

View file

@ -59,8 +59,7 @@ Tags.prototype.getChildElement = function(id) {
return {main_action: new Function};
var self = this;
res.data.title = getMessage("Tags.viewTitle", {title: "Tags",
siteName: self._parent.title});
res.data.title = gettext("Tags of site {0}", self._parent.title);
res.data.list = renderList(child, function(item) {
item.parent.renderSkin("preview");
}, 10, req.data.page);

View file

@ -77,9 +77,9 @@ Layout.prototype.shareable_macro = function(param) {
delete inputParam.checked;
Html.checkBox(inputParam);
} else if (this.shareable)
res.write(param.yes ? param.yes : getMessage("generic.yes"));
res.write(param.yes || gettext("yes"));
else
res.write(param.no ? param.no : getMessage("generic.no"));
res.write(param.no || gettext("no"));
return;
};

View file

@ -32,7 +32,7 @@ Members.prototype.sendpwd_action = function() {
Members.prototype.subscribelink_macro = function(param) {
if (this._parent.online && res.data.memberlevel == null) {
html.link({href: this._parent.href("subscribe")},
param.text || getMessage("Members.signUp"));
param.text || gettext("sign up"));
}
return;
};
@ -40,7 +40,7 @@ Members.prototype.subscribelink_macro = function(param) {
Members.prototype.subscriptionslink_macro = function(param) {
if (session.user.size()) {
html.link({href: this.href("updated")},
param.text || getMessage("Members.subscriptions"));
param.text || gettext("subscriptions"));
}
return;
};

View file

@ -61,7 +61,7 @@ Membership.prototype.level_macro = function(param) {
Membership.prototype.editlink_macro = function(param) {
if (this.creator !== session.user) {
this.link_filter(param.text || getMessage("generic.edit"),
this.link_filter(param.text || gettext("edit"),
param, this.href("edit"));
}
return;
@ -70,13 +70,13 @@ Membership.prototype.editlink_macro = function(param) {
Membership.prototype.deletelink_macro = function(param) {
if (this.role !== Membership.OWNER)
html.link({href: this.href("delete")}, param.text ||
getMessage("generic.remove"));
gettext("remove"));
return;
};
Membership.prototype.unsubscribelink_macro = function(param) {
if (this.role === Membership.SUBSCRIBER) {
this.link_filter(param.text || getMessage("Membership.unsubscribe"),
this.link_filter(param.text || gettext("unsubscribe"),
param, this.site.href("unsubscribe"));
}
return;

View file

@ -42,11 +42,11 @@ Poll.prototype.choices_macro = function(param) {
Poll.prototype.total_macro = function(param) {
var n = this.votes.size();
if (n == 0)
n += " " + (param.no ? param.no : getMessage("Poll.votes.no"));
n += " " + (param.no || gettext("votes"));
else if (n == 1)
n += " " + (param.one ? param.one : getMessage("Poll.votes.one"));
n += " " + (param.one || gettext("vote"));
else
n += " " + (param.more ? param.more : getMessage("Poll.votes.more"));
n += " " + (param.more || gettext("votes"));
return n;
};
@ -86,11 +86,11 @@ Poll.prototype.results_macro = function() {
param.width = Math.round(param.percent * 2.5);
param.graph = c.renderSkinAsString("graph", param);
if (param.count == 1)
param.text = " " + (param2.one ? param2.one : getMessage("Poll.votes.one"));
param.text = " " + (param2.one || gettext("vote"));
else
param.text = " " + (param2.more ? param2.more : getMessage("Poll.votes.more"));
param.text = " " + (param2.more || gettext("votes"));
} else
param.text = " " + (param2.no ? param2.no : getMessage("Poll.votes.no"));
param.text = " " + (param2.no || gettext("votes"));
c.renderSkin("result", param);
}
return;
@ -104,7 +104,7 @@ Poll.prototype.editlink_macro = function(param) {
return;
}
Html.link({href: this.href("edit")},
param.text ? param.text : getMessage("generic.edit"));
param.text || gettext("edit"));
}
return;
};
@ -117,7 +117,7 @@ Poll.prototype.deletelink_macro = function(param) {
return;
}
Html.link({href: this.href("delete")},
param.text ? param.text : getMessage("generic.delete"));
param.text || gettext("delete"));
}
return;
};
@ -127,7 +127,7 @@ Poll.prototype.viewlink_macro = function(param) {
if (!this.closed) {
this.checkVote(session.user, res.data.memberlevel);
Html.link({href: this.href()},
param.text ? param.text : getMessage("Poll.vote"));
param.text || gettext("vote"));
}
} catch (deny) {
return;
@ -142,7 +142,7 @@ Poll.prototype.closelink_macro = function(param) {
} catch (deny) {
return;
}
var str = this.closed ? getMessage("Poll.reopen") : getMessage("Poll.close");
var str = this.closed ? gettext("re-open") : gettext("close");
Html.link({href: this.href("toggle")},
param.text ? param.text : str);
}

View file

@ -88,7 +88,7 @@ Root.prototype.sys_allowFiles_macro = function(param) {
delete inputParam.checked;
Html.checkBox(inputParam);
} else
res.write(this.sys_allowFiles ? getMessage("generic.yes") : getMessage("generic.no"));
res.write(this.sys_allowFiles ? gettext("yes") : gettext("no"));
return;
};
@ -110,7 +110,8 @@ Root.prototype.sys_limitNewSites_macro = function(param) {
if (!session.user.sysadmin)
return;
if (param.as == "editor") {
var options = [getMessage("SysMgr.registeredUsers"), getMessage("SysMgr.trustedUsers"), "---------"];
var options = [gettext("all registered users"),
gettext("only trusted users"), "---------"];
Html.dropDown({name: "sys_limitNewSites"}, options, this.sys_limitNewSites);
} else
res.write(this.sys_limitNewSites);
@ -173,7 +174,7 @@ Root.prototype.sys_enableAutoCleanup_macro = function(param) {
delete inputParam.checked;
Html.checkBox(inputParam);
} else
res.write(this.sys_enableAutoCleanup ? getMessage("generic.yes") : getMessage("generic.no"));
res.write(this.sys_enableAutoCleanup ? gettext("yes") : gettext("no"));
return;
};
@ -201,7 +202,7 @@ Root.prototype.sys_blockPrivateSites_macro = function(param) {
delete inputParam.checked;
Html.checkBox(inputParam);
} else
res.write(this.sys_blockPrivateSites ? getMessage("generic.yes") : getMessage("generic.no"));
res.write(this.sys_blockPrivateSites ? gettext("yes") : gettext("no"));
return;
};
@ -237,7 +238,7 @@ Root.prototype.sys_deleteInactiveSites_macro = function(param) {
delete inputParam.checked;
Html.checkBox(inputParam);
} else
res.write(this.sys_deleteInactiveSites ? getMessage("generic.yes") : getMessage("generic.no"));
res.write(this.sys_deleteInactiveSites ? gettext("yes") : gettext("no"));
return;
};
@ -281,9 +282,9 @@ Root.prototype.sys_allowEmails_macro = function(param) {
if (!session.user.sysadmin)
return;
if (param.as == "editor") {
var options = new Array(getMessage("SysMgr.allowNotfication.no"),
getMessage("SysMgr.allowNotfication.all"),
getMessage("SysMgr.allowNotfication.trusted"));
var options = [gettext("no notification e-mails"),
gettext("notification for all sites"),
gettext("only trusted sites")];
Html.dropDown({name: "sys_allowEmails"}, options, this.sys_allowEmails);
} else
res.write(this.sys_allowEmails);

View file

@ -235,34 +235,35 @@ Story.prototype.discussions_macro = function(param) {
// FIXME!
Story.prototype.editableby_macro = function(param) {
if (param.as == "editor" && (session.user == this.creator || !this.creator)) {
var options = [EDITABLEBY_ADMINS,
EDITABLEBY_CONTRIBUTORS,
EDITABLEBY_SUBSCRIBERS];
var labels = [getMessage("Story.editableBy.admins"),
getMessage("Story.editableBy.contributors"),
getMessage("Story.editableBy.subscribers")];
var options = [EDITABLEBY_ADMINS, EDITABLEBY_CONTRIBUTORS,
EDITABLEBY_SUBSCRIBERS];
var labels = [gettext("the author"), gettext("all contributors"),
gettext("all subscribers")];
delete param.as;
if (req.data.publish || req.data.save)
var selValue = !isNaN(req.data.editableby) ? req.data.editableby : null;
else
var selValue = this.editableby;
for (var i=0;i<options.length;i++) {
html.radioButton({name: "editableby", value: options[i], selectedValue: selValue});
html.radioButton({name: "editableby",
value: options[i], selectedValue: selValue});
res.write("&nbsp;");
res.write(labels[i]);
res.write("&nbsp;");
}
} else {
switch (this.editableby) {
case 0 :
res.write(getMessage("Story.editableBy.adminsLong", {siteTitle: path.Site.title}));
return;
case 1 :
res.write(getMessage("Story.editableBy.contributorsLong", {siteTitle: path.Site.title}));
break;
case 0:
res.write(gettext("Content managers and admins of {0}",
path.site.title));
break;
case 1:
res.write(gettext("Contributors to {0}", path.site.title));
break;
case 2 :
res.write(getMessage("Story.editableBy.subscribersLong", {siteTitle: path.Site.title}));
break;
res.write(gettext("Subscribers of and contributors to {0}",
path.site.title));
break;
}
}
return;