From 4c95269bba89650bd7b713830719f26e587244de Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 23 Feb 2004 00:13:59 +0000 Subject: [PATCH] added an override in the user profile for toolbar icon set. added icons on all of the manage links in the content editing forms. added an "edit" icon to the template method in HTMLForm --- docs/changelog/6.x.x.txt | 1 + docs/upgrades/upgrade_5.9.9-6.0.0.pl | 8 +- docs/upgrades/upgrade_5.9.9-6.0.0.sql | 9 ++ lib/WebGUI/HTMLForm.pm | 16 +-- lib/WebGUI/Icon.pm | 112 +++++++++++++++--- lib/WebGUI/Navigation.pm | 3 +- lib/WebGUI/Operation/Page.pm | 24 ++-- lib/WebGUI/Wobject.pm | 2 +- www/extras/toolbar/charcoal/manage.gif | Bin 0 -> 1672 bytes www/extras/toolbar/classic/manage.gif | Bin 0 -> 455 bytes www/extras/toolbar/dutch/manage.gif | Bin 0 -> 1802 bytes www/extras/toolbar/iconic/manage.gif | Bin 0 -> 662 bytes www/extras/toolbar/italiano/manage.gif | Bin 0 -> 1869 bytes www/extras/toolbar/italianoclassic/manage.gif | Bin 0 -> 489 bytes www/extras/toolbar/orange/manage.gif | Bin 0 -> 1898 bytes www/extras/toolbar/spanish/manage.gif | Bin 0 -> 1840 bytes 16 files changed, 126 insertions(+), 49 deletions(-) create mode 100644 www/extras/toolbar/charcoal/manage.gif create mode 100644 www/extras/toolbar/classic/manage.gif create mode 100644 www/extras/toolbar/dutch/manage.gif create mode 100644 www/extras/toolbar/iconic/manage.gif create mode 100644 www/extras/toolbar/italiano/manage.gif create mode 100644 www/extras/toolbar/italianoclassic/manage.gif create mode 100644 www/extras/toolbar/orange/manage.gif create mode 100644 www/extras/toolbar/spanish/manage.gif diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 5ce197f15..679531c18 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -80,6 +80,7 @@ webgui. - Added Cool Menus to the navigation system. (Thanks to Thomas Brattli, http://www.dhtmlcentral.com) - Added a config file option for per-site International message caching. + - Added an override in the user profile for toolbar icon set. diff --git a/docs/upgrades/upgrade_5.9.9-6.0.0.pl b/docs/upgrades/upgrade_5.9.9-6.0.0.pl index 2d75f7060..ee2288c6e 100644 --- a/docs/upgrades/upgrade_5.9.9-6.0.0.pl +++ b/docs/upgrades/upgrade_5.9.9-6.0.0.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl use lib "../../lib"; +use File::Path; use Getopt::Long; use Parse::PlainConfig; use strict; @@ -528,11 +529,8 @@ unlink("../../lib/WebGUI/Wobject/FAQ.pm"); unlink("../../lib/WebGUI/Wobject/ExtraColumn.pm"); unlink("../../lib/WebGUI/Authentication.pm"); unlink("../../lib/WebGUI/Operation/Account.pm"); -unlink("../../lib/WebGUI/Authentication/WebGUI.pm"); -unlink("../../lib/WebGUI/Authentication/LDAP.pm"); -unlink("../../lib/WebGUI/Authentication/SMB.pm"); -rmdir("../../lib/WebGUI/Authentication"); - +rmtree("../../lib/WebGUI/Authentication"); +rmtree("../../www/extras/toolbar/default"); #-------------------------------------------- print "\tMigrating wobject privileges.\n" unless ($quiet); diff --git a/docs/upgrades/upgrade_5.9.9-6.0.0.sql b/docs/upgrades/upgrade_5.9.9-6.0.0.sql index 27ffa118d..4d3f592f2 100644 --- a/docs/upgrades/upgrade_5.9.9-6.0.0.sql +++ b/docs/upgrades/upgrade_5.9.9-6.0.0.sql @@ -527,4 +527,13 @@ INSERT INTO template VALUES (1,'Calendar Month (Big)','\r\ INSERT INTO template VALUES (7,'Cool Menus','\n\n \n\n\n\n\n','Navigation'); INSERT INTO Navigation VALUES (17,'coolmenu',99,'descendants','WebGUIroot',-1,7,0,0,0,0); +delete from international where internationalId=741 and namespace='WebGUI'; +delete from international where internationalId=742 and namespace='WebGUI'; +delete from international where languageId=1 and namespace='WebGUI' and internationalId=1084; +insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (1084,1,'WebGUI','Default', 1077472740,'A label indicating that the user should use the default setting.'); +update language set toolbar='metal' where toolbar='default'; +INSERT INTO userProfileField VALUES ('toolbar','WebGUI::International::get(746)',0,0,'selectList','WebGUI::Icon::getToolbarOptions()','[\'useLanguageDefault\']',13,4,0,0); + + + diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index a495f4c70..6e2477868 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -18,6 +18,7 @@ use CGI::Util qw(rearrange); use strict qw(vars refs); use WebGUI::DateTime; use WebGUI::Form; +use WebGUI::Icon; use WebGUI::International; use WebGUI::Privilege; use WebGUI::Session; @@ -1086,6 +1087,9 @@ sub group { my ($name, $label, $value, $size, $multiple, $extras, $subtext, $uiLevel, $excludeGroups) = rearrange([qw(name label value size multiple extras subtext uiLevel excludeGroups)], @p); if (_uiLevelChecksOut($uiLevel)) { + if (WebGUI::Privilege::isInGroup(3)) { + $subtext = manageIcon("op=listGroups").$subtext; + } $output = WebGUI::Form::group({ "name"=>$name, "size"=>$size, @@ -1961,14 +1965,10 @@ sub template { if (_uiLevelChecksOut($uiLevel)) { $label = $label || WebGUI::International::get(356); if (WebGUI::Privilege::isInGroup(8)) { - #disabled until we can resolve the "new" wobject problem - #if ($afterEdit) { - # $subtext = ''.WebGUI::International::get(741).' / '; - #} - $subtext .= '' - .WebGUI::International::get(742).''; + if ($afterEdit) { + $subtext = editIcon("op=editTemplate&tid=".$value."&namespace=".$namespace."&afterEdit=".WebGUI::URL::escape($afterEdit)); + } + $subtext .= manageIcon("op=listTemplates&namespace=$namespace"); } $output = WebGUI::Form::template({ "name"=>$name, diff --git a/lib/WebGUI/Icon.pm b/lib/WebGUI/Icon.pm index d9ae701e3..99c0119e7 100644 --- a/lib/WebGUI/Icon.pm +++ b/lib/WebGUI/Icon.pm @@ -16,11 +16,12 @@ package WebGUI::Icon; use Exporter; use strict; +use WebGUI::International; use WebGUI::Session; use WebGUI::URL; our @ISA = qw(Exporter); -our @EXPORT = qw(&helpIcon &becomeIcon &cutIcon ©Icon &deleteIcon &editIcon +our @EXPORT = qw(&helpIcon &becomeIcon &cutIcon ©Icon &deleteIcon &editIcon &manageIcon &moveBottomIcon &moveDownIcon &moveLeftIcon &moveRightIcon &moveTopIcon &moveUpIcon &pageIcon &dragIcon &shortcutIcon &pasteIcon &wobjectIcon &viewIcon); @@ -41,6 +42,7 @@ A package for generating user interface buttons. The subroutines found herein do $html = dragIcon(); $html = editIcon('op=something'); $html = helpIcon(1,"MyNamespace"); + $html = manageIcon('op=something'); $html = moveBottomIcon('op=something'); $html = moveDownIcon('op=something'); $html = moveLeftIcon('op=something'); @@ -53,12 +55,34 @@ A package for generating user interface buttons. The subroutines found herein do $html = viewIcon('op=something'); $html = wobjectIcon(); + $hashRef = getToolbarOptions(); + =head1 METHODS These subroutines are available from this package: =cut +#------------------------------------------------------------------- + +=head2 _getBaseURL ( ) + +Returns the base URL for this user's toolbar. + +=cut + +sub _getBaseURL { + my $url = $session{config}{extrasURL}.'/toolbar/'; + if ($session{user}{toolbar} ne "useLanguageDefault") { + $url .= $session{user}{toolbar}; + } else { + $url .= $session{language}{toolbar}; + } + $url .= '/'; + return $url; +} + + #------------------------------------------------------------------- =head2 copyIcon ( urlParameters [, pageURL ] ) @@ -83,7 +107,7 @@ sub copyIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Copy'; + $output .= 'Copy'; return $output; } @@ -111,7 +135,7 @@ sub cutIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Cut'; + $output .= 'Cut'; return $output; } @@ -139,7 +163,7 @@ sub deleteIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Delete'; + $output .= 'Delete'; return $output; } @@ -152,7 +176,7 @@ Generates an icon that can be used to drag content. =cut sub dragIcon { - return 'Drag'; + return 'Drag'; } #------------------------------------------------------------------- @@ -179,12 +203,36 @@ sub editIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Edit'; + $output .= 'Edit'; return $output; } #------------------------------------------------------------------- +=head2 getToolbarOptions ( ) + +Returns a hash reference containing the list of toolbar icon sets to be selected in user profile. + +=cut + +sub getToolbarOptions { + my %options; + tie %options, 'Tie::IxHash'; + $options{useLanguageDefault} = WebGUI::International::get(1084); + my $dir = $session{config}{extrasPath}.$session{os}{slash}."toolbar"; + opendir (DIR,$dir) or WebGUI::ErrorHandler::warn("Can't open toolbar directory!"); + my @files = readdir(DIR); + foreach my $file (@files) { + if ($file ne ".." && $file ne ".") { + $options{$file} = $file; + } + } + closedir(DIR); + return \%options; +} + +#------------------------------------------------------------------- + =head2 helpIcon ( helpId [, namespace ] ) Generates a button with the word "Help" printed on it. @@ -207,12 +255,40 @@ sub helpIcon { my ($output, $namespace); $namespace = $_[1] || "WebGUI"; $output = ''; + '" target="_blank">Help'; return $output; } #------------------------------------------------------------------- +=head2 manageIcon ( urlParameters [, pageURL ] ) + +Generates a button that represents a management function. + +=over + +=item urlParameters + +Any URL parameters that need to be tacked on to the current URL to accomplish whatever function this button represents. + +=item pageURL + +The URL to any page. Defaults to the current page. + +=back + +=cut + +sub manageIcon { + my ($output, $pageURL); + $pageURL = $_[1] || $session{page}{urlizedTitle}; + $output = ''; + $output .= 'Manage'; + return $output; +} + +#------------------------------------------------------------------- + =head2 moveBottomIcon ( urlParameters [, pageURL ] ) Generates a button with a double down arrow printed on it. @@ -235,7 +311,7 @@ sub moveBottomIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Move To Bottom'; + $output .= 'Move To Bottom'; return $output; } @@ -263,7 +339,7 @@ sub moveDownIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Move Down'; + $output .= 'Move Down'; return $output; } @@ -291,7 +367,7 @@ sub moveLeftIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Move Left'; + $output .= 'Move Left'; return $output; } @@ -319,7 +395,7 @@ sub moveRightIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Move Right'; + $output .= 'Move Right'; return $output; } @@ -347,7 +423,7 @@ sub moveTopIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Move To Top'; + $output .= 'Move To Top'; return $output; } @@ -375,7 +451,7 @@ sub moveUpIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Move Up'; + $output .= 'Move Up'; return $output; } @@ -388,7 +464,7 @@ Generates an icon that looks like a page. It's purpose is to represent whether y =cut sub pageIcon { - return 'Page Settings'; + return 'Page Settings'; } #------------------------------------------------------------------- @@ -415,7 +491,7 @@ sub pasteIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Paste'; + $output .= 'Paste'; return $output; } @@ -443,7 +519,7 @@ sub shortcutIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Shortcut'; + $output .= 'Shortcut'; return $output; } @@ -471,7 +547,7 @@ sub viewIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'View'; + $output .= 'View'; return $output; } @@ -484,7 +560,7 @@ Generates an icon that looks like a wobject. It's purpose is to represent whethe =cut sub wobjectIcon { - return 'Wobject Settings'; + return 'Wobject Settings'; } diff --git a/lib/WebGUI/Navigation.pm b/lib/WebGUI/Navigation.pm index 61f917f75..2609359d3 100644 --- a/lib/WebGUI/Navigation.pm +++ b/lib/WebGUI/Navigation.pm @@ -70,7 +70,8 @@ These methods are available from this package: #------------------------------------------------------------------- sub _getEditButton { my $self = shift; - return editIcon("op=editNavigation&navigationId=".$self->{_navigationId}."&identifier=".$self->{_identifier}); + return editIcon("op=editNavigation&navigationId=".$self->{_navigationId}."&identifier=".$self->{_identifier}) + .manageIcon("op=listNavigation"); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Operation/Page.pm b/lib/WebGUI/Operation/Page.pm index 0335b1326..c220c8d82 100644 --- a/lib/WebGUI/Operation/Page.pm +++ b/lib/WebGUI/Operation/Page.pm @@ -100,12 +100,11 @@ sub _selectPositions { my ($templates, $output, $f, $key); $f = WebGUI::HTMLForm->new(1); $templates = WebGUI::Page::getTemplateList(); - $f->selectList( - -name=>"templateId", - -options=>$templates, - -value=>[$_[0]], - -extras=>'onChange="changeTemplatePreview(this.form.templateId.value)"', - -subtext=>'   '.WebGUI::International::get(742).'' + $f->template( + -value=>$_[0], + -namespace=>"page", + -afterEdit=>'op=editPage&npp='.$session{form}{npp}, + -extras=>'onChange="changeTemplatePreview(this.form.templateId.value)"' ); $output = '