From c0a568726c6fce038ae0dcc34866afe9b1d21a1f Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 22 Apr 2005 02:38:26 +0000 Subject: [PATCH] - Added an end point to limit ancestors in navigation. - Added missing international entries for Navigation. --- docs/changelog/6.x.x.txt | 2 + docs/upgrades/upgrade_6.5.6-6.6.0.sql | 3 + lib/WebGUI/Asset.pm | 7 ++ lib/WebGUI/Asset/Wobject/Navigation.pm | 95 +++++++++++++------ lib/WebGUI/i18n/English/Asset_Navigation.pm | 96 ++++++++++++++++++++ www/extras/adminConsole/richEdit.gif | Bin 0 -> 2244 bytes www/extras/adminConsole/small/richEdit.gif | Bin 0 -> 1022 bytes 7 files changed, 174 insertions(+), 29 deletions(-) create mode 100644 www/extras/adminConsole/richEdit.gif create mode 100644 www/extras/adminConsole/small/richEdit.gif 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 0000000000000000000000000000000000000000..fe2e947d459c8a006ba9de29575d5e913257f10a GIT binary patch literal 2244 zcmV;#2s`&jNk%w1VK4wN0QbKDsl>~x+2rq%Q=`h)+wJn6(cX%Rim0@>s?_1i=I-nE z`TWsQcZG?i(cbY6Zo1v)Rc?w^SXi{Qw8GrpZc|J4`uyn0u%y=DoYvy^{QXphxWdE3 zGEi>K%*^@u`TEs)@rgvs>+}5l{POhib*9bsHHvAR%AA{<ePmZ^D>_|}Np z+uO*fO_a;o-Sqj9k&wyA$*;)H`279-)oOKnef0oc|Kh3R^7fRx$L*YB(b3T+XRPu0 z`tXiRs;jEa=F=`N>Dh}_uhHLMl*XpH!D4od#q0A+hQHwU`p^bhRgA&q@AOz@a`=9|v#70zm7eB* zxABI*S4u#OuDa{$>f*?-<@o+#U|zxD>DR`wvbeaHnw#}vst8e_rr+#~#n(G$kpM}c z)baV5&f2!%>7Sa3z1ZdW{r-Dra=G8HGZry5Q)r-R6O> z(!S;GuiEAJ|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MM|3 zP=y-Qp&Iq5My-VnVqlGkh+qUL;6VqbI@MfI^{QCSDi2gKf{BP=6dnkxSjS4%vWis% SBJjsd*2>nlx|OW~0RTJJif#D- literal 0 HcmV?d00001 diff --git a/www/extras/adminConsole/small/richEdit.gif b/www/extras/adminConsole/small/richEdit.gif new file mode 100644 index 0000000000000000000000000000000000000000..884b84e231331556b98dd693b0efd96ca7303a9e GIT binary patch literal 1022 zcmeH`+fPyf0EZ7CrEV#eZMF3f)`M-D1ZTmi#@K)`OdZ({z{)m4pF>-BG2EEdmgF0&nWWB%sBZ!XNgr1*egK70pD zg;;N&c5L#+P)?nMjs759c;{GKbGcocOkvUs5n9UeRK|mOZ?ji}U=} z_|mW5Wjm)TYt8Abm(SgNP}(IL>lIJ1hD0o6A+Y0Q4xLme8mnt;R-4so)f^bj3Y