source: branches/2.2/contactcenter/js/ccMain.js @ 3644

Revision 3644, 8.0 KB checked in by rafaelraymundo, 13 years ago (diff)

Ticket #1338 - Desalinhamento dos campos de pesquisa do contactcenter no IE.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1var last_id = 0;       
2
3function 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
12var Main_pre_load = document.body.onload;
13var ccSearch, ccTree;
14var 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'] = (v_label != false &  v_atrib != false)? '485px' : '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
172var _showBar = showBar;
173var _hideBar = hideBar;
174
175function __showBar(){
176        _showBar();
177        resizeWindow();
178}
179
180function __hideBar(){
181        _hideBar();
182        resizeWindow();
183}
184showBar = __showBar;
185hideBar = __hideBar;
186       
187var _onResize   = window.onresize;
188window.onresize = resizeWindow;
189var defaultHeight = 0;
190function 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
203function resizeWindow(){
204        setDefaultHeight();
205        if(Element("divScrollMain"))
206                Element("divScrollMain").style.height   = defaultHeight - 108; 
207        if (!is_ie)
208                Element('tableDivAppbox').width = '100%';
209}
210document.body.scroll="no";
211document.body.style.overflow ="hidden";
212setDefaultHeight();
213Element('cc_main').style.height = defaultHeight;
214var lang_warn_firefox = Element('cc_msg_warn_firefox');
215var lang_firefox_msg1 = Element('cc_msg_firefox_half1');
216var lang_firefox_msg2 = Element('cc_msg_firefox_half2');
217var lang_install_now = Element('cc_msg_install_now');
218var lang_install_new_firefox = Element('cc_msg_install_new_firefox');
219var lang_close = Element('cc_msg_close');
220function 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'>&nbsp;"+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        "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
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
243var agt=navigator.userAgent.toLowerCase();
244if(agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.'))
245        buildWarningMsg(agt.substring(agt.indexOf('firefox/')+8,agt.indexOf('firefox/')+13));
Note: See TracBrowser for help on using the repository browser.