diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 5ccc60e10..96e0f388c 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -31,6 +31,8 @@ - Added a config file option to specify where the file cache is persisted. - Added complete documentation of all WebGUI config file options to the default config file. + - Added an end point to limit ancestors in navigation. + - Added missing international entries for Navigation. - fix [1177858] lib/WebGUI/i18n/English/Macros.pm can not translated diff --git a/docs/upgrades/upgrade_6.5.6-6.6.0.sql b/docs/upgrades/upgrade_6.5.6-6.6.0.sql index fdde76d03..92b53240c 100644 --- a/docs/upgrades/upgrade_6.5.6-6.6.0.sql +++ b/docs/upgrades/upgrade_6.5.6-6.6.0.sql @@ -4,3 +4,6 @@ update template set template='^StyleSheet(^Extras;/slidePanel/slidePanel.css);\r alter table DataForm add column defaultView int(11) DEFAULT 0 NOT NULL; update template set template = '\">\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
Entry IDSubmission Date
\">
' where assetId='PBtmpl0000000000000021'; +alter table Navigation change endPoint descendantEndPoint int not null default 55; +alter table Navigation add column anscestorEndPoint int not null default 55; + diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 80f279e09..157bac9f4 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1233,6 +1233,10 @@ An integer limiting the length of the lineages of the assets to be returned. Thi An asset object reference to draw a pedigree from. A pedigree includes ancestors, siblings, descendants and other information. It's specifically used in flexing navigations. +=head4 ancestorLimit + +An integer describing how many levels of ancestry from the start point that should be retrieved. + =head4 excludeClasses An array reference containing a list of asset classes to remove from the result set. The opposite of the includOnlyClasses rule. @@ -1276,9 +1280,12 @@ sub getLineage { # ancestors too my @specificFamilyMembers = (); if (isIn("ancestors",@{$relatives})) { + my $i = 1; my @familyTree = ($lineage =~ /(.{6})/g); while (pop(@familyTree)) { push(@specificFamilyMembers,join("",@familyTree)) if (scalar(@familyTree)); + last if ($i >= $rules->{ancestorLimit}); + $i++; } } # let's add ourself to the list diff --git a/lib/WebGUI/Asset/Wobject/Navigation.pm b/lib/WebGUI/Asset/Wobject/Navigation.pm index a8ce07c53..fa7dc47a7 100644 --- a/lib/WebGUI/Asset/Wobject/Navigation.pm +++ b/lib/WebGUI/Asset/Wobject/Navigation.pm @@ -52,7 +52,11 @@ sub definition { fieldType=>'text', defaultValue=>0 }, - endPoint=>{ + ancestorEndPoint=>{ + fieldType=>'selectList', + defaultValue=>55 + }, + descendantEndPoint=>{ fieldType=>'selectList', defaultValue=>55 }, @@ -102,65 +106,86 @@ sub getEditForm { $pedigreeChecked = 1; } } + my $i18n = WebGUI::International->new("Asset_Navigation"); $tabform->getTab("properties")->selectList( -name=>"startType", -options=>{ - specificUrl=>'Specific URL', - relativeToCurrentUrl=>'Relative To Current URL', - relativeToRoot=>'Relative To Root' + specificUrl=>$i18n->get('Specific URL'), + relativeToCurrentUrl=>$i18n->get('Relative To Current URL'), + relativeToRoot=>$i18n->get('Relative To Root') }, -value=>[$self->getValue("startType")], - -label=>"Start Point Type", + -label=>$i18n->get("Start Point Type"), -extras=>'id="navStartType" onChange="changeStartPoint()"' ); $tabform->getTab("properties")->readOnly( - -label=>"Start Point", + -label=>$i18n->get("Start Point"), -value=>'

' ); + my %options = (); + tie %options, 'Tie::IxHash'; + %options = ( + '1'=>'../ (-1)', + '2'=>'../../ (-2)', + '3'=>'../../../ (-3)', + '4'=>'../../../../ (-4)', + '5'=>'../../../../../ (-5)', + '55'=>$i18n->get('Infinity') + ); + $tabform->getTab("properties")->raw( + ''.$i18n->get("Ancestor End Point").'' + .WebGUI::Form::selectList({ + name=>"ancestorEndPoint", + value=>[$self->getValue("ancestorEndPoint")], + options=>\%options + }) + .'' + ); $tabform->getTab("properties")->readOnly( - -label=>"Relatives to Include", + -label=>$i18n->get("Relatives To Include"), -value=>WebGUI::Form::checkbox({ checked=>$ancestorsChecked, name=>"assetsToInclude", + extras=>'onChange="toggleAncestorEndPoint()"', value=>"ancestors" - }).'Ancestors
' + }).$i18n->get('Ancestors').'
' .WebGUI::Form::checkbox({ checked=>$selfChecked, name=>"assetsToInclude", value=>"self" - }).'Self
' + }).$i18n->get('Self').'
' .WebGUI::Form::checkbox({ checked=>$siblingsChecked, name=>"assetsToInclude", value=>"siblings" - }).'Siblings
' + }).$i18n->get('Siblings').'
' .WebGUI::Form::checkbox({ checked=>$descendantsChecked, name=>"assetsToInclude", value=>"descendants", - extras=>'onChange="toggleEndPoint()"' - }).'Descendants
' + extras=>'onChange="toggleDescendantEndPoint()"' + }).$i18n->get('Descendants').'
' .WebGUI::Form::checkbox({ checked=>$pedigreeChecked, name=>"assetsToInclude", value=>"pedigree" - }).'Pedigree
' + }).$i18n->get('Pedigree').'
' ); my %options; tie %options, 'Tie::IxHash'; %options = ( - '55'=>'Infinity', '1'=>'./a/ (+1)', '2'=>'./a/b/ (+2)', '3'=>'./a/b/c/ (+3)', '4'=>'./a/b/c/d/ (+4)', - '5'=>'./a/b/c/d/e/ (+5)' + '5'=>'./a/b/c/d/e/ (+5)', + '55'=>$i18n->get('Infinity') ); $tabform->getTab("properties")->raw( - 'End Point' + ''.$i18n->get('Descendant End Point').'' .WebGUI::Form::selectList({ - name=>"endPoint", - value=>[$self->getValue("endPoint")], + name=>"descendantEndPoint", + value=>[$self->getValue("descendantEndPoint")], options=>\%options }) .'' @@ -182,26 +207,37 @@ sub getEditForm { ); my $start = $self->getValue("startPoint"); $tabform->getTab("properties")->raw(""); my $previewButton;# = qq{ # getLineageLength - $self->get("startPoint") + 1) * 6 )); } elsif ($self->get("startPoint") > 0) { - my $lineage = $current->getLineage; + my $lineage = $current->get("lineage"); for (1..$self->get("startPoint")) { $lineage .= $self->formatRank(1); } @@ -287,8 +323,9 @@ sub view { my @includedRelationships = split("\n",$self->get("assetsToInclude")); my %rules; $rules{returnQuickReadObjects} = 1; - $rules{endingLineageLength} = $start->getLineageLength+$self->get("endPoint"); + $rules{endingLineageLength} = $start->getLineageLength+$self->get("descendantEndPoint"); $rules{assetToPedigree} = $current if (isIn("pedigree",@includedRelationships)); + $rules{ancestorLimit} = $self->get("ancestorEndPoint"); my $assets = $start->getLineage(\@includedRelationships,\%rules); my $var = {'page_loop' => []}; my @interestingProperties = ('assetId', 'parentId', 'title', 'ownerUserId', 'synopsis', 'newWindow', 'menuTitle'); diff --git a/lib/WebGUI/i18n/English/Asset_Navigation.pm b/lib/WebGUI/i18n/English/Asset_Navigation.pm index f764a045c..e6ece0303 100644 --- a/lib/WebGUI/i18n/English/Asset_Navigation.pm +++ b/lib/WebGUI/i18n/English/Asset_Navigation.pm @@ -1,6 +1,102 @@ package WebGUI::i18n::English::Asset_Navigation; our $I18N = { + + 'Specific URL' => { + message => 'Specific URL', + lastUpdated => 0 + }, + + 'Relative To Current URL' => { + message => 'Relative To Current URL', + lastUpdated => 0 + }, + + 'Relative To Root' => { + message => 'Relative To Root', + lastUpdated => 0 + }, + + 'Start Point Type' => { + message => 'Start Point Type', + lastUpdated => 0 + }, + + 'Start Point' => { + message => 'Start Point', + lastUpdated => 0 + }, + + 'Infinity' => { + message => 'Infinity', + lastUpdated => 0 + }, + + 'Ancestor End Point' => { + message => 'Ancestor End Point', + lastUpdated => 0 + }, + + 'Relatives To Include' => { + message => 'Relatives To Include', + lastUpdated => 0 + }, + + 'Ancestors' => { + message => 'Ancestors', + lastUpdated => 0 + }, + + 'Siblings' => { + message => 'Siblings', + lastUpdated => 0 + }, + + 'Self' => { + message => 'Self', + lastUpdated => 0 + }, + + 'Descendants' => { + message => 'Descendants', + lastUpdated => 0 + }, + + 'Pedigree' => { + message => 'Pedigree', + lastUpdated => 0 + }, + + 'Descendant End Point' => { + message => 'Descendant End Point', + lastUpdated => 0 + }, + + '' => { + message => '', + lastUpdated => 0 + }, + + '' => { + message => '', + lastUpdated => 0 + }, + + '' => { + message => '', + lastUpdated => 0 + }, + + '' => { + message => '', + lastUpdated => 0 + }, + + '' => { + message => '', + lastUpdated => 0 + }, + '32' => { message => q|Show unprivileged pages|, lastUpdated => 1077080845 diff --git a/www/extras/adminConsole/richEdit.gif b/www/extras/adminConsole/richEdit.gif new file mode 100644 index 000000000..fe2e947d4 Binary files /dev/null and b/www/extras/adminConsole/richEdit.gif differ diff --git a/www/extras/adminConsole/small/richEdit.gif b/www/extras/adminConsole/small/richEdit.gif new file mode 100644 index 000000000..884b84e23 Binary files /dev/null and b/www/extras/adminConsole/small/richEdit.gif differ