From c0e10f657848169cb4923fc84f804b25b77fc040 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 8 Dec 2003 02:28:16 +0000 Subject: [PATCH] templatized the admin bar macro --- docs/changelog/6.x.x.txt | 1 + docs/previousVersion.sql | 2 +- docs/upgrades/upgrade_5.5.3-6.0.0.sql | 2 + lib/WebGUI/Macro/AdminBar.pm | 81 ++++++++++++++------------- 4 files changed, 45 insertions(+), 41 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 28f3fe050..9c9ab1e7c 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -15,5 +15,6 @@ - Re-enabled the Date macro by default. - Templatized the Login Box macro. - Added the new WebGUI 6 design. + - Templatized the Admin Bar macro. diff --git a/docs/previousVersion.sql b/docs/previousVersion.sql index 1f3623649..32dd30da0 100644 --- a/docs/previousVersion.sql +++ b/docs/previousVersion.sql @@ -17036,5 +17036,5 @@ update style set styleId=10 where styleId=-10; delete from style where styleId<0; update incrementer set nextValue=nextValue+1 where incrementerId='styleId'; update page set styleId=1000 where styleId=-8; -INSERT INTO style VALUES (1000,'WebGUI 6','\r\n ','\r\n^AdminBar;\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n
^L(17,"",2); ^AdminToggle;
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n^Spacer(56,1);^Spacer(26,1);
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,59);^D(\"%c %D, %y\");
^PageTitle;
^Spacer(53,59);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,1);\r\n
\r\n^FlexMenu;\r\n


\r\n\r\n
^-;^Spacer(53,1);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n'); +INSERT INTO style VALUES (1000,'WebGUI 6','\r\n ','\r\n^AdminBar(1);\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n
^L(17,"",2); ^AdminToggle;
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n^Spacer(56,1);^Spacer(26,1);
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,59);^D(\"%c %D, %y\");
^PageTitle;
^Spacer(53,59);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n
^Spacer(53,1);\r\n
\r\n^FlexMenu;\r\n


\r\n\r\n
^-;^Spacer(53,1);
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n'); diff --git a/docs/upgrades/upgrade_5.5.3-6.0.0.sql b/docs/upgrades/upgrade_5.5.3-6.0.0.sql index d41683331..8a0521552 100644 --- a/docs/upgrades/upgrade_5.5.3-6.0.0.sql +++ b/docs/upgrades/upgrade_5.5.3-6.0.0.sql @@ -172,4 +172,6 @@ delete from international where languageId=1 and namespace='USS' and internation insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (71,1,'USS','User Submission Systems (USS) are a great way to add a sense of community to any site as well as get free content from your users. The User Submission System name is misleading to some people, because they immediately think of users as visitors. However, users are also staff, or business partners, or even yourself. With the USS you can select who can add new content, and even who can moderate that content.\r\n

\r\nUser Submission systems are so versatile that they allow you to create all kinds of applications, just by editing a few templates. Example applications are Photo Galleries, FAQs, Link Lists, Guest Books, Classifieds, and more.\r\n\r\n\r\n

\r\nSubmission Template
\r\nChoose a layout for the individual submissions.\r\n

\r\n\r\nSubmission Form Template
\r\nChoose a layout of the form users see when submitting content.\r\n

\r\n\r\n\r\nSubmissions Per Page
\r\nHow many submissions should be listed per page in the submissions index?\r\n

\r\n\r\n\r\nFilter Content
\r\nSelect the level of content filtering you wish to perform on all submitted content.\r\n

\r\n\r\nSort By
\r\nThe field to sort the submission list by.\r\n

\r\n\r\nSort Order
\r\nThe direction to sort the submission list by.\r\n

\r\n\r\n\r\n\r\n\r\nWho can approve?
\r\nWhat group is allowed to approve and deny content?\r\n

\r\n\r\nWho can contribute?
\r\nWhat group is allowed to contribute content?\r\n

\r\n\r\n\r\nDefault Status
\r\nShould submissions be set to Approved, Pending, or Denied by default?\r\n

\r\nNote: If you set the default status to Pending, then be prepared to monitor your message log for new submissions.\r\n

\r\n\r\nKarma Per Submission
\r\nHow much karma should be given to a user when they contribute to this user submission system?\r\n

\r\n\r\n\r\nAllow discussion?
\r\nChecking this box will enable responses to your article much like Articles on Slashdot.org.\r\n

\r\n\r\n\r\n', 1070199700,NULL); INSERT INTO template VALUES (1,'Default Login Box','

\n\n \n
\n \n

\n \n
\n \n \n \n

\n
\n\n \n \">.\n \n \n \n \n
\n
\n','Macro/L_loginBox'); INSERT INTO template VALUES (2,'Horizontal Login Box','
\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n\n \n \">.\n
\n \n \n
\n
\n
\n','Macro/L_loginBox'); +INSERT INTO template VALUES (2,'DHTML Admin Bar','\n\n\n\n
\n','Macro/AdminBar'); +INSERT INTO template VALUES (1,'Default Admin Bar',' \n \n
\n\n \n \n \n \n \n
\n \n
\n \n
\n \n
\n
\n','Macro/AdminBar'); diff --git a/lib/WebGUI/Macro/AdminBar.pm b/lib/WebGUI/Macro/AdminBar.pm index 0e23901dc..01279092f 100644 --- a/lib/WebGUI/Macro/AdminBar.pm +++ b/lib/WebGUI/Macro/AdminBar.pm @@ -12,8 +12,8 @@ package WebGUI::Macro::AdminBar; use strict qw(refs vars); use Tie::IxHash; -use WebGUI::Form; use WebGUI::International; +use WebGUI::Macro; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::SQL; @@ -23,7 +23,10 @@ use WebGUI::Utility; #------------------------------------------------------------------- sub process { return "" unless ($session{var}{adminOn}); - my (%hash2, $miscSelect, $adminSelect, $clipboardSelect, %hash, $output, $contentSelect, $r, $i, @item, $query); + my @param = WebGUI::Macro::getParams($_[0]); + my $templateId = $param[0] || 1; + my %var; + my (%hash2, %hash, $r, $i, @item, $query); tie %hash, "Tie::IxHash"; tie %hash2, "Tie::IxHash"; #--content adder @@ -42,15 +45,21 @@ sub process { $hash{WebGUI::URL::page('func=edit&wid=new&namespace='.$namespace)} = $w->name;; } %hash = sortHash(%hash); - %hash = (%{{WebGUI::URL::page()=>WebGUI::International::get(1)}},%hash); - $contentSelect = WebGUI::Form::selectList({ - name=>"contentSelect", - options=>\%hash, - extras=>'onChange="goContent()"' - }); + $var{'addcontent.label'} = WebGUI::International::get(1); + my @addcontent; + my $i = 0; + foreach my $key (keys %hash) { + push(@addcontent,{ + 'addcontent.url'=>$key, + 'addcontent.label'=>$hash{$key}, + 'addcontent.count'=>$i + }); + $i++; + } + $var{'addcontent_loop'} = \@addcontent; #--clipboard paster %hash2 = (); - $hash2{WebGUI::URL::page()} = WebGUI::International::get(3); + $var{'clipboard.label'} = WebGUI::International::get(3); # get pages and store in array of arrays in order to integrate with wobjects and sort by buffer date if ($session{setting}{sharedClipboard} eq "1") { @@ -92,12 +101,17 @@ sub process { $hash2{ $sorted_item[$i][1] } = $sorted_item[$i][2]; } @sorted_item = (); - - $clipboardSelect = WebGUI::Form::selectList({ - name=>"clipboardSelect", - options=>\%hash2, - extras=>'onChange="goClipboard()"' - }); + my @clipboard; + $i = 0; + foreach my $key (keys %hash2) { + push(@clipboard,{ + 'clipboard.url'=>$key, + 'clipboard.label'=>$hash2{$key}, + 'clipboard.count'=>$i + }); + $i++; + } + $var{'clipboard_loop'} = \@clipboard; #--admin functions %hash = (); if (WebGUI::Privilege::isInGroup(3)) { @@ -156,35 +170,22 @@ sub process { ); %hash = sortHash(%hash); %hash = ( - ''=>WebGUI::International::get(82), WebGUI::URL::page('op=switchOffAdmin')=>WebGUI::International::get(12), %hash ); - $adminSelect = WebGUI::Form::selectList({ - name=>"adminSelect", - options=>\%hash, - extras=>'onChange="goAdmin()"' - }); - #--output admin bar - $output = ' -
- - - - -
'.$contentSelect.'
'.$clipboardSelect.'
'.$adminSelect.'
- '; - return $output; + $var{'admin_loop'} = \@admin; + return WebGUI::Template::process(WebGUI::Template::get($templateId,"Macro/AdminBar"),\%var); }