No subject

=3D?utf-8?q?Alexander_Nicolaysen_S=3DC3=3DB8rnes?=3D alex at thehandofag=
Thu Nov 15 09:34:07 CST 2007


ony.com>
Date: Sat, 22 Dec 2007 00:46:47 +0100
Subject: [PATCH] Allow users to delete their queued bug links

---
 include/bugs.php |   64 +++++++++++++++++++++++++++++++++++----------------=
--
 1 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/include/bugs.php b/include/bugs.php
index e49a7a6..b1d7506 100644
--- a/include/bugs.php
+++ b/include/bugs.php
@@ -286,37 +286,54 @@ class Bug
     /* Get a list of bugs submitted by a given user */
     function listSubmittedBy($iUserId, $bQueued =3D true)
     {
-        $hResult =3D query_parameters("SELECT appFamily.appName, buglinks.v=
ersionId, appVersion.versionName, buglinks.submitTime, buglinks.bug_id FROM =
buglinks, appFamily, appVersion WHERE appFamily.appId =3D appVersion.appId A=
ND buglinks.versionId =3D appVersion.versionId AND buglinks.queued =3D '?' A=
ND buglinks.submitterId =3D '?' ORDER BY buglinks.versionId", $bQueued ? "tr=
ue" : "false", $iUserId);
+        $hResult =3D query_parameters("SELECT appFamily.appName, buglinks.v=
ersionId, appVersion.versionName, buglinks.submitTime, buglinks.bug_id, bugl=
inks.linkId FROM buglinks, appFamily, appVersion WHERE appFamily.appId =3D a=
ppVersion.appId AND buglinks.versionId =3D appVersion.versionId AND buglinks=
.queued =3D '?' AND buglinks.submitterId =3D '?' ORDER BY buglinks.versionId=
", $bQueued ? "true" : "false", $iUserId);
=20
         if(!$hResult || !query_num_rows($hResult))
             return FALSE;
=20
-        $sReturn =3D html_table_begin("width=3D\"100%\" align=3D\"center\""=
);
-        $sReturn .=3D html_tr(array(
-            "Version",
-            array("Bug #", 'width=3D"50"'),
-            array("Status", 'width=3D"80"'),
-            array("Resolution", 'width=3D"110"'),
-            "Description",
-            "Submit time"),
-            "color4");
+        $oTable =3D new Table();
+        $oTable->SetWidth("100%");
+        $oTable->SetAlign("center");
+
+        // setup the table header
+        $oTableRow =3D new TableRow();
+        $oTableRow->AddTextCell('Version');
+        $oTableRow->AddTextCell('Bug #', 'width=3D"50"');
+        $oTableRow->AddTextCell('Status', 'width=3D"80"');
+        $oTableRow->AddTextCell('Resolution', 'width=3D"110"');
+        $oTableRow->AddTextCell('Description', 'Submit time');
+        $oTableRow->AddTextCell('Submit time');
+
+        if($bQueued)
+            $oTableRow->addTextCell('Action');
+
+        $oTableRow->SetClass('color4');
+        $oTable->AddRow($oTableRow);
=20
         for($i =3D 1; $oRow =3D query_fetch_object($hResult); $i++)
         {
-            $oBug =3D new Bug($oRow->bug_id);
-            $sReturn .=3D html_tr(array(
-                version::fullNameLink($oRow->versionId),
-                "<a href=3D\"".BUGZILLA_ROOT."show_bug.cgi?id=3D".$oRow->bu=
g_id."\">".$oRow->bug_id."</a>",
-                $oBug->sBug_status,
-                $oBug->sResolution,
-                $oBug->sShort_desc,
-                print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime=
))),
-                ($i % 2) ? "color0" : "color1");
-        }
+            $oTableRow =3D new TableRow();
=20
-        $sReturn .=3D html_table_end();
+            $oTableRow->AddTextCell(version::fullNameLink($oRow->versionId)=
);
+            $oTableRow->AddTextCell('<a href=3D'.BUGZILLA_ROOT.'show_bug.cg=
i?id=3D'.$oRow->bug_id.'">'.$oRow->bug_id.'</a>');
+            $oTableRow->AddTextCell($oBug->sBug_status);
+            $oTableRow->AddTextCell($oBug->sResolution);
+            $oTableRow->AddTextCell($oBug->sShort_desc);
+            $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimesta=
mp($oRow->submitTime)));
=20
-        return $sReturn;
+            if($bQueued)
+            {
+                $oM =3D new objectManager('bug');
+                $oM->setReturnTo(array_key_exists('REQUEST_URI', $_SERVER) =
? $_SERVER['REQUEST_URI'] : "");
+                $shDeleteLink =3D '<a href=3D"'.$oM->makeUrl('delete', $oRo=
w->linkId, 'Delete entry').'">delete</a>';
+                $oTableRow->addTextCell(" [ $shDeleteLink ]");
+            }
+
+            $oTableRow->SetClass(($i % 2 ) ? 'color0' : 'color1');
+            $oTable->AddRow($oTableRow);
+        }
+
+        return $oTable->GetString();
     }
=20
     function isOpen()
@@ -459,6 +476,9 @@ class Bug
             {
                 return true;
             }
+
+            if($this->iSubmitterId =3D=3D $_SESSION['current']->iUserId)
+                return true;
         }
=20
         return false;
--=20
1.5.1.6


--=_f7cav7lspe8--




More information about the wine-patches mailing list