started asset helpers

This commit is contained in:
Doug Bell 2010-04-21 11:20:22 -05:00
parent 8d432c8be6
commit a9ff59d7b2
3 changed files with 56 additions and 9 deletions

View file

@ -210,6 +210,7 @@ sub www_getTreeData {
assetSize => $asset->assetSize,
lockedBy => ($asset->isLockedBy ? $asset->lockedBy->username : ''),
actions => $asset->canEdit && $asset->canEditIfLocked,
helpers => $asset->getHelpers,
);
$fields{ className } = {};
@ -225,6 +226,15 @@ sub www_getTreeData {
$assetInfo->{ totalAssets } = $p->getRowCount;
$assetInfo->{ sort } = $session->form->get( 'orderByColumn' );
$assetInfo->{ dir } = lc $session->form->get( 'orderByDirection' );
$assetInfo->{ currentAsset } = { title => $asset->getTitle, helpers => $asset->getHelpers };
$assetInfo->{ crumbtrail } = [];
for my $asset ( @{ $asset->getLineage( ['ancestors'], { returnObjects => 1 } ) } ) {
push @{ $assetInfo->{crumbtrail} }, {
title => $asset->getTitle,
url => $asset->getUrl
};
}
$session->http->setMimeType( 'application/json' );
@ -357,10 +367,9 @@ __DATA__
<div class="yui-content">
<div id="viewTab"><iframe src="<tmpl_var viewUrl>" name="view" style="width: 100%; height: 80%"></iframe></div>
<div id="treeTab">
<div id="treeDataTableContainer">
</div>
<div id="treePagination">
</div>
<div id="treeCrumbtrail"></div>
<div id="treeDataTableContainer"></div>
<div id="treePagination"></div>
</div>
</div>
</div>

View file

@ -1172,6 +1172,34 @@ sub getExtraHeadTags {
;
}
#----------------------------------------------------------------------------
=head2 getHelpers ( )
Get the AssetHelpers for this asset.
=cut
sub getHelpers {
my ( $self ) = @_;
my $default = [
{
class => 'WebGUI::AssetHelper::EditBranch',
label => 'Edit Branch',
},
{
url => $self->getUrl( 'func=edit' ),
label => 'Edit',
},
{
url => $self->getUrl( 'func=view' ),
label => 'View',
},
];
return $default;
}
#-------------------------------------------------------------------

View file

@ -723,18 +723,18 @@ WebGUI.Admin.Tree.prototype.formatTitle
= function ( elCell, oRecord, oColumn, orderNumber ) {
elCell.innerHTML = '<span class="hasChildren">'
+ ( oRecord.getData( 'childCount' ) > 0 ? "+" : "&nbsp;" )
+ '</span> <a href="' + appendToUrl(oRecord.getData( 'url' ), 'op=assetManager;method=manage') + '">'
+ '</span> <span class="clickable">'
+ oRecord.getData( 'title' )
+ '</a>'
+ '</span>'
;
};
WebGUI.Admin.Tree.prototype.goto
= function ( assetUrl ) {
var callback = {
success : this.dataTable.onDataReturnInitializeTable,
failure : this.dataTable.onDataReturnInitializeTable,
scope : this.dataTable,
success : this.onDataReturnInitializeTable,
failure : this.onDataReturnInitializeTable,
scope : this,
argument: this.dataTable.getState()
};
@ -748,6 +748,16 @@ WebGUI.Admin.Tree.prototype.goto
);
};
/**
* onDataReturnInitializeTable ( sRequest, oResponse, oPayload )
* Initialize the table with a new response from the server
*/
WebGUI.Admin.Tree.prototype.onDataReturnInitializeTable
= function ( sRequest, oResponse, oPayload ) {
this.dataTable.onDataReturnInitializeTable.call( this.dataTable, sRequest, oResponse, oPayload );
};
/**
* removeHighlightFromRow ( child )
* Remove the highlight from a row by removing the "highlight" class.