Skip to content

Commit

Permalink
Item11808: revert perltidy on all lib/CPAN and all plugins which are …
Browse files Browse the repository at this point in the history
…CoordinateWithAuthor, as requested by Micha

git-svn-id: http://svn.foswiki.org/trunk/TagsPlugin@14764 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed May 7, 2012
1 parent 3da3448 commit e0c78f7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 48 deletions.
24 changes: 12 additions & 12 deletions lib/Foswiki/Plugins/TagsPlugin.pm
Expand Up @@ -60,10 +60,9 @@ sub initPlugin {

#TODO: need a more correct error for NO DB INITIALISED yet
#need to allow the user to init, or update the db - so the plugin needs to succeed..
Foswiki::Func::registerRESTHandler( 'initialiseDatabase',
\&initialiseDatabase );
Foswiki::Func::registerRESTHandler( 'convertDatabase',
\&convertDatabase );
Foswiki::Func::registerRESTHandler( 'initialiseDatabase',
\&initialiseDatabase );
Foswiki::Func::registerRESTHandler( 'convertDatabase', \&convertDatabase );
return 1;
}

Expand Down Expand Up @@ -732,7 +731,6 @@ sub updateTopicTags {
use Foswiki::Plugins::TagsPlugin::Tag;
$text =~
s/[;,\s]([$alpha]+)Category[;,\s]/Foswiki::Plugins::TagsPlugin::Tag::do($item_type, "$web.$topic", $1, $user_id);Foswiki::Plugins::TagsPlugin::Tag::do('tag', $1, $web, $user_id);''/geo;

# Foswiki::Plugins::TagsPlugin::Tag::do( $item_type, "$web.$topic", $tag, Foswiki::Func::getCanonicalUserID("AdminUser") );
}

Expand Down Expand Up @@ -781,6 +779,7 @@ CREATE TABLE IF NOT EXISTS `TagsPlugin_info` (
END
$arrayRef = $db->dbInsert($statement);


$statement = <<'END';
CREATE TABLE IF NOT EXISTS `Users` (
`FoswikicUID` varchar(256) character set ascii NOT NULL,
Expand Down Expand Up @@ -829,11 +828,12 @@ CREATE TABLE IF NOT EXISTS `UserTagStat` (
END
$arrayRef = $db->dbInsert($statement);

#TODO: save the schema version.
# $statement = <<'END';
#UPDATE
#END
# $arrayRef = $db->dbInsert($statement);
#TODO: save the schema version.
# $statement = <<'END';
#UPDATE
#END
# $arrayRef = $db->dbInsert($statement);


#add basic tags
# - each topic is tagged with the web its in (tag type?)
Expand Down Expand Up @@ -871,7 +871,7 @@ sub convertDatabase {
ALTER TABLE `UserItemTag` ADD COLUMN `public` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `tag_id`;
END
my $arrayRef = $db->dbInsert($statement);

$statement = <<'END';
CREATE TABLE IF NOT EXISTS `TagsPlugin_info` (
`name` varchar(255) NOT NULL,
Expand All @@ -880,7 +880,7 @@ CREATE TABLE IF NOT EXISTS `TagsPlugin_info` (
) ENGINE=InnoDB AUTO_INCREMENT=904 DEFAULT CHARSET=latin1;
END
$arrayRef = $db->dbInsert($statement);

$db->disconnect(); #force a commit

return "ok";
Expand Down
11 changes: 4 additions & 7 deletions lib/Foswiki/Plugins/TagsPlugin/ChangeOwner.pm
Expand Up @@ -42,9 +42,8 @@ sub rest {
( defined $query->param('public') ) ? $query->param('public') : '1';
my $redirectto = $query->param('redirectto') || '';

my $current_user = Foswiki::Func::getWikiName();
my $tagAdminGroup = $Foswiki::cfg{TagsPlugin}{TagAdminGroup}
|| "AdminGroup";
my $current_user = Foswiki::Func::getWikiName();
my $tagAdminGroup = $Foswiki::cfg{TagsPlugin}{TagAdminGroup} || "AdminGroup";

$item = Foswiki::Sandbox::untaintUnchecked($item);
$tag = Foswiki::Sandbox::untaintUnchecked($tag);
Expand Down Expand Up @@ -104,12 +103,10 @@ sub rest {
return "<h1>400 'public' is not 0 or 1</h1>";
}

if (
$user ne $current_user
if ( $user ne $current_user
&& not Foswiki::Func::isGroupMember(
$tagAdminGroup, Foswiki::Func::getWikiName()
)
)
) )
{
$session->{response}->status(403);
return "<h1>403 Forbidden</h1>";
Expand Down
18 changes: 7 additions & 11 deletions lib/Foswiki/Plugins/TagsPlugin/ImportTagMe.pm
Expand Up @@ -97,27 +97,23 @@ sub do {
use Foswiki::Plugins::TagsPlugin::Tag;
foreach my $webTopic (@list) {

my ( $web, $topic ) =
Foswiki::Func::normalizeWebTopicName( "", $webTopic );
my ($web, $topic) = Foswiki::Func::normalizeWebTopicName( "", $webTopic );
$webTopic =~ s/[\/\\]/\./g;
$web =~ s/[\/\\]/\./g;

# do not import garbage
if ( $web =~ m/^Trash/ ) {
Foswiki::Func::writeDebug(
"TagsPlugin::TagMe-Import: skipping topic from Trash: $webTopic"
);
if ($web =~ m/^Trash/) {
Foswiki::Func::writeDebug("TagsPlugin::TagMe-Import: skipping topic from Trash: $webTopic");
$retval .= "<br /> $webTopic (skipping, trash topic)";
next;
}
};

# do not import legacy
if ( not Foswiki::Func::topicExists( $web, $topic ) ) {
Foswiki::Func::writeDebug(
"TagsPlugin::TagMe-Import: skipping nonexisting $webTopic");
if (not Foswiki::Func::topicExists( $web, $topic )) {
Foswiki::Func::writeDebug("TagsPlugin::TagMe-Import: skipping nonexisting $webTopic");
$retval .= "<br /> $webTopic (skipping, non-existsing)";
next;
}
};

my $text = Foswiki::Func::readFile("$workAreaDir/_tags_$webTopic.txt");
my @tagInfo = grep { /^[0-9]/ } split( /\n/, $text );
Expand Down
34 changes: 17 additions & 17 deletions lib/Foswiki/Plugins/TagsPlugin/TAGSEARCH.pm
Expand Up @@ -35,21 +35,21 @@ Return:
sub do {
my ( $session, $params, $topic, $web ) = @_;

my $theHeader = $params->{header} || '';
my $theSep = $params->{separator} || $params->{sep} || ', ';
my $theFooter = $params->{footer} || '';
my $theUser = $params->{user} || 'all';
my $theWeb = $params->{web} || 'all';
my $theTag = $params->{tag} || 'all';
my $theTopic = $params->{topic} || '';
my $theQuery = $params->{query} || 'tag';
my $theOrder = $params->{order} || '';
my $thePublic = $params->{visibility} || 'user';
my $theAlt = $params->{alt} || '';
my $theLimit = $params->{limit} || 0;
my $theOffset = $params->{offset} || 0;
my $theFormat = $params->{format};
my $theRendering = $params->{rendering} || '';
my $theHeader = $params->{header} || '';
my $theSep = $params->{separator} || $params->{sep} || ', ';
my $theFooter = $params->{footer} || '';
my $theUser = $params->{user} || 'all';
my $theWeb = $params->{web} || 'all';
my $theTag = $params->{tag} || 'all';
my $theTopic = $params->{topic} || '';
my $theQuery = $params->{query} || 'tag';
my $theOrder = $params->{order} || '';
my $thePublic = $params->{visibility} || 'user';
my $theAlt = $params->{alt} || '';
my $theLimit = $params->{limit} || 0;
my $theOffset = $params->{offset} || 0;
my $theFormat = $params->{format};
my $theRendering = $params->{rendering} || '';

if ( $thePublic =~ m/private/i ) {
$theUser = Foswiki::Func::getWikiName();
Expand Down Expand Up @@ -339,10 +339,10 @@ $limit";

# handle special renderings (ie. cloud)
if ( $theRendering =~ /^cloud$/i && $row_counter > 0 ) {
my $tml =
"%TAGCLOUD{ terms=\"$output\" format=\"<a style='font-size:\$weightpx;' class='tagsplugin_tagcloud_tag' href='%SCRIPTURL{view}%/%SYSTEMWEB%/TagsPluginTagDetails?tag=\$term' item='\$3.\$4' topic='\$4' web='\$3' tag='\$term' user='\$5'>\$term</a>\" warn=\"off\" split=\"[,]+\" }%";
my $tml = "%TAGCLOUD{ terms=\"$output\" format=\"<a style='font-size:\$weightpx;' class='tagsplugin_tagcloud_tag' href='%SCRIPTURL{view}%/%SYSTEMWEB%/TagsPluginTagDetails?tag=\$term' item='\$3.\$4' topic='\$4' web='\$3' tag='\$term' user='\$5'>\$term</a>\" warn=\"off\" split=\"[,]+\" }%";
$output = Foswiki::Func::expandCommonVariables( $tml, $topic, $web );
}


return $output;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/TagsPlugin/build.pl
Expand Up @@ -8,4 +8,4 @@ BEGIN
$build = new Foswiki::Contrib::Build('TagsPlugin');

# Build the target on the command line, or the default target
$build->build( $build->{target} );
$build->build($build->{target});

0 comments on commit e0c78f7

Please sign in to comment.