From 5cb1bf8beff8804354519c3543903a8ba622be79 Mon Sep 17 00:00:00 2001 From: OliverKrueger Date: Wed, 23 Jun 2010 10:11:42 +0000 Subject: [PATCH] Item1918: adding dry-run and doco for TagMePlugin import, minor changes in dialogbox layout. git-svn-id: http://svn.foswiki.org/trunk/TagsPlugin@7890 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- data/System/TagsPlugin.txt | 10 ++++++++ .../TagsPluginTagDetailsDialogExtended.txt | 2 +- .../TagsPluginTagDetailsDialogSimple.txt | 2 +- lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm | 23 +++++++++++++------ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/data/System/TagsPlugin.txt b/data/System/TagsPlugin.txt index 3650e43..476f200 100644 --- a/data/System/TagsPlugin.txt +++ b/data/System/TagsPlugin.txt @@ -53,6 +53,16 @@ with the =taggedwith(tagname)= operator. TagsPluginViews defines the common Tag widgets that can be reused via Sectional includes. +---+++ TagMePlugin data import +%SYSTEMWEB%.TagsPlugin can import the data from the !TagMePlugin. Please use the following links to directly start the import process. +In comparison to !TagMe %SYSTEMWEB%.TagsPlugin offers an additional public/visibility attribute. You can either import all tags as public +or private tags into %SYSTEMWEB%.TagsPlugin. + +|*Action*|*Link*| +| Import all tags from !TagMePlugin... | [[%SCRIPTURL{rest}%/TagsPlugin/importTagMe?visibility=public][...as public tags.]] | +|   | [[%SCRIPTURL{rest}%/TagsPlugin/importTagMe?visibility=private][...as private tags.]] | +| Don't import tags from !TagMePlugin, just... | [[%SCRIPTURL{rest}%/TagsPlugin/importTagMe?visibility=public&dryrun=1][...do a dry-run.]] | + ---+++ Preferences (used by the jquery flavor) Available variables which can be used to change the (default) behaviour of the jquery skin: diff --git a/data/System/TagsPluginTagDetailsDialogExtended.txt b/data/System/TagsPluginTagDetailsDialogExtended.txt index 8337ec0..69f9ac3 100644 --- a/data/System/TagsPluginTagDetailsDialogExtended.txt +++ b/data/System/TagsPluginTagDetailsDialogExtended.txt @@ -44,7 +44,7 @@ query="topic" tag="%TAGNAME%" header="%MAKETEXT{"Where else can I find this tag:"}%%BR%%BR%$n" - format=" * $web [[$item][$topic]]" + format=" * [[$item][$item]]" sep="$n" visibility="user" order="topic" diff --git a/data/System/TagsPluginTagDetailsDialogSimple.txt b/data/System/TagsPluginTagDetailsDialogSimple.txt index 2a13c35..7a8a862 100644 --- a/data/System/TagsPluginTagDetailsDialogSimple.txt +++ b/data/System/TagsPluginTagDetailsDialogSimple.txt @@ -8,7 +8,7 @@ query="topic" tag="%TAGNAME%" header="%MAKETEXT{"Where else can I find this tag:"}%%BR%%BR%$n" - format=" * $web [[$item][$topic]]" + format=" * [[$item][$item]]" sep="$n" visibility="user" order="topic" diff --git a/lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm b/lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm index 9454ade..ddaf7f1 100644 --- a/lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm +++ b/lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm @@ -34,6 +34,10 @@ sub rest { my $query = Foswiki::Func::getCgiQuery(); my $public = $query->param('visibility') || "NULL"; + $public = Foswiki::Sandbox::untaintUnchecked($public); + + my $dryrun = $query->param('dryrun') || "0"; + $dryrun = Foswiki::Sandbox::untaintUnchecked($dryrun); # check if current user is allowed to do so # @@ -51,12 +55,12 @@ sub rest { # interpret the public url param as a confirmation if ( $public eq "public" || $public eq "private" ) { - $public = Foswiki::Sandbox::untaintUnchecked($public); + $dryrun = ( $dryrun eq "1" ) ? "1" : "0"; $public = ( $public eq "public" ) ? "1" : "0"; - return Foswiki::Plugins::TagsPlugin::ImportTagMe::do($public); + return Foswiki::Plugins::TagsPlugin::ImportTagMe::do($public, $dryrun); } else { - return "Please use ?visibility=public or visibility=private"; + return "Please use visibility=public or visibility=private."; } } @@ -67,7 +71,7 @@ sub rest { =cut sub do { - my ($public) = @_; + my ($public, $dryrun) = @_; my $retval = ""; Foswiki::Func::writeDebug("TagsPlugin:TagMe-Import:Start") if DEBUG; @@ -109,9 +113,14 @@ sub do { Foswiki::Func::writeDebug( "TagsPlugin:TagMe-Import: $webTopic, $tag, $user_id, $public" ) if DEBUG; - $retval .= "$webTopic, $tag, $user_id, $public
"; - Foswiki::Plugins::TagsPlugin::Tag::do( "tag", $webTopic, - $tag, $user_id, $public ); + $retval .= "$webTopic, $tag, $user_id, $public"; + if ($dryrun) { + $retval .= "(dryrun)
"; + } else { + Foswiki::Plugins::TagsPlugin::Tag::do( "tag", $webTopic, + $tag, $user_id, $public ); + $retval .= "
"; + } } } }