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.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 | |
---|
53 | function submitValues(alert_msg){ |
---|
54 | var typeField = document.getElementById('cal[type]'); |
---|
55 | if (typeField && typeField.value == 'hourAppointment') |
---|
56 | if(document.getElementsByName('categories[]')[0].value == ""){ |
---|
57 | alert(alert_msg); |
---|
58 | return false; |
---|
59 | } |
---|
60 | for(i = 0; i < select_in.length; i++) |
---|
61 | select_in.options[i].selected = true; |
---|
62 | } |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | function openListUsers(newWidth,newHeight, owner){ |
---|
67 | newScreenX = screen.width - newWidth; |
---|
68 | newScreenY = 0; |
---|
69 | window.open('calendar/templates/celepar/listUsers.php?owner='+owner,"","width="+newWidth+",height="+newHeight+",screenX="+newScreenX+",left="+newScreenX+",screenY="+newScreenY+",top="+newScreenY+",toolbar=no,scrollbars=yes,resizable=no"); |
---|
70 | } |
---|
71 | |
---|
72 | function adicionaListaCalendar() |
---|
73 | { |
---|
74 | var select = window.document.getElementById('user_list_in'); |
---|
75 | var selectOpener = window.opener.document.getElementById('user_list'); |
---|
76 | for (i = 0 ; i < select.length ; i++) { |
---|
77 | |
---|
78 | if (select.options[i].selected) { |
---|
79 | isSelected = false; |
---|
80 | |
---|
81 | for(var j = 0;j < selectOpener.options.length; j++) { |
---|
82 | if(selectOpener.options[j].value == select.options[i].value){ |
---|
83 | isSelected = true; |
---|
84 | break; |
---|
85 | } |
---|
86 | } |
---|
87 | |
---|
88 | if(!isSelected){ |
---|
89 | |
---|
90 | option = window.opener.document.createElement('option'); |
---|
91 | option.value =select.options[i].value; |
---|
92 | option.text = select.options[i].text; |
---|
93 | selectOpener.options[selectOpener.options.length] = option; |
---|
94 | } |
---|
95 | |
---|
96 | } |
---|
97 | } |
---|
98 | selectOpener.options[selectOpener.options.length-1].selected = true; |
---|
99 | } |
---|
100 | function changeViewMode(chValue){ |
---|
101 | switch (chValue){ |
---|
102 | case 'hourAppointment': |
---|
103 | var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label'); |
---|
104 | for (var i=0; i < names.length; i++) |
---|
105 | { |
---|
106 | var Field = document.getElementsByName('cal['+names[i]+']'); |
---|
107 | if (Field[0]) |
---|
108 | Field[0].parentNode.parentNode.style.display = "none"; |
---|
109 | } |
---|
110 | |
---|
111 | Field = document.getElementsByName('participants[]'); |
---|
112 | Field[0].parentNode.parentNode.style.display = "none"; |
---|
113 | Field[1].parentNode.parentNode.style.display = "none"; |
---|
114 | Field = document.getElementById('txt_loading'); |
---|
115 | Field.parentNode.parentNode.style.display = "none"; |
---|
116 | Field = document.getElementsByName('cal[rpt_day][]'); |
---|
117 | Field[0].parentNode.parentNode.style.display = "none"; |
---|
118 | break; |
---|
119 | default: |
---|
120 | var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label'); |
---|
121 | for (var i=0; i < names.length; i++) |
---|
122 | { |
---|
123 | var Field = document.getElementsByName('cal['+names[i]+']'); |
---|
124 | if (Field[0]) |
---|
125 | Field[0].parentNode.parentNode.style.display = ""; |
---|
126 | } |
---|
127 | Field = document.getElementsByName('participants[]'); |
---|
128 | Field[0].parentNode.parentNode.style.display = ""; |
---|
129 | Field[1].parentNode.parentNode.style.display = ""; |
---|
130 | Field = document.getElementById('txt_loading'); |
---|
131 | Field.parentNode.parentNode.style.display = ""; |
---|
132 | Field = document.getElementsByName('cal[rpt_day][]'); |
---|
133 | Field[0].parentNode.parentNode.style.display = ""; |
---|
134 | break; |
---|
135 | } |
---|
136 | |
---|
137 | } |
---|
138 | function updateTitleField(select){ |
---|
139 | var typeField = document.getElementsByName('cal[type]'); |
---|
140 | if (typeField[0].value != 'hourAppointment') |
---|
141 | return; |
---|
142 | var titleField = document.getElementsByName('cal[title]'); |
---|
143 | var optionsArray = select.childNodes; |
---|
144 | titleField[0].value = ''; |
---|
145 | for(option in optionsArray) |
---|
146 | if (optionsArray[option].selected) |
---|
147 | titleField[0].value += optionsArray[option].text + ' '; |
---|
148 | } |
---|
149 | |
---|
150 | |
---|
151 | // Fim |
---|