From 4934682de6a1eaebd42e051049601eec9c04ee0f Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 27 May 2002 04:35:59 +0000 Subject: [PATCH] Made the ^AdminBar; macro. --- lib/WebGUI.pm | 106 ---------------------------------- lib/WebGUI/Operation/Style.pm | 4 +- 2 files changed, 2 insertions(+), 108 deletions(-) diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index b1e4d036d..dd9191a26 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -13,7 +13,6 @@ our $VERSION = "3.9.0"; use strict qw(vars subs); use Tie::CPHash; -use Tie::IxHash; use WebGUI::ErrorHandler; use WebGUI::Icon; use WebGUI::International; @@ -23,108 +22,6 @@ use WebGUI::Session; use WebGUI::SQL; use WebGUI::Style; use WebGUI::Template; -use WebGUI::URL; -use WebGUI::Utility; - -#------------------------------------------------------------------- -sub _displayAdminBar { - my (%hash2, $miscSelect, $adminSelect, $clipboardSelect, - %hash, $output, $contentSelect, $key); - tie %hash, "Tie::IxHash"; - tie %hash2, "Tie::IxHash"; - #--content adder - $hash{WebGUI::URL::page()} = WebGUI::International::get(1); - $hash{WebGUI::URL::page('op=editPage&npp='.$session{page}{pageId})} = WebGUI::International::get(2); - $hash{WebGUI::URL::page('op=selectPackageToDeploy')} = WebGUI::International::get(376); - foreach $key (keys %{$session{wobject}}) { - $hash2{WebGUI::URL::page('func=edit&wid=new&namespace='.$key)} = $session{wobject}{$key}; - } - %hash2 = sortHash(%hash2); - %hash = (%hash, %hash2); - $contentSelect = WebGUI::Form::selectList("contentSelect",\%hash,"","","","goContent()"); - #--clipboard paster - %hash2 = (); - $hash2{WebGUI::URL::page()} = WebGUI::International::get(3); - %hash = WebGUI::SQL->buildHash("select pageId,title from page where parentId=2 order by title"); - foreach $key (keys %hash) { - $hash2{WebGUI::URL::page('op=pastePage&pageId='.$key)} = $hash{$key}; - } - %hash = WebGUI::SQL->buildHash("select wobjectId,title from wobject where pageId=2 order by title"); - foreach $key (keys %hash) { - $hash2{WebGUI::URL::page('func=paste&wid='.$key)} = $hash{$key}; - } - $clipboardSelect = WebGUI::Form::selectList("clipboardSelect",\%hash2,"","","","goClipboard()"); - #--admin functions - %hash = (); - if (WebGUI::Privilege::isInGroup(3,$session{user}{userId})) { - %hash = ( - WebGUI::URL::page('op=listGroups')=>WebGUI::International::get(5), - WebGUI::URL::page('op=manageSettings')=>WebGUI::International::get(4), - WebGUI::URL::page('op=listUsers')=>WebGUI::International::get(7), - WebGUI::URL::gateway('trash')=>WebGUI::International::get(10), - WebGUI::URL::page('op=listRoots')=>WebGUI::International::get(410), - WebGUI::URL::page('op=viewStatistics')=>WebGUI::International::get(144) - ); - } - if (WebGUI::Privilege::isInGroup(4,$session{user}{userId})) { - %hash = ( - 'http://validator.w3.org/check?uri=http%3A%2F%2F'.$session{env}{SERVER_NAME}. - WebGUI::URL::page()=>WebGUI::International::get(399), - WebGUI::URL::page('op=listImages')=>WebGUI::International::get(394), - WebGUI::URL::page('op=viewPageTree')=>WebGUI::International::get(447), - %hash - ); - } - if (WebGUI::Privilege::isInGroup(5,$session{user}{userId})) { - %hash = ( - WebGUI::URL::page('op=listStyles')=>WebGUI::International::get(6), - %hash - ); - } - if (WebGUI::Privilege::isInGroup(6,$session{user}{userId})) { - %hash = ( - WebGUI::URL::gateway('packages')=>WebGUI::International::get(374), - %hash - ); - } - if (WebGUI::Privilege::isInGroup(8,$session{user}{userId})) { - %hash = ( - WebGUI::URL::page('op=listTemplates')=>WebGUI::International::get(508), - %hash - ); - } - %hash = ( - WebGUI::URL::page('op=viewHelpIndex')=>WebGUI::International::get(13), - %hash - ); - %hash = sortHash(%hash); - %hash = ( - WebGUI::URL::page()=>WebGUI::International::get(82), - WebGUI::URL::page('op=switchOffAdmin')=>WebGUI::International::get(12), - %hash - ); - $adminSelect = WebGUI::Form::selectList("adminSelect",\%hash,"","","","goAdmin()"); - #--output admin bar - $output = ' -
- - - - -
'.$contentSelect.'
'.$clipboardSelect.'
'.$adminSelect.'
- '; - return $output; -} #------------------------------------------------------------------- sub page { @@ -221,9 +118,6 @@ sub page { $content = WebGUI::Template::generate(\%contentHash,1); } } - if ($session{var}{adminOn}) { - $adminBar = _displayAdminBar(); - } if ($session{header}{redirect} ne "") { return $session{header}{redirect}; } else { diff --git a/lib/WebGUI/Operation/Style.pm b/lib/WebGUI/Operation/Style.pm index 9c1011062..cd9c24ca3 100644 --- a/lib/WebGUI/Operation/Style.pm +++ b/lib/WebGUI/Operation/Style.pm @@ -78,7 +78,7 @@ sub www_editStyle { tie %style, 'Tie::CPHash'; if (WebGUI::Privilege::isInGroup(5)) { if ($session{form}{sid} eq "new") { - $style{body} = "\n\n^-;\n\n"; + $style{body} = "^AdminBar;\n\n\n\n^-;\n\n"; $style{styleSheet} = ""; } else { %style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}"); @@ -107,7 +107,7 @@ sub www_editStyleSave { $session{form}{sid} = getNextId("styleId"); WebGUI::SQL->write("insert into style (styleId) values ($session{form}{sid})"); } - $session{form}{body} = "^-;" if ($session{form}{body} eq ""); + $session{form}{body} = "^AdminBar;\n\n\n\n^-;\n\n" if ($session{form}{body} eq ""); WebGUI::SQL->write("update style set name=".quote($session{form}{name}).", body=".quote($session{form}{body}).", styleSheet=".quote($session{form}{styleSheet})." where styleId=".$session{form}{sid}); return www_listStyles();