function initializeMainMenu(menuid) { $.ajax({ type: "GET", dataType: "json", url: "php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion", async: false, success : function(moduleEntries) { $("#loggedinuser").html(moduleEntries.user); $("#versioninfo").html("v" + moduleEntries.version); var li='
  • Module
  • '; $.each(moduleEntries.menu, function (i, module) { var name = module.name; var link = module.link; if (name != "Abmelden") { li += '
  • ' + name + '
  • '; } else { li += '
  • ' + name + '
  • '; } }); $(menuid).empty().append(li).promise().done(function () { $(menuid).listview("refresh"); }) }, error: function( text ) { alert( "Kommunikationsproblem zum Server bei Modulabfrage!" ); } }); $(".modulebutton").off("click").on("click", function (e) { var view = $(this).attr("href"); doAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser", { view: view}, null, "Problem Benutzerdatenpflege"); }); } function hideMenu() { $( "#modulepanel" ).panel( "close" ); $("#menuswitch").off("click").on("click", function (e) { $("#menuswitch").trigger("mouseout"); e.stopImmediatePropagation(); e.preventDefault(); $( "#modulepanel" ).panel( "open" );; }); } // to make IE happy... function refreshList(selector) { if ( $(selector).hasClass('ui-listview')) { $(selector).listview('refresh'); } else { $(selector).trigger('create'); } } function doAjax(getOrPost,url,data,functionToCallIfSuccess,errorMsg) { $.ajax({ type: getOrPost, url: url, dataType: "json", data: data, async: false, success : function(jsonContent) { if (functionToCallIfSuccess != null) { functionToCallIfSuccess(jsonContent); } }, error: function( text ) { if (errorMsg != null) { alert( "Kommunikationsfehler zum Server: " + errorMsg); } } }); } function doAjaxSuppressError(getOrPost,url,data,functionToCallIfSuccess,errorMsg) { $.ajax({ type: getOrPost, url: url, dataType: "json", data: data, async: false, success : function(jsonContent) { if (functionToCallIfSuccess != null) { functionToCallIfSuccess(jsonContent); } }, error: function( text ) { functionToCallIfSuccess("ERROR"); } }); } function doAjaxNonJsonNonCall(getOrPost,url,data) { $.ajax({ type: getOrPost, data : data, url: url, async: false, error: function( text ) { alert( "Kommunikationsproblem zum Server" ); } }); }