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;
}
// FIXME: Most likely obsolete
/*
var getCompatibleSkin = function(prototype, name) {
return name;
var renamedSkins = {
Site: {
searchbox: "Site#search"
},
Story: {
"historyview": "Story#history"
display: "Story#display",
historyview: "Story#history"
}
};
var getRenamedSkin = function() {
var skins;
if (skins = renamedSkins[prototype]) {
return skins[name];
var renamed;
if (renamed = skins[name]) {
return renamed;
}
}
throw Error("Undefined renaming of skin " + prototype + "." + name);
}
return (new Skin(prototype, name)).getSource() ?
name : getRenamedSkin();
return getRenamedSkin();
}
*/
var formatTimestamp = function() {
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() {
/* 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) {
var param = args[0];
return [param, args[1] || param.to, args[2] || param.text];

View file

@ -22,9 +22,8 @@
// $URL$
//
/*
(function() {
return; // FIXME!
var renderSkin = HopObject.prototype.renderSkin;
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) {
var prototype = (this === root) ? "Site" : this.constructor.name;
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"));
};
Layout.prototype.value_macro = function(param, name, value) {
if (!name) {
return;
/*
Layout.prototype.value_macro = function(param, name) {
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?
switch (name) {
case "bgcolor":
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;
if (name = Layout.compatibilityMap[name]) {
return value_macro(param, name);
}
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"));
};
Site.prototype.skin_macro = function(param) {
if (param.name) {
switch (param.name) {
case "searchbox":
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.skin_macro = Skin.compatibleMacro;
// FIXME: Define the function if the above does not work reliably
//function() {
// return Skin.rename.apply(this, arguments);
//}
Site.prototype.link_macro = function(param, url, text) {
param.text || (param.text = text);
@ -174,15 +169,10 @@ Site.prototype.loginstatus_macro = function(param) {
Site.prototype.navigation_macro = function(param) {
switch (param["for"]) {
case "contributors":
if ((new Skin("Site", "contribnavigation")).getSource()) {
this.renderSkin("contribnavigation");
} break;
this.renderSkin("Site#contribnavigation"); break;
case "admins":
if ((new Skin("Site", "adminnavigation")).getSource()) {
this.renderSkin("adminnavigation");
} break;
break;
this.renderSkin("Site#adminnavigation"); break;
default:
this.renderSkin("Site#navigation");
@ -297,7 +287,6 @@ Site.prototype.layoutchooser_macro = function(param) {
Site.prototype.history_macro = function(param, type) {
param.limit = Math.min(param.limit || 10, 20);
type || (type = param.show);
var skin = getCompatibleSkin("Story", "historyview");
var stories = this.stories.recent;
var size = stories.size();
var counter = i = 0;
@ -321,7 +310,7 @@ Site.prototype.history_macro = function(param, type) {
continue;
} break;
}
item.renderSkin(skin);
item.renderSkin("Story#history");
counter += 1;
}
return;

View file

@ -25,3 +25,12 @@
relocateProperty(Skin, "createtime", "created");
relocateProperty(Skin, "modifytime", "modified");
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);
}
//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) {
if (this.commentMode === "closed") {
return;