103 lines
2.8 KiB
JavaScript
103 lines
2.8 KiB
JavaScript
function ModalLoad(idmodal,title,path) {
|
|
$("#"+idmodal+" .modal-header h4").text(title);
|
|
$("#"+idmodal+" #framemodal").attr("src",path);
|
|
}
|
|
|
|
$(document).on('ready', function(){
|
|
$(".pick-a-color").pickAColor({
|
|
showSpectrum : true,
|
|
showSavedColors : true,
|
|
saveColorsPerElement : true,
|
|
fadeMenuToggle : true,
|
|
showAdvanced : true,
|
|
showBasicColors : true,
|
|
showHexInput : true,
|
|
allowBlank : true,
|
|
inlineDropdown : true
|
|
});
|
|
|
|
$("a[data-method]").on('click',function(){
|
|
var $el = $(this);
|
|
|
|
var $form = $('<form/>').hide();
|
|
var doit = true;
|
|
|
|
//form options
|
|
$form.attr({
|
|
'action' : $el.attr('href'),
|
|
'method':'post'
|
|
});
|
|
|
|
//adding the _method hidden field
|
|
$form.append($('<input/>',{
|
|
type:'hidden',
|
|
name:'_method'
|
|
}).val($el.data('method')));
|
|
|
|
var data = $el.data();
|
|
var match, name;
|
|
for(var prop in data) {
|
|
if(data.hasOwnProperty(prop)){
|
|
match = prop.match(/^field(.*)$/);
|
|
if(match) {
|
|
name = match[1];
|
|
$form.append($('<input/>',{
|
|
type:'text',
|
|
name: name.toLowerCase()
|
|
}).val(data[prop]));
|
|
}
|
|
}
|
|
}
|
|
|
|
//adding a CSRF if needs
|
|
if ($(this).data('csrf'))
|
|
{
|
|
var csrf = $(this).data('csrf').split(':');
|
|
$form.append($('<input/>',{
|
|
type:'hidden',
|
|
name:csrf[0]
|
|
}).val(csrf[1]));
|
|
}
|
|
|
|
if($(this).data('confirm')){
|
|
doit = confirm($(this).data('confirm'));
|
|
}
|
|
|
|
if($(this).data('error')){
|
|
alert($(this).data('error'));
|
|
} else {
|
|
//add form to parent node
|
|
$(this).parent().append($form);
|
|
|
|
if(doit){
|
|
$form.submit();
|
|
}
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
if( typeof CKEDITOR !== 'undefined') {
|
|
CKEDITOR.on('dialogDefinition', function(ev) {
|
|
try {
|
|
var dialogName = ev.data.name;
|
|
var dialogDefinition = ev.data.definition;
|
|
|
|
if(dialogName == 'link') {
|
|
var informationTab = dialogDefinition.getContents('target');
|
|
var targetField = informationTab.get('linkTargetType');
|
|
targetField['default'] = '_blank';
|
|
}
|
|
|
|
/*
|
|
dialogDefinition.onShow = function() {
|
|
this.move(this.getPosition().x,0); // Top center
|
|
};
|
|
*/
|
|
|
|
} catch(exception) {
|
|
|
|
}
|
|
});
|
|
}
|
|
}); |