Disabled many compatibility methods due to improvements in update app already renaming or eliminating the incompatibilities

This commit is contained in:
Tobi Schäfer 2008-01-19 18:48:45 +00:00
parent ce76bd48b5
commit 1ed7a19779
7 changed files with 88 additions and 68 deletions

View file

@ -53,24 +53,35 @@ var addPropertyMacro = function(proto, name, key) {
return; return;
} }
// FIXME: Most likely obsolete
/*
var getCompatibleSkin = function(prototype, name) { var getCompatibleSkin = function(prototype, name) {
return name;
var renamedSkins = { var renamedSkins = {
Site: {
searchbox: "Site#search"
},
Story: { Story: {
"historyview": "Story#history" display: "Story#display",
historyview: "Story#history"
} }
}; };
var getRenamedSkin = function() { var getRenamedSkin = function() {
var skins; var skins;
if (skins = renamedSkins[prototype]) { if (skins = renamedSkins[prototype]) {
return skins[name]; var renamed;
if (renamed = skins[name]) {
return renamed;
}
} }
throw Error("Undefined renaming of skin " + prototype + "." + name); throw Error("Undefined renaming of skin " + prototype + "." + name);
} }
return (new Skin(prototype, name)).getSource() ? return getRenamedSkin();
name : getRenamedSkin();
} }
*/
var formatTimestamp = function() { var formatTimestamp = function() {
return formatDate.apply(this, arguments); return formatDate.apply(this, arguments);

View file

@ -75,6 +75,15 @@ helma.aspects.addAround(global, "story_macro", function(args, func, obj) {
}); });
HopObject.prototype.onCodeUpdate = function() { HopObject.prototype.onCodeUpdate = function() {
/* FIXME: Does not work :(
helma.aspects.addBefore(this, "skin_macro", function(args, func, obj) {
var param = args[0];
if (param.name) {
param.name = this._prototype + "#" + param.name;
}
return args;
});
*/
return helma.aspects.addBefore(this, "link_macro", function(args, func, obj) { return helma.aspects.addBefore(this, "link_macro", function(args, func, obj) {
var param = args[0]; var param = args[0];
return [param, args[1] || param.to, args[2] || param.text]; return [param, args[1] || param.to, args[2] || param.text];

View file

@ -22,9 +22,8 @@
// $URL$ // $URL$
// //
/*
(function() { (function() {
return; // FIXME!
var renderSkin = HopObject.prototype.renderSkin; var renderSkin = HopObject.prototype.renderSkin;
HopObject.prototype.renderSkin = function(name, param) { HopObject.prototype.renderSkin = function(name, param) {
@ -51,7 +50,22 @@
} }
})(); })();
*/
HopObject.prototype.createtime_macro = function() {
return this.created_macro.apply(this, arguments);
};
HopObject.prototype.modifytime_macro = function() {
return this.modified_macro.apply(this, arguments);
};
HopObject.prototype.url_macro = function(param) {
return this.href_macro(param);
};
// FIME: Most likely obsolete
/*
HopObject.prototype.peel_macro = function(param, name) { HopObject.prototype.peel_macro = function(param, name) {
var prototype = (this === root) ? "Site" : this.constructor.name; var prototype = (this === root) ? "Site" : this.constructor.name;
var parts = name.split("#"); var parts = name.split("#");
@ -68,15 +82,4 @@ HopObject.prototype.peel_macro = function(param, name) {
} }
} }
}; };
*/
HopObject.prototype.createtime_macro = function() {
return this.created_macro.apply(this, arguments);
};
HopObject.prototype.modifytime_macro = function() {
return this.modified_macro.apply(this, arguments);
};
HopObject.prototype.url_macro = function(param) {
return this.href_macro(param);
};

View file

@ -95,41 +95,34 @@ Layout.prototype.activatelink_macro = function(param) {
return this.link_macro(param, "activate", param.text || gettext("activate")); return this.link_macro(param, "activate", param.text || gettext("activate"));
}; };
Layout.prototype.value_macro = function(param, name, value) { /*
if (!name) { Layout.prototype.value_macro = function(param, name) {
return; if (name = Layout.compatibilityMap[name]) {
return value_macro(null, name);
} }
var key = "layout_" + name;
if (!value) {
if (value = this.metadata.get(name.toLowerCase())) {
return value;
}
return res.meta[key];
} else {
//this.metadata.set(name.toLowerCase(), value);
res.meta[key] = value;
}
return;
}; };
Layout.prototype.onUnhandledMacro = function(name) { Layout.prototype.onUnhandledMacro = function(name, param) {
// FIXME: editors? // FIXME: editors?
switch (name) { if (name = Layout.compatibilityMap[name]) {
case "bgcolor": return value_macro(param, name);
case "linkcolor":
case "alinkcolor":
case "vlinkcolor":
case "titlecolor":
case "textcolor":
case "smallcolor":
renderColor(this.metadata.get(name)); break;
case "textfont":
case "textsize":
case "titlefont":
case "titlesize":
case "smallfont":
case "smallsize":
res.write(this.metadata.get(name)); break;
} }
return; return;
} }
Layout.compatibilityMap = {
"bgcolor": "background color",
"linkcolor": "link color",
"alinkcolor": "active link color",
"vlinkcolor": "visited link color",
"titlefont": "big font",
"titlesize": "big font size",
"titlecolor": "big font color",
"textfont": "base font",
"textsize": "base font size",
"textcolor": "base font color",
"smallfont": "small font",
"smallsize": "small font size",
"smallcolor": "small font color"
}
*/

View file

@ -88,16 +88,11 @@ Site.prototype.mostread_action = function() {
return res.redirect(this.stories.href("top")); return res.redirect(this.stories.href("top"));
}; };
Site.prototype.skin_macro = function(param) { //Site.prototype.skin_macro = Skin.compatibleMacro;
if (param.name) { // FIXME: Define the function if the above does not work reliably
switch (param.name) { //function() {
case "searchbox": // return Skin.rename.apply(this, arguments);
param.name = "Site#search"; break; //}
}
return HopObject.prototype.skin_macro.call(this, param, param.name);
}
return HopObject.prototype.skin_macro.apply(this, arguments);
}
Site.prototype.link_macro = function(param, url, text) { Site.prototype.link_macro = function(param, url, text) {
param.text || (param.text = text); param.text || (param.text = text);
@ -174,15 +169,10 @@ Site.prototype.loginstatus_macro = function(param) {
Site.prototype.navigation_macro = function(param) { Site.prototype.navigation_macro = function(param) {
switch (param["for"]) { switch (param["for"]) {
case "contributors": case "contributors":
if ((new Skin("Site", "contribnavigation")).getSource()) { this.renderSkin("Site#contribnavigation"); break;
this.renderSkin("contribnavigation");
} break;
case "admins": case "admins":
if ((new Skin("Site", "adminnavigation")).getSource()) { this.renderSkin("Site#adminnavigation"); break;
this.renderSkin("adminnavigation");
} break;
break;
default: default:
this.renderSkin("Site#navigation"); this.renderSkin("Site#navigation");
@ -297,7 +287,6 @@ Site.prototype.layoutchooser_macro = function(param) {
Site.prototype.history_macro = function(param, type) { Site.prototype.history_macro = function(param, type) {
param.limit = Math.min(param.limit || 10, 20); param.limit = Math.min(param.limit || 10, 20);
type || (type = param.show); type || (type = param.show);
var skin = getCompatibleSkin("Story", "historyview");
var stories = this.stories.recent; var stories = this.stories.recent;
var size = stories.size(); var size = stories.size();
var counter = i = 0; var counter = i = 0;
@ -321,7 +310,7 @@ Site.prototype.history_macro = function(param, type) {
continue; continue;
} break; } break;
} }
item.renderSkin(skin); item.renderSkin("Story#history");
counter += 1; counter += 1;
} }
return; return;

View file

@ -25,3 +25,12 @@
relocateProperty(Skin, "createtime", "created"); relocateProperty(Skin, "createtime", "created");
relocateProperty(Skin, "modifytime", "modified"); relocateProperty(Skin, "modifytime", "modified");
relocateProperty(Skin, "proto", "prototype"); relocateProperty(Skin, "proto", "prototype");
// FIXME: Obsolete
/* Skin.compatibleMacro = function(param) {
if (param.name) {
param.name = getCompatibleSkin(this._prototype, param.name);
return HopObject.prototype.skin_macro.call(this, param, param.name);
}
return HopObject.prototype.skin_macro.apply(this, arguments);
} */

View file

@ -29,6 +29,12 @@ Story.prototype.allowTextMacros = function(skin) {
return Story.prototype.macro_filter(skin); return Story.prototype.macro_filter(skin);
} }
//Story.prototype.skin_macro = Skin.compatibleMacro;
// FIXME: Define the function if the above does not work reliably
//function() {
// return Skin.rename.apply(this, arguments);
//}
Story.prototype.commentform_macro = function(param) { Story.prototype.commentform_macro = function(param) {
if (this.commentMode === "closed") { if (this.commentMode === "closed") {
return; return;