sync(dev): fehlende Admin-Theme-Assets vom Live-Stand ergaenzt (nichts ueberschrieben)
This commit is contained in:
@@ -0,0 +1,347 @@
|
||||
var jows = {
|
||||
MakeModal: function(options) {
|
||||
var defaults = {
|
||||
opacity: 1
|
||||
};
|
||||
|
||||
$.extend(defaults, options);
|
||||
|
||||
$this = $(this);
|
||||
|
||||
$('<div />').css({
|
||||
position: 'absolute',
|
||||
background: 'transparent url(./themes/admin/media/images/audarisTools.modal.background.png) repeat',
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
opacity: defaults.opacity,
|
||||
width: '100%',
|
||||
height: $(document).height() + 'px',
|
||||
zIndex: 99999
|
||||
}).attr({
|
||||
id: 'easywayShopModal'
|
||||
}).appendTo('body');
|
||||
},
|
||||
HideModal: function(options) {
|
||||
var defaults = {
|
||||
opacity: 0.8
|
||||
};
|
||||
|
||||
$.extend(defaults, options);
|
||||
|
||||
$this = $(this);
|
||||
|
||||
$('#easywayShopModal').empty().remove();
|
||||
},
|
||||
MessageDialog: function(messageText, buttonOptions, endFunction) {
|
||||
var defaults = {
|
||||
minLength: 8,
|
||||
width: '440px'
|
||||
};
|
||||
|
||||
var defaultButtonOptions = {
|
||||
ok: true,
|
||||
cancel: true
|
||||
};
|
||||
|
||||
var buttonOptions = defaultButtonOptions;
|
||||
|
||||
$().makeModal();
|
||||
|
||||
var dialog = $('<div></div>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
width: defaults.width,
|
||||
height: defaults.height,
|
||||
background: '#ffffff',
|
||||
padding: '20px',
|
||||
textAlign: 'left',
|
||||
left: (($(window).width() - parseInt(defaults.width)) / 2) + 'px',
|
||||
top: (($(window).height() - parseInt(defaults.height)) / 2 + $(window).scrollTop()) + 'px',
|
||||
zIndex: 100000
|
||||
})
|
||||
.appendTo('body')
|
||||
.append('<form id="audarisMessageDialog"></form>');
|
||||
|
||||
var messageForm = $(dialog).find('#audarisMessageDialog');
|
||||
|
||||
$(messageForm).append('<p>' + messageText + '</p>');
|
||||
|
||||
if (buttonOptions.ok) {
|
||||
$(messageForm).append('<button id="audarisMessageDialogOkButton" type="button">Ok</button>');
|
||||
|
||||
// bind ok button click event
|
||||
$('#audarisMessageDialogOkButton').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// unbind ok button click event
|
||||
$('#audarisMessageDialogOkButton').unbind('click');
|
||||
|
||||
// unbind cancel button click event if it is set
|
||||
if (buttonOptions.cancel) {
|
||||
$('#audarisMessageDialogCancelButton').unbind('click');
|
||||
}
|
||||
|
||||
// remove dialog
|
||||
$(dialog).empty().remove();
|
||||
$().hideModal();
|
||||
|
||||
// call callcack
|
||||
endFunction();
|
||||
});
|
||||
}
|
||||
|
||||
if (buttonOptions.cancel) {
|
||||
$(messageForm).append('<button id="audarisMessageDialogCancelButton" type="button">Abbrechen</button>');
|
||||
|
||||
// bind cancel button click event
|
||||
$('#audarisMessageDialogCancelButton').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// unbind ok button click event if it is set
|
||||
if (buttonOptions.ok) {
|
||||
$('#audarisMessageDialogOkButton').unbind('click');
|
||||
}
|
||||
|
||||
$('#audarisMessageDialogCancelButton').unbind('click');
|
||||
|
||||
// remove dialog
|
||||
$(dialog).empty().remove();
|
||||
$().hideModal();
|
||||
});
|
||||
}
|
||||
},
|
||||
PromptDialog: function(messageText, promptMessage, buttonOptions, endFunction) {
|
||||
var defaults = {
|
||||
minLength: 8,
|
||||
width: '440px'
|
||||
//height: '350px'
|
||||
};
|
||||
|
||||
var defaultButtonOptions = {
|
||||
ok: false,
|
||||
cancel: false,
|
||||
numeric: false,
|
||||
zero: false,
|
||||
negativ: false
|
||||
};
|
||||
|
||||
var buttonOptions = buttonOptions;
|
||||
|
||||
$().makeModal();
|
||||
|
||||
var dialog = $('<div></div>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
width: defaults.width,
|
||||
height: defaults.height,
|
||||
background: '#ffffff',
|
||||
padding: '20px',
|
||||
textAlign: 'left',
|
||||
left: (($(window).width() - parseInt(defaults.width)) / 2) + 'px',
|
||||
top: (($(window).height() - parseInt(defaults.height)) / 2 + $(window).scrollTop()) + 'px',
|
||||
zIndex: 100000
|
||||
})
|
||||
.appendTo('body')
|
||||
.append('<form id="audarisMessageDialog"></form>');
|
||||
|
||||
var messageForm = $(dialog).find('#audarisMessageDialog');
|
||||
|
||||
$(messageForm).append('<p>' + messageText + '</p>');
|
||||
$(messageForm).append('<p>' + promptMessage + '</p>');
|
||||
$(messageForm).append('<input type="text" name="easywayShopPrompt" id="easywayShopPrompt" /><br />')
|
||||
|
||||
// bind submit event
|
||||
$('#audarisMessageDialog').submit(function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
if (buttonOptions.ok) {
|
||||
$(messageForm).append('<button id="audarisMessageDialogOkButton" type="button">Ok</button>');
|
||||
|
||||
// bind ok button click event
|
||||
$('#audarisMessageDialogOkButton').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var promptValue = $('#easywayShopPrompt').val();
|
||||
|
||||
if (checkValue(promptValue)) {
|
||||
// unbind ok button click event
|
||||
$('#audarisMessageDialogOkButton').unbind('click');
|
||||
|
||||
// unbind cancel button click event if it is set
|
||||
if (buttonOptions.cancel) {
|
||||
$('#audarisMessageDialogCancelButton').unbind('click');
|
||||
}
|
||||
|
||||
// unbind submit event
|
||||
$('#audarisMessageDialog').unbind('submit');
|
||||
|
||||
// remove dialog
|
||||
$(dialog).empty().remove();
|
||||
$().hideModal();
|
||||
|
||||
// call callcack
|
||||
endFunction(promptValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (buttonOptions.cancel) {
|
||||
$(messageForm).append('<button id="audarisMessageDialogCancelButton" type="button">Abbrechen</button>');
|
||||
|
||||
// bind cancel button click event
|
||||
$('#audarisMessageDialogCancelButton').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// unbind ok button click event if it is set
|
||||
if (buttonOptions.ok) {
|
||||
$('#audarisMessageDialogOkButton').unbind('click');
|
||||
}
|
||||
|
||||
$('#audarisMessageDialogCancelButton').unbind('click');
|
||||
|
||||
// unbind submit event
|
||||
$('#audarisMessageDialog').unbind('submit');
|
||||
|
||||
// remove dialog
|
||||
$(dialog).empty().remove();
|
||||
$().hideModal();
|
||||
});
|
||||
}
|
||||
|
||||
var checkValue = function (value) {
|
||||
if (buttonOptions.numeric) {
|
||||
value = parseInt(value);
|
||||
if (typeof(value) != 'number' ) {
|
||||
alert(typeof(value) != 'number');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonOptions.negativ) {
|
||||
if (value < 0) {
|
||||
alert(value < 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonOptions.zero) {
|
||||
if (value == 0) {
|
||||
alert(value == 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
},
|
||||
OptionsDialog: function(optionType, optionsArray, endFunction) {
|
||||
var defaults = {
|
||||
minLength: 8,
|
||||
width: '440px',
|
||||
height: '350px'
|
||||
};
|
||||
|
||||
$.makeModal();
|
||||
|
||||
var dialog = $('<div></div>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
width: defaults.width,
|
||||
height: defaults.height,
|
||||
background: '#ffffff',
|
||||
padding: '20px',
|
||||
textAlign: 'left',
|
||||
left: (($(window).width() - parseInt(defaults.width)) / 2) + 'px',
|
||||
top: (($(window).height() - parseInt(defaults.height)) / 2 + $(window).scrollTop()) + 'px',
|
||||
zIndex: 100000
|
||||
})
|
||||
.appendTo('body')
|
||||
.append('<form id="audarisOptionsDialog"></form>');
|
||||
|
||||
var optionsForm = $(dialog).find('#audarisOptionsDialog');
|
||||
|
||||
if (optionType == 'radio') {
|
||||
for(var i in optionsArray) {
|
||||
$(optionsForm)
|
||||
.append('<input type="radio" name="audarisOptionsDialogOption" value="' + optionsArray[i] +'" />')
|
||||
.append('<label for="' + optionsArray[i] + '">' + optionsArray[i] + '</label><br />');
|
||||
}
|
||||
} else if (optionType == 'checkbox') {
|
||||
$(optionsForm)
|
||||
.append('<input type="checkbox" name="audarisOptionsDialogCheckAll" value="1" />')
|
||||
.append('<label for="audarisOptionsDialogCheckAll">alle markieren</label><br />')
|
||||
for(var i in optionsArray) {
|
||||
$(optionsForm)
|
||||
.append('<input type="checkbox" name="audarisOptionsDialogOption" value="' + optionsArray[i] +'" />')
|
||||
.append('<label for="' + optionsArray[i] + '">' + optionsArray[i] + '</label><br />');
|
||||
}
|
||||
}
|
||||
|
||||
$(optionsForm).append('<button id="audarisOptionsDialogOkButton" type="button">Ok</button>');
|
||||
$(optionsForm).append('<button id="audarisOptionsDialogCancelButton" type="button">Abbrechen</button>');
|
||||
|
||||
// bind click event
|
||||
$('input[name="audarisOptionsDialogCheckAll"]').click(function() {
|
||||
var checked = $(this).attr('checked');
|
||||
|
||||
$('input[name="audarisOptionsDialogOption"]').each(function() {
|
||||
$(this).attr('checked', checked);
|
||||
});
|
||||
});
|
||||
|
||||
//bind cancel button click event
|
||||
$('#audarisOptionsDialogCancelButton').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// unbind events
|
||||
// unbind click event
|
||||
$('input[name="audarisOptionsDialogCheckAll"]').unbind('click');
|
||||
// unbind cancel button click event
|
||||
$('#audarisOptionsDialogCancelButton').unbind('click');
|
||||
// unbind ok button click event
|
||||
$('#audarisOptionsDialogOkButton').unbind('click');
|
||||
|
||||
// remove dialog
|
||||
$(dialog).empty().remove();
|
||||
$.hideModal();
|
||||
});
|
||||
|
||||
// bind ok button click event
|
||||
$('#audarisOptionsDialogOkButton').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// TODO: build value like in shop
|
||||
var value = '';
|
||||
|
||||
$('input[name="audarisOptionsDialogOption"]').each(function() {
|
||||
if ($(this).attr('checked')) {
|
||||
if(value == '') {
|
||||
value += $(this).val();
|
||||
} else {
|
||||
value += ';' + $(this).val();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (value == '' && optionType == 'radio') {
|
||||
alert("Bitte setzen sie einen wert.");
|
||||
} else {
|
||||
// unbind events
|
||||
// unbind click event
|
||||
$('input[name="audarisOptionsDialogCheckAll"]').unbind('click');
|
||||
// unbind cancel button click event
|
||||
$('#audarisOptionsDialogCancelButton').unbind('click');
|
||||
// unbind ok button click event
|
||||
$('#audarisOptionsDialogOkButton').unbind('click');
|
||||
|
||||
// remove dialog
|
||||
$(dialog).empty().remove();
|
||||
$.hideModal();
|
||||
|
||||
// call callcack
|
||||
endFunction(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user