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

Revision 119, 6.9 KB checked in by niltonneto, 16 years ago (diff)

Internacionalização do CC

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