diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index adf4c3c79..d3d2b9b55 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -9,5 +9,7 @@ - Converted items to articles and removed the item wobject. - Converted FAQ's to USS submissions and removed the FAQ wobject. - Created format and processReplacements subs in the WebGUI::HTML package. + - Migrated extra columns to page templates and removed the Extra Column + wobject. diff --git a/docs/upgrades/upgrade_5.5.3-6.0.0.pl b/docs/upgrades/upgrade_5.5.3-6.0.0.pl index 6ab425f3a..bd297bc44 100644 --- a/docs/upgrades/upgrade_5.5.3-6.0.0.pl +++ b/docs/upgrades/upgrade_5.5.3-6.0.0.pl @@ -66,6 +66,44 @@ WebGUI::SQL->write("delete from groups where groupId=5"); WebGUI::SQL->write("delete from groupings where groupId=5"); +#-------------------------------------------- +print "\tMigrating extra columns to page templates.\n" unless ($quiet); +my $a = WebGUI::SQL->read("select a.wobjectId, a.templatePosition, a.sequenceNumber, a.pageId, b.templateId, c.width, c.class, c.spacer from wobject a + left join page b on a.pageId=b.pageId left join ExtraColumn c on a.wobjectId=c.wobjectId where a.namespace='ExtraColumn'"); +while (my $data = $a->hashRef) { + my ($template, $name) = WebGUI::SQL->quickArray("select template,name from template where namespace='Page' and templateId=".$data->{templateId}); + $name .= " w/ Extra Column"; + #eliminate the need for compatibility with old-style page templates + $template =~ s/\^(\d+)\;/_positionFormat5x($1)/eg; + my $i = 1; + while ($template =~ m/page\.position$i/) { + $i++; + } + my $position = $i; + my $replacement = '{templatePosition}.'>'; + my $spliton = "{templatePosition}.">"; + my @parts = split(/$spliton/, $template); + $template = $parts[0].$replacement.$parts[1]; + my ($id) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='Page'"); + $id++; + WebGUI::SQL->write("insert into template (templateId, name, template, namespace) values ($id, ".quote($name).", ".quote($template).", 'Page')"); + WebGUI::SQL->write("update page set templateId=$id where pageId=".$data->{pageId}); + WebGUI::SQL->write("update wobject set templatePosition=".$position." where pageId=".$data->{pageId}." and templatePosition=". + $data->{templatePosition}." and sequenceNumber>".$data->{sequenceNumber}); + WebGUI::SQL->write("delete from wobject where wobjectId=".$data->{wobjectId}); + my $b = WebGUI::SQL->read("select wobjectId from wobject where pageId=".$data->{pageId}." order by templatePosition,sequenceNumber"); + my $i = 0; + while (my ($wid) = $b->array) { + $i++; + WebGUI::SQL->write("update wobject set sequenceNumber='$i' where wobjectId=$wid"); + } + $b->finish; +} +$a->finish; +WebGUI::SQL->write("drop table ExtraColumn"); + + #-------------------------------------------- print "\tMigrating page templates.\n" unless ($quiet); my $sth = WebGUI::SQL->read("select * from template where namespace='Page'"); @@ -213,6 +251,9 @@ WebGUI::SQL->write("drop table FAQ_question"); WebGUI::SQL->write("delete from incrementer where incrementerId='FAQ_questionId'"); + + + #-------------------------------------------- print "\tUpdating config file.\n" unless ($quiet); my $pathToConfig = '../../etc/'.$configFile; @@ -224,7 +265,7 @@ $conf->set("macros"=>$macros); my $wobjects = $conf->get("wobjects"); my @newWobjects; foreach my $wobject (@{$wobjects}) { - unless ($wobject eq "Item" || $wobject eq "FAQ") { + unless ($wobject eq "Item" || $wobject eq "FAQ" || $wobject eq "ExtraColumn") { push(@newWobjects,$wobject); } } @@ -239,6 +280,7 @@ unlink("../../lib/WebGUI/Operation/Style.pm"); unlink("../../lib/WebGUI/Wobject/Item.pm"); #unlink("../../lib/WebGUI/Wobject/LinkList.pm"); unlink("../../lib/WebGUI/Wobject/FAQ.pm"); +unlink("../../lib/WebGUI/Wobject/ExtraColumn.pm"); diff --git a/docs/upgrades/upgrade_5.5.3-6.0.0.sql b/docs/upgrades/upgrade_5.5.3-6.0.0.sql index 19fe3b7fe..3890ad414 100644 --- a/docs/upgrades/upgrade_5.5.3-6.0.0.sql +++ b/docs/upgrades/upgrade_5.5.3-6.0.0.sql @@ -58,8 +58,7 @@ insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'EventsCal insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'MessageBoard', 61, 71, '3,MessageBoard;2,MessageBoard;21,WebGUI;'); insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (21, 'WebGUI', 671, 626, '19,WebGUI;18,WebGUI;27,WebGUI;14,WebGUI;'); insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'Article', 61, 71, '2,Article;71,WebGUI;21,WebGUI;'); -insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'ExtraColumn', 61, 71, '21,WebGUI;'); -insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (27, 'WebGUI', 677, 632, '1,Article;1,EventsCalendar;1,ExtraColumn;1,FileManager;1,HttpProxy;1,DataForm;1,MessageBoard;1,Poll;1,Product;1,SiteMap;1,SQLReport;1,Survey;1,SyndicatedContent;1,USS;1,WobjectProxy;21,WebGUI;'); +insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (27, 'WebGUI', 677, 632, '1,Article;1,EventsCalendar;1,FileManager;1,HttpProxy;1,DataForm;1,MessageBoard;1,Poll;1,Product;1,SiteMap;1,SQLReport;1,Survey;1,SyndicatedContent;1,USS;1,WobjectProxy;21,WebGUI;'); insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'Poll', 61, 71, '2,Poll;21,WebGUI;'); insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'SiteMap', 61, 71, '2,SiteMap;21,WebGUI;'); insert into help (helpId,namespace,titleId,bodyId,seeAlso) values (1, 'SQLReport', 61, 71, '21,WebGUI;'); @@ -153,6 +152,7 @@ INSERT INTO template VALUES (1,'Default Submission Form','

\n\n\n \n \n \n \n \n \n \n \n
\n\n','USS/SubmissionForm'); insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (87,1,'USS','Submission Form Template', 1070027660,'Prompt the user to select a template for the USS submission form.'); insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (88,1,'USS','Sequence', 1070027660,'A type of ordering in the USS that will allow the admin to specify (or sequence) the order of the results.'); +delete from international where namespace='ExtraColumn';