From c1f4105699cec1b2a719642d6e97aada87784f64 Mon Sep 17 00:00:00 2001 From: Hal Roberts Date: Fri, 25 Jul 2003 15:14:40 +0000 Subject: [PATCH] added support for record deletion in DataForm --- docs/changelog/5.x.x.txt | 1 + docs/upgrades/upgrade_5.4.2-5.5.0.sql | 4 ++++ lib/WebGUI/Wobject/DataForm.pm | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/docs/changelog/5.x.x.txt b/docs/changelog/5.x.x.txt index 3385619d2..a020717d4 100644 --- a/docs/changelog/5.x.x.txt +++ b/docs/changelog/5.x.x.txt @@ -10,6 +10,7 @@ - Fixed a relative hyperlink bug in htmlArea (Thanks to Andreas Graf.) - Ordered the username list in the manageUsersInGroup operation (Thanks to Andreas Graf.) + - Added support for record deletion in DataForm (Thanks to Hal Roberts.) diff --git a/docs/upgrades/upgrade_5.4.2-5.5.0.sql b/docs/upgrades/upgrade_5.4.2-5.5.0.sql index d84319c48..2511b7714 100644 --- a/docs/upgrades/upgrade_5.4.2-5.5.0.sql +++ b/docs/upgrades/upgrade_5.4.2-5.5.0.sql @@ -110,3 +110,7 @@ insert into international (internationalId,languageId,namespace,message,lastUpda delete from international where languageId=1 and namespace='SyndicatedContent' and internationalId=71; INSERT INTO international VALUES (71,'SyndicatedContent',1,'Syndicated content is content that is pulled from another site using the RDF/RSS specification. This technology is often used to pull headlines from various news sites like CNN and Slashdot. It can, of course, be used for other things like sports scores, stock market info, etc.\r\n

\r\n\r\nURL to RSS file
\r\nProvide the exact URL (starting with http://) to the syndicated content\'s RDF or RSS file. The syndicated content will be downloaded from this URL hourly.\r\n

\r\nYou can find syndicated content at the following locations:\r\n

\r\n\r\n

\r\n\r\nTo create an aggregate RSS feed, include a list of space separated urls instead of a single url. For an aggregate feed, the system will display an equal number of headlines from each source, sorted by the date the system first received the story.

\r\n\r\nTemplate
\r\nSelect a template for this content.\r\n

Maximum Headlines
\r\nEnter the maximum number of headlines that should be displayed. For an aggregate feed, the system will display an equal number of headlines from each source, even if doing so requires displaying more than the requested maximum number of headlines. Set to zero to allow any number of headlines.\r\n

',1047855741,NULL); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (90,1,'DataForm','Delete this entry.',1057208065); +delete from template where templateId=1 and namespace='DataForm'; +INSERT INTO template VALUES (1,'Mail Form','\n

\n\n\n\n
  • \n\n\n\n\n

    \n\n\n\n \">\n · \">\n \n · \">\n \n \n · \">\n \n

    \n\n\n\n\n\n \n \n \n\n\n
    \n \n \n \n \n \n \n \n \n *\n
    \n
    \n\n\n','DataForm'); + diff --git a/lib/WebGUI/Wobject/DataForm.pm b/lib/WebGUI/Wobject/DataForm.pm index 3e43bdc59..45a819116 100644 --- a/lib/WebGUI/Wobject/DataForm.pm +++ b/lib/WebGUI/Wobject/DataForm.pm @@ -166,6 +166,8 @@ sub getRecordTemplateVars { $var->{"entryList.label"} = WebGUI::International::get(86,$self->get("namespace")); $var->{"export.tab.url"} = WebGUI::URL::page('func=exportTab&wid='.$self->get("wobjectId")); $var->{"export.tab.label"} = WebGUI::International::get(84,$self->get("namespace")); ++ $var->{"delete.url"} = WebGUI::URL::page('func=delete&wid='.$self->get("wobjectId").'&entryId='.$var->{entryId}); ++ $var->{"delete.label"} = WebGUI::International::get(90,$self->get("namespace")); $var->{"back.url"} = WebGUI::URL::page(); $var->{"back.label"} = WebGUI::International::get(18,$self->get("namespace")); $var->{"addField.url"} = WebGUI::URL::page('func=editField&wid='.$self->get("wobjectId")); @@ -650,6 +652,18 @@ sub www_view { return $_[0]->processTemplate($_[0]->get("templateId"),$var); } +#------------------------------------------------------------------- +sub www_delete { + my $entryId = $session{form}{entryId}; + if (!WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId"))) { + return WebGUI::Privilege::insufficient(); + } + + WebGUI::SQL->write("delete from DataForm_entry where DataForm_entryId=".$entryId); + + $session{form}{entryId} = 'list'; + return $_[0]->www_view(); +} 1;