[2] | 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 | |
---|
[880] | 21 | cListParticipants.prototype.showList = function(id, contact, email, title, account_type){ |
---|
[2] | 22 | _this = this; |
---|
| 23 | |
---|
| 24 | id = id; |
---|
[880] | 25 | |
---|
[2] | 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> <b><font color='BLUE'>"+title+"</font></b>"+ |
---|
| 52 | " <br><br> <u>"+ |
---|
| 53 | Element('cc_participants').value+"</u> <br><br>"; |
---|
| 54 | |
---|
| 55 | if(names.length) { |
---|
| 56 | for (var d = 0; d < (names.length-1); d++) { |
---|
[5131] | 57 | var email_valido = email[d] != 'null' ? email[d] : "não informado" |
---|
[2] | 58 | el.innerHTML += |
---|
| 59 | "<font color='DARKBLUE'> "+ |
---|
| 60 | "\"" + names[d]+ "\"" + |
---|
[5131] | 61 | " <"+email_valido+ |
---|
[2] | 62 | "></font> <br>"; |
---|
| 63 | } |
---|
| 64 | } |
---|
| 65 | else { |
---|
| 66 | el.innerHTML += "<font color='DARKBLUE'> "+ |
---|
| 67 | "<"+Element('cc_empty').value+"> </font><br>"; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | el.innerHTML += "<br>"; |
---|
| 71 | |
---|
| 72 | if(div) |
---|
| 73 | this.showWindow(div); |
---|
| 74 | else |
---|
| 75 | _this.showWindow(el); |
---|
| 76 | } else { |
---|
| 77 | var handler = function (responseText) { |
---|
| 78 | var contacts = unserialize(responseText); |
---|
[24] | 79 | var title = contacts.names_ordered; |
---|
| 80 | document.body.appendChild(el); |
---|
[2] | 81 | el.innerHTML = ""; |
---|
| 82 | el.innerHTML = "<br> <b><font color='BLUE' nowrap>"+title+"</font></b>"+ |
---|
| 83 | " <br><br> <u>"+ |
---|
[24] | 84 | Element('cc_participants').value+"</u> <br><br>"; |
---|
| 85 | if(contacts.size > 0) { |
---|
| 86 | el.innerHTML += contacts.inner_html; |
---|
[2] | 87 | } |
---|
| 88 | else { |
---|
| 89 | el.innerHTML += "<font color='DARKBLUE'> "+ |
---|
| 90 | "<"+Element('cc_empty').value+"> </font><br>"; |
---|
| 91 | } |
---|
| 92 | el.innerHTML += "<br>"; |
---|
| 93 | |
---|
| 94 | _this.showWindow(el); |
---|
| 95 | } |
---|
[880] | 96 | |
---|
[2] | 97 | if(div) |
---|
| 98 | this.showWindow(div); |
---|
| 99 | else |
---|
[880] | 100 | 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); |
---|
[2] | 101 | } |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | cListParticipants.prototype.showWindow = function (div) |
---|
| 105 | { |
---|
| 106 | if(! div) { |
---|
| 107 | alert('Essa lista não possui nenhum participante.'); |
---|
| 108 | return; |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | if(! this.arrayWin[div.id]) { |
---|
| 112 | div.style.width = "auto"; |
---|
| 113 | div.style.height = "250px"; |
---|
| 114 | var title = 'Listar Partipantes'; |
---|
| 115 | var wHeight = div.offsetHeight + "px"; |
---|
| 116 | var wWidth = div.offsetWidth + "px"; |
---|
| 117 | if(is_ie) { |
---|
| 118 | div.style.width = wWidth; |
---|
| 119 | } |
---|
| 120 | else { |
---|
| 121 | div.style.width = div.offsetWidth - 5; |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | win = new dJSWin({ |
---|
| 125 | id: 'ccListParticipants_'+div.id, |
---|
| 126 | content_id: div.id, |
---|
| 127 | width: wWidth, |
---|
| 128 | height: wHeight, |
---|
| 129 | title_color: '#3978d6', |
---|
| 130 | bg_color: '#eee', |
---|
| 131 | title: title, |
---|
| 132 | title_text_color: 'white', |
---|
| 133 | button_x_img: Element('cc_phpgw_img_dir').value+'/winclose.gif', |
---|
| 134 | border: true }); |
---|
| 135 | |
---|
| 136 | this.arrayWin[div.id] = win; |
---|
| 137 | win.draw(); |
---|
| 138 | } |
---|
| 139 | else { |
---|
| 140 | win = this.arrayWin[div.id]; |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | win.open(); |
---|
| 144 | } |
---|
| 145 | |
---|
| 146 | /* Build the Object */ |
---|
| 147 | var ccListParticipants ; |
---|
| 148 | var cListParticipants_pre_load = document.body.onload; |
---|
| 149 | |
---|
| 150 | if (is_ie) |
---|
| 151 | { |
---|
| 152 | document.body.onload = function (e) |
---|
| 153 | { |
---|
| 154 | cListParticipants_pre_load(); |
---|
| 155 | ccListParticipants = new cListParticipants(); |
---|
| 156 | |
---|
| 157 | }; |
---|
| 158 | } |
---|
| 159 | else |
---|
| 160 | { |
---|
| 161 | ccListParticipants = new cListParticipants(); |
---|
| 162 | } |
---|