fixed shortcut
This commit is contained in:
parent
177328b550
commit
1b08faa78b
5 changed files with 75 additions and 51 deletions
|
|
@ -154,7 +154,7 @@ Adds a child asset to a parent. Creates a new AssetID for child. Makes the paren
|
|||
|
||||
=head3 properties
|
||||
|
||||
A hash reference containing a list of properties to associate with the child. The only used property value is "className"
|
||||
A hash reference containing a list of properties to associate with the child. The only required property value is "className"
|
||||
|
||||
=head3 id
|
||||
|
||||
|
|
@ -165,14 +165,14 @@ A unique 22 character ID. By default WebGUI will generate this and you should a
|
|||
sub addChild {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $id = WebGUI::Id::generate() || shift;
|
||||
my $id = shift || WebGUI::Id::generate();
|
||||
my $lineage = $self->get("lineage").$self->getNextChildRank;
|
||||
$self->{_hasChildren} = 1;
|
||||
WebGUI::SQL->beginTransaction;
|
||||
WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, state, className, url, startDate, endDate)
|
||||
WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, state, className, url, startDate, endDate, ownerUserId, groupIdEdit, groupIdView)
|
||||
values (".quote($id).",".quote($self->getId).", ".quote($lineage).",
|
||||
'published', ".quote($properties->{className}).", ".quote($id).",
|
||||
997995720, 9223372036854775807)");
|
||||
997995720, 9223372036854775807,'3','3','7')");
|
||||
my $tempAsset = WebGUI::Asset->newByDynamicClass("new",$properties->{className});
|
||||
foreach my $definition (@{$tempAsset->definition}) {
|
||||
unless ($definition->{tableName} eq "asset") {
|
||||
|
|
@ -1425,7 +1425,7 @@ sub getToolbar {
|
|||
.copyIcon('func=copy',$self->get("url"));
|
||||
# .moveTopIcon('func=moveTop&wid='.${$wobject}{wobjectId})
|
||||
# .moveBottomIcon('func=moveBottom&wid='.${$wobject}{wobjectId})
|
||||
$toolbar .= shortcutIcon('func=createShortcut') unless ($self->get("className") =~ /Shortcut/);
|
||||
$toolbar .= shortcutIcon('func=createShortcut',$self->get("url")) unless ($self->get("className") =~ /Shortcut/);
|
||||
return $toolbar;
|
||||
}
|
||||
|
||||
|
|
@ -1800,12 +1800,12 @@ sub processTemplate {
|
|||
%{$self->{_properties}},
|
||||
%{$var}
|
||||
);
|
||||
if (defined $self->get("_WobjectProxy")) {
|
||||
$vars{isShortcut} = 1;
|
||||
my ($originalPageURL) = WebGUI::SQL->quickArray("select url from asset where assetId=".quote($self->getId),WebGUI::SQL->getSlave);
|
||||
$vars{originalURL} = WebGUI::URL::gateway($originalPageURL."#".$self->getId);
|
||||
my $template = WebGUI::Asset::Template->new($templateId);
|
||||
if (defined $template) {
|
||||
return $template->process(\%vars);
|
||||
} else {
|
||||
return "Error: Can't instanciate template ".$templateId;
|
||||
}
|
||||
return WebGUI::Asset::Template->new($templateId)->process(\%vars);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -2079,8 +2079,8 @@ sub updateHistory {
|
|||
WebGUI::SQL->beginTransaction;
|
||||
WebGUI::SQL->write("insert into assetHistory (assetId, userId, actionTaken, dateStamp) values (
|
||||
".quote($self->getId).", ".quote($userId).", ".quote($action).", ".$dateStamp.")");
|
||||
$self->update({lastUpdated=>$dateStamp,lastUpdatedBy=>$userId});
|
||||
WebGUI::SQL->commit;
|
||||
$self->update({lastUpdated=>$dateStamp,lastUpdatedBy=>$userId});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -2167,9 +2167,16 @@ sub www_copyList {
|
|||
|
||||
sub www_createShortcut () {
|
||||
my $self = shift;
|
||||
$self->addChild({
|
||||
className=>$self->get("className"),
|
||||
my $child = $self->addChild({
|
||||
className=>'WebGUI::Asset::Shortcut',
|
||||
shortcutToAssetId=>$self->getId,
|
||||
title=>$self->get("title"),
|
||||
menuTitle=>$self->get("menuTitle"),
|
||||
url=>$self->get("title"),
|
||||
templateId=>'PBtmpl0000000000000140'
|
||||
});
|
||||
$child->cut;
|
||||
return $self->getContainer->www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $definition = shift;
|
||||
push(@{$definition}, {
|
||||
tableName=>'FileAsset',
|
||||
className=>'WebGUI::Asset::File',
|
||||
tableName=>'Shortcut',
|
||||
className=>'WebGUI::Asset::Shortcut',
|
||||
properties=>{
|
||||
shortcutToAssetId=>{
|
||||
fieldType=>"hidden",
|
||||
|
|
@ -63,6 +63,10 @@ sub definition {
|
|||
shortcutCriteria=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>"",
|
||||
},
|
||||
templateId=>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>"PBtmpl0000000000000140"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -75,7 +79,11 @@ sub definition {
|
|||
sub getEditForm {
|
||||
my $self = shift;
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
my $originalTemplate = WebGUI::Asset::Template->new(self->getShortcut->get("templateId"));
|
||||
my $originalTemplate = WebGUI::Asset::Template->new($self->getShortcut->get("templateId"));
|
||||
$tabform->getTab("display")->template(
|
||||
-value=>$self->getValue("templateId"),
|
||||
-namespace=>"Shortcut"
|
||||
);
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"overrideTemplateId",
|
||||
-value=>$self->getValue("overrideTemplateId") || $originalTemplate->getId,
|
||||
|
|
@ -145,8 +153,8 @@ sub getEditForm {
|
|||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/small/template.gif' if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/template.gif';
|
||||
return $session{config}{extrasURL}.'/assets/small/shortcut.gif' if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/shortcut.gif';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -312,7 +320,13 @@ sub processPropertiesFromFormPost {
|
|||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
return $self->getShortcut->view;
|
||||
my %var = (
|
||||
isShortcut => 1,
|
||||
'shortcut.content' => $self->getShortcut->view,
|
||||
'shortcut.label' => 'Shortcut',
|
||||
originalURL => $self->getShortcut->getUrl
|
||||
);
|
||||
return $self->processTemplate(\%var,$self->getValue("templateId"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ use WebGUI::Session;
|
|||
use WebGUI::Style;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
#use WebGUI::Asset::Wobject::WobjectProxy;
|
||||
|
||||
our @ISA = qw(WebGUI::Asset);
|
||||
|
||||
|
|
@ -558,33 +557,6 @@ sub setCollateral {
|
|||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_createShortcut ( )
|
||||
|
||||
Creates a shortcut (using the wobject proxy) of this wobject on the clipboard.
|
||||
|
||||
B<NOTE:> Should never need to be overridden or extended.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_createShortcut {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
my $w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>"new",namespace=>"WobjectProxy"});
|
||||
$w->update({
|
||||
pageId=>'2',
|
||||
templatePosition=>1,
|
||||
title=>$self->getValue("title"),
|
||||
proxiedNamespace=>$self->get("namespace"),
|
||||
proxiedWobjectId=>$self->get("wobjectId"),
|
||||
bufferUserId=>$session{user}{userId},
|
||||
bufferDate=>WebGUI::DateTime::time(),
|
||||
bufferPrevId=>$session{page}{pageId}
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ our $I18N = {
|
|||
context => q|Title of the navigation manager in the admin console.|
|
||||
},
|
||||
|
||||
'22' => {
|
||||
message => q|Edit Navigation|,
|
||||
lastUpdated => 1078208044
|
||||
},
|
||||
|
||||
'1098' => {
|
||||
message => q|Navigation, Add/Edit|,
|
||||
lastUpdated => 1078208044
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue