2016-09-03 15:54:33 +02:00
|
|
|
|
2016-09-04 16:27:48 +02:00
|
|
|
function bindNavToContent(containerId, fileName, loadNow)
|
2016-09-03 15:54:33 +02:00
|
|
|
{
|
2016-09-14 13:51:28 +02:00
|
|
|
$("#page-content").off();
|
2016-09-03 15:54:33 +02:00
|
|
|
$(containerId).on("click", function() {
|
2016-09-14 13:51:28 +02:00
|
|
|
$("#page-content").load("/content/"+fileName+".html");
|
2016-09-04 16:27:48 +02:00
|
|
|
});
|
2016-09-03 15:54:33 +02:00
|
|
|
if (loadNow)
|
|
|
|
{
|
2016-09-15 20:42:58 +02:00
|
|
|
$(containerId).trigger("click");
|
2016-09-03 15:54:33 +02:00
|
|
|
}
|
|
|
|
}
|
2016-09-05 17:26:29 +02:00
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
function loadContentTo(containerId, fileName)
|
|
|
|
{
|
|
|
|
$(containerId).load("/content/"+fileName+".html");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-05 17:26:29 +02:00
|
|
|
|
|
|
|
function toggleClass(obj,class1,class2)
|
|
|
|
{
|
|
|
|
if ( $(obj).hasClass(class1))
|
|
|
|
{
|
|
|
|
$(obj).removeClass(class1);
|
|
|
|
$(obj).addClass(class2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$(obj).removeClass(class2);
|
|
|
|
$(obj).addClass(class1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setClassByBool(obj,enable,class1,class2)
|
|
|
|
{
|
|
|
|
if (enable)
|
|
|
|
{
|
|
|
|
$(obj).removeClass(class1);
|
|
|
|
$(obj).addClass(class2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$(obj).removeClass(class2);
|
|
|
|
$(obj).addClass(class1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-27 23:42:24 +02:00
|
|
|
function showInfoDialog(type,header,message)
|
2016-09-06 10:14:54 +02:00
|
|
|
{
|
2016-10-27 23:42:24 +02:00
|
|
|
$('#modal_dialog .modal-bodytitle').html(header);
|
|
|
|
$('#modal_dialog .modal-bodycontent').html(message);
|
|
|
|
|
|
|
|
if (type=="success"){
|
|
|
|
$('#modal_dialog .modal-bodyicon').html('<i class="fa fa-check modal-icon-check">');
|
|
|
|
$('#modal_dialog .modal-footer-button').html('<button type="button" class="btn btn-success" data-dismiss="modal">OK</button>');
|
|
|
|
}
|
|
|
|
else if (type=="warning"){
|
|
|
|
$('#modal_dialog .modal-bodyicon').html('<i class="fa fa-warning modal-icon-warning">');
|
|
|
|
$('#modal_dialog .modal-footer-button').html('<button type="button" class="btn btn-warning" data-dismiss="modal">OK</button>');
|
|
|
|
}
|
|
|
|
else if (type=="error"){
|
|
|
|
$('#modal_dialog .modal-bodyicon').html('<i class="fa fa-warning modal-icon-error">');
|
|
|
|
$('#modal_dialog .modal-footer-button').html('<button type="button" class="btn btn-danger" data-dismiss="modal">OK</button>');
|
|
|
|
}
|
|
|
|
$('#modal_dialog').modal('show');
|
|
|
|
|
2016-09-06 10:14:54 +02:00
|
|
|
}
|
|
|
|
|
2016-10-09 10:23:04 +02:00
|
|
|
function isJsonString(str)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2016-09-06 10:14:54 +02:00
|
|
|
JSON.parse(str);
|
2016-10-09 10:23:04 +02:00
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
2016-09-06 10:14:54 +02:00
|
|
|
return e;
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
2016-10-09 10:23:04 +02:00
|
|
|
|
|
|
|
|
2016-10-10 23:15:50 +02:00
|
|
|
function createJsonEditor(container,schema,setconfig)
|
2016-10-09 10:23:04 +02:00
|
|
|
{
|
|
|
|
$('#'+container).off();
|
|
|
|
$('#'+container).html("");
|
|
|
|
|
2016-10-10 23:15:50 +02:00
|
|
|
var editor = new JSONEditor(document.getElementById(container),
|
2016-10-09 10:23:04 +02:00
|
|
|
{
|
|
|
|
theme: 'bootstrap3',
|
|
|
|
iconlib: "fontawesome4",
|
|
|
|
disable_collapse: 'true',
|
|
|
|
form_name_root: 'sa',
|
|
|
|
disable_edit_json: 'true',
|
|
|
|
disable_properties: 'true',
|
2016-10-30 17:54:38 +01:00
|
|
|
disable_array_reorder: 'true',
|
2016-10-09 10:23:04 +02:00
|
|
|
no_additional_properties: 'true',
|
2016-10-10 23:15:50 +02:00
|
|
|
schema: {
|
|
|
|
title:'',
|
|
|
|
properties: schema
|
|
|
|
}
|
2016-10-09 10:23:04 +02:00
|
|
|
});
|
2016-10-10 23:15:50 +02:00
|
|
|
|
|
|
|
$('#editor_container .well').css("background-color","white");
|
|
|
|
$('#editor_container .well').css("border","none");
|
|
|
|
$('#editor_container .well').css("box-shadow","none");
|
|
|
|
$('#editor_container .btn').addClass("btn-primary");
|
|
|
|
$('#editor_container h3').first().remove();
|
|
|
|
|
|
|
|
if (setconfig)
|
|
|
|
{
|
|
|
|
for(var key in editor.root.editors)
|
|
|
|
{
|
|
|
|
editor.getEditor("root."+key).setValue( parsedConfJSON[key] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return editor;
|
2016-10-09 10:23:04 +02:00
|
|
|
}
|