diff --git a/data/System/TagsPluginNoHeaderViewTemplate.txt b/data/System/TagsPluginNoHeaderViewTemplate.txt
new file mode 100644
index 0000000..382a4c2
--- /dev/null
+++ b/data/System/TagsPluginNoHeaderViewTemplate.txt
@@ -0,0 +1,4 @@
+%META:TOPICINFO{author="BaseUserMapping_333" date="1251408056" format="1.1" version="1.1"}%
+%TMPL:INCLUDE{view}%
+
+%TMPL:DEF{"tagsplugin:header"}%%TMPL:END%
diff --git a/data/System/TagsPluginTagCloud.txt b/data/System/TagsPluginTagCloud.txt
new file mode 100644
index 0000000..01d0f79
--- /dev/null
+++ b/data/System/TagsPluginTagCloud.txt
@@ -0,0 +1,8 @@
+%META:TOPICINFO{author="BaseUserMapping_333" date="1251421038" format="1.1" reprev="1.6" version="1.6"}%
+%TAGCLOUD{
+ terms="$percntTAGSEARCH{ query=\"tag\" format=\"$tag:1:$web:$topic:$user\" sep=\",\" web=\"$percntTAGWEB$percnt\" user=\"$percntTAGUSER$percnt\" }$percnt"
+ header="
"
+ format="$term"
+ footer="
"
+ warn="off"
+}%
diff --git a/data/System/TagsPluginTagList.txt b/data/System/TagsPluginTagList.txt
index e2a15d5..a61bfdc 100644
--- a/data/System/TagsPluginTagList.txt
+++ b/data/System/TagsPluginTagList.txt
@@ -1,10 +1,8 @@
-%META:TOPICINFO{author="BaseUserMapping_333" date="1251232495" format="1.1" version="1.2"}%
-
+%META:TOPICINFO{author="BaseUserMapping_333" date="1251400275" format="1.1" version="1.3"}%
%TAGSEARCH{
query="tag"
- web="%URLPARAM{"tagweb" default="%SYSTEMWEB%"}%"
- topic="%URLPARAM{"tagtopic" default="SomeTHiNg_verY-unLIKelY" }%"
- format=" $tag$n"
+ web="%URLPARAM{"tagweb" default="%BASEWEB%"}%"
+ topic="%URLPARAM{"tagtopic" default="%BASETOPIC%" }%"
+ format=" $tag"
sep=" "
}%
-
diff --git a/lib/Foswiki/Plugins/TagsPlugin.pm b/lib/Foswiki/Plugins/TagsPlugin.pm
index 1897d2b..a239c03 100644
--- a/lib/Foswiki/Plugins/TagsPlugin.pm
+++ b/lib/Foswiki/Plugins/TagsPlugin.pm
@@ -45,12 +45,16 @@ sub initPlugin {
return 0;
}
+ Foswiki::Func::addToHEAD('TAGSPLUGIN','');
+
# $debug = $Foswiki::cfg{Plugins}{TagsPlugin}{Debug} || 0;
- Foswiki::Func::registerTagHandler( 'TAGLIST', \&_TAGLIST );
- Foswiki::Func::registerTagHandler( 'TAGENTRY', \&_TAGENTRY );
- Foswiki::Func::registerTagHandler( 'TAGCLOUD', \&_TAGCLOUD ) if ( defined($Foswiki::cfg{TagsPlugin}{EnableTagCloud}) && $Foswiki::cfg{TagsPlugin}{EnableTagCloud} );
- Foswiki::Func::registerTagHandler( 'TAGSEARCH', \&_TAGSEARCH );
+ Foswiki::Func::registerTagHandler( 'TAGLIST', \&_TAGLIST );
+ Foswiki::Func::registerTagHandler( 'TAGENTRY', \&_TAGENTRY );
+ Foswiki::Func::registerTagHandler( 'TAGCLOUD', \&_TAGCLOUD ) if ( defined($Foswiki::cfg{TagsPlugin}{EnableTagCloud}) && $Foswiki::cfg{TagsPlugin}{EnableTagCloud} );
+ Foswiki::Func::registerTagHandler( 'TAGSEARCH', \&_TAGSEARCH );
+ Foswiki::Func::registerTagHandler( 'TAGGROUPS', \&_TAGGROUPS );
+ Foswiki::Func::registerTagHandler( 'ISTAGADMIN', \&_ISTAGADMIN );
Foswiki::Func::registerRESTHandler( 'tag', \&tagCall );
Foswiki::Func::registerRESTHandler( 'untag', \&untagCall );
@@ -292,6 +296,20 @@ sub _TAGSEARCH {
return Foswiki::Plugins::TagsPlugin::TAGSEARCH::do( @_ );
}
+sub _TAGGROUPS {
+ use Foswiki::Plugins::TagsPlugin::TAGGROUPS;
+ return Foswiki::Plugins::TagsPlugin::TAGGROUPS::do( @_ );
+}
+
+sub _ISTAGADMIN {
+ my $tagAdminGroup = $Foswiki::cfg{TagsPlugin}{TagAdminGroup} || "AdminGroup";
+ if ( !Foswiki::Func::isGroupMember( $tagAdminGroup, Foswiki::Func::getWikiName()) ) {
+ return "0";
+ } else {
+ return "1";
+ }
+}
+
=pod
---++ tagCall($session) -> $text
diff --git a/lib/Foswiki/Plugins/TagsPlugin/MANIFEST b/lib/Foswiki/Plugins/TagsPlugin/MANIFEST
index 3fd0943..6def5ec 100644
--- a/lib/Foswiki/Plugins/TagsPlugin/MANIFEST
+++ b/lib/Foswiki/Plugins/TagsPlugin/MANIFEST
@@ -3,8 +3,11 @@ data/System/TagsPlugin.txt 0644 Documentation
data/System/TagsPluginViews.txt 0644 Documentation
data/System/TagsPluginTagEntrySearch.txt 0644 Topic
data/System/TagsPluginViewsTagSearch.txt 0644 Topic
+data/System/TagsPluginNoHeaderViewTemplate.txt 0644 Topic
data/System/TagsPluginTagList.txt 0644 Topic
+data/System/TagsPluginTagCloud.txt 0644 Topic
data/System/VarTAGSEARCH.txt 0644 Documentation
+pub/System/TagsPlugin/tagsplugin.css 0644 Stylesheets
lib/Foswiki/Plugins/TagsPlugin.pm 0644 Perl module
lib/Foswiki/Plugins/TagsPlugin/Tag.pm 0644 Perl module
lib/Foswiki/Plugins/TagsPlugin/Untag.pm 0644 Perl module
@@ -12,6 +15,7 @@ lib/Foswiki/Plugins/TagsPlugin/Delete.pm 0644 Perl module
lib/Foswiki/Plugins/TagsPlugin/Rename.pm 0644 Perl module
lib/Foswiki/Plugins/TagsPlugin/Merge.pm 0644 Perl module
lib/Foswiki/Plugins/TagsPlugin/TAGSEARCH.pm 0644 Perl module
+lib/Foswiki/Plugins/TagsPlugin/TAGGROUPS.pm 0644 Perl module
templates/tagsplugin.tmpl
templates/view.tagsplugin.tmpl
diff --git a/lib/Foswiki/Plugins/TagsPlugin/TAGGROUPS.pm b/lib/Foswiki/Plugins/TagsPlugin/TAGGROUPS.pm
new file mode 100644
index 0000000..8f7e382
--- /dev/null
+++ b/lib/Foswiki/Plugins/TagsPlugin/TAGGROUPS.pm
@@ -0,0 +1,72 @@
+# This script Copyright
+# (c) 2009 Oliver Krueger, (wiki-one.net)
+# and distributed under the GPL (see below)
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details, published at
+# http://www.gnu.org/copyleft/gpl.html
+#
+# Author(s): Oliver Krueger
+
+package Foswiki::Plugins::TagsPlugin::TAGGROUPS;
+
+use strict;
+use warnings;
+use Error qw(:try);
+
+=begin TML
+
+---++ do( $session, $params, $topic, $web )
+Taghandler for TAGGROUPS.
+
+Return:
+ Formatted list of current users groups.
+=cut
+
+sub do {
+ my ( $session, $params, $topic, $web ) = @_;
+
+ my $theHeader = $params->{header} || '';
+ my $theSep = $params->{separator} || $params->{sep} || ',';
+ my $theFooter = $params->{footer} || '';
+ my $theFormat = $params->{format} || '$group';
+
+ my $output = '';
+ my @groups = ();
+
+ # get the groups and rotate through it
+ my $it = Foswiki::Func::eachGroup();
+ while ($it->hasNext()) {
+ my $group = $it->next();
+ if ( !Foswiki::Func::isGroupMember( $group ) ) { next; };
+ my $entry = $theFormat;
+
+ $entry =~ s/\$group/$group/g;
+
+ # insert seperator only if needed
+ if ( $output ne '' ) {
+ $output .= $theSep . $entry;
+ } else {
+ $output = $entry;
+ }
+ }
+
+ $output = $theHeader . $output . $theFooter if ($output);
+
+ # expand standard escapes
+ $output =~ s/\$n/\n/g;
+ $output =~ s/\$percnt/\%/g;
+ $output =~ s/\$quot/"/g;
+ $output =~ s/\$dollar/\$/g;
+
+ return $output;
+}
+
+1;
diff --git a/lib/Foswiki/Plugins/TagsPlugin/TAGSEARCH.pm b/lib/Foswiki/Plugins/TagsPlugin/TAGSEARCH.pm
index c50cd4b..0ceff2d 100644
--- a/lib/Foswiki/Plugins/TagsPlugin/TAGSEARCH.pm
+++ b/lib/Foswiki/Plugins/TagsPlugin/TAGSEARCH.pm
@@ -65,15 +65,23 @@ sub do {
# resolve the cUID from the database and exit with "" if it does not exist
#
if ( lc($theUser) ne 'all' ) {
- my $cuid;
- my $statement =
- sprintf( 'SELECT %s from %s WHERE %s = ? ', qw( CUID Users FoswikicUID) );
- my $arrayRef = $db->dbSelect( $statement, Foswiki::Func::getCanonicalUserID( $theUser ) );
- if ( defined( $arrayRef->[0][0] ) ) {
- $cuid = $arrayRef->[0][0];
+ my @users = split( /,/, $theUser );
+ my @clauses;
+ foreach my $u (@users) {
+ $u =~ s/^\s*//g;
+ $u =~ s/\s*$//g;
+ my $cuid;
+ my $statement =
+ sprintf( 'SELECT %s from %s WHERE %s = ? ', qw( CUID Users FoswikicUID) );
+ my $arrayRef = $db->dbSelect( $statement, Foswiki::Func::getCanonicalUserID( $u ) );
+ if ( defined( $arrayRef->[0][0] ) ) {
+ $cuid = $arrayRef->[0][0];
+ }
+ next unless ( defined($cuid) );
+ push @clauses, " i2t.user_id = '$cuid' ";
}
- return '' unless ( defined($cuid) );
- push @whereClauses, " i2t.user_id = '$cuid' ";
+ if ( !defined(@clauses) ) { return ''; };
+ push @whereClauses, "(" . join( ' OR ', @clauses ) . ")";
}
# filter for webs
@@ -86,7 +94,7 @@ sub do {
$w =~ s/\s*$//g;
push @clauses, " i.item_name like '$w%' ";
}
- push @whereClauses, join( ' OR ', @clauses );
+ push @whereClauses, "(" . join( ' OR ', @clauses ) . ")";
}
# filter for topics
diff --git a/lib/Foswiki/Plugins/TagsPlugin/Tag.pm b/lib/Foswiki/Plugins/TagsPlugin/Tag.pm
index 37bd093..3171ce1 100644
--- a/lib/Foswiki/Plugins/TagsPlugin/Tag.pm
+++ b/lib/Foswiki/Plugins/TagsPlugin/Tag.pm
@@ -104,6 +104,7 @@ sub rest {
# returning nothing of interest
my $user_id = Foswiki::Plugins::TagsPlugin::getUserId($session, Foswiki::Func::getCanonicalUserID( $user ) );
+ Foswiki::Func::writeDebug("ID: $user_id");
my $retval = Foswiki::Plugins::TagsPlugin::Tag::do( $item_type, $item_name, $tag_text, $user_id );
# redirect on request
@@ -218,4 +219,4 @@ sub do {
return $rowCount;
}
-1;
\ No newline at end of file
+1;
diff --git a/pub/System/TagsPlugin/tagsplugin.css b/pub/System/TagsPlugin/tagsplugin.css
new file mode 100644
index 0000000..956668a
--- /dev/null
+++ b/pub/System/TagsPlugin/tagsplugin.css
@@ -0,0 +1,44 @@
+ .tagsplugin_container {
+ border-style:dashed;
+ border-width:thin;
+ padding: 10px;
+ }
+ .tagsplugin_web {
+ background-color:#EEEEEE;
+ display:inline;
+ margin:2px;
+ padding:2px;
+ text-decoration:none;
+ color:black;
+ cursor:pointer;
+ }
+ .tagsplugin_web_active {
+ background-color:#B9DAFF;
+ }
+ .tagsplugin_tag {
+ background-color:#EEEEEE;
+ display:inline;
+ margin:2px;
+ padding:2px;
+ text-decoration:none;
+ color:black;
+ }
+ .tagsplugin_tagcloud {
+ }
+ .tagsplugin_tagcloud_tag {
+ cursor:pointer;
+ }
+ .tagsplugin_tagcloud_tag_tagged {
+ background-color:#B9DAFF;
+ }
+ .tagsplugin_tag_remove {
+ color:red;
+ cursor:pointer;
+ padding-left:5px;
+ }
+ .tagsplugin_clickable {
+ cursor:pointer;
+ }
+ .tagsplugin_hidden {
+ display:none;
+ }