source: sandbox/2.4.2-expresso2/expressoMail1_2/js/report_window.js @ 5315

Revision 5315, 4.5 KB checked in by douglasz, 12 years ago (diff)

Ticket #2422 - Funcionalidade de reportar erro nao esta funcionando.

  • Property svn:executable set to *
Line 
1/**************************************************************************\
2 Relatório de problema no email pelo usuário.
3\**************************************************************************/
4
5        function report_window()
6        {
7                this.arrayW = new Array();
8        }
9
10        /* Propriedades da tela */
11        report_window.prototype.make_report_window = function(ID_msg){
12                _this = this;
13                var title = get_lang("More information about the problem (optional)");
14               
15                tree                              = document.createElement("DIV");
16                tree.style.visibility = "hidden";
17                tree.style.position   = "absolute";
18                tree.style.left           = "0px";
19                tree.style.top            = "0px";
20                tree.style.width          = "0px";
21                tree.style.height         = "0px";                                                                     
22                tree.id                           = "window";
23                        document.body.appendChild(tree);
24
25                var msg_title = document.createElement("DIV");
26                        msg_title.id = "div_title";
27                        msg_title.style.position = "absolute";         
28                        msg_title.style.left = "5px";
29                        msg_title.style.top = "-8px"           
30                        msg_title.style.width = "240px";
31                        msg_title.style.height = "350px";
32                        msg_title.innerHTML = "<br><b><font color='BLACK' nowrap>"+title+"</font></b>";
33                                tree.appendChild(msg_title);
34               
35                var text_area_div = document.createElement("DIV");
36                        text_area_div.id = "div_text_area";
37                var     text_area = document.createElement("TEXTAREA");
38                        text_area.id = "text_area";
39                        text_area.style.position = "absolute";         
40                        text_area.style.left = "5px";
41                        text_area.style.top = "45px"           
42                        text_area.style.width = "240px";
43                        text_area.style.height = "130px";
44                                text_area_div.appendChild(text_area);
45                                tree.appendChild(text_area_div);
46               
47                var msg_confirmation = document.createElement("DIV");
48                        msg_confirmation.id = "div_msg_confirmation";
49                        msg_confirmation.style.position = "absolute";           
50                        msg_confirmation.style.left = "5px";
51                        msg_confirmation.style.top = "170px"           
52                        msg_confirmation.style.width = "240px";
53                        msg_confirmation.style.height = "350px";
54                        msg_confirm = get_lang("Attention! The information contained in the e-mail will be sent to the support team");
55                        msg_confirmation.innerHTML = "<br><b><font color='BLACK' nowrap>"+msg_confirm+"</font></b>";
56                                tree.appendChild(msg_confirmation);
57               
58               
59                var div_buttons = document.createElement("DIV");
60                        div_buttons.id = "div_buttons_report";
61                        div_buttons.style.position = "absolute";               
62                        div_buttons.style.left = "50px";
63                        div_buttons.style.top = "160px"         
64                        div_buttons.style.width = "130px";
65                        div_buttons.style.height = "190px";
66                        div_buttons.innerHTML = "<table border='0' cellpading='0' cellspacing='0'>"+
67                                                                        "<tr><td><br><br><br><br><br></td></tr>"+
68                                                                        "<tr>" +
69                                                                        "<td><input type='button' value='"+get_lang('Report error')+"' onclick='report_error()'></td>" +
70                                                                        "<td><input type='button' value='"+get_lang('Cancel')+"' onclick='report_wind.close_win()'></td>" +
71                                                                        "</tr>"+
72                                                                        "</table>";
73                        tree.appendChild(div_buttons);         
74                /* Mostra a tela*/     
75                _this.showWindow(tree);
76        }
77
78       
79        /* Mostra a tela para o usuário */
80        report_window.prototype.showWindow = function (div){
81                if(! div) {
82                        return;
83                }
84               
85                if(! this.arrayW[div.id]) {
86                        div.style.width  = "250px";
87                        div.style.height = "260px";
88                        div.style.zIndex = "10000";                     
89                        var title = get_lang("Email report error");
90                        var wHeight = div.offsetHeight + "px";
91                        var wWidth =  div.offsetWidth   + "px";
92                        div.style.width = div.offsetWidth - 5;
93
94                        win = new dJSWin({
95                                id: 'win_'+div.id,
96                                content_id: div.id,
97                                width: wWidth,
98                                height: wHeight,
99                                title_color: '#3978d6',
100                                bg_color: '#eee',
101                                title: title,
102                                title_text_color: 'white',
103                                button_x_img: '../phpgwapi/images/winclose.gif',
104                                border: true });
105                       
106                        this.arrayW[div.id] = win;
107                        win.draw();
108                }
109                else {
110                        win = this.arrayW[div.id];
111                }
112                win.open();
113        }
114       
115        /* Fecha a janela do report error */
116        report_window.prototype.close_win = function(){
117       
118                this.arrayW['window'].close();
119                return false;
120        }
121
122        /* Função que envia a mensagem do usuário para o servidor */   
123        function report_error() {               
124                msg_user   = document.getElementById('text_area').value;
125                msg_folder = get_current_folder();
126                cExecute ("$this.imap_functions.report_mail_error&params="+ID_msg+";;"+msg_user+";;"+msg_folder, handler_report_error);         
127        }
128
129        /* Retorno da chamada ao servidor */
130        function handler_report_error(data) {
131                report_wind.close_win();
132                document.getElementById('text_area').value = "";
133        }
134       
135       
136        /* Build the Object */
137        var report_wind;
138        report_wind = new report_window();
Note: See TracBrowser for help on using the repository browser.