2007-09-16 18:30:26 +02:00
|
|
|
var _TRANSLATING_LANG = null;
|
2007-09-25 23:58:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2008-11-13 05:24:02 +01:00
|
|
|
LangSelectorClass = Class.create();
|
|
|
|
LangSelectorClass.prototype = {
|
2007-09-16 18:30:26 +02:00
|
|
|
|
|
|
|
initialize: function() {
|
2007-09-25 23:58:42 +02:00
|
|
|
if(this.selectedIndex != 0) {
|
|
|
|
_TRANSLATING_LANG = this.value;
|
2007-09-16 18:30:26 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2007-09-25 23:58:42 +02:00
|
|
|
onchange: function(e, val) {
|
|
|
|
if(this.value != _TRANSLATING_LANG) {
|
|
|
|
_TRANSLATING_LANG = this.value;
|
2010-01-19 09:53:46 +01:00
|
|
|
document.location = baseHref() + 'admin/?locale=' + this.value;
|
2007-09-16 18:30:26 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
selectValue: function(lang) {
|
2007-09-25 23:58:42 +02:00
|
|
|
this.value = lang;
|
|
|
|
if(this.value != lang) {
|
2007-09-16 18:30:26 +02:00
|
|
|
var newLang = document.createElement('option');
|
|
|
|
newLang.text = lang;
|
|
|
|
newLang.value = lang;
|
|
|
|
try {
|
2007-09-25 23:58:42 +02:00
|
|
|
this.add(newLang, null); // standards compliant
|
2007-09-16 18:30:26 +02:00
|
|
|
} catch(ex) {
|
2007-09-25 23:58:42 +02:00
|
|
|
this.add(newLang); // IE only
|
2007-09-16 18:30:26 +02:00
|
|
|
}
|
2007-09-25 23:58:42 +02:00
|
|
|
this.value = lang;
|
2007-09-16 18:30:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2008-11-13 05:24:02 +01:00
|
|
|
LangSelectorClass.applyTo('#LangSelector');
|
2007-09-16 18:30:26 +02:00
|
|
|
|
2007-09-25 23:58:42 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2007-09-16 18:30:26 +02:00
|
|
|
TranslatorCreator = Class.create();
|
|
|
|
TranslatorCreator.prototype = {
|
|
|
|
|
|
|
|
onSelectionChanged: function(selectedNode) {
|
2007-09-25 23:58:42 +02:00
|
|
|
if(_TRANSLATING_LANG && Element.hasClassName(selectedNode,'untranslated')) {
|
2007-09-16 18:30:26 +02:00
|
|
|
$start = confirm('Would you like to start a translation for this page?');
|
2007-09-25 23:58:42 +02:00
|
|
|
if($start) Element.removeClassName(selectedNode,'untranslated');
|
2007-09-16 18:30:26 +02:00
|
|
|
return $start;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function() {
|
|
|
|
$('sitetree').observeMethod('SelectionChanged', this.onSelectionChanged.bind(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
TranslatorCreator.applyTo('#LangSelector_holder');
|