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
This commit is contained in:
JT Smith 2004-02-23 00:13:59 +00:00
parent 5502b42ac3
commit 4c95269bba
16 changed files with 126 additions and 49 deletions

View file

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

View file

@ -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);

File diff suppressed because one or more lines are too long

View file

@ -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 = '<a href="'.WebGUI::URL::page("op=editTemplate&tid=".$value."&namespace=".$namespace
# ."&afterEdit="
# .WebGUI::URL::escape($afterEdit)).'">'.WebGUI::International::get(741).'</a> / ';
#}
$subtext .= '<a href="'.WebGUI::URL::page("op=listTemplates&namespace=$namespace").'">'
.WebGUI::International::get(742).'</a>';
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,

View file

@ -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 &copyIcon &deleteIcon &editIcon
our @EXPORT = qw(&helpIcon &becomeIcon &cutIcon &copyIcon &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 = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/copy.gif" align="middle" border="0" alt="Copy" title="Copy" /></a>';
$output .= '<img src="'._getBaseURL().'copy.gif" align="middle" border="0" alt="Copy" title="Copy" /></a>';
return $output;
}
@ -111,7 +135,7 @@ sub cutIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/cut.gif" align="middle" border="0" alt="Cut" title="Cut" /></a>';
$output .= '<img src="'._getBaseURL().'cut.gif" align="middle" border="0" alt="Cut" title="Cut" /></a>';
return $output;
}
@ -139,7 +163,7 @@ sub deleteIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/delete.gif" align="middle" border="0" alt="Delete" title="Delete" /></a>';
$output .= '<img src="'._getBaseURL().'delete.gif" align="middle" border="0" alt="Delete" title="Delete" /></a>';
return $output;
}
@ -152,7 +176,7 @@ Generates an icon that can be used to drag content.
=cut
sub dragIcon {
return '<img id="dragTrigger" class="dragTrigger" src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/drag.gif" align="middle" border="0" alt="Drag" title="Drag" />';
return '<img id="dragTrigger" class="dragTrigger" src="'._getBaseURL().'drag.gif" align="middle" border="0" alt="Drag" title="Drag" />';
}
#-------------------------------------------------------------------
@ -179,12 +203,36 @@ sub editIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/edit.gif" align="middle" border="0" alt="Edit" title="Edit" /></a>';
$output .= '<img src="'._getBaseURL().'edit.gif" align="middle" border="0" alt="Edit" title="Edit" /></a>';
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 = '<a href="'.WebGUI::URL::page('op=viewHelp&hid='.$_[0].'&namespace='.$namespace).
'" target="_blank"><img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/help.gif" border="0" align="right"></a>';
'" target="_blank"><img src="'._getBaseURL().'help.gif" border="0" align="right" title="Help" Alt="Help"></a>';
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 = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'manage.gif" align="middle" border="0" alt="Manage" title="Manage" /></a>';
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 = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/moveBottom.gif" align="middle" border="0" alt="Move To Bottom" title="Move To Bottom" /></a>';
$output .= '<img src="'._getBaseURL().'moveBottom.gif" align="middle" border="0" alt="Move To Bottom" title="Move To Bottom" /></a>';
return $output;
}
@ -263,7 +339,7 @@ sub moveDownIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/moveDown.gif" align="middle" border="0" alt="Move Down" title="Move Down" /></a>';
$output .= '<img src="'._getBaseURL().'moveDown.gif" align="middle" border="0" alt="Move Down" title="Move Down" /></a>';
return $output;
}
@ -291,7 +367,7 @@ sub moveLeftIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/moveLeft.gif" align="middle" border="0" alt="Move Left" title="Move Left" /></a>';
$output .= '<img src="'._getBaseURL().'moveLeft.gif" align="middle" border="0" alt="Move Left" title="Move Left" /></a>';
return $output;
}
@ -319,7 +395,7 @@ sub moveRightIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/moveRight.gif" align="middle" border="0" alt="Move Right" title="Move Right" /></a>';
$output .= '<img src="'._getBaseURL().'moveRight.gif" align="middle" border="0" alt="Move Right" title="Move Right" /></a>';
return $output;
}
@ -347,7 +423,7 @@ sub moveTopIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/moveTop.gif" align="middle" border="0" alt="Move To Top" title="Move To Top" /></a>';
$output .= '<img src="'._getBaseURL().'moveTop.gif" align="middle" border="0" alt="Move To Top" title="Move To Top" /></a>';
return $output;
}
@ -375,7 +451,7 @@ sub moveUpIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/moveUp.gif" align="middle" border="0" alt="Move Up" title="Move Up" /></a>';
$output .= '<img src="'._getBaseURL().'moveUp.gif" align="middle" border="0" alt="Move Up" title="Move Up" /></a>';
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 '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/page.gif" align="middle" border="0" alt="Page Settings" title="Page Settings" />';
return '<img src="'._getBaseURL().'page.gif" align="middle" border="0" alt="Page Settings" title="Page Settings" />';
}
#-------------------------------------------------------------------
@ -415,7 +491,7 @@ sub pasteIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/paste.gif" align="middle" border="0" alt="Paste" title="Paste" /></a>';
$output .= '<img src="'._getBaseURL().'paste.gif" align="middle" border="0" alt="Paste" title="Paste" /></a>';
return $output;
}
@ -443,7 +519,7 @@ sub shortcutIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/shortcut.gif" align="middle" border="0" alt="Shortcut" title="Create Shortcut" /></a>';
$output .= '<img src="'._getBaseURL().'shortcut.gif" align="middle" border="0" alt="Shortcut" title="Create Shortcut" /></a>';
return $output;
}
@ -471,7 +547,7 @@ sub viewIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/view.gif" align="middle" border="0" alt="View" title="View" /></a>';
$output .= '<img src="'._getBaseURL().'view.gif" align="middle" border="0" alt="View" title="View" /></a>';
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 '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/wobject.gif" align="middle" border="0" alt="Wobject Settings" title="Wobject Settings" />';
return '<img src="'._getBaseURL().'wobject.gif" align="middle" border="0" alt="Wobject Settings" title="Wobject Settings" />';
}

View file

@ -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");
}
#-------------------------------------------------------------------

View file

@ -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=>' &nbsp; <a href="'.WebGUI::URL::page("op=listTemplates&namespace=Page").'">'.WebGUI::International::get(742).'</a>'
$f->template(
-value=>$_[0],
-namespace=>"page",
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp},
-extras=>'onChange="changeTemplatePreview(this.form.templateId.value)"'
);
$output = '
<script language="JavaScript">
@ -428,6 +427,7 @@ sub www_editPage {
-label=>WebGUI::International::get(912),
-value=>($page{styleId} || 2),
-namespace=>'style',
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp},
-uiLevel=>5
);
$f->getTab("layout")->template(
@ -435,6 +435,7 @@ sub www_editPage {
-label=>WebGUI::International::get(1079),
-value=>($page{printableStyleId} || 3),
-namespace=>'style',
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp},
-uiLevel=>5
);
if ($childCount) {
@ -462,8 +463,7 @@ sub www_editPage {
-uiLevel=>6
);
if (WebGUI::Privilege::isInGroup(3)) {
$subtext = ' &nbsp; <a href="'.WebGUI::URL::page('op=listUsers').'">'
.WebGUI::International::get(7).'</a>';
$subtext = manageIcon('op=listUsers');
} else {
$subtext = "";
}
@ -484,24 +484,16 @@ sub www_editPage {
-subtext=>$subtext,
-uiLevel=>6
);
if (WebGUI::Privilege::isInGroup(3)) {
$subtext = ' &nbsp; <a href="'.WebGUI::URL::page('op=listGroups').'">'
.WebGUI::International::get(5).'</a>';
} else {
$subtext = "";
}
$f->getTab("privileges")->group(
-name=>"groupIdView",
-label=>WebGUI::International::get(872),
-value=>[$page{groupIdView}],
-subtext=>$subtext,
-uiLevel=>6
);
$f->getTab("privileges")->group(
-name=>"groupIdEdit",
-label=>WebGUI::International::get(871),
-value=>[$page{groupIdEdit}],
-subtext=>$subtext,
-excludeGroups=>[1,7],
-uiLevel=>6
);

View file

@ -1223,7 +1223,7 @@ sub www_edit {
$f->getTab("layout")->template(
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
-afterEdit=>'func=edit&amp;wid='.$_[0]->get("wobjectId")."&amp;namespace=".$_[0]->get("namespace")
);
}
$f->getTab("layout")->selectList(

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB