Merge branch 'WebGUI8' into psgi
This commit is contained in:
commit
65dfb6e683
36 changed files with 378 additions and 741 deletions
|
|
@ -110,7 +110,8 @@
|
||||||
#
|
#
|
||||||
"cache" : {
|
"cache" : {
|
||||||
"driver" : "FastMmap",
|
"driver" : "FastMmap",
|
||||||
"expires_variance" : "0.10"
|
"expires_variance" : "0.10",
|
||||||
|
"root_dir" : "/tmp/WebGUICache"
|
||||||
},
|
},
|
||||||
|
|
||||||
# Sessions that are "hot", those that are not only not expired,
|
# Sessions that are "hot", those that are not only not expired,
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ sub www_getTreeData {
|
||||||
childCount => $asset->getChildCount,
|
childCount => $asset->getChildCount,
|
||||||
assetSize => $asset->assetSize,
|
assetSize => $asset->assetSize,
|
||||||
lockedBy => ($asset->isLockedBy ? $asset->lockedBy->username : ''),
|
lockedBy => ($asset->isLockedBy ? $asset->lockedBy->username : ''),
|
||||||
actions => $asset->canEdit && $asset->canEditIfLocked,
|
canEdit => $asset->canEdit && $asset->canEditIfLocked,
|
||||||
helpers => $asset->getHelpers,
|
helpers => $asset->getHelpers,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -226,7 +226,13 @@ sub www_getTreeData {
|
||||||
$assetInfo->{ totalAssets } = $p->getRowCount;
|
$assetInfo->{ totalAssets } = $p->getRowCount;
|
||||||
$assetInfo->{ sort } = $session->form->get( 'orderByColumn' );
|
$assetInfo->{ sort } = $session->form->get( 'orderByColumn' );
|
||||||
$assetInfo->{ dir } = lc $session->form->get( 'orderByDirection' );
|
$assetInfo->{ dir } = lc $session->form->get( 'orderByDirection' );
|
||||||
$assetInfo->{ currentAsset } = { title => $asset->getTitle, helpers => $asset->getHelpers };
|
$assetInfo->{ currentAsset } = {
|
||||||
|
assetId => $asset->getId,
|
||||||
|
url => $asset->getUrl,
|
||||||
|
title => $asset->getTitle,
|
||||||
|
icon => $asset->getIcon("small"),
|
||||||
|
helpers => $asset->getHelpers,
|
||||||
|
};
|
||||||
|
|
||||||
$assetInfo->{ crumbtrail } = [];
|
$assetInfo->{ crumbtrail } = [];
|
||||||
for my $asset ( @{ $asset->getLineage( ['ancestors'], { returnObjects => 1 } ) } ) {
|
for my $asset ( @{ $asset->getLineage( ['ancestors'], { returnObjects => 1 } ) } ) {
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,134 @@ package WebGUI::Asset::EMSSubmission;
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
use Class::C3;
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use Moose;
|
||||||
|
use WebGUI::Definition::Asset;
|
||||||
|
use WebGUI::Asset;
|
||||||
|
use WebGUI::International;
|
||||||
|
extends 'WebGUI::Asset';
|
||||||
|
define tableName => 'EMSSubmission';
|
||||||
|
define assetNae => ['assetName', 'Asset_EMSSubmission'];
|
||||||
|
define icon => 'EMSSubmission.gif';
|
||||||
|
|
||||||
|
property submissionId => (
|
||||||
|
noFormPost => 1,
|
||||||
|
fieldType => "hidden",
|
||||||
|
default => undef,
|
||||||
|
);
|
||||||
|
property submissionStatus => (
|
||||||
|
fieldType => "selectList",
|
||||||
|
default => 'pending',
|
||||||
|
customDrawMethod => 'drawStatusField',
|
||||||
|
label => [ "submission status", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "submission status help", 'Asset_EMSSubmission' ]
|
||||||
|
);
|
||||||
|
property description => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "HTMLArea",
|
||||||
|
default => undef,
|
||||||
|
label => [ "description", 'Asset_Sku' ],
|
||||||
|
hoverHelp => [ "description help", 'Asset_Sku' ]
|
||||||
|
);
|
||||||
|
property sku => (
|
||||||
|
tab => "shop",
|
||||||
|
fieldType => "text",
|
||||||
|
builder => '_builder_sku',
|
||||||
|
lazy => 1,
|
||||||
|
label => [ "sku", 'Asset_Sku' ],
|
||||||
|
hoverHelp => [ "sku help", 'Asset_Sku' ]
|
||||||
|
);
|
||||||
|
sub _builder_sku {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->session->id->generate;
|
||||||
|
}
|
||||||
|
property displayTitle => (
|
||||||
|
tab => "display",
|
||||||
|
fieldType => "yesNo",
|
||||||
|
default => 1,
|
||||||
|
label => [ "display title", 'Asset_Sku' ],
|
||||||
|
hoverHelp => [ "display title help", 'Asset_Sku' ]
|
||||||
|
);
|
||||||
|
property vendorId => (
|
||||||
|
tab => "shop",
|
||||||
|
fieldType => "vendor",
|
||||||
|
default => 'defaultvendor000000000',
|
||||||
|
label => [ "vendor", 'Asset_Sku' ],
|
||||||
|
hoverHelp => [ "vendor help", 'Asset_Sku' ]
|
||||||
|
);
|
||||||
|
property shipsSeparately => (
|
||||||
|
tab => 'shop',
|
||||||
|
fieldType => 'yesNo',
|
||||||
|
default => 0,
|
||||||
|
label => [ 'shipsSeparately', 'Asset_Sku' ],
|
||||||
|
hoverHelp => [ 'shipsSeparately help', 'Asset_Sku' ],
|
||||||
|
);
|
||||||
|
|
||||||
|
property price => (
|
||||||
|
tab => "shop",
|
||||||
|
fieldType => "float",
|
||||||
|
default => 0.00,
|
||||||
|
label => [ "price", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "price help", 'Asset_EMSSubmission' ],
|
||||||
|
);
|
||||||
|
property seatsAvailable => (
|
||||||
|
tab => "shop",
|
||||||
|
fieldType => "integer",
|
||||||
|
default => 25,
|
||||||
|
label => [ "seats available", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "seats available help", 'Asset_EMSSubmission' ],
|
||||||
|
);
|
||||||
|
property startDate => (
|
||||||
|
noFormPost => 1,
|
||||||
|
fieldType => "dateTime",
|
||||||
|
default => '',
|
||||||
|
label => [ "add/edit event start date", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "add/edit event start date help", 'Asset_EMSSubmission' ],
|
||||||
|
autoGenerate => 0,
|
||||||
|
);
|
||||||
|
property duration => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "float",
|
||||||
|
default => 1.0,
|
||||||
|
subtext => [ 'hours', 'Asset_EMSSubmission' ],
|
||||||
|
label => [ "duration", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "duration help", 'Asset_EMSSubmission' ],
|
||||||
|
);
|
||||||
|
property location => (
|
||||||
|
fieldType => "combo",
|
||||||
|
tab => "properties",
|
||||||
|
customDrawMethod => 'drawLocationField',
|
||||||
|
label => [ "location", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "location help", 'Asset_EMSSubmission' ],
|
||||||
|
);
|
||||||
|
property relatedBadgeGroups => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "checkList",
|
||||||
|
customDrawMethod => 'drawRelatedBadgeGroupsField',
|
||||||
|
label => [ "related badge groups", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "related badge groups ticket help", 'Asset_EMSSubmission' ],
|
||||||
|
);
|
||||||
|
property relatedRibbons => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "checkList",
|
||||||
|
customDrawMethod => 'drawRelatedRibbonsField',
|
||||||
|
label => [ "related ribbons", 'Asset_EMSSubmission' ],
|
||||||
|
hoverHelp => [ "related ribbons help", 'Asset_EMSSubmission' ],
|
||||||
|
);
|
||||||
|
property eventMetaData => (
|
||||||
|
noFormPost => 1,
|
||||||
|
fieldType => "hidden",
|
||||||
|
default => '{}',
|
||||||
|
);
|
||||||
|
property ticketId => (
|
||||||
|
noFormPost => 1,
|
||||||
|
fieldType => "hidden",
|
||||||
|
default => '',
|
||||||
|
);
|
||||||
|
|
||||||
|
with 'WebGUI::Role::Asset::Comments';
|
||||||
|
|
||||||
use Tie::IxHash;
|
use Tie::IxHash;
|
||||||
use base qw(WebGUI::AssetAspect::Comments WebGUI::Asset);
|
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use WebGUI::Inbox;
|
use WebGUI::Inbox;
|
||||||
|
|
||||||
|
|
@ -58,173 +182,15 @@ send email when a comment is added
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub addComment {
|
around addComment => sub {
|
||||||
|
my $orig = shift;
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->update({lastReplyBy => $self->session->user->userId});
|
$self->update({lastReplyBy => $self->session->user->userId});
|
||||||
$self->next::method(@_);
|
$self->$orig(@_);
|
||||||
$self->sendEmailUpdate;
|
$self->sendEmailUpdate;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 addRevision
|
|
||||||
|
|
||||||
This method exists for demonstration purposes only. The superclass
|
|
||||||
handles revisions to NewAsset Assets.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
#sub addRevision {
|
|
||||||
# my $self = shift;
|
|
||||||
# my $newSelf = $self->next::method(@_);
|
|
||||||
# return $newSelf;
|
|
||||||
#}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 definition ( session, definition )
|
|
||||||
|
|
||||||
defines asset properties for New Asset instances. You absolutely need
|
|
||||||
this method in your new Assets.
|
|
||||||
|
|
||||||
=head3 session
|
|
||||||
|
|
||||||
=head3 definition
|
|
||||||
|
|
||||||
A hash reference passed in from a subclass definition.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub definition {
|
|
||||||
my $class = shift;
|
|
||||||
my $session = shift;
|
|
||||||
my $definition = shift;
|
|
||||||
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmission" );
|
|
||||||
my $EMS_i18n = WebGUI::International->new($session, "Asset_EventManagementSystem");
|
|
||||||
my $SKU_i18n = WebGUI::International->new($session, "Asset_Sku");
|
|
||||||
tie my %properties, 'Tie::IxHash', (
|
|
||||||
submissionId => {
|
|
||||||
noFormPost => 1,
|
|
||||||
fieldType => "hidden",
|
|
||||||
defaultValue => undef,
|
|
||||||
},
|
|
||||||
submissionStatus => {
|
|
||||||
fieldType =>"selectList",
|
|
||||||
defaultValue => 'pending',
|
|
||||||
customDrawMethod=> 'drawStatusField',
|
|
||||||
label => $i18n->get("submission status"),
|
|
||||||
hoverHelp => $i18n->get("submission status help")
|
|
||||||
},
|
|
||||||
description => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "HTMLArea",
|
|
||||||
defaultValue => undef,
|
|
||||||
label => $SKU_i18n->get("description"),
|
|
||||||
hoverHelp => $SKU_i18n->get("description help")
|
|
||||||
},
|
|
||||||
sku => {
|
|
||||||
tab => "shop",
|
|
||||||
fieldType => "text",
|
|
||||||
defaultValue => $session->id->generate,
|
|
||||||
label => $SKU_i18n->get("sku"),
|
|
||||||
hoverHelp => $SKU_i18n->get("sku help")
|
|
||||||
},
|
|
||||||
displayTitle => {
|
|
||||||
tab => "display",
|
|
||||||
fieldType => "yesNo",
|
|
||||||
defaultValue => 1,
|
|
||||||
label => $SKU_i18n->get("display title"),
|
|
||||||
hoverHelp => $SKU_i18n->get("display title help")
|
|
||||||
},
|
|
||||||
vendorId => {
|
|
||||||
tab => "shop",
|
|
||||||
fieldType => "vendor",
|
|
||||||
defaultValue => 'defaultvendor000000000',
|
|
||||||
label => $SKU_i18n->get("vendor"),
|
|
||||||
hoverHelp => $SKU_i18n->get("vendor help")
|
|
||||||
},
|
|
||||||
shipsSeparately => {
|
|
||||||
tab => 'shop',
|
|
||||||
fieldType => 'yesNo',
|
|
||||||
defaultValue => 0,
|
|
||||||
label => $SKU_i18n->get('shipsSeparately'),
|
|
||||||
hoverHelp => $SKU_i18n->get('shipsSeparately help'),
|
|
||||||
},
|
|
||||||
|
|
||||||
price => {
|
|
||||||
tab => "shop",
|
|
||||||
fieldType => "float",
|
|
||||||
defaultValue => 0.00,
|
|
||||||
label => $EMS_i18n->get("price"),
|
|
||||||
hoverHelp => $EMS_i18n->get("price help"),
|
|
||||||
},
|
|
||||||
seatsAvailable => {
|
|
||||||
tab => "shop",
|
|
||||||
fieldType => "integer",
|
|
||||||
defaultValue => 25,
|
|
||||||
label => $EMS_i18n->get("seats available"),
|
|
||||||
hoverHelp => $EMS_i18n->get("seats available help"),
|
|
||||||
},
|
|
||||||
startDate => {
|
|
||||||
noFormPost => 1,
|
|
||||||
fieldType => "dateTime",
|
|
||||||
defaultValue => '',
|
|
||||||
label => $EMS_i18n->get("add/edit event start date"),
|
|
||||||
hoverHelp => $EMS_i18n->get("add/edit event start date help"),
|
|
||||||
autoGenerate => 0,
|
|
||||||
},
|
|
||||||
duration => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "float",
|
|
||||||
defaultValue => 1.0,
|
|
||||||
subtext => $EMS_i18n->get('hours'),
|
|
||||||
label => $EMS_i18n->get("duration"),
|
|
||||||
hoverHelp => $EMS_i18n->get("duration help"),
|
|
||||||
},
|
|
||||||
location => {
|
|
||||||
fieldType => "combo",
|
|
||||||
tab => "properties",
|
|
||||||
customDrawMethod=> 'drawLocationField',
|
|
||||||
label => $EMS_i18n->get("location"),
|
|
||||||
hoverHelp => $EMS_i18n->get("location help"),
|
|
||||||
},
|
|
||||||
relatedBadgeGroups => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "checkList",
|
|
||||||
customDrawMethod=> 'drawRelatedBadgeGroupsField',
|
|
||||||
label => $EMS_i18n->get("related badge groups"),
|
|
||||||
hoverHelp => $EMS_i18n->get("related badge groups ticket help"),
|
|
||||||
},
|
|
||||||
relatedRibbons => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "checkList",
|
|
||||||
customDrawMethod=> 'drawRelatedRibbonsField',
|
|
||||||
label => $EMS_i18n->get("related ribbons"),
|
|
||||||
hoverHelp => $EMS_i18n->get("related ribbons help"),
|
|
||||||
},
|
|
||||||
eventMetaData => {
|
|
||||||
noFormPost => 1,
|
|
||||||
fieldType => "hidden",
|
|
||||||
defaultValue => '{}',
|
|
||||||
},
|
|
||||||
ticketId => {
|
|
||||||
noFormPost => 1,
|
|
||||||
fieldType => "hidden",
|
|
||||||
defaultValue => '',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
push @{$definition}, {
|
|
||||||
assetName => $i18n->get('assetName'),
|
|
||||||
icon => 'EMSSubmission.gif',
|
|
||||||
autoGenerateForms => 1,
|
|
||||||
tableName => 'EMSSubmission',
|
|
||||||
className => 'WebGUI::Asset::EMSSubmission',
|
|
||||||
properties => \%properties,
|
|
||||||
};
|
|
||||||
return $class->next::method( $session, $definition );
|
|
||||||
} ## end sub definition
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 drawLocationField ()
|
=head2 drawLocationField ()
|
||||||
|
|
@ -313,22 +279,6 @@ sub drawStatusField {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 duplicate
|
|
||||||
|
|
||||||
This method exists for demonstration purposes only. The superclass
|
|
||||||
handles duplicating NewAsset Assets. This method will be called
|
|
||||||
whenever a copy action is executed
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
#sub duplicate {
|
|
||||||
# my $self = shift;
|
|
||||||
# my $newAsset = $self->next::method(@_);
|
|
||||||
# return $newAsset;
|
|
||||||
#}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 ems
|
=head2 ems
|
||||||
|
|
@ -527,31 +477,6 @@ sub www_view { $_[0]->ems->www_viewSubmissionQueue }
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getEditForm ( )
|
|
||||||
|
|
||||||
Extends the base class to add Tax information for the Sku, in a new tab.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub getEditForm {
|
|
||||||
my $self = shift;
|
|
||||||
my $session = $self->session;
|
|
||||||
|
|
||||||
my $tabform = $self->SUPER::getEditForm;
|
|
||||||
|
|
||||||
# TODO once comments can be submitted using AJAX this will work...
|
|
||||||
# be sure to uncomment the tab in the next function also...
|
|
||||||
#my $comments = $tabform->getTab( 'comments' );
|
|
||||||
|
|
||||||
# $comments->div({name => 'comments',
|
|
||||||
# contentCallback => sub { $self->getFormattedComments },
|
|
||||||
# });
|
|
||||||
|
|
||||||
return $tabform;
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 getEditTabs ( )
|
=head2 getEditTabs ( )
|
||||||
|
|
||||||
defines 2 new tabs.
|
defines 2 new tabs.
|
||||||
|
|
@ -561,15 +486,11 @@ in the future when the sku asset is created from this data.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub getEditTabs {
|
override getEditTabs => sub {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $i18n = WebGUI::International->new($self->session,"Asset_EMSSubmission");
|
my $sku_i18n = WebGUI::International->new($self->session,"Asset_Sku");
|
||||||
my $sku_i18n = WebGUI::International->new($self->session,"Asset_Sku");
|
return (super(), ['shop', $sku_i18n->get('shop'), 9],);
|
||||||
return ($self->SUPER::getEditTabs(), ['shop', $sku_i18n->get('shop'), 9],
|
};
|
||||||
# The comment tab is not available because comments are not AJAX yet...
|
|
||||||
# ['comments', $i18n->get('comments'), 9]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -592,11 +513,11 @@ Making private. See WebGUI::Asset::indexContent() for additonal details.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub indexContent {
|
override indexContent => sub {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $indexer = $self->next::method;
|
my $indexer = super();
|
||||||
$indexer->setIsPublic(0);
|
$indexer->setIsPublic(0);
|
||||||
}
|
};
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -609,10 +530,6 @@ See WebGUI::Asset::prepareView() for details.
|
||||||
sub prepareView {
|
sub prepareView {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->ems->prepareView;
|
$self->ems->prepareView;
|
||||||
#$self->next::method();
|
|
||||||
#my $template = WebGUI::Asset::Template->new( $self->session, $self->get("templateId") );
|
|
||||||
#$template->prepare($self->getMetaDataAsTemplateVariables);
|
|
||||||
#$self->{_viewTemplate} = $template;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
|
|
@ -659,50 +576,6 @@ sub processForm {
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 processPropertiesFromFormPost ( )
|
|
||||||
|
|
||||||
Used to process properties from the form posted. Do custom things with
|
|
||||||
noFormPost fields here, or do whatever you want. This method is called
|
|
||||||
when /yourAssetUrl?func=editSave is requested/posted.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub processPropertiesFromFormPost {
|
|
||||||
my $self = shift;
|
|
||||||
$self->next::method;
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 purge ( )
|
|
||||||
|
|
||||||
This method is called when data is purged by the system.
|
|
||||||
removes collateral data associated with a NewAsset when the system
|
|
||||||
purges it's data. This method is unnecessary, but if you have
|
|
||||||
auxiliary, ancillary, or "collateral" data or files related to your
|
|
||||||
asset instances, you will need to purge them here.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
#sub purge {
|
|
||||||
# my $self = shift;
|
|
||||||
# return $self->next::method;
|
|
||||||
#}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 purgeRevision ( )
|
|
||||||
|
|
||||||
This method is called when data is purged by the system.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
#sub purgeRevision {
|
|
||||||
# my $self = shift;
|
|
||||||
# return $self->next::method;
|
|
||||||
#}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ use Archive::Any;
|
||||||
=head1 DIAGNOSTICS
|
=head1 DIAGNOSTICS
|
||||||
|
|
||||||
=head1 METHODS
|
=head1 METHODS
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ sub getFolder {
|
||||||
$oldVersionTag->setWorking() if $oldVersionTag;
|
$oldVersionTag->setWorking() if $oldVersionTag;
|
||||||
|
|
||||||
##Get a new version of the asset from the db with the correct state
|
##Get a new version of the asset from the db with the correct state
|
||||||
$folder = WebGUI::Asset->newByUrl($session, $folderUrl);
|
$folder = $folder->cloneFromDb();
|
||||||
return $folder;
|
return $folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1975,7 +1975,7 @@ sub prepareShowSurveyTemplate {
|
||||||
Serializes the SurveyJSON instance and persists it to the database.
|
Serializes the SurveyJSON instance and persists it to the database.
|
||||||
|
|
||||||
Calling this method is only required if you have directly accessed and modified
|
Calling this method is only required if you have directly accessed and modified
|
||||||
the L<"surveyJSON"> object.
|
the L<WebGUI::Asset::Wobject::Survey::surveyJSON> object.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -733,7 +733,7 @@ sub getParent {
|
||||||
return $self if ($self->getId eq "PBasset000000000000001");
|
return $self if ($self->getId eq "PBasset000000000000001");
|
||||||
|
|
||||||
unless ( $self->{_parent} ) {
|
unless ( $self->{_parent} ) {
|
||||||
$self->{_parent} = WebGUI::Asset->newById($self->session,$self->parentId);
|
$self->{_parent} = eval { WebGUI::Asset->newById($self->session, $self->parentId); };
|
||||||
}
|
}
|
||||||
|
|
||||||
return $self->{_parent};
|
return $self->{_parent};
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ Returns an array of the names of all tables in every class used by this class.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub get_tables {
|
sub get_tables {
|
||||||
my $self = shift;
|
my ($self) = @_;
|
||||||
if ($self->is_immutable) {
|
if ($self->is_immutable) {
|
||||||
return @{ $self->{__immutable}{get_tables_methods} ||= [ $self->_get_tables ] };
|
return @{ $self->{__immutable}{get_tables_methods} ||= [ $self->_get_tables ] };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ Returns an array of all attribute names across all meta classes.
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub get_all_attributes_list {
|
sub get_all_attributes_list {
|
||||||
my $self = shift;
|
my ($self) = @_;
|
||||||
if ($self->is_immutable) {
|
if ($self->is_immutable) {
|
||||||
return @{ $self->{__immutable}{get_all_attributes_list} ||= [ $self->_get_all_attributes_list ] };
|
return @{ $self->{__immutable}{get_all_attributes_list} ||= [ $self->_get_all_attributes_list ] };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package WebGUI::FilePump::Bundle;
|
||||||
use base qw/WebGUI::Crud WebGUI::JSONCollateral/;
|
use base qw/WebGUI::Crud WebGUI::JSONCollateral/;
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
|
use WebGUI::Exception;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use URI;
|
use URI;
|
||||||
use Path::Class;
|
use Path::Class;
|
||||||
|
|
@ -508,8 +509,8 @@ sub fetchAsset {
|
||||||
|
|
||||||
my $url = $uri->opaque;
|
my $url = $uri->opaque;
|
||||||
$url =~ s{^/+}{};
|
$url =~ s{^/+}{};
|
||||||
my $asset = WebGUI::Asset->newByUrl($self->session, $url);
|
my $asset = eval {WebGUI::Asset->newByUrl($self->session, $url);};
|
||||||
return {} unless $asset;
|
return {} if Exception::Class->caught();
|
||||||
##Check for a snippet, or snippet subclass?
|
##Check for a snippet, or snippet subclass?
|
||||||
my $guts = {
|
my $guts = {
|
||||||
lastModified => $asset->get('lastModified'),
|
lastModified => $asset->get('lastModified'),
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ package WebGUI::Form::Email;
|
||||||
use strict;
|
use strict;
|
||||||
use base 'WebGUI::Form::Text';
|
use base 'WebGUI::Form::Text';
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
|
use WebGUI::Utility;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ This is an aspect which makes adding comments to existing assets trivial.
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
with 'WebGUI::Role::Asset::Comments';
|
with 'WebGUI::Role::Asset::Comments';
|
||||||
|
|
||||||
=head1 METHODS
|
=head1 METHODS
|
||||||
|
|
||||||
These methods are available from this class:
|
These methods are available from this class:
|
||||||
|
|
|
||||||
|
|
@ -897,7 +897,6 @@ sub setRow {
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 unconditionalRead ( sql [, placeholders ] )
|
=head2 unconditionalRead ( sql [, placeholders ] )
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ pod2usage( verbose => 2 ) if $help;
|
||||||
pod2usage() unless $configFile;
|
pod2usage() unless $configFile;
|
||||||
|
|
||||||
print "Starting up...\n" unless ($quiet);
|
print "Starting up...\n" unless ($quiet);
|
||||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
my $session = WebGUI::Session->open($configFile);
|
||||||
|
|
||||||
if ($userMessageFile) {
|
if ($userMessageFile) {
|
||||||
print "Opening message file.." unless ($quiet);
|
print "Opening message file.." unless ($quiet);
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,6 @@ checkModule('Digest::SHA', '5.47' );
|
||||||
checkModule("CSS::Minifier::XS", "0.03" );
|
checkModule("CSS::Minifier::XS", "0.03" );
|
||||||
checkModule("JavaScript::Minifier::XS", "0.05" );
|
checkModule("JavaScript::Minifier::XS", "0.05" );
|
||||||
checkModule("Readonly", "1.03" );
|
checkModule("Readonly", "1.03" );
|
||||||
checkModule("Memcached::libmemcached", "0.3102" );
|
|
||||||
checkModule("Moose", "0.93" );
|
checkModule("Moose", "0.93" );
|
||||||
checkModule("MooseX::Storage", "0.23" );
|
checkModule("MooseX::Storage", "0.23" );
|
||||||
checkModule("MooseX::NonMoose", '0.07' );
|
checkModule("MooseX::NonMoose", '0.07' );
|
||||||
|
|
|
||||||
145
t/Cache.t
145
t/Cache.t
|
|
@ -1,145 +0,0 @@
|
||||||
# vim:syntax=perl
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# Please read the legal notices (docs/legal.txt) and the license
|
|
||||||
# (docs/license.txt) that came with this distribution before using
|
|
||||||
# this software.
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
# http://www.plainblack.com info@plainblack.com
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Write a little about what this script tests.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
use FindBin;
|
|
||||||
use strict;
|
|
||||||
use lib "$FindBin::Bin/lib";
|
|
||||||
use Test::More;
|
|
||||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
|
||||||
use WebGUI::Session;
|
|
||||||
use WebGUI::Cache;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Init
|
|
||||||
my $session = WebGUI::Test->session;
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Tests
|
|
||||||
|
|
||||||
plan tests => 11; # Increment this number for each test you create
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
my $cache = WebGUI::Cache->new($session, 1);
|
|
||||||
isa_ok($cache, 'WebGUI::Cache');
|
|
||||||
is($cache->parseKey("andy"), $session->config->getFilename.":andy", "parseKey single key");
|
|
||||||
is($cache->parseKey(["andy","red"]), $session->config->getFilename.":andy:red", "parseKey composite key");
|
|
||||||
$cache->set("Shawshank","Prison");
|
|
||||||
is($cache->get("Shawshank"), "Prison", "set/get");
|
|
||||||
$cache->set(["andy", "dufresne"], "Prisoner");
|
|
||||||
is($cache->get(["andy", "dufresne"]), "Prisoner", "set/get composite");
|
|
||||||
my ($a, $b) = @{$cache->mget(["Shawshank",["andy", "dufresne"]])};
|
|
||||||
is($a, "Prison", "mget first value");
|
|
||||||
is($b, "Prisoner", "mget second value");
|
|
||||||
$cache->delete("Shawshank");
|
|
||||||
is(eval{$cache->get("Shawshank")}, undef, 'delete');
|
|
||||||
$cache->flush;
|
|
||||||
is(eval{$cache->get(["andy", "dufresne"])}, undef, 'flush');
|
|
||||||
$cache->setByHttp("http://www.google.com/");
|
|
||||||
cmp_ok($cache->get("http://www.google.com/"), 'ne', '', 'setByHttp');
|
|
||||||
my $longValue ='abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*(
|
|
||||||
';
|
|
||||||
$cache->set("really-long-value",$longValue);
|
|
||||||
is($cache->get("really-long-value"), $longValue, "set/get really long value");
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
|
|
||||||
}
|
|
||||||
#vim:ft=perl
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
# vim:syntax=perl
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# Please read the legal notices (docs/legal.txt) and the license
|
|
||||||
# (docs/license.txt) that came with this distribution before using
|
|
||||||
# this software.
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
# http://www.plainblack.com info@plainblack.com
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Write a little about what this script tests.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
use FindBin;
|
|
||||||
use strict;
|
|
||||||
use lib "$FindBin::Bin/../lib";
|
|
||||||
use Storable qw(freeze thaw);
|
|
||||||
use Test::More;
|
|
||||||
use Time::HiRes;
|
|
||||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
|
||||||
use WebGUI::Session;
|
|
||||||
use WebGUI::Cache::Database;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Init
|
|
||||||
my $session = WebGUI::Test->session;
|
|
||||||
|
|
||||||
# presupposes that there are cached items to test
|
|
||||||
my $cacheEntries = $session->db->buildArrayRefOfHashRefs("select expires,cachekey,namespace,content from cache order by rand() limit 100");
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Tests
|
|
||||||
|
|
||||||
plan tests => 2 + scalar(@{$cacheEntries}); # Increment this number for each test you create
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# put your tests here
|
|
||||||
|
|
||||||
my $cache = WebGUI::Cache::Database->new($session, "this", "that");
|
|
||||||
my $testValue = "a rock that has no earthly business in that field";
|
|
||||||
|
|
||||||
$cache->set($testValue);
|
|
||||||
is($cache->get, $testValue, "set/get works");
|
|
||||||
$cache->delete;
|
|
||||||
is($cache->get, undef, "delete works");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# performance tests
|
|
||||||
my $numTests = 0;
|
|
||||||
my $totalTime = 0;
|
|
||||||
foreach my $entry (@{$cacheEntries}) {
|
|
||||||
my $start = [Time::HiRes::gettimeofday];
|
|
||||||
my $cache = WebGUI::Cache::Database->new($session, $entry->{cachekey}, $entry->{namespace});
|
|
||||||
$cache->{_key} = $entry->{cachekey}; # evil: don't do this at home kids
|
|
||||||
my $value = $cache->get;
|
|
||||||
if ($entry->{expires} > time()) {
|
|
||||||
my $entryValue = $entry->{content};
|
|
||||||
eval { $entryValue = thaw($entryValue); };
|
|
||||||
$entryValue = ($entryValue && ref $entryValue) ? $$entryValue : undef;
|
|
||||||
is_deeply($value, $entryValue, "cache entry is valid");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
is($value, undef, "cache entry has timed out");
|
|
||||||
}
|
|
||||||
$numTests++;
|
|
||||||
$totalTime += Time::HiRes::tv_interval($start);
|
|
||||||
}
|
|
||||||
print "\nTime to run $numTests cache tests is $totalTime seconds. Average time per test is ".($totalTime/$numTests)." seconds.\n" if ($numTests > 0);
|
|
||||||
# end performance tests
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
# vim:syntax=perl
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# Please read the legal notices (docs/legal.txt) and the license
|
|
||||||
# (docs/license.txt) that came with this distribution before using
|
|
||||||
# this software.
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
# http://www.plainblack.com info@plainblack.com
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Write a little about what this script tests.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
use FindBin;
|
|
||||||
use strict;
|
|
||||||
use lib "$FindBin::Bin/../lib";
|
|
||||||
use Test::More;
|
|
||||||
use Test::Deep;
|
|
||||||
use Path::Class;
|
|
||||||
use File::Path;
|
|
||||||
use File::Basename qw(basename);
|
|
||||||
|
|
||||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
|
||||||
use WebGUI::Session;
|
|
||||||
use WebGUI::Cache;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Init
|
|
||||||
my $session = WebGUI::Test->session;
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Tests
|
|
||||||
|
|
||||||
my $tests = 14;
|
|
||||||
plan tests => 1 + $tests;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# put your tests here
|
|
||||||
|
|
||||||
my $origCacheType = $session->config->get('cacheType');
|
|
||||||
$session->config->set('cacheType', 'WebGUI::Cache::FileCache');
|
|
||||||
|
|
||||||
my $origCacheRoot = $session->config->get('fileCacheRoot');
|
|
||||||
$session->config->delete('fileCacheRoot');
|
|
||||||
|
|
||||||
my $loaded = use_ok('WebGUI::Cache::FileCache');
|
|
||||||
|
|
||||||
SKIP: {
|
|
||||||
|
|
||||||
skip 'Unable to load module WebGUI::Cache::FileCache', $tests unless $loaded;
|
|
||||||
|
|
||||||
my $cacher = WebGUI::Cache->new($session, 'ReservedForTests');
|
|
||||||
|
|
||||||
isa_ok($cacher, 'WebGUI::Cache::FileCache', 'WebGUI::Cache creates the correct object type');
|
|
||||||
isa_ok($cacher->session, 'WebGUI::Session', 'session method returns a session object');
|
|
||||||
|
|
||||||
cmp_deeply(
|
|
||||||
$cacher,
|
|
||||||
noclass({
|
|
||||||
_session => ignore(),
|
|
||||||
_namespace => basename(WebGUI::Test->file),
|
|
||||||
_key => re('[a-zA-Z0-9+\-]{22}'),
|
|
||||||
}),
|
|
||||||
'New FileCache object has correct defaults',
|
|
||||||
);
|
|
||||||
|
|
||||||
$cacher = WebGUI::Cache->new($session, 'ReservedForTests', 'ReservedForTests');
|
|
||||||
|
|
||||||
cmp_deeply(
|
|
||||||
$cacher,
|
|
||||||
noclass({
|
|
||||||
_session => ignore(),
|
|
||||||
_namespace => 'ReservedForTests',
|
|
||||||
_key => re('[a-zA-Z0-9+\-]{22}'),
|
|
||||||
}),
|
|
||||||
'Second fileCache object was recreated with custom namespace',
|
|
||||||
);
|
|
||||||
|
|
||||||
my $root = '/tmp'; ##Default for Unix testing. Need to extend this for Windows someday...
|
|
||||||
my $namespace = Path::Class::Dir->new($root, qw/WebGUICache ReservedForTests/);
|
|
||||||
is($cacher->getNamespaceRoot, $namespace->stringify, 'getNamespaceRoot returns the correct path');
|
|
||||||
|
|
||||||
ok(! -e $cacher->getNamespaceRoot, 'The namespace does not exist in the filesystem');
|
|
||||||
|
|
||||||
my $folder = $namespace->subdir($cacher->{_key});
|
|
||||||
is($cacher->getFolder, $folder->stringify, 'getFolder returns the correct path, which is the namespace with a key subdirectory');
|
|
||||||
ok(! -e $cacher->getFolder, 'The folder does not exist in the filesystem');
|
|
||||||
|
|
||||||
$cacher->set('Some value');
|
|
||||||
ok( -e $namespace->stringify, 'setting data into the cache creates the namespace dir');
|
|
||||||
ok( -e $folder->stringify, 'setting data into the cache creates the folder dir');
|
|
||||||
ok( -e $folder->file('expires')->stringify, 'expiry file was created');
|
|
||||||
ok( -e $folder->file('cache')->stringify, 'cache file was created');
|
|
||||||
|
|
||||||
$cacher->delete();
|
|
||||||
ok(! -e $cacher->getFolder, 'delete removes the cache folder');
|
|
||||||
|
|
||||||
$cacher->flush();
|
|
||||||
ok(! -e $cacher->getNamespaceRoot, 'purge removes the namespace folder');
|
|
||||||
|
|
||||||
undef $cacher;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
$session->config->set('cacheType', $origCacheType);
|
|
||||||
if ($origCacheRoot) {
|
|
||||||
$session->config->get('fileCacheRoot', $origCacheRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,6 +14,7 @@ use lib "$FindBin::Bin/../lib";
|
||||||
|
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
use WebGUI::Pluggable;
|
||||||
use WebGUI::Operation::Help;
|
use WebGUI::Operation::Help;
|
||||||
|
|
||||||
#The goal of this test is to verify that all entries in the lib/WebGUI/Help
|
#The goal of this test is to verify that all entries in the lib/WebGUI/Help
|
||||||
|
|
@ -26,14 +27,14 @@ my $numTests = 0;
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
my @helpFileSet = WebGUI::Operation::Help::_getHelpFilesList($session);
|
my @helpFileSet = WebGUI::Pluggable::findAndLoad('WebGUI::Help');
|
||||||
|
|
||||||
$numTests = scalar @helpFileSet; #One for each help compile
|
$numTests = scalar @helpFileSet; #One for each help compile
|
||||||
|
|
||||||
plan tests => $numTests;
|
plan tests => $numTests;
|
||||||
|
|
||||||
foreach my $helpSet (@helpFileSet) {
|
foreach my $helpFile (@helpFileSet) {
|
||||||
my $helpName = $helpSet->[1];
|
my ($namespace) = $helpFile =~ m{WebGUI::Help::(.+$)};
|
||||||
my $help = WebGUI::Operation::Help::_load($session, $helpName);
|
my $help = WebGUI::Operation::Help::_load($session, $namespace);
|
||||||
ok(keys %{ $help }, "$helpName compiled");
|
ok(keys %{ $help }, "$namespace compiled");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ WebGUI::Test->usersToDelete($newUser);
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
plan tests => 48; # Increment this number for each test you create
|
plan tests => 50; # Increment this number for each test you create
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Test the creation of ProfileField
|
# Test the creation of ProfileField
|
||||||
|
|
@ -91,6 +91,8 @@ my $newProfileField = WebGUI::ProfileField->create($session, 'testField', {
|
||||||
});
|
});
|
||||||
|
|
||||||
is($newProfileField->get('fieldType'), 'Float', 'create: makes field with correct type');
|
is($newProfileField->get('fieldType'), 'Float', 'create: makes field with correct type');
|
||||||
|
is $newProfileField->get('fieldName'), 'testField', '...correct fieldName';
|
||||||
|
is $newProfileField->getId, 'testField', '...correct id';
|
||||||
is($newProfileField->get('label'), 'Test Field', 'correct label');
|
is($newProfileField->get('label'), 'Test Field', 'correct label');
|
||||||
is($newProfileField->getLabel, 'Test Field', 'getLabel works, too');
|
is($newProfileField->getLabel, 'Test Field', 'getLabel works, too');
|
||||||
|
|
||||||
|
|
|
||||||
4
t/SQL.t
4
t/SQL.t
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
|
|
||||||
use Test::More tests => 56; # increment this value for each test you create
|
use Test::More tests => 57; # increment this value for each test you create
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
|
|
@ -145,6 +145,8 @@ my $setRowId = $session->db->setRow("incrementer","incrementerId",{incrementerId
|
||||||
ok($setRowId ne "", "setRow() - return ID");
|
ok($setRowId ne "", "setRow() - return ID");
|
||||||
my ($setRowResult) = $session->db->quickArray("select nextValue from incrementer where incrementerId=".$session->db->quote($setRowId));
|
my ($setRowResult) = $session->db->quickArray("select nextValue from incrementer where incrementerId=".$session->db->quote($setRowId));
|
||||||
is($setRowResult, 47, "setRow() - set data");
|
is($setRowResult, 47, "setRow() - set data");
|
||||||
|
is $session->db->setRow("incrementer", "incrementerId",{incrementerId=>'new', nextValue => 48}, 'oogeyBoogeyBoo'),
|
||||||
|
'oogeyBoogeyBoo', 'overriding default id with a custom one';
|
||||||
|
|
||||||
# getRow
|
# getRow
|
||||||
my $getRow = $session->db->getRow("incrementer","incrementerId",$setRowId);
|
my $getRow = $session->db->getRow("incrementer","incrementerId",$setRowId);
|
||||||
|
|
|
||||||
|
|
@ -328,14 +328,14 @@ TODO: {
|
||||||
####################################################
|
####################################################
|
||||||
#
|
#
|
||||||
# process
|
# process
|
||||||
# no duped headBlockContent
|
# no duped extraHeadTagsContent
|
||||||
#
|
#
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
$style->useEmptyStyle(1);
|
$style->useEmptyStyle(1);
|
||||||
$style->sent(0);
|
$style->sent(0);
|
||||||
|
|
||||||
$session->scratch->set('personalStyleId', $templates->{headBlock}->getId);
|
$session->scratch->set('personalStyleId', $templates->{extraHeadTags}->getId);
|
||||||
|
|
||||||
$styled = $style->process('body.content', 'notATemplateId');
|
$styled = $style->process('body.content', 'notATemplateId');
|
||||||
|
|
||||||
|
|
@ -369,7 +369,8 @@ $expectedMetas = [
|
||||||
'content' => 'must-revalidate'
|
'content' => 'must-revalidate'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
cmp_bag(\@metas, $expectedMetas, 'process, headBlock:no duped headBlock from style template');
|
cmp_bag(\@metas, $expectedMetas, 'process, extraHeadTags:no duped extraHeadTags from style template');
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
#
|
#
|
||||||
# process
|
# process
|
||||||
|
|
@ -480,16 +481,16 @@ sub setup_assets {
|
||||||
};
|
};
|
||||||
$templates->{personal} = $importNode->addChild($properties, $properties->{id});
|
$templates->{personal} = $importNode->addChild($properties, $properties->{id});
|
||||||
$properties = {
|
$properties = {
|
||||||
title => 'personal style test template with headBlock',
|
title => 'personal style test template with extraHeadTags',
|
||||||
className => 'WebGUI::Asset::Template',
|
className => 'WebGUI::Asset::Template',
|
||||||
url => 'headblock_style',
|
url => 'headblock_style',
|
||||||
namespace => 'Style',
|
namespace => 'Style',
|
||||||
template => 'HEADBLOCK STYLE TEMPLATE\n\nBODY=<tmpl_var body.content>\n\nHEAD=<tmpl_var head.tags>',
|
template => 'HEADBLOCK STYLE TEMPLATE\n\nBODY=<tmpl_var body.content>\n\nHEAD=<tmpl_var head.tags>',
|
||||||
headBlock => q|<meta name="keywords" content="keyword1,keyword2" />|,
|
extraHeadTags => q|<meta name="keywords" content="keyword1,keyword2" />|,
|
||||||
id => 'testTemplate_headblock',
|
id => 'testTemplate_headblock',
|
||||||
# '1234567890123456789012'
|
# '1234567890123456789012'
|
||||||
};
|
};
|
||||||
$templates->{headBlock} = $importNode->addChild($properties, $properties->{id});
|
$templates->{extraHeadTags} = $importNode->addChild($properties, $properties->{id});
|
||||||
$properties = {
|
$properties = {
|
||||||
title => 'personal style test template for printing',
|
title => 'personal style test template for printing',
|
||||||
className => 'WebGUI::Asset::Template',
|
className => 'WebGUI::Asset::Template',
|
||||||
|
|
|
||||||
|
|
@ -417,21 +417,21 @@ my $statefulAsset = WebGUI::Asset->getRoot($session)->addChild({ className => 'W
|
||||||
$versionTag->commit;
|
$versionTag->commit;
|
||||||
$session->asset( $statefulAsset );
|
$session->asset( $statefulAsset );
|
||||||
|
|
||||||
$statefulAsset->{_properties}{state} = 'published';
|
$statefulAsset->state('published');
|
||||||
is(
|
is(
|
||||||
$session->url->getBackToSiteURL,
|
$session->url->getBackToSiteURL,
|
||||||
WebGUI::Asset->getRoot($session)->getUrl,
|
WebGUI::Asset->getRoot($session)->getUrl,
|
||||||
q!getBackToSiteURL: When asset state is published, it returns you to the Assets container!
|
q!getBackToSiteURL: When asset state is published, it returns you to the Assets container!
|
||||||
);
|
);
|
||||||
|
|
||||||
$statefulAsset->{_properties}{state} = 'trash';
|
$statefulAsset->state( 'trash');
|
||||||
is(
|
is(
|
||||||
$session->url->getBackToSiteURL,
|
$session->url->getBackToSiteURL,
|
||||||
$defaultAssetUrl,
|
$defaultAssetUrl,
|
||||||
q!getBackToSiteURL: When asset state is trash, it returns you to the default Asset!
|
q!getBackToSiteURL: When asset state is trash, it returns you to the default Asset!
|
||||||
);
|
);
|
||||||
|
|
||||||
$statefulAsset->{_properties}{state} = 'clipboard';
|
$statefulAsset->state('clipboard');
|
||||||
is(
|
is(
|
||||||
$session->url->getBackToSiteURL,
|
$session->url->getBackToSiteURL,
|
||||||
$defaultAssetUrl,
|
$defaultAssetUrl,
|
||||||
|
|
|
||||||
|
|
@ -138,13 +138,13 @@ $session->db->write("update userSession set expires=? where sessionId=?",
|
||||||
my %copyOfVar2 = %{$var2->{_var}};
|
my %copyOfVar2 = %{$var2->{_var}};
|
||||||
$copyOfVar2{expires} = $var2->get('lastPageView')-1;
|
$copyOfVar2{expires} = $var2->get('lastPageView')-1;
|
||||||
$copyOfVar2{userId} = 3;
|
$copyOfVar2{userId} = 3;
|
||||||
$session->cache->set(['session',$var2->getId], \%copyOfVar2);
|
$session->cache->set($var2->getId, \%copyOfVar2);
|
||||||
|
|
||||||
my $var3 = WebGUI::Session::Var->new($session, $var2->getId);
|
my $var3 = WebGUI::Session::Var->new($session, $var2->getId);
|
||||||
is($var3->getId, $var2->getId, 'new Var object has correct id');
|
is $var3->getId, $var2->getId, 'new Var object has correct id';
|
||||||
isnt($var3->isAdminOn, $var2->isAdminOn, 'new adminOn not equal to old adminOn');
|
isnt $var3->isAdminOn, $var2->isAdminOn, 'new adminOn not equal to old adminOn';
|
||||||
is($var3->isAdminOn, 0, 'new Var object has default adminOn');
|
is $var3->isAdminOn, 0, 'new Var object has default adminOn';
|
||||||
isnt($var3->get('userId'), 3, 'new userId not equal to old userId');
|
isnt $var3->get('userId'), 3, 'new userId not equal to old userId';
|
||||||
$var2->end;
|
$var2->end;
|
||||||
$var3->end;
|
$var3->end;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ ok (!(-e $storage1->getPath("testfile-hash.file")), "rename file original file i
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
$storage1->addFileFromFilesystem(
|
$storage1->addFileFromFilesystem(
|
||||||
WebGUI::Test->getTestCollateralPath('WebGUI.pm'),
|
WebGUI::Test->getTestCollateralPath('International/lib/WebGUI/i18n/PigLatin/WebGUI.pm'),
|
||||||
);
|
);
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
|
|
@ -473,7 +473,7 @@ is($formStore->addFileFromFormPost('files'), undef, 'addFileFromFormPost returns
|
||||||
|
|
||||||
$session->request->uploadFiles(
|
$session->request->uploadFiles(
|
||||||
'oneFile',
|
'oneFile',
|
||||||
[ WebGUI::Test->getTestCollateralPath('WebGUI.pm') ],
|
[ WebGUI::Test->getTestCollateralPath('International/lib/WebGUI/i18n/PigLatin/WebGUI.pm') ],
|
||||||
);
|
);
|
||||||
is($formStore->addFileFromFormPost('oneFile'), 'WebGUI.pm', '... returns the name of the uploaded file');
|
is($formStore->addFileFromFormPost('oneFile'), 'WebGUI.pm', '... returns the name of the uploaded file');
|
||||||
cmp_bag($formStore->getFiles, [ qw/WebGUI.pm/ ], '... adds the file to the storage location');
|
cmp_bag($formStore->getFiles, [ qw/WebGUI.pm/ ], '... adds the file to the storage location');
|
||||||
|
|
|
||||||
6
t/User.t
6
t/User.t
|
|
@ -15,7 +15,6 @@ use lib "$FindBin::Bin/lib";
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use WebGUI::Cache;
|
|
||||||
#use Exception::Class;
|
#use Exception::Class;
|
||||||
|
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
|
|
@ -28,8 +27,7 @@ use Data::Dumper;
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
my $testCache = WebGUI::Cache->new($session, 'myTestKey');
|
$session->cache->remove('myTestKey');
|
||||||
$testCache->flush;
|
|
||||||
|
|
||||||
my $user;
|
my $user;
|
||||||
my $lastUpdate;
|
my $lastUpdate;
|
||||||
|
|
@ -1063,6 +1061,6 @@ END {
|
||||||
|
|
||||||
$newProfileField->delete() if $newProfileField;
|
$newProfileField->delete() if $newProfileField;
|
||||||
|
|
||||||
$testCache->flush;
|
$session->cache->remove('myTestKey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ is($siteWideTag->getId(), $siteWideTagId, 'versionTagMode siteWide: reclaim site
|
||||||
|
|
||||||
|
|
||||||
## Through in a new session as different user
|
## Through in a new session as different user
|
||||||
my $admin_session = WebGUI::Session->open($WebGUI::Test->file);
|
my $admin_session = WebGUI::Session->open(WebGUI::Test->file);
|
||||||
$admin_session->user({'userId' => 3});
|
$admin_session->user({'userId' => 3});
|
||||||
WebGUI::Test->sessionsToDelete($admin_session);
|
WebGUI::Test->sessionsToDelete($admin_session);
|
||||||
|
|
||||||
|
|
@ -301,7 +301,7 @@ $adminUserTag->rollback();
|
||||||
is($tag->getAssetCount, 1, qq{$test_prefix [singlePerUser] tag with 1 asset});
|
is($tag->getAssetCount, 1, qq{$test_prefix [singlePerUser] tag with 1 asset});
|
||||||
|
|
||||||
# create admin session
|
# create admin session
|
||||||
my $admin_session = WebGUI::Session->open($WebGUI::Test->file);
|
my $admin_session = WebGUI::Session->open(WebGUI::Test->file);
|
||||||
addToCleanup($session);
|
addToCleanup($session);
|
||||||
$admin_session->user({'userId' => 3});
|
$admin_session->user({'userId' => 3});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use lib "$FindBin::Bin/../lib"; ##t/lib
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Operation::Help;
|
use WebGUI::Operation::Help;
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
use WebGUI::Session;
|
use WebGUI::Pluggable;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
#The goal of this test is to verify all the i18n labels in
|
#The goal of this test is to verify all the i18n labels in
|
||||||
|
|
@ -28,14 +28,14 @@ my $numTests = 0;
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
my @helpFileSet = WebGUI::Operation::Help::_getHelpFilesList($session);
|
my @helpFileSet = WebGUI::Pluggable::findAndLoad('WebGUI::Help');
|
||||||
|
|
||||||
my %helpTable;
|
my %helpTable;
|
||||||
|
|
||||||
foreach my $helpSet (@helpFileSet) {
|
foreach my $helpFile (@helpFileSet) {
|
||||||
my $helpName = $helpSet->[1];
|
my ($namespace) = $helpFile =~ m{WebGUI::Help::(.+$)};
|
||||||
my $help = WebGUI::Operation::Help::_load($session, $helpName);
|
my $help = WebGUI::Operation::Help::_load($session, $namespace);
|
||||||
$helpTable{ $helpName } = $help;
|
$helpTable{ $namespace } = $help;
|
||||||
}
|
}
|
||||||
|
|
||||||
##Scan #1, find all labels in the help system. body, title, @fields
|
##Scan #1, find all labels in the help system. body, title, @fields
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ Usage:
|
||||||
|
|
||||||
# Reset the session back
|
# Reset the session back
|
||||||
$session->{_request} = $old_session;
|
$session->{_request} = $old_session;
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub get_request
|
sub get_request
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ our @EXPORT_OK = qw(session config collateral);
|
||||||
|
|
||||||
my $CLASS = __PACKAGE__;
|
my $CLASS = __PACKAGE__;
|
||||||
|
|
||||||
my @guarded;
|
|
||||||
|
|
||||||
sub import {
|
sub import {
|
||||||
our $CONFIG_FILE = $ENV{ WEBGUI_CONFIG };
|
our $CONFIG_FILE = $ENV{ WEBGUI_CONFIG };
|
||||||
|
|
||||||
|
|
@ -80,7 +78,7 @@ sub _initSession {
|
||||||
my $session = our $SESSION = $CLASS->newSession(1);
|
my $session = our $SESSION = $CLASS->newSession(1);
|
||||||
|
|
||||||
my $originalSetting = clone $session->setting->get;
|
my $originalSetting = clone $session->setting->get;
|
||||||
push @guarded, Scope::Guard->new(sub {
|
$CLASS->addToCleanup(sub {
|
||||||
while (my ($param, $value) = each %{ $originalSetting }) {
|
while (my ($param, $value) = each %{ $originalSetting }) {
|
||||||
$session->setting->set($param, $value);
|
$session->setting->set($param, $value);
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +108,7 @@ sub _initSession {
|
||||||
my ($label, $table) = @checkCount[$i, $i+1];
|
my ($label, $table) = @checkCount[$i, $i+1];
|
||||||
$initCounts{$table} = $session->db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
$initCounts{$table} = $session->db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
||||||
}
|
}
|
||||||
push @guarded, Scope::Guard->new(sub {
|
$CLASS->addToCleanup(sub {
|
||||||
for ( my $i = 0; $i < @checkCount; $i += 2) {
|
for ( my $i = 0; $i < @checkCount; $i += 2) {
|
||||||
my ($label, $table) = @checkCount[$i, $i+1];
|
my ($label, $table) = @checkCount[$i, $i+1];
|
||||||
my $quant = $session->db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
my $quant = $session->db->quickScalar('SELECT COUNT(*) FROM ' . $table);
|
||||||
|
|
@ -127,19 +125,6 @@ END {
|
||||||
$CLASS->cleanup;
|
$CLASS->cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cleanup {
|
|
||||||
# remove guards in reverse order they were added, triggering all of the
|
|
||||||
# requested cleanup operations
|
|
||||||
pop @guarded
|
|
||||||
while @guarded;
|
|
||||||
|
|
||||||
if ( our $SESSION ) {
|
|
||||||
$SESSION->var->end;
|
|
||||||
$SESSION->close;
|
|
||||||
undef $SESSION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 newSession ( $noCleanup )
|
=head2 newSession ( $noCleanup )
|
||||||
|
|
@ -159,7 +144,7 @@ sub newSession {
|
||||||
my $session = WebGUI::Session->open( $CLASS->config );
|
my $session = WebGUI::Session->open( $CLASS->config );
|
||||||
$session->{_request} = $pseudoRequest;
|
$session->{_request} = $pseudoRequest;
|
||||||
if ( ! $noCleanup ) {
|
if ( ! $noCleanup ) {
|
||||||
$CLASS->sessionsToDelete($session);
|
$CLASS->addToCleanup($session);
|
||||||
}
|
}
|
||||||
return $session;
|
return $session;
|
||||||
}
|
}
|
||||||
|
|
@ -444,7 +429,7 @@ Returns the full path to the WebGUI lib directory, usually /data/WebGUI/lib.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
our $WEBGUI_LIB = File::Spec->catdir( $WEBGUI_TEST_ROOT, File::Spec->updir );
|
our $WEBGUI_LIB = File::Spec->catdir( $WEBGUI_TEST_ROOT, File::Spec->updir, 'lib' );
|
||||||
|
|
||||||
sub lib {
|
sub lib {
|
||||||
return our $WEBGUI_LIB;
|
return our $WEBGUI_LIB;
|
||||||
|
|
@ -543,7 +528,7 @@ sub prepareMailServer {
|
||||||
# Let it start up yo
|
# Let it start up yo
|
||||||
sleep 2;
|
sleep 2;
|
||||||
|
|
||||||
push @guarded, Scope::Guard->new(sub {
|
$CLASS->addToCleanup(sub {
|
||||||
# Close SMTPD
|
# Close SMTPD
|
||||||
if ($smtpdPid) {
|
if ($smtpdPid) {
|
||||||
kill INT => $smtpdPid;
|
kill INT => $smtpdPid;
|
||||||
|
|
@ -576,7 +561,7 @@ sub originalConfig {
|
||||||
}
|
}
|
||||||
# add cleanup handler if this is the first time we were run
|
# add cleanup handler if this is the first time we were run
|
||||||
if (! keys %originalConfig) {
|
if (! keys %originalConfig) {
|
||||||
push @guarded, Scope::Guard->new(sub {
|
$class->addToCleanup(sub {
|
||||||
while (my ($key, $value) = each %originalConfig) {
|
while (my ($key, $value) = each %originalConfig) {
|
||||||
if (defined $value) {
|
if (defined $value) {
|
||||||
$CLASS->session->config->set($key, $value);
|
$CLASS->session->config->set($key, $value);
|
||||||
|
|
@ -592,7 +577,7 @@ sub originalConfig {
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getMail ( )
|
=head2 getMail ( )
|
||||||
|
|
||||||
Read a sent mail from the prepared mail server (L<prepareMailServer>)
|
Read a sent mail from the prepared mail server (L<prepareMailServer>)
|
||||||
|
|
||||||
|
|
@ -600,7 +585,7 @@ Read a sent mail from the prepared mail server (L<prepareMailServer>)
|
||||||
|
|
||||||
sub getMail {
|
sub getMail {
|
||||||
my $json;
|
my $json;
|
||||||
|
|
||||||
if ( !$smtpdSelect ) {
|
if ( !$smtpdSelect ) {
|
||||||
return from_json ' { "error": "mail server not prepared" }';
|
return from_json ' { "error": "mail server not prepared" }';
|
||||||
}
|
}
|
||||||
|
|
@ -611,11 +596,11 @@ sub getMail {
|
||||||
else {
|
else {
|
||||||
$json = ' { "error": "mail not sent" } ';
|
$json = ' { "error": "mail not sent" } ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$json) {
|
if (!$json) {
|
||||||
$json = ' { "error": "error in getting mail" } ';
|
$json = ' { "error": "error in getting mail" } ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return from_json( $json );
|
return from_json( $json );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -635,7 +620,7 @@ sub getMailFromQueue {
|
||||||
if ( !$smtpdSelect ) {
|
if ( !$smtpdSelect ) {
|
||||||
$class->prepareMailServer;
|
$class->prepareMailServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $messageId = $CLASS->session->db->quickScalar( "SELECT messageId FROM mailQueue" );
|
my $messageId = $CLASS->session->db->quickScalar( "SELECT messageId FROM mailQueue" );
|
||||||
warn $messageId;
|
warn $messageId;
|
||||||
return unless $messageId;
|
return unless $messageId;
|
||||||
|
|
@ -646,6 +631,7 @@ sub getMailFromQueue {
|
||||||
|
|
||||||
return $class->getMail;
|
return $class->getMail;
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 sessionsToDelete ( $session, [$session, ...] )
|
=head2 sessionsToDelete ( $session, [$session, ...] )
|
||||||
|
|
@ -660,7 +646,7 @@ This is a class method.
|
||||||
|
|
||||||
sub sessionsToDelete {
|
sub sessionsToDelete {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
push @guarded, cleanupGuard(@_);
|
$class->addToCleanup(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -677,7 +663,7 @@ This is a class method.
|
||||||
|
|
||||||
sub assetsToPurge {
|
sub assetsToPurge {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
push @guarded, cleanupGuard(@_);
|
$class->addToCleanup(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -693,7 +679,7 @@ This is a class method.
|
||||||
|
|
||||||
sub groupsToDelete {
|
sub groupsToDelete {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
push @guarded, cleanupGuard(@_);
|
$class->addToCleanup(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -710,7 +696,7 @@ This is a class method.
|
||||||
|
|
||||||
sub storagesToDelete {
|
sub storagesToDelete {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
push @guarded, cleanupGuard(map {
|
$class->addToCleanup(map {
|
||||||
ref $_ ? $_ : ('WebGUI::Storage' => $_)
|
ref $_ ? $_ : ('WebGUI::Storage' => $_)
|
||||||
} @_);
|
} @_);
|
||||||
}
|
}
|
||||||
|
|
@ -727,7 +713,7 @@ This is a class method.
|
||||||
|
|
||||||
sub tagsToRollback {
|
sub tagsToRollback {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
push @guarded, cleanupGuard(@_);
|
$class->addToCleanup(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -743,7 +729,7 @@ This is a class method.
|
||||||
|
|
||||||
sub usersToDelete {
|
sub usersToDelete {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
push @guarded, cleanupGuard(@_);
|
$class->addToCleanup(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -759,7 +745,7 @@ This is a class method.
|
||||||
|
|
||||||
sub workflowsToDelete {
|
sub workflowsToDelete {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
push @guarded, cleanupGuard(@_);
|
$class->addToCleanup(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -973,12 +959,26 @@ This is a class method.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
my @guarded;
|
||||||
sub addToCleanup {
|
sub addToCleanup {
|
||||||
shift
|
shift
|
||||||
if eval { $_[0]->isa($CLASS) };
|
if eval { $_[0]->isa($CLASS) };
|
||||||
push @guarded, cleanupGuard(@_);
|
push @guarded, cleanupGuard(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub cleanup {
|
||||||
|
# remove guards in reverse order they were added, triggering all of the
|
||||||
|
# requested cleanup operations
|
||||||
|
pop @guarded
|
||||||
|
while @guarded;
|
||||||
|
|
||||||
|
if ( our $SESSION ) {
|
||||||
|
$SESSION->var->end;
|
||||||
|
$SESSION->close;
|
||||||
|
undef $SESSION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@ package WebGUI::Test::Activity;
|
||||||
use WebGUI::Workflow;
|
use WebGUI::Workflow;
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
|
|
||||||
=head Name
|
=head1 Name
|
||||||
|
|
||||||
package WebGUI::Test::Activity;
|
package WebGUI::Test::Activity;
|
||||||
|
|
||||||
=head Description
|
=head1 Description
|
||||||
|
|
||||||
This package encapsulates the code required to run
|
This package encapsulates the code required to run
|
||||||
an activity.
|
an activity.
|
||||||
|
|
||||||
=head Usage
|
=head1 Usage
|
||||||
|
|
||||||
use WebGUI::Test::Activity;
|
use WebGUI::Test::Activity;
|
||||||
|
|
||||||
|
|
@ -27,17 +27,21 @@ is( $instance->run, 'complete', 'activity complete' );
|
||||||
is( $instance->run, 'done', 'activity done' );
|
is( $instance->run, 'done', 'activity done' );
|
||||||
$instance->delete;
|
$instance->delete;
|
||||||
|
|
||||||
=head methods
|
=head1 methods
|
||||||
|
|
||||||
=head2 create
|
=head2 create
|
||||||
|
|
||||||
=params
|
=head3 session
|
||||||
|
|
||||||
session -- the session variable
|
the session variable
|
||||||
|
|
||||||
class -- the class for the activity to run
|
=head3 class
|
||||||
|
|
||||||
params -- params to set in the workflow
|
the class for the activity to run
|
||||||
|
|
||||||
|
=head3 params
|
||||||
|
|
||||||
|
params to set in the workflow
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ functions _quiet_caller and _try_as_caller are directly copied from Test::Except
|
||||||
hocuspocus is being in that module however, since doing 'eval { uplevel 1, $codeRef }' seems to work too. On my
|
hocuspocus is being in that module however, since doing 'eval { uplevel 1, $codeRef }' seems to work too. On my
|
||||||
platform at least =). For the time being, I leave those subs in here so that they may be used. They are commented
|
platform at least =). For the time being, I leave those subs in here so that they may be used. They are commented
|
||||||
out by default, though.
|
out by default, though.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ plan tests => $numTests;
|
||||||
|
|
||||||
foreach my $tmpl ( @tmplVarTable ) {
|
foreach my $tmpl ( @tmplVarTable ) {
|
||||||
my $tmplId = $tmpl->{id};
|
my $tmplId = $tmpl->{id};
|
||||||
my $tmplAsset = WebGUI::Asset->newByDynamicClass($session, $tmplId);
|
my $tmplAsset = eval { WebGUI::Asset->newById($session, $tmplId); };
|
||||||
my $tmplExists = is(ref($tmplAsset), 'WebGUI::Asset::Template', "$tmplId exists");
|
my $tmplExists = is(ref($tmplAsset), 'WebGUI::Asset::Template', "$tmplId exists");
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip("$tmplId could not be found", $tmpl->{numTests} ) unless $tmplExists;
|
skip("$tmplId could not be found", $tmpl->{numTests} ) unless $tmplExists;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ sub _00_init : Test(startup => 1) {
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
$test->session($session);
|
$test->session($session);
|
||||||
my $class = ref $test;
|
my $class = ref $test;
|
||||||
$class =~ s/Test:://;
|
$class =~ s/^Test:://;
|
||||||
|
return ('Not a WebGUI class') unless $class =~ /^WebGUI/;
|
||||||
$test->class($class);
|
$test->class($class);
|
||||||
lives_ok { WebGUI::Asset->loadModule($class); } "loaded module class $class";
|
lives_ok { WebGUI::Asset->loadModule($class); } "loaded module class $class";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,11 @@
|
||||||
margin: 0; padding: 0;
|
margin: 0; padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
|
||||||
img.icon {
|
img.icon {
|
||||||
vertical-align: baseline;
|
vertical-align: baseline;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,37 @@ WebGUI.Admin.prototype.afterShowViewTab
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* go( url )
|
* appendToUrl( url, params )
|
||||||
* Open the view tab and go to the given URL.
|
* Add URL components to a URL;
|
||||||
* Should not be used for assets, use gotoAsset() instead
|
|
||||||
*/
|
*/
|
||||||
|
appendToUrl
|
||||||
|
= function ( url, params ) {
|
||||||
|
var components = [ url ];
|
||||||
|
if (url.match(/\?/)) {
|
||||||
|
components.push(";");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
components.push("?");
|
||||||
|
}
|
||||||
|
components.push(params);
|
||||||
|
return components.join('');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* editAsset( url )
|
||||||
|
* Show the edit form for the asset at the given URL
|
||||||
|
*/
|
||||||
|
WebGUI.Admin.prototype.editAsset
|
||||||
|
= function ( url ) {
|
||||||
|
// Open the edit form
|
||||||
|
window.frames["view"].location.href = appendToUrl( url, "func=edit" );
|
||||||
|
|
||||||
|
// Mark undirty, as we'll clean it ourselves
|
||||||
|
this.viewDirty = 0;
|
||||||
|
|
||||||
|
// Show the view tab
|
||||||
|
this.tabBar.selectTab( 0 );
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gotoAsset( url )
|
* gotoAsset( url )
|
||||||
|
|
@ -96,14 +123,38 @@ WebGUI.Admin.prototype.gotoAsset
|
||||||
}
|
}
|
||||||
else if ( this.currentTab == "tree" ) {
|
else if ( this.currentTab == "tree" ) {
|
||||||
// Make tree request
|
// Make tree request
|
||||||
this.tree.goto( this.currentAssetDef.url );
|
this.tree.goto( url );
|
||||||
this.viewDirty = 1;
|
this.viewDirty = 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* makeEditAsset( url )
|
||||||
|
* Create a callback to edit an asset. Use when attaching to event listeners
|
||||||
|
*/
|
||||||
|
WebGUI.Admin.prototype.makeEditAsset
|
||||||
|
= function (url) {
|
||||||
|
var self = this;
|
||||||
|
return function() {
|
||||||
|
self.editAsset( url );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* makeGotoAsset( url )
|
||||||
|
* Create a callback to view an asset. Use when attaching to event listeners
|
||||||
|
*/
|
||||||
|
WebGUI.Admin.prototype.makeGotoAsset
|
||||||
|
= function ( url ) {
|
||||||
|
var self = this;
|
||||||
|
return function() {
|
||||||
|
self.gotoAsset( url );
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* navigate( assetDef )
|
* navigate( assetDef )
|
||||||
* We've navigated to a new asset. Called by one of the iframes when a new
|
* We've navigated to a new asset. Called by the view iframe when a new
|
||||||
* page is reached
|
* page is reached
|
||||||
*/
|
*/
|
||||||
WebGUI.Admin.prototype.navigate
|
WebGUI.Admin.prototype.navigate
|
||||||
|
|
@ -122,7 +173,10 @@ WebGUI.Admin.prototype.navigate
|
||||||
// Update the location bar
|
// Update the location bar
|
||||||
this.locationBar.navigate( assetDef );
|
this.locationBar.navigate( assetDef );
|
||||||
|
|
||||||
this.currentAssetDef = assetDef;
|
if ( !this.currentAssetDef || this.currentAssetDef.assetId != assetDef.assetId ) {
|
||||||
|
this.currentAssetDef = assetDef;
|
||||||
|
this.treeDirty = 1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
@ -442,7 +496,7 @@ WebGUI.Admin.Tree
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'assetId' },
|
{ key: 'assetId' },
|
||||||
{ key: 'lineage' },
|
{ key: 'lineage' },
|
||||||
{ key: 'actions' },
|
{ key: 'canEdit' },
|
||||||
{ key: 'title' },
|
{ key: 'title' },
|
||||||
{ key: 'className' },
|
{ key: 'className' },
|
||||||
{ key: 'revisionDate' },
|
{ key: 'revisionDate' },
|
||||||
|
|
@ -453,7 +507,9 @@ WebGUI.Admin.Tree
|
||||||
{ key: 'childCount' }
|
{ key: 'childCount' }
|
||||||
],
|
],
|
||||||
metaFields: {
|
metaFields: {
|
||||||
totalRecords: "totalAssets" // Access to value in the server response
|
totalRecords: "totalAssets", // Access to value in the server response
|
||||||
|
crumbtrail : "crumbtrail",
|
||||||
|
currentAsset : "currentAsset"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -493,23 +549,6 @@ WebGUI.Admin.Tree
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* appendToUrl( url, params )
|
|
||||||
* Add URL components to a URL;
|
|
||||||
*/
|
|
||||||
appendToUrl
|
|
||||||
= function ( url, params ) {
|
|
||||||
var components = [ url ];
|
|
||||||
if (url.match(/\?/)) {
|
|
||||||
components.push(";");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
components.push("?");
|
|
||||||
}
|
|
||||||
components.push(params);
|
|
||||||
return components.join('');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* addHighlightToRow ( child )
|
* addHighlightToRow ( child )
|
||||||
* Highlight the row containing this element by adding to it the "highlight"
|
* Highlight the row containing this element by adding to it the "highlight"
|
||||||
|
|
@ -605,16 +644,17 @@ WebGUI.Admin.Tree.prototype.findRow
|
||||||
*/
|
*/
|
||||||
WebGUI.Admin.Tree.prototype.formatActions
|
WebGUI.Admin.Tree.prototype.formatActions
|
||||||
= function ( elCell, oRecord, oColumn, orderNumber ) {
|
= function ( elCell, oRecord, oColumn, orderNumber ) {
|
||||||
if ( oRecord.getData( 'actions' ) ) {
|
if ( oRecord.getData( 'canEdit' ) ) {
|
||||||
elCell.innerHTML
|
var edit = document.createElement("span");
|
||||||
= '<a href="' + appendToUrl(oRecord.getData( 'url' ), 'func=edit;proceed=manageAssets') + '">'
|
edit.className = "clickable";
|
||||||
+ window.admin.i18n.get('Asset', 'edit') + '</a>'
|
YAHOO.util.Event.addListener( edit, "click", function(){
|
||||||
+ ' | '
|
window.admin.editAsset( oRecord.getData('url') );
|
||||||
;
|
}, window.admin, true );
|
||||||
}
|
edit.appendChild( document.createTextNode( window.admin.i18n.get('Asset', 'edit') ) );
|
||||||
else {
|
elCell.appendChild( edit );
|
||||||
elCell.innerHTML = "";
|
elCell.appendChild( document.createTextNode( " | " ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return; // TODO
|
return; // TODO
|
||||||
var more = document.createElement( 'a' );
|
var more = document.createElement( 'a' );
|
||||||
elCell.appendChild( more );
|
elCell.appendChild( more );
|
||||||
|
|
@ -627,7 +667,7 @@ WebGUI.Admin.Tree.prototype.formatActions
|
||||||
oldMenu.parentNode.removeChild( oldMenu );
|
oldMenu.parentNode.removeChild( oldMenu );
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = this.buildMoreMenu(oRecord.getData( 'url' ), more, oRecord.getData( 'actions' ));
|
var options = this.buildMoreMenu(oRecord.getData( 'url' ), more, oRecord.getData( 'canEdit' ));
|
||||||
|
|
||||||
var menu = new YAHOO.widget.Menu( "moreMenu" + oRecord.getData( 'assetId' ), options );
|
var menu = new YAHOO.widget.Menu( "moreMenu" + oRecord.getData( 'assetId' ), options );
|
||||||
YAHOO.util.Event.onDOMReady( function () { menu.render( document.getElementById( 'assetManager' ) ); } );
|
YAHOO.util.Event.onDOMReady( function () { menu.render( document.getElementById( 'assetManager' ) ); } );
|
||||||
|
|
@ -674,11 +714,11 @@ WebGUI.Admin.Tree.prototype.formatLockedBy
|
||||||
elCell.innerHTML
|
elCell.innerHTML
|
||||||
= oRecord.getData( 'lockedBy' )
|
= oRecord.getData( 'lockedBy' )
|
||||||
? '<a href="' + appendToUrl(oRecord.getData( 'url' ), 'func=manageRevisions') + '">'
|
? '<a href="' + appendToUrl(oRecord.getData( 'url' ), 'func=manageRevisions') + '">'
|
||||||
+ '<img src="' + extras + '/assetManager/locked.gif" alt="' + window.admin.i18n.get('WebGUI', 'locked by') + ' ' + oRecord.getData( 'lockedBy' ) + '" '
|
+ '<img src="' + extras + '/icon/lock.png" alt="' + window.admin.i18n.get('WebGUI', 'locked by') + ' ' + oRecord.getData( 'lockedBy' ) + '" '
|
||||||
+ 'title="' + window.admin.i18n.get('WebGUI', 'locked by') + ' ' + oRecord.getData( 'lockedBy' ) + '" border="0" />'
|
+ 'title="' + window.admin.i18n.get('WebGUI', 'locked by') + ' ' + oRecord.getData( 'lockedBy' ) + '" border="0" />'
|
||||||
+ '</a>'
|
+ '</a>'
|
||||||
: '<a href="' + appendToUrl(oRecord.getData( 'url' ), 'func=manageRevisions') + '">'
|
: '<a href="' + appendToUrl(oRecord.getData( 'url' ), 'func=manageRevisions') + '">'
|
||||||
+ '<img src="' + extras + '/assetManager/unlocked.gif" alt="' + window.admin.i18n.get('Asset', 'unlocked') + '" '
|
+ '<img src="' + extras + '/icon/lock_open.png" alt="' + window.admin.i18n.get('Asset', 'unlocked') + '" '
|
||||||
+ 'title="' + window.admin.i18n.get('Asset', 'unlocked') + '" border="0" />'
|
+ 'title="' + window.admin.i18n.get('Asset', 'unlocked') + '" border="0" />'
|
||||||
+ '</a>'
|
+ '</a>'
|
||||||
;
|
;
|
||||||
|
|
@ -721,16 +761,30 @@ WebGUI.Admin.Tree.prototype.formatRevisionDate
|
||||||
*/
|
*/
|
||||||
WebGUI.Admin.Tree.prototype.formatTitle
|
WebGUI.Admin.Tree.prototype.formatTitle
|
||||||
= function ( elCell, oRecord, oColumn, orderNumber ) {
|
= function ( elCell, oRecord, oColumn, orderNumber ) {
|
||||||
elCell.innerHTML = '<span class="hasChildren">'
|
var hasChildren = document.createElement("span");
|
||||||
+ ( oRecord.getData( 'childCount' ) > 0 ? "+" : " " )
|
hasChildren.className = "hasChildren";
|
||||||
+ '</span> <span class="clickable">'
|
if ( oRecord.getData('childCount') > 0 ) {
|
||||||
+ oRecord.getData( 'title' )
|
hasChildren.appendChild( document.createTextNode( "+" ) );
|
||||||
+ '</span>'
|
}
|
||||||
;
|
else {
|
||||||
|
hasChildren.appendChild( document.createTextNode( " " ) );
|
||||||
|
}
|
||||||
|
elCell.appendChild( hasChildren );
|
||||||
|
|
||||||
|
var title = document.createElement("span");
|
||||||
|
title.className = "clickable";
|
||||||
|
title.appendChild( document.createTextNode( oRecord.getData('title') ) );
|
||||||
|
YAHOO.util.Event.addListener( title, "click", function(){ window.admin.gotoAsset(oRecord.getData('url')) }, this, true );
|
||||||
|
elCell.appendChild( title );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the tree with a new asset
|
||||||
|
* Do not call this directly, use Admin.gotoAsset(url)
|
||||||
|
*/
|
||||||
WebGUI.Admin.Tree.prototype.goto
|
WebGUI.Admin.Tree.prototype.goto
|
||||||
= function ( assetUrl ) {
|
= function ( assetUrl ) {
|
||||||
|
// TODO: Show loading screen
|
||||||
var callback = {
|
var callback = {
|
||||||
success : this.onDataReturnInitializeTable,
|
success : this.onDataReturnInitializeTable,
|
||||||
failure : this.onDataReturnInitializeTable,
|
failure : this.onDataReturnInitializeTable,
|
||||||
|
|
@ -756,6 +810,32 @@ WebGUI.Admin.Tree.prototype.onDataReturnInitializeTable
|
||||||
= function ( sRequest, oResponse, oPayload ) {
|
= function ( sRequest, oResponse, oPayload ) {
|
||||||
this.dataTable.onDataReturnInitializeTable.call( this.dataTable, sRequest, oResponse, oPayload );
|
this.dataTable.onDataReturnInitializeTable.call( this.dataTable, sRequest, oResponse, oPayload );
|
||||||
|
|
||||||
|
// Rebuild the crumbtrail
|
||||||
|
var crumb = oResponse.meta.crumbtrail;
|
||||||
|
var elCrumb = document.getElementById( "treeCrumbtrail" );
|
||||||
|
elCrumb.innerHTML = '';
|
||||||
|
for ( var i = 0; i < crumb.length; i++ ) {
|
||||||
|
var item = crumb[i];
|
||||||
|
var elItem = document.createElement( "span" );
|
||||||
|
elItem.className = "clickable";
|
||||||
|
YAHOO.util.Event.addListener( elItem, "click", window.admin.makeGotoAsset(item.url) );
|
||||||
|
elItem.appendChild( document.createTextNode( item.title ) );
|
||||||
|
|
||||||
|
elCrumb.appendChild( elItem );
|
||||||
|
elCrumb.appendChild( document.createTextNode( " > " ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Final crumb item has a menu
|
||||||
|
var elItem = document.createElement( "span" );
|
||||||
|
elItem.className = "clickable";
|
||||||
|
YAHOO.util.Event.addListener( elItem, "click", function(){ alert( "TOADO" ) }, this, true );
|
||||||
|
elItem.appendChild( document.createTextNode( oResponse.meta.currentAsset.title ) );
|
||||||
|
elCrumb.appendChild( elItem );
|
||||||
|
|
||||||
|
// TODO: Update current asset
|
||||||
|
window.admin.navigate( oResponse.meta.currentAsset );
|
||||||
|
|
||||||
|
// TODO Hide loading screen
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -834,7 +914,7 @@ WebGUI.Admin.Tree.prototype.toggleHighlightForRow
|
||||||
*/
|
*/
|
||||||
WebGUI.Admin.Tree.prototype.toggleRow = function ( child ) {
|
WebGUI.Admin.Tree.prototype.toggleRow = function ( child ) {
|
||||||
var row = this.findRow( child );
|
var row = this.findRow( child );
|
||||||
|
|
||||||
// Find the checkbox
|
// Find the checkbox
|
||||||
var inputs = row.getElementsByTagName( "input" );
|
var inputs = row.getElementsByTagName( "input" );
|
||||||
for ( var i = 0; i < inputs.length; i++ ) {
|
for ( var i = 0; i < inputs.length; i++ ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue