signaler un bug envoie un mail au support au lieu de creer un bug flyspray
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 30 Nov 2006 23:53:30 +0000 (23:53 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 30 Nov 2006 23:53:30 +0000 (23:53 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1216 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
classes/pltableeditor.php
htdocs/javascript/flyspray.js [deleted file]
modules/events.php
templates/bug.tpl [new file with mode: 0644]
templates/skin/common.bug.tpl [deleted file]
templates/skin/common.menu.tpl

index 920450c..75417f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,24 +3,28 @@ VERSION 0.9.13                                                        ?? ?? 2007
 
 New:
 
+    * Events:
+        - Tips.                                                         -FRU/Car
+        - Signal bug send to OTRS and not trackers.                        -Car
+
     * Payment:
-        - Directly integrated into Xnet                                    -FRU
+        - Directly integrated into Xnet.                                   -FRU
 
 Bug/Wish:
 
     * Register:
-        - #277: Improve ergonomy                                           -FRU
+        - #277: Improve ergonomy.                                          -FRU
 
     * Xnet:
-        - #570: Fix geoloc skin                                            -FRU
+        - #570: Fix geoloc skin.                                           -FRU
 
 From 0.9.12 branch:
 
     * Search:
-        - #566: Fix accent detection                                       -FRU
+        - #566: Fix accent detection.                                      -FRU
 
     * Xnet:
-        - #574: Fix subscription link customization                        -FRU
+        - #574: Fix subscription link customization.                       -FRU
 
 ================================================================================
 VERSION 0.9.12                                                        25 11 2006
index c849f37..3fe9dce 100644 (file)
@@ -75,7 +75,12 @@ class PLTableEditor {
             elseif (substr($a['Type'],0,4) == 'set(') {
                 // get the list of options
                 $a['List'] = explode('§',str_replace("','","§",substr($a['Type'], 5, strlen($a['Type']) - 7)));
-                $a['Type'] = 'set';
+                if (count($a['List']) == 1) {
+                    $a['Type'] = 'checkbox';
+                    $a['Value'] = $a['List'][0];
+                } else {
+                    $a['Type'] = 'set';
+                } 
             }
             elseif (substr($a['Type'],0,5) == 'enum(') {
                 // get the list of options
@@ -196,6 +201,8 @@ class PLTableEditor {
                         $val .= $option;
                     }
                     $val = "'".addslashes($val)."'";
+                } elseif ($descr['Type'] == 'checkbox') {
+                    $val = Post::has($field)?"'".addslashes($descr['Value'])."'":"''";
                 } elseif (Post::has($field)) {
                     $val = Post::v($field);
                     if ($descr['Type'] == 'timestamp') {
diff --git a/htdocs/javascript/flyspray.js b/htdocs/javascript/flyspray.js
deleted file mode 100644 (file)
index 3cd41d1..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/***************************************************************************\r
- *  Copyright (C) 2003-2006 Polytechnique.org                              *\r
- *  http://opensource.polytechnique.org/                                   *\r
- *                                                                         *\r
- *  This program is free software; you can redistribute it and/or modify   *\r
- *  it under the terms of the GNU General Public License as published by   *\r
- *  the Free Software Foundation; either version 2 of the License, or      *\r
- *  (at your option) any later version.                                    *\r
- *                                                                         *\r
- *  This program is distributed in the hope that it will be useful,        *\r
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *\r
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *\r
- *  GNU General Public License for more details.                           *\r
- *                                                                         *\r
- *  You should have received a copy of the GNU General Public License      *\r
- *  along with this program; if not, write to the Free Software            *\r
- *  Foundation, Inc.,                                                      *\r
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *\r
- ***************************************************************************/\r
-\r
-function send_bug() {\r
-        var h = windowHeight();\r
-        var y = getScrollY();\r
-        y += (h - 470) /2;\r
-       document.getElementById('flyspray_report').style.display = 'block';\r
-        document.getElementById('flyspray_report').style.top = y+'px';\r
-       return false;\r
-}\r
-\r
-function getScrollY() {\r
-    var scrOfX = 0, scrOfY = 0;\r
-    if( typeof( window.pageYOffset ) == 'number' ) {\r
-        //Netscape compliant\r
-        scrOfY = window.pageYOffset;\r
-    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {\r
-        //DOM compliant\r
-        scrOfY = document.body.scrollTop;\r
-    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {\r
-        //IE6 standards compliant mode\r
-        scrOfY = document.documentElement.scrollTop;\r
-    }\r
-    return scrOfY;\r
-}\r
-function windowHeight() {\r
-    if( typeof( window.innerWidth ) == 'number' ) {\r
-        //Non-IE\r
-        return window.innerHeight;\r
-    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {\r
-        return document.documentElement.clientHeight;\r
-    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {\r
-        //IE 4 compatible\r
-        return document.body.clientHeight;\r
-    }\r
-    return 0;\r
-}\r
-\r
-function close_bug(f,send) {\r
-       var detail = document.getElementById('flyspray_detail');\r
-       detail.value = utf8(detail.value);\r
-       var title = document.getElementById('flyspray_title');\r
-       title.value = utf8(title.value);\r
-       if (send) {\r
-               f.target = '_blank';\r
-               f.submit();\r
-       }\r
-       f.reset();\r
-       document.getElementById('flyspray_report').style.display = 'none';\r
-}\r
-\r
-function utf8(isotext)\r
-{\r
-       var utf8text = "";\r
-       for ( i=0; i<isotext.length; i++ )\r
-       {\r
-               unicodchar = isotext.charCodeAt(i);\r
-               \r
-               if(unicodchar < 128){\r
-                       utf8text += String.fromCharCode(unicodchar);\r
-               } else if(unicodchar < 0x800) {\r
-                       var val1 = 0xC0 + (unicodchar & 0x7C0) / 0x40;          // 0011111000000\r
-                       var val2 = 0x80 + (unicodchar & 0x3F);                          // 0000000111111\r
-                       utf8text += String.fromCharCode(val1,val2);\r
-               } else if(unicodchar < 0x10000) {\r
-                       var val1 = 0xE0 + (unicodchar & 0xF000) / 0x1000;       // 001111000000000000\r
-                       var val2 = 0x80 + (unicodchar &  0xFC0) / 0x40;         // 000000111111000000\r
-                       var val3 = 0x80 + (unicodchar &   0x3F);                        // 000000000000111111\r
-                       utf8text += String.fromCharCode(val1,val2, val3);\r
-               } else if(unicodchar < 0x200000){\r
-                       var val4 = 0x80 + (unicodchar & 0x1C0000) / 0x40000;// 00111000000000000000000\r
-                       var val2 = 0x80 + (unicodchar &  0x3F000) / 0x1000;     // 00000111111000000000000\r
-                       var val3 = 0x80 + (unicodchar &    0xFC0) / 0x40;       // 00000000000111111000000\r
-                       var val4 = 0x80 + (unicodchar &     0x3F);                      // 00000000000000000111111\r
-                       utf8text += String.fromCharCode(val1,val2, val3, val4);\r
-        }\r
-       }\r
-       return utf8text;\r
-}\r
index c4933f7..4e25980 100644 (file)
@@ -73,8 +73,19 @@ class EventsModule extends PLModule
 
     function handler_bug(&$page)
     {
-        $this->handler_ev($page);
-        $page->assign('bug', 1);
+        $page->changeTpl('bug.tpl',SIMPLE);
+        $page->addJsLink('close_on_esc.js');
+        if (Env::has('send')) {
+            $page->assign('bug_sent',1);
+            
+            require_once "diogenes/diogenes.hermes.inc.php";
+            $mymail = new HermesMailer();
+            $mymail->setFrom('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@polytechnique.org>');
+            $mymail->addTo('support+platal@polytechnique.org');
+            $mymail->setSubject('Plat/al '.Env::v('task_type').' : '.Env::v('item_summary'));
+            $mymail->setTxtBody(Env::v('detailed_desc'));
+            $mymail->send();
+        }
     }
 
     function handler_ev(&$page, $action = 'list', $eid = null, $pound = null)
diff --git a/templates/bug.tpl b/templates/bug.tpl
new file mode 100644 (file)
index 0000000..49c1049
--- /dev/null
@@ -0,0 +1,28 @@
+<div style="width:800px;height:600px">\r
+{if $bug_sent}\r
+<script type="text/javascript">window.close();</script>\r
+{/if}\r
+<form action="send_bug" method="post">\r
+       <h1>Signaler un bug ou demander une amélioration</h1>\r
+       <div style="margin-left:10%;margin-right:10%">\r
+          <select name="task_type">\r
+           <option value="bug">Bug</option>\r
+            <option value="wish">Wish</option>\r
+          </select>\r
+          &nbsp;&nbsp;Sujet : <input type="text" name="item_summary" id="flyspray_title" value="sur la page {$smarty.server.HTTP_REFERER}" size="50" maxlength="100"/>\r
+          <textarea name="detailed_desc" id="flyspray_detail" cols="70" rows="10" style="width:100%;margin-top:10px;margin-bottom:10px;height:400px;display:block;">\r
+\r
+** Explique ici le problème ou l'amélioration proposée **\r
+               \r
+Page : {$smarty.server.HTTP_REFERER}\r
+\r
+Navigateur : {$smarty.server.HTTP_USER_AGENT}\r
+Skin : {$smarty.session.skin} \r
+Signalé par {$smarty.session.forlife}</textarea>\r
+          <div style="text-align:center">\r
+              <input type="button" value="Fermer" onclick="window.close()"/>\r
+              <input type="submit" name="send" value="Signaler le bug"/>\r
+          </div>\r
+    </div>\r
+</form>\r
+</div>\r
diff --git a/templates/skin/common.bug.tpl b/templates/skin/common.bug.tpl
deleted file mode 100644 (file)
index 5ef8f3d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<script type="text/javascript" src="javascript/flyspray.js"></script>\r
-\r
-<form action="http://trackers.polytechnique.org/" method="post" enctype="multipart/form-data">\r
-       <h1>Signaler un bug ou demander une amélioration</h1>\r
-       <div style="margin-left:10%;margin-right:10%">\r
-               <input type="hidden" name="do" value="modify"/>\r
-               <input type="hidden" name="action" value="newtask"/>\r
-               <input type="hidden" name="project_id" value="1"/>\r
-               <select name="task_type">\r
-           <option value="1">Bug</option>\r
-                       <option value="2">Wish</option>\r
-               </select>\r
-               &nbsp;&nbsp;Sujet : <input type="text" name="item_summary" id="flyspray_title" value="sur la page {if $bug}{$smarty.server.HTTP_REFERER}{else}{$smarty.server.REQUEST_URI}{/if}" size="50" maxlength="100"/>\r
-               <input type="hidden" name="productcategory" value="1"/><!-- non trié -->\r
-               <input type="hidden" name="itemstatus" value="2"/><!-- New -->\r
-               <input type="hidden" name="assigned_to" value="0"/><!-- No one -->\r
-               <input type="hidden" name="operating_system" value="1"/><!-- All -->\r
-               <input type="hidden" name="task_severity" value="2"/><!-- Low -->\r
-               <input type="hidden" name="task_priority" value="2"/><!-- Normal -->\r
-               <input type="hidden" name="productversion" value=""/><!-- ??? -->\r
-               <input type="hidden" name="closedbyversion" value=""/><!-- Undecided -->\r
-               <input type="hidden" name="due_date" value=""/>\r
-               <textarea name="detailed_desc" id="flyspray_detail" cols="70" rows="10" style="width:100%;margin-bottom:10px;height:300px;display:block;">\r
-\r
-** Explique ici le problème ou l'amélioration proposée **\r
-               \r
-Page : {if $bug}{$smarty.server.HTTP_REFERER}{else}{$globals->baseurl}/?{$smarty.server.QUERY_STRING}{/if}\r
-\r
-Navigateur : {$smarty.server.HTTP_USER_AGENT}\r
-Skin : {$smarty.session.skin} \r
-Signalé par {$smarty.session.forlife}</textarea>\r
-               <div style="text-align:center">\r
-                       <input type="button" value="Fermer" onclick="close_bug(this.form,false)"/>\r
-                       <input type="button" value="Signaler le bug" onclick="close_bug(this.form,true)"/>\r
-               </div>\r
-       </div>\r
-</form>\r
index c610d21..bc1f2ea 100644 (file)
@@ -70,7 +70,7 @@
 <div class="menu_item"><a href="Xorg/">Documentations</a></div>
 <div class="menu_item"><a href="Xorg/NousContacter">Nous contacter</a></div>
 <div class="menu_item"><a href="Docs/Emploi">Carrières</a></div>
-<div class="menu_item"><a href="send_bug" onclick="send_bug();return false">Signaler un bug</a></div>
+<div class="menu_item"><a href="send_bug" class="popup2">Signaler un bug</a></div>
 {include file=skin/common.bug.tpl}
 
 {if $smarty.session.perms eq admin}