source: companies/serpro/calendar/templates/celepar/js/over_fn_exmail.js @ 903

Revision 903, 5.8 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

Line 
1/******************************************************************************\
2|**************************   CALENDAR MODULE   *******************************|
3|********** PLUGIN USING AJAX EXPRESSOMAIL COMPONENT - OVERWRITE FUNCTIONS   **|
4\******************************************************************************/
5
6/******************************************************************************\
7|** Function      : emQuickSearch *********************************************|
8|** Original File : <expressoMail_module>/js/common_functions.js **************|
9\******************************************************************************/
10window.onresize = function(){};
11function emQuickSearch(el){
12
13        var emailList = el.value;
14        var field = el.id;
15        var ex_participants = Element("ex_participants");
16        var quickSearchKeyBegin;
17        var quickSearchKeyEnd;
18       
19        var handler_emQuickSearch = function(data){
20                window_DropDownContacts = Element('tipDiv');
21                if (window_DropDownContacts.style.visibility != 'hidden'){
22                        window_DropDownContacts.style.visibility = 'hidden';
23                }
24               
25                if ((!data.status) && (data.error == "many results")){
26                        alert(get_lang('More than %1 results. Please, try to refine your search.',200));
27                        return false;
28                }
29                       
30                if (data.length > 0){
31                        QuickCatalogSearch.showList(data, quickSearchKeyBegin, quickSearchKeyEnd);
32                }
33                else
34                        alert(get_lang('None result was found.'));
35                return true;
36        }
37        ex_participants.focus();                                //mecessary for IE.
38        var i = getPosition(ex_participants); //inputBox.selectionStart;
39        var j = --i;
40
41    while ((j >= 0) && (emailList.charAt(j) != ',')){j--};
42    quickSearchKeyBegin = ++j;
43
44    while ((i <= emailList.length) && (emailList.charAt(i) != ',')){i++};
45    quickSearchKeyEnd = i;
46
47    var search_for = trim(emailList.substring(quickSearchKeyBegin, quickSearchKeyEnd));
48
49        if (search_for.length < 4){
50                alert(get_lang('Your search argument must be longer than 4 characters.'));
51                return false;
52        }
53       
54        cExecute ("expressoMail1_2.ldap_functions.quicksearch&search_for="+search_for+"&field="+field, handler_emQuickSearch);
55}
56
57/******************************************************************************\
58|** Function      : emQuickCatalogSearch.prototype.transfer_result ************|
59|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
60\******************************************************************************/
61emQuickCatalogSearch.prototype.transfer_result = function (field, ID, begin, end){
62        cm = document.getElementById('select_QuickCatalogSearch');
63        option_selected = cm.options[cm.selectedIndex].value + ", ";
64        emailList = Element("ex_participants").value;           
65        new_emailList = emailList.substring(0, begin) + option_selected + emailList.substring((parseInt(end) + 2), emailList.length);
66        document.getElementById("ex_participants").value = new_emailList;
67        if(is_ie)
68                Element("i_blank").style.display = "none";
69        document.getElementById("ex_participants").focus();
70        this.arrayWin['window_QuickCatalogSearch'].close();
71}
72
73/******************************************************************************\
74|** Function      : emQuickCatalogSearch.prototype.close_QuickSearch_window ***|
75|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
76\******************************************************************************/
77emQuickCatalogSearch.prototype.close_QuickSearch_window = function (field, ID){
78        if(is_ie)
79                Element("i_blank").style.display = "none";
80        document.getElementById("ex_participants").focus();
81        this.arrayWin['window_QuickCatalogSearch'].close();
82}
83
84/******************************************************************************\
85|** Function      : emQuickCatalogSearch.prototype.showWindow *****************|
86|** Original File : <expressoMail_module>/js/QuickCatalogSearch.js ************|
87\******************************************************************************/
88emQuickCatalogSearch.prototype.showWindow = function (div)
89{
90        if(! div) {
91                alert(get_lang('The list has no participant.'));
92                return;
93        }
94                                               
95        if(! this.arrayWin[div.id]) {
96                div.style.width = "700px";
97                div.style.height = "230px";
98                var title = get_lang('The results were found in the Global Catalog')+':';
99                var wHeight = div.offsetHeight + "px";
100                var wWidth =  div.offsetWidth   + "px";
101                div.style.width = div.offsetWidth - 5;
102
103                win = new dJSWin({                     
104                        id: 'QuickCatalogSearch_'+div.id,
105                        content_id: div.id,
106                        width: wWidth,
107                        height: wHeight,
108                        y:'300px',
109                        top: '300px',
110                        title_color: '#3978d6',
111                        bg_color: '#eee',
112                        title: title,                                           
113                        title_text_color: 'white',
114                        button_x_img: 'phpgwapi/images/winclose.gif',
115                        border: true });
116               
117                this.arrayWin[div.id] = win;
118                win.draw();
119        }
120        else {
121                win = this.arrayWin[div.id];
122        }
123
124        if(is_ie) {     
125                var _IFrame = Element("i_blank");
126                if(_IFrame){
127                _IFrame.style.display  = '' ;           
128                }
129                else {
130                        _IFrame = document.body.appendChild(document.createElement('iframe'));
131                        _IFrame.src = 'about:blank' ;
132                    _IFrame.frameBorder         = '0';
133                    _IFrame.scrolling           = 'no' ;
134                    _IFrame.style.left          = findPosX(div)  + document.body.scrollLeft -5;
135                        _IFrame.style.top               = findPosY(div)  + document.body.scrollTop  -20;
136                    _IFrame.width                       = 610;
137                    _IFrame.style.border        = 0;
138                        _IFrame.height                  = 285;
139                        _IFrame.border                  = 0;
140                        _IFrame.id                              = "i_blank";
141                    _IFrame.style.position      = 'absolute';
142                    _IFrame.style.zIndex        = '5';
143                _IFrame.style.display  = '' ;
144                }
145        }
146
147        win.open();
148        document.getElementById('select_QuickCatalogSearch').focus();
149}       
150
151
152/******************************************************************************\
153|** Function      :  DRAG *****************************************************|
154|** Original File : phpgwapi/js/wz_dragdrop/wz_dragdrop.js ********************|
155\******************************************************************************/
156var over_fn_DRAG = DRAG;
157DRAG = function (event){
158
159                if(is_ie)
160                        return false;
161                else
162                        over_fn_DRAG(event);
163}               
Note: See TracBrowser for help on using the repository browser.