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

Revision 1598, 7.7 KB checked in by rafaelraymundo, 14 years ago (diff)

Ticket #704 - Incluido outro campo para busca utilizando atributo do LDAP

  • 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_contact_sh","cc_msg_group"];
95                textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_full_add_button_sh", "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                Element("cc_full_add_button_sh").onclick = newSharedContact;
129                         
130                       
131                ccQuickAdd.afterSave = function ()
132                {
133                        updateCards();
134                }                       
135                       
136                ccAddGroup.load = function ()
137                {                               
138                        editGroup();                   
139                }
140                       
141                ccAddGroup.afterSave = function ()
142                {
143                        updateCards();
144                }
145                       
146                return true;
147        }
148
149        if (is_ie)
150        {
151                       
152                document.body.onload = function (e)
153                {                       
154                        Main_pre_load();                                                               
155                        Main_load();                                   
156                                                               
157                }
158        }
159        else
160        {
161               
162                Main_load();   
163                       
164        }       
165
166// BEGIN: FUNCTION RESIZE WINDOW
167var _showBar = showBar;
168var _hideBar = hideBar;
169
170function __showBar(){
171        _showBar();
172        resizeWindow();
173}
174
175function __hideBar(){
176        _hideBar();
177        resizeWindow();
178}
179showBar = __showBar;
180hideBar = __hideBar;
181       
182var _onResize   = window.onresize;
183window.onresize = resizeWindow;
184var defaultHeight = 0;
185function setDefaultHeight(){
186       
187        var bar = Element("toolbar");
188        var offset = 0;
189        if(bar.style.visibility != 'hidden')
190                offset = (bar.offsetHeight ? bar.offsetHeight :  bar.clientHeight);     
191
192        var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight;
193        defaultHeight = screenHeight - offset; 
194        Element("cc_tree").style.height                 = defaultHeight - 68;   
195        Element("cc_left_main").style.height    = defaultHeight - 68;   
196}
197
198function resizeWindow(){
199        setDefaultHeight();
200        if(Element("divScrollMain"))
201                Element("divScrollMain").style.height   = defaultHeight - 108; 
202        if (!is_ie)
203                Element('tableDivAppbox').width = '100%';
204}
205document.body.scroll="no";
206document.body.style.overflow ="hidden";
207setDefaultHeight();
208Element('cc_main').style.height = defaultHeight;
209var lang_warn_firefox = Element('cc_msg_warn_firefox');
210var lang_firefox_msg1 = Element('cc_msg_firefox_half1');
211var lang_firefox_msg2 = Element('cc_msg_firefox_half2');
212var lang_install_now = Element('cc_msg_install_now');
213var lang_install_new_firefox = Element('cc_msg_install_new_firefox');
214var lang_close = Element('cc_msg_close');
215function buildWarningMsg(_version) {
216        var screenWidth = document.body.clientWidth ? document.body.clientWidth: document.body.offsetWidth;
217        var _div = document.createElement("DIV");
218        _div.innerHTML += "<DIV id='warning_msg' style='background:LIGHTYELLOW;position:absolute;"+
219        "border:1px solid black;left:"+(screenWidth - 330)+";top:10px;width:300px;padding:10px;"+
220        (document.body.clientWidth ? "-moz-border-radius: 9px 9px 9px 9px;'>" : "")+
221            "<font color='RED' size='2'>"+lang_warn_firefox +  "("+_version+")</font><BR>"+
222            "<font color='black' size='2'><p style='text-align:justify'>&nbsp;"+lang_firefox_msg1+
223            lang_firefox_msg2 + ".</p></font><div style='width:100%' align='center'>"+
224            "<a title='"+lang_install_now+"' href='http://br.mozdev.org/firefox/download.html' target='_blank'>"+lang_install_new_firefox+ "</a>"+     
225        "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
226            "<a title='"+lang_close+"' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>"+lang_close+"</a></div>"+
227
228        "</DIV>";
229
230        document.body.appendChild(_div);
231
232        myOpacity = new fx.Opacity('warning_msg', {duration: 600});
233        document.getElementById("warning_msg").style.visibility = 'hidden';             
234        myOpacity.now = 0;
235        setTimeout("myOpacity.toggle()",3000);
236}
237// Verifica versão do Firefox
238var agt=navigator.userAgent.toLowerCase();
239if(agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.'))
240        buildWarningMsg(agt.substring(agt.indexOf('firefox/')+8,agt.indexOf('firefox/')+13));
Note: See TracBrowser for help on using the repository browser.