Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item10175: make a JSONEditor JQueryPlugin using my new EmptyJQueryPlu…
…gin stub git-svn-id: http://svn.foswiki.org/trunk/JSONEditorJQueryPlugin@10348 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
SvenDowideit
authored and
SvenDowideit
committed
Dec 18, 2010
0 parents
commit e287edc
Showing
7 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
%META:TOPICINFO{author="ProjectContributor" date="1258383446" format="1.1" version="1.2"}% | ||
%META:TOPICPARENT{name="JSONEditorJQueryPlugin"}% | ||
---+ %TOPIC% | ||
%JQPLUGINS{"jsoneditor" | ||
format=" | ||
Homepage: $homepage <br /> | ||
Author(s): $author <br /> | ||
Version: $version | ||
" | ||
}% | ||
|
||
%STARTSECTION{"summary"}% | ||
|
||
%ENDSECTION{"summary"}% | ||
|
||
---++ Examples | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
---+!! !JSONEditorJQueryPlugin | ||
<!-- | ||
One line description, required for extensions repository catalog. | ||
BuildContrib will fill in the SHORTDESCRIPTION with the value of | ||
$SHORTDESCRIPTION from the .pm module, or you can redefine it here if you | ||
prefer. | ||
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION% | ||
--> | ||
%SHORTDESCRIPTION% | ||
|
||
%TOC% | ||
|
||
---++ Usage | ||
|
||
---++ Examples | ||
|
||
---++ Installation Instructions | ||
|
||
%$INSTALL_INSTRUCTIONS% | ||
|
||
---++ Info | ||
|
||
Many thanks to the following sponsors for supporting this work: | ||
* Acknowledge any sponsors here | ||
|
||
| Author(s): | | | ||
| Copyright: | © | | ||
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] | | ||
| Release: | %$RELEASE% | | ||
| Version: | %$VERSION% | | ||
| Change History: | <!-- versions below in reverse order --> | | ||
| Dependencies: | %$DEPENDENCIES% | | ||
| Home page: | http://foswiki.org/bin/view/Extensions/JSONEditorJQueryPlugin | | ||
| Support: | http://foswiki.org/bin/view/Support/JSONEditorJQueryPlugin | | ||
|
||
<!-- Do _not_ attempt to edit this topic; it is auto-generated. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# See bottom of file for default license and copyright information | ||
|
||
=begin TML | ||
---+ package JSONEditorJQueryPlugin | ||
=cut | ||
|
||
package Foswiki::Plugins::JSONEditorJQueryPlugin; | ||
|
||
# Always use strict to enforce variable scoping | ||
use strict; | ||
use warnings; | ||
|
||
use Foswiki::Func (); # The plugins API | ||
use Foswiki::Plugins (); # For the API version | ||
|
||
our $VERSION = '$Rev$'; | ||
|
||
our $RELEASE = '03 Mar 2010'; | ||
|
||
# Short description of this plugin | ||
# One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic: | ||
our $SHORTDESCRIPTION = 'lightweight tree editor of JSON data, using RestPlugin to GET and SET'; | ||
|
||
our $NO_PREFS_IN_TOPIC = 1; | ||
|
||
=begin TML | ||
---++ initPlugin($topic, $web, $user) -> $boolean | ||
* =$topic= - the name of the topic in the current CGI query | ||
* =$web= - the name of the web in the current CGI query | ||
* =$user= - the login name of the user | ||
* =$installWeb= - the name of the web the plugin topic is in | ||
(usually the same as =$Foswiki::cfg{SystemWebName}=) | ||
=cut | ||
|
||
sub initPlugin { | ||
my ( $topic, $web, $user, $installWeb ) = @_; | ||
|
||
# check for Plugins.pm versions | ||
if ( $Foswiki::Plugins::VERSION < 2.0 ) { | ||
Foswiki::Func::writeWarning( 'Version mismatch between ', | ||
__PACKAGE__, ' and Plugins.pm' ); | ||
return 0; | ||
} | ||
if ($Foswiki::cfg{Plugins}{JQueryPlugin}{Enabled}) { | ||
require Foswiki::Plugins::JQueryPlugin; | ||
Foswiki::Plugins::JQueryPlugin::registerPlugin("JSONEditor", | ||
'Foswiki::Plugins::JSONEditorJQueryPlugin::JSONEDITOR'); | ||
} | ||
|
||
# Plugin correctly initialized | ||
return 1; | ||
} | ||
|
||
1; | ||
__END__ | ||
This copyright information applies to the JSONEditorJQueryPlugin: | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# | ||
# JSONEditorJQueryPlugin is # 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. | ||
# | ||
# For licensing info read LICENSE file in the root of this distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Dependencies for JSONEditorJQueryPlugin | ||
# Example: | ||
# Time::ParseDate,>=2003.0211,cpan,Required. | ||
# Foswiki::Plugins,>=1.2,perl,Requires version 1.2 of handler API. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# copyright for plugin and for jquery code | ||
# license.. | ||
|
||
package Foswiki::Plugins::JQueryExtrasPlugin::JSONEDITOR; | ||
use strict; | ||
use warnings; | ||
use Foswiki::Plugins::JQueryPlugin::Plugin; | ||
our @ISA = qw( Foswiki::Plugins::JQueryPlugin::Plugin ); | ||
|
||
=begin TML | ||
---+ package Foswiki::Plugins::JQueryExtrasPlugin::JSONEDITOR | ||
This is the perl stub for the jquery.jsoneditor plugin. | ||
=cut | ||
|
||
=begin TML | ||
---++ ClassMethod new( $class, $session, ... ) | ||
Constructor | ||
=cut | ||
|
||
sub new { | ||
my $class = shift; | ||
my $session = shift || $Foswiki::Plugins::SESSION; | ||
|
||
my $this = bless($class->SUPER::new( | ||
$session, | ||
name => 'jsoneditor', | ||
version => '0.0.1', | ||
author => 'The Author of the JQuery plugin', | ||
homepage => 'jq module\'s URL', | ||
documentation => "$Foswiki::cfg{SystemWebName}.JQueryJSONEditor", | ||
puburl => '%PUBURLPATH%/%SYSTEMWEB%/JQueryExtrasPlugin/jsoneditor', | ||
javascript => ['jquery.jsoneditor.js'] | ||
), $class); | ||
|
||
return $this; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Release manifest for JSONEditorJQueryPlugin | ||
data/System/JSONEditorJQueryPlugin.txt 0644 Documentation | ||
lib/Foswiki/Plugins/JSONEditorJQueryPlugin.pm 0644 Perl module | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/perl -w | ||
BEGIN { unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} ); } | ||
use Foswiki::Contrib::Build; | ||
|
||
# Create the build object | ||
$build = new Foswiki::Contrib::Build('JSONEditorJQueryPlugin'); | ||
|
||
# (Optional) Set the details of the repository for uploads. | ||
# This can be any web on any accessible Foswiki installation. | ||
# These defaults will be used when expanding tokens in .txt | ||
# files, but be warned, they can be overridden at upload time! | ||
|
||
# name of web to upload to | ||
$build->{UPLOADTARGETWEB} = 'Extensions'; | ||
# Full URL of pub directory | ||
$build->{UPLOADTARGETPUB} = 'http://foswiki.org/pub'; | ||
# Full URL of bin directory | ||
$build->{UPLOADTARGETSCRIPT} = 'http://foswiki.org/bin'; | ||
# Script extension | ||
$build->{UPLOADTARGETSUFFIX} = ''; | ||
|
||
# Build the target on the command line, or the default target | ||
$build->build($build->{target}); | ||
|