svn: /pear2/BugManager/trunk/ src/BugManager/Issue.php src/BugManager/JsonRpc.php src/BugManager/JsonRpcException.php www/jsonrpc.php www/pearworm/source/class/pearworm/BugController.js www/pearworm/source/class/pearworm/model/Issue.js www/pearworm/source/class/pearworm/view/IssueEdit.js www/pearworm/source/class/pearworm/view/ReportIssue.js

[email protected] (Greg Beaver) Sat, 11 Sep 2010 06:06:43 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
cellog                                   Sat, 11 Sep 2010 06:06:43 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=303271

Log:
more verbose error message when creating a new bug, so we can see what's wrong.  Begin error-debugging issue creation.  Weird bug in qooxdoo prevents php version dropdown from working, it looks like it is, but it never sets the value

Changed paths:
    U   pear2/BugManager/trunk/src/BugManager/Issue.php
    U   pear2/BugManager/trunk/src/BugManager/JsonRpc.php
    U   pear2/BugManager/trunk/src/BugManager/JsonRpcException.php
    U   pear2/BugManager/trunk/www/jsonrpc.php
    U   pear2/BugManager/trunk/www/pearworm/source/class/pearworm/BugController.js
    U   pear2/BugManager/trunk/www/pearworm/source/class/pearworm/model/Issue.js
    U   pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/IssueEdit.js
    U   pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/ReportIssue.js

Modified: pear2/BugManager/trunk/src/BugManager/Issue.php
===================================================================
--- pear2/BugManager/trunk/src/BugManager/Issue.php	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/src/BugManager/Issue.php	2010-09-11 06:06:43 UTC (rev 303271)
@@ -487,6 +487,8 @@
         if (isset($input['id']) && $input['id']) {
             $this->id = $input['id'];
             $this->retrieve();
+        } else {
+            $this->reporter = \PEAR2\BugManager\Main::site()->defaultActorManager()->loggedinUser();
         }
         $errs = new \PEAR2\MultiErrors;
         if (isset($input['phpversion'])) {

Modified: pear2/BugManager/trunk/src/BugManager/JsonRpc.php
===================================================================
--- pear2/BugManager/trunk/src/BugManager/JsonRpc.php	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/src/BugManager/JsonRpc.php	2010-09-11 06:06:43 UTC (rev 303271)
@@ -139,7 +139,7 @@
                 }
             }
         } catch (\Exception $e) {
-            throw new JsonRpcException(2, $e->getCode(), $e->getMessage());
+            throw new JsonRpcException(2, $e->getCode(), $e->getMessage(), $e);
         }
         $this->encodeResult($result);
     }

Modified: pear2/BugManager/trunk/src/BugManager/JsonRpcException.php
===================================================================
--- pear2/BugManager/trunk/src/BugManager/JsonRpcException.php	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/src/BugManager/JsonRpcException.php	2010-09-11 06:06:43 UTC (rev 303271)
@@ -7,14 +7,14 @@
     const CLASSNOTFOUND = 3;
     const METHODNOTFOUND = 4;
     public $origin;
-    function __construct($origin, $code, $message)
+    function __construct($origin, $code, $message, $previous = null)
     {
-        parent::__construct($message, $code);
+        parent::__construct($message, $code, $previous);
         $this->origin = $origin;
     }

     static function fromException(\Exception $e)
     {
-        return new self(2, $e->getCode(), $e->getMessage());
+        return new self(2, $e->getCode(), $e->getMessage(), $e);
     }
 }

Modified: pear2/BugManager/trunk/www/jsonrpc.php
===================================================================
--- pear2/BugManager/trunk/www/jsonrpc.php	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/www/jsonrpc.php	2010-09-11 06:06:43 UTC (rev 303271)
@@ -12,13 +12,21 @@
 function __handler($exception)
 {
     if ($exception instanceof JsonRpcException) {
+        if ($exception->getPrevious() instanceof PEAR2\BugManager\ValidationException) {
+            $message = $exception->getMessage();
+            foreach ($exception->getPrevious()->getPrevious() as $err) {
+                $message .= "\n" . $err->getMessage();
+            }
+        } else {
+            $message = $exception->getMessage();
+        }
         header('Content-Type: application/json');
         echo json_encode(array(
             'result' => null,
             'error' => array(
                             'origin' => $exception->origin,
                             'code' => $exception->getCode(),
-                            'message' => $exception->getMessage()
+                            'message' => $message
                             ),
             'id' => JsonRpc::$id,
         ));

Modified: pear2/BugManager/trunk/www/pearworm/source/class/pearworm/BugController.js
===================================================================
--- pear2/BugManager/trunk/www/pearworm/source/class/pearworm/BugController.js	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/www/pearworm/source/class/pearworm/BugController.js	2010-09-11 06:06:43 UTC (rev 303271)
@@ -146,6 +146,11 @@
         myview.addListener("chosetab", function() {
           this.fireDataEvent("buglistUpdated", null);
         }, this);
+      } else {
+        myview.addListener("newbug", function(e) {
+          this.removeBug(-1, false, true);
+          this.displayBug(e.getData().id, "bug", e.getData());
+        }, this);
       }
       this._pane.add(myview);
       this._pane.resetSelection();

Modified: pear2/BugManager/trunk/www/pearworm/source/class/pearworm/model/Issue.js
===================================================================
--- pear2/BugManager/trunk/www/pearworm/source/class/pearworm/model/Issue.js	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/www/pearworm/source/class/pearworm/model/Issue.js	2010-09-11 06:06:43 UTC (rev 303271)
@@ -50,10 +50,12 @@
       event : "changeAssigned"
     },
     status : {
-      event: "changeStatus"
+      event: "changeStatus",
+      init: "Open"
     },
     summary : {
-      event: "changeSummary"
+      event: "changeSummary",
+      init: ""
     },
     description : {
       event: "changeDescription"
@@ -69,7 +71,9 @@
       event: "changePackagename"
     },
     packageversion : {
-      event: "changePackageversion"
+      event: "changePackageversion",
+      nullable: true,
+      init: null
     },
     category : {
       event: "changeCategory"
@@ -79,10 +83,12 @@
     },
     os : {
       event: "changeOs",
+      init: null,
       nullable: true
     },
     phpversion : {
-      event: "changePhpversion"
+      event: "changePhpversion",
+      init: ""
     },
     ldesc : {
       event: "changeLdesc",
@@ -210,10 +216,14 @@
         // reporting new issue
         delete data.id;
         delete data.status;
+        delete data.reporter;
         delete data.category;
         delete data.secondarycategories;
         delete data.description;
         delete data.newcomment;
+        delete data.attachments;
+        delete data.createtimestamp;
+        delete data.modifiedtimestamp;
         saver = this.handleSave;
       } else {
         saver = this.handleUpdate;

Modified: pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/IssueEdit.js
===================================================================
--- pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/IssueEdit.js	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/IssueEdit.js	2010-09-11 06:06:43 UTC (rev 303271)
@@ -244,7 +244,7 @@
       form.add(osfield, "Operating System", null, "os");
       form.addButton(submitbutton);

-      submitbutton.addListener("execute", this._issue.save, this);
+      submitbutton.addListener("execute", this._issue.save, this._issue);

       formcontroller.setTarget(form);
       var content = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));

Modified: pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/ReportIssue.js
===================================================================
--- pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/ReportIssue.js	2010-09-11 03:54:35 UTC (rev 303270)
+++ pear2/BugManager/trunk/www/pearworm/source/class/pearworm/view/ReportIssue.js	2010-09-11 06:06:43 UTC (rev 303271)
@@ -233,7 +233,7 @@
       form.add(actualfield, "Actual Result", null, "actres");
       form.addButton(submitbutton);

-      submitbutton.addListener("execute", this._issue.save, this);
+      submitbutton.addListener("execute", this._issue.save, this._issue);

       formcontroller.setTarget(form);
       var renderer = new qx.ui.form.renderer.Single(form);
@@ -255,5 +255,18 @@
     issue.addListener("changeType", function(e) {
       this.setLabel("Report New " + e.getTarget().getFancyType());
     }, this);
+    issue.addListener("newbug", function(e) {
+      this.fireDataEvent("newbug", e.getData());
+    }, this);
+    // for avoiding irrelevant errors
+    issue.setCreatetimestamp("");
+    issue.setModifiedtimestamp("");
+    issue.setReporter("");
+    issue.setCategory("");
+    issue.setSecondarycategories("");
+    issue.setNewcomment("");
+    issue.setDescription("");
+    issue.setAssigned([]); // todo: add 3 assigned dropdowns
+    issue.setAttachments([]);
   }
 });