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

Franck VILLAUME nerville at fusionforge.org
Sun Jul 8 15:58:49 CEST 2012


Author: nerville
Date: 2012-07-08 15:58:48 +0200 (Sun, 08 Jul 2012)
New Revision: 15966

Modified:
   trunk/src/common/widget/Widget_MyAdmin.class.php
   trunk/src/common/widget/Widget_MyArtifacts.class.php
   trunk/src/common/widget/Widget_MyBookmarks.class.php
   trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php
   trunk/src/common/widget/Widget_MyMonitoredForums.class.php
   trunk/src/common/widget/Widget_MyProjects.class.php
   trunk/src/common/widget/Widget_MyProjectsLastDocuments.class.php
   trunk/src/common/widget/Widget_MyRss.class.php
   trunk/src/common/widget/Widget_MySurveys.class.php
   trunk/src/common/widget/Widget_ProjectDescription.class.php
   trunk/src/common/widget/Widget_ProjectInfo.class.php
   trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php
   trunk/src/common/widget/Widget_ProjectLatestFileReleases.class.php
   trunk/src/common/widget/Widget_ProjectLatestNews.class.php
   trunk/src/common/widget/Widget_ProjectMembers.class.php
   trunk/src/common/widget/Widget_ProjectPublicAreas.class.php
Log:
use __construct when needed, indent, cleanup

Modified: trunk/src/common/widget/Widget_MyAdmin.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyAdmin.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyAdmin.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -21,12 +21,13 @@
 require_once('Widget.class.php');
 
 /**
-* Widget_MyAdmin
-*
-* Personal Admin
-*/
+ * Widget_MyAdmin
+ *
+ * Personal Admin
+ */
+
 class Widget_MyAdmin extends Widget {
-    function Widget_MyAdmin() {
+    function __construct() {
         $this->Widget('myadmin');
     }
     function getTitle() {

Modified: trunk/src/common/widget/Widget_MyArtifacts.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyArtifacts.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyArtifacts.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -35,9 +35,10 @@
  *
  * Artifact assigned to or submitted by or monitored by this person
  */
+
 class Widget_MyArtifacts extends Widget {
 	var $_artifact_show;
-	function Widget_MyArtifacts() {
+	function __construct() {
 		$this->Widget('myartifacts');
 		$this->_artifact_show = UserManager::instance()->getCurrentUser()->getPreference('my_artifacts_show');
 		if($this->_artifact_show === false) {

Modified: trunk/src/common/widget/Widget_MyBookmarks.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyBookmarks.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyBookmarks.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -22,12 +22,13 @@
 require_once $gfcommon.'include/plugins_utils.php';
 
 /**
-* Widget_MyBookmarks
-*
-* Personal bookmarks
-*/
+ * Widget_MyBookmarks
+ *
+ * Personal bookmarks
+ */
+
 class Widget_MyBookmarks extends Widget {
-	function Widget_MyBookmarks() {
+	function __construct() {
 		$this->Widget('mybookmarks');
 	}
 

Modified: trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyMonitoredDocuments.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -25,12 +25,13 @@
 require_once $gfwww.'include/my_utils.php';
 
 /**
-* Widget_MyMonitoredDocuments
-*
-* Documents that are actively monitored
-*/
+ * Widget_MyMonitoredDocuments
+ *
+ * Documents that are actively monitored
+ */
+
 class Widget_MyMonitoredDocuments extends Widget {
-	function Widget_MyMonitoredDocuments() {
+	function __construct() {
 		$this->Widget('mymonitoreddocuments');
 	}
 

Modified: trunk/src/common/widget/Widget_MyMonitoredForums.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyMonitoredForums.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyMonitoredForums.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -23,12 +23,13 @@
 require_once $gfwww.'include/my_utils.php';
 
 /**
-* Widget_MyMonitoredForums
-*
-* Forums that are actively monitored
-*/
+ * Widget_MyMonitoredForums
+ *
+ * Forums that are actively monitored
+ */
+
 class Widget_MyMonitoredForums extends Widget {
-	function Widget_MyMonitoredForums() {
+	function __construct() {
 		$this->Widget('mymonitoredforums');
 	}
 
@@ -47,8 +48,8 @@
 		$um = UserManager::instance();
 		$current_user = $um->getCurrentUser();
 		if ($current_user->getStatus()=='S') {
-		$projects = $current_user->getProjects();
-		$sql .= "AND groups.group_id IN (". implode(',', $projects) .") ";
+			$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";
@@ -149,7 +150,7 @@
 		$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');
+			$ajax_url .= '&hide_item_id=' . $request->get('hide_item_id') . '&hide_forum=' . $request->get('hide_forum');
 		}
 		return $ajax_url;
 	}

Modified: trunk/src/common/widget/Widget_MyProjects.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyProjects.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyProjects.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -23,12 +23,13 @@
 require_once('common/rss/RSS.class.php');
 
 /**
-* Widget_MyProjects
-*
-* PROJECT LIST
-*/
+ * Widget_MyProjects
+ *
+ * PROJECT LIST
+ */
+
 class Widget_MyProjects extends Widget {
-	function Widget_MyProjects() {
+	function __construct() {
 		$this->Widget('myprojects');
 	}
 	function getTitle() {

Modified: trunk/src/common/widget/Widget_MyProjectsLastDocuments.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyProjectsLastDocuments.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyProjectsLastDocuments.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -25,12 +25,11 @@
 include $gfcommon.'docman/DocumentFactory.class.php';
 
 /**
-* Widget_MyProjectsLastDocuments
-*
-* PROJECT LIST
-*/
+ * Widget_MyProjectsLastDocuments
+ */
+
 class Widget_MyProjectsLastDocuments extends Widget {
-	function Widget_MyProjectsLastDocuments() {
+	function __construct() {
 		$this->Widget('myprojectslastdocuments');
 	}
 

Modified: trunk/src/common/widget/Widget_MyRss.class.php
===================================================================
--- trunk/src/common/widget/Widget_MyRss.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MyRss.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -22,12 +22,13 @@
 require_once('common/widget/WidgetLayoutManager.class.php');
 
 /**
-* Widget_MyRss
-*
-* Personal rss reader
-*/
+ * Widget_MyRss
+ *
+ * Personal rss reader
+ */
+
 class Widget_MyRss extends Widget_Rss {
-    function Widget_MyRss() {
+    function __construct() {
         $this->Widget_Rss('myrss', user_getid(), WidgetLayoutManager::OWNER_TYPE_USER);
     }
 

Modified: trunk/src/common/widget/Widget_MySurveys.class.php
===================================================================
--- trunk/src/common/widget/Widget_MySurveys.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_MySurveys.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -30,11 +30,12 @@
  * This needs to be updated manually to display any given survey
  * Default behavior: get first survey from group #1
  */
+
 class Widget_MySurveys extends Widget {
 	var $content;
 	var $can_be_displayed;
 
-	function Widget_MySurveys() {
+	function __construct() {
 		$this->Widget('mysurveys');
 		$no_survey = true;
 

Modified: trunk/src/common/widget/Widget_ProjectDescription.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectDescription.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_ProjectDescription.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -22,47 +22,46 @@
 require_once('common/include/Codendi_HTMLPurifier.class.php');
 
 /**
-* Widget_ProjectDescription
-*
-*/
+ * Widget_ProjectDescription
+ */
+
 class Widget_ProjectDescription extends Widget {
-    public function __construct() {
-        $this->Widget('projectdescription');
-    }
-    public function getTitle() {
-        return _('Project description');
-    }
-    public function getContent() {
-        $request =& HTTPRequest::instance();
-        $group_id = $request->get('group_id');
-        $pm = ProjectManager::instance();
-        $project = $pm->getProject($group_id);
-        //$hp = Codendi_HTMLPurifier::instance();
+	public function __construct() {
+		$this->Widget('projectdescription');
+	}
 
-	$pluginManager = plugin_manager_get_object();
+	public function getTitle() {
+		return _('Project description');
+	}
+
+	public function getContent() {
+		$request =& HTTPRequest::instance();
+		$group_id = $request->get('group_id');
+		$pm = ProjectManager::instance();
+		$project = $pm->getProject($group_id);
+
+		$pluginManager = plugin_manager_get_object();
 		if (! $pluginManager->PluginIsInstalled('blocks') || !plugin_hook ("blocks", 'summary_description')) {
-		$project_description = $project->getDescription();
-		if ($project_description) {
-			// need to use a litteral version for content attribute since nl2br is for HTML
-			print "<p>"
-				.'<span property="doap:description" content="'. preg_quote($project_description,'"') .'">'
-				. nl2br($project_description)
-				.'</span></p>';
-		} else {
-			print "<p>" . _('This project has not yet submitted a description.') . '</p>';
+			$project_description = $project->getDescription();
+			if ($project_description) {
+				// need to use a litteral version for content attribute since nl2br is for HTML
+				print "<p>"
+					.'<span property="doap:description" content="'. preg_quote($project_description,'"') .'">'
+					. nl2br($project_description)
+					.'</span></p>';
+			} else {
+				print "<p>" . _('This project has not yet submitted a description.') . '</p>';
+			}
 		}
 	}
 
+	public function canBeUsedByProject(&$project) {
+		return true;
+	}
 
-
-
-    }
-    public function canBeUsedByProject(&$project) {
-	    return true;
-    }
-    function getDescription() {
-	    return _('Allow you to view the project description');
-    }
+	function getDescription() {
+		return _('Allow you to view the project description');
+	}
 }
 
 ?>

Modified: trunk/src/common/widget/Widget_ProjectInfo.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectInfo.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_ProjectInfo.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -21,15 +21,17 @@
 require_once('Widget.class.php');
 
 /**
- * Widget_ProjectMembers
+ * Widget_ProjectInfo
  */
 class Widget_ProjectInfo extends Widget {
 	public function __construct() {
 		$this->Widget('projectinfo');
 	}
+
 	public function getTitle() {
 		return _('Project Info');
 	}
+
 	public function getContent() {
 		$request =& HTTPRequest::instance();
 		$group_id = $request->get('group_id');
@@ -116,16 +118,16 @@
 			}
 		}
 
-
 		$hook_params = array();
 		$hook_params['group_id'] = $group_id;
 		plugin_hook("project_after_description",$hook_params);
 		plugin_hook('hierarchy_views', array($group_id, 'home'));
+	}
 
-	}
 	public function canBeUsedByProject(&$project) {
 		return true;
 	}
+
 	function getDescription() {
 		return _('Some infos about the project.');
 	}

Modified: trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_ProjectLatestDocuments.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -23,12 +23,12 @@
 require_once('Widget.class.php');
 
 /**
-* Widget_ProjectLatestDocuments
-*
-*/
+ * Widget_ProjectLatestDocuments
+ */
+
 class Widget_ProjectLatestDocuments extends Widget {
 	var $content;
-	function Widget_ProjectLatestDocuments() {
+	function __construct() {
 		$this->Widget('projectlatestdocuments');
 		$request =& HTTPRequest::instance();
 		$pm = ProjectManager::instance();

Modified: trunk/src/common/widget/Widget_ProjectLatestFileReleases.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectLatestFileReleases.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_ProjectLatestFileReleases.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -22,23 +22,25 @@
 require_once('Widget.class.php');
 
 /**
-* Widget_ProjectLatestFileReleases
-*
-*/
+ * Widget_ProjectLatestFileReleases
+ */
+
 class Widget_ProjectLatestFileReleases extends Widget {
 	var $content;
-	function Widget_ProjectLatestFileReleases() {
+	function __construct() {
 		$this->Widget('projectlatestfilereleases');
 		$request =& HTTPRequest::instance();
 		$pm = ProjectManager::instance();
 		$project = $pm->getProject($request->get('group_id'));
 		if ($project && $this->canBeUsedByProject($project)) {
-		$this->content['title'] = _('Latest File Releases');
+			$this->content['title'] = _('Latest File Releases');
 		}
 	}
+
 	function getTitle() {
 		return $this->content['title'];
 	}
+
 	function getContent() {
 		$request =& HTTPRequest::instance();
 		$pm = ProjectManager::instance();
@@ -152,23 +154,23 @@
 				echo '</table>';
 			}
 		}
-
 		echo '<div class="underline-link">' . util_make_link ('/frs/?group_id='.$group_id, _('View All Project Files')) . '</div>';
+	}
 
-    }
-    function isAvailable() {
-        return isset($this->content['title']);
-    }
-    function canBeUsedByProject(&$project) {
-        return $project->usesFRS();
-    }
+	function isAvailable() {
+		return isset($this->content['title']);
+	}
+	function canBeUsedByProject(&$project) {
+		return $project->usesFRS();
+	}
 
-    function getCategory() {
-        return 'File-Release';
-    }
-    function getDescription() {
+	function getCategory() {
+		return 'File-Release';
+	}
+
+	function getDescription() {
 		return _(' List the most recent packages available for download along with their revision. <br />A Release Notes icon allows you to see the latest changes and developers comments associated with this revision.<br />Then comes the monitor icon, selecting this icon will cause this package to be monitored for you.<br />Anytime the project development team posts a new release, you will be automatically notified via e-mail. All monitored File Releases are listed in your Personal Page and can be canceled from this page or from the main page of the file release system.');
-    }
+	}
 }
 
 ?>

Modified: trunk/src/common/widget/Widget_ProjectLatestNews.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectLatestNews.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_ProjectLatestNews.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -24,46 +24,51 @@
 * Widget_ProjectLatestNews
 */
 class Widget_ProjectLatestNews extends Widget {
-    var $content;
-    function Widget_ProjectLatestNews() {
+	var $content;
+
+	function __construct() {
 		global $gfwww;
+		$this->Widget('projectlatestnews');
+		$request =& HTTPRequest::instance();
+		$pm = ProjectManager::instance();
+		$project = $pm->getProject($request->get('group_id'));
+		if ($project && $this->canBeUsedByProject($project)) {
+			require_once('www/news/news_utils.php');
+			$this->content = news_show_latest($request->get('group_id'), 10, false);
+		}
+	}
 
-        $this->Widget('projectlatestnews');
-        $request =& HTTPRequest::instance();
-        $pm = ProjectManager::instance();
-        $project = $pm->getProject($request->get('group_id'));
+	function getTitle() {
+		return _('Latest News');
+	}
 
-        if ($project && $this->canBeUsedByProject($project)) {
-            require_once('www/news/news_utils.php');
-            $this->content = news_show_latest($request->get('group_id'),10,false);
-        }
-    }
-    function getTitle() {
-        return _('Latest News');
-    }
-    function getContent() {
-        return $this->content;
-    }
-    function isAvailable() {
-        return $this->content ? true : false;
-    }
-    function hasRss() {
-        return true;
-    }
-function displayRss() {
-        $request =& HTTPRequest::instance();
+	function getContent() {
+		return $this->content;
+	}
+
+	function isAvailable() {
+		return $this->content ? true : false;
+	}
+
+	function hasRss() {
+		return true;
+	}
+
+	function displayRss() {
+		$request =& HTTPRequest::instance();
 		$owner = $request->get('owner');
 		$group_id = (int)substr($owner, 1);
-//		$group_id = $request->get('group_id');
 		require_once 'www/export/rss_utils.inc';
 		rss_display_news($group_id, 10);
-    }
-    function canBeUsedByProject(&$project) {
-        return $project->usesNews();
-    }
-    function getDescription() {
-        return _('List the last 10 pieces of news posted by the project members.');
-    }
+	}
+
+	function canBeUsedByProject(&$project) {
+		return $project->usesNews();
+	}
+
+	function getDescription() {
+		return _('List the last 10 pieces of news posted by the project members.');
+	}
 }
 
 ?>

Modified: trunk/src/common/widget/Widget_ProjectMembers.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectMembers.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_ProjectMembers.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -28,9 +28,11 @@
 	public function __construct() {
 		$this->Widget('projectmembers');
 	}
+
 	public function getTitle() {
 		return _('Project Members');
 	}
+
 	public function getContent() {
 		$request =& HTTPRequest::instance();
 		$group_id = $request->get('group_id');
@@ -108,9 +110,11 @@
 			echo '<p>'.util_make_link ('/project/request.php?group_id='.$group_id,_('Request to join')).'</p>';
 		}
 	}
+
 	public function canBeUsedByProject(&$project) {
 		return true;
 	}
+
 	function getDescription() {
 		return _('List the project members.');
 	}

Modified: trunk/src/common/widget/Widget_ProjectPublicAreas.class.php
===================================================================
--- trunk/src/common/widget/Widget_ProjectPublicAreas.class.php	2012-07-08 12:39:00 UTC (rev 15965)
+++ trunk/src/common/widget/Widget_ProjectPublicAreas.class.php	2012-07-08 13:58:48 UTC (rev 15966)
@@ -23,13 +23,16 @@
 /**
  * Widget_ProjectPublicAreas
  */
+
 class Widget_ProjectPublicAreas extends Widget {
-	function Widget_ProjectPublicAreas() {
+	function __construct() {
 		$this->Widget('projectpublicareas');
 	}
+
 	function getTitle() {
 		return _('Public Areas');
 	}
+
 	function getContent() {
 		$request =& HTTPRequest::instance();
 		$group_id = $request->get('group_id');
@@ -212,14 +215,14 @@
 								//webcalendar
 								plugin_hook("cal_link_group",$group_id);
 	}
+
 	function canBeUsedByProject(&$project) {
 		return true;
 	}
+
 	function getDescription() {
 		return _('List all available services for this project along with some information next to it. Click on any of this item to access a service.<br />The role of this area is pretty much equivalent to the Project Main Menu at the top of the screen except that it shows additional information about each of the service (e.g. total number of open bugs, tasks, ...)');
 	}
-
-
 }
 
 ?>




More information about the Fusionforge-commits mailing list