[285] | 1 | var last_id = 0; |
---|
[3795] | 2 | var preferences = null; |
---|
[285] | 3 | function openwindow(url){ |
---|
| 4 | var window_features = "scrollbars=yes,resizable=yes,location=no,menubar=no," + |
---|
| 5 | "personalbar=no,status=no,titlebar=no,toolbar=no," + |
---|
| 6 | "screenX=0,screenY=0,top=0,left=0,width=" + |
---|
| 7 | screen.width + ",height=" + screen.height/5*3; |
---|
| 8 | |
---|
| 9 | window.open(url,'', window_features); |
---|
[2] | 10 | } |
---|
| 11 | |
---|
| 12 | var Main_pre_load = document.body.onload; |
---|
| 13 | var ccSearch, ccTree; |
---|
[285] | 14 | var Main_load = function () |
---|
[1598] | 15 | { |
---|
[2] | 16 | Connector.setProgressBox(Element('cc_loading'), true); |
---|
[285] | 17 | Connector.setProgressHolder(Element('cc_loading_inner')); |
---|
[2] | 18 | /* Associate the Quick Add Button with the Plugin */ |
---|
[285] | 19 | |
---|
[2] | 20 | |
---|
| 21 | /* Create the Search Object */ |
---|
| 22 | var search_params = new Array(); |
---|
| 23 | search_params['holder'] = Element('cc_panel_search_call'); |
---|
[5131] | 24 | search_params['total_width'] = (v_label != false & v_atrib != false)? '485px' : '335px'; |
---|
[2] | 25 | search_params['input_width'] = '200px'; |
---|
| 26 | search_params['progress_top'] = '150px'; |
---|
| 27 | search_params['progress_left'] = '-260px'; |
---|
| 28 | search_params['progress_color'] = '#3978d6'; |
---|
| 29 | search_params['progress_width'] = '250px'; |
---|
| 30 | search_params['conn_1_msg'] = Element('cc_loading_1').value; |
---|
| 31 | search_params['conn_2_msg'] = Element('cc_loading_2').value; |
---|
| 32 | search_params['conn_3_msg'] = Element('cc_loading_3').value; |
---|
| 33 | search_params['button_text'] = Element('cc_panel_search_text').value; |
---|
| 34 | search_params['Connector'] = Connector; |
---|
| 35 | |
---|
| 36 | ccSearch = new ccSearchClass(search_params); |
---|
| 37 | ccSearch.DOMresult.style.visibility = 'hidden'; |
---|
| 38 | ccSearch.onSearchFinish = ccSearchUpdate; |
---|
[285] | 39 | |
---|
[2] | 40 | Connector.setProgressBox(Element('cc_loading'), true); |
---|
| 41 | Connector.setProgressHolder(Element('cc_loading_inner')); |
---|
[284] | 42 | |
---|
[285] | 43 | try |
---|
| 44 | { |
---|
[3795] | 45 | function handlerInitValues(sdata) |
---|
[285] | 46 | { |
---|
[3795] | 47 | var data = unserialize(sdata); |
---|
| 48 | preferences = data.preferences; |
---|
| 49 | if( boolData = eval(data.visible_all_ldap) ) |
---|
[285] | 50 | { |
---|
| 51 | ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); |
---|
| 52 | showCards('all',getActualPage()); |
---|
| 53 | selectLetter('27'); |
---|
| 54 | } |
---|
| 55 | else |
---|
| 56 | { |
---|
| 57 | ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); clearCards();'}); |
---|
[3313] | 58 | var ccQtdCompartilhado = function(responseText) { |
---|
| 59 | data = unserialize(responseText); |
---|
| 60 | qtd_compartilhado = data[0]; |
---|
| 61 | } |
---|
| 62 | Connector.newRequest('fulfilQtdCompartilhado', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_qtds_compartilhado', 'POST', ccQtdCompartilhado); |
---|
[285] | 63 | } |
---|
| 64 | } |
---|
| 65 | |
---|
[3795] | 66 | Connector.newRequest('handlerInitValues', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_init_values', 'GET', handlerInitValues); |
---|
[285] | 67 | |
---|
| 68 | ccTree.Connector = Connector; |
---|
| 69 | } |
---|
| 70 | catch(e){} |
---|
| 71 | |
---|
| 72 | /* Create the Tree Object */ |
---|
[284] | 73 | //ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); |
---|
[285] | 74 | //ccTree.Connector = Connector; |
---|
[2] | 75 | } |
---|
| 76 | var menuStarted = false; |
---|
| 77 | function findPosY(obj) |
---|
| 78 | { |
---|
| 79 | var curtop = 0; |
---|
| 80 | if (obj.offsetParent) |
---|
| 81 | { |
---|
| 82 | while (obj.offsetParent) |
---|
| 83 | { |
---|
| 84 | curtop += obj.offsetTop |
---|
| 85 | obj = obj.offsetParent; |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | else if (obj.y) |
---|
| 89 | curtop += obj.y; |
---|
| 90 | return curtop; |
---|
| 91 | } |
---|
| 92 | var _timeout = ''; |
---|
| 93 | var menu = function () { |
---|
[285] | 94 | |
---|
[2] | 95 | if(! this.menuStarted) |
---|
| 96 | this.menuStarted = true; |
---|
[285] | 97 | |
---|
[2] | 98 | submenu = []; |
---|
| 99 | textmenu = []; |
---|
[1598] | 100 | |
---|
[1496] | 101 | textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_contact_sh","cc_msg_group"]; |
---|
| 102 | textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_full_add_button_sh", "cc_add_group_button"]; |
---|
[2] | 103 | function show(){ |
---|
| 104 | clearTimeout(_timeout); |
---|
| 105 | button = document.getElementById("cc_button_new"); |
---|
[285] | 106 | |
---|
| 107 | this.style.top = 19 + findPosY(button) + "px"; |
---|
| 108 | this.style.visibility='visible'; |
---|
[2] | 109 | } |
---|
| 110 | function hide(){ _timeout = setTimeout("menu.style.visibility='hidden';",200); }; |
---|
[285] | 111 | |
---|
[2] | 112 | if(document.getElementById) { |
---|
| 113 | menu = document.getElementById("Layer1"); |
---|
[285] | 114 | |
---|
[2] | 115 | for (i=0; i< textmenu[0].length; i++) { |
---|
[38] | 116 | textmenu[0][i] = "<span onclick= 'menu.onmouseout();'>" + document.getElementById(textmenu[0][i]).value + "</span><br>"; |
---|
[285] | 117 | submenu[i] = document.createElement("DIV"); |
---|
[2] | 118 | submenu[i].innerHTML = textmenu[0][i]; |
---|
| 119 | submenu[i].id = textmenu[1][i]; |
---|
[38] | 120 | submenu[i].onmouseover = function () {this.style.backgroundColor = 'LIGHTYELLOW';this.style.color = 'DARKBLUE';}; |
---|
[285] | 121 | submenu[i].onmouseout = function () { this.style.backgroundColor = '#DCDCDC'; this.style.color = '#006699';}; |
---|
[2] | 122 | submenu[i].setAttribute("className", "special"); |
---|
| 123 | submenu[i].setAttribute("class", "special"); |
---|
[285] | 124 | submenu[i].style.padding = "5px"; |
---|
[2] | 125 | menu.appendChild(submenu[i]); |
---|
[285] | 126 | } |
---|
| 127 | |
---|
[2] | 128 | menu.onmouseover = show; |
---|
| 129 | menu.onmouseout = hide; |
---|
| 130 | } |
---|
[285] | 131 | |
---|
[2] | 132 | ccQuickAdd.associateAsButton(Element('cc_quick_add')); |
---|
[575] | 133 | ccAddGroup.associateAsButton(Element('cc_add_group_button')); |
---|
| 134 | Element("cc_full_add_button").onclick = newContact; |
---|
[1496] | 135 | Element("cc_full_add_button_sh").onclick = newSharedContact; |
---|
[1598] | 136 | |
---|
[285] | 137 | |
---|
[2] | 138 | ccQuickAdd.afterSave = function () |
---|
| 139 | { |
---|
| 140 | updateCards(); |
---|
[285] | 141 | } |
---|
| 142 | |
---|
| 143 | ccAddGroup.load = function () |
---|
| 144 | { |
---|
| 145 | editGroup(); |
---|
[2] | 146 | } |
---|
[285] | 147 | |
---|
[2] | 148 | ccAddGroup.afterSave = function () |
---|
| 149 | { |
---|
| 150 | updateCards(); |
---|
| 151 | } |
---|
[285] | 152 | |
---|
[2] | 153 | return true; |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | if (is_ie) |
---|
| 157 | { |
---|
[285] | 158 | |
---|
[2] | 159 | document.body.onload = function (e) |
---|
[285] | 160 | { |
---|
| 161 | Main_pre_load(); |
---|
| 162 | Main_load(); |
---|
| 163 | |
---|
[2] | 164 | } |
---|
| 165 | } |
---|
| 166 | else |
---|
[1598] | 167 | { |
---|
| 168 | |
---|
[285] | 169 | Main_load(); |
---|
| 170 | |
---|
| 171 | } |
---|
[2] | 172 | |
---|
| 173 | // BEGIN: FUNCTION RESIZE WINDOW |
---|
| 174 | var _showBar = showBar; |
---|
| 175 | var _hideBar = hideBar; |
---|
| 176 | |
---|
| 177 | function __showBar(){ |
---|
| 178 | _showBar(); |
---|
| 179 | resizeWindow(); |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | function __hideBar(){ |
---|
| 183 | _hideBar(); |
---|
| 184 | resizeWindow(); |
---|
| 185 | } |
---|
| 186 | showBar = __showBar; |
---|
| 187 | hideBar = __hideBar; |
---|
[285] | 188 | |
---|
[2] | 189 | var _onResize = window.onresize; |
---|
| 190 | window.onresize = resizeWindow; |
---|
| 191 | var defaultHeight = 0; |
---|
| 192 | function setDefaultHeight(){ |
---|
[285] | 193 | |
---|
[2] | 194 | var bar = Element("toolbar"); |
---|
| 195 | var offset = 0; |
---|
[285] | 196 | if(bar.style.visibility != 'hidden') |
---|
| 197 | offset = (bar.offsetHeight ? bar.offsetHeight : bar.clientHeight); |
---|
[2] | 198 | |
---|
| 199 | var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; |
---|
[285] | 200 | defaultHeight = screenHeight - offset; |
---|
| 201 | Element("cc_tree").style.height = defaultHeight - 68; |
---|
| 202 | Element("cc_left_main").style.height = defaultHeight - 68; |
---|
[2] | 203 | } |
---|
| 204 | |
---|
| 205 | function resizeWindow(){ |
---|
| 206 | setDefaultHeight(); |
---|
[38] | 207 | if(Element("divScrollMain")) |
---|
[285] | 208 | Element("divScrollMain").style.height = defaultHeight - 108; |
---|
[2] | 209 | if (!is_ie) |
---|
| 210 | Element('tableDivAppbox').width = '100%'; |
---|
| 211 | } |
---|
| 212 | document.body.scroll="no"; |
---|
| 213 | document.body.style.overflow ="hidden"; |
---|
| 214 | setDefaultHeight(); |
---|
| 215 | Element('cc_main').style.height = defaultHeight; |
---|
[285] | 216 | var lang_warn_firefox = Element('cc_msg_warn_firefox'); |
---|
| 217 | var lang_firefox_msg1 = Element('cc_msg_firefox_half1'); |
---|
| 218 | var lang_firefox_msg2 = Element('cc_msg_firefox_half2'); |
---|
| 219 | var lang_install_now = Element('cc_msg_install_now'); |
---|
| 220 | var lang_install_new_firefox = Element('cc_msg_install_new_firefox'); |
---|
| 221 | var lang_close = Element('cc_msg_close'); |
---|
[2] | 222 | function buildWarningMsg(_version) { |
---|
| 223 | var screenWidth = document.body.clientWidth ? document.body.clientWidth: document.body.offsetWidth; |
---|
| 224 | var _div = document.createElement("DIV"); |
---|
| 225 | _div.innerHTML += "<DIV id='warning_msg' style='background:LIGHTYELLOW;position:absolute;"+ |
---|
| 226 | "border:1px solid black;left:"+(screenWidth - 330)+";top:10px;width:300px;padding:10px;"+ |
---|
| 227 | (document.body.clientWidth ? "-moz-border-radius: 9px 9px 9px 9px;'>" : "")+ |
---|
[285] | 228 | "<font color='RED' size='2'>"+lang_warn_firefox + "("+_version+")</font><BR>"+ |
---|
| 229 | "<font color='black' size='2'><p style='text-align:justify'> "+lang_firefox_msg1+ |
---|
| 230 | lang_firefox_msg2 + ".</p></font><div style='width:100%' align='center'>"+ |
---|
| 231 | "<a title='"+lang_install_now+"' href='http://br.mozdev.org/firefox/download.html' target='_blank'>"+lang_install_new_firefox+ "</a>"+ |
---|
[2] | 232 | " "+ |
---|
[285] | 233 | "<a title='"+lang_close+"' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>"+lang_close+"</a></div>"+ |
---|
| 234 | |
---|
[2] | 235 | "</DIV>"; |
---|
| 236 | |
---|
| 237 | document.body.appendChild(_div); |
---|
| 238 | |
---|
| 239 | myOpacity = new fx.Opacity('warning_msg', {duration: 600}); |
---|
[285] | 240 | document.getElementById("warning_msg").style.visibility = 'hidden'; |
---|
[2] | 241 | myOpacity.now = 0; |
---|
| 242 | setTimeout("myOpacity.toggle()",3000); |
---|
| 243 | } |
---|
| 244 | // Verifica versão do Firefox |
---|
| 245 | var agt=navigator.userAgent.toLowerCase(); |
---|
| 246 | if(agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.')) |
---|
[575] | 247 | buildWarningMsg(agt.substring(agt.indexOf('firefox/')+8,agt.indexOf('firefox/')+13)); |
---|