source: trunk/contactcenter/js/ccListParticipants.js @ 880

Revision 880, 4.9 KB checked in by niltonneto, 15 years ago (diff)

Ticket #480 - Inclusão dos grupos LDAP na busca do Catálogo Geral.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1  /***************************************************************************\
2  * eGroupWare - Contacts Center                                              *
3  * http://www.egroupware.org                                                 *
4  * Written by:                                                               *
5  *  - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net>         *
6  *  sponsored by Thyamad - http://www.thyamad.com                            *
7  * ------------------------------------------------------------------------- *
8  *  This program is free software; you can redistribute it and/or modify it  *
9  *  under the terms of the GNU General Public License as published by the    *
10  *  Free Software Foundation; either version 2 of the License, or (at your   *
11  *  option) any later version.                                               *
12  \***************************************************************************/
13
14        function cListParticipants ()
15        {
16                this.arrayWin = new Array();
17                this.el;
18        }
19
20       
21cListParticipants.prototype.showList = function(id, contact, email, title, account_type){
22        _this = this;
23       
24        id = id;
25
26        div = document.getElementById(id+':cc_rectParticipants');
27        var el = document.createElement("DIV");                                                                 
28        el.style.visibility = "hidden";                                                                 
29        el.style.position = "absolute";
30        el.style.left = "0px";
31        el.style.top = "0px";
32        el.style.width = "0px";
33        el.style.height = "0px";                                                                       
34        el.className = "div_cc_rectParticipants";
35        el.id = id+':cc_rectParticipants';
36       
37        if(is_ie) {
38                el.style.width= "auto";
39                el.style.overflowY = "auto";                                                           
40                el.style.overflowX = "hidden";
41        }                                                                                                       
42                else {                                                                 
43                el.style.overflow = "-moz-scrollbars-vertical";
44        }
45               
46        if (title) {
47                document.body.appendChild(el);
48                var names = contact.split(",");
49                var email = email.split(",");
50                el.innerHTML = "";                                                             
51                el.innerHTML = "<br>&nbsp;&nbsp;<b><font color='BLUE'>"+title+"</font></b>"+
52                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<u>"+
53                Element('cc_participants').value+"</u>&nbsp;&nbsp;&nbsp;<br><br>";
54                                                       
55                if(names.length) {
56                        for (var d = 0; d < (names.length-1); d++) {                                                                                                                                                                                                                                                                                                   
57                                el.innerHTML +=
58                                "<font color='DARKBLUE'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
59                                        "\"" + names[d]+ "\"" +
60                                        " &lt;"+email[d]+
61                                        "&gt;</font>&nbsp;&nbsp;&nbsp;<br>";                                                                                                                                   
62                        }
63                }
64                else {
65                        el.innerHTML += "<font color='DARKBLUE'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
66                                "&lt;"+Element('cc_empty').value+"&gt;&nbsp;&nbsp;</font><br>";         
67                }
68                       
69                el.innerHTML += "<br>";
70               
71                if(div)
72                        this.showWindow(div);
73                else                                           
74                        _this.showWindow(el);
75        } else {
76                        var handler = function (responseText) {
77                                var contacts = unserialize(responseText);
78                                var title = contacts.names_ordered;     
79                                document.body.appendChild(el);                         
80                                el.innerHTML = "";     
81                                el.innerHTML = "<br>&nbsp;&nbsp;<b><font color='BLUE' nowrap>"+title+"</font></b>"+
82                                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<u>"+
83                                Element('cc_participants').value+"</u>&nbsp;&nbsp;&nbsp;<br><br>";                             
84                                if(contacts.size > 0) {
85                                                el.innerHTML += contacts.inner_html;
86                                }
87                                else {
88                                        el.innerHTML += "<font color='DARKBLUE'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
89                                        "&lt;"+Element('cc_empty').value+"&gt;&nbsp;&nbsp;</font><br>";         
90                                }
91                                el.innerHTML += "<br>";
92                                                               
93                                _this.showWindow(el);
94                        }               
95
96                        if(div)
97                                this.showWindow(div);
98                        else
99                                Connector.newRequest('get_catalog_participants_'+account_type , '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_catalog_participants_'+account_type, 'POST', handler, 'id='+id);
100                }
101        }
102       
103        cListParticipants.prototype.showWindow = function (div)
104        {                                               
105                if(! div) {
106                        alert('Essa lista não possui nenhum participante.');
107                        return;
108                }
109                                                       
110                if(! this.arrayWin[div.id]) {
111                        div.style.width = "auto";
112                        div.style.height = "250px";
113                        var title = 'Listar Partipantes';               
114                        var wHeight = div.offsetHeight + "px";
115                        var wWidth =  div.offsetWidth   + "px";
116                        if(is_ie) {
117                                div.style.width = wWidth;
118                        }                       
119                        else {
120                                div.style.width = div.offsetWidth - 5;
121                        }
122
123                        win = new dJSWin({                     
124                                id: 'ccListParticipants_'+div.id,
125                                content_id: div.id,
126                                width: wWidth,
127                                height: wHeight,
128                                title_color: '#3978d6',
129                                bg_color: '#eee',
130                                title: title,                                           
131                                title_text_color: 'white',
132                                button_x_img: Element('cc_phpgw_img_dir').value+'/winclose.gif',
133                                border: true });
134                       
135                        this.arrayWin[div.id] = win;
136                        win.draw();                     
137                }
138                else {
139                        win = this.arrayWin[div.id];
140                }                       
141                                                       
142                win.open();                             
143        }
144       
145/* Build the Object */
146        var ccListParticipants ;
147        var cListParticipants_pre_load = document.body.onload;
148
149        if (is_ie)
150        {
151                document.body.onload = function (e)
152                {
153                        cListParticipants_pre_load();
154                        ccListParticipants = new cListParticipants();
155                       
156                };
157        }
158        else
159        {
160                ccListParticipants = new cListParticipants();
161        }
Note: See TracBrowser for help on using the repository browser.