|
Lines 34-39
define([
Link Here
|
| 34 |
"dojo/_base/array", |
34 |
"dojo/_base/array", |
| 35 |
"dojo/date/locale", |
35 |
"dojo/date/locale", |
| 36 |
"dojo/Deferred", |
36 |
"dojo/Deferred", |
|
|
37 |
"dojo/on", |
| 37 |
"dijit/Dialog", |
38 |
"dijit/Dialog", |
| 38 |
"dojox/html/entities", |
39 |
"dojox/html/entities", |
| 39 |
"umc/dialog", |
40 |
"umc/dialog", |
|
Lines 51-57
define([
Link Here
|
| 51 |
"umc/widgets/ProgressInfo", |
52 |
"umc/widgets/ProgressInfo", |
| 52 |
"umc/widgets/SearchForm", |
53 |
"umc/widgets/SearchForm", |
| 53 |
"umc/i18n!umc/modules/schoolusers" |
54 |
"umc/i18n!umc/modules/schoolusers" |
| 54 |
], function(declare, lang, array, locale, Deferred, Dialog, entities, dialog, tools, Module, |
55 |
], function(declare, lang, array, locale, Deferred, on, Dialog, entities, dialog, tools, Module, |
| 55 |
Grid, Page, Form, SearchBox, TextBox, ComboBox, CheckBox, Text, ContainerWidget, ProgressInfo, SearchForm, _) { |
56 |
Grid, Page, Form, SearchBox, TextBox, ComboBox, CheckBox, Text, ContainerWidget, ProgressInfo, SearchForm, _) { |
| 56 |
|
57 |
|
| 57 |
return declare("umc.modules.schoolusers", [ Module ], { |
58 |
return declare("umc.modules.schoolusers", [ Module ], { |
|
Lines 59-64
define([
Link Here
|
| 59 |
_grid: null, |
60 |
_grid: null, |
| 60 |
_searchPage: null, |
61 |
_searchPage: null, |
| 61 |
_progressInfo: null, |
62 |
_progressInfo: null, |
|
|
63 |
_autosearch_on_change: false, |
| 64 |
_classChangeHandler: null, |
| 65 |
_classValuesLoadedHandler: null, |
| 62 |
|
66 |
|
| 63 |
uninitialize: function() { |
67 |
uninitialize: function() { |
| 64 |
this.inherited(arguments); |
68 |
this.inherited(arguments); |
|
Lines 175-183
define([
Link Here
|
| 175 |
|
179 |
|
| 176 |
this._searchPage.startup(); |
180 |
this._searchPage.startup(); |
| 177 |
|
181 |
|
| 178 |
tools.ucr(['ucsschool/passwordreset/autosearch', 'ucsschool/passwordreset/password-change-on-next-login', 'ucsschool/passwordreset/force-password-change-on-next-login']).then(lang.hitch(this, function(ucr) { |
182 |
this._setupEventHandlers(); |
|
|
183 |
|
| 184 |
tools.ucr(['ucsschool/passwordreset/autosearch', 'ucsschool/passwordreset/autosearch_on_change', 'ucsschool/passwordreset/password-change-on-next-login', 'ucsschool/passwordreset/force-password-change-on-next-login']).then(lang.hitch(this, function(ucr) { |
| 179 |
this.changeOnNextLogin = tools.isTrue(ucr['ucsschool/passwordreset/password-change-on-next-login'] || true); |
185 |
this.changeOnNextLogin = tools.isTrue(ucr['ucsschool/passwordreset/password-change-on-next-login'] || true); |
| 180 |
this.changeOnNextLoginDisabled = tools.isTrue(ucr['ucsschool/passwordreset/force-password-change-on-next-login'] || false); |
186 |
this.changeOnNextLoginDisabled = tools.isTrue(ucr['ucsschool/passwordreset/force-password-change-on-next-login'] || false); |
|
|
187 |
this._autosearch_on_change = tools.isTrue(ucr['ucsschool/passwordreset/autosearch_on_change'] || false); |
| 181 |
if (tools.isTrue(ucr['ucsschool/passwordreset/autosearch'] || true)) { |
188 |
if (tools.isTrue(ucr['ucsschool/passwordreset/autosearch'] || true)) { |
| 182 |
this._searchForm.ready().then(lang.hitch(this, function() { |
189 |
this._searchForm.ready().then(lang.hitch(this, function() { |
| 183 |
this._grid.filter(this._searchForm.get('value')); |
190 |
this._grid.filter(this._searchForm.get('value')); |
|
Lines 213-218
define([
Link Here
|
| 213 |
_content.addChild(new Text({ content: message })); |
220 |
_content.addChild(new Text({ content: message })); |
| 214 |
dialog.alert(_content); |
221 |
dialog.alert(_content); |
| 215 |
} |
222 |
} |
|
|
223 |
this._searchForm.submit(); // Bug 45601 Comment #6 |
| 216 |
}); |
224 |
}); |
| 217 |
|
225 |
|
| 218 |
var _set_passwords = lang.hitch(this, function(password, nextLogin) { |
226 |
var _set_passwords = lang.hitch(this, function(password, nextLogin) { |
|
Lines 296-301
define([
Link Here
|
| 296 |
'class': 'umcPopup' |
304 |
'class': 'umcPopup' |
| 297 |
} ); |
305 |
} ); |
| 298 |
_dialog.show(); |
306 |
_dialog.show(); |
|
|
307 |
}, |
| 308 |
|
| 309 |
// This construct results from the dependency between class data and chosen school. There was no solution found yet to solve this in a more clean way. |
| 310 |
_setupEventHandlers() { |
| 311 |
this._searchForm.ready().then(lang.hitch(this, function() { |
| 312 |
this._classChangeHandler = on.pausable(this._searchForm.getWidget("class"), "change", lang.hitch(this, function(e) { |
| 313 |
if (this._autosearch_on_change) { |
| 314 |
this._searchForm.submit(); |
| 315 |
} |
| 316 |
})); |
| 317 |
this._classChangeHandler.pause(); // Has to be paused to prevent redundant query on page load (event gets already fired). |
| 318 |
// Unpauses the classChangeHandler after first firing of change event on class |
| 319 |
on.once(this._searchForm.getWidget("class"), "change", lang.hitch(this, function(e) { |
| 320 |
if (this._classChangeHandler) { |
| 321 |
this._classChangeHandler.resume(); |
| 322 |
} |
| 323 |
})); |
| 324 |
this._classValuesLoadedHandler = on.pausable(this._searchForm.getWidget("class"), "ValuesLoaded", lang.hitch(this, function(e) { |
| 325 |
if (this._autosearch_on_change) { |
| 326 |
this._searchForm.submit(); |
| 327 |
this._classChangeHandler.resume(); // Has to be paused to prevent redundant query on page load (event gets already fired). |
| 328 |
} |
| 329 |
})) |
| 330 |
this._classValuesLoadedHandler.pause(); |
| 331 |
on(this._searchForm.getWidget("school"), "change", lang.hitch(this, function(e) { |
| 332 |
if (this._searchForm.getWidget("class").get("value") !== "None") { |
| 333 |
this._searchForm._widgets.class.setInitialValue("None"); // Workaround/Hack: Otherwise it will be the invalid value "" |
| 334 |
} |
| 335 |
if(this._autosearch_on_change) { |
| 336 |
if (this._classChangeHandler) { |
| 337 |
this._classChangeHandler.pause(); |
| 338 |
} |
| 339 |
} |
| 340 |
})); |
| 341 |
// Resumes classValuesLoaded handler after first schoolChange event |
| 342 |
on.once(this._searchForm.getWidget("school"), "change", lang.hitch(this, function(e) { |
| 343 |
if (this._classValuesLoadedHandler) { |
| 344 |
this._classValuesLoadedHandler.resume(); |
| 345 |
} |
| 346 |
})); |
| 347 |
})) |
| 299 |
} |
348 |
} |
| 300 |
}); |
349 |
}); |
| 301 |
|
350 |
|