diff --git a/data/TWiki/FormPlugin.txt b/data/System/FormPlugin.txt similarity index 92% rename from data/TWiki/FormPlugin.txt rename to data/System/FormPlugin.txt index 2a73d15..a9d7340 100644 --- a/data/TWiki/FormPlugin.txt +++ b/data/System/FormPlugin.txt @@ -2,8 +2,6 @@ %IF{"defined Name and $ Name != ''" then="---+!! Hello %URLPARAM{"Name"}%!" else="---+!! Form Plugin"}% *Lets you create simple and advanced web forms.* -*Note:* for TWiki versions before 4.2, form POSTs are converted to GETs. This means that all form values will be visible in the browser url, and that there is a limit to the amount of data sent. - %TOC% ---++ Main features @@ -11,7 +9,7 @@ * Add input fields, textareas, dropdown select boxes, checkboxes, radio buttons * Set preselected values * Create a uniform layout - * Call TWiki scripts (view, edit, upload, save) or custom scripts + * Call Foswiki scripts (view, edit, upload, save) or custom scripts * Use entered field values as variables * Validate the form before it performs its action * Usability tested error feedback @@ -19,7 +17,7 @@ Example of validation error feedback: -
Example of validation error feedback
+
Example of validation error feedback
---++ Introduction @@ -135,8 +133,8 @@ Most parameters are optional. See below for a detailed explanation. | =anchor= | The anchor link the form should be linked to after submission. If not set the default notification anchor link is used to directly point to possible problems. |- |=FormPluginNotification= | =anchor="MyForm"= | | =method= | GET or POST ([[http://www.cs.tut.fi/~jkorpela/forms/methods.html][What's the difference?]]) |- | =GET= | =method="POST"= | | =redirectto= | Redirect topic after form action has been performed. Only for scripts that understand the =redirectto= parameter such as =edit= and =save=. Use the =Webname.TopicName= syntax. |- |- | =redirectto="Main.WebHome"= | -| =formcssclass= | The CSS class of the form container. Use TWiki's =twikiFormSteps= class together with =twikiFormStep= for elements to divide the form in steps. |- |- | =formcssclass="twikiFormSteps"= | -| =elementcssclass= | The CSS class of the element container. Use TWiki's =twikiFormStep= class to divide the form in steps. |- |- | =elementcssclass="twikiFormStep"= | +| =formcssclass= | The CSS class of the form container. Use CSS classes =foswikiFormSteps= and =foswikiFormStep= for elements to divide the form in steps. |- |- | =formcssclass="foswikiFormSteps"= | +| =elementcssclass= | The CSS class of the element container. Use CSS class =foswikiFormStep= class to divide the form in steps. |- |- | =elementcssclass="foswikiFormStep"= | | =noformhtml= | When set to =on= no form html will be written to the page. This is useful to set form parameters for form elements that use a different form, for instance with Foswiki:Extensions.CommentPlugin. |- |- | =noformhtml="on"= | | =onSubmit= | Function call that is invoked when the user has pressed the submit button of a form. This event happens just before the form is submitted, and your function can return a value of false in order to abort the submission. Note that the function call should include =(this)=. |- |- | =onSubmit="return notify(this)"= | @@ -191,7 +189,7 @@ Use =%URLPARAM{"element_name"}%= to retrieve the value of a submitted form | =format= | See [[#Formatting][Formatting]] below. |||| | =fieldformat= | See [[#Formatting][Formatting]] below. |||| | =titleformat= | See [[#Formatting][Formatting]] below. |||| -| =cssclass= | CSS class for the element |- |TWiki CSS classes: =twikiInputField=, =twikiSubmit= | =cssclass="myButtonClass"= | +| =cssclass= | CSS class for the element |- |CSS classes: =foswikiInputField=, =foswikiSubmit= | =cssclass="myButtonClass"= | | =size= | For =type="text"= or =type="password"=: the width of the input field measured in number of characters. |- |=40= | =size="60"= | | =maxlength= | For =type="text"= or =type="password"=: the maximum number of input characters. |- |- | =maxlength="12"= | | =rows= | For =type="textarea"=: the number of rows. |- |- | =rows="5"= | @@ -331,7 +329,7 @@ A !FormPlugin form is first processed before it is sent to its action target. Pr 1 Substitution of field references. 1 Validation -
+
---+++ Substitution of field references This allows to use entered field values as variables. For example: @@ -351,7 +349,7 @@ See [[Sandbox.FormPluginExamples]] ---+++ Upload form -A TWiki upload form to attach a file to a topic should contain these parameters: +An upload form to attach a file to a topic should contain these parameters: * STARTFORM param =action="upload"= * STARTFORM param =topic= and =web=, or use the more compact =topic="Web.TopicName"= format * STARTFORM param =method="POST"= @@ -443,35 +441,34 @@ Plugin settings are stored as preferences variables. To reference a plugin setti ---++ Plugin Installation Instructions -__Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running. +*Note:* You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where Foswiki is running. * Download the ZIP file from the Plugin web (see below) - * Unzip ==%TOPIC%.zip== in your twiki installation directory. Content: + * Unzip ==%TOPIC%.zip== in your installation directory. Content: | *File:* | *Description:* | - | ==data/TWiki/FormPlugin.txt== | Plugin topic | + | ==data/System/FormPlugin.txt== | Plugin topic | | ==data/Sandbox/FormPluginExamples.txt== | Working examples | | ==lib/Foswiki/Plugins/FormPlugin.pm== | Plugin Perl module | | ==lib/Foswiki/Plugins/FormPlugin/Validate.pm== | Plugin Perl module for form validation | - | ==pub/TWiki/FormPlugin/formplugin.css== | Style Sheet | - | ==pub/TWiki/FormPlugin/error.gif== | Error icon | + | ==pub/System/FormPlugin/formplugin.css== | Style Sheet | + | ==pub/System/FormPlugin/error.gif== | Error icon | ---++ Plugin Info -| Plugin Author: | TWiki:Main.ArthurClemens | +| Copyright: | © Arthur Clemens | | Other authors: | =Validate.pm=, originally =CGI::Validate= by Zenin aka Byron Brummer . Copyright (c) 1997,1998 OMIX, Inc. All rights reserved. Use is granted under the same terms of Perl. | -| Plugin Version: | 08 Mar 2007 (V1.2) | +| Plugin Version: | 07 Jan 2009 (V1.3) | | Change History: |   | +| 07 Jan 2009 | 1.3 Foswiki release. | | 08 Mar 2008 | 1.2 Added =condition=, =noformhtml= and =dateformat= attributes. | | 19 Oct 2007 | 1.1 Added =date= type. | -| 09 Jun 2007 | 1.0.5 Added upload parameter; option to turn off form validation; custom javascript has been replaced by code in =pub/TWiki/JavascriptFiles/foswikiForm.js=; added Flickr example. | +| 09 Jun 2007 | 1.0.5 Added upload parameter; option to turn off form validation; custom javascript has been replaced by code in =pub/System/JavascriptFiles/foswikiForm.js=; added Flickr example. | | 27 May 2007 | 1.0.4 Update javascript calls to new =foswikiForm.js=. | | 19 May 2007 | 1.0.3 Added element attributes: =focus=, =disabled=, =readonly=; Javascript parameters =beforeclick=, =onFocus=, =onBlur=, =onMouseOver=, =onMouseOut=, =onSelect=, =onChange=, =onClick=, =onKeyUp=; form parameter =onSubmit=. Fallback for form POSTs and TWiki versions earlier than 4.2: POST requests are converted to GET requests. | | 15 May 2007 | 1.0.2 Added form attribute =elementformat=; changed parameter names for consistency: =class= to =cssclass=, =elementformat= to =fieldformat=. | -| 14 May 2007 | 1.0.1 Added missing lib. | | 13 May 2007 | 1.0 First release. | -| TWiki Dependency: | TWiki 4.2; $TWiki::Plugins::VERSION 1.1 | | CPAN Dependencies: |- | | Other Dependencies: |- | | Perl Version: | 5.005 | diff --git a/lib/TWiki/Plugins/FormPlugin.pm b/lib/Foswiki/Plugins/FormPlugin.pm similarity index 90% rename from lib/TWiki/Plugins/FormPlugin.pm rename to lib/Foswiki/Plugins/FormPlugin.pm index 99f4781..5be0350 100644 --- a/lib/TWiki/Plugins/FormPlugin.pm +++ b/lib/Foswiki/Plugins/FormPlugin.pm @@ -15,27 +15,24 @@ # 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 TWiki root. +# For licensing info read LICENSE file in the installation root. -package TWiki::Plugins::FormPlugin; +package Foswiki::Plugins::FormPlugin; # Always use strict to enforce variable scoping use strict; -use TWiki::Func; +use Foswiki::Func; use CGI qw( :all ); -#use TWiki::Plugins::FormPlugin::Validate qw(CheckFormData); -#use CGI::Validate qw(:vars); - -# $VERSION is referred to by TWiki, and is the only global variable that +# $VERSION is referred to by Foswiki, and is the only global variable that # *must* exist in this package use vars qw( $VERSION $RELEASE $debug $pluginName $installWeb); use vars qw( $currentTopic $currentWeb $defaultFormat $defaultHiddenFieldFormat $defaultTitleFormat %expandedForms %substitutedForms %uncheckedForms %validatedForms %errorForms %noErrorForms %errorFields $headerDone %currentForm $elementcssclass); -# This should always be $Rev: 11069$ so that TWiki can determine the checked-in +# This should always be $Rev: 11069$ so that Foswiki can determine the checked-in # status of the plugin. It is used by the build automation tools, so # you should leave it alone. $VERSION = '$Rev: 11069$'; @@ -110,7 +107,7 @@ my $TITLE_CSS_CLASS = 'formPluginTitle'; my $HINT_CSS_CLASS = 'formPluginHint'; my $MANDATORY_CSS_CLASS = 'formPluginMandatory'; my $MANDATORY_STRING = '*'; -my $BEFORE_CLICK_CSS_CLASS = 'twikiInputFieldBeforeClick'; +my $BEFORE_CLICK_CSS_CLASS = 'foswikiInputFieldBeforeClick'; =pod @@ -120,8 +117,8 @@ sub initPlugin { my ( $topic, $web, $user, $installWeb ) = @_; # check for Plugins.pm versions - if ( $TWiki::Plugins::VERSION < 1.026 ) { - TWiki::Func::writeWarning( + if ( $Foswiki::Plugins::VERSION < 1.026 ) { + Foswiki::Func::writeWarning( "Version mismatch between $pluginName and Plugins.pm"); return 0; } @@ -129,13 +126,13 @@ sub initPlugin { $currentTopic = $topic if !$currentTopic; $currentWeb = $web if !$currentWeb; - $debug = TWiki::Func::getPluginPreferencesFlag("DEBUG") - || TWiki::Func::getPreferencesFlag("DEBUG"); + $debug = Foswiki::Func::getPluginPreferencesFlag("DEBUG") + || Foswiki::Func::getPreferencesFlag("DEBUG"); - TWiki::Func::registerTagHandler( 'STARTFORM', \&_startForm ); - TWiki::Func::registerTagHandler( 'ENDFORM', \&_endForm ); - TWiki::Func::registerTagHandler( 'FORMELEMENT', \&_formElement ); - TWiki::Func::registerTagHandler( 'FORMSTATUS', \&_formStatus ); + Foswiki::Func::registerTagHandler( 'STARTFORM', \&_startForm ); + Foswiki::Func::registerTagHandler( 'ENDFORM', \&_endForm ); + Foswiki::Func::registerTagHandler( 'FORMELEMENT', \&_formElement ); + Foswiki::Func::registerTagHandler( 'FORMSTATUS', \&_formStatus ); # Plugin correctly initialized return 1; @@ -156,7 +153,7 @@ sub beforeCommonTagsHandler { # do not uncomment, use $_[0], $_[1]... instead ### my ( $text, $topic, $web ) = @_; - my $query = TWiki::Func::getCgiQuery(); + my $query = Foswiki::Func::getCgiQuery(); my $submittedFormName = $query->param($FORM_SUBMIT_TAG); # form name is stored in submit if ($submittedFormName) { @@ -210,7 +207,7 @@ by the value of the field with name 'about'. sub _substituteFieldTokens { - my $query = TWiki::Func::getCgiQuery(); + my $query = Foswiki::Func::getCgiQuery(); # create quick lookup hash my @names = $query->param; @@ -270,7 +267,7 @@ sub _meetsCondition { \%validateFields ); _validateFormFields(%validateFields); - if (@TWiki::Plugins::FormPlugin::Validate::ErrorFields) { + if (@Foswiki::Plugins::FormPlugin::Validate::ErrorFields) { return ( $referencedField, 0 ); } return ( $referencedField, 1 ); @@ -339,7 +336,7 @@ sub _addHeader { END - TWiki::Func::addToHEAD( 'FORMPLUGIN', $header ); + Foswiki::Func::addToHEAD( 'FORMPLUGIN', $header ); $headerDone = 1; } @@ -365,7 +362,7 @@ sub _startForm { $expandedForms{$name} = 1; # check if the submitted form is the form at hand - my $query = TWiki::Func::getCgiQuery(); + my $query = Foswiki::Func::getCgiQuery(); my $submittedFormName = $query->param($FORM_SUBMIT_TAG); if ( $submittedFormName && $name eq $submittedFormName ) { @@ -384,7 +381,7 @@ sub _startForm { # do not delete param $FORM_SUBMIT_TAG as we might want to know if this form is validated my $method = _method( $params->{'method'} ); - if ( $method eq 'POST' && $TWiki::Plugins::VERSION < 1.2 ) { + if ( $method eq 'POST' && $Foswiki::Plugins::VERSION < 1.2 ) { # on previous versions redirecting a POST does not work # because the request is changed to a GET @@ -395,16 +392,16 @@ sub _startForm { # we now have a url param # delete original POST data $query->delete_all(); - TWiki::Func::writeDebug( + Foswiki::Func::writeDebug( "FormPlugin - POST and Plugins::VERSION < 1.2 -- converting all key-values to a parameter string: actionUrl=" . $actionUrl ) if $debug; - TWiki::Func::redirectCgiQuery( undef, $actionUrl ); + Foswiki::Func::redirectCgiQuery( undef, $actionUrl ); return; } # else - TWiki::Func::redirectCgiQuery( undef, $actionUrl, 1 ); + Foswiki::Func::redirectCgiQuery( undef, $actionUrl, 1 ); return ''; } } @@ -415,51 +412,19 @@ sub _startForm { =pod -Code taken from TWiki.pm - -=cut - -sub _isRedirectSafe { - my $redirect = shift; - - #TODO: this should really use URI - if ( ( !$TWiki::cfg{AllowRedirectUrl} ) - && ( $redirect =~ m!^([^:]*://[^/]*)/*(.*)?$! ) ) - { - my $host = $1; - - #remove trailing /'s to match - $TWiki::cfg{DefaultUrlHost} =~ m!^([^:]*://[^/]*)/*(.*)?$!; - my $expected = $1; - - if ( defined( $TWiki::cfg{PermittedRedirectHostUrls} ) - && $TWiki::cfg{PermittedRedirectHostUrls} ne '' ) - { - my @permitted = - map { s!^([^:]*://[^/]*)/*(.*)?$!$1!; $1 } - split( /,\s*/, $TWiki::cfg{PermittedRedirectHostUrls} ); - return 1 if ( grep ( { uc($host) eq uc($_) } @permitted ) ); - } - return ( uc($host) eq uc($expected) ); - } - return 1; -} - -=pod - Returns 1 when validation is ok; 0 if an error has been found. =cut sub _validateForm { - eval 'use TWiki::Plugins::FormPlugin::Validate'; + eval 'use Foswiki::Plugins::FormPlugin::Validate'; # Some fields might need to be validated # this is set with parameter =validate="s"= in %FORMELEMENT% # during parsing of %FORMELEMENT% this has been converted to # a new hidden field $VALIDATE_TAG_fieldname - my $query = TWiki::Func::getCgiQuery(); + my $query = Foswiki::Func::getCgiQuery(); my @names = $query->param; my %validateFields = (); @@ -483,10 +448,10 @@ sub _validateForm { return 1 if !keys %validateFields; _validateFormFields(%validateFields); - if (@TWiki::Plugins::FormPlugin::Validate::ErrorFields) { + if (@Foswiki::Plugins::FormPlugin::Validate::ErrorFields) { # store field name refs - for my $href (@TWiki::Plugins::FormPlugin::Validate::ErrorFields) { + for my $href (@Foswiki::Plugins::FormPlugin::Validate::ErrorFields) { my $fieldNameForRef = $href->{'field'}; $errorFields{$fieldNameForRef} = 1; } @@ -529,19 +494,19 @@ Returns 1 when validation is ok; 0 if an error has been found. sub _validateFormFields { my (%fields) = @_; - eval 'use TWiki::Plugins::FormPlugin::Validate'; + eval 'use Foswiki::Plugins::FormPlugin::Validate'; # allow some fields not to be validated # otherwise we get errors on hidden fields we have inserted ourselves - $TWiki::Plugins::FormPlugin::Validate::IgnoreNonMatchingFields = 1; + $Foswiki::Plugins::FormPlugin::Validate::IgnoreNonMatchingFields = 1; # not need to check for all form elements - $TWiki::Plugins::FormPlugin::Validate::Complete = 1; + $Foswiki::Plugins::FormPlugin::Validate::Complete = 1; # test fields - TWiki::Plugins::FormPlugin::Validate::GetFormData(%fields); + Foswiki::Plugins::FormPlugin::Validate::GetFormData(%fields); - if ($TWiki::Plugins::FormPlugin::Validate::Error) { + if ($Foswiki::Plugins::FormPlugin::Validate::Error) { return 0; } @@ -555,11 +520,11 @@ sub _validateFormFields { sub _displayErrors { my ( $session, $params, $topic, $web ) = @_; - if (@TWiki::Plugins::FormPlugin::Validate::ErrorFields) { + if (@Foswiki::Plugins::FormPlugin::Validate::ErrorFields) { my $note = " *Some fields are not filled in correctly:* "; my @sortedErrorFields = sort { $a->{order} cmp $b->{order} } - @TWiki::Plugins::FormPlugin::Validate::ErrorFields; + @Foswiki::Plugins::FormPlugin::Validate::ErrorFields; for my $href (@sortedErrorFields) { my $errorType = $href->{'type'}; my $fieldName = $href->{'field'}; @@ -590,7 +555,7 @@ With POST, ignores url parameters. sub _currentUrl { my ( $session, $params, $topic, $web ) = @_; - my $query = TWiki::Func::getCgiQuery(); + my $query = Foswiki::Func::getCgiQuery(); my $currentUrl = $query->url() . $query->path_info(); return $currentUrl; } @@ -628,7 +593,7 @@ sub _displayForm { $currentForm{'name'} = $name; $currentForm{'elementformat'} = $params->{'elementformat'} || ''; - my $noFormHtml = TWiki::Func::isTrue( $params->{'noformhtml'} || '' ); + my $noFormHtml = Foswiki::Func::isTrue( $params->{'noformhtml'} || '' ); if ($noFormHtml) { $currentForm{'noFormHtml'} = 1; return ''; @@ -636,7 +601,7 @@ sub _displayForm { if ($topicParam) { ( $web, $topic ) = - TWiki::Func::normalizeWebTopicName( $webParam, $topicParam ); + Foswiki::Func::normalizeWebTopicName( $webParam, $topicParam ); } else { $web = $currentWeb; @@ -734,7 +699,7 @@ Lifted out: my %status = _status($formName); return '' unless isTrue( $status{$conditionStatus} ); - my $query = TWiki::Func::getCgiQuery(); + my $query = Foswiki::Func::getCgiQuery(); my $default = $params->{'default'}; $query->param( -name => $name, -value => $default ); } @@ -798,7 +763,7 @@ sub _formElement { $format =~ s/(\$e\b)/$1$javascriptCalls/go; my $mandatoryParam = $params->{'mandatory'}; - my $isMandatory = isTrue( $mandatoryParam, 0 ); + my $isMandatory = Foswiki::Func::isTrue( $mandatoryParam, 0 ); my $mandatory = $isMandatory ? _wrapHtmlMandatoryContainer($MANDATORY_STRING) : ''; @@ -1117,11 +1082,11 @@ sub _textfieldAttributes { %attributes = ( %attributes, %extraAttributes ); my $cssClass = $attributes{'class'} || ''; - $cssClass = 'twikiInputFieldDisabled' + $cssClass = 'foswikiInputFieldDisabled' if ( !$cssClass && $attributes{'disabled'} ); - $cssClass = 'twikiInputFieldReadOnly' + $cssClass = 'foswikiInputFieldReadOnly' if ( !$cssClass && $attributes{'readonly'} ); - $cssClass ||= 'twikiInputField'; + $cssClass ||= 'foswikiInputField'; $cssClass = _normalizeCssClassName($cssClass); $attributes{'class'} = $cssClass if $cssClass; @@ -1154,9 +1119,9 @@ sub _getSubmitButtonHtml { %attributes = ( %attributes, %extraAttributes ); my $cssClass = $attributes{'class'} || ''; - $cssClass = 'twikiSubmitDisabled' + $cssClass = 'foswikiSubmitDisabled' if ( !$cssClass && $attributes{'disabled'} ); - $cssClass ||= 'twikiSubmit'; + $cssClass ||= 'foswikiSubmit'; $cssClass = _normalizeCssClassName($cssClass); $attributes{'class'} = $cssClass if $cssClass; return CGI::submit(%attributes); @@ -1178,11 +1143,11 @@ sub _getTextareaHtml { %attributes = ( %attributes, %extraAttributes ); my $cssClass = $attributes{'class'} || ''; - $cssClass = 'twikiInputFieldDisabled' + $cssClass = 'foswikiInputFieldDisabled' if ( !$cssClass && $attributes{'disabled'} ); - $cssClass = 'twikiInputFieldReadOnly' + $cssClass = 'foswikiInputFieldReadOnly' if ( !$cssClass && $attributes{'readonly'} ); - $cssClass ||= 'twikiInputField'; + $cssClass ||= 'foswikiInputField'; $cssClass = _normalizeCssClassName($cssClass); $attributes{'class'} = $cssClass if $cssClass; @@ -1225,7 +1190,7 @@ sub _getCheckboxButtonGroupHtml { %attributes = ( %attributes, %extraAttributes ); my $cssClass = $attributes{'class'} || ''; - $cssClass = 'twikiCheckbox ' . $cssClass; + $cssClass = 'foswikiCheckbox ' . $cssClass; $cssClass = _normalizeCssClassName($cssClass); $attributes{'-class'} = $cssClass if $cssClass; @@ -1273,7 +1238,7 @@ sub _getRadioButtonGroupHtml { %attributes = ( %attributes, %extraAttributes ); my $cssClass = $attributes{'class'} || ''; - $cssClass = 'twikiInputFieldDisabled' + $cssClass = 'foswikiInputFieldDisabled' if ( !$cssClass && $attributes{'disabled'} ); $cssClass = 'foswikiRadioButton ' . $cssClass; $cssClass = _normalizeCssClassName($cssClass); @@ -1343,7 +1308,7 @@ sub _getSelectHtml { my $cssClass = $attributes{'class'} || ''; $cssClass = 'foswikiSelectDisabled' if ( !$cssClass && $attributes{'disabled'} ); - $cssClass = 'twikiSelect ' . $cssClass; + $cssClass = 'foswikiSelect ' . $cssClass; $cssClass = _normalizeCssClassName($cssClass); $attributes{'-class'} = $cssClass if $cssClass; @@ -1368,28 +1333,28 @@ sub _getDateFieldHtml { my $text = CGI::textfield(%attributes); - eval 'use TWiki::Contrib::JSCalendarContrib'; + eval 'use Foswiki::Contrib::JSCalendarContrib'; { if ($@) { my $mess = "WARNING: JSCalendar not installed: $@"; print STDERR "$mess\n"; - TWiki::Func::writeWarning($mess); + Foswiki::Func::writeWarning($mess); } else { - TWiki::Contrib::JSCalendarContrib::addHEAD('twiki'); + Foswiki::Contrib::JSCalendarContrib::addHEAD('foswiki'); my $format = $dateFormat - || $TWiki::cfg{JSCalendarContrib}{format} + || $Foswiki::cfg{JSCalendarContrib}{format} || "%e %B %Y"; - $text .= ' '; + $text .= ' '; my $control = CGI::image_button( -class => 'editTableCalendarButton', -name => 'calendar', -onclick => "return showCalendar('$id','$format')", - -src => TWiki::Func::getPubUrlPath() . '/' - . TWiki::Func::getTwikiWebname() + -src => Foswiki::Func::getPubUrlPath() . '/' + . $Foswiki::cfg{SystemWebName} . '/JSCalendarContrib/img.gif', -alt => 'Calendar', -align => 'middle' @@ -1597,27 +1562,7 @@ Shorthand function call. =cut sub _debug { - TWiki::Func::writeDebug(@_); -} - -=pod - -Copied from TWiki.pm. Interface is available in Func.pm but is too new yet. - -=cut - -sub isTrue { - my ( $value, $default ) = @_; - - $default ||= 0; - - return $default unless defined($value); - - $value =~ s/^\s*(.*?)\s*$/$1/gi; - $value =~ s/off//gi; - $value =~ s/no//gi; - $value =~ s/false//gi; - return ($value) ? 1 : 0; + Foswiki::Func::writeDebug(@_); } =pod @@ -1628,7 +1573,7 @@ Creates a url param string from POST data. sub _postDataToUrlParamString { my $out = ''; - my $query = TWiki::Func::getCgiQuery(); + my $query = Foswiki::Func::getCgiQuery(); my @names = $query->param; foreach (@names) { my $name = $_; @@ -1643,7 +1588,7 @@ sub _postDataToUrlParamString { =pod -Copied from TWiki.pm +Copied from Foswiki.pm =cut diff --git a/lib/TWiki/Plugins/FormPlugin/DEPENDENCIES b/lib/Foswiki/Plugins/FormPlugin/DEPENDENCIES similarity index 100% rename from lib/TWiki/Plugins/FormPlugin/DEPENDENCIES rename to lib/Foswiki/Plugins/FormPlugin/DEPENDENCIES diff --git a/lib/Foswiki/Plugins/FormPlugin/MANIFEST b/lib/Foswiki/Plugins/FormPlugin/MANIFEST new file mode 100644 index 0000000..d01c69a --- /dev/null +++ b/lib/Foswiki/Plugins/FormPlugin/MANIFEST @@ -0,0 +1,8 @@ +data/System/FormPlugin.txt 0644 Documentation +data/Sandbox/FormPluginExamples.txt 0644 Documentation examples +lib/Foswiki/Plugins/FormPlugin.pm 0644 Perl module +lib/Foswiki/Plugins/FormPlugin/Validate.pm 0644 Perl module +pub/System/FormPlugin/formplugin.css 0644 CSS styles +pub/System/FormPlugin/form_on_submit_diagram.png 0644 Illustration +pub/System/FormPlugin/error.gif 0644 Icon +pub/System/FormPlugin/screenshot_validation_example.png 0644 Example screenshot diff --git a/lib/TWiki/Plugins/FormPlugin/Validate.pm b/lib/Foswiki/Plugins/FormPlugin/Validate.pm similarity index 99% rename from lib/TWiki/Plugins/FormPlugin/Validate.pm rename to lib/Foswiki/Plugins/FormPlugin/Validate.pm index 7d9c67d..8b69dad 100644 --- a/lib/TWiki/Plugins/FormPlugin/Validate.pm +++ b/lib/Foswiki/Plugins/FormPlugin/Validate.pm @@ -1,9 +1,9 @@ -package TWiki::Plugins::FormPlugin::Validate; +package Foswiki::Plugins::FormPlugin::Validate; =pod Changes for %SYSTEMWEB%.FormPlugin: -- changed package name from CGI::Validate to TWiki::Plugins::FormPlugin::Validate +- changed package name from CGI::Validate to Foswiki::Plugins::FormPlugin::Validate - added an order parameter - created array ErrorFields to collect all error fields with data structure: - field diff --git a/lib/TWiki/Plugins/FormPlugin/build.pl b/lib/Foswiki/Plugins/FormPlugin/build.pl similarity index 75% rename from lib/TWiki/Plugins/FormPlugin/build.pl rename to lib/Foswiki/Plugins/FormPlugin/build.pl index 5b4a729..2f45658 100755 --- a/lib/TWiki/Plugins/FormPlugin/build.pl +++ b/lib/Foswiki/Plugins/FormPlugin/build.pl @@ -8,10 +8,10 @@ BEGIN } } -use TWiki::Contrib::Build; +use Foswiki::Contrib::Build; # Create the build object -$build = new TWiki::Contrib::Build( 'FormPlugin' ); +$build = new Foswiki::Contrib::Build( 'FormPlugin' ); # Build the target on the command line, or the default target $build->build($build->{target}); diff --git a/lib/TWiki/Plugins/FormPlugin/MANIFEST b/lib/TWiki/Plugins/FormPlugin/MANIFEST deleted file mode 100644 index fcb27b5..0000000 --- a/lib/TWiki/Plugins/FormPlugin/MANIFEST +++ /dev/null @@ -1,8 +0,0 @@ -data/TWiki/FormPlugin.txt 0644 Documentation -data/Sandbox/FormPluginExamples.txt 0644 Documentation examples -lib/TWiki/Plugins/FormPlugin.pm 0644 Perl module -lib/TWiki/Plugins/FormPlugin/Validate.pm 0644 Perl module -pub/TWiki/FormPlugin/formplugin.css 0644 CSS styles -pub/TWiki/FormPlugin/form_on_submit_diagram.png 0644 Illustration -pub/TWiki/FormPlugin/error.gif 0644 Icon -pub/TWiki/FormPlugin/screenshot_validation_example.png 0644 Example screenshot diff --git a/pub/TWiki/FormPlugin/error.gif b/pub/System/FormPlugin/error.gif similarity index 100% rename from pub/TWiki/FormPlugin/error.gif rename to pub/System/FormPlugin/error.gif diff --git a/pub/TWiki/FormPlugin/form_on_submit_diagram.png b/pub/System/FormPlugin/form_on_submit_diagram.png similarity index 100% rename from pub/TWiki/FormPlugin/form_on_submit_diagram.png rename to pub/System/FormPlugin/form_on_submit_diagram.png diff --git a/pub/TWiki/FormPlugin/formplugin.css b/pub/System/FormPlugin/formplugin.css similarity index 100% rename from pub/TWiki/FormPlugin/formplugin.css rename to pub/System/FormPlugin/formplugin.css diff --git a/pub/TWiki/FormPlugin/screenshot_validation_example.png b/pub/System/FormPlugin/screenshot_validation_example.png similarity index 100% rename from pub/TWiki/FormPlugin/screenshot_validation_example.png rename to pub/System/FormPlugin/screenshot_validation_example.png