Commit fd915d35 authored by Jesper Zedlitz's avatar Jesper Zedlitz

Merge branch 'Horst' into 'master'

Überarbeitung des Straßenfilters und verschieben von AdressBook.js nach desActivate.js

See merge request !24
parents a02a7106 1ed4e6bd
Pipeline #1424 passed with stage
in 32 seconds
function activatFilterForSelect(selectId, combinedInput, combineFunction, insertTR, selectItems, attrArray) {
if (insertTR === true) {
$('#' + 'inputRow' + selectId.replace('select', '')).before($('<tr id="inputRow' + selectId + '" class="des-remember" style="display:none;"><td>' + selectId.replace('select', '') + ' ' +
'<label style="font-size:8px" align="center">Auswahl mit Filter</br>' +
'<input id="FilterOn' + selectId + '" title="Filter aktivieren" tabindex="-1" onfocus="' + selectId + '.focus();" type="checkbox" >' +
'<input id="FilterText' + selectId + '" class="FilterText" title="aktiver Filter, shift-Backspace zum löschen" onfocus="' + selectId + '.focus();" size="6" tabindex="-1" ' +
'type="text" style="font-size:10px; border:none; background:#FFFFFF" readonly=readonly></br></label></td>' +
'<td><select id="' + selectId + '" class="StorageValue TabStop Combiner" onblur="' + combineFunction + '()" style="width: 200px">' +
'<option selected="selected" ></option></select> ' +
'<input id="HausNr" size="6" class="StorageValue TabStop Combiner" onblur="' + combineFunction + '()" onkeyup="' + combineFunction + '()" type="text">' +
'</td></tr>'
));
} else {
var firstCell = $(insertTR).find('td:first');
$(firstCell).append(
'<label style="font-size:8px" align="center">Auswahl mit Filter</br>' +
'<input id="FilterOn' + selectId + '" title="Filter aktivieren" tabindex="-1" onfocus="' + selectId + '.focus();" type="checkbox" >' +
'<input id="FilterText' + selectId + '" class="FilterText" title="aktiver Filter, shift-Backspace zum löschen" onfocus="' + selectId + '.focus();" size="6" tabindex="-1" ' +
'type="text" style="font-size:10px; border:none; background:#FFFFFF" readonly=readonly></label>'
);
}
$('#FilterOn' + selectId).bind('click ', function () {
ClearFilter(selectId);
});
$('#FilterOn' + selectId).addClass('StorageValue');
if (selectItems) {
selectAppand(selectId, selectItems, combineFunction, attrArray);
}
if ($('#' + selectId).hasClass("Combiner")) {
var isCombiner = true;
$('#' + combinedInput).attr('tabindex', -1).attr('readonly', true).removeClass('StorageValue TabStop des-autocase');
$('#TabStop' + combinedInput).remove();
$('#hold' + combinedInput).remove();
setTimeout(function () {
$('#loadStorageValue').bind('click ', function () {
window[combineFunction]();
});
}, 200);
$('#' + selectId).bind('change click onfokus', function () {
window[combineFunction]();
});
$("#inputForm").on('show', function () {
setTimeout(function () {
if ($('#inputFormSave').val() === 'Speichern') {
window[combineFunction]();
} else {
var combiner = window[combineFunction](false);
desSplitCombinedValues(combiner, $('#' + combinedInput).val());
}
}, 200);
});
}
$('#' + selectId).filterByText($('#FilterText' + selectId));
$('#' + selectId).bind('keypress', function (event) {
if (event.which > 13) {
if ($('#FilterOn' + selectId).prop('checked')) {
$('#FilterText' + selectId).val($('#FilterText' + selectId).val() + String.fromCharCode(event.which));
$('#FilterText' + selectId).triggerHandler("focus");
}
}
if (isCombiner) {
window[combineFunction]();
}
});
$('#' + selectId).bind('keydown', function (event) {
if (event.shiftKey && event.keyCode === 8) {
ClearFilter(selectId);
$('#' + selectId).prop('selectedIndex', 0);
}
if (event.keyCode === 8) {
$('#FilterText' + selectId).val($('#FilterText' + selectId).val().substr(0, $('#FilterText' + selectId).val().length - 1));
event.preventDefault();
$('#FilterText' + selectId).triggerHandler("focus");
}
if (event.keyCode == 32 && $('#FilterOn' + selectId).prop('checked')) {
$('#FilterText' + selectId).triggerHandler("focus");
}
if (isCombiner) {
window[combineFunction]();
}
});
$('#inputRow' + selectId).css('display', '');
}
jQuery.fn.filterByText = function (FilterText) {
return this.each(function () {
var select = this;
var options = [];
$(select).find('option').each(function () {
options.push({value: $(this).val(), text: $(this).text(), GOVId: $(this).attr('Attribut')});
});
$(select).data('options', options);
$(FilterText).bind('on focus', function () {
var options = $(select).empty().data('options');
var search = $.trim($(this).val());
var regex = new RegExp(search, "gi");
$.each(options, function (i) {
var option = options[i];
if (option.text.match(regex) !== null) {
$(select).append($('<' + 'option' + '>').text(option.text).val(option.value).attr("Attribut", option.GOVId));
}
});
if ($(select).prop('selectedIndex') < 0) {
$(select).append($('<' + 'option' + '>').text('xxx nicht in Liste xxx').val('xxx nicht in Liste xxx').attr("Attribut", ''));
}
});
});
};
function ClearFilter(selectId) {
if (selectId) {
$('#FilterText' + selectId).val('');
$('#FilterText' + selectId).triggerHandler("focus");
} else {
$('.FilterText').val('');
$('.FilterText').triggerHandler("focus");
}
}
function combineStraße(combine) {
var combiner = [selectStraße, HausNr];
if (combine === false) {
return (combiner);
}
$(inputFormValue02).val(($("#selectStraße option:selected").val() + " " + $('#HausNr').val().trim()).trim());
}
function showBezP() {
if (($('#inputFormValue06').prop('selectedIndex')) > 0) {
$('#inputFormValue07').css('display', '');
......@@ -295,7 +168,7 @@ function QuartierDivisible(myRule, HausNr) {
if (HausNr % 2 == 0 && thisRule == 'gerade') {
return ('gerade,true,' + myRuleArray[1]);
}
if (HausNr % 2 != 0 && thisRule == 'ungerade') {
return ('ungrade,true,' + myRuleArray[1]);
} else {
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment