Skip to content

Commit

Permalink
Item13220: JS needed to clean up STRING values before setting them. P…
Browse files Browse the repository at this point in the history
…lus fix one syntax error in Foswiki.spec that had been missed - there should be no UNKNOWN type specs
  • Loading branch information
Comment committed Jan 22, 2015
1 parent 877aaf2 commit 67e20c8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
26 changes: 23 additions & 3 deletions ConfigurePlugin/pub/System/ConfigurePlugin/types.uncompressed.js
Expand Up @@ -92,6 +92,14 @@ var Types = {};

});

Types.STRING = Types.BaseType.extend({
restoreDefaultValue: function() {
var val = this.spec['default'];
val = val.substring(1, val.length - 1);
this.useVal(val);
}
});

Types.BOOLEAN = Types.BaseType.extend({
createUI: function(change_handler) {
this.$ui = $('<input type="checkbox" id="' + _id_ify(this.spec.keys) + '" />');
Expand Down Expand Up @@ -143,7 +151,7 @@ var Types = {};
}
});

Types.PASSWORD = Types.BaseType.extend({
Types.PASSWORD = Types.STRING.extend({
createUI: function(change_handler) {
this._super(change_handler);
this.$ui.attr('type', 'password');
Expand All @@ -152,7 +160,7 @@ var Types = {};
}
});

Types.REGEX = Types.BaseType.extend({
Types.REGEX = Types.STRING.extend({
isDefault: function() {
// String comparison, no eval
return this.currentValue() == this.spec['default'];
Expand Down Expand Up @@ -182,14 +190,26 @@ var Types = {};
}
});

Types.PATHINFO = Types.BaseType.extend({
Types.PATHINFO = Types.STRING.extend({
createUI: function(change_handler) {
this._super(change_handler);
this.$ui.attr('readonly', 'readonly');
return this.$ui;
}
});

Types.URL = Types.STRING.extend({
});

Types.URLPATH = Types.STRING.extend({
});

Types.DATE = Types.STRING.extend({
});

Types.EMAILADDRESS = Types.STRING.extend({
});

// This field is invisible, as it only exists to provide a hook
// for a provideFeedback button. It is disabled as there is no
// point in POSTing it.
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki.spec
Expand Up @@ -85,7 +85,7 @@ $Foswiki::cfg{ForceDefaultUrlHost} = $FALSE;
# (Omit the trailing slash.)
$Foswiki::cfg{PermittedRedirectHostUrls} = '';

# **URLPATH LABEL="Script Url Path" CHECK="emptyok notrail"
# **URLPATH LABEL="Script Url Path" CHECK="emptyok notrail"**
# This is the 'cgi-bin' part of URLs used to access the Foswiki bin
# directory. For example =/foswiki/bin=.
# See [[http://foswiki.org/Support/ShorterUrlCookbook][ShorterUrlCookbook]]
Expand Down

0 comments on commit 67e20c8

Please sign in to comment.