source: branches/1.2/contactcenter/js/ccMain.js @ 575

Revision 575, 7.5 KB checked in by niltonneto, 15 years ago (diff)

Melhorando tratamento de csv automático.
Resolve também #250

  • 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'] = '280px';
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                                }
57                        }
58
59                        Connector.newRequest('ViewLdap', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_visible_all_ldap', 'GET', ViewLdap);           
60                       
61                        ccTree.Connector = Connector;                                           
62                }
63                catch(e){}
64
65                /* Create the Tree Object */                   
66                //ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'});
67                //ccTree.Connector = Connector;                                         
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 () {
87                 
88         if(! this.menuStarted)
89                this.menuStarted = true;
90               
91                submenu = [];
92                textmenu = [];
93                       
94                textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_group"]
95                textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_add_group_button"];           
96                function show(){
97                        clearTimeout(_timeout);
98                        button = document.getElementById("cc_button_new");
99                               
100                        this.style.top = 19 + findPosY(button) + "px";
101                        this.style.visibility='visible';
102                }
103                function hide(){ _timeout = setTimeout("menu.style.visibility='hidden';",200); };
104                       
105                if(document.getElementById) {
106                        menu = document.getElementById("Layer1");
107                               
108                        for (i=0; i< textmenu[0].length; i++) {
109                                textmenu[0][i] = "<span onclick= 'menu.onmouseout();'>" + document.getElementById(textmenu[0][i]).value + "</span><br>";
110                                submenu[i] = document.createElement("DIV");                             
111                                submenu[i].innerHTML = textmenu[0][i];
112                                submenu[i].id = textmenu[1][i];
113                                submenu[i].onmouseover = function () {this.style.backgroundColor = 'LIGHTYELLOW';this.style.color = 'DARKBLUE';};
114                                submenu[i].onmouseout   = function () {  this.style.backgroundColor = '#DCDCDC'; this.style.color = '#006699';};                                       
115                                submenu[i].setAttribute("className", "special");
116                                submenu[i].setAttribute("class", "special");
117                                submenu[i].style.padding = "5px";                                         
118                                menu.appendChild(submenu[i]);
119                        }                       
120                               
121                        menu.onmouseover = show;
122                        menu.onmouseout = hide;
123                }
124                       
125                ccQuickAdd.associateAsButton(Element('cc_quick_add'));
126                ccAddGroup.associateAsButton(Element('cc_add_group_button'));
127                Element("cc_full_add_button").onclick = newContact;
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                Main_load();   
161                       
162        }       
163
164// BEGIN: FUNCTION RESIZE WINDOW
165var _showBar = showBar;
166var _hideBar = hideBar;
167
168function __showBar(){
169        _showBar();
170        resizeWindow();
171}
172
173function __hideBar(){
174        _hideBar();
175        resizeWindow();
176}
177showBar = __showBar;
178hideBar = __hideBar;
179       
180var _onResize   = window.onresize;
181window.onresize = resizeWindow;
182var defaultHeight = 0;
183function setDefaultHeight(){
184       
185        var bar = Element("toolbar");
186        var offset = 0;
187        if(bar.style.visibility != 'hidden')
188                offset = (bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight);     
189
190        var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight;
191        defaultHeight = screenHeight - offset; 
192        Element("cc_tree").style.height                 = defaultHeight - 68;   
193        Element("cc_left_main").style.height    = defaultHeight - 68;   
194}
195
196function resizeWindow(){
197        setDefaultHeight();
198        if(Element("divScrollMain"))
199                Element("divScrollMain").style.height   = defaultHeight - 108; 
200        if (!is_ie)
201                Element('tableDivAppbox').width = '100%';
202}
203document.body.scroll="no";
204document.body.style.overflow ="hidden";
205setDefaultHeight();
206Element('cc_main').style.height = defaultHeight;
207var lang_warn_firefox = Element('cc_msg_warn_firefox');
208var lang_firefox_msg1 = Element('cc_msg_firefox_half1');
209var lang_firefox_msg2 = Element('cc_msg_firefox_half2');
210var lang_install_now = Element('cc_msg_install_now');
211var lang_install_new_firefox = Element('cc_msg_install_new_firefox');
212var lang_close = Element('cc_msg_close');
213function buildWarningMsg(_version) {
214        var screenWidth = document.body.clientWidth ? document.body.clientWidth: document.body.offsetWidth;
215        var _div = document.createElement("DIV");
216        _div.innerHTML += "<DIV id='warning_msg' style='background:LIGHTYELLOW;position:absolute;"+
217        "border:1px solid black;left:"+(screenWidth - 330)+";top:10px;width:300px;padding:10px;"+
218        (document.body.clientWidth ? "-moz-border-radius: 9px 9px 9px 9px;'>" : "")+
219            "<font color='RED' size='2'>"+lang_warn_firefox +  "("+_version+")</font><BR>"+
220            "<font color='black' size='2'><p style='text-align:justify'>&nbsp;"+lang_firefox_msg1+
221            lang_firefox_msg2 + ".</p></font><div style='width:100%' align='center'>"+
222            "<a title='"+lang_install_now+"' href='http://br.mozdev.org/firefox/download.html' target='_blank'>"+lang_install_new_firefox+ "</a>"+     
223        "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
224            "<a title='"+lang_close+"' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>"+lang_close+"</a></div>"+
225
226        "</DIV>";
227
228        document.body.appendChild(_div);
229
230        myOpacity = new fx.Opacity('warning_msg', {duration: 600});
231        document.getElementById("warning_msg").style.visibility = 'hidden';             
232        myOpacity.now = 0;
233        setTimeout("myOpacity.toggle()",3000);
234}
235// Verifica versão do Firefox
236var agt=navigator.userAgent.toLowerCase();
237if(agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.'))
238        buildWarningMsg(agt.substring(agt.indexOf('firefox/')+8,agt.indexOf('firefox/')+13));
Note: See TracBrowser for help on using the repository browser.