* Added some missing and fixed some incorrect res.data.title properties

* Moved code removing the current layout *after* the one backing it up
This commit is contained in:
Tobi Schäfer 2009-10-27 22:58:07 +00:00
parent b34390b9a9
commit 323254321d
4 changed files with 12 additions and 9 deletions

View file

@ -59,6 +59,7 @@ Archive.prototype.getPermission = function(action) {
} }
Archive.prototype.main_action = function() { Archive.prototype.main_action = function() {
res.data.title = "Archive of " + res.handlers.site.getTitle();
res.data.body = this.renderSkinAsString("Archive#main"); res.data.body = this.renderSkinAsString("Archive#main");
res.handlers.site.renderSkin("Site#page"); res.handlers.site.renderSkin("Site#page");
res.handlers.site.log(); res.handlers.site.log();

View file

@ -103,7 +103,7 @@ Layout.prototype.main_action = function() {
app.log(ex); app.log(ex);
} }
} }
res.data.title = gettext("Layout of site {0}", res.handlers.site.title); res.data.title = gettext("Layout of {0}", res.handlers.site.title);
res.data.body = this.renderSkinAsString("$Layout#main"); res.data.body = this.renderSkinAsString("$Layout#main");
res.handlers.site.renderSkin("Site#page"); res.handlers.site.renderSkin("Site#page");
return; return;
@ -192,8 +192,6 @@ Layout.prototype.import_action = function() {
if (!data.upload || data.upload.contentLength === 0) { if (!data.upload || data.upload.contentLength === 0) {
throw Error(gettext("Please upload a layout package.")); throw Error(gettext("Please upload a layout package."));
} }
Layout.remove(this);
res.commit();
// Create destination directory // Create destination directory
var destination = this.getFile(); var destination = this.getFile();
destination.makeDirectory(); destination.makeDirectory();
@ -208,14 +206,16 @@ Layout.prototype.import_action = function() {
if (!data.version || data.version !== Root.VERSION) { if (!data.version || data.version !== Root.VERSION) {
throw Error("Incompatible layout version."); throw Error("Incompatible layout version.");
} }
// Backup the current layout if necessary // Backup the current layout if possible
if (destination.list().length > 0) { if (destination.list().length > 0) {
var timestamp = (new Date).format("yyyyMMdd-HHmmss"); var timestamp = (new Date).format("yyyyMMdd-HHmmss");
var zip = new helma.Zip(); var zip = this.getArchive(res.skinpath);
zip.add(destination);
zip.save(this.getFile("../layout-" + timestamp + ".zip")); zip.save(this.getFile("../layout-" + timestamp + ".zip"));
zip.close();
} }
// Remove old layout and replace it with new one
Layout.remove(this);
res.commit();
destination.makeDirectory(); // FIXME: This is in fact necessary again (s. line 197)
temp.renameTo(destination); temp.renameTo(destination);
// Update database with imported data // Update database with imported data
layout = this; layout = this;
@ -231,6 +231,7 @@ Layout.prototype.import_action = function() {
res.message = ex; res.message = ex;
app.log(ex); app.log(ex);
} }
res.redirect(this.href());
} }
res.data.title = gettext("Import layout"); res.data.title = gettext("Import layout");
res.data.body = this.renderSkinAsString("$Layout#import"); res.data.body = this.renderSkinAsString("$Layout#import");

View file

@ -60,7 +60,7 @@ Skins.prototype.main_action = function() {
if (!this._parent) { if (!this._parent) {
res.redirect(res.handlers.layout.skins.href()); res.redirect(res.handlers.layout.skins.href());
} }
res.data.title = gettext("Custom skins of {0}", this._parent.title); res.data.title = gettext("Basic skins of {0}", res.handlers.site.title);
res.data.list = this.renderSkinAsString("$Skins#basic"); res.data.list = this.renderSkinAsString("$Skins#basic");
res.data.body = this.renderSkinAsString("$Skins#main"); res.data.body = this.renderSkinAsString("$Skins#main");
res.handlers.site.renderSkin("Site#page"); res.handlers.site.renderSkin("Site#page");
@ -149,7 +149,7 @@ Skins.prototype.create_action = function() {
} }
Skins.prototype.modified_action = function() { Skins.prototype.modified_action = function() {
res.data.title = gettext("Modified skins of {0}", this._parent.title); res.data.title = gettext("Modified skins of {0}", res.handlers.site.title);
res.push(); res.push();
this.modified.forEach(function() { this.modified.forEach(function() {
this.renderSkin("$Skin#listItem"); this.renderSkin("$Skin#listItem");

View file

@ -36,6 +36,7 @@ Tags.prototype.main_action = function() {
this.setPage(req.data.page); this.setPage(req.data.page);
res.redirect(this.href(action)); res.redirect(this.href(action));
} }
res.data.title = gettext("{0} of {1}", this.getTitle(), res.handlers.site.getTitle());
res.data.body = this.renderSkinAsString("$Tags#" + req.action); res.data.body = this.renderSkinAsString("$Tags#" + req.action);
res.handlers.site.renderSkin("Site#page"); res.handlers.site.renderSkin("Site#page");
return; return;