forward port of MultiSearch docs and setParent privilege checks
This commit is contained in:
parent
406b9310a6
commit
b32a94d4d0
5 changed files with 74 additions and 6 deletions
|
|
@ -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"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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|<p>The MultiSearch template has all the template variables used by Wobjects,
|
||||
as well as these:
|
||||
<p><b>search</b><br />
|
||||
Internationalized label for the word "search"
|
||||
</p>
|
||||
|
||||
<p><b>for</b><br />
|
||||
Internationalized label for the word "for"
|
||||
</p>
|
||||
|
||||
<p><b>submit</b><br />
|
||||
Submit button with internationalized label for "Submit".
|
||||
</p>
|
||||
|
||||
|,
|
||||
lastUpdated => 1133619940,
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -3304,8 +3304,8 @@ that Asset and all Assets below it.</p>
|
|||
|
||||
'submit' => {
|
||||
message => q|Submit|,
|
||||
lastUpdated =>0,
|
||||
context => q|Field type name|
|
||||
lastUpdated =>1140589512,
|
||||
context => q|Field type name and button label|
|
||||
},
|
||||
|
||||
'button' => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue