Skip to content

Commit 8e62225

Browse files
author
crawford
committed
Item12952: improve reporting of changes coming back from wizards
1 parent 8fb0afb commit 8e62225

File tree

3 files changed

+56
-46
lines changed

3 files changed

+56
-46
lines changed

pub/System/ConfigurePlugin/configure.uncompressed.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,9 @@ div.information {
144144
#auth_prompt {
145145
height: 300px;
146146
width: 350px;
147-
}
147+
}
148+
149+
textarea.report {
150+
width: 100%;
151+
height: 40%;
152+
}

pub/System/ConfigurePlugin/configure.uncompressed.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var $TRUE = 1;
160160
$('body').css('cursor','auto');
161161
}
162162

163-
// Create a popup with reports
163+
// Create a popup with reports, and apply changes
164164
function wizard_reports(results) {
165165
$('body').css('cursor','wait');
166166
// Generate reports
@@ -170,14 +170,19 @@ var $TRUE = 1;
170170
$whine.addClass(rep.level);
171171
$div.append($whine);
172172
});
173-
// Reflect changed values back to the input elements
173+
// Reflect changed values back to the input elements and
174+
// run the checker on them
174175
$.each(results.changes, function(keys, value) {
175176
// Get the input for the keys, if it's there
176-
var $input = $('#' + _id_ify(keys));
177-
$input.each(function() {
178-
$(this).attr('value', value);
179-
update_modified_default($(this).closest('div.node'));
180-
})
177+
$('#' + _id_ify(keys))
178+
.closest('.node')
179+
.each(function() {
180+
var $node = $(this);
181+
var handler = $node.data('value_handler');
182+
handler.useVal(value);
183+
// Fire off checker
184+
check_current_value($node);
185+
})
181186
});
182187
$div.dialog({
183188
width: '60%',

pub/System/ConfigurePlugin/types.uncompressed.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Types.BaseType = Class.extend({
3333
var cols = m[1];
3434
var rows = m[2];
3535
var value = val == undefined ? '' : val;
36-
this.ui = $('<textarea id="' + _id_ify(this.spec.keys)
36+
this.$ui = $('<textarea id="' + _id_ify(this.spec.keys)
3737
+ '" rows="' + rows
3838
+ '" cols="' + cols
3939
+ '" class="foswikiTextArea">' + value + '</textarea>');
@@ -44,26 +44,26 @@ Types.BaseType = Class.extend({
4444
&& (m = this.spec.SIZE.match(/^\s*(\d+)(\s|$)/))) {
4545
size = m[1];
4646
}
47-
this.ui = $('<input id="' + _id_ify(this.spec.keys)
47+
this.$ui = $('<input id="' + _id_ify(this.spec.keys)
4848
+ '" size="' + size + '"/>');
49-
this.ui.attr('value', val);
49+
this.$ui.val(val);
5050
}
5151
if (this.spec.SPELLCHECK) {
52-
this.ui.attr('spellcheck', "true");
52+
this.$ui.attr('spellcheck', 'true');
5353
}
5454
if (change_handler != undefined)
55-
this.ui.change(change_handler);
56-
return this.ui;
55+
this.$ui.change(change_handler);
56+
return this.$ui;
5757
},
5858

5959
useVal: function(val) {
60-
this.ui.val(val);
60+
this.$ui.val(val);
6161
},
6262

6363
currentValue: function() {
6464
if (this.null_if != null && this.null_if())
6565
return null;
66-
return this.ui.val();
66+
return this.$ui.val();
6767
},
6868

6969
commitVal: function() {
@@ -96,23 +96,23 @@ Types.BaseType = Class.extend({
9696

9797
Types.BOOLEAN = Types.BaseType.extend({
9898
createUI: function(change_handler) {
99-
this.ui = $('<input type="checkbox" id="' + _id_ify(this.spec.keys)
99+
this.$ui = $('<input type="checkbox" id="' + _id_ify(this.spec.keys)
100100
+ '" />');
101101
if (change_handler != undefined)
102-
this.ui.change(change_handler);
102+
this.$ui.change(change_handler);
103103
if (typeof(this.spec.current_value) == 'undefined')
104104
this.spec.current_value = 0;
105105
if (this.spec.current_value != 0) {
106-
this.ui.attr('checked', 'checked');
106+
this.$ui.attr('checked', 'checked');
107107
}
108108
if (this.spec.extraClass) {
109-
this.ui.addClass(this.spec.extraClass);
109+
this.$ui.addClass(this.spec.extraClass);
110110
}
111-
return this.ui;
111+
return this.$ui;
112112
},
113113

114114
currentValue: function() {
115-
return this.ui[0].checked ? 1 : 0;
115+
return this.$ui[0].checked ? 1 : 0;
116116
},
117117

118118
isModified: function() {
@@ -128,7 +128,7 @@ Types.BOOLEAN = Types.BaseType.extend({
128128
},
129129

130130
useVal: function(val) {
131-
this.ui[0].attr(checked, val ? 'checked' : '');
131+
this.$ui.attr('checked', val ? 'checked' : '');
132132
}
133133
});
134134

@@ -140,16 +140,16 @@ Types.BOOLGROUP = Types.BaseType.extend({
140140
for (var i = 0; i < values.length; i++) {
141141
sets[values[i]] = true;
142142
}
143-
this.ui = $('<div class="checkbox_group"></div>');
143+
this.$ui = $('<div class="checkbox_group"></div>');
144144
for (var i = 0; i < options.length; i++) {
145145
var cb = $('<input type="checkbox" name="' + options[i]
146146
+ ' id="' + _id_ify(this.spec.keys) + '"/>');
147147
if (sets[options[i]])
148148
cb.attr('checked', 'checked');
149149
cb.change(change_handler);
150-
this.ui.append(cb);
150+
this.$ui.append(cb);
151151
}
152-
return this.ui;
152+
return this.$ui;
153153
},
154154

155155
currentValue: function() {
@@ -168,7 +168,7 @@ Types.BOOLGROUP = Types.BaseType.extend({
168168
sets[values[i]] = true;
169169
}
170170
var i = 0;
171-
this.ui.find('input[type="checkbox"]').each(function() {
171+
this.$ui.find('input[type="checkbox"]').each(function() {
172172
if (sets[options[i++]])
173173
cb.attr('checked', 'checked');
174174
});
@@ -178,9 +178,9 @@ Types.BOOLGROUP = Types.BaseType.extend({
178178
Types.PASSWORD = Types.BaseType.extend({
179179
createUI: function(change_handler) {
180180
this._super(change_handler);
181-
this.ui.attr('type', 'password');
182-
this.ui.attr('autocomplete', 'off');
183-
return this.ui;
181+
this.$ui.attr('type', 'password');
182+
this.$ui.attr('autocomplete', 'off');
183+
return this.$ui;
184184
}
185185
});
186186

@@ -214,16 +214,16 @@ Types.OCTAL = Types.BaseType.extend({
214214
},
215215

216216
currentValue: function() {
217-
var newval = this.ui.val();
217+
var newval = this.$ui.val();
218218
return newval.toString(8);
219219
}
220220
});
221221

222222
Types.PATHINFO = Types.BaseType.extend({
223223
createUI: function(change_handler) {
224224
this._super(change_handler);
225-
this.ui.attr('readonly', 'readonly');
226-
return this.ui;
225+
this.$ui.attr('readonly', 'readonly');
226+
return this.$ui;
227227
}
228228
});
229229

@@ -233,19 +233,19 @@ Types.PATHINFO = Types.BaseType.extend({
233233
Types.NULL = Types.BaseType.extend({
234234
createUI: function(change_handler) {
235235
this._super(change_handler);
236-
this.ui.attr('readonly', 'readonly');
237-
this.ui.attr('disabled', 'disabled');
238-
this.ui.attr('size', '1');
239-
return this.ui;
236+
this.$ui.attr('readonly', 'readonly');
237+
this.$ui.attr('disabled', 'disabled');
238+
this.$ui.attr('size', '1');
239+
return this.$ui;
240240
}
241241
});
242242

243243
Types.BUTTON = Types.BaseType.extend({
244244
createUI: function() {
245-
this.ui = $('<a href="' + this.spec.uri + '">'
245+
this.$ui = $('<a href="' + this.spec.uri + '">'
246246
+ this.spec.title + '</a>');
247-
this.ui.button();
248-
return this.ui;
247+
this.$ui.button();
248+
return this.$ui;
249249
},
250250

251251
useVal: function() {
@@ -277,12 +277,12 @@ Types.SELECT = Types.BaseType.extend({
277277
if (this.spec.SIZE && (m = this.spec.SIZE.match(/\b(\d+)\b/)))
278278
size = m[0];
279279

280-
this.ui = $('<select id="' + _id_ify(this.spec.keys) + '" size="' + size
280+
this.$ui = $('<select id="' + _id_ify(this.spec.keys) + '" size="' + size
281281
+ '" class="foswikiSelect" />');
282282
if (change_handler != undefined)
283-
this.ui.change(change_handler);
283+
this.$ui.change(change_handler);
284284
if (this.spec.MULTIPLE) {
285-
this.ui.attr('multiple', 'multiple');
285+
this.$ui.attr('multiple', 'multiple');
286286
}
287287

288288
if (this.spec.select_from != undefined) {
@@ -293,18 +293,18 @@ Types.SELECT = Types.BaseType.extend({
293293
if (sel[opt]) {
294294
option.attr('selected', 'selected');
295295
}
296-
this.ui.append(option);
296+
this.$ui.append(option);
297297
}
298298
}
299-
return this.ui;
299+
return this.$ui;
300300
},
301301

302302
useVal: function(val) {
303303
var sel = this._getSel(val);
304304
var sf = this.spec.select_from;
305305
if (sf != undefined) {
306306
var i = 0;
307-
this.ui.find('option').each(function() {
307+
this.$ui.find('option').each(function() {
308308
var opt = sf[i++];
309309
if (sel[opt])
310310
$(this).attr('selected', 'selected');

0 commit comments

Comments
 (0)