@@ -126,6 +126,7 @@ PWM_MAIN.loadLocaleBundle = function(bundleName, completeFunction) {
126
126
127
127
PWM_MAIN . initPage = function ( ) {
128
128
PWM_MAIN . applyFormAttributes ( ) ;
129
+ PWM_MAIN . initDisplayTabPreferences ( ) ;
129
130
130
131
require ( [ "dojo" ] , function ( dojo ) {
131
132
if ( dojo . isIE ) {
@@ -219,6 +220,33 @@ PWM_MAIN.initPage = function() {
219
220
console . log ( 'initPage completed' ) ;
220
221
} ;
221
222
223
+ PWM_MAIN . initDisplayTabPreferences = function ( ) {
224
+ var storageName = 'lastTabState-' + window . location . pathname + '-' ;
225
+ var knownTabNames = [ ] ;
226
+ PWM_MAIN . doQuery ( 'div.tab-container>input[type="radio"]' , function ( formElement ) {
227
+ var name = formElement . name ;
228
+ var id = formElement . id ;
229
+ if ( ! PWM_MAIN . JSLibrary . arrayContains ( knownTabNames , name ) ) {
230
+ knownTabNames . push ( name ) ;
231
+ }
232
+ PWM_MAIN . addEventHandler ( formElement , 'click' , function ( ) {
233
+ PWM_MAIN . Preferences . writeSessionStorage ( storageName + name , id ) ;
234
+ } ) ;
235
+
236
+ } ) ;
237
+
238
+ knownTabNames . forEach ( function ( name ) {
239
+ var value = PWM_MAIN . Preferences . readSessionStorage ( storageName + name ) ;
240
+ if ( value ) {
241
+ var selector = "input[name='" + name + "'][type='radio'][id='" + value + "']" ;
242
+ PWM_MAIN . doQuery ( selector , function ( formElement ) {
243
+ formElement . checked = true ;
244
+ } ) ;
245
+ }
246
+ } ) ;
247
+ } ;
248
+
249
+
222
250
PWM_MAIN . applyFormAttributes = function ( ) {
223
251
PWM_MAIN . doQuery ( 'form' , function ( formElement ) {
224
252
formElement . setAttribute ( 'autocomplete' , 'off' ) ;
0 commit comments