Locale selector, for whatever reason, continually calls onChange in Dojo 1.6 collab/jamesrf/dojo-16
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Mon, 24 Oct 2011 20:30:30 +0000 (13:30 -0700)
committerJames Fournie <jfournie@sitka.bclibraries.ca>
Mon, 24 Oct 2011 20:30:30 +0000 (13:30 -0700)
A simple check to see if it actually changes makes the OPAC load correctly with Dojo 1.6

Signed-off-by: James Fournie <jfournie@sitka.bclibraries.ca>
Open-ILS/web/opac/skin/default/xml/common/fonts.xml
Open-ILS/web/opac/skin/default/xml/home/homesearch.xml

index c7ebef3..d03c69d 100644 (file)
                     opacLocaleSelector.setValue(locale);
                     dojo.connect(opacLocaleSelector, 'onChange', 
                         function () {
-                            location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin');
+                                var locale = location.href.replace( /.+opac\/([^\/]+)\/skin.+/, '$1' );
+                                if(this.getValue() != locale){
+                                    location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin');
+                                }
                         }
                     );
                 });
index 30ca9a3..cb1c74a 100644 (file)
                             opacLocaleSelector.setValue(locale);
                             dojo.connect(opacLocaleSelector, 'onChange', 
                                 function () {
-                                                       location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin');
+                                    var locale = location.href.replace( /.+opac\/([^\/]+)\/skin.+/, '$1' );
+                                    if(this.getValue() != locale){
+                                        location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin');
+                                    }
                                 }
                             );
                         });