Skip to content

Commit

Permalink
Item12730: initial checkin of new list management and bookmarking wid…
Browse files Browse the repository at this point in the history
…get called "listy"

git-svn-id: http://svn.foswiki.org/trunk/ListyPlugin@17722 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed May 28, 2014
0 parents commit ff6023b
Show file tree
Hide file tree
Showing 13 changed files with 2,123 additions and 0 deletions.
29 changes: 29 additions & 0 deletions data/System/ListyPlugin.txt
@@ -0,0 +1,29 @@
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1394206737" format="1.1" reprev="2" version="2"}%
---+!! %TOPIC%
%SHORTDESCRIPTION%

%TOC%

---++ Usage

---++ Examples

---++ Installation Instructions

%$INSTALL_INSTRUCTIONS%

---++ Info
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

| Author(s): | Michael Daum|
| Copyright: | &copy; 2011-2014 Michael Daum http://michaeldaumconsulting.com |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 24 Jan 2014: | renamed from <nop>BookmarksPlugin to ListyPlugin |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |
115 changes: 115 additions & 0 deletions lib/Foswiki/Plugins/ListyPlugin.pm
@@ -0,0 +1,115 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# ListyPlugin is Copyright (C) 2011 Michael Daum http://michaeldaumconsulting.com
#
# 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

package Foswiki::Plugins::ListyPlugin;

use strict;
use warnings;

=begin TML
---+ package ListyPlugin
=cut

use Foswiki::Func ();
use Foswiki::Plugins ();
use Foswiki::Contrib::JsonRpcContrib ();

our $VERSION = '0.99';
our $RELEASE = '0.99';
our $SHORTDESCRIPTION = 'Fancy list manager';
our $NO_PREFS_IN_TOPIC = 1;
our $core;


=begin TML
---++ initPlugin($topic, $web, $user) -> $boolean
=cut

sub initPlugin {

Foswiki::Func::registerTagHandler('LISTY', \&LISTY);

Foswiki::Contrib::JsonRpcContrib::registerMethod("ListyPlugin", "saveListyItem", sub {
my $session = shift;
return getCore($session)->jsonRpcSaveListyItem(@_);
});

Foswiki::Contrib::JsonRpcContrib::registerMethod("ListyPlugin", "deleteListyItem", sub {
my $session = shift;
return getCore($session)->jsonRpcDeleteListyItem(@_);
});

Foswiki::Contrib::JsonRpcContrib::registerMethod("ListyPlugin", "saveListy", sub {
my $session = shift;
return getCore($session)->jsonRpcSaveListy(@_);
});

if ($Foswiki::Plugins::VERSION > 2.0) {
my $metaDataName = $Foswiki::cfg{ListyPlugin}{MetaData} || 'LISTY';
Foswiki::Meta::registerMETA($metaDataName, alias => lc($metaDataName), many => 1);
}


return 1;
}

=begin TML
---++ finishPlugin()
=cut

sub finishPlugin {
undef $core;
}

=begin TML
---++ getCore()
=cut

sub getCore {
my $session = shift;

unless (defined $core) {
require Foswiki::Plugins::ListyPlugin::Core;
$core = new Foswiki::Plugins::ListyPlugin::Core($session);
} else {
$core->init($session);
}

return $core;
}

=begin TML
---++ LISTY($session, $params, $theTopic, $theWeb) -> $string
stub for LISTY to initiate the core before handling the macro
=cut

sub LISTY {
my $session = shift;
return getCore($session)->LISTY(@_);
}


1;
9 changes: 9 additions & 0 deletions lib/Foswiki/Plugins/ListyPlugin/Config.spec
@@ -0,0 +1,9 @@
# ---+ Extensions
# ---++ ListyPlugin
# ---+++ Meta data name
# **STRING EXPERT**
# ID of the meta data to hold listy data, defaults to LISTY.
# WARNING: old listies won't be accessible if you change the ID here after having used ListyPlugin for some time.
$Foswiki::cfg{ListyPlugin}{MetaData} = 'LISTY';

1;

0 comments on commit ff6023b

Please sign in to comment.