source: trunk/expressoMail1_2/js/QuickCatalogSearch.js @ 325

Revision 325, 21.2 KB checked in by rafaelraymundo, 16 years ago (diff)

Alterações realizadas para unificação do ExpressoMail?


r39 | 50673548368 | 2008-06-24 18:17:33 -0300 (Ter, 24 Jun 2008) | 9 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
M /trunk/expressoMail1_2/js/QuickCatalogSearch.js

Os arquivos abaixo sofreram modificacoes para tratar a exibicao do departamento na opcao "Pesquisar" do email.

  • alteracao na funcao catalogsearch() em expressoMail1_2/inc/class.ldap_functions.inc.php
  • alteracao na funcao searchCatalogList em expressoMail1_2/js/QuickCatalogSearch.js

r38 | 98954890059 | 2008-06-24 18:07:11 -0300 (Ter, 24 Jun 2008) | 1 line
Caminhos mudados:

M /trunk/expressoMail1_2/js/rich_text_editor.js

Correcao de traducoes e remocao da variavel defaultDraftsFodler


r35 | 98954890059 | 2008-06-19 21:11:11 -0300 (Qui, 19 Jun 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
M /trunk/expressoMail1_2/js/QuickCatalogSearch.js

Melhoria inseridas pelo Emerson:

Pesquisa por catalogos externos na Lupa(f9).


r34 | 00105772038 | 2008-06-19 19:51:58 -0300 (Qui, 19 Jun 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/templates/default/preferences.tpl

Em preferências do Email foi removida a opção duplicada:

  • Salvar rascunhos automaticamente

r33 | 98954890059 | 2008-06-19 19:23:04 -0300 (Qui, 19 Jun 2008) | 2 lines
Caminhos mudados:

M /trunk/expressoMail1_2/js/draw_api.js

correcao de bug que nao mostrava a cota do usuario ao abrir o expressoMail.


r32 | 98954890059 | 2008-06-19 18:17:39 -0300 (Qui, 19 Jun 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.ScriptS.inc.php
M /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
M /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
M /trunk/expressoMail1_2/index.php
M /trunk/expressoMail1_2/js/DropDownContacts.js
M /trunk/expressoMail1_2/js/InfoContact.js
M /trunk/expressoMail1_2/js/TreeS.js
M /trunk/expressoMail1_2/js/TreeShow.js
M /trunk/expressoMail1_2/js/abas.js
M /trunk/expressoMail1_2/js/common_functions.js
M /trunk/expressoMail1_2/js/doiMenuData.js
M /trunk/expressoMail1_2/js/drag_area.js
M /trunk/expressoMail1_2/js/draw_api.js
M /trunk/expressoMail1_2/js/globals.js
M /trunk/expressoMail1_2/js/main.js
M /trunk/expressoMail1_2/js/rich_text_editor.js
M /trunk/expressoMail1_2/js/search.js
M /trunk/expressoMail1_2/js/shortcut.js
M /trunk/expressoMail1_2/preferences.php
M /trunk/expressoMail1_2/setup/phpgw_pt-br.lang
M /trunk/expressoMail1_2/setup/setup.inc.php
M /trunk/expressoMail1_2/templates/default/index.tpl
M /trunk/expressoMail1_2/templates/default/preferences.tpl

Corcacoes da celepar do bug das imagens e tabelas


r30 | 00105772038 | 2008-06-05 18:12:17 -0300 (Qui, 05 Jun 2008) | 5 lines
Caminhos mudados:

M /trunk/expressoMail1_2/js/common_functions.js
M /trunk/expressoMail1_2/js/globals.js

  • Foram inseridas funcionalidades para:

globals.js: Extenções de imagens permitidas "allowFileExtensions"

common_functions.js: Alterada a função validateFileExtension para rejeitar arquivos que não sejam imagens no corpo do email


r28 | 98954890059 | 2008-05-28 17:37:52 -0300 (Qua, 28 Mai 2008) | 2 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
M /trunk/expressoMail1_2/js/main.js

Alterada a funcao empty_trash() para mudar de Lixeira para imapDefaultTrashFolder.


r27 | 00105772038 | 2008-05-28 17:11:41 -0300 (Qua, 28 Mai 2008) | 1 line
Caminhos mudados:

M /trunk/expressoMail1_2/setup/phpgw_pt-br.lang

Incluida tradução para mensagem de 'alert' ao tentar excluir emails de uma pasta compartilhada


r26 | 98954890059 | 2008-05-28 13:08:26 -0300 (Qua, 28 Mai 2008) | 1 line
Caminhos mudados:

M /trunk/expressoMail1_2/js/main.js

Inserido get_lang na ACL das pastas compartilhadas. Função move_msgs()


r24 | 98954890059 | 2008-05-27 17:53:30 -0300 (Ter, 27 Mai 2008) | 2 lines
Caminhos mudados:

M /trunk/expressoMail1_2/js/preferences.js

Aumentado o tamanho da janela javascript das preferencias do expressoMail.


r23 | 03436989789 | 2008-05-27 17:43:54 -0300 (Ter, 27 Mai 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
M /trunk/expressoMail1_2/js/QuickCatalogSearch.js

Substituição de links no email.


r22 | 98954890059 | 2008-05-27 17:07:32 -0300 (Ter, 27 Mai 2008) | 2 lines
Caminhos mudados:

M /trunk/expressoMail1_2/js/draw_api.js

Corrigido um bug na visualizacao das pastas compartilhadas.


r19 | 03436989789 | 2008-05-27 15:37:01 -0300 (Ter, 27 Mai 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php

Pesquisa em catalogos externos


r17 | 03436989789 | 2008-05-27 13:18:56 -0300 (Ter, 27 Mai 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
M /trunk/expressoMail1_2/js/QuickCatalogSearch.js

Busca de catálogos externos no email.


r15 | 98954890059 | 2008-05-27 12:19:50 -0300 (Ter, 27 Mai 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
M /trunk/expressoMail1_2/js/QuickCatalogSearch.js

Procura em catálogos externos


r6 | 98954890059 | 2008-05-21 16:14:33 -0300 (Qua, 21 Mai 2008) | 2 lines
Caminhos mudados:

M /trunk/expressoMail1_2/js/draw_api.js

Correção para atualizar a visualização das cotas
de pastas compartilhadas ao mudar de pasta.


r5 | 98954890059 | 2008-05-21 16:02:37 -0300 (Qua, 21 Mai 2008) | 3 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
M /trunk/expressoMail1_2/js/draw_api.js

Alterações iniciais do serpro:

-Mostrar quotas das pastas compartilhadas


r4 | 03436989789 | 2008-05-21 13:25:29 -0300 (Qua, 21 Mai 2008) | 10 lines
Caminhos mudados:

M /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
M /trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
M /trunk/expressoMail1_2/index.php
M /trunk/expressoMail1_2/js/common_functions.js
M /trunk/expressoMail1_2/js/filter.js
M /trunk/expressoMail1_2/js/main.js
M /trunk/expressoMail1_2/js/preferences.js
M /trunk/expressoMail1_2/js/rich_text_editor.js
M /trunk/expressoMail1_2/preferences.php
M /trunk/expressoMail1_2/setup/phpgw_pt-br.lang
M /trunk/expressoMail1_2/templates/default/preferences.tpl

Alterações iniciais do sepro:

  • Assinatura automática no corpo das mensagens
  • Fixar assinatura no corpo das mensagens
  • Questão dos Catálogos Externos (Ao clicar em um email o módulo abre nova mensagem)
  • Inserção de imagens em Firefox3
  • Quota nas pastas compartilhadas
  • Traduções nas pastas

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1        function emQuickCatalogSearch ()
2        {
3                this.arrayWin = new Array();
4                this.el;
5                this.cc_contacts = new Array();
6                this.cc_groups  = new Array();
7        }
8
9        emQuickCatalogSearch.prototype.showList = function(data, begin, end){
10                id = '1';
11                _this = this;
12
13                var el = document.createElement("DIV");
14                el.style.visibility = "hidden";
15                el.style.position = "absolute";
16                el.style.left = "0px";
17                el.style.top = "0px";
18                el.style.width = "0px";
19                el.style.height = "0px";
20                el.id = 'window_QuickCatalogSearch';
21                document.body.appendChild(el);
22                el.innerHTML = "";
23               
24                if (document.getElementById('select_QuickCatalogSearch') == null){
25
26                        var title_innerHTML = get_lang('Select a name') + ':';
27                        if (data.quickSearch_only_in_userSector)
28                                title_innerHTML += "<font color='BLACK' nowrap> ("+get_lang('Showing only the results found in your organization')+".)</font>"
29
30                        var title = document.createElement("SPAM");
31                        title.id = 'window_QuickCatalogSearch_title';
32                        title.innerHTML = "&nbsp;&nbsp;<b><font color='BLUE' nowrap>"+title_innerHTML+"</font></b><br>&nbsp;&nbsp;";
33                        el.appendChild(title);
34                       
35                        var cmb = document.createElement("SELECT");
36                        cmb.id = "select_QuickCatalogSearch";
37                        cmb.style.width = "685px"; // na comunidade valor eh 585px
38                        cmb.size = "12";
39                        cmb.onkeypress = function (e)
40                        {
41                                if (is_ie)
42                                {
43                                        if ((window.event.keyCode) == 13)
44                                        {
45                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
46                                        }
47                                        else if ((window.event.keyCode) == 27)
48                                        {
49                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
50                                        }
51                                }
52                                else
53                                {
54                                        if ((e.keyCode) == 13)
55                                        {
56                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
57                                        }
58                                        else if ((e.keyCode) == 27)
59                                        {
60                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
61                                        }
62                                }
63                        };
64                        el.appendChild(cmb);
65
66                        var space = document.createElement('SPAN');
67                        space.innerHTML = "<BR>&nbsp;&nbsp;";
68                        el.appendChild(space);
69
70                        var butt = document.createElement('BUTTON');
71                        var buttext = document.createTextNode('OK');
72                        butt.id = "QuickCatalogSearch_button_ok";
73                        butt.appendChild(buttext);
74                        butt.onclick = function () {QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);};
75                        el.appendChild(butt);
76
77                        var space = document.createElement('SPAN');
78                        space.innerHTML = "&nbsp;&nbsp;";
79                        el.appendChild(space);
80
81                        var butt = document.createElement('BUTTON');
82                        butt.id = "QuickCatalogSearch_button_close";
83                        var buttext = document.createTextNode(get_lang('Close'));
84                        butt.appendChild(buttext);
85                        butt.onclick = function () {QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);};
86                        el.appendChild(butt);
87                }
88                else{
89                        var title_innerHTML = get_lang('Select a name') + ':';
90                        if (data.quickSearch_only_in_userSector)
91                                title_innerHTML += "<font color='BLACK' nowrap> ("+get_lang('Showing only the results found in your organization')+".)</font>"
92
93                        var title = Element('window_QuickCatalogSearch_title');
94                        title.innerHTML = "&nbsp;&nbsp;<b><font color='BLUE' nowrap>"+title_innerHTML+"</font></b><br>&nbsp;&nbsp;";
95                       
96                        var cmb = document.getElementById('select_QuickCatalogSearch');
97                        cmb.onkeypress = function (e)
98                        {
99                                if (is_ie)
100                                {
101                                        if ((window.event.keyCode) == 13)
102                                        {
103                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
104                                        }
105                                        else if ((window.event.keyCode) == 27)
106                                        {
107                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
108                                        }
109                                }
110                                else
111                                {
112                                        if ((e.keyCode) == 13)
113                                        {
114                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
115                                        }
116                                        else if ((e.keyCode) == 27)
117                                        {
118                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
119                                        }
120                                }
121                        };
122
123                        for (i=0; i<cmb.length; i++)
124                                cmb.options[i--] = null;
125                       
126                        var butt_ok = document.getElementById("QuickCatalogSearch_button_ok");
127                        var butt_close = document.getElementById("QuickCatalogSearch_button_close");
128                        butt_ok.onclick = function () {QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);};
129                        butt_close.onclick = function () {QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);};
130                }
131
132                for (i=0; i<data.length; i++){
133                        var Op = document.createElement("OPTION");
134                        Op.text = data[i].cn + ' (' + data[i].mail + ')';
135                        if (data[i].phone != '')
136                                Op.text += ' - ' + data[i].phone;
137                        if (data[i].ou != '')
138                                Op.text += ' - ' + data[i].ou; // adicionado "data[i].ou" para exibir setor (F9)
139                        Op.value = '"' + data[i].cn + '" ' + '<' + data[i].mail + '>';
140                        cmb.options.add(Op);
141
142                }
143                cmb.options[0].selected = true;
144                _this.showWindow(el);
145        }
146       
147        emQuickCatalogSearch.prototype.showWindow = function (div)
148        {
149                if(! div) {
150                        alert(get_lang('The list has no participant.'));
151                        return;
152                }
153                                                       
154                if(! this.arrayWin[div.id]) {
155                        div.style.width = "700px"; //na comunidade valor eh 600px
156                        div.style.height = "230px";
157                        var title = get_lang('The results were found in the Global Catalog')+':';
158                        var wHeight = div.offsetHeight + "px";
159                        var wWidth =  div.offsetWidth   + "px";
160                        div.style.width = div.offsetWidth - 5;
161
162                        win = new dJSWin({                     
163                                id: 'QuickCatalogSearch_'+div.id,
164                                content_id: div.id,
165                                width: wWidth,
166                                height: wHeight,
167                                title_color: '#3978d6',
168                                bg_color: '#eee',
169                                title: title,                                           
170                                title_text_color: 'white',
171                                button_x_img: '../phpgwapi/images/winclose.gif',
172                                border: true });
173                       
174                        this.arrayWin[div.id] = win;
175                        win.draw();
176                }
177                else {
178                        win = this.arrayWin[div.id];
179                }
180                //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "";
181                win.open();
182                document.getElementById('select_QuickCatalogSearch').focus();
183        }
184       
185        emQuickCatalogSearch.prototype.transfer_result = function (field, ID, begin, end){
186                cm = document.getElementById('select_QuickCatalogSearch');
187                option_selected = cm.options[cm.selectedIndex].value + ", ";
188                emailList = document.getElementById(field + "_" + ID).value;
189               
190                new_emailList = emailList.substring(0, begin) + option_selected + emailList.substring((parseInt(end) + 2), emailList.length);
191                document.getElementById(field + "_" + ID).value = new_emailList;
192                document.getElementById(field + "_" + ID).focus();
193               
194                //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "none";
195                this.arrayWin['window_QuickCatalogSearch'].close();
196        }
197       
198        emQuickCatalogSearch.prototype.close_QuickSearch_window = function (field, ID){
199                //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "none";
200                document.getElementById(field + "_" + ID).focus();
201                this.arrayWin['window_QuickCatalogSearch'].close();
202        }
203
204        emQuickCatalogSearch.prototype.close_window = function(id) {
205                this.arrayWin[id].close();
206                var group_values = Element('list_values');
207                var user_values = Element('user_values');       
208        }
209        emQuickCatalogSearch.prototype.showCatalogList = function (border_id){
210                var el = Element('catalog_list');
211
212                if(el) {
213                        Element('border_id').value = border_id;
214                        win = this.arrayWin[el.id];
215                        win.open();
216                        return;         
217                }
218                var border_input   = document.createElement("INPUT");
219                border_input.type  = 'hidden';
220                border_input.id    = 'border_id';
221                border_input.value = border_id;
222                document.body.appendChild(border_input);
223                el = document.createElement("DIV");             
224                el.id = 'catalog_list';
225                document.body.appendChild(el);                 
226                el.style.visibility = "hidden";
227                el.style.position = "absolute";
228                el.style.width = "700px"; // na comunidade valor eh 495px
229                el.style.height = is_ie ? "360px" : "375px";           
230                el.style.left = "0px";
231                el.style.top = "0px";                   
232                el.innerHTML = "<table border='0' cellpading='0' cellspacing='0' width='100%'>"+
233                                           "<tr><td id='td1' style='cursor:pointer' align='center' onclick='QuickCatalogSearch.select_div(\"tab1\")'><a href='#' class='catalog' onclick='QuickCatalogSearch.select_div(\"tab1\");'>"+get_lang('Global Catalog')+"</a></td>"+
234                                           "<td id='td2' style='background:#cecece;cursor:pointer' onclick='QuickCatalogSearch.select_div(\"tab2\")' align='center'><a href='#' class='catalog' onclick='QuickCatalogSearch.select_div(\"tab2\");'>"+get_lang('Personal Catalog')+"</a></td></tr>"+
235                                           '</table>'+
236                                           '<div id="tab1" align="center"><br>'+
237                                           '<table border="0" cellpading="0" cellspacing="0">'+
238                                           '<tr><td>'+get_lang("Select an organization and click on button <b>Search</b>")+'&nbsp;:</td></tr>'+
239                                        '<tr><td><select style="width:150px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select>&nbsp'+
240                                        '<select id="select_organization" style="width:100px" name="select_organization"></select>&nbsp;'+   
241                                        '<input type="text" id="search_for" name="search_for" value="" size="10" maxlength="15"/>&nbsp;<input type="button" onclick="QuickCatalogSearch.searchCatalogList(true)" class="button" value="'+get_lang('Search')+'">&nbsp;<input style="display:none" type="button" onclick="QuickCatalogSearch.searchCatalogList(false)" class="button" value="'+get_lang('List All')+'"></td></tr>'+
242                                           '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type" type="radio" name="type" value="l"/>'+get_lang('Public Lists')+'&nbsp;&nbsp;<input type="radio" name="type" value="u" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" checked/>'+get_lang('Users')+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
243                                           '<span style="visibility:hidden;background:#cc4444" id=msg_search>&nbsp;&nbsp;<font face="Verdana" size="1" color="WHITE">'+get_lang('Search in Catalog')+'...</font>&nbsp;</span></td></tr>'+
244                                           '<tr><td>'+
245                                           '<span id="list_span"><select multiple style="display:none;width:450px" size="14" id="list_values"></select></span>'+
246                                           '<span id="user_span"><select multiple style="width:580px" size="14" id="user_values"></select></span>'+
247                                           '</td></tr>'+
248                                           '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+':&nbsp;<input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to\')">&nbsp;'+
249                                           '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc\')">&nbsp;'+
250                                           '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco\')">'+
251                                           '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+
252                                           '</table>'+
253                                           '</div>'+
254                                           '<div style="display:none" id="tab2" align="center">'+
255                                           '<br><br><br>'+
256                                           '<table border="0" cellpading="0" cellspacing="0">'+
257                                           '<tr><td>'+get_lang("Select the type of contact that you want to view")+'&nbsp;:</td></tr>'+
258                                           '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type" type="radio" name="type" value="p"/>' + get_lang('People') + '&nbsp;&nbsp;<input type="radio" name="type" value="g" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)"/>' + get_lang('Groups') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
259                                           '<tr><td>'+
260                                           '<span id="personal_span"><select multiple style="width:400px" size="14" id="list_personal"></select></span>'+
261                                           '<span id="groups_span"><select multiple style="display:none;width:400px" size="14" id="list_groups"></select></span>'+
262                                           '</td></tr>'+
263                                           '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+':&nbsp;<input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to1\')">&nbsp;'+
264                                           '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc1\')">&nbsp;'+
265                                           '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco1\')">'+
266                                           '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+
267                                           '</table>'+
268                                           '</div>';
269
270                var title = get_lang('Search in the Global Catalog');
271                var wHeight = el.offsetHeight - (is_ie ? 10 : 0) + "px";
272                var wWidth =  el.offsetWidth   + "px";
273                el.style.width = el.offsetWidth;
274               
275                Element('search_for').onkeypress = function (e) {
276                        if ((is_ie && (window.event.keyCode == 13)) || (!is_ie && e.keyCode == 13)) {
277                                QuickCatalogSearch.searchCatalogList(true);
278                        }
279                };
280
281                win = new dJSWin({                     
282                        id: 'win_'+el.id,
283                        content_id: el.id,
284                        width: wWidth,
285                        height: wHeight,
286                        title_color: '#3978d6',
287                        bg_color: '#eee',
288                        title: title,                                           
289                        title_text_color: 'white',
290                        button_x_img: '../phpgwapi/images/winclose.gif',
291                        border: true });
292                       
293                this.arrayWin[el.id] = win;             
294                win.draw();
295                win.open();
296
297                var handler_catalogs = function(data){
298                        var user_catalog = "Catalogo Geral";
299
300                        for(i = 0; i < data.length; i++) {
301                       
302                                Element('select_catalog').options[i] = new Option(data[i],i);
303                                if(user_catalog.toUpperCase() == data[i].toUpperCase())
304                                        Element('select_catalog').options[i].selected = true;
305                        }
306                }
307                cExecute ("$this.ldap_functions.get_catalogs", handler_catalogs);               
308
309                this.update_organizations();
310       
311                var handler_cc_contacts= function(data){
312                        if(data && data.length > 0){
313                                var aux = data.split(",");
314                                for(var i=0; i< aux.length; i++){
315                                        QuickCatalogSearch.cc_contacts[QuickCatalogSearch.cc_contacts.length] = aux[i];                         
316                                }
317                        }
318                }
319                cExecute("$this.db_functions.get_cc_contacts",handler_cc_contacts);
320
321                var handler_cc_groups = function(data){
322                        if(data && data.length > 0){
323                                var aux = data.split(",");
324                                for(var i=0; i < data.length; i++){
325                                        QuickCatalogSearch.cc_groups[QuickCatalogSearch.cc_groups.length] = aux[i];                                                             
326                                }       
327                        }
328                }
329                cExecute("$this.db_functions.get_cc_groups",handler_cc_groups);
330       
331        }
332       
333        emQuickCatalogSearch.prototype.select_div = function(element){
334                if(element == 'tab1'){
335                   Element('tab1').style.display = '';
336                   Element('tab2').style.display = 'none';
337                   Element('td1').style.background = '#eee';   
338                   Element('td2').style.background = '#cecece';
339                }
340                if(element == 'tab2'){
341                   Element('tab1').style.display = 'none';
342                   Element('tab2').style.display = '';
343                   Element('td1').style.background = '#cecece';
344                   Element('td2').style.background = '#eee';               
345
346                }
347        }
348       
349        emQuickCatalogSearch.prototype.load_catalog = function(){
350       
351                var _this = this;
352                var content = new Array;
353                var select = Element('list_personal').style.display == 'none'? Element('list_groups'): Element('list_personal');
354               
355                if(Element('list_personal').style.display == 'none'){
356                        content = _this.cc_groups;
357                }else{
358                        content = _this.cc_contacts;
359                }
360                if(select.options.length > 0){
361                        for(var i=0; i < select.options.length; i++){
362                                select.options[i] = null;
363                                i--;
364                        }
365                }
366                for(var i=0; i < content.length; i++){
367                        if(content[i] != undefined){
368                                var aux = content[i].split(";");
369                                var opt = new Option(aux[0] + ' (' + aux[1] + ')','"' + aux[0] + '" ' + '<' + aux[1] + '>',false,false);
370                                select[select.length] = opt;
371                        }
372                }
373                content.splice(0,(content.lenght));
374        }
375
376        emQuickCatalogSearch.prototype.update_organizations = function(){
377
378                       
379                while(Element('select_organization').options.length > 0) {
380                        Element('select_organization').remove(0);
381                }
382               
383               
384                var handler_org = function(data){
385                        Element('select_organization').options[0] = new Option('todos','todos');
386                        if (data != null){
387                       
388                        for(x = 0; x < data.length; x++) {
389                                Element('select_organization').options[x+1] = new Option(data[x],data[x]);
390                                }
391                        }
392                       
393                }
394               
395                cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value, handler_org);
396               
397        }
398
399        emQuickCatalogSearch.prototype.changeOptions = function(type){ 
400
401                switch(type){
402                        case 'u':
403                                Element('list_values').style.display = 'none';
404                                Element('user_values').style.display = '';
405                                break;
406                       
407                        case 'l':               
408                                Element('user_values').style.display = 'none';
409                                Element('list_values').style.display = '';             
410                                break;
411
412                        case 'p':
413                                Element('list_personal').style.display = '';
414                                Element('list_groups').style.display = 'none'
415                                QuickCatalogSearch.load_catalog();                             
416                                break;
417                       
418                        case 'g':
419                                Element('list_personal').style.display = 'none';
420                                Element('list_groups').style.display = ''
421                                QuickCatalogSearch.load_catalog();
422                                break;
423                }
424
425        }
426
427        emQuickCatalogSearch.prototype.addContacts = function(field) {
428               
429                var border_id   = Element('border_id').value;
430                var select              = Element('user_values').style.display == 'none' ? Element('list_values') : Element('user_values');
431                if(field == "to1" || field == "cc1" || field == "cco1"){
432                        field = field.substr(0,field.length - 1);
433                        var select = Element('list_personal').style.display == 'none' ? Element('list_groups') : Element('list_personal');
434                }
435                var fieldOpener = Element(field+"_"+border_id);
436                var not_selected = true;               
437                for (i = 0 ; i < select.length ; i++) {                 
438                        if (select.options[i].selected && select.options[i].value != '-1') {
439                                if(fieldOpener.value.length > 0 && (fieldOpener.value.lastIndexOf(',') != (fieldOpener.value.length -1))){
440                                        fieldOpener.value += ",";
441                                }
442                                fieldOpener.value += select.options[i].value + ",";
443                                not_selected = false;
444                                select.options[i].selected = false;
445                        }
446                }
447               
448                if(not_selected)
449                        return false;
450                       
451                if(field != 'to'){
452                        a_link = Element("a_"+field+"_link_"+border_id);
453                        if(a_link)
454                                a_link.onclick();                       
455                }                               
456        }
457       
458        emQuickCatalogSearch.prototype.searchCatalogList = function (itemSearch){
459
460                if(itemSearch && Element('search_for').value.length < 4){
461                        alert(get_lang('your search argument must be longer than 4 characters.'));
462                        Element('search_for').focus();
463                        return false;
464                }
465                var organization = Element('select_organization').value;               
466                var search               = itemSearch ? Element('search_for').value : '';
467                var catalog              = Element('select_catalog').value;
468                var max_result   = 300;
469
470                var handler_searchResults = function(data){
471
472                        Element('msg_search').style.visibility = 'hidden';
473                        if(data.error){
474                                alert(get_lang('More than %1 results. Please, try to refine your search.',max_result));
475                                return false;
476                        }
477                       
478                        var group = Element('list_span');
479                        var user  = Element('user_span');       
480                        if(is_ie){
481                                group.innerHTML = '';
482                                user.innerHTML = '';
483                        }
484                        else {
485                                group = Element('list_values');
486                                user  = Element('user_values');
487                                for(var i = 0;i < group.options.length; i++)                           
488                                        group.options[i--] = null;
489                                for(var i = 0;i < user.options.length; i++)                             
490                                        user.options[i--] = null;
491                        }
492
493                        var arr         = new Array(max_result);
494                        var display     = Element('type').value == 'l'? 'display:none;' : '';
495
496                        for(i = 0; data.groups && i < data.groups.length; i++) {                       
497                                if(is_ie)
498                                        arr[i] = '<option value="'+'&quot;'+data.groups[i].name+'&quot; &lt;'+data.groups[i].email+'&gt;">'+data.groups[i].name+' ('+data.groups[i].email+')'+'</option>';
499                                else
500                                        group.options[i] = new Option(data.groups[i].name+' ('+data.groups[i].email+')','"'+data.groups[i].name+'" <'+data.groups[i].email+'>');
501                        }
502       
503                        if(is_ie)
504                                group.innerHTML = '<select multiple style="'+display+'width:400px" size="14" id="list_values">'+ arr.join() +'</select>';
505
506                        arr = new Array(max_result);
507                        display = display ? "" : "display:none;";
508                       
509                        for(i = 0; data.users && i < data.users.length; i++) {                 
510                                if(is_ie){
511                                        arr[i] = '<option value="'+'&quot;'+data.users[i].name+'&quot; &lt;'+data.users[i].email+'&gt;">'+data.users[i].name+' ('+data.users[i].email+')'+'</option>';
512                                }
513                                else{
514
515                                /*******************************************************************************************/
516                                /* O resultado pratico do bloco de codigo a seguir eh a exibicao dos valores em tela,
517                                ja que vai verificar se o departamento e o email estao vazios ou nulos e a partir dai o
518                                resultado apresentado em tela sera exibido de maneira mais apresentavel;
519                                */
520                                        //verifica se departamento eh null ou nao;
521                                        var departamento_nulo = 'false';
522                                        if((data.users[i].department == null) || (data.users[i].department == '')) {
523                                                data.users[i].department = '';
524                                                departamento_nulo = 'true';
525                                        }
526                                        else {
527                                                data.users[i].department = ' - ' + data.users[i].department;
528                                        }
529
530                                        //verifica se email eh null ou nao;
531                                        if((data.users[i].email == null) || (data.users[i].email == '')) {
532                                                if(departamento_nulo = 'true') {
533                                                        data.users[i].email = '';
534                                                }
535                                                else {
536                                                        data.users[i].email = ' - ';
537                                                }
538                                        }
539                                        else {
540                                                data.users[i].email = ' (' + data.users[i].email + ') ';
541                                        }
542
543                                        user.options[i] = new Option(data.users[i].name+data.users[i].email+data.users[i].department,'"'+data.users[i].name+'" <'+data.users[i].email+'>'); // incluido data.users[i].department para exibir setor na opcao "Pesquisar" do email;
544                                }
545                        }
546       
547                        if(is_ie)
548                                user.innerHTML = '<select multiple style="'+display+'width:400px" size="14" id="user_values">'+ arr.join() +'</select>';
549                }
550
551                Element('msg_search').style.visibility = 'visible';
552                cExecute ("$this.ldap_functions.catalogsearch&max_result="+max_result+"&organization="+organization+"&search_for="+search+"&catalog="+catalog, handler_searchResults);
553        }
554
555       
556/* Build the Object */
557        var QuickCatalogSearch;
558        QuickCatalogSearch = new emQuickCatalogSearch();
Note: See TracBrowser for help on using the repository browser.