//<![CDATA[
$(function() {
WCF.Language.addObject({
+ '__days': [ '{lang}wcf.date.day.sunday{/lang}', '{lang}wcf.date.day.monday{/lang}', '{lang}wcf.date.day.tuesday{/lang}', '{lang}wcf.date.day.wednesday{/lang}', '{lang}wcf.date.day.thursday{/lang}', '{lang}wcf.date.day.friday{/lang}', '{lang}wcf.date.day.saturday{/lang}' ],
+ 'wcf.date.relative.minutes': '{capture assign=relativeMinutes}{lang}wcf.date.relative.minutes{/lang}{/capture}{@$relativeMinutes|encodeJS}',
+ 'wcf.date.relative.hours': '{capture assign=relativeHours}{lang}wcf.date.relative.hours{/lang}{/capture}{@$relativeHours|encodeJS}',
+ 'wcf.date.relative.pastDays': '{capture assign=relativePastDays}{lang}wcf.date.relative.pastDays{/lang}{/capture}{@$relativePastDays|encodeJS}',
+ 'wcf.date.dateTimeFormat': '{lang}wcf.date.dateTimeFormat{/lang}',
'wcf.global.button.add': '{lang}wcf.global.button.add{/lang}',
'wcf.global.button.cancel': '{lang}wcf.global.button.cancel{/lang}',
'wcf.global.button.collapsible': '{lang}wcf.global.button.collapsible{/lang}',
'wcf.global.button.save': '{lang}wcf.global.button.save{/lang}',
'wcf.global.button.search': '{lang}wcf.global.button.search{/lang}',
'wcf.global.button.submit': '{lang}wcf.global.button.submit{/lang}',
+ 'wcf.global.confirmation.cancel': '{lang}wcf.global.confirmation.cancel{/lang}',
+ 'wcf.global.confirmation.confirm': '{lang}wcf.global.confirmation.confirm{/lang}',
+ 'wcf.global.confirmation.title': '{lang}wcf.global.confirmation.title{/lang}',
+ 'wcf.global.decimalPoint': '{capture assign=decimalPoint}{lang}wcf.global.decimalPoint{/lang}{/capture}{$decimalPoint|encodeJS}',
'wcf.global.error.title': '{lang}wcf.global.error.title{/lang}',
+ 'wcf.global.form.edit.success': '{lang}wcf.global.form.edit.success{/lang}',
+ 'wcf.global.language.noSelection': '{lang}wcf.global.language.noSelection{/lang}',
'wcf.global.loading': '{lang}wcf.global.loading{/lang}',
- 'wcf.date.relative.minutes': '{capture assign=relativeMinutes}{lang}wcf.date.relative.minutes{/lang}{/capture}{@$relativeMinutes|encodeJS}',
- 'wcf.date.relative.hours': '{capture assign=relativeHours}{lang}wcf.date.relative.hours{/lang}{/capture}{@$relativeHours|encodeJS}',
- 'wcf.date.relative.pastDays': '{capture assign=relativePastDays}{lang}wcf.date.relative.pastDays{/lang}{/capture}{@$relativePastDays|encodeJS}',
- 'wcf.date.dateTimeFormat': '{lang}wcf.date.dateTimeFormat{/lang}',
- '__days': [ '{lang}wcf.date.day.sunday{/lang}', '{lang}wcf.date.day.monday{/lang}', '{lang}wcf.date.day.tuesday{/lang}', '{lang}wcf.date.day.wednesday{/lang}', '{lang}wcf.date.day.thursday{/lang}', '{lang}wcf.date.day.friday{/lang}', '{lang}wcf.date.day.saturday{/lang}' ],
- 'wcf.global.thousandsSeparator': '{capture assign=thousandsSeparator}{lang}wcf.global.thousandsSeparator{/lang}{/capture}{@$thousandsSeparator|encodeJS}',
- 'wcf.global.decimalPoint': '{capture assign=decimalPoint}{lang}wcf.global.decimalPoint{/lang}{/capture}{$decimalPoint|encodeJS}',
'wcf.global.page.jumpTo': '{lang}wcf.global.page.jumpTo{/lang}',
'wcf.global.page.jumpTo.description': '{lang}wcf.global.page.jumpTo.description{/lang}',
'wcf.global.page.pageNavigation': '{lang}wcf.global.page.pageNavigation{/lang}',
'wcf.global.page.next': '{capture assign=pageNext}{lang}wcf.global.page.next{/lang}{/capture}{@$pageNext|encodeJS}',
'wcf.global.page.previous': '{capture assign=pagePrevious}{lang}wcf.global.page.previous{/lang}{/capture}{@$pagePrevious|encodeJS}',
- 'wcf.global.confirmation.cancel': '{lang}wcf.global.confirmation.cancel{/lang}',
- 'wcf.global.confirmation.confirm': '{lang}wcf.global.confirmation.confirm{/lang}',
- 'wcf.global.confirmation.title': '{lang}wcf.global.confirmation.title{/lang}',
+ 'wcf.global.thousandsSeparator': '{capture assign=thousandsSeparator}{lang}wcf.global.thousandsSeparator{/lang}{/capture}{@$thousandsSeparator|encodeJS}',
'wcf.sitemap.title': '{lang}wcf.sitemap.title{/lang}',
- 'wcf.style.changeStyle': '{lang}wcf.style.changeStyle{/lang}',
- 'wcf.global.form.edit.success': '{lang}wcf.global.form.edit.success{/lang}'
+ 'wcf.style.changeStyle': '{lang}wcf.style.changeStyle{/lang}'
{event name='javascriptLanguageImport'}
});
* @param integer languageID
* @param object languages
* @param object callback
+ * @param boolean allowEmptyValue
*/
- init: function(containerID, inputFieldID, languageID, languages, callback) {
+ init: function(containerID, inputFieldID, languageID, languages, callback, allowEmptyValue) {
var $container = $('#' + containerID);
if ($container.length != 1) {
console.debug("[WCF.Language.Chooser] Invalid container id '" + containerID + "' given");
}
}
+ // allow an empty selection (e.g. using as language filter)
+ if (allowEmptyValue) {
+ $('<li class="dropdownDivider" />').appendTo($dropdownMenu);
+ var $item = $('<li><a>' + WCF.Language.get('wcf.global.language.noSelection') + '</a></li>').data('languageID', 0).click($.proxy(this._click, this)).appendTo($dropdownMenu);
+
+ if (languageID === 0) {
+ this._dropdown.children('.dropdownToggle').empty().append($item.html());
+ }
+ }
+
WCF.Dropdown.init();
},
*/
_click: function(event) {
var $item = $(event.currentTarget);
+ var $languageID = $item.data('languageID');
// update input field
- this._input.val($item.data('languageID'));
+ this._input.val($languageID);
// update dropdown label
var $html = $('' + $item.html());
- var $innerContent = $html.children().detach();
+ var $innerContent = ($languageID === 0) ? $html : $html.children().detach();
this._dropdown.children('.dropdownToggle').empty().append($innerContent);
// execute callback