From b32a94d4d07a491a64b79913e4ef9f1ca76dd594 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 23 Feb 2006 00:54:30 +0000 Subject: [PATCH] forward port of MultiSearch docs and setParent privilege checks --- lib/WebGUI/Asset/Wobject/MultiSearch.pm | 12 ++++++-- lib/WebGUI/AssetLineage.pm | 7 ++++- lib/WebGUI/Help/Asset_MultiSearch.pm | 26 ++++++++++++++++ lib/WebGUI/i18n/English/Asset_MultiSearch.pm | 31 +++++++++++++++++++- lib/WebGUI/i18n/English/WebGUI.pm | 4 +-- 5 files changed, 74 insertions(+), 6 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/MultiSearch.pm b/lib/WebGUI/Asset/Wobject/MultiSearch.pm index 32110fd07..3997e53f5 100644 --- a/lib/WebGUI/Asset/Wobject/MultiSearch.pm +++ b/lib/WebGUI/Asset/Wobject/MultiSearch.pm @@ -48,7 +48,7 @@ sub definition { tab=>"display", defaultValue=>'MultiSearchTmpl0000001', namespace=>"MultiSearch", - hoverHelp=>$i18n->get('MultiSearch Template'), + hoverHelp=>$i18n->get('MultiSearch Template description'), label=>$i18n->get('MultiSearch Template') }, # predefinedSearches=>{ @@ -97,7 +97,15 @@ to be displayed within the page style sub view { my $self = shift; - return $self->processTemplate({}, undef, $self->{_viewTemplate}); + my %var = $self->get(); + my $i18n = WebGUI::International->new($self->session, 'Asset_MultiSearch'); + + #Set some template variables + $var{'for'} = $i18n->get('for'); + $var{'search'} = $i18n->get('search'); + $var{'submit'} = WebGUI::Form::Submit->new({name=>'SearchSubmit',value=>$i18n->get('submit','WebGUI')})->toHtml(); + + return $self->processTemplate(\%var, undef, $self->get("templateId")); } diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index ae6b43c5f..bd11f3c14 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -568,11 +568,13 @@ An asset object reference representing the new parent to paste the asset to. sub setParent { my $self = shift; my $newParent = shift; + return 0 unless $self->session->user->isInGroup('4'); return 0 unless (defined $newParent); # can't move it if a parent object doesn't exist return 0 if ($newParent->getId eq $self->get("parentId")); # don't move it to where it already is return 0 if ($newParent->getId eq $self->getId); # don't move it to itself if (defined $newParent) { my $oldLineage = $self->get("lineage"); + return 0 unless $newParent->canEdit; my $lineage = $newParent->get("lineage").$newParent->getNextChildRank; return 0 if ($lineage =~ m/^$oldLineage/); # can't move it to its own child $self->session->db->beginTransaction; @@ -698,7 +700,10 @@ sub www_setParent { my $self = shift; return $self->session->privilege->insufficient() unless $self->canEdit; my $newParent = WebGUI::Asset->newByDynamicClass($self->session->form->process("assetId")); - $self->setParent($newParent) if (defined $newParent); + if (defined $newParent) { + my $success = $self->setParent($newParent); + return $self->session->privilege->insufficient() unless $success; + } return $self->www_manageAssets(); } diff --git a/lib/WebGUI/Help/Asset_MultiSearch.pm b/lib/WebGUI/Help/Asset_MultiSearch.pm index 377bd18e0..07cceefb3 100644 --- a/lib/WebGUI/Help/Asset_MultiSearch.pm +++ b/lib/WebGUI/Help/Asset_MultiSearch.pm @@ -5,13 +5,39 @@ our $HELP = { title => 'multisearch add/edit title', body => 'multisearch add/edit body', fields => [ + { + title => 'MultiSearch Template', + description => 'MultiSearch Template description', + namespace => 'Asset_MultiSearch', + }, ], related => [ + { + tag => 'multisearch template', + namespace => 'Asset_MultiSearch' + }, { tag => 'dashboard add/edit', namespace => 'Asset_Dashboard' }, ] + }, + + 'multisearch template' => { + title => 'multisearch template title', + body => 'multisearch template body', + fields => [ + ], + related => [ + { + tag => 'multisearch template', + namespace => 'Asset_MultiSearch' + }, + { + tag => 'wobject template', + namespace => 'Wobject' + } + ] } }; diff --git a/lib/WebGUI/i18n/English/Asset_MultiSearch.pm b/lib/WebGUI/i18n/English/Asset_MultiSearch.pm index e12febec5..c80bfb67e 100644 --- a/lib/WebGUI/i18n/English/Asset_MultiSearch.pm +++ b/lib/WebGUI/i18n/English/Asset_MultiSearch.pm @@ -7,6 +7,11 @@ our $I18N = { lastUpdated => 1133619940, }, + 'MultiSearch Template' => { + message => q|Select a template to display the multiple search engine form to the user.|, + lastUpdated => 1140587435, + }, + 'assetName' => { message => q|MultiSearch|, lastUpdated => 1133619940, @@ -18,7 +23,31 @@ our $I18N = { }, 'multisearch add/edit body' => { - message => q|The MultiSearch wobject is a simple wobject that enables the user to search various search engines. The results appear in a new window. The search engines are entirely contained within the MultiSearch template, for which there are no special template variables.|, + message => q|The MultiSearch wobject is a simple wobject that enables the user to search various search engines. The results appear in a new window.|, + lastUpdated => 1140587496, + }, + + 'multisearch template title' => { + message => q|MultiSearch Template Variables|, + lastUpdated => 1133619940, + }, + + 'multi search template body' => { + message => q|

The MultiSearch template has all the template variables used by Wobjects, +as well as these: +

search
+Internationalized label for the word "search" +

+ +

for
+Internationalized label for the word "for" +

+ +

submit
+Submit button with internationalized label for "Submit". +

+ +|, lastUpdated => 1133619940, }, diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 807607a3a..0c51fd870 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -3304,8 +3304,8 @@ that Asset and all Assets below it.

'submit' => { message => q|Submit|, - lastUpdated =>0, - context => q|Field type name| + lastUpdated =>1140589512, + context => q|Field type name and button label| }, 'button' => {