change admin console to get asset info via ajax call after frame is loaded
this is step one in making the asset control toolbars work correctly without having an "Admin Mode"
This commit is contained in:
parent
eec3986cf7
commit
f5ebb6e916
3 changed files with 116 additions and 99 deletions
|
|
@ -248,34 +248,15 @@ if ($self->session->user->isRegistered || $self->session->setting->get("preventP
|
|||
}
|
||||
|
||||
|
||||
# TODO: Figure out if user is still in the admin console
|
||||
$var{'head.tags'} .= '<script type="text/javascript">';
|
||||
my $asset = $session->asset;
|
||||
|
||||
# If user is in an operation, find the right asset
|
||||
if ( !$asset && $session->form->get('op') ) {
|
||||
$asset = WebGUI::Asset->newByUrl( $session );
|
||||
}
|
||||
|
||||
if ( $asset ) {
|
||||
my $i18n = WebGUI::International->new( $session );
|
||||
my $assetName = $i18n->get( @{ $asset->assetName } );
|
||||
my $assetDef = {
|
||||
assetId => $asset->getId,
|
||||
title => $asset->getTitle,
|
||||
url => $asset->getUrl,
|
||||
icon => $asset->getIcon(1),
|
||||
type => $assetName,
|
||||
helpers => $asset->getHelpers,
|
||||
revisions => $asset->getRevisionDates,
|
||||
};
|
||||
$var{'head.tags'} .= sprintf <<'ADMINJS', JSON->new->encode( $assetDef );
|
||||
if ( window.parent && window.parent.admin ) {
|
||||
window.parent.admin.navigate( %s );
|
||||
}
|
||||
# Give the API jocks something to use
|
||||
if ( $session->asset ) {
|
||||
$var{'head.tags'} .= sprintf <<'ADMINJS', $session->asset->getId
|
||||
<script type="text/javascript">
|
||||
if ( typeof window.WG == "undefined" ) { window.WG = {} }
|
||||
WG.currentAssetId = '%s';
|
||||
</script>
|
||||
ADMINJS
|
||||
}
|
||||
$var{'head.tags'} .= '</script>';
|
||||
|
||||
# Removing the newlines will probably annoy people.
|
||||
# Perhaps turn it off under debug mode?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue