fixed shortcut

This commit is contained in:
JT Smith 2005-02-05 20:02:01 +00:00
parent 177328b550
commit 1b08faa78b
5 changed files with 75 additions and 51 deletions

View file

@ -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"));
}

View file

@ -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 "";
}