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=>'
'}); + foreach my $asset (@{$session->asset->getAssetAdderLinks}) { + push(@assets, { + title=>$asset->{label}, + icon=>$asset->{'icon.small'}, + url=>$asset->{url} + }); + } + push(@adminbar, { + label => $i18n->get(1083), + name => "newContent", + items => \@assets + }); + } + return WebGUI::Asset::Template->new($session,$templateId)->process({adminbar_loop=>\@adminbar}); # 'http://validator.w3.org/check?uri=referer'=>$i18n->get(399), } diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm index 157e8879d..7e4e55609 100644 --- a/lib/WebGUI/Operation/VersionTag.pm +++ b/lib/WebGUI/Operation/VersionTag.pm @@ -16,6 +16,8 @@ package WebGUI::Operation::VersionTag; use strict; use WebGUI::Paginator; +use WebGUI::AdminConsole; +use WebGUI::International; =head1 NAME @@ -86,13 +88,17 @@ sub www_addVersionTagSave { #------------------------------------------------------------------- sub www_commitVersionTag { - my $self = shift; - return $self->session->privilege->adminOnly() unless $self->session->user->isInGroup(3); - my $tagId = $self->session->form->process("tagId"); + my $session = shift; + return $session->privilege->adminOnly() unless $session->user->isInGroup(3); + my $tagId = $session->form->process("tagId"); if ($tagId) { - $self->commitVersionTag($tagId); + my $tag = WebGUI::VersionTag->new($session, $tagId); + $tag->commit if (defined $tag); } - return $self->www_manageVersions; + if ($session->form->get("backToSite")) { + return ""; + } + return www_manageVersions($session); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/VersionTag.pm b/lib/WebGUI/VersionTag.pm index 21e99a318..6fee65658 100644 --- a/lib/WebGUI/VersionTag.pm +++ b/lib/WebGUI/VersionTag.pm @@ -147,15 +147,24 @@ sub getId { #------------------------------------------------------------------- -=head2 getWorking ( ) +=head2 getWorking ( session, noCreate ) This is a class method. Returns the current working version tag for this user as set by setWorking(). If there is no current working tag an autotag will be created and assigned as the working tag for this user. +=head3 session + +A reference to the current session. + +=head3 noCreate + +A boolean that if set to true, will prevent this method from creating an autotag. + =cut sub getWorking { my $class = shift; my $session = shift; + my $noCreate = shift; if ($session->stow->get("versionTag")) { return $session->stow->get("versionTag"); } else { @@ -164,6 +173,8 @@ sub getWorking { my $tag = $class->new($session, $tagId); $session->stow->set("versionTag",$tag); return $tag; + } elsif ($noCreate) { + return undef; } else { my $tag = $class->create($session); $tag->setAsWorking; diff --git a/lib/WebGUI/i18n/English/Asset_Template.pm b/lib/WebGUI/i18n/English/Asset_Template.pm index 0b68cfa03..45b8edf9a 100644 --- a/lib/WebGUI/i18n/English/Asset_Template.pm +++ b/lib/WebGUI/i18n/English/Asset_Template.pm @@ -1,6 +1,18 @@ package WebGUI::i18n::English::Asset_Template; our $I18N = { + 'head block' => { + message => q|Head Block|, + context => q|label for the get edit form where users should put things that go in the html head block|, + lastUpdated => 0, + }, + + 'head block description' => { + message => q|Put meta tags, script tags, link tables, style sheets, and anything else here that you want to appear in the head block of the HTML document.|, + context => q|hover help for the head block field|, + lastUpdated => 0, + }, + 'style wizard' => { message => q|Style Wizard|, context => q|Label for link to engage the style wizard.|, diff --git a/lib/WebGUI/i18n/English/Macro_AdminBar.pm b/lib/WebGUI/i18n/English/Macro_AdminBar.pm index 711756f99..fe069bb39 100644 --- a/lib/WebGUI/i18n/English/Macro_AdminBar.pm +++ b/lib/WebGUI/i18n/English/Macro_AdminBar.pm @@ -18,83 +18,39 @@ content from the clipboard, accessing the help system and other administrative f The macro may take one optional argument, an alternate template in the Macro/AdminBar namespace for generating the AdminBar. The following variables are available in the template:

-packages.label
-The internationalized label for adding packages. - -

-packages.canAdd
-A boolean indicating whether the current user can add packages. - -

-addContent.label
-The internationalized label for adding content. - -

-contenttypes_loop
-The loop containing different types of content to add - +adminbar_loop
+A loop containing the various lists of data to display.

-

-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
+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. +

-

-addpage.label
-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
-The label for this item in the clipboard. - -

-clipboard.url
-The URL for pasting this clipboard item onto the current page. -

-

-admin.label
-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 label for this item in the clipboard. - -

-admin.url
-The URL for executing this admin function. - -

- -

- 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