source: trunk/calendar/templates/celepar/js/over_fn_exmail.js @ 2

Revision 2, 5.8 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

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