Commit dcd07176d22701ed525bd3135205341e0722e9fb

Authored by Elena.Budnik
1 parent 1c24551b

Feedback manager

generic_data/Feedback/Feedback.xml deleted
... ... @@ -1,12 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<root>
3   -
4   - <issue user="ToDo" userAgent="Chrome - WebKit - 534.10" interface="General" IP="195.83.102.217" date="2011-10-17" subject="Bug" read="" xml:id="0">fsdfsdf</issue>
5   - <issue user="cecconi" userAgent="Safari - WebKit - 536.26.17" interface="Plot_Data" IP="145.238.174.117" date="2012-12-17" subject="Bug" read="" xml:id="1">J'essaye de tracer les données "cass_lp_ne" (via drap and drop). Un seul panel de plot.
6   -Je selectionne une date de début 2005/02/16 00:00:00 et durée: 2j
7   -
8   -Je clique sur "Plot"
9   -
10   -Ca grise l'écran pendant une fraction de seconde avec la mini-fenêtre avec le truc qui tourne. Et puis ça revient, sans afficher la fenêtre de plot.</issue>
11   -
12   -</root>
js/app/controllers/FeedbackModule.js
... ... @@ -5,50 +5,44 @@
5 5 * @extends amdaDesktop.AmdaModule
6 6 * @brief Feedback controller
7 7 * @author Benjamin
8   - * @version $Id: FeedbackModule.js 965 2012-06-28 16:05:30Z benjamin $
9   - ********************************************************************************
10   - * FT Id : Date : Name - Description
11   - *******************************************************************************
12   - * :
  8 + * @version $Id: FeedbackModule.js 965 2012-06-28 16:05:30Z benjamin $
13 9 */
14 10  
15 11 Ext.define('amdaDesktop.FeedbackModule', {
16 12  
17   - extend: 'amdaDesktop.AmdaModule',
18   -
19   - requires : [
20   - 'amdaUI.FeedbackUI'
21   - ],
  13 + extend: 'amdaDesktop.AmdaModule',
  14 +
  15 + requires : [
  16 + 'amdaUI.FeedbackUI'
  17 + ],
22 18  
23 19 contentId : 'feedUI',
24 20  
25 21 createWindow : function(){
26   - var desktop = this.app.getDesktop();
27   - var win = desktop.getWindow(this.id);
28   -
29   - if(!win){
30   - win = desktop.createWindow({
31   - id: this.id,
32   - title:this.title,
33   - layout: 'anchor',
34   - width:600,
35   - height:550,
36   - modal: true,
37   - iconCls: this.icon,
38   - animCollapse:false,
39   - constrainHeader:true,
40   - bodyPadding : 5,
41   - stateful : true,
42   - stateId : this.id,
43   - stateEvents: ['move','show','resize'],
44   - items : [
45   - {
46   - xtype: 'panelFeedback'
47   - }
48   - ]
49   - });
50   - }
51   - win.show();
52   - return win;
  22 + var desktop = this.app.getDesktop();
  23 + var win = desktop.getWindow(this.id);
  24 +
  25 + if(!win){
  26 + win = desktop.createWindow({
  27 + id: this.id,
  28 + title:this.title,
  29 + layout: 'fit',
  30 + width: 600,
  31 + height: 550,
  32 + modal: true,
  33 + iconCls: this.icon,
  34 + animCollapse:false,
  35 + constrainHeader:true,
  36 + bodyPadding : 5,
  37 + stateful : true,
  38 + stateId : this.id,
  39 + stateEvents: ['move','show','resize'],
  40 + items : [{
  41 + xtype: 'panelFeedback'
  42 + }]
  43 + });
  44 + }
  45 + win.show();
  46 + return win;
53 47 }
54 48 });
55 49 \ No newline at end of file
... ...
js/app/views/FeedbackUI.js
... ... @@ -5,265 +5,262 @@
5 5 * @extends Ext.panel.Panel
6 6 * @brief Feedback view
7 7 * @author Benjamin
8   - * @version $Id: FeedbackUI.js 2031 2014-01-22 11:28:34Z elena $
9   - ********************************************************************************
10   - * FT Id : Date : Name - Description
11   - *******************************************************************************
12   - * :
  8 + * @version $Id: FeedbackUI.js 2031 2014-01-22 11:28:34Z elena $
13 9 */
14 10  
15 11 Ext.define('amdaUI.FeedbackUI', {
16   - extend: 'Ext.form.Panel',
17   - alias: 'widget.panelFeedback',
18   -
19   - constructor: function(config) {
  12 + extend: 'Ext.form.Panel',
  13 + alias: 'widget.panelFeedback',
  14 +
  15 + constructor: function(config) {
20 16 this.init(config);
21 17 this.callParent(arguments);
22 18 },
23 19  
24   - getInfoMsg : function()
25   - {
26   - return '<h2>Welcome,</h2>' +
27   - 'You have problems/comments</br>'+
28   - 'Please select an item[s] from a list below and describe the problem...</br></br>';
29   - },
  20 + getInfoMsg : function()
  21 + {
  22 + return '<h3>Welcome,</h3>' +
  23 + 'You have problems/comments</br>'+
  24 + 'Please select an item[s] from a list below and describe the problem...';
  25 + },
30 26  
31   - getBrowserInfo : function()
32   - {
33   - return Ext.browser.name+' - '+Ext.browser.engineName+' - '+Ext.browser.engineVersion;
34   - },
35   -
36   - getUser : function()
37   - {
38   - return sessionID;
39   - },
  27 + getBrowserInfo : function()
  28 + {
  29 + return Ext.browser.name+' - '+Ext.browser.engineName+' - '+Ext.browser.engineVersion;
  30 + },
40 31  
41   - getInterfaceList : function()
42   - {
43   - return [
44   - ['General','General'],
45   - ['Plot_Data','Plot Data'],
46   - ['Data_mining','Data mining'],
47   - ['My_Parameters','Parameters'],
48   - ['My_Time_Tables','Time Tables'],
49   - ['Download_Data','Download Data'],
50   - ['Upload_Data','Upload Data'],
51   - ['Interoperability','Interoperability'],
52   - ['Add_External_Data','External Data']
53   - ];
54   - },
  32 + getUser : function()
  33 + {
  34 + return sessionID;
  35 + },
55 36  
56   - onSendFinish : function(result, e){
57   - var t = e.getTransaction();
  37 + getInterfaceList : function()
  38 + {
  39 + return [
  40 + ['General','General'],
  41 + ['Plot_Data','Plot Data'],
  42 + ['Data_mining','Data mining'],
  43 + ['My_Parameters','Parameters'],
  44 + ['My_Time_Tables','Time Tables'],
  45 + ['My_Catalogs','Catalogs'],
  46 + ['Statistics', 'Statistics'],
  47 + ['Download_Data','Download Data'],
  48 + ['Upload_Data','Upload Data'],
  49 + ['Interoperability','Interoperability'],
  50 + ['Add_External_Data','External Data']
  51 + ];
  52 + },
  53 +
  54 + onSendFinish : function(result, e){
  55 + var t = e.getTransaction();
58 56 if (e.status)
59 57 {
60   - if (result && result == 'none')
61   - {
62   - // SUCCESS
63   - var win = myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.feedback.id);
64   - Ext.MessageBox.show({
65   - title: 'Feedback sended',
66   - msg: 'Thanks for your feedback',
67   - buttons: Ext.MessageBox.OK,
68   - icon: Ext.MessageBox.INFO,
69   - fn: function (btn){
70   - win.close();
71   - }
72   - });
73   - }
74   - else
75   - {
76   - //ERROR
77   - var msgErr = 'Unknown error';
78   - switch (result)
79   - {
80   - case 'err_user' :
81   - msgErr = 'User not defined';
82   - break;
83   - case 'err_file' :
84   - msgErr = 'Feedback file error';
85   - break;
86   - }
87   - Ext.Msg.show({title:'Error', msg: msgErr, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
88   - }
  58 + if (result && result == 'none')
  59 + {
  60 + // SUCCESS
  61 + var win = myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.feedback.id);
  62 + Ext.MessageBox.show({
  63 + title: 'Feedback sent',
  64 + msg: 'Thanks for your feedback',
  65 + buttons: Ext.MessageBox.OK,
  66 + icon: Ext.MessageBox.INFO,
  67 + fn: function (btn){
  68 + win.close();
  69 + }
  70 + });
  71 + }
  72 + else
  73 + {
  74 + //ERROR
  75 + var msgErr = 'Unknown error';
  76 + switch (result)
  77 + {
  78 + case 'err_user' :
  79 + msgErr = 'User not defined';
  80 + break;
  81 + case 'err_file' :
  82 + msgErr = 'Feedback file error';
  83 + break;
  84 + }
  85 + Ext.Msg.show({title:'Error', msg: msgErr, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  86 + }
89 87 }
90 88 else
91 89 {
92   - // FAILURE
93   - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  90 + // FAILURE
  91 + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
94 92 }
95   - },
  93 + },
96 94  
97   - onSendIssue : function(b,e){
98   - //get links to components
99   - var fieldset = this.getComponent('feedback_fieldset');
100   - var fieldsubject = fieldset.getComponent('subject_checkboxgroup');
101   - var fielduser = fieldset.getComponent('user_displayfield');
102   - var fieldbrowser = fieldset.getComponent('browser_displayfield');
103   - var fieldattach = fieldset.getComponent('attach_filefield');
104   - var fieldinterface = fieldset.getComponent('interface_combo');
105   - var fielddes = fieldset.getComponent('desc_textarea');
  95 + onSendIssue : function(b,e){
  96 + //get links to components
  97 + var fieldset = this.getComponent('feedback_fieldset');
  98 + var fieldsubject = fieldset.getComponent('subject_checkboxgroup');
  99 + var fielduser = fieldset.getComponent('user_displayfield');
  100 + var fieldbrowser = fieldset.getComponent('browser_displayfield');
  101 + var fieldattach = fieldset.getComponent('attach_filefield');
  102 + var fieldinterface = fieldset.getComponent('interface_combo');
  103 + var fielddes = fieldset.getComponent('desc_textarea');
106 104  
107   - //test if some fields are valid
108   - if (!fieldsubject.isValid() || !fielddes.isValid())
109   - {
110   - Ext.Msg.show({title:'Error', msg: 'Some field are required', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
111   - return;
112   - }
  105 + //test if some fields are valid
  106 + if (!fieldsubject.isValid() || !fielddes.isValid())
  107 + {
  108 + Ext.Msg.show({title:'Error', msg: 'Some field are required', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  109 + return;
  110 + }
113 111  
114   - //generate subject message (a list of all checked boxes)
115   - var subjectMsg = '';
116   - fieldsubject.items.each(function (item){
117   - if (!item.checked)
118   - return;
119   - if (subjectMsg != '')
120   - subjectMsg += ' - ';
121   - subjectMsg += item.boxLabel;
122   - },this);
  112 + //generate subject message (a list of all checked boxes)
  113 + var subjectMsg = '';
  114 + fieldsubject.items.each(function (item){
  115 + if (!item.checked)
  116 + return;
  117 + if (subjectMsg != '')
  118 + subjectMsg += ' - ';
  119 + subjectMsg += item.boxLabel;
  120 + },this);
123 121  
124   - //make the object to send
125   - var feed = {user : fielduser.getValue(),
126   - interface : fieldinterface.getValue(),
127   - subject : subjectMsg,
128   - userText : fielddes.getValue(),
129   - userAgent : fieldbrowser.getValue(),
130   - attach : fieldattach.getValue()};
131   -
132   - if (feed.attach != '')
133   - {
134   - this.submit({
135   - scope : this,
136   - url: 'php/uploadFile.php',
137   - waitMsg: 'Uploading your file...',
138   - success: function(form, o)
139   - {
140   - feed.attach = o.result.file;
141   - //call action
142   - AmdaAction.sendFeedback(feed,this.onSendFinish,this);
143   - },
144   - failure: function(form, o)
145   - {
146   - Ext.Msg.show( {
147   - title : 'Feedback - Upload attachment',
148   - msg : 'Error '+o.result.error,
149   - modal : true,
150   - icon : Ext.Msg.ERROR,
151   - buttons : Ext.Msg.OK
152   - });
  122 + //make the object to send
  123 + var feed = {user : fielduser.getValue(),
  124 + interface : fieldinterface.getValue(),
  125 + subject : subjectMsg,
  126 + userText : fielddes.getValue(),
  127 + userAgent : fieldbrowser.getValue(),
  128 + attach : fieldattach.getValue()};
  129 +
  130 + if (feed.attach != '')
  131 + {
  132 + this.submit({
  133 + scope : this,
  134 + url: 'php/uploadFile.php',
  135 + waitMsg: 'Uploading your file...',
  136 + success: function(form, o)
  137 + {
  138 + feed.attach = o.result.file;
  139 + //call action
  140 + AmdaAction.sendFeedback(feed,this.onSendFinish,this);
  141 + },
  142 + failure: function(form, o)
  143 + {
  144 + Ext.Msg.show( {
  145 + title : 'Feedback - Upload attachment',
  146 + msg : 'Error '+o.result.error,
  147 + modal : true,
  148 + icon : Ext.Msg.ERROR,
  149 + buttons : Ext.Msg.OK
  150 + });
153 151 }
154   - });
155   - }
156   - else
157   - //call action
158   - AmdaAction.sendFeedback(feed,this.onSendFinish,this);
159   - },
  152 + });
  153 + }
  154 + else
  155 + //call action
  156 + AmdaAction.sendFeedback(feed,this.onSendFinish,this);
  157 + },
160 158  
161   - init : function(config)
162   - {
163   - var myConf = {
164   - layout: 'fit',
165   - bodyStyle: { background: '#ddecfe'},
166   - items : [
167   - {
168   - xtype: 'fieldset',
169   - itemId: 'feedback_fieldset',
170   - layout: 'anchor',
171   - anchor: '100%',
172   - items : [
173   - {
174   - xtype: 'displayfield',
175   - itemId: 'info_displayfield',
176   - name: 'information',
177   - fieldLabel: '',
178   - anchor: '100%',
179   - value: this.getInfoMsg()
180   - },
181   - {
182   - xtype: 'checkboxgroup',
183   - itemId: 'subject_checkboxgroup',
184   - fieldLabel: 'Subject',
185   - anchor: '100%',
186   - columns : 3,
187   - vertical: true,
188   - allowBlank: false,
189   - items: [
190   - {boxLabel: 'Bug', inputValue: 'bug', checked: true},
191   - {boxLabel: 'Question', inputValue: 'question'},
192   - {boxLabel: 'Data', inputValue: 'data'},
193   - {boxLabel: 'Comment', inputValue: 'comment'},
194   - {boxLabel: 'Other', inputValue: 'other'}
195   - ]
196   - },
197   - {
198   - xtype: 'displayfield',
199   - itemId: 'user_displayfield',
200   - fieldLabel: 'User',
201   - anchor: '100%',
202   - name: 'user',
203   - value: this.getUser()
204   - },
205   - {
206   - xtype: 'displayfield',
207   - itemId: 'browser_displayfield',
208   - fieldLabel: 'Browser',
209   - anchor: '100%',
210   - name: 'browser',
211   - value: this.getBrowserInfo()
212   - },
213   - {
214   - xtype: 'filefield',
215   - itemId: 'attach_filefield',
216   - anchor: '100%',
217   - name: 'attachment',
218   - fieldLabel: 'Attachment',
219   - buttonText: 'Select File...',
220   - emptyText : 'none'
221   - },
222   - {
223   - xtype: 'combo',
224   - itemId: 'interface_combo',
225   - fieldLabel: 'Interface',
226   - name: 'interface',
227   - store: this.getInterfaceList(),
228   - value: 'General',
229   - forceSelection: true,
230   - anchor: '100%',
231   - autoSelect: true,
232   - allowBlanck: false
233   - },
234   - {
235   - xtype : 'textareafield',
236   - itemId: 'desc_textarea',
237   - anchor: '100%',
238   - height : 200,
239   - name: 'description',
240   - fieldLabel: 'Description',
241   - allowBlank: false
242   - },
243   - {
244   - xtype : 'hiddenfield',
245   - name: 'MAX_FILE_SIZE',
246   - value: '3000000' // 3MB
247   - }
248   - ]
249   - }],
250   - dockedItems: [{
251   - xtype: 'toolbar',
252   - dock: 'bottom',
253   - items: [
254   - '->',
255   - {
256   - iconCls: 'icon-feedback',
257   - text: 'Send',
258   - scope: this,
259   - tooltip: 'Send feeback',
260   - handler: this.onSendIssue
261   - }]
262   -
263   - }
264   -
265   - ]
266   - }
267   - Ext.apply (this , Ext.apply (arguments, myConf));
268   - }
  159 +
  160 + init : function(config)
  161 + {
  162 + var myConf = {
  163 + layout: 'fit',
  164 + bodyStyle: { background: '#ddecfe'},
  165 + items : [{
  166 + xtype: 'fieldset',
  167 + itemId: 'feedback_fieldset',
  168 + layout: 'anchor',
  169 + anchor: '100%',
  170 + items : [
  171 + {
  172 + xtype: 'displayfield',
  173 + itemId: 'info_displayfield',
  174 + name: 'information',
  175 + height : 80,
  176 + fieldLabel: '',
  177 + anchor: '100%',
  178 + value: this.getInfoMsg()
  179 + },
  180 + {
  181 + xtype: 'checkboxgroup',
  182 + itemId: 'subject_checkboxgroup',
  183 + fieldLabel: 'Subject',
  184 + anchor: '100%',
  185 + columns : 3,
  186 + vertical: true,
  187 + allowBlank: false,
  188 + items: [
  189 + {boxLabel: 'Bug', inputValue: 'bug', checked: true},
  190 + {boxLabel: 'Question', inputValue: 'question'},
  191 + {boxLabel: 'Data', inputValue: 'data'},
  192 + {boxLabel: 'Comment', inputValue: 'comment'},
  193 + {boxLabel: 'Other', inputValue: 'other'}
  194 + ]
  195 + },
  196 + {
  197 + xtype: 'displayfield',
  198 + itemId: 'user_displayfield',
  199 + fieldLabel: 'User',
  200 + anchor: '100%',
  201 + name: 'user',
  202 + value: this.getUser()
  203 + },
  204 + {
  205 + xtype: 'displayfield',
  206 + itemId: 'browser_displayfield',
  207 + fieldLabel: 'Browser',
  208 + anchor: '100%',
  209 + name: 'browser',
  210 + value: this.getBrowserInfo()
  211 + },
  212 + {
  213 + xtype: 'filefield',
  214 + itemId: 'attach_filefield',
  215 + anchor: '100%',
  216 + name: 'attachment',
  217 + fieldLabel: 'Attachment',
  218 + buttonText: 'Select File...',
  219 + emptyText : 'none'
  220 + },
  221 + {
  222 + xtype: 'combo',
  223 + itemId: 'interface_combo',
  224 + fieldLabel: 'Interface',
  225 + name: 'interface',
  226 + store: this.getInterfaceList(),
  227 + value: 'General',
  228 + forceSelection: true,
  229 + anchor: '100%',
  230 + autoSelect: true,
  231 + allowBlanck: false
  232 + },
  233 + {
  234 + xtype : 'textareafield',
  235 + itemId: 'desc_textarea',
  236 + anchor: '100%',
  237 + height : 200,
  238 + name: 'description',
  239 + fieldLabel: 'Description',
  240 + allowBlank: false
  241 + },
  242 + {
  243 + xtype : 'hiddenfield',
  244 + name: 'MAX_FILE_SIZE',
  245 + value: '3000000' // 3MB
  246 + }
  247 + ]
  248 + }],
  249 + dockedItems: [{
  250 + xtype: 'toolbar',
  251 + dock: 'bottom',
  252 + items: [
  253 + '->',
  254 + {
  255 + iconCls: 'icon-feedback',
  256 + text: 'Send',
  257 + scope: this,
  258 + tooltip: 'Send feeback',
  259 + handler: this.onSendIssue
  260 + }
  261 + ]
  262 + }]
  263 + }
  264 + Ext.apply (this , Ext.apply (arguments, myConf));
  265 + }
269 266 });
270 267 \ No newline at end of file
... ...
php/classes/FeedbackMgr.php
... ... @@ -9,7 +9,8 @@
9 9 {
10 10 protected $feedXml, $feedXmlName;
11 11  
12   - protected $emails = 'amda@irap.omp.eu';
  12 + // protected $emails = 'amda@irap.omp.eu';
  13 + protected $emails = 'ebudnik@irap.omp.eu';
13 14  
14 15 function __construct()
15 16 {
... ... @@ -18,81 +19,82 @@
18 19  
19 20 function addFeedback($user, $interface, $subject, $userText, $userAgent, $attach)
20 21 {
21   - if ($user == null)
22   - return 'err_user';
  22 + if ($user == null)
  23 + return 'err_user';
23 24  
24   - //send feedback to emails list
25   - $this->sendEmail($user, $interface, $userText, $attach);
26   -
27   - //load feedback file
28   -
29   - if (!file_exists(FeedbackXml))
30   - return 'err_file';
31   - $this->feedXmlName = FeedbackXml;
32   - $this->feedXml = new DomDocument("1.0","UTF-8");
33   - $this->feedXml->preserveWhiteSpace = false;
34   - $this->feedXml->formatOutput = true;
35   - if (file_exists($this->feedXmlName))
36   - {
37   - $this->feedXml->load($this->feedXmlName);
38   - $rootElement = $this->feedXml->documentElement;
39   - }
40   - else
41   - {
42   - $rootElement = $this->feedXml->createElement("root");
43   - $this->feedXml->appendChild($rootElement);
44   - }
45   -
46   - if (($this->feedXml == null) or ($rootElement == null))
47   - return 'err_file';
  25 + //send feedback to emails list
  26 + $this->sendEmail($user, $interface, $userText, $attach);
  27 +
  28 + if (!is_dir(DATAPATH.'Feedback'))
  29 + mkdir(DATAPATH.'Feedback',755);
  30 +
  31 + //load feedback file
  32 +// if (!file_exists(FeedbackXml))
  33 +// return 'err_file';
  34 + $this->feedXmlName = FeedbackXml;
  35 + $this->feedXml = new DomDocument("1.0","UTF-8");
  36 + $this->feedXml->preserveWhiteSpace = false;
  37 + $this->feedXml->formatOutput = true;
  38 +
  39 + if (file_exists($this->feedXmlName))
  40 + {
  41 + $this->feedXml->load($this->feedXmlName);
  42 + $rootElement = $this->feedXml->documentElement;
  43 + }
  44 + else
  45 + {
  46 + $rootElement = $this->feedXml->createElement("root");
  47 + $this->feedXml->appendChild($rootElement);
  48 + }
  49 +
  50 + if (($this->feedXml == null) or ($rootElement == null))
  51 + return 'err_file';
48 52  
49   - //get feed id - ToDo - to improve
50   - $N = $this->feedXml->getElementsByTagName("issue")->length > 0 ? $this->feedXml->getElementsByTagName("issue")->length : 0;
  53 + //get feed id - ToDo - to improve
  54 + $N = $this->feedXml->getElementsByTagName("issue")->length > 0 ? $this->feedXml->getElementsByTagName("issue")->length : 0;
51 55  
52   - $issue = $this->feedXml->createElement("issue", htmlspecialchars($userText));
53   - $issue->setAttribute("user", $user);
54   - $issue->setAttribute("userAgent", $userAgent);
55   - $issue->setAttribute('interface',$interface);
56   - $issue->setAttribute('IP',getenv('REMOTE_ADDR'));
57   - $issue->setAttribute("date", date("Y-m-d"));
58   - $issue->setAttribute("xml:id", $N);
59   - $issue->setAttribute("subject", $subject);
60   - if (isset($attach) && ($attach != ''))
61   - $issue->setAttribute("attachement",$attach);
  56 + $issue = $this->feedXml->createElement("issue", htmlspecialchars($userText));
  57 + $issue->setAttribute("user", $user);
  58 + $issue->setAttribute("userAgent", $userAgent);
  59 + $issue->setAttribute('interface',$interface);
  60 + $issue->setAttribute('IP',getenv('REMOTE_ADDR'));
  61 + $issue->setAttribute("date", date("Y-m-d"));
  62 + $issue->setAttribute("xml:id", $N);
  63 + $issue->setAttribute("subject", $subject);
  64 + if (isset($attach) && ($attach != ''))
  65 + $issue->setAttribute("attachement",$attach);
62 66  
63   - $rootElement->appendChild($issue);
64   - $this->feedXml->save($this->feedXmlName);
65   -
66   - return 'none';
  67 + $rootElement->appendChild($issue);
  68 + $this->feedXml->save($this->feedXmlName);
  69 +
  70 + return 'none';
67 71 }
68 72  
69   - protected function sendEmail($user, $interface, $userText, $attach)
  73 + protected function sendEmail($user, $interface, $userText, $attach)
70 74 {
71   - $amda = new AmdaClient();
72   - $result = $amda->getUserInfo($user);
  75 + $amda = new AmdaClient();
  76 + $result = $amda->getUserInfo($user);
73 77  
74   - if ($result['success'])
75   - {
76   - $from = $result['email'];
77   - $to = $this->emails.",".$result['email'];
78   - }
79   - else
80   - {
81   - $from = $user;
82   - $to = $this->emails;
83   - }
  78 + if ($result['success'])
  79 + {
  80 + $from = $result['email'];
  81 + $to = $this->emails.",".$result['email'];
  82 + }
  83 + else
  84 + {
  85 + $from = $user;
  86 + $to = $this->emails;
  87 + }
84 88  
85   - $subject = 'AMDA FEEDBACK: '.$interface;
86   - $message = $userText;
87   - if (isset($attach) && ($attach != ''))
88   - $message .= "\r\nAttachment : ".$attach;
89   - $headers = 'From: '.$from."\r\n".
90   - 'Content-type: text/plain; charset=UTF-8';
91   -
92   - mail($to, $subject, $message, $headers);
93   - }
94   -
  89 + $subject = 'AMDA FEEDBACK: '.$interface;
  90 + $message = $userText;
  91 + if (isset($attach) && ($attach != ''))
  92 + $message .= "\r\nAttachment : ".$attach;
  93 + $headers = 'From: '.$from."\r\n".
  94 + 'Content-type: text/plain; charset=UTF-8';
  95 +
  96 + mail($to, $subject, $message, $headers);
  97 + }
95 98 }
96   -
97 99 ?>
98 100  
99 101 \ No newline at end of file
... ...
php/uploadFile.php
... ... @@ -200,6 +200,9 @@
200 200 }
201 201 else if ($_FILES['attachment'])
202 202 {
  203 + if (!is_dir(ATTACHMENTDIR))
  204 + mkdir(ATTACHMENTDIR,755);
  205 +
203 206 $file = $_FILES['attachment'];
204 207 $file['name'] = str_replace(" ","_",$file['name']);
205 208 $file['name'] = $_POST['sessionID'].'_'.date("Y-m-d\TH:i:s").'_'.$file['name'];
... ... @@ -256,7 +259,7 @@
256 259 }
257 260  
258 261 if (!rename($file['tmp_name'], $localName))
259   - {
  262 + {
260 263 $response = array( 'success' => false, 'error' => 'Cannot copy file '.$file['name']);
261 264 unlink($file['tmp_name']);
262 265 die(json_encode($response));
... ...