Skip to content

Commit

Permalink
Item13186: drop nullok and support undefok and emptyok instead, to re…
Browse files Browse the repository at this point in the history
…present valid undef and empty string values respectively. Clean up the way check options are used in the checkers, and collapse undef and empty checking into a single checker function. Include other changes from George's patch in the task.
  • Loading branch information
Comment committed Jan 9, 2015
1 parent 47fcb1e commit 3d6fc31
Show file tree
Hide file tree
Showing 29 changed files with 213 additions and 268 deletions.
Expand Up @@ -535,6 +535,16 @@ function _id_ify(id) {
}
}

function CHECK_option(spec, option) {
if (!spec.CHECK)
return null;
if (spec.CHECK.length == 0)
return null;
if (!spec.CHECK[0][option])
return null;
return spec.CHECK[0][option][0];
}

// Load a key node UI
function load_ui($node) {
var spec = $node.data('spec.entry'),
Expand Down Expand Up @@ -562,7 +572,7 @@ function _id_ify(id) {
$pending.remove();
}

if (spec.UNDEFINEDOK == 1) {
if (CHECK_option(spec, 'undefok') === 1) {
// If undefined is OK, then we add a checkbox that
// needs to be clicked to see the value input.
// if it isn't checked, the value is undefined; if it
Expand All @@ -582,7 +592,7 @@ function _id_ify(id) {
}
update_modified_default( $node );
}).show();
// Add a null_if handler to intercent the currentValue
// Add a null_if handler to intercept the currentValue
// of the keys (see types.js)
handler.null_if = function () {
return !$butt.attr("checked");
Expand Down
4 changes: 2 additions & 2 deletions MailerContrib/lib/Foswiki/Contrib/MailerContrib/Config.spec
@@ -1,6 +1,6 @@
# ---+ Extensions
# ---++ MailerContrib
# **REGEX**
# **REGEX CHECK="undefok emptyok"**
# Define the regular expression that an email address entered in WebNotify
# must match to be identified as a legal email by the notifier. You can use
# this expression to - for example - filter email addresses on your company
Expand All @@ -14,7 +14,7 @@ $Foswiki::cfg{MailerContrib}{EmailFilterIn} = '';
# Remove IMG tags in notification mails.
$Foswiki::cfg{MailerContrib}{RemoveImgInMailnotify} = $TRUE;

# **STRING 80**
# **STRING 80 CHECK="undefok emptyok"**
# A comma-separated list of user preference names that will be respected
# when sending out emails.
$Foswiki::cfg{MailerContrib}{RespectUserPrefs} = 'LANGUAGE';
Expand Down
36 changes: 18 additions & 18 deletions UnitTestContrib/lib/Foswiki/Contrib/UnitTestContrib/Config.spec
Expand Up @@ -3,13 +3,13 @@
# Foswiki Unit-Test Framework
# ---+++ Selenium Remote Control
# For browser-in-the-loop testing
# **STRING 30**
# **STRING 30 CHECK='emptyok' **
# The UnitTestContrib needs a username to access (i.e. edit) the testcase web and topic from the browser opened by Selenium RC.
$Foswiki::cfg{UnitTestContrib}{SeleniumRc}{Username} = '';
# **PASSWORD 30**
# **PASSWORD 30 CHECK="emptyok" **
# The password for the Selenium RC user
$Foswiki::cfg{UnitTestContrib}{SeleniumRc}{Password} = '';
# **PERL 40x10 CHECK='nullok'**
# **PERL 40x10 CHECK='undefok'**
# List the browsers accessible via Selenium RC.
# It is keyed by browser identifier - you choose the identifiers as seems sensible. Browser identifiers may only consist of alphanumeric characters.
# Examples: <code>FF3 FF2dot1OnWindows IE6_1_345 w3m</code>
Expand All @@ -29,7 +29,7 @@ $Foswiki::cfg{UnitTestContrib}{SeleniumRc}{BaseTimeout} = 5000;
# and do nothing.
# **STRING FEEDBACK="label='Test one';wizard='Test';method='test1';auth=1" \
# FEEDBACK="label='Test two';wizard='Test';method='test1'" \
# CHECK="min:3 max:20"**
# CHECK="min:3 max:20 undefok"**
# When you press either of the test buttons, expect the value to change
# to "ROPE" and there to be one each of the different levels of report.
# Default: STRING
Expand All @@ -40,29 +40,29 @@ $Foswiki::cfg{UnitTestContrib}{Configure}{BOOLEAN} = 1;
# **COMMAND**
# Default: COMMAND
$Foswiki::cfg{UnitTestContrib}{Configure}{COMMAND} = 'COMMAND';
# **DATE**
# **DATE CHECK="undefok"**
# Default: 12 Feb 2012
$Foswiki::cfg{UnitTestContrib}{Configure}{DATE} = '12 Feb 2012';
# **EMAILADDRESS**
# **EMAILADDRESS CHECK="undefok"**
# Default: address@email.co
$Foswiki::cfg{UnitTestContrib}{Configure}{EMAILADDRESS} = 'address@email.co';
# **NUMBER**
# **NUMBER CHECK="undefok"**
# Default: 666
$Foswiki::cfg{UnitTestContrib}{Configure}{NUMBER} = 666;
# **OCTAL CHECK="min:30 max:70"**
# **OCTAL CHECK="min:30 max:70 undefok"**
# Default: 429
$Foswiki::cfg{UnitTestContrib}{Configure}{OCTAL} = 429;
# **PASSWORD**
# Default: PASSWORD
$Foswiki::cfg{UnitTestContrib}{Configure}{PASSWORD} = 'PASSWORD';
# **PATH**
# **PATH CHECK="undefok"**
# Default: PATH
$Foswiki::cfg{UnitTestContrib}{Configure}{PATH} = 'PATH';
# **PERL FEEDBACK="label='Format';wizard='Test';method='format'" **
# **PERL FEEDBACK="label='Format';wizard='Test';method='format'" CHECK="undefok"**
# Default: 'PERL'
# The test button should come back with a prettified version of your value.
#$Foswiki::cfg{UnitTestContrib}{Configure}{PERL} = '\'PERL\';';
# **REGEX**
# **REGEX CHECK="undefok"**
# Default: '^regex$'
$Foswiki::cfg{UnitTestContrib}{Configure}{REGEX} = '^regex$';
# **SELECTCLASS none,Foswiki::Configure::P* **
Expand All @@ -71,13 +71,13 @@ $Foswiki::cfg{UnitTestContrib}{Configure}{SELECTCLASS} = 'Foswiki::Configure::Pa
# **SELECT choose,life**
# Default: life
$Foswiki::cfg{UnitTestContrib}{Configure}{SELECT} = 'life';
# **URLPATH**
# **URLPATH CHECK="undefok"**
# Default: /
$Foswiki::cfg{UnitTestContrib}{Configure}{URLPATH} = '/';
# **URL**
# **URL CHECK="undefok"**
# Default: http://localhost
$Foswiki::cfg{UnitTestContrib}{Configure}{URL} = 'http://localhost';
# **STRING H**
# **STRING H CHECK="undefok"**
# Default: H
$Foswiki::cfg{UnitTestContrib}{Configure}{H} = 'H';
# **STRING EXPERT CHECK="nullok"**
Expand All @@ -86,20 +86,20 @@ $Foswiki::cfg{UnitTestContrib}{Configure}{EXPERT} = 'EXPERT';
# **PATH CHECK='nullok'**
# Default: empty
# $Foswiki::cfg{UnitTestContrib}{Configure}{empty} = 'empty';
# **STRING**
# **STRING CHECK="undefok"**
# Should contain other items
$Foswiki::cfg{UnitTestContrib}{Configure}{DEP_STRING} = 'xxx$Foswiki::cfg{UnitTestContrib}{Configure}{H}xxx';
# **PERL**
# **PERL CHECK="undefok"**
# Should contain other items
$Foswiki::cfg{UnitTestContrib}{Configure}{DEP_PERL} = {
'string' => 'xxx$Foswiki::cfg{UnitTestContrib}{Configure}{H}xxx',
'hash' => { 'hash' => 'xxx$Foswiki::cfg{UnitTestContrib}{Configure}{H}xxx' },
'array' => [ '$Foswiki::cfg{UnitTestContrib}{Configure}{H}' ]
};
# **PERL**
# **PERL CHECK="undefok"**
# Default: { a => 1, b => 2 }
$Foswiki::cfg{UnitTestContrib}{Configure}{PERL_HASH} = { a => 1, b => 2 };
# **PERL**
# **PERL CHECK="undefok"**
# Default: [ 1, 2 ]
$Foswiki::cfg{UnitTestContrib}{Configure}{PERL_ARRAY} = [ 1, 2 ];
1;
44 changes: 22 additions & 22 deletions core/lib/Foswiki.spec
Expand Up @@ -63,7 +63,7 @@
# to return the {DefaultUrlHost}.
$Foswiki::cfg{ForceDefaultUrlHost} = $FALSE;

# **URILIST EXPERT CHECK='nullok \
# **URILIST EXPERT CHECK='undefok \
# parts:scheme,authority \
# authtype:hostip' **
# If your host has aliases (such as both =www.mywiki.net= and =mywiki.net=
Expand Down Expand Up @@ -94,12 +94,12 @@ $Foswiki::cfg{PermittedRedirectHostUrls} = '';
# This is the file system path used to access the Foswiki bin directory.
# $Foswiki::cfg{ScriptDir} = '/home/httpd/foswiki/bin';

# **STRING 10**
# **STRING 10 CHECK="emptyok"**
# Suffix of Foswiki CGI scripts. For example, .cgi or .pl.
# You may need to set this if your webserver requires an extension.
$Foswiki::cfg{ScriptSuffix} = '';
#$Foswiki::cfg{ScriptSuffix} = '';

# **URLPATH CHECK='nullok notrail' FEEDBACK="label='Verify';wizard='ScriptHash';method='verify';auth=1" **
# **URLPATH CHECK='undefok emptyok notrail' FEEDBACK="label='Verify';wizard='ScriptHash';method='verify';auth=1" **
#! n.b. options should match Pluggables/SCRIPTHASH.pm for dynamic path items
# This is the complete path used to access the Foswiki view script,
# including any suffix.
Expand Down Expand Up @@ -182,13 +182,13 @@ $Foswiki::cfg{ScriptSuffix} = '';
# are pending verification.
# $Foswiki::cfg{WorkingDir} = '/home/httpd/foswiki/working';

# **PATH CHECK="nullok" EXPERT**
# **PATH CHECK="undefok" EXPERT**
# This is used to override the default system temporary file location.
# Set this if you wish to have control over where working tmp files are
# created. It is normally set automatically in the code.
# $Foswiki::cfg{TempfileDir} = '';

# **PATH EXPERT CHECK='nullok'**
# **PATH EXPERT CHECK='undefok'**
# You can override the default PATH setting to control
# where Foswiki looks for external programs, such as grep.
# By restricting this path to just a few key
Expand All @@ -202,7 +202,7 @@ $Foswiki::cfg{ScriptSuffix} = '';
# * Windows Cygwin Perl - Path separator is ':'. The Windows system
# directory is required on the path. Use '/' not '\' in pathnames.
# Typical setting is =/cygdrive/c/windows/system32=
# $Foswiki::cfg{SafeEnvPath} = '';
# $Foswiki::cfg{SafeEnvPath} = undef;

#############################################################################
#---+ Security and Authentication
Expand Down Expand Up @@ -270,7 +270,7 @@ $Foswiki::cfg{Sessions}{ExpireCookiesAfter} = 0;
# {Sessions}{MapIP2SID}).
$Foswiki::cfg{Sessions}{IDsInURLs} = 0;

# **STRING 20 CHECK='nullok' EXPERT DISPLAY_IF="{UseClientSessions}" CHECK="iff:'{UseClientSessions}'"**
# **STRING 20 CHECK='undefok' EXPERT DISPLAY_IF="{UseClientSessions}" CHECK="iff:'{UseClientSessions}'"**
# By default the Foswiki session cookie is only accessible by the host which
# sets it. To change the scope of this cookie you can set this to any other
# value (ie. company.com). Make sure that Foswiki can access its own cookie.
Expand Down Expand Up @@ -838,7 +838,7 @@ $Foswiki::cfg{Register}{RegistrationAgentWikiName} = 'RegistrationAgent';
# email address.
$Foswiki::cfg{Register}{UniqueEmail} = $FALSE;
# **REGEX 80 EXPERT**
# **REGEX 80 CHECK="emptyok" EXPERT**
# This regular expression can be used to block certain email addresses
# from being used for registering users. It can be used to block some
# of the more common wikispam bots. If this regex matches the entered
Expand Down Expand Up @@ -1036,19 +1036,19 @@ $Foswiki::cfg{AccessibleENV} =
# Some environments require outbound HTTP traffic to go through a proxy
# server (for example http://proxy.your.company).
# **URL 30 CHECK='nullok parts:scheme,authority,path,user,pass \
# **URL 30 CHECK='undefok emptyok parts:scheme,authority,path,user,pass \
# partsreq:scheme,authority \
# schemes:http,https \
# authtype:hostip' **
# Hostname or address of the proxy server.
# If your proxy requires authentication, simply put it in the URL, as in:
# http://username:password@proxy.your.company.
$Foswiki::cfg{PROXY}{HOST} = '';
$Foswiki::cfg{PROXY}{HOST} = undef;
# **STRING 30 CHECK='nullok'**
# **STRING 30 CHECK='undefok emptyok'**
# Some environments require outbound HTTP traffic to go through a proxy
# server. Set the port number here (e.g: 8080).
$Foswiki::cfg{PROXY}{PORT} = '';
$Foswiki::cfg{PROXY}{PORT} = undef;
#---++ Anti-spam
# Foswiki incorporates some simple anti-spam measures to protect
Expand Down Expand Up @@ -1193,14 +1193,14 @@ $Foswiki::cfg{WarningFileName} = '';
# or Foswiki 1.1 logging directory =$Foswiki::cfg{Log}{Dir}/log%DATE%.txt=
$Foswiki::cfg{LogFileName} = '';
# **PATH DISPLAY_IF="/Compatibility/i.test({Log}{Implementation}) || {ConfigureLogFileName}"**
# **PATH DISPLAY_IF="/Compatibility/i.test({Log}{Implementation}) || {ConfigureLogFileName}" CHECK="undefok"**
# Log file recording configuration changes when using the Compatibility logger
# If =%DATE%= is included in the file name, it gets expanded
# to YYYYMM (year, month), causing a new log to be written each month.
#
# To use the Compatibility logger, set this to a valid file path and name.
#
$Foswiki::cfg{ConfigureLogFileName} = '';
$Foswiki::cfg{ConfigureLogFileName} = undef;
#---++ Statistics
# Statistics are usually assembled by a cron script
Expand Down Expand Up @@ -2068,47 +2068,47 @@ qr(AERO|ARPA|ASIA|BIZ|CAT|COM|COOP|EDU|GOV|INFO|INT|JOBS|MIL|MOBI|MUSEUM|NAME|NE
#---+ Miscellaneous
# Miscellaneous expert options.

# **STRING 20 CHECK='nullok' EXPERT**
# **STRING 20 CHECK='undefok' EXPERT**
# The name of the host operating system. This is automatically calculated
# in the code. You should only need to override if your Perl doesn't provide
# the value of $^O or $Config::Config{'osname'} (an exceptional
# situtation never yet encountered)
# $Foswiki::cfg{DetailedOS} = '';

# **STRING 20 CHECK='nullok' EXPERT**
# **STRING 20 CHECK='undefok' EXPERT**
# One of UNIX WINDOWS VMS DOS MACINTOSH OS2
# This is automatically calculated in the code based on the value of
# {DetailedOS}. It is used to group OS's into generic groups based on their
# behaviours - for example,
#
# $Foswiki::cfg{OS} = '';

# **NUMBER CHECK="min:-1 nullok" EXPERT**
# **NUMBER CHECK="min:-1 undefok" EXPERT**
# Maximum number of backup versions of LocalSite.cfg to retain when changes
# are saved. Enables you to recover quickly from accidental changes.
# 0 does not save any backup versions. -1 does not limit the number of
# versions retained. Caution: If the directory is not writable and this
# parameter is non-zero, you will be unable to save the configuration.
$Foswiki::cfg{MaxLSCBackups} = 10;

# **STRING 20 CHECK='nullok' EXPERT**
# **STRING 20 EXPERT**
# Name of the web where documentation and default preferences are held. If you
# change this setting, you must make sure the web exists and contains
# appropriate content, and upgrade scripts may no longer work (don't
# change it unless you are certain that you know what you are doing!)
$Foswiki::cfg{SystemWebName} = 'System';

# **STRING 20 CHECK='nullok' EXPERT**
# **STRING 20 EXPERT**
# Name of the web used as a trashcan (where deleted topics are moved)
# If you change this setting, you must make sure the web exists.
$Foswiki::cfg{TrashWebName} = 'Trash';

# **STRING 20 CHECK='nullok' EXPERT**
# **STRING 20 EXPERT**
# Name of the web used as a scratchpad or temporary workarea for users to
# experiment with Foswiki topics.
$Foswiki::cfg{SandboxWebName} = 'Sandbox';

# **STRING 20 CHECK='nullok' EXPERT**
# **STRING 20 EXPERT**
# Name of site-level preferences topic in the {SystemWebName} web.
# *If you change this setting you will have to
# use Foswiki and *manually* rename the existing topic.*
Expand Down

0 comments on commit 3d6fc31

Please sign in to comment.