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