migrated extra column wobject to page templates.

This commit is contained in:
JT Smith 2003-11-30 04:53:12 +00:00
parent 83f1188ea3
commit c66612d680
3 changed files with 47 additions and 3 deletions

View file

@ -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.

View file

@ -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 = '<tmpl_var page.position'.$data->{templatePosition}.'></td><td width="'.$data->{spacer}
.'"></td><td width="'.$data->{width}.'" class="'.$data->{class}.'" valign="top"><tmpl_var page.position'.$position.'>';
my $spliton = "<tmpl_var page.position".$data->{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");

View file

@ -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','<h1><tmpl_var submissi
INSERT INTO template VALUES (2,'FAQ Submission Form','<h1><tmpl_var question.header.label></h1>\n\n<tmpl_var form.header>\n <table>\n <tmpl_if user.isVisitor> <tmpl_if submission.isNew>\n <tr><td><tmpl_var visitorName.label></td><td><tmpl_var visitorName.form></td></tr>\n </tmpl_if> </tmpl_if>\n <tr><td><tmpl_var question.label></td><td><tmpl_var title.form.textarea></td></tr>\n <tr><td><tmpl_var answer.label></td><td><tmpl_var body.form></td></tr>\n <tr><td><tmpl_var contentType.label></td><td><tmpl_var contentType.form></td></tr>\n <tr><td></td><td><tmpl_var form.submit></td></tr>\n </table>\n<tmpl_var form.footer>\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';