// where our WebSockets logic will go later var socket, host; var notification_count = 0; var notification_array=new Array(); var ajaxnotifications_url = "index.php?module=Schedulers&action=EcmNotificationAjax&to_pdf=1"; var audiotypes = { "mp3" : "audio/mpeg", "mp4" : "audio/mp4", "ogg" : "audio/ogg", "wav" : "audio/wav" } function ss_soundbits(sound) { var audio_element = document.createElement('audio') if (audio_element.canPlayType) { for (var i = 0; i < arguments.length; i++) { var source_element = document.createElement('source') source_element.setAttribute('src', arguments[i]) if (arguments[i].match(/\.(\w+)$/i)) source_element.setAttribute('type', audiotypes[RegExp.$1]) audio_element.appendChild(source_element) } audio_element.load() audio_element.playclip = function() { audio_element.pause() audio_element.currentTime = 0 audio_element.play() } return audio_element } } var clicksound = ss_soundbits( 'include/ECM/EcmNotifications/sounds/bell_ring.ogg', "include/ECM/EcmNotifications/sounds/bell_ring.mp3") host = "wss://system.saas-systems.pl:444"; function connect() { try { socket = new WebSocket(host); addMessage("Socket State: " + socket.readyState); socket.onopen = function() { addMessage("Socket Status: " + socket.readyState + " (open)"); } socket.onclose = function() { socket.close(); } socket.onmessage = function(msg) { DrawMessage(msg.data); } } catch (exception) { addMessage("Error: " + exception); } } function addMessage(msg) { $("#chat-log").append("
" + msg + "
"); } function DrawNotificationDiv(){ var html=''; var toggle="if($('#notification_list').css('display')=='none'){$('#notification_list').show();}else{$('#notification_list').hide();}"; if(notification_array.length>1){ html='Masz '+notification_array.length+' nowe przypomnienia!'; } if(notification_array.length==0){ html='Brak nowych przypomnień.
'; } if(notification_array.length==1) { html='Masz 1 nowe przypomnienie!'; } var div_header=''; $("#notification-Div").html(html+div_header); } function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for( var i=0; i < 5; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } function leaveSelect(id){ var html=''; return html; } function dialogContent(obj,id){ if(obj.date_start === null){ obj.date_start='brak'; } var toggle="if($('#leave_"+obj.id+"').css('display')=='none'){$('#leave_"+obj.id+"').show();}else{$('#leave_"+obj.id+"').hide();}"; var html='| Temat: | '+obj.name+' |
| Data rozpoczęcia: | '+obj.date_start.substr(0,16)+' |
| Opis: | '+obj.description+' |