From 39877fbe11232594c9cc9310ff4f764471933cc7 Mon Sep 17 00:00:00 2001 From: MichaelDaum Date: Tue, 16 Dec 2014 12:59:36 +0100 Subject: [PATCH] Item13147:Item13125: add "Default" column in forms also: - fixed call to CGI::param - add foswikiCurrentTopicLink to category breadcrumbs --- .../ClassificationApp/CategorizedTopic.txt | 10 +++++----- .../ClassificationApp/Category.txt | 18 +++++++++--------- .../ClassificationApp/ClassifiedTopic.txt | 12 ++++++------ .../PipelineManagementCategory.txt | 7 ++++--- .../ClassificationApp/ProductsCategory.txt | 9 +++++---- .../ClassificationApp/SeoTopic.txt | 18 +++++++++--------- .../ClassificationApp/SeoTopicViewTemplate.txt | 4 ++-- .../ClassificationApp/TaggedTopic.txt | 10 +++++----- lib/Foswiki/Form/Cat.pm | 16 ++++++++++++++-- lib/Foswiki/Plugins/ClassificationPlugin.pm | 11 +++++++++++ .../Plugins/ClassificationPlugin/Category.pm | 11 ++++++++++- .../ClassificationPlugin/JSTreeConnector.pm | 4 ++-- 12 files changed, 82 insertions(+), 48 deletions(-) diff --git a/data/Applications/ClassificationApp/CategorizedTopic.txt b/data/Applications/ClassificationApp/CategorizedTopic.txt index c0a7937..6cc857d 100644 --- a/data/Applications/ClassificationApp/CategorizedTopic.txt +++ b/data/Applications/ClassificationApp/CategorizedTopic.txt @@ -23,11 +23,11 @@ See also: ClassifiedTopic, TaggedTopic %STOPINCLUDE% ---++ %TOPIC% form -| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | -| TopicType | label | 1 | CategorizedTopic | Document type | | -| TopicTitle | text | 75 | | Title of this topic | | -| Summary | text | 75 | | Short description of the role of this topic | | -| Category | cat | 1 | | categories | | +| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | *Default:* | +| TopicType | label | 1 | CategorizedTopic | Document type | | | +| TopicTitle | text | 75 | | Title of this topic | | | +| Summary | text | 75 | | Short description of the role of this topic | | | +| Category | cat | 1 | | categories | | | %META:FORM{name="Applications.TopicType"}% diff --git a/data/Applications/ClassificationApp/Category.txt b/data/Applications/ClassificationApp/Category.txt index e285734..fb94214 100644 --- a/data/Applications/ClassificationApp/Category.txt +++ b/data/Applications/ClassificationApp/Category.txt @@ -42,15 +42,15 @@ See also: See [[CategorizedTopic]], [[ClassifiedTopic]], [[TaggedTopic]], [[Cate }%%STOPINCLUDE% ---++ %TOPIC% form -| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | -| TopicType | label | 3 |Category,CategorizedTopic| Document type | | -| TopicTitle | text | 75 | | title | | -| Summary | text | 75 | | short description of this category | | -| Redirect | text | 75 | | topic where to redirect to when visiting this category, e.g. a portal page representing this category | | -| Category | cat | 1 | | one or more parent categories that this category is filed to | | -| Icon | icon | 30 | cat="Silk" exclude="_add,_delete,arrow_,osx,border_,_start,_stop,_go,_edit,_play,_record,control_,_decrease,_increase,_next,_prev,_error,_eject,_pause,_toggle,_link,_magnify,shapes?_,sort_,text_" | icon to be displayed listing this category | | -| ImportedCategory | text | 75 | | import a root category from another web; all categories below it will be imported to this web in a virtual way | | -| Order | text | 5 | | number used in sorting categories | | +| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | *Default:* | +| TopicType | label | 3 |Category,CategorizedTopic| Document type | | | +| TopicTitle | text | 75 | | title | | | +| Summary | text | 75 | | short description of this category | | | +| Redirect | text | 75 | | topic where to redirect to when visiting this category, e.g. a portal page representing this category | | | +| Category | cat | 1 | | one or more parent categories that this category is filed to | | | +| Icon | icon | 30 | cat="Silk" exclude="_add,_delete,arrow_,osx,border_,_start,_stop,_go,_edit,_play,_record,control_,_decrease,_increase,_next,_prev,_error,_eject,_pause,_toggle,_link,_magnify,shapes?_,sort_,text_" | icon to be displayed listing this category | | | +| ImportedCategory | text | 75 | | import a root category from another web; all categories below it will be imported to this web in a virtual way | | | +| Order | text | 5 | | number used in sorting categories | | | %DBCALL{"Applications.RenderDataFormList" THEWEB="%URLPARAM{"web" default="%BASEWEB%"}%"}% diff --git a/data/Applications/ClassificationApp/ClassifiedTopic.txt b/data/Applications/ClassificationApp/ClassifiedTopic.txt index c7982b8..5f9c124 100644 --- a/data/Applications/ClassificationApp/ClassifiedTopic.txt +++ b/data/Applications/ClassificationApp/ClassifiedTopic.txt @@ -24,12 +24,12 @@ See also: ClassifiedTopicViewTemplate %STOPINCLUDE% ---++ %TOPIC% form -| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | -| TopicType | label | 1 |ClassifiedTopic, CategorizedTopic, TaggedTopic| Document type | | -| TopicTitle | text | 75 | | title of this topic | | -| Summary | text | 75 | | short description of the role of this topic | | -| Tag | tag | 30 | | keywords for this topic | | -| Category | cat | 1 | | categories this topic is field to | | +| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | *Default:* | +| TopicType | label | 1 |ClassifiedTopic, CategorizedTopic, TaggedTopic| Document type | | | +| TopicTitle | text | 75 | | title of this topic | | | +| Summary | text | 75 | | short description of the role of this topic | | | +| Tag | tag | 30 | | keywords for this topic | | | +| Category | cat | 1 | | categories this topic is field to | | | %META:FORM{name="Applications.TopicType"}% diff --git a/data/Applications/ClassificationApp/PipelineManagementCategory.txt b/data/Applications/ClassificationApp/PipelineManagementCategory.txt index 74e168a..48d1497 100644 --- a/data/Applications/ClassificationApp/PipelineManagementCategory.txt +++ b/data/Applications/ClassificationApp/PipelineManagementCategory.txt @@ -1,13 +1,14 @@ -%META:TOPICINFO{author="ProjectContributor" comment="autosave" date="1393260232" format="1.1" version="3"}% +%META:TOPICINFO{author="micha" comment="autosave" date="1415288834" format="1.1" version="4"}% %META:TOPICPARENT{name="SalesCategory"}% %DBCALL{"Applications.ClassificationApp.RenderCategory"}% - %META:FORM{name="Applications.ClassificationApp.Category"}% %META:FIELD{name="TopicType" title="TopicType" value="Category, CategorizedTopic, WikiTopic"}% %META:FIELD{name="TopicTitle" attributes="" title="TopicTitle" value="Pipeline Management"}% %META:FIELD{name="Summary" attributes="" title="Summary" value=""}% +%META:FIELD{name="Redirect" attributes="" title="Redirect" value=""}% %META:FIELD{name="Category" attributes="" title="Category" value="SalesCategory"}% -%META:FIELD{name="Icon" attributes="" title="Icon" value="pipe"}% +%META:FIELD{name="Icon" attributes="" title="Icon" value="connect"}% +%META:FIELD{name="ImportedCategory" attributes="" title="ImportedCategory" value=""}% %META:FIELD{name="Order" attributes="" title="Order" value=""}% diff --git a/data/Applications/ClassificationApp/ProductsCategory.txt b/data/Applications/ClassificationApp/ProductsCategory.txt index 356d64a..4a744ea 100644 --- a/data/Applications/ClassificationApp/ProductsCategory.txt +++ b/data/Applications/ClassificationApp/ProductsCategory.txt @@ -1,13 +1,14 @@ -%META:TOPICINFO{author="ProjectContributor" comment="autosave" date="1357565280" format="1.1" version="2"}% +%META:TOPICINFO{author="micha" comment="autosave" date="1415288567" format="1.1" version="3"}% %META:TOPICPARENT{name="CorporateCategory"}% %DBCALL{"Applications.ClassificationApp.RenderCategory"}% - %META:FORM{name="Applications.ClassificationApp.Category"}% -%META:FIELD{name="TopicType" attributes="" title="TopicType" value="Category, CategorizedTopic"}% +%META:FIELD{name="TopicType" title="TopicType" value="Category, CategorizedTopic, WikiTopic"}% %META:FIELD{name="TopicTitle" attributes="" title="TopicTitle" value="Products"}% %META:FIELD{name="Summary" attributes="" title="Summary" value=""}% +%META:FIELD{name="Redirect" attributes="" title="Redirect" value=""}% %META:FIELD{name="Category" attributes="" title="Category" value="CorporateCategory"}% -%META:FIELD{name="Icon" attributes="" title="Icon" value="cube_molecule"}% +%META:FIELD{name="Icon" attributes="" title="Icon" value="cake"}% %META:FIELD{name="ImportedCategory" attributes="" title="ImportedCategory" value=""}% +%META:FIELD{name="Order" attributes="" title="Order" value=""}% diff --git a/data/Applications/ClassificationApp/SeoTopic.txt b/data/Applications/ClassificationApp/SeoTopic.txt index da18b42..5835d47 100644 --- a/data/Applications/ClassificationApp/SeoTopic.txt +++ b/data/Applications/ClassificationApp/SeoTopic.txt @@ -17,15 +17,15 @@ %STOPINCLUDE% ---++ %TOPIC% form -| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | -| TopicType | label | 1 | SeoTopic, ClassifiedTopic, CategorizedTopic, TaggedTopic, WikiTopic | Document type | | -| TopicTitle | text | 75 | | title of this topic | | -| Summary | text | 75 | | Short description of the role of this topic | | -| Tag | tag | 30 | | keywords | | -| Category | cat | 1 | | categories this blog entry is field to |  | -| HTML Title | text | 75 | | controls the title being added to the html page, defaults to TopicTitle if. %MAKETEXT{"Generate title"}% | | -| Meta Description | textarea | 80x2 | | SEO description. Use a maximum of 160 chars for the description. %MAKETEXT{"Generate description"}% | | -| Meta Keywords | text | 75 | | SEO keywords. Specify a comma separate list of keywords. %MAKETEXT{"Generate keywords"}% | | +| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | *Default:* | +| TopicType | label | 1 | SeoTopic, ClassifiedTopic, CategorizedTopic, TaggedTopic, WikiTopic | Document type | | | +| TopicTitle | text | 75 | | title of this topic | | | +| Summary | text | 75 | | Short description of the role of this topic | | | +| Tag | tag | 30 | | keywords | | | +| Category | cat | 1 | | categories this blog entry is field to |  | | +| HTML Title | text | 75 | | controls the title being added to the html page, defaults to TopicTitle if. %MAKETEXT{"Generate title"}% | | | +| Meta Description | textarea | 80x2 | | SEO description. Use a maximum of 160 chars for the description. %MAKETEXT{"Generate description"}% | | | +| Meta Keywords | text | 75 | | SEO keywords. Specify a comma separate list of keywords. %MAKETEXT{"Generate keywords"}% | | | %META:FORM{name="Applications.TopicType"}% %META:FIELD{name="TopicType" title="TopicType" value="TopicType, DataForm, DocuTopic, ApplicationTopic"}% diff --git a/data/Applications/ClassificationApp/SeoTopicViewTemplate.txt b/data/Applications/ClassificationApp/SeoTopicViewTemplate.txt index 533f37b..cc216dd 100644 --- a/data/Applications/ClassificationApp/SeoTopicViewTemplate.txt +++ b/data/Applications/ClassificationApp/SeoTopicViewTemplate.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1367671100" format="1.1" reprev="3" version="3"}% +%META:TOPICINFO{author="micha" comment="reprev" date="1416294627" format="1.1" reprev="4" version="4"}% %META:TOPICPARENT{name="TopicView"}% %{}% %TMPL:INCLUDE{"Applications.ClassificationApp.ClassifiedTopicView"}% @@ -27,7 +27,7 @@ %{}% %META:FORM{name="Applications.ApplicationTopic"}% -%META:FIELD{name="TopicType" title="TopicType" value="TopicView"}% +%META:FIELD{name="TopicType" title="TopicType" value="TopicView, WikiTopic"}% %META:FIELD{name="TopicTitle" attributes="" title="TopicTitle" value=""}% %META:FIELD{name="Summary" attributes="c" title="Summary" value="View for SeoTopics"}% %META:FIELD{name="WikiApplication" attributes="" title="WikiApplication" value="ClassificationApp"}% diff --git a/data/Applications/ClassificationApp/TaggedTopic.txt b/data/Applications/ClassificationApp/TaggedTopic.txt index 35f310b..4875ffd 100644 --- a/data/Applications/ClassificationApp/TaggedTopic.txt +++ b/data/Applications/ClassificationApp/TaggedTopic.txt @@ -23,11 +23,11 @@ See also: ClassifiedTopic, CategorizedTopic, TaggedTopicViewTemplate %STOPINCLUDE% ---++ %TOPIC% form -| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | -| TopicType | label | 1 | TaggedTopic | Document type | | -| TopicTitle | text | 75 | | title of this topic | | -| Summary | text | 75 | | short description of the role of this topic | | -| Tag | tag | 30 | | keywords for this topic | | +| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | *Default:* | +| TopicType | label | 1 | TaggedTopic | Document type | | | +| TopicTitle | text | 75 | | title of this topic | | | +| Summary | text | 75 | | short description of the role of this topic | | | +| Tag | tag | 30 | | keywords for this topic | | | %META:FORM{name="Applications.TopicType"}% diff --git a/lib/Foswiki/Form/Cat.pm b/lib/Foswiki/Form/Cat.pm index 6ba698d..770c2a8 100644 --- a/lib/Foswiki/Form/Cat.pm +++ b/lib/Foswiki/Form/Cat.pm @@ -25,6 +25,18 @@ our @ISA = ('Foswiki::Form::FieldDefinition'); use Foswiki::Plugins::ClassificationPlugin (); use Foswiki::Func (); +use Foswiki::Request(); + +BEGIN { + + # Backwards compatibility for Foswiki 1.1.x + unless (defined *Foswiki::Request::multi_param) { + no warnings 'redefine'; + *Foswiki::Request::multi_param = \&Foswiki::Request::param; + use warnings 'redefine'; + } +} + sub new { my $class = shift; my $this = $class->SUPER::new( @_ ); @@ -45,12 +57,12 @@ sub isMultiValued { sub getOptions { # needed by FieldDefinition my $this = shift; - my $query = Foswiki::Func::getCgiQuery(); + my $request = Foswiki::Func::getCgiQuery(); # trick this in by getting all values from the query # and allow them to be asserted my @values = (); - my @valuesFromQuery = $query->param($this->{name}); + my @valuesFromQuery = $request->multi_param($this->{name}); foreach my $item (@valuesFromQuery) { next unless defined $item; foreach my $value (split(/\s*,\s*/, $item)) { diff --git a/lib/Foswiki/Plugins/ClassificationPlugin.pm b/lib/Foswiki/Plugins/ClassificationPlugin.pm index 9cb000b..7cdc1ee 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin.pm @@ -20,6 +20,17 @@ use warnings; use Foswiki::Func (); use Foswiki::Contrib::DBCacheContrib::Search (); +use Foswiki::Request(); + +BEGIN { + # Backwards compatibility for Foswiki 1.1.x + unless ( Foswiki::Request->can('multi_param') ) { + no warnings 'redefine'; + *Foswiki::Request::multi_param = \&Foswiki::Request::param; + use warnings 'redefine'; + } +} + our $VERSION = '3.99_002'; our $RELEASE = '3.99_002'; our $NO_PREFS_IN_TOPIC = 1; diff --git a/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm b/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm index fe09337..eccf70b 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm @@ -785,7 +785,16 @@ sub getAllBreadCrumbs { sub getLink { my ($this, $doRedirect) = @_; - return ""; + my $session = $Foswiki::Plugins::SESSION; + my $request = Foswiki::Func::getRequestObject(); + + my $baseWeb = $session->{webName}; + my $baseTopic = $request->param("catname") || $session->{topicName}; + + my $currentTopic = ''; + $currentTopic = ' foswikiCurrentTopicLink' if $baseWeb eq $this->{hierarchy}->{web} && $baseTopic eq $this->{name}; + + return ""; } ############################################################################### diff --git a/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm b/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm index 4c2216d..09a607b 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm @@ -186,11 +186,11 @@ sub handle_get_children { my $request = Foswiki::Func::getRequestObject(); my $catName = $request->param('cat') || "TopCategory"; - my @select = $request->param('select'); + my @select = $request->multi_param('select'); my $maxDepth = $request->param('maxDepth'); $maxDepth = -1 unless defined $maxDepth; - my $displayCounts = Foswiki::Func::isTrue($request->param('counts'), 0); + my $displayCounts = Foswiki::Func::isTrue(scalar $request->param('counts'), 0); my $sort = $request->param('sort'); $sort = 'on' if !defined($sort) || $sort !~ /^(on|title|order|name)$/;