/* $Revision$ $Id$ File: mobile.js Description: clientside functions for pda/* */ window.fcltmobile = 1; $(document).bind("mobileinit", function(){ // Enhancement to use history.replaceState in supported browsers, // to convert the hash-based Ajax URL into the full document path. // Note that we recommend disabling this feature if Ajax is disabled // or if extensive use of external links are used. //$.mobile.pushStateEnabled = false; if (window.FcltMgr) FcltMgr.fixActiveelementError(); }); $(document).bind("pageinit", function(){ $("i.dateklikker,i.timeklikker").each(function() { $(this).appendTo($(this).prev()); }); }); function McltCallbackAndThen(afterAction) { return function (json, textStatus) { if (json.message) alert(json.message); // Normaal door FcltMgr.closeDetail if (json.warning) alert(json.warning); json.message = null; json.warning = null; if (json.success) { if (afterAction) afterAction(json); } } }; function McltCallbackAndThenAlways(afterAction) { return function (json, textStatus) { if (json.message) alert(json.message); if (json.warning) alert(json.warning); json.message = null; json.warning = null; if (afterAction) afterAction(json); } }; function jqToast (msg) { $("

"+msg+"

") .css({ display: "block", opacity: 0.90, position: "absolute", padding: "7px", "text-align": "center", width: "270px", left: (($(window).width() - 284)/2)+"px", top: ($(window).scrollTop() + $(window).height()/2)+"px" }) .appendTo( $.mobile.pageContainer ).delay( 2500 ) .fadeOut( 400, function(){ $(this).remove(); }); } var McltCallbackSaved = McltCallbackAndThen(function (json) { if (json.success) jqToast(L("lcl_mobile_data_saved")); }); var McltCallbackRefresh = McltCallbackAndThen(function (json) { window.location.href = window.location.href; }); var McltCallbackClose = McltCallbackAndThen(function (json) { window.history.back(1); }); var McltCallbackHome = McltCallbackAndThen(function (json) { // window.history.back(1); doet geen refresh als je bijvoorbeeld net een reservering hebt verwijderd window.location.href = "./facilitor.asp" }); function onBijlagenMobile(formurl, // protected saveUrl, // protected multi, objButton) { // Vorige eventueel opruimen $("#bijlagepopup").trigger( "destroy" ).remove(); // eventuele vorige opruimen var html = ''; html = '
' + 'Close' + html + '
'; var $html = $(html); $( "body" ).append ( $html ); $html.trigger( "create" ); $("#bijlagepopup").on("popupafterclose", function(event, ui) { if (window.return_data) // gezet door BijlagenForm.asp { // Overkill alert(window.return_data.fileName + " is toegevoegd"); if (window.return_data.fileName) { if ($(objButton).is("[src]")) { afterUploadForm(window.return_data.fileName); } else { $(objButton).val(window.return_data.fileName) .show() .attr("onclick", "") .attr("readonly", "1") .parent().next().hide(); // de 'Add' knop } } } // Als we dit weglaten krijgen we obscure clientside jQuery errors ('Array not defined etc') $("iframe.mfcltmodal").attr("src", "../shared/empty.html"); }); $("#bijlagepopup").popup().popup( "open" ); $html.find("iframe").attr("src", formurl); }