[thirdparty-commits] jpeeler: mantis/trunk r59 - /mantis/trunk/

SVN commits to the Digium third-party software repository thirdparty-commits at lists.digium.com
Thu Jan 29 17:06:31 CST 2009


Author: jpeeler
Date: Thu Jan 29 17:06:31 2009
New Revision: 59

URL: http://svn.digium.com/svn-view/thirdparty?view=rev&rev=59
Log:
This makes the karma behavior for user transactions work the same way as for bug transactions. Also fixes some deletion problems.


Modified:
    mantis/trunk/bug_view_advanced_page.php
    mantis/trunk/bug_view_page.php
    mantis/trunk/karma_delete.php
    mantis/trunk/karma_view_transactions.php
    mantis/trunk/mantis_karma.php

Modified: mantis/trunk/bug_view_advanced_page.php
URL: http://svn.digium.com/svn-view/thirdparty/mantis/trunk/bug_view_advanced_page.php?view=diff&rev=59&r1=58&r2=59
==============================================================================
--- mantis/trunk/bug_view_advanced_page.php (original)
+++ mantis/trunk/bug_view_advanced_page.php Thu Jan 29 17:06:31 2009
@@ -210,7 +210,7 @@
 		<?php echo lang_get( 'reporter' ) ?>
 	</td>
 	<td>
-		<?php print_user_with_subject( $t_bug->reporter_id, $f_bug_id ); karma_show_karma_score ( $t_bug->reporter_id ); ?>
+		<?php print_user_with_subject( $t_bug->reporter_id, $f_bug_id ); karma_show_karma_score ( $f_bug_id, $t_bug->reporter_id ); ?>
 	</td>
 
 	<!-- View Status -->

Modified: mantis/trunk/bug_view_page.php
URL: http://svn.digium.com/svn-view/thirdparty/mantis/trunk/bug_view_page.php?view=diff&rev=59&r1=58&r2=59
==============================================================================
--- mantis/trunk/bug_view_page.php (original)
+++ mantis/trunk/bug_view_page.php Thu Jan 29 17:06:31 2009
@@ -213,7 +213,7 @@
 		<?php echo lang_get( 'reporter' ) ?>
 	</td>
 	<td>
-		<?php print_user_with_subject( $t_bug->reporter_id, $f_bug_id ); karma_show_karma_score ( $t_bug->reporter_id ); ?>
+		<?php print_user_with_subject( $t_bug->reporter_id, $f_bug_id ); karma_show_karma_score ( $f_bug_id, $t_bug->reporter_id ); ?>
 	</td>
 
 	<!-- View Status -->

Modified: mantis/trunk/karma_delete.php
URL: http://svn.digium.com/svn-view/thirdparty/mantis/trunk/karma_delete.php?view=diff&rev=59&r1=58&r2=59
==============================================================================
--- mantis/trunk/karma_delete.php (original)
+++ mantis/trunk/karma_delete.php Thu Jan 29 17:06:31 2009
@@ -8,11 +8,17 @@
 	auth_ensure_user_authenticated();
 
 	$f_karma_id = gpc_get_int( 'id' );
-	$f_bug_id = gpc_get_int( 'bug_id' );
+	$f_bug_id = gpc_get_int( 'bug_id');
+	$f_user_id = gpc_get_int( 'user_id', 0 );
 
 	if ($f_karma_id > 0)
 		karma_delete($f_karma_id);
 
-	header("Location: karma_transactions.php?bug_id=$f_bug_id");
+	if ($f_user_id == 0)
+		header("Location: karma_transactions.php?bug_id=$f_bug_id");
+	else if ($f_user_id != 0)
+		header("Location: karma_view_transactions.php?bug_id=$f_bug_id&user_id=$f_user_id");
+	else
+		echo "ERROR: Required variables are not present, this session can not continue. Click back.";
 	exit;
 ?>

Modified: mantis/trunk/karma_view_transactions.php
URL: http://svn.digium.com/svn-view/thirdparty/mantis/trunk/karma_view_transactions.php?view=diff&rev=59&r1=58&r2=59
==============================================================================
--- mantis/trunk/karma_view_transactions.php (original)
+++ mantis/trunk/karma_view_transactions.php Thu Jan 29 17:06:31 2009
@@ -16,13 +16,14 @@
 
 	auth_ensure_user_authenticated();
 
-    $f_user_id = gpc_get_int( 'id' );
+	$f_bug_id = gpc_get_int( 'bug_id' );
+    $f_user_id = gpc_get_int( 'user_id' );
 
     html_page_top1();
     html_page_top2();
 
     echo "<br/>\n";
-    karma_show_user_transactions( $f_user_id );
+    karma_show_user_transactions( $f_bug_id, $f_user_id );
 
 	echo "<br />\n";
 	echo "<SMALL><STRONG>Reminder: </STRONG>Karma is not always awarded when it should be,\n";

Modified: mantis/trunk/mantis_karma.php
URL: http://svn.digium.com/svn-view/thirdparty/mantis/trunk/mantis_karma.php?view=diff&rev=59&r1=58&r2=59
==============================================================================
--- mantis/trunk/mantis_karma.php (original)
+++ mantis/trunk/mantis_karma.php Thu Jan 29 17:06:31 2009
@@ -120,23 +120,32 @@
 
 # ----------------------------------------------------------------------------------------------------------------------
 
-function karma_delete_link($p_karma_id, $p_bug_id, $p_tx_user=null) {
+# p_user_id must be null for bug transaction
+function karma_delete_link($p_karma_id, $p_bug_id, $p_tx_user, $p_user_id) {
 	/* Limitation:
 	   If you change your nick on the bug tracker, you'll
 	   no longer be able to remove karma unless you're an
 	   administrator */
 	$t_karma_id = (int)$p_karma_id;
 	$t_bug_id = (int)$p_bug_id;
-	
+	$t_user_id = (int)$p_user_id;
+
 	if (!karma_user_can_delete($p_tx_user))
 		return;
+
+	$delete_params = "id={$t_karma_id}&bug_id={$t_bug_id}";
+	if ($p_user_id != NULL) {
+		$delete_params .= "&user_id={$t_user_id}";
+	}
+	$delete_params .= "\" ";
+
 	return "" .
-	       "<div style=\"text-align: left; float: left;\">" .
-	       "<small>(<a href=\"karma_delete.php?id={$t_karma_id}&bug_id={$t_bug_id}\" " .
-	       "   onclick=\"return confirm('Are you sure you want to delete karma?');\">" .
-	       "delete" .
-	       "</a><noscript> - no warning!</noscript>)</small>" .
-		   "</div>\n";
+			"<div style=\"text-align: left; float: left;\">" .
+			"<small>(<a href=\"karma_delete.php?{$delete_params}" .
+			"   onclick=\"return confirm('Are you sure you want to delete karma?');\">" .
+			"delete" .
+			"</a><noscript> - no warning!</noscript>)</small>" .
+			"</div>\n";
 }
 
 # ----------------------------------------------------------------------------------------------------------------------
@@ -216,7 +225,7 @@
             echo "</TD>\n";
             echo "        <TD VALIGN=\"Top\" CLASS=\"right\" NOWRAP>";
 			echo "<div style='float:right;'>{$t_value}</div>";
-            echo karma_delete_link($t_karma_id, $p_bug_id, $t_tx_user);
+            echo karma_delete_link($t_karma_id, $p_bug_id, $t_tx_user, NULL);
             echo "</TD>\n";
             echo "    </TR>\n";
 
@@ -477,24 +486,24 @@
 
 # ----------------------------------------------------------------------------------------------------------------------
 
-function karma_show_karma_score ($p_user_id) {
+function karma_show_karma_score ($p_bug_id, $p_user_id) {
 
     # Displays the karma score with a link to the transactions that make up the score
     $t_karma_score = karma_get_user_score($p_user_id);
     if ($t_karma_score == 0) {
-        echo " (Karma: <A HREF=\"karma_view_transactions.php?id=$p_user_id\">neutral</A>)";
+        echo " (Karma: <A HREF=\"karma_view_transactions.php?bug_id=$p_bug_id&user_id=$p_user_id\">neutral</A>)";
     } else {
         if ($t_karma_score > 0) {
             $t_karma_score = "+" . sprintf("%.2f", $t_karma_score);
         }
-        echo " (Karma: <A HREF=\"karma_view_transactions.php?id=$p_user_id\">" . $t_karma_score . "</A>)";
-    }
-
-}
-
-# ----------------------------------------------------------------------------------------------------------------------
-
-function karma_show_user_transactions($p_user_id) {
+        echo " (Karma: <A HREF=\"karma_view_transactions.php?bug_id=$p_bug_id&user_id=$p_user_id\">" . $t_karma_score . "</A>)";
+    }
+
+}
+
+# ----------------------------------------------------------------------------------------------------------------------
+
+function karma_show_user_transactions($p_bug_id, $p_user_id) {
 
     #
     # Gets the current karma score for the specified user
@@ -547,7 +556,10 @@
 
         echo "<TABLE CLASS=\"width100\" CELLSPACING=\"1\">\n";
         echo "    <TR>\n";
-        echo "        <TD CLASS=\"form-title\" COLSPAN=\"4\">Viewing karma score transactions for $t_user_name ($t_user_karma_score)</TD>\n";
+        echo "        <TD CLASS=\"form-title\" COLSPAN=\"4\">Viewing karma score transactions for $t_user_name ($t_user_karma_score)\n";
+        echo " <SPAN CLASS=\"small\">";
+        echo print_bracket_link( "bug_view_page.php?bug_id=$p_bug_id", "Return to bug view page" );
+        echo "</SPAN></TD>\n";
         echo "    </TR>\n";
         echo "    <TR CLASS=\"row-category\">\n";
         echo "         <TD WIDTH=\"15%\">Date</TD>\n";
@@ -586,7 +598,7 @@
            // echo "        <TD VALIGN=\"Top\" CLASS=\"right\" NOWRAP>$t_value</TD>\n";
             echo "        <TD VALIGN=\"Top\" CLASS=\"right\" NOWRAP>";
 			echo "<div style='float:right;'>{$t_value}</div>";
-            echo karma_delete_link($t_karma_id, $t_tx_user);
+            echo karma_delete_link($t_karma_id, $p_bug_id, $t_tx_user, $p_user_id);
             echo "</TD>\n";
             echo "    </TR>\n";
 




More information about the thirdparty-commits mailing list