Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.foswiki.org/trunk/MoreFormfieldsContrib@9319 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
MichaelDaum
authored and
MichaelDaum
committed
Sep 23, 2010
0 parents
commit 764620a
Showing
12 changed files
with
427 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,39 @@ | ||
---+!! %TOPIC% | ||
%SHORTDESCRIPTION% | ||
|
||
%TOC% | ||
|
||
This plugin implements a set of additional special purpose formfields to be used in [[%SYSTEMWEB%.DataForms][DataForm]] definitions. | ||
|
||
These are: | ||
|
||
* =ipaddress=: a general purpose IP4 address, consisting of 4 octets, e.g. =10.0.0.1= | ||
* =netmask=: a special IP address used for routing, consisting of 4 octets, e.g. =255.255.255.0= | ||
* =macaddress=: a hardware address given in 6 hex values, e.g. =00:1a:10:6f:ba:12= | ||
|
||
---++ !ExampleForm definition | ||
|
||
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* | | ||
| <nop>IpAddress | ipaddress | 15 | | network address | M | | ||
| Netmask | netmask | 15 | | netmask | | | ||
| <nop>MacAddress | macaddress | 17 | | hardware-addresse | | | ||
|
||
---++ Installation Instructions | ||
|
||
%$INSTALL_INSTRUCTIONS% | ||
|
||
---++ Info | ||
<!-- | ||
* Set SHORTDESCRIPTION = Additionall formfield types for !DataForms | ||
--> | ||
|
||
| Author(s): | Michael Daum| | ||
| Copyright: | © 2010 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 --> | | ||
| 23 Sep 2010: | initial release | | ||
| Dependencies: | %$DEPENDENCIES% | | ||
| Home page: | Foswiki:Extensions/%TOPIC% | | ||
| Support: | Foswiki:Support/%TOPIC% | |
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,21 @@ | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# | ||
# MoreFormfieldsContrib is Copyright (C) 2010 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::Contrib::MoreFormfieldsContrib; | ||
our $VERSION = '$Rev$'; | ||
our $RELEASE = '0.01'; | ||
our $SHORTDESCRIPTION = 'Additionall formfield types for %SYSTEMWEB%.DataForms'; | ||
|
||
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 @@ | ||
Foswiki::Plugins::JQueryPlugin,>3.31,perl,Required |
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,16 @@ | ||
data/System/MoreFormfieldsContrib.txt 0644 | ||
lib/Foswiki/Contrib/MoreFormfieldsContrib.pm 0644 | ||
lib/Foswiki/Form/Ipaddress.pm 0644 | ||
lib/Foswiki/Form/Macaddress.pm 0644 | ||
lib/Foswiki/Form/Netmask.pm 0644 | ||
lib/Foswiki/Form/NetworkAddressField.pm 0644 | ||
pub/System/MoreFormfieldsContrib/Makefile 0644 | ||
pub/System/MoreFormfieldsContrib/moreformfields.css 0644 | ||
pub/System/MoreFormfieldsContrib/moreformfields.css.gz 0644 | ||
pub/System/MoreFormfieldsContrib/moreformfields.uncompressed.css 0644 | ||
pub/System/MoreFormfieldsContrib/networkaddress.js 0644 | ||
pub/System/MoreFormfieldsContrib/networkaddress.js.gz 0644 | ||
pub/System/MoreFormfieldsContrib/networkaddress.uncompressed.js 0644 | ||
pub/System/MoreFormfieldsContrib/validate.js 0644 | ||
pub/System/MoreFormfieldsContrib/validate.js.gz 0644 | ||
pub/System/MoreFormfieldsContrib/validate.uncompressed.js 0644 |
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('MoreFormfieldsContrib'); | ||
|
||
# (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}); | ||
|
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,31 @@ | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# | ||
# MoreFormfieldsContrib is Copyright (C) 2010 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::Form::Ipaddress; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Foswiki::Form::NetworkAddressField (); | ||
our @ISA = ('Foswiki::Form::NetworkAddressField'); | ||
|
||
sub new { | ||
my $class = shift; | ||
my $this = $class->SUPER::new(@_); | ||
$this->{_class} = 'foswikiIpAddress'; | ||
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,31 @@ | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# | ||
# MoreFormfieldsContrib is Copyright (C) 2010 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::Form::Macaddress; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Foswiki::Form::NetworkAddressField (); | ||
our @ISA = ('Foswiki::Form::NetworkAddressField'); | ||
|
||
sub new { | ||
my $class = shift; | ||
my $this = $class->SUPER::new(@_); | ||
$this->{_class} = 'foswikiMacAddress'; | ||
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,32 @@ | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# | ||
# MoreFormfieldsContrib is Copyright (C) 2010 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::Form::Netmask; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Foswiki::Form::NetworkAddressField (); | ||
our @ISA = ('Foswiki::Form::NetworkAddressField'); | ||
|
||
sub new { | ||
my $class = shift; | ||
my $this = $class->SUPER::new(@_); | ||
$this->{_class} = 'foswikiNetmask'; | ||
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,101 @@ | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# | ||
# MoreFormfieldsContrib is Copyright (C) 2010 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::Form::NetworkAddressField; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Foswiki::Form::Text (); | ||
use Foswiki::Plugins::JQueryPlugin (); | ||
our @ISA = ('Foswiki::Form::Text'); | ||
|
||
sub addJavascript { | ||
#my $this = shift; | ||
Foswiki::Func::addToZone("script", | ||
"MOREFORMFIELDSCONTRIB::IPADDRESS::JS", | ||
"<script src='%PUBURLPATH%/%SYSTEMWEB%/MoreFormfieldsContrib/networkaddress.js'></script>", | ||
"JQUERYPLUGIN::FOSWIKI, JQUERYPLUGIN::LIVEQUERY, JQUERYPLUGIN::VALIDATE"); | ||
|
||
if ($Foswiki::cfg{Plugins}{MoreFormfieldsContrib}{Debug}) { | ||
Foswiki::Plugins::JQueryPlugin::createPlugin("debug"); | ||
} | ||
|
||
} | ||
|
||
sub addStyles { | ||
#my $this = shift; | ||
Foswiki::Func::addToZone("head", | ||
"MOREFORMFIELDSCONTRIB::IPADDRESS::CSS", | ||
"<link rel='stylesheet' media='all' href='%PUBURLPATH%/%SYSTEMWEB%/MoreFormfieldsContrib/moreformfields.css' />"); | ||
|
||
} | ||
|
||
sub renderForEdit { | ||
my $this = shift; | ||
|
||
# get args in a backwards compatible manor: | ||
my $metaOrWeb = shift; | ||
|
||
my $meta; | ||
my $web; | ||
my $topic; | ||
|
||
if (ref($metaOrWeb)) { | ||
# new: $this, $meta, $value | ||
$meta = $metaOrWeb; | ||
$web = $meta->web; | ||
$topic = $meta->topic; | ||
} else { | ||
# old: $this, $web, $topic, $value | ||
$web = $metaOrWeb; | ||
$topic = shift; | ||
($meta, undef) = Foswiki::Func::readTopic($web, $topic); | ||
} | ||
|
||
my $value = shift; | ||
|
||
$this->addJavascript(); | ||
$this->addStyles(); | ||
|
||
my $required = ''; | ||
if ($this->{attributes} =~ /\bM\b/i) { | ||
$required = 'required'; | ||
} | ||
|
||
return ( | ||
'', | ||
CGI::textfield( | ||
-class => $this->cssClasses('foswikiInputField', $this->{_class}, $required), | ||
-name => $this->{name}, | ||
-size => $this->{size}, | ||
-value => $value | ||
) | ||
); | ||
} | ||
|
||
sub renderForDisplay { | ||
my ($this, $format, $value, $attrs) = @_; | ||
|
||
my $result = "<div class='" . $this->{_class} . "'>$value</div>"; | ||
$format =~ s/\$value/$result/g; | ||
|
||
$this->addStyles(); | ||
|
||
return $this->SUPER::renderForDisplay($format, $value, $attrs); | ||
} | ||
|
||
|
||
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,6 @@ | ||
FOSWIKI_ROOT?=~/foswiki/trunk/core | ||
TARGET= \ | ||
moreformfields.css \ | ||
networkaddress.js | ||
|
||
-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include |
5 changes: 5 additions & 0 deletions
5
pub/System/MoreFormfieldsContrib/moreformfields.uncompressed.css
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 @@ | ||
.foswikiIpAddress, | ||
.foswikiNetmask, | ||
.foswikiMacAddress { | ||
font-family:monospace; | ||
} |
Oops, something went wrong.