[1643] | 1 | /******************************************************************************\ |
---|
| 2 | |************************** MODULO AGENDA *******************************| |
---|
| 3 | |********** SCRIPT REFERENTE A CAIXA DE INCLUSAO DE PARTICIPANTES ************| |
---|
| 4 | \******************************************************************************/ |
---|
| 5 | |
---|
| 6 | // Variaveis Locais |
---|
| 7 | var select_in = document.getElementById('user_list'); |
---|
| 8 | var select_out = document.getElementById('user_list_in'); |
---|
| 9 | var users_out = select_out ? select_out.cloneNode(true) : ''; |
---|
| 10 | var finderTimeout = ''; |
---|
| 11 | |
---|
| 12 | // Funcoes |
---|
| 13 | function showExParticipants(el,path){ |
---|
| 14 | document.getElementById('tbl_ext_participants').style.display=''; |
---|
| 15 | el.style.display='none'; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | function hideExParticipants(el,path){ |
---|
| 19 | document.getElementById('a_ext_participants').style.display = ''; |
---|
| 20 | document.getElementById('tbl_ext_participants').style.display ='none'; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | function optionFinderTimeout(obj){ |
---|
| 24 | |
---|
| 25 | clearTimeout(finderTimeout); |
---|
| 26 | var oWait = document.getElementById("wait"); |
---|
| 27 | oWait.innerHTML = 'Buscando...'; |
---|
| 28 | finderTimeout = setTimeout("optionFinder('"+obj.id+"')",500); |
---|
| 29 | } |
---|
| 30 | function optionFinder(id) { |
---|
| 31 | var oWait = document.getElementById("wait"); |
---|
| 32 | var oText = document.getElementById(id); |
---|
| 33 | for(var i = 0;i < select_out.options.length; i++) |
---|
| 34 | select_out.options[i--] = null; |
---|
| 35 | |
---|
| 36 | for(i = 0; i < users_out.length; i++){ |
---|
| 37 | if(users_out[i].text.substring(0 ,oText.value.length).toUpperCase() == oText.value.toUpperCase()) { |
---|
| 38 | sel = select_out.options; |
---|
| 39 | option = new Option(users_out[i].text,users_out[i].value); |
---|
| 40 | sel[sel.length] = option; |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | oWait.innerHTML = ' '; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | function rem() |
---|
| 47 | { |
---|
| 48 | for(var i = 0;i < select_in.options.length; i++) |
---|
| 49 | if(select_in.options[i].selected) |
---|
| 50 | select_in.options[i--] = null; |
---|
| 51 | } |
---|
| 52 | function show_disponibility() { |
---|
| 53 | |
---|
| 54 | participants = ""; |
---|
| 55 | combo = document.getElementById('user_list'); |
---|
| 56 | if(combo.length==0) { |
---|
| 57 | alert('set the participants'); |
---|
| 58 | return; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | for (i=0;i<combo.length;i++) { |
---|
| 62 | participants+=combo[i].value+","; |
---|
| 63 | } |
---|
| 64 | url = 'index.php?menuaction=calendar.uicalendar.disponibility&participants='+participants+'&date='+document.getElementById('start[str]').value; |
---|
| 65 | |
---|
| 66 | //alert(url); |
---|
| 67 | document.getElementById('frame_disponibility').src = url; |
---|
| 68 | document.getElementById('disponibility').style.display=''; |
---|
| 69 | //window.open(url); |
---|
| 70 | } |
---|
| 71 | function submitValues(alert_msg){ |
---|
| 72 | var typeField = document.getElementById('cal[type]'); |
---|
| 73 | if (typeField && typeField.value == 'hourAppointment') |
---|
| 74 | if(document.getElementsByName('categories[]')[0].value == ""){ |
---|
| 75 | alert(alert_msg); |
---|
| 76 | return false; |
---|
| 77 | } |
---|
| 78 | for(i = 0; i < select_in.length; i++) |
---|
| 79 | select_in.options[i].selected = true; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | function openListUsers(newWidth,newHeight, owner){ |
---|
| 85 | newScreenX = screen.width - newWidth; |
---|
| 86 | newScreenY = 0; |
---|
| 87 | window.open('calendar/templates/classic/listUsers.php?owner='+owner,"","width="+newWidth+",height="+newHeight+",screenX="+newScreenX+",left="+newScreenX+",screenY="+newScreenY+",top="+newScreenY+",toolbar=no,scrollbars=yes,resizable=no"); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | function adicionaListaCalendar() |
---|
| 91 | { |
---|
| 92 | var select = window.document.getElementById('user_list_in'); |
---|
| 93 | var selectOpener = window.opener.document.getElementById('user_list'); |
---|
| 94 | for (i = 0 ; i < select.length ; i++) { |
---|
| 95 | |
---|
| 96 | if (select.options[i].selected) { |
---|
| 97 | isSelected = false; |
---|
| 98 | |
---|
| 99 | for(var j = 0;j < selectOpener.options.length; j++) { |
---|
| 100 | if(selectOpener.options[j].value == select.options[i].value){ |
---|
| 101 | isSelected = true; |
---|
| 102 | break; |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | if(!isSelected){ |
---|
| 107 | |
---|
| 108 | option = window.opener.document.createElement('option'); |
---|
| 109 | option.value =select.options[i].value; |
---|
| 110 | option.text = select.options[i].text; |
---|
| 111 | selectOpener.options[selectOpener.options.length] = option; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | } |
---|
| 115 | } |
---|
| 116 | selectOpener.options[selectOpener.options.length-1].selected = true; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | // Fim |
---|