Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item13897: Converted CommentPlugin
  • Loading branch information
vrurg committed Jul 8, 2016
1 parent 2d96be2 commit b613253
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions CommentPlugin/lib/Foswiki/Plugins/CommentPlugin.pm
Expand Up @@ -44,7 +44,7 @@ sub initPlugin {
'Foswiki::Plugins::CommentPlugin::JQuery' );
unless (
Foswiki::Plugins::JQueryPlugin::createPlugin(
"Comment", $Foswiki::Plugins::SESSION
"Comment", $Foswiki::app
)
)
{
Expand All @@ -63,7 +63,7 @@ sub initPlugin {
}

sub _COMMENT {
my ( $session, $params, $topic, $web ) = @_;
my ( $app, $params, $topic, $web ) = @_;

# Indexing each macro instance
$params->{comment_index} = $commentIndex++;
Expand Down Expand Up @@ -111,8 +111,8 @@ sub _COMMENT {
# parameter is not set, we pass the exception on to the UI package.

sub _restSave {
my $session = shift;
my $response = $session->response;
my $app = shift;
my $response = $app->response;
my $query = Foswiki::Func::getCgiQuery();

my ( $web, $topic ) =
Expand Down Expand Up @@ -194,7 +194,7 @@ sub _restSave {
my $context =
$query->url( -full => 1, -path => 1, -query => 1 )
. time();
my $cgis = $session->getCGISession();
my $cgis = $app->users->getCGISession();
my $nonce;
if ( Foswiki::Validation->can('generateValidationKey') ) {
$nonce =
Expand All @@ -214,7 +214,7 @@ sub _restSave {
# Decorate the response to show it's been ajax-added.
# It's TML, and free format, so there's a limit as to
# how clever we can be.
my $pht = $session->i18n->maketext(
my $pht = $app->i18n->maketext(
'This is a temporary placeholder for your new comment. Refresh the topic to see the actual comment.'
);
$output =
Expand Down
12 changes: 7 additions & 5 deletions CommentPlugin/lib/Foswiki/Plugins/CommentPlugin/JQuery.pm
Expand Up @@ -9,18 +9,20 @@ use Moo;
extends qw( Foswiki::Plugins::JQueryPlugin::Plugin );

around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
my $orig = shift;
my $class = shift;
my %params = @_;
return $orig->(
$class, @_,
name => 'Comment',
version => '3.0',
author => 'Crawford Currie',
homepage => 'http://foswiki.org/Extensions/CommentPlugin',
puburl => '%PUBURLPATH%/%SYSTEMWEB%/CommentPlugin',
documentation => "$Foswiki::cfg{SystemWebName}.CommentPlugin",
css => ["comment.css"],
javascript => ["comment.js"]
documentation => $params{app}->cfg->data->{SystemWebName}
. ".CommentPlugin",
css => ["comment.css"],
javascript => ["comment.js"]
);
};

Expand Down

0 comments on commit b613253

Please sign in to comment.