diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 3ff622f0e..385eb5152 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -1,4 +1,6 @@ 6.99.0 + - Refactored admin bar to be more dynamic. + - Added version tags menu to admin bar. - Added a revisions list to the edit screen of assets, so that you can quickly edit/view an old revision. - Removed start/end dates from assets in favor of the workflow system. diff --git a/lib/WebGUI/Asset/Template.pm b/lib/WebGUI/Asset/Template.pm index a3906a4e8..aae03eb52 100644 --- a/lib/WebGUI/Asset/Template.pm +++ b/lib/WebGUI/Asset/Template.pm @@ -147,6 +147,12 @@ sub getEditForm { -hoverHelp=>$i18n->get('template description'), -value=>$self->getValue("template") ); + $tabform->getTab("properties")->codearea( + -name=>"headBlock", + -label=>$i18n->get('head block'), + -hoverHelp=>$i18n->get('head block description'), + -value=>$self->getValue("headBlock") + ); if($self->session->config->get("templateParsers")){ my @temparray = @{$self->session->config->get("templateParsers")}; tie my %parsers, 'Tie::IxHash'; diff --git a/lib/WebGUI/Macro/AdminBar.pm b/lib/WebGUI/Macro/AdminBar.pm index ea8dd5369..842330ce0 100644 --- a/lib/WebGUI/Macro/AdminBar.pm +++ b/lib/WebGUI/Macro/AdminBar.pm @@ -11,13 +11,12 @@ package WebGUI::Macro::AdminBar; #------------------------------------------------------------------- use strict qw(refs vars); -use Tie::CPHash; -use Tie::IxHash; use WebGUI::AdminConsole; use WebGUI::Asset; use WebGUI::Asset::Template; use WebGUI::International; use WebGUI::Utility; +use WebGUI::VersionTag; =head1 NAME @@ -46,43 +45,106 @@ sub process { my @param = @_; my $templateId = $param[0] || "PBtmpl0000000000000090"; my %var; - my (%cphash, %hash2, %hash, $r, @item, $query); - tie %hash, "Tie::IxHash"; - tie %hash2, "Tie::IxHash"; - tie %cphash, "Tie::CPHash"; my $i18n = WebGUI::International->new($session,'Macro_AdminBar'); - $var{'packages.canAdd'} = ($session->user->profileField("uiLevel") >= 7); - $var{'packages.label'} = $i18n->get(376); - $var{'contentTypes.label'} = $i18n->get(1083); - $var{'clipboard.label'} = $i18n->get(1082); + my @adminbar = (); + my $ac = WebGUI::AdminConsole->new($session); + my @adminConsole = (); + foreach my $item (@{$ac->getAdminFunction}) { + push(@adminConsole, { + title=>$item->{title}, + icon=>$item->{'icon.small'}, + url=>$item->{url} + }); + } + push(@adminbar, { + label => $i18n->get("admin console","AdminConsole"), + name => "adminConsole", + items => \@adminConsole + }); if ($session->asset) { + my @clipboard = (); + foreach my $asset (@{$session->asset->getAssetsInClipboard(1)}) { + my $title = $asset->getTitle; + $title =~ s/'//g; # stops it from breaking the javascript menus + push(@clipboard, { + 'title'=>$title, + 'url'=>$session->asset->getUrl("func=paste;assetId=".$asset->getId), + icon=>$asset->getIcon(1), + }); + } + if (scalar(@clipboard)) { + push(@adminbar, { + label => $i18n->get(1082), + name => "clipboard", + items => \@clipboard + }); + } + my @packages = (); foreach my $package (@{$session->asset->getPackageList}) { my $title = $package->getTitle; $title =~ s/'//g; # stops it from breaking the javascript menus push(@{$var{'package_loop'}},{ 'url'=>$session->asset->getUrl("func=deployPackage;assetId=".$package->getId), - 'label'=>$title, - 'icon.small'=>$package->getIcon(1), - 'icon'=>$package->getIcon() + 'title'=>$title, + icon=>$package->getIcon(1), }); } - $var{contentTypes_loop} = $session->asset->getAssetAdderLinks; - $var{container_loop} = $session->asset->getAssetAdderLinks(undef,"assetContainers"); - foreach my $asset (@{$session->asset->getAssetsInClipboard(1)}) { - my $title = $asset->getTitle; - $title =~ s/'//g; # stops it from breaking the javascript menus - push(@{$var{clipboard_loop}}, { - 'label'=>$title, - 'url'=>$session->asset->getUrl("func=paste;assetId=".$asset->getId), - 'icon.small'=>$asset->getIcon(1), - 'icon'=>$asset->getIcon() + if ($session->user->profileField("uiLevel") >= 7 && scalar(@packages)) { + push(@adminbar, { + label => $i18n->get(376), + name => "packages", + items => \@packages }); } - } - #--admin functions - my $ac = WebGUI::AdminConsole->new($session); - $var{adminConsole_loop} = $ac->getAdminFunction; - return WebGUI::Asset::Template->new($session,$templateId)->process(\%var); + } + my $working = WebGUI::VersionTag->getWorking($session, 1); + my @tags = (); + if ($working) { + push(@tags, { + url=>$session->url->page("op=commitVersionTag;backToSite=1;tagId=".$working->getId), + label=>$i18n->get("commit my changes"), + icon=>$session->config->get("extrasURL").'/spacer.gif' + }); + } + my $rs = $session->db->read("select tagId, name from assetVersionTag where isCommitted=0 and isLocked=0 order by name"); + while (my ($id, $name) = $rs->array) { + push(@tags, { + url=>$session->url->page("op=setAsWorkingVersionTag;backToSite=1;tagId=".$id), + label=>$name, + icon=>($id eq $working->getId) ? $session->config->get("extrasURL").'/adminConsole/small/versionTags.gif' : $session->config->get("extrasURL").'/spacer.gif' + }); + } + if (scalar(@tags)) { + push(@adminbar, { + label => $i18n->get("version tags"), + name => "versions", + items => \@tags + }); + } + if ($session->asset) { + my @assets = (); + foreach my $asset (@{$session->asset->getAssetAdderLinks(undef,"assetContainers")}) { + push(@assets, { + title=>$asset->{label}, + icon=>$asset->{'icon.small'}, + url=>$asset->{url} + }); + } + push(@assets, {icon=>$session->config->get("extrasURL").'/spacer.gif',label=>'
- -contenttype.label
-The internationalized label for this content type. +label
+A heading label for this category. + - -contenttype.url
-The URL for adding an instance of this content type. +name
+A javascript friendly name for this category. + + +items +A loop containing the list if items in this category. ++ +title- -addpage.label
+The displayable link title for this item. + + +url
+The link URL for this item. + + +icon
+The URL of an icon to associate with this item. +
-The internationalized label for adding a page. - - -addpage.url
-The URL for adding a page. - - -clipboard.label
-The internationalized label for the clipboard. - - -clipboard_loop
-The loop containing a list of items in the clipboard. - -- -clipboard.label- -admin.label
-The label for this item in the clipboard. - - -clipboard.url
-The URL for pasting this clipboard item onto the current page. -
-The internationalized label for administrative functions. - - -admin_loop
-The loop containing a list of administrative functions, such as turning off admin mode or -validating the current page. - -- -admin.label- - - The .adminBar style sheet class is tied to the default template for this macro. |, - lastUpdated => 1112583521, + lastUpdated => 1141328392, }, '376' => { @@ -117,11 +73,21 @@ The URL for executing this admin function. lastUpdated => 1031514049 }, + 'version tags' => { + message => q|Version Tags|, + lastUpdated => 0 + }, + '12' => { message => q|Turn admin off.|, lastUpdated => 1031514049 }, + 'commit my changes' => { + message => q|Commit My Changes|, + lastUpdated => 0 + }, + 'macroName' => { message => q|AdminBar|, lastUpdated => 1128837324 diff --git a/www/extras/fileIcons/unknown.gif b/www/extras/fileIcons/unknown.gif index 37f490155..15e356cac 100644 Binary files a/www/extras/fileIcons/unknown.gif and b/www/extras/fileIcons/unknown.gif differ
-The label for this item in the clipboard. - - -admin.url
-The URL for executing this admin function. - -