Remove extraneous discussion template vars from Default Article template.

This commit is contained in:
Drake 2006-09-28 02:08:04 +00:00
parent e8fd02ca9e
commit 7c31a532c9
3 changed files with 171 additions and 0 deletions

View file

@ -1,6 +1,7 @@
7.0.9
- partial fix: invalid Message-ID headers in outgoing mail
- fix: HttpProxy not doing file uploads correctly
- fix: leftover discussion template variables in Default Article template
7.0.8
- Fixed a couple of minor bugs with the default values of the Request

View file

@ -0,0 +1,46 @@
#PBtmpl0000000000000002
<a name="id<tmpl_var assetId>" id="id<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
<p><tmpl_var controls></p>
</tmpl_if>
<tmpl_if displayTitle>
<h2><tmpl_var title></h2>
</tmpl_if>
<tmpl_if pagination.isFirstPage>
<tmpl_if image.url>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="content">
<img src="<tmpl_var image.url>" align="right" border="0" alt="<tmpl_var image.url>" />
</tmpl_if>
</tmpl_if>
<tmpl_if description>
<tmpl_var description>
</tmpl_if>
<tmpl_if pagination.isLastPage>
<tmpl_if linkUrl>
<tmpl_if linkTitle>
<p />
<a href="<tmpl_var linkUrl>"><tmpl_var linkTitle></a>
</tmpl_if>
</tmpl_if>
<tmpl_if attachment.name><p><p style="display:inline;vertical-align:middle;"><a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.icon>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var attachment.name>" /> <tmpl_var attachment.name></a></p></p></tmpl_if>
</tmpl_if>
<tmpl_if pagination.pageCount.isMultiple>
<tmpl_var pagination.previousPage>
&#183;
<tmpl_var pagination.pageList.upTo20>
&#183;
<tmpl_var pagination.nextPage>
</tmpl_if>
<tmpl_if pagination.isFirstPage>
<tmpl_if image.url>
</td></tr></table>
</tmpl_if>
</tmpl_if>

View file

@ -0,0 +1,124 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use lib "../../lib";
use strict;
use Getopt::Long;
use WebGUI::Session;
my $toVersion = "7.0.9";
my $quiet;
my $session = start();
# upgrade functions go here
finish($session);
##-------------------------------------------------
#sub exampleFunction {
# my $session = shift;
# print "\tWe're doing some stuff here that you should know about.\n" unless ($quiet);
# # and here's our code
#}
# ---- DO NOT EDIT BELOW THIS LINE ----
#-------------------------------------------------
sub start {
my $configFile;
$|=1; #disable output buffering
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
my $session = WebGUI::Session->open("../..",$configFile);
$session->user({userId=>3});
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Upgrade to ".$toVersion});
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
updateTemplates($session);
return $session;
}
#-------------------------------------------------
sub finish {
my $session = shift;
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->close();
}
#-------------------------------------------------
sub updateTemplates {
my $session = shift;
return undef unless (-d "templates-".$toVersion);
print "\tUpdating templates.\n" unless ($quiet);
opendir(DIR,"templates-".$toVersion);
my @files = readdir(DIR);
closedir(DIR);
my $importNode = WebGUI::Asset->getImportNode($session);
my $newFolder = undef;
foreach my $file (@files) {
next unless ($file =~ /\.tmpl$/);
open(FILE,"<templates-".$toVersion."/".$file);
my $first = 1;
my $create = 0;
my $head = 0;
my %properties = (className=>"WebGUI::Asset::Template");
while (my $line = <FILE>) {
if ($first) {
$line =~ m/^\#(.*)$/;
$properties{id} = $1;
$first = 0;
} elsif ($line =~ m/^\#create$/) {
$create = 1;
} elsif ($line =~ m/^\#(.*):(.*)$/) {
$properties{$1} = $2;
} elsif ($line =~ m/^~~~$/) {
$head = 1;
} elsif ($head) {
$properties{headBlock} .= $line;
} else {
$properties{template} .= $line;
}
}
close(FILE);
if ($create) {
$newFolder = createNewTemplatesFolder($importNode) unless (defined $newFolder);
my $template = $newFolder->addChild(\%properties, $properties{id});
} else {
my $template = WebGUI::Asset->new($session,$properties{id}, "WebGUI::Asset::Template");
if (defined $template) {
my $newRevision = $template->addRevision(\%properties);
}
}
}
}
#-------------------------------------------------
sub createNewTemplatesFolder {
my $importNode = shift;
my $newFolder = $importNode->addChild({
className=>"WebGUI::Asset::Wobject::Folder",
title => $toVersion." New Templates",
menuTitle => $toVersion." New Templates",
url=> $toVersion."_new_templates",
groupIdView=>"12"
});
return $newFolder;
}