[Fusionforge-commits] r13586 - trunk/src/plugins/mantisbt/common

Franck VILLAUME nerville at fusionforge.org
Mon Jun 27 14:00:14 CEST 2011


Author: nerville
Date: 2011-06-27 14:00:14 +0200 (Mon, 27 Jun 2011)
New Revision: 13586

Added:
   trunk/src/plugins/mantisbt/common/mantisbt_Widget_ProjectLastIssues.class.php
Modified:
   trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
Log:
add skeleton for mantisbt widget

Modified: trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
===================================================================
--- trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-06-27 11:48:28 UTC (rev 13585)
+++ trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-06-27 12:00:14 UTC (rev 13586)
@@ -40,6 +40,8 @@
 		$this->_addHook('group_delete');
 		$this->_addHook('group_update');
 		$this->_addHook('site_admin_option_hook');
+		$this->_addHook('widget_instance', 'myPageBox', false);
+		$this->_addHook('widgets', 'widgets', false);
 	}
 
 	function CallHook($hookname, &$params) {
@@ -145,6 +147,20 @@
 				}
 				break;
 			}
+			case "widgets": {
+				$group = group_get_object($GLOBALS['group_id']);
+				if ($group->usesPlugin($this->name)) {
+					return $this->widgets($params);
+				}
+				break;
+			}
+			case "widget_instance": {
+				$group = group_get_object($GLOBALS['group_id']);
+				if ($group->usesPlugin($this->name)) {
+					return $this->myPageBox($params);
+				}
+				break;
+			}
 		}
 		return $returned;
 	}
@@ -620,6 +636,23 @@
 	function getAdminOptionLink() {
 		return util_make_link('/plugins/'.$this->name.'/?type=globaladmin&pluginname='.$this->name,_('Global MantisBT admin'));
 	}
+
+	function widgets($params) {
+ 		require_once('common/widget/WidgetLayoutManager.class.php');
+		if ($params['owner_type'] == WidgetLayoutManager::OWNER_TYPE_GROUP) {
+			$params['fusionforge_widgets'][] = 'plugin_mantisbt_project_latestissues';
+		}
+		return true;
+	}
+
+	function myPageBox($params) {
+		global $gfplugins;
+		require_once('common/widget/WidgetLayoutManager.class.php');
+		if ($params['widget'] == 'plugin_mantisbt_project_latestissues') {
+			require_once $gfplugins.$this->name.'/common/mantisbt_Widget_ProjectLastIssues.class.php';
+			$params['instance'] = new mantisbt_Widget_ProjectLastIssues($this);
+		}
+	}
 }
 // Local Variables:
 // mode: php

Added: trunk/src/plugins/mantisbt/common/mantisbt_Widget_ProjectLastIssues.class.php
===================================================================
--- trunk/src/plugins/mantisbt/common/mantisbt_Widget_ProjectLastIssues.class.php	                        (rev 0)
+++ trunk/src/plugins/mantisbt/common/mantisbt_Widget_ProjectLastIssues.class.php	2011-06-27 12:00:14 UTC (rev 13586)
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Copyright 2011, Franck Villaume - Capgemini
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. 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 Licence, or (at your option)
+ * any later version.
+ *
+ * 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
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+require_once('common/widget/Widget.class.php');
+require_once('common/widget/WidgetLayoutManager.class.php');
+
+class mantisBT_Widget_ProjectLastIssues extends Widget {
+	function mantisBT_Widget_ProjectLastIssues() {
+		$this->Widget('plugin_mantisbt_project_latestissues');
+	}
+
+	function getTitle() {
+		return _("MantisBT title");
+	}
+
+	function getCategory() {
+		return _('MantisBT');
+	}
+
+	function getDescription() {
+		return _("MantisBT description.");
+	}
+
+	function getContent() {
+		return '<div class="warning">'._('Not yet implemented').'</div>';
+	}
+}
+
+?>




More information about the Fusionforge-commits mailing list