From 767b89c1c93f636ead2f04d5cf69a6b7d5679d97 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 3 May 2007 00:24:00 +0000 Subject: [PATCH] upgrade file --- docs/upgrades/upgrade_7.3.15-7.3.16.pl | 292 +++++++++++++++++++++++++ 1 file changed, 292 insertions(+) create mode 100644 docs/upgrades/upgrade_7.3.15-7.3.16.pl diff --git a/docs/upgrades/upgrade_7.3.15-7.3.16.pl b/docs/upgrades/upgrade_7.3.15-7.3.16.pl new file mode 100644 index 000000000..0768b6092 --- /dev/null +++ b/docs/upgrades/upgrade_7.3.15-7.3.16.pl @@ -0,0 +1,292 @@ +#------------------------------------------------------------------- +# 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.3.16"; # make this match what version you're going to +my $quiet; # this line required + + +my $session = start(); # this line required + +trackEmails($session); +fixCss($session); + +finish($session); # this line required + + +#------------------------------------------------- +sub trackEmails { + my $session = shift; + print "\tTrack email messages for future debugging purposes.\n" unless ($quiet); + $session->db->write("alter table Post add column originalEmail mediumtext"); +} + +#------------------------------------------------- +sub fixCss { + my $session = shift; + print "\tFixing default css 03 template.\n" unless ($quiet); + my $css = < #mainBody { + height:auto; + min-height:500px; +} +#contentArea { + z-index:2; + position:relative; + padding-top:50px; + padding-left:10px; + padding-right:20px; + padding-bottom:20px; + -moz-box-sizing:border-box; + font-family:verdana; + font-size:9pt; + +} +html #main #mainBody #contentArea { + height:1%; +} +#topCorner { + width:100%; + height:214px; + position:absolute; + top:0px; + left:0px; + background: url('^FileUrl(style3/main_top_bg.jpg);') repeat-x; + z-index:1; +} +#bottomCorner { + width:100%; + height:211px; + position:absolute; + bottom:59px; + right:0px; + background: url('^FileUrl(style3/main_bottom.jpg);') no-repeat right; + z-index:1; +} +* html #bottomCorner { + bottom:58px; +} + +#footer { + width:100%; + margin:0px; + background:#000 url('^FileUrl(style3/footer_right.jpg);') no-repeat right top; + height:57px; + border-top:solid #B53018 2px; + text-align:right; + position:relative; + z-index:0; +} +#footer #copyright { + color:#3b3b3b; + font-family:arial; + position:absolute; + top:20px; + left:30px; + font-size:8pt; +} + +STOP + my $asset = WebGUI::Asset->new($session, "7.0-style0000000000051", "WebGUI::Asset::Snippet"); + if (defined $asset) { + $asset->addRevision({snippet=>$css}); + } +} + + + +# ---- 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,""WebGUI::Asset::Template"); + while (my $line = ) { + 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; +} + + +