Skip to content

Commit

Permalink
Item13147:Item13125: add "Default" column in forms
Browse files Browse the repository at this point in the history
also:
- fixed call to CGI::param
- add foswikiCurrentTopicLink to category breadcrumbs
  • Loading branch information
MichaelDaum committed Dec 16, 2014
1 parent 0c1ab65 commit 39877fb
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 48 deletions.
10 changes: 5 additions & 5 deletions data/Applications/ClassificationApp/CategorizedTopic.txt
Expand Up @@ -23,11 +23,11 @@ See also: ClassifiedTopic, TaggedTopic
%STOPINCLUDE%

---++ <nop>%TOPIC% form
| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* |
| TopicType | label | 1 | CategorizedTopic | Document type | |
| <nop>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 | | |
| <nop>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"}%
Expand Down
18 changes: 9 additions & 9 deletions data/Applications/ClassificationApp/Category.txt
Expand Up @@ -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 | |
| <nop>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 | |
| <nop>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 | | |
| <nop>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 | | |
| <nop>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%"}%"}%

Expand Down
12 changes: 6 additions & 6 deletions data/Applications/ClassificationApp/ClassifiedTopic.txt
Expand Up @@ -24,12 +24,12 @@ See also: ClassifiedTopicViewTemplate
<!-- -->%STOPINCLUDE%

---++ <nop>%TOPIC% form
| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* |
| TopicType | label | 1 |ClassifiedTopic, CategorizedTopic, TaggedTopic| Document type | |
| <nop>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 | | |
| <nop>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"}%
Expand Down
@@ -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="<nop>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="<nop>ImportedCategory" value=""}%
%META:FIELD{name="Order" attributes="" title="Order" value=""}%
9 changes: 5 additions & 4 deletions 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="<nop>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="<nop>ImportedCategory" value=""}%
%META:FIELD{name="Order" attributes="" title="Order" value=""}%
18 changes: 9 additions & 9 deletions data/Applications/ClassificationApp/SeoTopic.txt
Expand Up @@ -17,15 +17,15 @@
%STOPINCLUDE%

---++ <nop>%TOPIC% form
| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* |
| TopicType | label | 1 | SeoTopic, ClassifiedTopic, CategorizedTopic, TaggedTopic, WikiTopic | Document type | |
| <nop>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 <nop>TopicTitle if. <a href='#' id='clsGenerateTitle'>%MAKETEXT{"Generate title"}%</a> | |
| Meta Description | textarea | 80x2 | | SEO description. Use a maximum of 160 chars for the description. <a href='#' id='clsGenerateDescription'>%MAKETEXT{"Generate description"}%</a> | |
| Meta Keywords | text | 75 | | SEO keywords. Specify a comma separate list of keywords. <a href='#' id='clsGenerateKeywords'>%MAKETEXT{"Generate keywords"}%</a> | |
| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* | *Default:* |
| TopicType | label | 1 | SeoTopic, ClassifiedTopic, CategorizedTopic, TaggedTopic, WikiTopic | Document type | | |
| <nop>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 <nop>TopicTitle if. <a href='#' id='clsGenerateTitle'>%MAKETEXT{"Generate title"}%</a> | | |
| Meta Description | textarea | 80x2 | | SEO description. Use a maximum of 160 chars for the description. <a href='#' id='clsGenerateDescription'>%MAKETEXT{"Generate description"}%</a> | | |
| Meta Keywords | text | 75 | | SEO keywords. Specify a comma separate list of keywords. <a href='#' id='clsGenerateKeywords'>%MAKETEXT{"Generate keywords"}%</a> | | |

%META:FORM{name="Applications.TopicType"}%
%META:FIELD{name="TopicType" title="TopicType" value="TopicType, DataForm, DocuTopic, ApplicationTopic"}%
Expand Down
4 changes: 2 additions & 2 deletions 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"}%
%{<verbatim class="tml">}%
%TMPL:INCLUDE{"Applications.ClassificationApp.ClassifiedTopicView"}%
Expand Down Expand Up @@ -27,7 +27,7 @@
%{</verbatim>}%

%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="<nop>TopicTitle" value=""}%
%META:FIELD{name="Summary" attributes="c" title="Summary" value="View for SeoTopics"}%
%META:FIELD{name="WikiApplication" attributes="" title="WikiApplication" value="ClassificationApp"}%
10 changes: 5 additions & 5 deletions data/Applications/ClassificationApp/TaggedTopic.txt
Expand Up @@ -23,11 +23,11 @@ See also: ClassifiedTopic, CategorizedTopic, TaggedTopicViewTemplate
<!-- -->%STOPINCLUDE%

---++ <nop>%TOPIC% form
| *Name:*| *Type:* | *Size:* | *Values:* | *Description:* | *Attributes:* |
| TopicType | label | 1 | TaggedTopic | Document type | |
| <nop>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 | | |
| <nop>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"}%
Expand Down
16 changes: 14 additions & 2 deletions lib/Foswiki/Form/Cat.pm
Expand Up @@ -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( @_ );
Expand All @@ -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)) {
Expand Down
11 changes: 11 additions & 0 deletions lib/Foswiki/Plugins/ClassificationPlugin.pm
Expand Up @@ -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;
Expand Down
11 changes: 10 additions & 1 deletion lib/Foswiki/Plugins/ClassificationPlugin/Category.pm
Expand Up @@ -785,7 +785,16 @@ sub getAllBreadCrumbs {
sub getLink {
my ($this, $doRedirect) = @_;

return "<a href='".$this->getUrl($doRedirect)."' rel='tag' class='$this->{name}'><noautolink>$this->{title}</noautolink></a>";
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 "<a href='".$this->getUrl($doRedirect)."' rel='tag' class='$this->{name}$currentTopic'><noautolink>$this->{title}</noautolink></a>";
}

###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm
Expand Up @@ -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)$/;
Expand Down

0 comments on commit 39877fb

Please sign in to comment.