Finish rework of hierarchial keywords/categories.
This commit is contained in:
parent
ac7ce44180
commit
491c302309
6 changed files with 100 additions and 32 deletions
Binary file not shown.
BIN
docs/upgrades/packages-7.9.4/root_import_wiki.wgpkg
Normal file
BIN
docs/upgrades/packages-7.9.4/root_import_wiki.wgpkg
Normal file
Binary file not shown.
Binary file not shown.
|
|
@ -53,7 +53,6 @@ Append the template variables to C<var> for keyword (category) pages.
|
||||||
|
|
||||||
sub appendKeywordPageVars {
|
sub appendKeywordPageVars {
|
||||||
my ( $self, $var ) = @_;
|
my ( $self, $var ) = @_;
|
||||||
my $session = $self->session;
|
|
||||||
my $topKeywords = $self->getTopLevelKeywordsList;
|
my $topKeywords = $self->getTopLevelKeywordsList;
|
||||||
my $keywordHierarchy = $self->getKeywordHierarchy( $topKeywords, );
|
my $keywordHierarchy = $self->getKeywordHierarchy( $topKeywords, );
|
||||||
$var->{keywords_loop} = $self->getKeywordVariables( $keywordHierarchy );
|
$var->{keywords_loop} = $self->getKeywordVariables( $keywordHierarchy );
|
||||||
|
|
@ -612,6 +611,7 @@ sub getKeywordVariables {
|
||||||
KEYWORD: foreach my $member (@{ $hierarchy }) {
|
KEYWORD: foreach my $member (@{ $hierarchy }) {
|
||||||
my $varBlock = clone $member;
|
my $varBlock = clone $member;
|
||||||
$varBlock->{level} = $level;
|
$varBlock->{level} = $level;
|
||||||
|
$varBlock->{isTopLevel} = $level == 0;
|
||||||
$varBlock->{indent_loop} = [ map { { indent => $_ } } 1..$level ];
|
$varBlock->{indent_loop} = [ map { { indent => $_ } } 1..$level ];
|
||||||
delete $varBlock->{children};
|
delete $varBlock->{children};
|
||||||
push @{$variables}, $varBlock;
|
push @{$variables}, $varBlock;
|
||||||
|
|
@ -865,20 +865,30 @@ sub www_byKeyword {
|
||||||
}
|
}
|
||||||
@pages = sort { lc($a->{title}) cmp lc($b->{title}) } @pages;
|
@pages = sort { lc($a->{title}) cmp lc($b->{title}) } @pages;
|
||||||
my $var = {
|
my $var = {
|
||||||
keyword => $keyword,
|
keyword => $keyword,
|
||||||
pagesLoop => \@pages,
|
pagesLoop => \@pages,
|
||||||
};
|
canAdminister => $self->canAdminister,
|
||||||
|
recentChangesUrl => $self->getUrl("func=recentChanges"),
|
||||||
|
mostPopularUrl => $self->getUrl("func=mostPopular"),
|
||||||
|
wikiHomeUrl => $self->getUrl,
|
||||||
|
};
|
||||||
$p->appendTemplateVars($var);
|
$p->appendTemplateVars($var);
|
||||||
if ($self->canAdminister) {
|
|
||||||
$var->{formHeader} = WebGUI::Form::formHeader($session, {action => $self->getUrl, method => 'GET'})
|
my $subKeywords = $self->getSubKeywords($keyword);
|
||||||
. WebGUI::Form::hidden($session, { name => 'func', value => 'subKeywordSave',})
|
my $keywordHierarchy = $self->getKeywordHierarchy($subKeywords);
|
||||||
. WebGUI::Form::hidden($session, { name => 'thisKeyword', value => $keyword,});
|
$var->{keywords_loop} = $self->getKeywordVariables($keywordHierarchy);
|
||||||
|
|
||||||
|
if ($var->{canAdminister}) {
|
||||||
|
$var->{formHeader} = WebGUI::Form::formHeader($session, {action => $self->getUrl})
|
||||||
|
. WebGUI::Form::hidden($session, { name => 'func', value => 'subKeywordSave',})
|
||||||
|
. WebGUI::Form::hidden($session, { name => 'keyword', value => $keyword,});
|
||||||
my $subKeywords = join ', ', @{ $self->getSubKeywords($keyword) };
|
my $subKeywords = join ', ', @{ $self->getSubKeywords($keyword) };
|
||||||
$var->{keywordForm} = WebGUI::Form::keyword($session, {
|
$var->{keywordForm} = WebGUI::Form::keywords($session, {
|
||||||
name => 'subKeywords',
|
name => 'subKeywords',
|
||||||
value => $session->form->get('subKeywords') || $subKeywords,
|
value => $session->form->get('subKeywords') || $subKeywords,
|
||||||
});
|
});
|
||||||
$var->{formFooter} = WebGU::Form::formHeader($session);
|
$var->{submitForm} = WebGUI::Form::submit($session, {});
|
||||||
|
$var->{formFooter} = WebGUI::Form::formFooter($session);
|
||||||
}
|
}
|
||||||
return $self->processStyle($self->processTemplate($var, $self->get('byKeywordTemplateId')));
|
return $self->processStyle($self->processTemplate($var, $self->get('byKeywordTemplateId')));
|
||||||
}
|
}
|
||||||
|
|
@ -998,7 +1008,7 @@ sub www_subKeywordSave {
|
||||||
my $form = $self->session->form;
|
my $form = $self->session->form;
|
||||||
|
|
||||||
my $subKeywords = $form->process('subKeywords', 'keywords');
|
my $subKeywords = $form->process('subKeywords', 'keywords');
|
||||||
my $keyword = $form->process('thisKeyword');
|
my $keyword = $form->process('keyword');
|
||||||
my @subKeywords = @{ WebGUI::Keyword::string2list($subKeywords) };
|
my @subKeywords = @{ WebGUI::Keyword::string2list($subKeywords) };
|
||||||
$self->setSubKeywords($keyword, @subKeywords);
|
$self->setSubKeywords($keyword, @subKeywords);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,9 @@ our $HELP = {
|
||||||
{ namespace => "Asset_WikiMaster",
|
{ namespace => "Asset_WikiMaster",
|
||||||
tag => "wiki master asset variables"
|
tag => "wiki master asset variables"
|
||||||
},
|
},
|
||||||
|
{ namespace => "Asset_WikiMaster",
|
||||||
|
tag => "keyword page variables"
|
||||||
|
},
|
||||||
],
|
],
|
||||||
variables => [
|
variables => [
|
||||||
{ 'name' => 'searchLabel',
|
{ 'name' => 'searchLabel',
|
||||||
|
|
@ -102,26 +105,6 @@ our $HELP = {
|
||||||
{ 'name' => 'recentChangesLabel variable', },
|
{ 'name' => 'recentChangesLabel variable', },
|
||||||
{ 'name' => 'addPageUrl', },
|
{ 'name' => 'addPageUrl', },
|
||||||
{ 'name' => 'addPageLabel', },
|
{ 'name' => 'addPageLabel', },
|
||||||
{ 'name' => 'keywords_loop',
|
|
||||||
'variables' => [
|
|
||||||
{ 'name' => 'title',
|
|
||||||
'description' => 'keyword title',
|
|
||||||
},
|
|
||||||
{ 'name' => 'url',
|
|
||||||
'description' => 'keyword url',
|
|
||||||
},
|
|
||||||
{ 'name' => 'level',
|
|
||||||
'description' => 'keyword level',
|
|
||||||
},
|
|
||||||
{ 'name' => 'indent_loop',
|
|
||||||
'variables' => [
|
|
||||||
{ 'name' => 'indent',
|
|
||||||
'description' => 'keyword indent',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
fields => [],
|
fields => [],
|
||||||
related => [],
|
related => [],
|
||||||
|
|
@ -282,11 +265,16 @@ our $HELP = {
|
||||||
title => 'by keyword template title',
|
title => 'by keyword template title',
|
||||||
body => '',
|
body => '',
|
||||||
isa => [
|
isa => [
|
||||||
|
{ namespace => "Asset_WikiMaster",
|
||||||
|
tag => "keyword page variables"
|
||||||
|
},
|
||||||
{ namespace => "WebGUI",
|
{ namespace => "WebGUI",
|
||||||
tag => "pagination template variables"
|
tag => "pagination template variables"
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
variables => [
|
variables => [
|
||||||
|
{ 'name' => 'mostPopularUrl', },
|
||||||
|
{ 'name' => 'recentChangesUrl', },
|
||||||
{ name => 'keyword',
|
{ name => 'keyword',
|
||||||
description => 'by keyword keyword',
|
description => 'by keyword keyword',
|
||||||
},
|
},
|
||||||
|
|
@ -310,6 +298,9 @@ our $HELP = {
|
||||||
{ name => 'keywordForm',
|
{ name => 'keywordForm',
|
||||||
description => 'by keyword keywordForm',
|
description => 'by keyword keywordForm',
|
||||||
},
|
},
|
||||||
|
{ name => 'submitForm',
|
||||||
|
description => 'by keyword submitForm',
|
||||||
|
},
|
||||||
{ name => 'formFooter',
|
{ name => 'formFooter',
|
||||||
description => 'by keyword formFooter',
|
description => 'by keyword formFooter',
|
||||||
},
|
},
|
||||||
|
|
@ -318,6 +309,43 @@ our $HELP = {
|
||||||
related => [],
|
related => [],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'keyword page variables' => {
|
||||||
|
title => 'keyword page variables',
|
||||||
|
body => '',
|
||||||
|
isa => [ ],
|
||||||
|
private => 1,
|
||||||
|
variables => [
|
||||||
|
{ 'name' => 'keywords_loop',
|
||||||
|
'variables' => [
|
||||||
|
{ 'name' => 'title',
|
||||||
|
'description' => 'keyword title',
|
||||||
|
},
|
||||||
|
{ 'name' => 'url',
|
||||||
|
'description' => 'keyword url',
|
||||||
|
},
|
||||||
|
{ 'name' => 'level',
|
||||||
|
'description' => 'keyword level',
|
||||||
|
},
|
||||||
|
{ 'name' => 'descendants',
|
||||||
|
'description' => 'keyword descendants',
|
||||||
|
},
|
||||||
|
{ 'name' => 'isTopLevel',
|
||||||
|
'description' => 'keyword isTopLevel',
|
||||||
|
},
|
||||||
|
{ 'name' => 'indent_loop',
|
||||||
|
'variables' => [
|
||||||
|
{ 'name' => 'indent',
|
||||||
|
'description' => 'keyword indent',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
fields => [],
|
||||||
|
related => [],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -537,7 +537,7 @@ listing of pages that are related to a specific keyword?| },
|
||||||
},
|
},
|
||||||
|
|
||||||
'keywords_loop' => {
|
'keywords_loop' => {
|
||||||
message => q{A loop containing all the top level keywords, links to their keyword pages, and all sub pages below them.},
|
message => q{A loop containing all the top level keywords for this page, links to their keyword pages, and all sub pages below them.},
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
context => q{Help for template variable},
|
context => q{Help for template variable},
|
||||||
},
|
},
|
||||||
|
|
@ -560,6 +560,12 @@ listing of pages that are related to a specific keyword?| },
|
||||||
context => q{Help for template variable},
|
context => q{Help for template variable},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'keyword descendants' => {
|
||||||
|
message => q{The number of wiki pages that are tagged with this keyword, and all sub-keywords of this keyword.},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{Help for template variable},
|
||||||
|
},
|
||||||
|
|
||||||
'indent_loop' => {
|
'indent_loop' => {
|
||||||
message => q{A loop that runs 1 time for each level.},
|
message => q{A loop that runs 1 time for each level.},
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
|
|
@ -626,6 +632,30 @@ listing of pages that are related to a specific keyword?| },
|
||||||
context => q{Help for template variable},
|
context => q{Help for template variable},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'by keyword submitForm' => {
|
||||||
|
message => q{A button to submit the sub-keywords form.},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{Help for template variable},
|
||||||
|
},
|
||||||
|
|
||||||
|
'Related Pages' => {
|
||||||
|
message => q{Related Pages},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{template label},
|
||||||
|
},
|
||||||
|
|
||||||
|
'keyword page variables' => {
|
||||||
|
message => q{Keyword Page Variables},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{template variable help},
|
||||||
|
},
|
||||||
|
|
||||||
|
'keyword isTopLevel' => {
|
||||||
|
message => q{Whether or not the keyword is one of the keywords for the page that was called. For the Wiki Front Page, it will only include top level keywords. For a keyword page, it would be true for any sub-keywords of this page.},
|
||||||
|
lastUpdated => 0,
|
||||||
|
context => q{template variable help},
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue