diff --git a/docs/upgrades/upgrade_3.7.0-3.8.0.sql b/docs/upgrades/upgrade_3.7.0-3.8.0.sql index 7cf85e4c4..636167288 100644 --- a/docs/upgrades/upgrade_3.7.0-3.8.0.sql +++ b/docs/upgrades/upgrade_3.7.0-3.8.0.sql @@ -104,6 +104,8 @@ delete from widget where namespace='EventsCalendar'; alter table EventsCalendar change widgetId wobjectId int not null; alter table EventsCalendar_event change widgetId wobjectId int not null; +update incrementer set incrementerId='wobjectId' where incrementerId='widgetId'; + INSERT INTO international VALUES (21,'EventsCalendar','English','Proceed to add event?'); INSERT INTO international VALUES (20,'EventsCalendar','English','Add an event.'); INSERT INTO international VALUES (38,'UserSubmission','English','(Select \"No\" if you\'re writing an HTML/Rich Edit submission.)'); diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index 04c6189f2..2fe9c811d 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -277,7 +277,7 @@ sub purge { sub set { my ($key, $sql, @update, $i); if ($_[0]->{_property}{wobjectId} eq "new") { - $_[0]->{_property}{wobjectId} = getNextId("widgetId"); + $_[0]->{_property}{wobjectId} = getNextId("wobjectId"); $_[0]->{_property}{pageId} = ${$_[1]}{pageId} || $session{page}{pageId}; $_[0]->{_property}{sequenceNumber} = _getNextSequenceNumber($_[0]->{_property}{pageId}); $_[0]->{_property}{addedBy} = $session{user}{userId}; diff --git a/lib/WebGUI/Wobject/SQLReport.pm b/lib/WebGUI/Wobject/SQLReport.pm index 684b1ef06..21dd9578e 100644 --- a/lib/WebGUI/Wobject/SQLReport.pm +++ b/lib/WebGUI/Wobject/SQLReport.pm @@ -60,80 +60,6 @@ sub set { $_[0]->SUPER::set($_[1],[qw(template dbQuery DSN username identifier convertCarriageReturns paginateAfter preprocessMacros debugMode)]); } -#------------------------------------------------------------------- -sub www_add { - my ($output, %hash); - tie %hash, 'Tie::IxHash'; - if (WebGUI::Privilege::canEditPage()) { - $output = helpLink(1,$namespace); - $output .= '

'.WebGUI::International::get(2,$namespace).'

'; - $output .= formHeader(); - $output .= WebGUI::Form::hidden("widget",$namespace); - $output .= WebGUI::Form::hidden("func","addSave"); - $output .= ''; - $output .= tableFormRow(WebGUI::International::get(99), - WebGUI::Form::text("title",20,128,widgetName())); - $output .= tableFormRow(WebGUI::International::get(174), - WebGUI::Form::checkbox("displayTitle",1,1)); - $output .= tableFormRow(WebGUI::International::get(175), - WebGUI::Form::checkbox("processMacros",1,1)); - %hash = WebGUI::Widget::getPositions(); - $output .= tableFormRow(WebGUI::International::get(363), - WebGUI::Form::selectList("templatePosition",\%hash)); - $output .= tableFormRow(WebGUI::International::get(85), - WebGUI::Form::textArea("description",'','','',1)); - $output .= tableFormRow(WebGUI::International::get(15,$namespace), - WebGUI::Form::checkbox("preprocessMacros",1)); - $output .= tableFormRow(WebGUI::International::get(16,$namespace), - WebGUI::Form::checkbox("debugMode",1)); - $output .= tableFormRow(WebGUI::International::get(4,$namespace), - WebGUI::Form::textArea("dbQuery",'')); - $output .= tableFormRow(WebGUI::International::get(3,$namespace), - WebGUI::Form::textArea("template",'','','',1)); - $output .= tableFormRow(WebGUI::International::get(5,$namespace), - WebGUI::Form::text("DSN",20,255,$session{config}{dsn})); - $output .= tableFormRow(WebGUI::International::get(6,$namespace), - WebGUI::Form::text("username",20,255,$session{config}{dbuser})); - $output .= tableFormRow(WebGUI::International::get(7,$namespace), - WebGUI::Form::password("identifier",20,255)); - $output .= tableFormRow(WebGUI::International::get(14,$namespace), - WebGUI::Form::text("paginateAfter",20,30,50)); - $output .= tableFormRow(WebGUI::International::get(13,$namespace), - WebGUI::Form::checkbox("convertCarriageReturns",1)); - $output .= formSave(); - $output .= '
'; - return $output; - } else { - return WebGUI::Privilege::insufficient(); - } - return $output; -} - -#------------------------------------------------------------------- -sub www_addSave { - my ($widgetId); - if (WebGUI::Privilege::canEditPage()) { - $widgetId = create($session{page}{pageId},$session{form}{widget}, - $session{form}{title},$session{form}{displayTitle}, - $session{form}{description},$session{form}{processMacros}, - $session{form}{templatePosition}); - WebGUI::SQL->write("insert into SQLReport values($widgetId, ". - quote($session{form}{template}).", ". - quote($session{form}{dbQuery}).", ". - quote($session{form}{DSN}).", ". - quote($session{form}{username}).", ". - quote($session{form}{identifier}).", ". - "'$session{form}{convertCarriageReturns}', ". - "'$session{form}{paginateAfter}', ". - "'$session{form}{preprocessMacros}', ". - "'$session{form}{debugMode}'". - ")"); - return ""; - } else { - return WebGUI::Privilege::insufficient(); - } -} - #------------------------------------------------------------------- sub www_copy { if (WebGUI::Privilege::canEditPage()) { @@ -172,7 +98,7 @@ sub www_edit { #------------------------------------------------------------------- sub www_editSave { - my ($widgetId, $displayTitle, $image, $attachment); + my ($wobjectId, $displayTitle, $image, $attachment); if (WebGUI::Privilege::canEditPage()) { $_[0]->SUPER::www_editSave(); $_[0]->set({ @@ -195,7 +121,11 @@ sub www_editSave { #------------------------------------------------------------------- sub www_view { my ($dsn, $query, @row, $i, $rownum, $p, $ouch, $output, $sth, $dbh, @result, @template, $temp, $col, $errorMessage, $url); - $query = WebGUI::Macro::process($_[0]->get("dbQuery")) if ($_[0]->get("preprocessMacros")); + if ($_[0]->get("preprocessMacros")) { + $query = WebGUI::Macro::process($_[0]->get("dbQuery")); + } else { + $query = $_[0]->get("dbQuery"); + } $dsn = $_[0]->get("DSN"); $output = $_[0]->displayTitle; $output .= $_[0]->description; diff --git a/lib/WebGUI/Wobject/SyndicatedContent.pm b/lib/WebGUI/Wobject/SyndicatedContent.pm index b53638d11..b0610238a 100644 --- a/lib/WebGUI/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Wobject/SyndicatedContent.pm @@ -52,45 +52,6 @@ sub set { $_[0]->SUPER::set($_[1], [qw(rssUrl content lastFetched)]); } -#------------------------------------------------------------------- -sub www_add { - my ($output, %hash); - tie %hash, 'Tie::IxHash'; - if (WebGUI::Privilege::canEditPage()) { - $output = helpLink(1,$namespace); - $output .= '

'.WebGUI::International::get(3,$namespace).'

'; - $output .= formHeader(); - $output .= WebGUI::Form::hidden("widget",$namespace); - $output .= WebGUI::Form::hidden("func","addSave"); - $output .= ''; - $output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,'Syndicated Content')); - $output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1)); - $output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1)); - %hash = WebGUI::Widget::getPositions(); - $output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash)); - $output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'','','',1)); - $output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::text("rssUrl",20,2048)); - $output .= formSave(); - $output .= '
'; - return $output; - } else { - return WebGUI::Privilege::insufficient(); - } - return $output; -} - -#------------------------------------------------------------------- -sub www_addSave { - my ($widgetId); - if (WebGUI::Privilege::canEditPage()) { - $widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition}); - WebGUI::SQL->write("insert into SyndicatedContent values ($widgetId, ".quote($session{form}{rssUrl}).", 'Not yet fetched.', '".time()."')"); - return ""; - } else { - return WebGUI::Privilege::insufficient(); - } -} - #------------------------------------------------------------------- sub www_copy { if (WebGUI::Privilege::canEditPage()) {