| 1 |
//<![CDATA[ |
| 2 |
function importBookings(){ |
| 3 |
var ajax_crm_message = 'Working...'; |
| 4 |
document.getElementById('ajax_working').innerHTML = |
| 5 |
'<div class="info_message ajax_message" id="ajax_message">\n\ |
| 6 |
<div style="float:left;">'+ajax_crm_message+'</div> \n\ |
| 7 |
<div style="float:left;width:80px;margin-top:-3px;">\n\ |
| 8 |
<img src="'+wpdev_crm_plugin_url+'/img/ajax-loader.gif">\n\ |
| 9 |
</div>\n\ |
| 10 |
</div>'; |
| 11 |
|
| 12 |
// Ajax POST here |
| 13 |
jWPDev.ajax({ // Start Ajax Sending |
| 14 |
url: wpdev_crm_plugin_url+ '/' + wpdev_crm_plugin_filename, |
| 15 |
type:'POST', |
| 16 |
success: function (data, textStatus){ if( textStatus == 'success') jWPDev('#ajax_respond').html( data );}, |
| 17 |
error:function (XMLHttpRequest, textStatus, errorThrown){ window.status = 'Ajax sending Error status:'+ textStatus; alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText); if (XMLHttpRequest.status == 500) { alert('Please check at this page according this error:' + ' http://onlinebookingcalendar.com/faq/#faq-13'); } }, |
| 18 |
// beforeSend: someFunction, |
| 19 |
data:{ |
| 20 |
ajax_action_crm : 'IMPORT_BOOKINGS' |
| 21 |
} |
| 22 |
}); |
| 23 |
} |
| 24 |
//]]> |
| 25 |
|
| 26 |
function showAllRecordsAtOnePage(){ |
| 27 |
//var myloc = window.location.href ; |
| 28 |
//myloc = myloc.replace(/(&show_all_records=1)|(&show_all_records=0)/g, ""); |
| 29 |
//window.location.href = myloc + '&show_all_records=1'; |
| 30 |
window.location.href = setURLParameter('show_all_records',1,window.location.href); |
| 31 |
} |
| 32 |
|
| 33 |
function showNormalRecordsAtOnePage(){ |
| 34 |
//var myloc = window.location.href ; |
| 35 |
//myloc = myloc.replace(/(&show_all_records=1)|(&show_all_records=0)/g, ""); |
| 36 |
//window.location.href = myloc; |
| 37 |
window.location.href = setURLParameter('show_all_records',0,window.location.href); |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
function openModalWindowCRM(content_ID){ |
| 43 |
//alert('!!!' + content); |
| 44 |
jWPDev('.modal_content_text').attr('style','display:none;') |
| 45 |
document.getElementById( content_ID ).style.display = 'block'; |
| 46 |
var buttons = {};//{ "Ok": wpdev_crm_dialog_close }; |
| 47 |
|
| 48 |
jWPDev("#wpdev-crm-dialog").dialog( { |
| 49 |
autoOpen: false, |
| 50 |
width: 700, |
| 51 |
height: 200, |
| 52 |
buttons:buttons, |
| 53 |
draggable:false, |
| 54 |
hide: 'slide', |
| 55 |
resizable: false, |
| 56 |
modal: true, |
| 57 |
title: '<img src="'+wpdev_crm_plugin_url+ '/img/crm-16x16.png" align="middle" style="margin-top:1px;"> Orders' |
| 58 |
}); |
| 59 |
jWPDev("#wpdev-crm-dialog").dialog("open"); |
| 60 |
} |
| 61 |
|
| 62 |
function wpdev_crm_dialog_close(){ |
| 63 |
jWPDev("#wpdev-crm-dialog").dialog("close"); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
function wpdev_togle_box(boxid){ |
| 69 |
if ( jWPDev( '#' + boxid ).hasClass('closed') ) jWPDev('#' + boxid).removeClass('closed'); |
| 70 |
else jWPDev('#' + boxid).addClass('closed'); |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
// Support function. |
| 76 |
|
| 77 |
// Set parameters to url and return url string |
| 78 |
function setURLParameter(myParam, myValue, myLink) { |
| 79 |
var myloc = myLink ; |
| 80 |
|
| 81 |
var single_par = ''; |
| 82 |
var params = myloc.split('?'); |
| 83 |
var return_link = params[0]; |
| 84 |
params = params[1]; |
| 85 |
params = params.split('&'); |
| 86 |
|
| 87 |
var isSet = false; |
| 88 |
for(var i=0; i< params.length; i++){ |
| 89 |
single_par = params[i].split('='); |
| 90 |
|
| 91 |
if ( i !== 0) return_link += '&'; |
| 92 |
else return_link += '?'; |
| 93 |
|
| 94 |
if (single_par[0]==myParam) { |
| 95 |
isSet = true; |
| 96 |
return_link += single_par[0] + '=' + myValue; |
| 97 |
} else { |
| 98 |
return_link += single_par[0] + '=' + single_par[1]; |
| 99 |
} |
| 100 |
|
| 101 |
} |
| 102 |
|
| 103 |
if (! isSet) { |
| 104 |
return_link += '&' + myParam + '=' + myValue; |
| 105 |
} |
| 106 |
|
| 107 |
return return_link; |
| 108 |
} |
| 109 |
|
| 110 |
function reloadpage_with_param(myParam, myValue){ |
| 111 |
window.location.href = setURLParameter( myParam, myValue ,window.location.href); |
| 112 |
} |