source: sandbox/expresso2.2/contactcenter/js/ccMain.js @ 1662

Revision 1662, 7.5 KB checked in by amuller, 14 years ago (diff)

Ticket #490 - Criação dos códigos de unificação ajax

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