[285] | 1 | var last_id = 0; |
---|
[2] | 2 | |
---|
[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'); |
---|
[1721] | 24 | search_params['total_width'] = '330px'; |
---|
[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 | { |
---|
| 45 | function ViewLdap(data) |
---|
| 46 | { |
---|
| 47 | if( boolData = eval(data) ) |
---|
| 48 | { |
---|
| 49 | ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); |
---|
| 50 | showCards('all',getActualPage()); |
---|
| 51 | selectLetter('27'); |
---|
| 52 | } |
---|
| 53 | else |
---|
| 54 | { |
---|
| 55 | ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); clearCards();'}); |
---|
| 56 | } |
---|
| 57 | } |
---|
| 58 | |
---|
[306] | 59 | Connector.newRequest('ViewLdap', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_visible_all_ldap', 'GET', ViewLdap); |
---|
[285] | 60 | |
---|
| 61 | ccTree.Connector = Connector; |
---|
| 62 | } |
---|
| 63 | catch(e){} |
---|
| 64 | |
---|
| 65 | /* Create the Tree Object */ |
---|
[284] | 66 | //ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); |
---|
[285] | 67 | //ccTree.Connector = Connector; |
---|
[2] | 68 | } |
---|
| 69 | var menuStarted = false; |
---|
| 70 | function findPosY(obj) |
---|
| 71 | { |
---|
| 72 | var curtop = 0; |
---|
| 73 | if (obj.offsetParent) |
---|
| 74 | { |
---|
| 75 | while (obj.offsetParent) |
---|
| 76 | { |
---|
| 77 | curtop += obj.offsetTop |
---|
| 78 | obj = obj.offsetParent; |
---|
| 79 | } |
---|
| 80 | } |
---|
| 81 | else if (obj.y) |
---|
| 82 | curtop += obj.y; |
---|
| 83 | return curtop; |
---|
| 84 | } |
---|
| 85 | var _timeout = ''; |
---|
| 86 | var menu = function () { |
---|
[285] | 87 | |
---|
[2] | 88 | if(! this.menuStarted) |
---|
| 89 | this.menuStarted = true; |
---|
[285] | 90 | |
---|
[2] | 91 | submenu = []; |
---|
| 92 | textmenu = []; |
---|
[1598] | 93 | |
---|
[1496] | 94 | textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_contact_sh","cc_msg_group"]; |
---|
| 95 | textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_full_add_button_sh", "cc_add_group_button"]; |
---|
[2] | 96 | function show(){ |
---|
| 97 | clearTimeout(_timeout); |
---|
| 98 | button = document.getElementById("cc_button_new"); |
---|
[285] | 99 | |
---|
| 100 | this.style.top = 19 + findPosY(button) + "px"; |
---|
| 101 | this.style.visibility='visible'; |
---|
[2] | 102 | } |
---|
| 103 | function hide(){ _timeout = setTimeout("menu.style.visibility='hidden';",200); }; |
---|
[285] | 104 | |
---|
[2] | 105 | if(document.getElementById) { |
---|
| 106 | menu = document.getElementById("Layer1"); |
---|
[285] | 107 | |
---|
[2] | 108 | for (i=0; i< textmenu[0].length; i++) { |
---|
[38] | 109 | textmenu[0][i] = "<span onclick= 'menu.onmouseout();'>" + document.getElementById(textmenu[0][i]).value + "</span><br>"; |
---|
[285] | 110 | submenu[i] = document.createElement("DIV"); |
---|
[2] | 111 | submenu[i].innerHTML = textmenu[0][i]; |
---|
| 112 | submenu[i].id = textmenu[1][i]; |
---|
[38] | 113 | submenu[i].onmouseover = function () {this.style.backgroundColor = 'LIGHTYELLOW';this.style.color = 'DARKBLUE';}; |
---|
[285] | 114 | submenu[i].onmouseout = function () { this.style.backgroundColor = '#DCDCDC'; this.style.color = '#006699';}; |
---|
[2] | 115 | submenu[i].setAttribute("className", "special"); |
---|
| 116 | submenu[i].setAttribute("class", "special"); |
---|
[285] | 117 | submenu[i].style.padding = "5px"; |
---|
[2] | 118 | menu.appendChild(submenu[i]); |
---|
[285] | 119 | } |
---|
| 120 | |
---|
[2] | 121 | menu.onmouseover = show; |
---|
| 122 | menu.onmouseout = hide; |
---|
| 123 | } |
---|
[285] | 124 | |
---|
[2] | 125 | ccQuickAdd.associateAsButton(Element('cc_quick_add')); |
---|
[575] | 126 | ccAddGroup.associateAsButton(Element('cc_add_group_button')); |
---|
| 127 | Element("cc_full_add_button").onclick = newContact; |
---|
[1496] | 128 | Element("cc_full_add_button_sh").onclick = newSharedContact; |
---|
[1598] | 129 | |
---|
[285] | 130 | |
---|
[2] | 131 | ccQuickAdd.afterSave = function () |
---|
| 132 | { |
---|
| 133 | updateCards(); |
---|
[285] | 134 | } |
---|
| 135 | |
---|
| 136 | ccAddGroup.load = function () |
---|
| 137 | { |
---|
| 138 | editGroup(); |
---|
[2] | 139 | } |
---|
[285] | 140 | |
---|
[2] | 141 | ccAddGroup.afterSave = function () |
---|
| 142 | { |
---|
| 143 | updateCards(); |
---|
| 144 | } |
---|
[285] | 145 | |
---|
[2] | 146 | return true; |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | if (is_ie) |
---|
| 150 | { |
---|
[285] | 151 | |
---|
[2] | 152 | document.body.onload = function (e) |
---|
[285] | 153 | { |
---|
| 154 | Main_pre_load(); |
---|
| 155 | Main_load(); |
---|
| 156 | |
---|
[2] | 157 | } |
---|
| 158 | } |
---|
| 159 | else |
---|
[1598] | 160 | { |
---|
| 161 | |
---|
[285] | 162 | Main_load(); |
---|
| 163 | |
---|
| 164 | } |
---|
[2] | 165 | |
---|
| 166 | // BEGIN: FUNCTION RESIZE WINDOW |
---|
| 167 | var _showBar = showBar; |
---|
| 168 | var _hideBar = hideBar; |
---|
| 169 | |
---|
| 170 | function __showBar(){ |
---|
| 171 | _showBar(); |
---|
| 172 | resizeWindow(); |
---|
| 173 | } |
---|
| 174 | |
---|
| 175 | function __hideBar(){ |
---|
| 176 | _hideBar(); |
---|
| 177 | resizeWindow(); |
---|
| 178 | } |
---|
| 179 | showBar = __showBar; |
---|
| 180 | hideBar = __hideBar; |
---|
[285] | 181 | |
---|
[2] | 182 | var _onResize = window.onresize; |
---|
| 183 | window.onresize = resizeWindow; |
---|
| 184 | var defaultHeight = 0; |
---|
| 185 | function setDefaultHeight(){ |
---|
[285] | 186 | |
---|
[2] | 187 | var bar = Element("toolbar"); |
---|
| 188 | var offset = 0; |
---|
[285] | 189 | if(bar.style.visibility != 'hidden') |
---|
| 190 | offset = (bar.offsetHeight ? bar.offsetHeight : bar.clientHeight); |
---|
[2] | 191 | |
---|
| 192 | var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; |
---|
[285] | 193 | defaultHeight = screenHeight - offset; |
---|
| 194 | Element("cc_tree").style.height = defaultHeight - 68; |
---|
| 195 | Element("cc_left_main").style.height = defaultHeight - 68; |
---|
[2] | 196 | } |
---|
| 197 | |
---|
| 198 | function resizeWindow(){ |
---|
| 199 | setDefaultHeight(); |
---|
[38] | 200 | if(Element("divScrollMain")) |
---|
[285] | 201 | Element("divScrollMain").style.height = defaultHeight - 108; |
---|
[2] | 202 | if (!is_ie) |
---|
| 203 | Element('tableDivAppbox').width = '100%'; |
---|
| 204 | } |
---|
| 205 | document.body.scroll="no"; |
---|
| 206 | document.body.style.overflow ="hidden"; |
---|
| 207 | setDefaultHeight(); |
---|
| 208 | Element('cc_main').style.height = defaultHeight; |
---|
[285] | 209 | var lang_warn_firefox = Element('cc_msg_warn_firefox'); |
---|
| 210 | var lang_firefox_msg1 = Element('cc_msg_firefox_half1'); |
---|
| 211 | var lang_firefox_msg2 = Element('cc_msg_firefox_half2'); |
---|
| 212 | var lang_install_now = Element('cc_msg_install_now'); |
---|
| 213 | var lang_install_new_firefox = Element('cc_msg_install_new_firefox'); |
---|
| 214 | var lang_close = Element('cc_msg_close'); |
---|
[2] | 215 | function buildWarningMsg(_version) { |
---|
| 216 | var screenWidth = document.body.clientWidth ? document.body.clientWidth: document.body.offsetWidth; |
---|
| 217 | var _div = document.createElement("DIV"); |
---|
| 218 | _div.innerHTML += "<DIV id='warning_msg' style='background:LIGHTYELLOW;position:absolute;"+ |
---|
| 219 | "border:1px solid black;left:"+(screenWidth - 330)+";top:10px;width:300px;padding:10px;"+ |
---|
| 220 | (document.body.clientWidth ? "-moz-border-radius: 9px 9px 9px 9px;'>" : "")+ |
---|
[285] | 221 | "<font color='RED' size='2'>"+lang_warn_firefox + "("+_version+")</font><BR>"+ |
---|
| 222 | "<font color='black' size='2'><p style='text-align:justify'> "+lang_firefox_msg1+ |
---|
| 223 | lang_firefox_msg2 + ".</p></font><div style='width:100%' align='center'>"+ |
---|
| 224 | "<a title='"+lang_install_now+"' href='http://br.mozdev.org/firefox/download.html' target='_blank'>"+lang_install_new_firefox+ "</a>"+ |
---|
[2] | 225 | " "+ |
---|
[285] | 226 | "<a title='"+lang_close+"' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>"+lang_close+"</a></div>"+ |
---|
| 227 | |
---|
[2] | 228 | "</DIV>"; |
---|
| 229 | |
---|
| 230 | document.body.appendChild(_div); |
---|
| 231 | |
---|
| 232 | myOpacity = new fx.Opacity('warning_msg', {duration: 600}); |
---|
[285] | 233 | document.getElementById("warning_msg").style.visibility = 'hidden'; |
---|
[2] | 234 | myOpacity.now = 0; |
---|
| 235 | setTimeout("myOpacity.toggle()",3000); |
---|
| 236 | } |
---|
| 237 | // Verifica versão do Firefox |
---|
| 238 | var agt=navigator.userAgent.toLowerCase(); |
---|
| 239 | if(agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.')) |
---|
[575] | 240 | buildWarningMsg(agt.substring(agt.indexOf('firefox/')+8,agt.indexOf('firefox/')+13)); |
---|