Skip to content

Commit

Permalink
Item1918: adding dry-run and doco for TagMePlugin import, minor chang…
Browse files Browse the repository at this point in the history
…es in dialogbox layout.

git-svn-id: http://svn.foswiki.org/trunk/TagsPlugin@7890 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OliverKrueger authored and OliverKrueger committed Jun 23, 2010
1 parent 05ecdca commit 5cb1bf8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
10 changes: 10 additions & 0 deletions data/System/TagsPlugin.txt
Expand Up @@ -53,6 +53,16 @@ with the =taggedwith(tagname)= operator.

TagsPluginViews defines the common Tag widgets that can be reused via Sectional includes.

---+++ <nop>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.]] |
| &nbsp; | [[%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:

Expand Down
2 changes: 1 addition & 1 deletion data/System/TagsPluginTagDetailsDialogExtended.txt
Expand Up @@ -44,7 +44,7 @@
query="topic"
tag="%TAGNAME%"
header="%MAKETEXT{"Where else can I find this tag:"}%%BR%%BR%$n"
format=" * <span class='foswikiGrayText'>$web</span> [[$item][$topic]]"
format=" * [[$item][$item]]"
sep="$n"
visibility="user"
order="topic"
Expand Down
2 changes: 1 addition & 1 deletion data/System/TagsPluginTagDetailsDialogSimple.txt
Expand Up @@ -8,7 +8,7 @@
query="topic"
tag="%TAGNAME%"
header="%MAKETEXT{"Where else can I find this tag:"}%%BR%%BR%$n"
format=" * <span class='foswikiGrayText'>$web</span> [[$item][$topic]]"
format=" * [[$item][$item]]"
sep="$n"
visibility="user"
order="topic"
Expand Down
23 changes: 16 additions & 7 deletions lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm
Expand Up @@ -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
#
Expand All @@ -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 <a href='importTagMe?visibility=public'>visibility=public</a> or <a href='importTagMe?visibility=private'>visibility=private</a>.";
}
}

Expand All @@ -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;
Expand Down Expand Up @@ -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 <br />";
Foswiki::Plugins::TagsPlugin::Tag::do( "tag", $webTopic,
$tag, $user_id, $public );
$retval .= "$webTopic, $tag, $user_id, $public";
if ($dryrun) {
$retval .= "(dryrun) <br />";
} else {
Foswiki::Plugins::TagsPlugin::Tag::do( "tag", $webTopic,
$tag, $user_id, $public );
$retval .= "<br />";
}
}
}
}
Expand Down

0 comments on commit 5cb1bf8

Please sign in to comment.