diff --git a/data/Applications/ClassificationApp/CategoryRenderIndexItem.txt b/data/Applications/ClassificationApp/CategoryRenderIndexItem.txt index 228494c..2f145de 100644 --- a/data/Applications/ClassificationApp/CategoryRenderIndexItem.txt +++ b/data/Applications/ClassificationApp/CategoryRenderIndexItem.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1397121183" format="1.1" reprev="9" version="11"}% +%META:TOPICINFO{author="micha" comment="reprev" date="1402084278" format="1.1" reprev="13" version="13"}% %META:TOPICPARENT{name="TopicFunction"}% %TOC{depth="2"}% @@ -10,13 +10,16 @@ a summary for an object of type ClassifiedTopic. ---+++++ Parameters * OBJECT * TITLE + * THEWEB %ENDSECTION{name="documentation" type="section"}% ---++ Implementation %STARTINCLUDE% -%CATINFO{cat="%DBQUERY{topic="%OBJECT%" format="$topic"}%" +%CATINFO{ + cat="%DBQUERY{topic="%OBJECT%" format="$topic"}%" + web="%THEWEB{default="%DBQUERY{topic="%OBJECT%" format="$web"}%"}%" maxchildren="6" sortchildren="on" morechildren="..." diff --git a/data/Applications/ClassificationApp/CategoryViewTemplate.txt b/data/Applications/ClassificationApp/CategoryViewTemplate.txt index f8d5552..0dce5ae 100644 --- a/data/Applications/ClassificationApp/CategoryViewTemplate.txt +++ b/data/Applications/ClassificationApp/CategoryViewTemplate.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1380204072" format="1.1" reprev="15" version="15"}% +%META:TOPICINFO{author="micha" comment="reprev" date="1402086950" format="1.1" reprev="16" version="16"}% %META:TOPICPARENT{name="TopicView"}% %{}% %TMPL:INCLUDE{"Applications.WikiTopicView"}% @@ -14,36 +14,29 @@ %{}% %TMPL:DEF{"beforetext"}% -%IF{"defined catname" - then="$percntTMPL:P{\"virtualcategory\"}$percnt" - else="$percntTMPL:P{\"normalcategory\"}$percnt" -}% -%TMPL:END% -%{}% - -%{}% -%TMPL:DEF{"normalcategory"}% -
-%DBCALL{"Applications.ClassificationApp.RenderClassifiedTopicView" TITLE_EXTRA="%TMPL:P{"titleextra"}%" }% -
-%TMPL:END% -%{
}% - -%{}% -%TMPL:DEF{"virtualcategory"}% -
%CATINFO{ - cat="%URLPARAM{"catname"}%" + cat="%URLPARAM{"catname" default="%BASETOPIC%"}%" format="

$link $percntIF{\"'$percntENCODE{\"$summary\" type=\"entity\"}$percnt'!=''\" then=\"
$summary\" - }$percnt

- $percntMAKETEXT{\"Filed in [_1]\" - args=\"$percntFORMATLIST{\"$parentlinks\" split=\"\s*,\s*\" separator=\", \"}$percnt\" - }$percnt" + }$percnt" }% -
-%TMPL:END% +%IF{"'%DISPLAYREVISIONINFO{default="on"}%'='on'" + then="$percntTMPL:P{\"catrevinfo\"}$percnt" +}%%TMPL:END% +%{
}% + +%{}% +%TMPL:DEF{"catrevinfo"}% +%CATINFO{ + cat="%URLPARAM{"catname" default="%BASETOPIC%"}%" + format="$percntFORMATLIST{\"$parentlinks\" + split=\"\s*,\s*\" + separator=\", \" + header=\"
%JQICON{"fa-folder"}% \" + footer=\"
\" + }$percnt" +}%%TMPL:END% %{
}% %{}% diff --git a/data/Applications/ClassificationApp/IntranetDirectory.txt b/data/Applications/ClassificationApp/IntranetDirectory.txt index 0dcc034..b98dbca 100644 --- a/data/Applications/ClassificationApp/IntranetDirectory.txt +++ b/data/Applications/ClassificationApp/IntranetDirectory.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1400744215" format="1.1" reprev="9" version="10"}% +%META:TOPICINFO{author="micha" comment="reprev" date="1401705411" format="1.1" reprev="11" version="11"}% %META:TOPICPARENT{name="WebHome"}% %DBCALL{"Applications.ClassificationApp.RenderCategory"}% diff --git a/data/Applications/ClassificationApp/OrgChart.txt b/data/Applications/ClassificationApp/OrgChart.txt index 775a620..e105a95 100644 --- a/data/Applications/ClassificationApp/OrgChart.txt +++ b/data/Applications/ClassificationApp/OrgChart.txt @@ -1,27 +1,10 @@ -%META:TOPICINFO{author="ProjectContributor" comment="autosave" date="1357565280" format="1.1" version="7"}% -%META:TOPICPARENT{name="WebHome"}% -wwwxxx -yyy -zzz -111222 -111 -222 -333 -444 -555 -666 -777 -888 -999 -111 -222 -333 -444 -555 +%META:TOPICINFO{author="micha" comment="reprev" date="1401709243" format="1.1" reprev="8" version="8"}% +%META:TOPICPARENT{name="BusinessStructure"}% + %META:FORM{name="Applications.ClassificationApp.ClassifiedTopic"}% %META:FIELD{name="TopicType" title="TopicType" value="ClassifiedTopic, CategorizedTopic, TaggedTopic, WikiTopic"}% %META:FIELD{name="TopicTitle" attributes="" title="TopicTitle" value="Org.Chart"}% %META:FIELD{name="Summary" attributes="" title="Summary" value="This is a test topic with a nop in it"}% %META:FIELD{name="Tag" attributes="" title="Tag" value=""}% -%META:FIELD{name="Category" attributes="" title="Category" value=""}% +%META:FIELD{name="Category" attributes="" title="Category" value="BusinessStructure"}% diff --git a/data/Applications/ClassificationApp/RenderCategory.txt b/data/Applications/ClassificationApp/RenderCategory.txt index e396a36..12a26a2 100644 --- a/data/Applications/ClassificationApp/RenderCategory.txt +++ b/data/Applications/ClassificationApp/RenderCategory.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1392980602" format="1.1" reprev="17" version="17"}% +%META:TOPICINFO{author="micha" comment="reprev" date="1402086723" format="1.1" reprev="21" version="21"}% %META:TOPICPARENT{name="TopicFunction"}% %TOC{depth="2"}% @@ -11,8 +11,10 @@ See the CategoryTemplate. * CAT: category to be rendered, defaults to URLPARM{"catname" default="BASETOPIC"} * KEYWORDS: keywords to filter for * TAG: tags to be searching for in this category - * SHOWHEADER: display anchors, defaults to off * EXCLUDE: categories to be excluded from the list + * SHOWHEADER: switch on/off display anchors, defaults to off + * SHOWTOPICS: switch on/off display of topics in this category; defaults to on + * SHOWGROUPS: switch on/off alphabetic headers; defaults to off %ENDSECTION{name="documentation" type="section"}% @@ -22,8 +24,8 @@ See the CategoryTemplate. %MAKEINDEX{ "%HIERARCHY{ web="%BASEWEB%" - top="%IF{"defined CAT" then="%CAT%" else="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%" - exclude="%IF{"defined CAT" then="%CAT%" else="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%%IF{"defined EXCLUDE" then="|%EXCLUDE%"}%" + top="%CAT{default="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%" + exclude="%CAT{default="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%%IF{"defined EXCLUDE" then="|%EXCLUDE%"}%" depth="2" sort="title" format="($trunctitle);$topic;$origweb$n" @@ -32,8 +34,22 @@ See the CategoryTemplate. split="\n" pattern="\((.*)\);(.*);(.*)" sort="off" - format="$percntDBCALL{\"$3.$2->RenderIndexItem\" TITLE=\"$1\"}$percnt" -}% + %IF{"'%SHOWGROUPS{default="off"}%'!='on'" then="group=\"\""}% + format="$percntDBCALL{\"$3.$2->RenderIndexItem\" TITLE=\"$1\" THEWEB=\"%BASEWEB%\"}$percnt" +}% +%IF{"'%SHOWTOPICS{default="%IF{"'%CAT{default="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%'='TopCategory'" then="off" else="on"}%"}%'='on'" + then="$percntDBCALL{\"%WEB%.%TOPIC%\" + section=\"topicindex\" + TAG=\"%TAG%\" + KEYWORDS=\"%KEYWORDS%\" + }$percnt" +}% +
+%STOPINCLUDE% +
+ + +%STARTSECTION{"topicindex"}% %MAKEINDEX{ "%DBQUERY{ "!(TopicType=~'\bCategory\b') AND @@ -59,10 +75,9 @@ See the CategoryTemplate. pattern="(.*);(.*);(.*)" sort="nocase" %IF{"'%SHOWHEADER%'='on'" then="header=\"$anchors\""}% - format="$percntDBCALL{\"$3.$2->RenderIndexItem\"}$percnt" - }% - -%STOPINCLUDE% + format="$percntDBCALL{\"$3.$2->RenderIndexItem\"}$percnt" +}% +%ENDSECTION{"topicindex"}%% ---++ Toolbar diff --git a/data/Applications/ClassificationApp/RenderClassifiedTopicView.txt b/data/Applications/ClassificationApp/RenderClassifiedTopicView.txt index 481d347..d2a62cc 100644 --- a/data/Applications/ClassificationApp/RenderClassifiedTopicView.txt +++ b/data/Applications/ClassificationApp/RenderClassifiedTopicView.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1398678623" format="1.1" reprev="21" version="21"}% +%META:TOPICINFO{author="micha" comment="reprev" date="1402085106" format="1.1" reprev="22" version="22"}% %META:TOPICPARENT{name="TopicFunction"}% %TOC{depth="2"}% diff --git a/data/Applications/ClassificationApp/RenderUncategorizedTopics.txt b/data/Applications/ClassificationApp/RenderUncategorizedTopics.txt new file mode 100644 index 0000000..5306754 --- /dev/null +++ b/data/Applications/ClassificationApp/RenderUncategorizedTopics.txt @@ -0,0 +1,40 @@ +%META:TOPICINFO{author="micha" comment="reprev" date="1401709324" format="1.1" reprev="2" version="2"}% +%META:TOPICPARENT{name="TopicFunction"}% +%TOC{depth="2"}% + +---++ Documentation +%STARTSECTION{"documentation"}% +%RED%TODO%ENDCOLOR% + +---+++++ Parameters + * EXCLUDE: regular expression of topics to be excluded, defaults to =UncategorizedTopics|WebTopicEditTemplate= + +%ENDSECTION{"documentation"}% + +---++ Implementation + +%STARTINCLUDE%%DBQUERY{ + "TopicType=~'\b(Classified|Categorized)Topic\b' AND TopicType !~ '\bCategory\b' AND ('TopCategory' DISTANCE topic) = 1" + exclude="%EXCLUDE{default="UncategorizedTopics|WebTopicEditTemplat"}%" + web="%BASEWEB%" + format=" 1 [[$web.$topic]]" +}%%STOPINCLUDE% + + +---++ Test +%DBCALL{"%TOPIC%"}% + +%DBCALL{"Applications.RenderFunctionCallers"}% + +---++ Copyright +© 2014 Michael Daum http://michaeldaumconsulting.com + +%DBCALL{"Applications.GnuGeneralPublicLicense" section="notice"}% + +%META:FORM{name="Applications.ApplicationTopic"}% +%META:FIELD{name="TopicType" title="TopicType" value="DocuTopic, TopicFunction"}% +%META:FIELD{name="TopicTitle" attributes="" title="TopicTitle" value=""}% +%META:FIELD{name="Summary" attributes="c" title="Summary" value="list all topics not categorized yet"}% +%META:FIELD{name="WikiApplication" attributes="" title="WikiApplication" value="ClassificationApp"}% +%META:TOPICMOVED{by="micha" date="1401703596" from="Applications/ClassificationApp.RenderUncategorizedTopicsuncat" to="Applications/ClassificationApp.RenderUncategorizedTopics"}% +%META:PREFERENCE{name="EDIT_TEMPLATE" title="EDIT_TEMPLATE" type="Set" value="Applications.WikiTopicEdit"}% diff --git a/data/Applications/ClassificationApp/TestSeoTopic.txt b/data/Applications/ClassificationApp/TestSeoTopic.txt index 3146061..1abaf32 100644 --- a/data/Applications/ClassificationApp/TestSeoTopic.txt +++ b/data/Applications/ClassificationApp/TestSeoTopic.txt @@ -1,6 +1,6 @@ -%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1367829599" format="1.1" reprev="1" version="1"}% +%META:TOPICINFO{author="micha" comment="reprev" date="1401709261" format="1.1" reprev="2" version="2"}% %META:TOPICPARENT{name="WebHome"}% - * MetaDescription: %DBQUERY{topic="%TOPIC%" format="$formfield(MetaDescription)"}% + %META:FORM{name="Applications/ClassificationApp.SeoTopic"}% %META:FIELD{name="TopicType" title="TopicType" value="SeoTopic, ClassifiedTopic, CategorizedTopic, TaggedTopic, WikiTopic"}% diff --git a/data/System/ClassificationPlugin.txt b/data/System/ClassificationPlugin.txt index 5a721f1..576617b 100644 --- a/data/System/ClassificationPlugin.txt +++ b/data/System/ClassificationPlugin.txt @@ -353,6 +353,7 @@ Note however that for now only the =%DBQUERY= language is supported (see [[Foswi | Release: | %$RELEASE% | | Version: | %$VERSION% | | Change History: |   | +| 10 Jun 2014: | added options to disable some parts of a category view template; added tool to list uncategorized topics; fully specify all security switches for rest handlers | | 22 May 2014: | fixes to Category factory; initial work on a category-based virtual filesystem for webdav | | 23 Apr 2014: | improved topic info layout; added WebTagList; added back Clear button to category editor | | 04 Apr 2014: | fixed compatibility with foswiki >= 1.2.0; flag rest handlers that don't require authentication | diff --git a/data/_ClassificationTemplate/UncategorizedTopics.txt b/data/_ClassificationTemplate/UncategorizedTopics.txt new file mode 100644 index 0000000..4ffed30 --- /dev/null +++ b/data/_ClassificationTemplate/UncategorizedTopics.txt @@ -0,0 +1,13 @@ +%META:TOPICINFO{author="micha" comment="reprev" date="1401709430" format="1.1" reprev="1" version="1"}% +%META:TOPICPARENT{name="WebHome"}% +%DBCALL{ + "Applications.ClassificationApp.RenderUncategorizedTopics" + EXCLUDE="UncategorizedTopics|WebTopicEditTemplate" +}% + +%META:FORM{name="Applications.ClassificationApp.ClassifiedTopic"}% +%META:FIELD{name="TopicType" title="TopicType" value="ClassifiedTopic, CategorizedTopic, TaggedTopic, WikiTopic"}% +%META:FIELD{name="TopicTitle" attributes="" title="TopicTitle" value="Uncategorized Topics"}% +%META:FIELD{name="Summary" attributes="" title="Summary" value=""}% +%META:FIELD{name="Tag" attributes="" title="Tag" value=""}% +%META:FIELD{name="Category" attributes="" title="Category" value=""}% diff --git a/lib/Foswiki/Plugins/ClassificationPlugin.pm b/lib/Foswiki/Plugins/ClassificationPlugin.pm index 50db7cf..bc505fe 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin.pm @@ -17,8 +17,8 @@ use strict; use warnings; use Foswiki::Contrib::DBCacheContrib::Search (); -our $VERSION = '3.22'; -our $RELEASE = '3.22'; +our $VERSION = '3.30'; +our $RELEASE = '3.30'; our $NO_PREFS_IN_TOPIC = 1; our $SHORTDESCRIPTION = 'A topic classification plugin and application'; @@ -76,27 +76,47 @@ sub initPlugin { $jsTreeConnector = Foswiki::Plugins::ClassificationPlugin::JSTreeConnector->new(); } $jsTreeConnector->dispatchAction(@_); - }, authenticate => 0); + }, + authenticate => 0, + validate => 0, + http_allow => 'GET,POST', + ); Foswiki::Func::registerRESTHandler('splitfacet', sub { initServices(); return Foswiki::Plugins::ClassificationPlugin::Services::splitFacet(@_); - }, authenticate => 0); + }, + authenticate => 1, + validate => 0, + http_allow => 'GET,POST', + ); Foswiki::Func::registerRESTHandler('renametag', sub { - initServices(); - return Foswiki::Plugins::ClassificationPlugin::Services::renameTag(@_); - }, authenticate => 0); + initServices(); + return Foswiki::Plugins::ClassificationPlugin::Services::renameTag(@_); + }, + authenticate => 1, + validate => 0, + http_allow => 'POST', + ); Foswiki::Func::registerRESTHandler('normalizetags', sub { initServices(); return Foswiki::Plugins::ClassificationPlugin::Services::normalizeTags(@_); - }, authenticate => 0); + }, + authenticate => 1, + validate => 0, + http_allow => 'POST', + ); Foswiki::Func::registerRESTHandler('deployTopicType', sub { initServices(); return Foswiki::Plugins::ClassificationPlugin::Services::deployTopicType(@_); - }, authenticate => 0); + }, + authenticate => 1, + validate => 0, + http_allow => 'POST', + ); Foswiki::Contrib::DBCacheContrib::Search::addOperator( name=>'SUBSUMES', diff --git a/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm b/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm index d9bfdf4..f7ad6ce 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin/Category.pm @@ -100,7 +100,7 @@ sub init { if ($parent) { $this->{parents}{$name} = $parent; } else { - print STDERR "parent $name of $this->{name} NOT found in $this->{hierarchy}->{web}\n"; + writeDebug("parent $name of $this->{name} NOT found in $this->{hierarchy}->{web}"); delete $this->{parents}{$name}; } } @@ -183,7 +183,6 @@ sub computeDistance { my $thisId = $this->{id}; return if $ancestors->{$thisId}; - # become an ancestor $ancestors->{$thisId} = $this; $$distance[$thisId][$thisId] = 0; diff --git a/lib/Foswiki/Plugins/ClassificationPlugin/Core.pm b/lib/Foswiki/Plugins/ClassificationPlugin/Core.pm index 22ca1a0..e515075 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin/Core.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin/Core.pm @@ -112,6 +112,7 @@ sub OP_distance { my $web = $Foswiki::Plugins::DBCachePlugin::Core::dbQueryCurrentWeb || $baseWeb; my $hierarchy = getHierarchy($web); my $dist = $hierarchy->distance($lval, $rval); + return $dist || 0; } @@ -344,7 +345,7 @@ sub handleCATINFO { my $parentSubsumesCat = $hierarchy->getCategory($theParentSubsumes); foreach my $catName (sort @$categories) { - next if $catName =~ /BottomCategory|TopCategory/; + next if $theCat && $theCat ne 'TopCategory' && $catName =~ /BottomCategory|TopCategory/; my $category = $hierarchy->getCategory($catName); next unless $category; diff --git a/lib/Foswiki/Plugins/ClassificationPlugin/Hierarchy.pm b/lib/Foswiki/Plugins/ClassificationPlugin/Hierarchy.pm index 18f7520..8b6a12d 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin/Hierarchy.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin/Hierarchy.pm @@ -425,7 +425,7 @@ sub distance { return undef unless $cats; # no categories, no distance foreach my $name (@$cats) { $catObj = $this->getCategory($name); - $catSet2{$name} = $catObj->{id} if $catObj + $catSet2{$name} = $catObj->{id} if $catObj; } } return 0 if @@ -451,7 +451,7 @@ sub distance { } # both sets aren't connected - return undef unless defined($min); + return undef if !defined($min) && $topic1 ne 'TopCategory' && $topic2 ne 'TopCategory'; $min = abs($min) + 2 if $firstIsTopic && $secondIsTopic; $min-- if $firstIsTopic; diff --git a/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm b/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm index dc4072f..4c2216d 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm +++ b/lib/Foswiki/Plugins/ClassificationPlugin/JSTreeConnector.pm @@ -296,7 +296,7 @@ sub handle_move_node { $a->{order} <=> $b->{order} || $a->{title} cmp $b->{title}; } grep {$_->{name} !~ /^BottomCategory$/} values %{$newParent->{children}}; - print STDERR "sortedCats=".join(", ", map {$_->{name}} @sortedCats)."\n"; + #print STDERR "sortedCats=".join(", ", map {$_->{name}} @sortedCats)."\n"; my $index = 10; foreach my $item (@sortedCats) { diff --git a/lib/Foswiki/Plugins/ClassificationPlugin/MANIFEST b/lib/Foswiki/Plugins/ClassificationPlugin/MANIFEST index cec2be2..de0b4e1 100644 --- a/lib/Foswiki/Plugins/ClassificationPlugin/MANIFEST +++ b/lib/Foswiki/Plugins/ClassificationPlugin/MANIFEST @@ -93,6 +93,7 @@ data/Applications/ClassificationApp/RenderKnownTags.txt 0644 data/Applications/ClassificationApp/RenderSideBar.txt 0644 data/Applications/ClassificationApp/RenderSolrTagCloud.txt 0644 data/Applications/ClassificationApp/RenderTagEditor.txt 0644 +data/Applications/ClassificationApp/RenderUncategorizedTopics.txt 0644 data/Applications/ClassificationApp/RenderWebTagCloud.txt 0644 data/Applications/ClassificationApp/SalesCategory.txt 0644 data/Applications/ClassificationApp/SalesForecastCategory.txt 0644 @@ -168,6 +169,7 @@ data/_ClassificationTemplate/TestCategory.txt 0644 data/_ClassificationTemplate/TestTopic.txt 0644 data/_ClassificationTemplate/TopCategory.txt 0644 data/_ClassificationTemplate/TopicType.txt 0644 +data/_ClassificationTemplate/UncategorizedTopics.txt 0644 data/_ClassificationTemplate/WebAtom.txt 0644 data/_ClassificationTemplate/WebChanges.txt 0644 data/_ClassificationTemplate/WebHome.txt 0644 diff --git a/pub/System/ClassificationPlugin/styles.uncompressed.css b/pub/System/ClassificationPlugin/styles.uncompressed.css index 7980e24..6aa04f4 100644 --- a/pub/System/ClassificationPlugin/styles.uncompressed.css +++ b/pub/System/ClassificationPlugin/styles.uncompressed.css @@ -31,6 +31,7 @@ } .clsBrowser .treeview li { padding: 1px 0px 1px 20px; + border:0; } .clsTag { padding:1px 15px 2px 5px;