source: trunk/contactcenter/js/ccMain.js @ 284

Revision 284, 6.7 KB checked in by rafaelraymundo, 16 years ago (diff)

Vide Trac - #197, #166, #198, #199

  1. Correção de problema na leitura do arquivo configuração.
  2. Permissão do click2dial também no contactcenter.
  3. Visualização de matricula, e nro celular no resultado da pesquisa(se estiverem populados)
  4. Adicionada a leitura a Catálogos Externos
  • 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                /* Create the Tree Object */
44                //ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'});
45                ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); clearCards();'});
46
47                ccTree.Connector = Connector;
48        }
49        var menuStarted = false;
50        function findPosY(obj)
51        {
52                var curtop = 0;
53                if (obj.offsetParent)
54                {
55                        while (obj.offsetParent)
56                        {
57                                curtop += obj.offsetTop
58                                obj = obj.offsetParent;
59                        }
60                }
61                else if (obj.y)
62                        curtop += obj.y;
63                return curtop;
64        }
65        var _timeout = '';
66        var menu = function () {
67
68         if(! this.menuStarted)
69                this.menuStarted = true;
70
71                submenu = [];
72                textmenu = [];
73
74                textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_group"]
75                textmenu[1] = ["cc_quick_add", "cc_full_add", "cc_add_group"];
76                function show(){
77                        clearTimeout(_timeout);
78                        button = document.getElementById("cc_button_new");
79
80                        this.style.top = 19 + findPosY(button) + "px";
81                        this.style.visibility='visible';
82                }
83                function hide(){ _timeout = setTimeout("menu.style.visibility='hidden';",200); };
84
85                if(document.getElementById) {
86                        menu = document.getElementById("Layer1");
87
88                        for (i=0; i< textmenu[0].length; i++) {
89                                textmenu[0][i] = "<span onclick= 'menu.onmouseout();'>" + document.getElementById(textmenu[0][i]).value + "</span><br>";
90                                submenu[i] = document.createElement("DIV");
91                                submenu[i].innerHTML = textmenu[0][i];
92                                submenu[i].id = textmenu[1][i];
93                                submenu[i].onmouseover = function () {this.style.backgroundColor = 'LIGHTYELLOW';this.style.color = 'DARKBLUE';};
94                                submenu[i].onmouseout   = function () {  this.style.backgroundColor = '#DCDCDC'; this.style.color = '#006699';};
95                                submenu[i].setAttribute("className", "special");
96                                submenu[i].setAttribute("class", "special");
97                                submenu[i].style.padding = "5px";
98                                menu.appendChild(submenu[i]);
99                        }
100
101                        menu.onmouseover = show;
102                        menu.onmouseout = hide;
103                }
104
105                ccQuickAdd.associateAsButton(Element('cc_quick_add'));
106                ccAddGroup.associateAsButton(Element('cc_add_group'));
107                document.getElementById("cc_full_add").onclick= newContact;
108
109
110                ccQuickAdd.afterSave = function ()
111                {
112                        updateCards();
113                }
114
115                ccAddGroup.load = function ()
116                {
117                        editGroup();
118                }
119
120                ccAddGroup.afterSave = function ()
121                {
122                        updateCards();
123                }
124
125                return true;
126        }
127
128        if (is_ie)
129        {
130
131                document.body.onload = function (e)
132                {
133                        Main_pre_load();
134                        Main_load();
135
136                }
137        }
138        else
139        {
140                Main_load();
141
142        }
143
144// BEGIN: FUNCTION RESIZE WINDOW
145var _showBar = showBar;
146var _hideBar = hideBar;
147
148function __showBar(){
149        _showBar();
150        resizeWindow();
151}
152
153function __hideBar(){
154        _hideBar();
155        resizeWindow();
156}
157showBar = __showBar;
158hideBar = __hideBar;
159
160var _onResize   = window.onresize;
161window.onresize = resizeWindow;
162var defaultHeight = 0;
163function setDefaultHeight(){
164
165        var bar = Element("toolbar");
166        var offset = 0;
167        if(bar.style.visibility != 'hidden')
168                offset = (bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight);
169
170        var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight;
171        defaultHeight = screenHeight - offset;
172        Element("cc_tree").style.height                 = defaultHeight - 68;
173        Element("cc_left_main").style.height    = defaultHeight - 68;
174}
175
176function resizeWindow(){
177        setDefaultHeight();
178        if(Element("divScrollMain"))
179                Element("divScrollMain").style.height   = defaultHeight - 108;
180        if (!is_ie)
181                Element('tableDivAppbox').width = '100%';
182}
183document.body.scroll="no";
184document.body.style.overflow ="hidden";
185setDefaultHeight();
186Element('cc_main').style.height = defaultHeight;
187function buildWarningMsg(_version) {
188        var screenWidth = document.body.clientWidth ? document.body.clientWidth: document.body.offsetWidth;
189        var _div = document.createElement("DIV");
190        _div.innerHTML += "<DIV id='warning_msg' style='background:LIGHTYELLOW;position:absolute;"+
191        "border:1px solid black;left:"+(screenWidth - 330)+";top:10px;width:300px;padding:10px;"+
192        (document.body.clientWidth ? "-moz-border-radius: 9px 9px 9px 9px;'>" : "")+
193        "<font color='RED' size='2'>Aviso: Versão muito antiga do Firefox ("+_version+")</font><BR>"+
194        "<font color='black' size='2'><p style='text-align:justify'>&nbsp;Para que essa aplicação funcione <u>corretamente</u> "+
195        "é necessário atualizar o seu navegador Firefox para uma versão mais nova (versão > 1.5). "+
196        "Instale agora clicando no link abaixo ou caso queira atualizar mais tarde (não recomendável), clique em Fechar.</p></font><div style='width:100%' align='center'>"+
197        "<a title='Instalar agora' href='http://br.mozdev.org/firefox/download.html' target='_blank'>Instalar nova versão do Firefox</a>"+
198        "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
199        "<a title='Fechar' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>Fechar</a></div>"+
200        "</DIV>";
201
202        document.body.appendChild(_div);
203
204        myOpacity = new fx.Opacity('warning_msg', {duration: 600});
205        document.getElementById("warning_msg").style.visibility = 'hidden';
206        myOpacity.now = 0;
207        setTimeout("myOpacity.toggle()",3000);
208}
209// Verifica versão do Firefox
210var agt=navigator.userAgent.toLowerCase();
211if(agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.'))
212        buildWarningMsg(agt.substring(agt.indexOf('firefox/')+8,agt.indexOf('firefox/')+13));
Note: See TracBrowser for help on using the repository browser.