diff --git a/generic_data/Feedback/Feedback.xml b/generic_data/Feedback/Feedback.xml deleted file mode 100644 index 8185d10..0000000 --- a/generic_data/Feedback/Feedback.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<root> - - <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> - <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. -Je selectionne une date de début 2005/02/16 00:00:00 et durée: 2j - -Je clique sur "Plot" - -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> - -</root> diff --git a/js/app/controllers/FeedbackModule.js b/js/app/controllers/FeedbackModule.js index 3de9d20..73d71b0 100644 --- a/js/app/controllers/FeedbackModule.js +++ b/js/app/controllers/FeedbackModule.js @@ -5,50 +5,44 @@ * @extends amdaDesktop.AmdaModule * @brief Feedback controller * @author Benjamin - * @version $Id: FeedbackModule.js 965 2012-06-28 16:05:30Z benjamin $ - ******************************************************************************** - * FT Id : Date : Name - Description - ******************************************************************************* - * : + * @version $Id: FeedbackModule.js 965 2012-06-28 16:05:30Z benjamin $ */ Ext.define('amdaDesktop.FeedbackModule', { - extend: 'amdaDesktop.AmdaModule', - - requires : [ - 'amdaUI.FeedbackUI' - ], + extend: 'amdaDesktop.AmdaModule', + + requires : [ + 'amdaUI.FeedbackUI' + ], contentId : 'feedUI', createWindow : function(){ - var desktop = this.app.getDesktop(); - var win = desktop.getWindow(this.id); - - if(!win){ - win = desktop.createWindow({ - id: this.id, - title:this.title, - layout: 'anchor', - width:600, - height:550, - modal: true, - iconCls: this.icon, - animCollapse:false, - constrainHeader:true, - bodyPadding : 5, - stateful : true, - stateId : this.id, - stateEvents: ['move','show','resize'], - items : [ - { - xtype: 'panelFeedback' - } - ] - }); - } - win.show(); - return win; + var desktop = this.app.getDesktop(); + var win = desktop.getWindow(this.id); + + if(!win){ + win = desktop.createWindow({ + id: this.id, + title:this.title, + layout: 'fit', + width: 600, + height: 550, + modal: true, + iconCls: this.icon, + animCollapse:false, + constrainHeader:true, + bodyPadding : 5, + stateful : true, + stateId : this.id, + stateEvents: ['move','show','resize'], + items : [{ + xtype: 'panelFeedback' + }] + }); + } + win.show(); + return win; } }); \ No newline at end of file diff --git a/js/app/views/FeedbackUI.js b/js/app/views/FeedbackUI.js index 4ec6309..b979234 100644 --- a/js/app/views/FeedbackUI.js +++ b/js/app/views/FeedbackUI.js @@ -5,265 +5,262 @@ * @extends Ext.panel.Panel * @brief Feedback view * @author Benjamin - * @version $Id: FeedbackUI.js 2031 2014-01-22 11:28:34Z elena $ - ******************************************************************************** - * FT Id : Date : Name - Description - ******************************************************************************* - * : + * @version $Id: FeedbackUI.js 2031 2014-01-22 11:28:34Z elena $ */ Ext.define('amdaUI.FeedbackUI', { - extend: 'Ext.form.Panel', - alias: 'widget.panelFeedback', - - constructor: function(config) { + extend: 'Ext.form.Panel', + alias: 'widget.panelFeedback', + + constructor: function(config) { this.init(config); this.callParent(arguments); }, - getInfoMsg : function() - { - return '<h2>Welcome,</h2>' + - 'You have problems/comments</br>'+ - 'Please select an item[s] from a list below and describe the problem...</br></br>'; - }, + getInfoMsg : function() + { + return '<h3>Welcome,</h3>' + + 'You have problems/comments</br>'+ + 'Please select an item[s] from a list below and describe the problem...'; + }, - getBrowserInfo : function() - { - return Ext.browser.name+' - '+Ext.browser.engineName+' - '+Ext.browser.engineVersion; - }, - - getUser : function() - { - return sessionID; - }, + getBrowserInfo : function() + { + return Ext.browser.name+' - '+Ext.browser.engineName+' - '+Ext.browser.engineVersion; + }, - getInterfaceList : function() - { - return [ - ['General','General'], - ['Plot_Data','Plot Data'], - ['Data_mining','Data mining'], - ['My_Parameters','Parameters'], - ['My_Time_Tables','Time Tables'], - ['Download_Data','Download Data'], - ['Upload_Data','Upload Data'], - ['Interoperability','Interoperability'], - ['Add_External_Data','External Data'] - ]; - }, + getUser : function() + { + return sessionID; + }, - onSendFinish : function(result, e){ - var t = e.getTransaction(); + getInterfaceList : function() + { + return [ + ['General','General'], + ['Plot_Data','Plot Data'], + ['Data_mining','Data mining'], + ['My_Parameters','Parameters'], + ['My_Time_Tables','Time Tables'], + ['My_Catalogs','Catalogs'], + ['Statistics', 'Statistics'], + ['Download_Data','Download Data'], + ['Upload_Data','Upload Data'], + ['Interoperability','Interoperability'], + ['Add_External_Data','External Data'] + ]; + }, + + onSendFinish : function(result, e){ + var t = e.getTransaction(); if (e.status) { - if (result && result == 'none') - { - // SUCCESS - var win = myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.feedback.id); - Ext.MessageBox.show({ - title: 'Feedback sended', - msg: 'Thanks for your feedback', - buttons: Ext.MessageBox.OK, - icon: Ext.MessageBox.INFO, - fn: function (btn){ - win.close(); - } - }); - } - else - { - //ERROR - var msgErr = 'Unknown error'; - switch (result) - { - case 'err_user' : - msgErr = 'User not defined'; - break; - case 'err_file' : - msgErr = 'Feedback file error'; - break; - } - Ext.Msg.show({title:'Error', msg: msgErr, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); - } + if (result && result == 'none') + { + // SUCCESS + var win = myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.feedback.id); + Ext.MessageBox.show({ + title: 'Feedback sent', + msg: 'Thanks for your feedback', + buttons: Ext.MessageBox.OK, + icon: Ext.MessageBox.INFO, + fn: function (btn){ + win.close(); + } + }); + } + else + { + //ERROR + var msgErr = 'Unknown error'; + switch (result) + { + case 'err_user' : + msgErr = 'User not defined'; + break; + case 'err_file' : + msgErr = 'Feedback file error'; + break; + } + Ext.Msg.show({title:'Error', msg: msgErr, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); + } } else { - // FAILURE - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); + // FAILURE + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); } - }, + }, - onSendIssue : function(b,e){ - //get links to components - var fieldset = this.getComponent('feedback_fieldset'); - var fieldsubject = fieldset.getComponent('subject_checkboxgroup'); - var fielduser = fieldset.getComponent('user_displayfield'); - var fieldbrowser = fieldset.getComponent('browser_displayfield'); - var fieldattach = fieldset.getComponent('attach_filefield'); - var fieldinterface = fieldset.getComponent('interface_combo'); - var fielddes = fieldset.getComponent('desc_textarea'); + onSendIssue : function(b,e){ + //get links to components + var fieldset = this.getComponent('feedback_fieldset'); + var fieldsubject = fieldset.getComponent('subject_checkboxgroup'); + var fielduser = fieldset.getComponent('user_displayfield'); + var fieldbrowser = fieldset.getComponent('browser_displayfield'); + var fieldattach = fieldset.getComponent('attach_filefield'); + var fieldinterface = fieldset.getComponent('interface_combo'); + var fielddes = fieldset.getComponent('desc_textarea'); - //test if some fields are valid - if (!fieldsubject.isValid() || !fielddes.isValid()) - { - Ext.Msg.show({title:'Error', msg: 'Some field are required', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); - return; - } + //test if some fields are valid + if (!fieldsubject.isValid() || !fielddes.isValid()) + { + Ext.Msg.show({title:'Error', msg: 'Some field are required', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); + return; + } - //generate subject message (a list of all checked boxes) - var subjectMsg = ''; - fieldsubject.items.each(function (item){ - if (!item.checked) - return; - if (subjectMsg != '') - subjectMsg += ' - '; - subjectMsg += item.boxLabel; - },this); + //generate subject message (a list of all checked boxes) + var subjectMsg = ''; + fieldsubject.items.each(function (item){ + if (!item.checked) + return; + if (subjectMsg != '') + subjectMsg += ' - '; + subjectMsg += item.boxLabel; + },this); - //make the object to send - var feed = {user : fielduser.getValue(), - interface : fieldinterface.getValue(), - subject : subjectMsg, - userText : fielddes.getValue(), - userAgent : fieldbrowser.getValue(), - attach : fieldattach.getValue()}; - - if (feed.attach != '') - { - this.submit({ - scope : this, - url: 'php/uploadFile.php', - waitMsg: 'Uploading your file...', - success: function(form, o) - { - feed.attach = o.result.file; - //call action - AmdaAction.sendFeedback(feed,this.onSendFinish,this); - }, - failure: function(form, o) - { - Ext.Msg.show( { - title : 'Feedback - Upload attachment', - msg : 'Error '+o.result.error, - modal : true, - icon : Ext.Msg.ERROR, - buttons : Ext.Msg.OK - }); + //make the object to send + var feed = {user : fielduser.getValue(), + interface : fieldinterface.getValue(), + subject : subjectMsg, + userText : fielddes.getValue(), + userAgent : fieldbrowser.getValue(), + attach : fieldattach.getValue()}; + + if (feed.attach != '') + { + this.submit({ + scope : this, + url: 'php/uploadFile.php', + waitMsg: 'Uploading your file...', + success: function(form, o) + { + feed.attach = o.result.file; + //call action + AmdaAction.sendFeedback(feed,this.onSendFinish,this); + }, + failure: function(form, o) + { + Ext.Msg.show( { + title : 'Feedback - Upload attachment', + msg : 'Error '+o.result.error, + modal : true, + icon : Ext.Msg.ERROR, + buttons : Ext.Msg.OK + }); } - }); - } - else - //call action - AmdaAction.sendFeedback(feed,this.onSendFinish,this); - }, + }); + } + else + //call action + AmdaAction.sendFeedback(feed,this.onSendFinish,this); + }, - init : function(config) - { - var myConf = { - layout: 'fit', - bodyStyle: { background: '#ddecfe'}, - items : [ - { - xtype: 'fieldset', - itemId: 'feedback_fieldset', - layout: 'anchor', - anchor: '100%', - items : [ - { - xtype: 'displayfield', - itemId: 'info_displayfield', - name: 'information', - fieldLabel: '', - anchor: '100%', - value: this.getInfoMsg() - }, - { - xtype: 'checkboxgroup', - itemId: 'subject_checkboxgroup', - fieldLabel: 'Subject', - anchor: '100%', - columns : 3, - vertical: true, - allowBlank: false, - items: [ - {boxLabel: 'Bug', inputValue: 'bug', checked: true}, - {boxLabel: 'Question', inputValue: 'question'}, - {boxLabel: 'Data', inputValue: 'data'}, - {boxLabel: 'Comment', inputValue: 'comment'}, - {boxLabel: 'Other', inputValue: 'other'} - ] - }, - { - xtype: 'displayfield', - itemId: 'user_displayfield', - fieldLabel: 'User', - anchor: '100%', - name: 'user', - value: this.getUser() - }, - { - xtype: 'displayfield', - itemId: 'browser_displayfield', - fieldLabel: 'Browser', - anchor: '100%', - name: 'browser', - value: this.getBrowserInfo() - }, - { - xtype: 'filefield', - itemId: 'attach_filefield', - anchor: '100%', - name: 'attachment', - fieldLabel: 'Attachment', - buttonText: 'Select File...', - emptyText : 'none' - }, - { - xtype: 'combo', - itemId: 'interface_combo', - fieldLabel: 'Interface', - name: 'interface', - store: this.getInterfaceList(), - value: 'General', - forceSelection: true, - anchor: '100%', - autoSelect: true, - allowBlanck: false - }, - { - xtype : 'textareafield', - itemId: 'desc_textarea', - anchor: '100%', - height : 200, - name: 'description', - fieldLabel: 'Description', - allowBlank: false - }, - { - xtype : 'hiddenfield', - name: 'MAX_FILE_SIZE', - value: '3000000' // 3MB - } - ] - }], - dockedItems: [{ - xtype: 'toolbar', - dock: 'bottom', - items: [ - '->', - { - iconCls: 'icon-feedback', - text: 'Send', - scope: this, - tooltip: 'Send feeback', - handler: this.onSendIssue - }] - - } - - ] - } - Ext.apply (this , Ext.apply (arguments, myConf)); - } + + init : function(config) + { + var myConf = { + layout: 'fit', + bodyStyle: { background: '#ddecfe'}, + items : [{ + xtype: 'fieldset', + itemId: 'feedback_fieldset', + layout: 'anchor', + anchor: '100%', + items : [ + { + xtype: 'displayfield', + itemId: 'info_displayfield', + name: 'information', + height : 80, + fieldLabel: '', + anchor: '100%', + value: this.getInfoMsg() + }, + { + xtype: 'checkboxgroup', + itemId: 'subject_checkboxgroup', + fieldLabel: 'Subject', + anchor: '100%', + columns : 3, + vertical: true, + allowBlank: false, + items: [ + {boxLabel: 'Bug', inputValue: 'bug', checked: true}, + {boxLabel: 'Question', inputValue: 'question'}, + {boxLabel: 'Data', inputValue: 'data'}, + {boxLabel: 'Comment', inputValue: 'comment'}, + {boxLabel: 'Other', inputValue: 'other'} + ] + }, + { + xtype: 'displayfield', + itemId: 'user_displayfield', + fieldLabel: 'User', + anchor: '100%', + name: 'user', + value: this.getUser() + }, + { + xtype: 'displayfield', + itemId: 'browser_displayfield', + fieldLabel: 'Browser', + anchor: '100%', + name: 'browser', + value: this.getBrowserInfo() + }, + { + xtype: 'filefield', + itemId: 'attach_filefield', + anchor: '100%', + name: 'attachment', + fieldLabel: 'Attachment', + buttonText: 'Select File...', + emptyText : 'none' + }, + { + xtype: 'combo', + itemId: 'interface_combo', + fieldLabel: 'Interface', + name: 'interface', + store: this.getInterfaceList(), + value: 'General', + forceSelection: true, + anchor: '100%', + autoSelect: true, + allowBlanck: false + }, + { + xtype : 'textareafield', + itemId: 'desc_textarea', + anchor: '100%', + height : 200, + name: 'description', + fieldLabel: 'Description', + allowBlank: false + }, + { + xtype : 'hiddenfield', + name: 'MAX_FILE_SIZE', + value: '3000000' // 3MB + } + ] + }], + dockedItems: [{ + xtype: 'toolbar', + dock: 'bottom', + items: [ + '->', + { + iconCls: 'icon-feedback', + text: 'Send', + scope: this, + tooltip: 'Send feeback', + handler: this.onSendIssue + } + ] + }] + } + Ext.apply (this , Ext.apply (arguments, myConf)); + } }); \ No newline at end of file diff --git a/php/classes/FeedbackMgr.php b/php/classes/FeedbackMgr.php index 91b321e..29be206 100644 --- a/php/classes/FeedbackMgr.php +++ b/php/classes/FeedbackMgr.php @@ -9,7 +9,8 @@ { protected $feedXml, $feedXmlName; - protected $emails = 'amda@irap.omp.eu'; + // protected $emails = 'amda@irap.omp.eu'; + protected $emails = 'ebudnik@irap.omp.eu'; function __construct() { @@ -18,81 +19,82 @@ function addFeedback($user, $interface, $subject, $userText, $userAgent, $attach) { - if ($user == null) - return 'err_user'; + if ($user == null) + return 'err_user'; - //send feedback to emails list - $this->sendEmail($user, $interface, $userText, $attach); - - //load feedback file - - if (!file_exists(FeedbackXml)) - return 'err_file'; - $this->feedXmlName = FeedbackXml; - $this->feedXml = new DomDocument("1.0","UTF-8"); - $this->feedXml->preserveWhiteSpace = false; - $this->feedXml->formatOutput = true; - if (file_exists($this->feedXmlName)) - { - $this->feedXml->load($this->feedXmlName); - $rootElement = $this->feedXml->documentElement; - } - else - { - $rootElement = $this->feedXml->createElement("root"); - $this->feedXml->appendChild($rootElement); - } - - if (($this->feedXml == null) or ($rootElement == null)) - return 'err_file'; + //send feedback to emails list + $this->sendEmail($user, $interface, $userText, $attach); + + if (!is_dir(DATAPATH.'Feedback')) + mkdir(DATAPATH.'Feedback',755); + + //load feedback file +// if (!file_exists(FeedbackXml)) +// return 'err_file'; + $this->feedXmlName = FeedbackXml; + $this->feedXml = new DomDocument("1.0","UTF-8"); + $this->feedXml->preserveWhiteSpace = false; + $this->feedXml->formatOutput = true; + + if (file_exists($this->feedXmlName)) + { + $this->feedXml->load($this->feedXmlName); + $rootElement = $this->feedXml->documentElement; + } + else + { + $rootElement = $this->feedXml->createElement("root"); + $this->feedXml->appendChild($rootElement); + } + + if (($this->feedXml == null) or ($rootElement == null)) + return 'err_file'; - //get feed id - ToDo - to improve - $N = $this->feedXml->getElementsByTagName("issue")->length > 0 ? $this->feedXml->getElementsByTagName("issue")->length : 0; + //get feed id - ToDo - to improve + $N = $this->feedXml->getElementsByTagName("issue")->length > 0 ? $this->feedXml->getElementsByTagName("issue")->length : 0; - $issue = $this->feedXml->createElement("issue", htmlspecialchars($userText)); - $issue->setAttribute("user", $user); - $issue->setAttribute("userAgent", $userAgent); - $issue->setAttribute('interface',$interface); - $issue->setAttribute('IP',getenv('REMOTE_ADDR')); - $issue->setAttribute("date", date("Y-m-d")); - $issue->setAttribute("xml:id", $N); - $issue->setAttribute("subject", $subject); - if (isset($attach) && ($attach != '')) - $issue->setAttribute("attachement",$attach); + $issue = $this->feedXml->createElement("issue", htmlspecialchars($userText)); + $issue->setAttribute("user", $user); + $issue->setAttribute("userAgent", $userAgent); + $issue->setAttribute('interface',$interface); + $issue->setAttribute('IP',getenv('REMOTE_ADDR')); + $issue->setAttribute("date", date("Y-m-d")); + $issue->setAttribute("xml:id", $N); + $issue->setAttribute("subject", $subject); + if (isset($attach) && ($attach != '')) + $issue->setAttribute("attachement",$attach); - $rootElement->appendChild($issue); - $this->feedXml->save($this->feedXmlName); - - return 'none'; + $rootElement->appendChild($issue); + $this->feedXml->save($this->feedXmlName); + + return 'none'; } - protected function sendEmail($user, $interface, $userText, $attach) + protected function sendEmail($user, $interface, $userText, $attach) { - $amda = new AmdaClient(); - $result = $amda->getUserInfo($user); + $amda = new AmdaClient(); + $result = $amda->getUserInfo($user); - if ($result['success']) - { - $from = $result['email']; - $to = $this->emails.",".$result['email']; - } - else - { - $from = $user; - $to = $this->emails; - } + if ($result['success']) + { + $from = $result['email']; + $to = $this->emails.",".$result['email']; + } + else + { + $from = $user; + $to = $this->emails; + } - $subject = 'AMDA FEEDBACK: '.$interface; - $message = $userText; - if (isset($attach) && ($attach != '')) - $message .= "\r\nAttachment : ".$attach; - $headers = 'From: '.$from."\r\n". - 'Content-type: text/plain; charset=UTF-8'; - - mail($to, $subject, $message, $headers); - } - + $subject = 'AMDA FEEDBACK: '.$interface; + $message = $userText; + if (isset($attach) && ($attach != '')) + $message .= "\r\nAttachment : ".$attach; + $headers = 'From: '.$from."\r\n". + 'Content-type: text/plain; charset=UTF-8'; + + mail($to, $subject, $message, $headers); + } } - ?> \ No newline at end of file diff --git a/php/uploadFile.php b/php/uploadFile.php index 3f316a6..452a915 100644 --- a/php/uploadFile.php +++ b/php/uploadFile.php @@ -200,6 +200,9 @@ } else if ($_FILES['attachment']) { + if (!is_dir(ATTACHMENTDIR)) + mkdir(ATTACHMENTDIR,755); + $file = $_FILES['attachment']; $file['name'] = str_replace(" ","_",$file['name']); $file['name'] = $_POST['sessionID'].'_'.date("Y-m-d\TH:i:s").'_'.$file['name']; @@ -256,7 +259,7 @@ } if (!rename($file['tmp_name'], $localName)) - { + { $response = array( 'success' => false, 'error' => 'Cannot copy file '.$file['name']); unlink($file['tmp_name']); die(json_encode($response)); -- libgit2 0.21.2