diff --git a/docs/upgrades/upgrade_4.2.0-4.3.0.sql b/docs/upgrades/upgrade_4.2.0-4.3.0.sql index 8ff86c812..571bfcdab 100644 --- a/docs/upgrades/upgrade_4.2.0-4.3.0.sql +++ b/docs/upgrades/upgrade_4.2.0-4.3.0.sql @@ -660,6 +660,32 @@ update international set message='Attachment' where internationalId=33 and langu alter table page add column startDate int not null default 946710000; alter table page add column endDate int not null default 2082783600; update page set styleId=-6 where styleId=-3; +update international set message='Edit Image Group' where internationalId=545 and languageId=1; +alter table help change seeAlso seeAlso text; +alter table international change message message mediumtext; +drop table helpSeeAlso; +insert into international select (60+helpId),namespace,1,concat(object,", ",action) from help where languageId=1 and namespace<>'WebGUI'; +insert into international select (70+helpId),namespace,1,body from help where languageId=1 and namespace<>'WebGUI'; +insert into international select (605+helpId),namespace,1,body from help where languageId=1 and namespace='WebGUI'; +insert into international select (650+helpId),namespace,1,concat(object,", ",action) from help where languageId=1 and namespace='WebGUI'; +alter table help add column titleId int after languageId; +alter table help add column bodyId int after titleId; +update help set titleId=60+helpId, bodyId=70+helpId where namespace<>'WebGUI'; +update help set titleId=650+helpId, bodyId=605+helpId where namespace='WebGUI'; +alter table help drop column languageId; +alter table help drop column action; +alter table help drop column object; +alter table help drop column body; +delete from international where internationalId=96; +delete from international where internationalId=97; +insert into international values (642,'WebGUI',1,'Page, Add/Edit'); +update help set titleId=642 where helpId=1 and namespace='WebGUI'; + + + + + + diff --git a/lib/WebGUI/Operation/Help.pm b/lib/WebGUI/Operation/Help.pm index 9157d0d91..947e18daa 100644 --- a/lib/WebGUI/Operation/Help.pm +++ b/lib/WebGUI/Operation/Help.pm @@ -12,92 +12,85 @@ package WebGUI::Operation::Help; use Exporter; use strict; +use Tie::IxHash; use Tie::CPHash; use WebGUI::International; use WebGUI::Session; use WebGUI::SQL; use WebGUI::URL; +use WebGUI::Utility; our @ISA = qw(Exporter); our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex); +#------------------------------------------------------------------- +sub _helpLink { + return ''.$_[2].''; +} + +#------------------------------------------------------------------- +sub _seeAlso { + my ($item, $seeAlso, @items, $namespace, $helpId, $titleId, $output); + $seeAlso = $_[0]; + $seeAlso =~ s/\n//g; #removes line feeds + $seeAlso =~ s/\r//g; #removes carriage returns + $seeAlso =~ s/ //g; #removes spaces + @items = split(/;/,$seeAlso); + foreach $item (@items) { + ($helpId,$namespace) = split(/,/,$item); + ($titleId) = WebGUI::SQL->quickArray("select titleId from help where helpId=$helpId + and namespace='$namespace'"); + $output .= '
'.WebGUI::International::get(94).':';
- $sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}'
- and action<>'$help{action}' and languageId='$session{user}{language}' order by action");
- unless ($sth->rows) {
- $sth->finish;
- $sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}'
- and action<>'$help{action}' and languageId=1 order by action");
- }
- while (@data = $sth->array) {
- $output .= ' '.$data[1].' '.$data[2].',';
- }
- $sth->finish;
- $sth = WebGUI::SQL->read("select helpId, namespace from helpSeeAlso where seeAlsoId in ($help{seeAlso})");
- while (@data = $sth->array) {
- %seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]'
- and namespace='$data[1]' and languageId='$session{user}{language}'");
- if ($seeAlso{helpId} eq "") {
- %seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]'
- and namespace='$data[1]' and languageId=1");
- }
- $output .= ' '.$seeAlso{action}.' '.$seeAlso{object}.',';
- }
- $sth->finish;
- $output .= ' '.WebGUI::International::get(95).'';
+ %help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid} and namespace='$namespace'");
+ $output = ''.WebGUI::International::get(93).': '.
+ WebGUI::International::get($help{titleId},$help{namespace}).'
';
+ $output .= WebGUI::International::get($help{bodyId},$help{namespace});
+ $output .= '
'.WebGUI::International::get(94).': ';
- $sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where languageId='$session{user}{language}' order by action,object");
- unless ($sth->rows) {
- $sth->finish;
- $sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where languageId=1 order by action,object");
- }
- while (@data = $sth->array) {
- if ($data[1] ne $previous) {
- $output .= ' '.$data[1].' ';
- $sth = WebGUI::SQL->read("select helpId, object, action, namespace from help where languageId='$session{user}{language}' order by object,action");
- unless ($sth->rows) {
- $sth->finish;
- $sth = WebGUI::SQL->read("select helpId, object, action, namespace from help where languageId=1 order by object,action");
+ foreach $key (sort {$a cmp $b} keys %index) {
+ $sortedIndex{$key}=$index{$key};
}
- while (@data = $sth->array) {
- if ($data[1] ne $previous) {
- $output .= ' '.$data[1].' ';
+ $i++;
+ }
+ $output .= '';
+ $output .= _seeAlso($help{seeAlso});
+ $output .= '
';
return $output;
}
#-------------------------------------------------------------------
sub www_viewHelpIndex {
- my ($sth, @data, $output, $previous);
+ my ($sth, %help, $output, $key, %index, $title, $seeAlso, %sortedIndex, $i, $midpoint);
+ tie %help, 'Tie::CPHash';
+ tie %sortedIndex, 'Tie::IxHash';
$output = ''.WebGUI::International::get(95).'
';
- $output .= '
';
+ $i = 0;
+ $output .= ''.WebGUI::International::get(96).'
';
- $previous = $data[1];
- }
- $output .= '
';
+ $sth = WebGUI::SQL->read("select helpId,namespace,titleId,seeAlso from help");
+ while (%help = $sth->hash) {
+ $title = WebGUI::International::get($help{titleId},$help{namespace});
+ $index{$title} = _helpLink($help{helpId},$help{namespace},$title);
+ $seeAlso = _seeAlso($help{seeAlso});
+ if ($seeAlso ne "") {
+ $index{$title} .= ''.$seeAlso.'
';
+ }
+ $i++;
}
+ $midpoint = round($i/2);
$sth->finish;
- $output .= ''.WebGUI::International::get(97).'
';
- $previous = $data[1];
- }
- $output .= '
';
- }
- $sth->finish;
- $output .= '
';
return $output;
}
diff --git a/lib/WebGUI/Operation/Image.pm b/lib/WebGUI/Operation/Image.pm
index c33d90b43..1ff814040 100644
--- a/lib/WebGUI/Operation/Image.pm
+++ b/lib/WebGUI/Operation/Image.pm
@@ -314,7 +314,7 @@ sub www_editImageGroup {
%data = WebGUI::SQL->quickHash("select * from imageGroup where imageGroupId=$session{form}{gid}");
}
%parent_data = WebGUI::SQL->quickHash("select name from imageGroup where imageGroupId=$session{form}{pid}");
- $output = helpIcon(20);
+ $output = helpIcon(36);
$output .= '';
+ foreach $key (keys %sortedIndex) {
+ if ($i == $midpoint) {
+ $output .= ' ';
+ }
+ $output .= $sortedIndex{$key}.' '.WebGUI::International::get(545).'
';
$f = WebGUI::HTMLForm->new;
$f->hidden("op","editImageGroupSave");
diff --git a/lib/WebGUI/Operation/International.pm b/lib/WebGUI/Operation/International.pm
index b616b020f..4eb60fb6c 100644
--- a/lib/WebGUI/Operation/International.pm
+++ b/lib/WebGUI/Operation/International.pm
@@ -36,7 +36,6 @@ sub _submenu {
$output .= '