source: trunk/calendar/templates/celepar/js/edit.js @ 583

Revision 583, 5.0 KB checked in by niltonneto, 15 years ago (diff)

Resolve #390.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
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 = '&nbsp;';
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(){                               
54                for(i = 0; i < select_in.length; i++)
55                        select_in.options[i].selected = true;
56        }
57       
58       
59       
60        function openListUsers(newWidth,newHeight, owner){                                     
61                newScreenX  = screen.width - newWidth;         
62                newScreenY  = 0;               
63                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");
64        }
65
66        function adicionaListaCalendar()
67        {
68                var select = window.document.getElementById('user_list_in');
69                var selectOpener = window.opener.document.getElementById('user_list');
70                for (i = 0 ; i < select.length ; i++) {                         
71
72                        if (select.options[i].selected) {
73                                isSelected = false;
74
75                                for(var j = 0;j < selectOpener.options.length; j++) {                                                                                                                                                   
76                                        if(selectOpener.options[j].value == select.options[i].value){
77                                                isSelected = true;                                             
78                                                break; 
79                                        }
80                                }
81
82                                if(!isSelected){
83
84                                        option = window.opener.document.createElement('option');
85                                        option.value =select.options[i].value;
86                                        option.text = select.options[i].text;
87                                        selectOpener.options[selectOpener.options.length] = option;     
88                                }
89                               
90                        }
91                }
92                selectOpener.options[selectOpener.options.length-1].selected = true;
93        }
94function changeViewMode(chValue){
95        switch (chValue){
96                case 'hourAppointment':
97                        var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
98                        for (var i=0; i < names.length; i++)
99                        {
100                                var Field = document.getElementsByName('cal['+names[i]+']');
101                                if (Field[0])
102                                        Field[0].parentNode.parentNode.style.display = "none";
103                        }
104
105                        Field = document.getElementsByName('participants[]');
106                        Field[0].parentNode.parentNode.style.display = "none";
107                        Field[1].parentNode.parentNode.style.display = "none";
108                        Field = document.getElementById('txt_loading');
109                        Field.parentNode.parentNode.style.display = "none";
110                        Field = document.getElementsByName('cal[rpt_day][]');
111                        Field[0].parentNode.parentNode.style.display = "none";
112                        break;
113                default:
114                        var names=new Array('title','priority','location','alarmhours','alarmminutes','recur_type','rpt_use_end','recur_interval','rpt_label');
115                        for (var i=0; i < names.length; i++)
116                        {
117                                var Field = document.getElementsByName('cal['+names[i]+']');
118                                if (Field[0])
119                                        Field[0].parentNode.parentNode.style.display = "";
120                        }
121                        Field = document.getElementsByName('participants[]');
122                        Field[0].parentNode.parentNode.style.display = "";
123                        Field[1].parentNode.parentNode.style.display = "";
124                        Field = document.getElementById('txt_loading');
125                        Field.parentNode.parentNode.style.display = "";
126                        Field = document.getElementsByName('cal[rpt_day][]');
127                        Field[0].parentNode.parentNode.style.display = "";
128                        break;
129        }
130
131}
132function updateTitleField(select){
133        var typeField = document.getElementsByName('cal[type]');
134        if (typeField[0].value != 'hourAppointment')
135                return;
136        var titleField = document.getElementsByName('cal[title]');
137        var optionsArray = select.childNodes;
138        titleField[0].value = '';
139        for(option in optionsArray)
140                if (optionsArray[option].selected)
141                        titleField[0].value += optionsArray[option].text + ' ';
142}
143
144       
145// Fim       
Note: See TracBrowser for help on using the repository browser.