package WebGUI; #------------------------------------------------------------------- # WebGUI is Copyright 2001 Plain Black Software. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use strict qw(vars subs); use Tie::IxHash; use WebGUI::Operation; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::SQL; use WebGUI::Style; #------------------------------------------------------------------- sub _displayAdminBar { my ($widgetName, $key, %hash2, $miscSelect, $adminSelect, $clipboardSelect, $widget, @widgetArray, %hash, $output, $contentSelect); tie %hash, "Tie::IxHash"; tie %hash2, "Tie::IxHash"; #--content adder @widgetArray = @_; $hash2{$session{page}{url}} = "Add content..."; $hash2{$session{page}{url}.'?op=addPage'} = 'Page'; foreach $widget (@widgetArray) { $widgetName = "WebGUI::Widget::".$widget."::widgetName"; $hash2{$session{page}{url}.'?func=add&widget='.$widget} = &$widgetName; } $contentSelect = WebGUI::Form::selectList("contentSelect",\%hash2,"","","","goContent()"); #--clipboard paster %hash2 = ( $session{page}{url}=> "Paste from clipboard..." ); %hash = WebGUI::SQL->buildHash("select pageId,title from page where parentId=2 order by title",$session{dbh}); foreach $key (keys %hash) { $hash2{$session{page}{url}.'?op=pastePage&pageId='.$key} = $hash{$key}; } %hash = WebGUI::SQL->buildHash("select widgetId,title from widget where pageId=2 order by title",$session{dbh}); foreach $key (keys %hash) { $hash2{$session{page}{url}.'?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 = ( $session{page}{url}.'?op=editSettings'=>'Edit Settings', $session{page}{url}.'?op=listGroups'=>'Manage Groups', $session{page}{url}.'?op=listStyles'=>'Manage Styles', $session{page}{url}.'?op=listUsers'=>'Manage Users', $session{env}{SCRIPT_NAME}.'/clipboard'=>'View Clipboard', $session{env}{SCRIPT_NAME}.'/trash'=>'View Trash' ); } %hash = ( $session{page}{url}=>'Admin...', $session{page}{url}.'?op=switchOffAdmin'=>'Turn Admin Off', $session{page}{url}.'?op=viewHelpIndex'=>'View Help Index', $session{page}{url}.'?op=viewPendingSubmissions'=>'View Pending Submissions', %hash ); $adminSelect = WebGUI::Form::selectList("adminSelect",\%hash,"","","","goAdmin()"); #--output admin bar $output = '
| '; $postContent = ' |




';
}
$sth = WebGUI::SQL->read("select widgetId, widgetType from widget where pageId=".$session{page}{pageId}." order by sequenceNumber, widgetId",$session{dbh});
while (@widgetList = $sth->array) {
if ($session{var}{adminOn}) {
$content .= '




"; } $sth->finish; } else { $content = '