[Fusionforge-commits] r9996 - in trunk/gforge/www/forum: . admin include

Roland Mas lolando at libremir.placard.fr.eu.org
Fri Jun 4 15:04:42 CEST 2010


Author: lolando
Date: 2010-06-04 15:04:41 +0200 (Fri, 04 Jun 2010)
New Revision: 9996

Modified:
   trunk/gforge/www/forum/admin/ForumAdmin.class.php
   trunk/gforge/www/forum/admin/attachments.php
   trunk/gforge/www/forum/admin/index.php
   trunk/gforge/www/forum/admin/pending.php
   trunk/gforge/www/forum/admin/pendingmsgdetail.php
   trunk/gforge/www/forum/include/ForumHTML.class.php
   trunk/gforge/www/forum/message.php
Log:
Fixed forum moderation interface

Modified: trunk/gforge/www/forum/admin/ForumAdmin.class.php
===================================================================
--- trunk/gforge/www/forum/admin/ForumAdmin.class.php	2010-06-04 12:25:13 UTC (rev 9995)
+++ trunk/gforge/www/forum/admin/ForumAdmin.class.php	2010-06-04 13:04:41 UTC (rev 9996)
@@ -36,10 +36,9 @@
 	var $group_id;
 	var $p,$g;
 	
-	function ForumAdmin($gid=0) {
-		global $group_id;
+	function ForumAdmin($group_id) {
 		$this->group_id = $group_id; 
-		if ($gid) {
+		if ($group_id) {
 			$this->group_id = $group_id;
 			$this->g =& group_get_object($group_id);
 			$this->p =& $this->g->getPermission ();
@@ -275,8 +274,8 @@
 			if ($this->isGroupAdmin()) {
 				$this->PrintAdminOptions();
 			}
-			$res = db_query_params ('SELECT forum_name, group_forum_id FROM forum_group_list WHERE group_id=$1 and moderation_level > 0',
-			array ($group_id));
+			$res = db_query_params ('SELECT fgl.forum_name, fgl.group_forum_id FROM forum_group_list fgl, forum_pending_messages fpm WHERE fgl.group_id=$1 AND fpm.group_forum_id = fgl.group_forum_id GROUP BY fgl.forum_name, fgl.group_forum_id',
+						array ($group_id));
 			if (!$res) {
 				echo db_error();
 				return;			
@@ -289,7 +288,7 @@
 			}
 			
 			if (count($moderated_forums)==0) {
-				echo $HTML->feedback(_('No forums are moderated for this group'));
+				echo $HTML->feedback(_('No forum messages are pending moderation for this group'));
 				forum_footer(array());
 				exit();
 			}
@@ -319,8 +318,7 @@
 
 			';
 			
-			//$moderated_forums["A"] = "All Forums for this group"; // to show all
-			echo html_build_select_box_from_assoc($moderated_forums,forum_id,$forum_id);
+			echo html_build_select_box_from_assoc($moderated_forums,'forum_id',$forum_id);
 			echo '    <input name="Go" type="submit" value="Go" />';
 			
 			$title = array();
@@ -338,6 +336,7 @@
 
 			$options = array("1" => "No action","2" => "Delete","3" => "Release"); //array with the supported actions
 			//i'll make a hidden variable, helps to determine when the user updates the info, which action corresponds to which msgID
+			$ids='';
 			for($i=0;$i<db_numrows($res);$i++) {
 				$ids .= db_result($res,$i,'msg_id') . ",";
 			}
@@ -441,7 +440,7 @@
 						$has_followups = db_result($res1,0,"has_followups");
 						$most_recent_date = db_result($res1,0,"most_recent_date");
 						if ($fm->insertreleasedmsg($group_forum_id,$subject, $body,$post_date, $thread_id, $is_followup_to,$posted_by,$has_followups,time())) {
-							$feedback .= "( $subject ) " . _('Pending forum released') . "<br />";
+							$feedback .= "( $subject ) " . _('Pending message released') . "<br />";
 							if (db_numrows($res2)>0) {
 								//if there's an attachment
 								$am = NEW AttachManager();//object that will handle and insert the attachment into the db

Modified: trunk/gforge/www/forum/admin/attachments.php
===================================================================
--- trunk/gforge/www/forum/admin/attachments.php	2010-06-04 12:25:13 UTC (rev 9995)
+++ trunk/gforge/www/forum/admin/attachments.php	2010-06-04 13:04:41 UTC (rev 9996)
@@ -42,7 +42,7 @@
 $action = getStringFromRequest('action');
 $group_id = getIntFromRequest('group_id');
 
-$fa = new ForumAdmin();
+$fa = new ForumAdmin($group_id);
 
 session_require_perm ('forum_admin', $group_id) ;
 

Modified: trunk/gforge/www/forum/admin/index.php
===================================================================
--- trunk/gforge/www/forum/admin/index.php	2010-06-04 12:25:13 UTC (rev 9995)
+++ trunk/gforge/www/forum/admin/index.php	2010-06-04 13:04:41 UTC (rev 9996)
@@ -124,7 +124,7 @@
 
 	forum_header(array('title'=>_('Change forum status')));
 	echo '<p>'._('You can adjust forum features from here. Please note that private forums can still be viewed by members of your project, not the general public.').'</p>';
-	$fa = new ForumAdmin();
+	$fa = new ForumAdmin($f->Group->getID());
 	$fa->PrintAdminPendingOption($group_forum_id);
 		
 	echo '
@@ -185,12 +185,14 @@
 } elseif ( getStringFromRequest("deletemsg") ) {
 	// delete message handling
 		
-	$fa = new ForumAdmin();
-
 	$forum_id = getStringFromRequest("forum_id");
 	$thread_id = getStringFromRequest("thread_id");
 	$msg_id = getStringFromRequest("deletemsg");
 
+	$f = forum_get_object ($forum_id) ;
+
+	$fa = new ForumAdmin($f->Group->getID());
+
 	if (getStringFromRequest("ok")) {
 		//actually delete the message
 		$feedback .= $fa->ExecuteAction("delete");
@@ -229,8 +231,10 @@
 	$forum_id = getStringFromRequest("forum_id");
 	$thread_id = getStringFromRequest("thread_id");
 	$msg_id = getStringFromRequest("editmsg");
-	$fa = new ForumAdmin();
 
+	$f = forum_get_object ($forum_id) ;
+	$fa = new ForumAdmin($f->Group->getID());
+
 	if (getStringFromRequest("ok")) {
 		//actually finish editing the message and save the contents
 		$f = new Forum ($fa->GetGroupObject(),$forum_id);
@@ -304,7 +308,8 @@
 	$forum_id = getIntFromRequest("forum_id");
 	$return_to_message = getIntFromRequest("return_to_message");
 	$new_forum_id = getIntFromRequest("new_forum_id");
-	$fa = new ForumAdmin();
+	$f = forum_get_object ($forum_id) ;
+	$fa = new ForumAdmin($f->Group->getID());
 
 	if (getStringFromRequest("ok")) {
 		if ($forum_id == $new_forum_id) {
@@ -420,7 +425,8 @@
 	//
 	//	Add new forum
 	//
-	$fa = new ForumAdmin();
+	$fa = new ForumAdmin($g->getID());
+
 	$fa->PrintAdminOptions();
 
 	if ($f)

Modified: trunk/gforge/www/forum/admin/pending.php
===================================================================
--- trunk/gforge/www/forum/admin/pending.php	2010-06-04 12:25:13 UTC (rev 9995)
+++ trunk/gforge/www/forum/admin/pending.php	2010-06-04 13:04:41 UTC (rev 9996)
@@ -42,7 +42,7 @@
 $group_id = getIntFromRequest('group_id');
 $forum_id = getStringFromRequest("forum_id");
 
-$fa = new ForumAdmin ();
+$fa = new ForumAdmin ($group_id);
 
 // If there's no forum_id input, then the user must have access to all forums, thus he's a group admin for the forums
 if (!$forum_id) {

Modified: trunk/gforge/www/forum/admin/pendingmsgdetail.php
===================================================================
--- trunk/gforge/www/forum/admin/pendingmsgdetail.php	2010-06-04 12:25:13 UTC (rev 9995)
+++ trunk/gforge/www/forum/admin/pendingmsgdetail.php	2010-06-04 13:04:41 UTC (rev 9996)
@@ -43,7 +43,7 @@
 
 global $HTML;
 
-$fa = new ForumAdmin();
+$fa = new ForumAdmin($group_id);
 
 if ( (!$forum_id) || (!$group_id) || (!$msg_id) ) {
 	exit_missing_param();

Modified: trunk/gforge/www/forum/include/ForumHTML.class.php
===================================================================
--- trunk/gforge/www/forum/include/ForumHTML.class.php	2010-06-04 12:25:13 UTC (rev 9995)
+++ trunk/gforge/www/forum/include/ForumHTML.class.php	2010-06-04 13:04:41 UTC (rev 9996)
@@ -250,8 +250,8 @@
 			$bold_end = '';
 		}
 		$am = new AttachManager();
-		$fa = new ForumAdmin();
 		$msgforum =& $msg->getForum();
+		$fa = new ForumAdmin($msgforum->Group->getID());
 		$url = util_make_url('/forum/message.php?msg_id='. $msg->getID() .'&amp;group_id='.$group_id);
 		$ret_val = 		
 		'<table border="0" width="100%" cellspacing="0">

Modified: trunk/gforge/www/forum/message.php
===================================================================
--- trunk/gforge/www/forum/message.php	2010-06-04 12:25:13 UTC (rev 9995)
+++ trunk/gforge/www/forum/message.php	2010-06-04 13:04:41 UTC (rev 9996)
@@ -120,7 +120,7 @@
 	echo _("By:").' '. util_make_link_u($fm->getPosterName(), $fm->getPosterID(), $fm->getPosterRealName());
 	echo ' on '. date(_('Y-m-d H:i'), $fm->getPostDate()) .'</td><td align="right">';
 	echo '<a href="'.$url.'">[forum:'.$msg_id.']</a><br/>';
-	$fa = new ForumAdmin();
+	$fa = new ForumAdmin($f->Group->getID());
 	if (forge_check_perm ('forum_admin', $f->Group->getID())) {
 		echo $fa->PrintAdminMessageOptions($msg_id,$group_id,0,$forum_id); // 0 in thread id because that tells us to go back to message.php instead of forum.php
 	}




More information about the Fusionforge-commits mailing list