[Fusionforge-commits] r15037 - trunk/src/common/widget

Franck VILLAUME nerville at fusionforge.org
Sun Jan 29 18:06:41 CET 2012


Author: nerville
Date: 2012-01-29 18:06:40 +0100 (Sun, 29 Jan 2012)
New Revision: 15037

Modified:
   trunk/src/common/widget/Widget_MyMonitoredForums.class.php
Log:
fix bug id #344, correct indent, fix flag : new monitored forum

Modified: trunk/src/common/widget/Widget_MyMonitoredForums.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyMonitoredForums.class.php	2012-01-29 17:01:06 UTC (rev 15036)
+++ trunk/src/common/widget/Widget_MyMonitoredForums.class.php	2012-01-29 17:06:40 UTC (rev 15037)
@@ -1,21 +1,22 @@
 <?php
 /**
  * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
+ * Copyright 2012, Franck Villaume - TrivialDev
  *
- * This file is a part of Codendi.
+ * This file is a part of FusionForge.
  *
- * Codendi is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * Codendi is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
+ * along with FusionForge. If not, see <http://www.gnu.org/licenses/>.
  */
 
 require_once('Widget.class.php');
@@ -27,116 +28,118 @@
 * Forums that are actively monitored
 */
 class Widget_MyMonitoredForums extends Widget {
-    function Widget_MyMonitoredForums() {
-        $this->Widget('mymonitoredforums');
-    }
-    function getTitle() {
-        return _("Monitored Forums");
-    }
-    function getContent() {
-        $html_my_monitored_forums = '';
-        $sql="SELECT DISTINCT groups.group_id, groups.group_name ".
-             "FROM groups,forum_group_list,forum_monitored_forums ".
-             "WHERE groups.group_id=forum_group_list.group_id ".
-             "AND groups.status = 'A' ".
-            "AND forum_group_list.is_public <> 9 ".
-             "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
-             "AND forum_monitored_forums.user_id=$1 ";
-        $um = UserManager::instance();
-        $current_user = $um->getCurrentUser();
-        if ($current_user->getStatus()=='S') {
-            $projects = $current_user->getProjects();
-            $sql .= "AND groups.group_id IN (". implode(',', $projects) .") ";
-        }
-        //$sql .= "GROUP BY groups.group_id ORDER BY groups.group_id ASC LIMIT 100";
-        $sql .= "ORDER BY groups.group_id ASC LIMIT 100";
+	function Widget_MyMonitoredForums() {
+		$this->Widget('mymonitoredforums');
+	}
 
-        $result=db_query_params($sql,array(user_getid()));
-        $rows=db_numrows($result);
-        if (!$result || $rows < 1) {
-            $html_my_monitored_forums .= '<div class="warning">' . _("You are not monitoring any forums.") . '</div><p>' . _("If you monitor forums, you will be sent new posts in the form of an email, with a link to the new message.") . '</p><p>' . _("You can monitor forums by clicking on the appropriate menu item in the discussion forum itself.") . '</p>';
-        } else {
-            $request =& HTTPRequest::instance();
-            $html_my_monitored_forums .= '<table style="width:100%">';
-            for ($j=0; $j<$rows; $j++) {
-                $group_id = db_result($result,$j,'group_id');
+	function getTitle() {
+		return _("Monitored Forums");
+	}
 
-                $sql2="SELECT forum_group_list.group_forum_id,forum_group_list.forum_name ".
-                    "FROM groups,forum_group_list,forum_monitored_forums ".
-                    "WHERE groups.group_id=forum_group_list.group_id ".
-                    "AND groups.group_id=$1".
-                    "AND forum_group_list.is_public <> 9 ".
-                    "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
-                    "AND forum_monitored_forums.user_id=$2 LIMIT 100";
+	function getContent() {
+		$html_my_monitored_forums = '';
+		$sql="SELECT DISTINCT groups.group_id, groups.group_name ".
+		"FROM groups,forum_group_list,forum_monitored_forums ".
+		"WHERE groups.group_id=forum_group_list.group_id ".
+		"AND groups.status = 'A' ".
+		"AND forum_group_list.is_public <> 9 ".
+		"AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
+		"AND forum_monitored_forums.user_id=$1 ";
+		$um = UserManager::instance();
+		$current_user = $um->getCurrentUser();
+		if ($current_user->getStatus()=='S') {
+		$projects = $current_user->getProjects();
+		$sql .= "AND groups.group_id IN (". implode(',', $projects) .") ";
+		}
+		//$sql .= "GROUP BY groups.group_id ORDER BY groups.group_id ASC LIMIT 100";
+		$sql .= "ORDER BY groups.group_id ASC LIMIT 100";
 
-                $result2 = db_query_params($sql2,array($group_id,user_getid()));
-                $rows2 = db_numrows($result2);
+		$result=db_query_params($sql,array(user_getid()));
+		$rows=db_numrows($result);
+		if (!$result || $rows < 1) {
+		$html_my_monitored_forums .= '<div class="warning">' . _("You are not monitoring any forums.") . '</div><p>' . _("If you monitor forums, you will be sent new posts in the form of an email, with a link to the new message.") . '</p><p>' . _("You can monitor forums by clicking on the appropriate menu item in the discussion forum itself.") . '</p>';
+		} else {
+		$request =& HTTPRequest::instance();
+		$html_my_monitored_forums .= '<table style="width:100%">';
+		for ($j=0; $j<$rows; $j++) {
+			$group_id = db_result($result, $j, 'group_id');
 
-                $vItemId = new Valid_UInt('hide_item_id');
-                $vItemId->required();
-                if($request->valid($vItemId)) {
-                    $hide_item_id = $request->get('hide_item_id');
-                } else {
-                    $hide_item_id = null;
-                }
+			$sql2="SELECT forum_group_list.group_forum_id,forum_group_list.forum_name ".
+			"FROM groups,forum_group_list,forum_monitored_forums ".
+			"WHERE groups.group_id=forum_group_list.group_id ".
+			"AND groups.group_id=$1".
+			"AND forum_group_list.is_public <> 9 ".
+			"AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
+			"AND forum_monitored_forums.user_id=$2 LIMIT 100";
 
-                $vForum = new Valid_WhiteList('hide_forum', array(0, 1));
-		$vForum->required();
-		if($request->valid($vForum)) {
-			$hide_forum = $request->get('hide_forum');
-		} else {
-			$hide_forum = null;
-		}
+			$result2 = db_query_params($sql2, array($group_id, user_getid()));
+			$rows2 = db_numrows($result2);
 
-		list($hide_now,$count_diff,$hide_url) = my_hide_url('forum',$group_id,$hide_item_id,$rows2,$hide_forum);
+			$vItemId = new Valid_UInt('hide_item_id');
+			$vItemId->required();
+			if ($request->valid($vItemId)) {
+			$hide_item_id = $request->get('hide_item_id');
+			} else {
+			$hide_item_id = null;
+			}
 
-		$html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '').
-			$hide_url.'<a href="/forum/?group_id='.$group_id.'">'.
-			db_result($result,$j,'group_name').'</a>    ';
+			$vForum = new Valid_WhiteList('hide_forum', array(0, 1));
+			$vForum->required();
+			if ($request->valid($vForum)) {
+				$hide_forum = $request->get('hide_forum');
+			} else {
+				$hide_forum = null;
+			}
 
-		$html = '';
-		$count_new = max(0, $count_diff);
-		for ($i=0; $i<$rows2; $i++) {
+			list($hide_now,$count_diff,$hide_url) = my_hide_url('forum',$group_id,$hide_item_id,$rows2,$hide_forum);
 
-			if (!$hide_now) {
-				$group_forum_id = db_result($result2,$i,'group_forum_id');
+			$html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '').
+				$hide_url.'<a href="/forum/?group_id='.$group_id.'">'.
+				db_result($result,$j,'group_name').'</a>    ';
 
-				$html .= '
-					<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'"><td width="99%">'.
-					'   - <a href="/forum/forum.php?forum_id='.$group_forum_id.'">'.
-					stripslashes(db_result($result2,$i,'forum_name')).'</a></td>'.
-					'<td align="center"><a href="/my/stop_monitor.php?forum_id='.$group_forum_id.
-					'" onClick="return confirm(\''._("Stop monitoring this Forum?").'\')">'.
-					'<img src="'.$GLOBALS['HTML']->imgroot.'ic/trash.png" height="16" width="16" '.
-					'border="0" alt="'._("Stop monitoring").'" /></a></td></tr>';
+			$html = '';
+			$count_new = max(0, $count_diff);
+			for ($i=0; $i<$rows2; $i++) {
+				if (!$hide_now) {
+					$group_forum_id = db_result($result2, $i, 'group_forum_id');
+					$html .= '
+						<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'"><td width="99%">'.
+						'   - <a href="/forum/forum.php?forum_id='.$group_forum_id.'">'.
+						stripslashes(db_result($result2,$i,'forum_name')).'</a></td>'.
+						'<td align="center"><a href="/forum/monitor.php?forum_id='.$group_forum_id.'&group_id='.$group_id.'&stop=1'.
+						'" onClick="return confirm(\''._("Stop monitoring this Forum?").'\')">'.
+						'<img src="'.$GLOBALS['HTML']->imgroot.'ic/trash.png" height="16" width="16" '.
+						'border="0" alt="'._("Stop monitoring").'" /></a></td></tr>';
+				}
 			}
+
+			$html_hdr .= '['.$rows2.($count_new ? ", <b>".sprintf(_('%s new'), $count_new)."</b>]" : ']').'</td></tr>';
+			$html_my_monitored_forums .= $html_hdr.$html;
 		}
+		$html_my_monitored_forums .= '</table>';
+		}
+		return $html_my_monitored_forums;
+	}
 
-		$html_hdr .= '['.$rows2.($count_new ? ", <b>".sprintf(_('%s new'), array($count_new))."</b>]" : ']').'</td></tr>';
-		$html_my_monitored_forums .= $html_hdr.$html;
-	    }
-	    $html_my_monitored_forums .= '</table>';
+	function getCategory() {
+		return 'Forums';
 	}
-	return $html_my_monitored_forums;
-    }
 
-    function getCategory() {
-	    return 'Forums';
-    }
-    function getDescription() {
-	    return _("List forums that you are currently monitoring, by project.<br />To cancel any of the monitored items just click on the trash icon next to the item label.");
-    }
-    function isAjax() {
-	    return true;
-    }
-    function getAjaxUrl($owner_id, $owner_type) {
-        $request =& HTTPRequest::instance();
-        $ajax_url = parent::getAjaxUrl($owner_id, $owner_type);
-        if ($request->exist('hide_item_id') || $request->exist('hide_forum')) {
-            $ajax_url .= '&hide_item_id=' . $request->get('hide_item_id') . '&hide_forum=' . $request->get('hide_forum');
-        }
-        return $ajax_url;
-    }
+	function getDescription() {
+		return _("List forums that you are currently monitoring, by project.<br />To cancel any of the monitored items just click on the trash icon next to the item label.");
+	}
 
+	function isAjax() {
+		return true;
+	}
+
+	function getAjaxUrl($owner_id, $owner_type) {
+		$request =& HTTPRequest::instance();
+		$ajax_url = parent::getAjaxUrl($owner_id, $owner_type);
+		if ($request->exist('hide_item_id') || $request->exist('hide_forum')) {
+		$ajax_url .= '&hide_item_id=' . $request->get('hide_item_id') . '&hide_forum=' . $request->get('hide_forum');
+		}
+		return $ajax_url;
+	}
 }
-?>
+?>
\ No newline at end of file




More information about the Fusionforge-commits mailing list