[Fusionforge-commits] r13682 - in trunk/src: plugins/quota_management/common www/project/admin

Franck VILLAUME nerville at fusionforge.org
Tue Jul 5 10:50:23 CEST 2011


Author: nerville
Date: 2011-07-05 10:50:23 +0200 (Tue, 05 Jul 2011)
New Revision: 13682

Modified:
   trunk/src/plugins/quota_management/common/quota_managementPlugin.class.php
   trunk/src/www/project/admin/project_admin_utils.php
Log:
reorg submenu & implement correctly groupadminmenu hook

Modified: trunk/src/plugins/quota_management/common/quota_managementPlugin.class.php
===================================================================
--- trunk/src/plugins/quota_management/common/quota_managementPlugin.class.php	2011-07-05 07:49:05 UTC (rev 13681)
+++ trunk/src/plugins/quota_management/common/quota_managementPlugin.class.php	2011-07-05 08:50:23 UTC (rev 13682)
@@ -34,32 +34,41 @@
 		$this->_addHook('userisactivecheckboxpost'); //
 		$this->_addHook('project_admin_plugins'); // to show up in the admin page fro group
 		$this->_addHook('site_admin_option_hook'); // to show in admin
-		$this->_addHook('quota_label_project_admin'); // to show in admin project
-		$this->_addHook('quota_link_project_admin'); // to show in admin project
+		$this->_addHook('groupadminmenu');
 	}
 
 	function CallHook($hookname, &$params) {
 		global $use_quota_managementplugin, $G_SESSION, $HTML;
-		if ($hookname == "project_admin_plugins") {
-			// this displays the link in the project admin options page to it's  quota_management administration
-			$group_id = $params['group_id'];
-			$group = &group_get_object($group_id);
-			if ( $group->usesPlugin($this->name)) {
-				echo util_make_link('/plugins/quota_management/index.php?id='.$group->getID().'&type=admin&pluginname='.$this->name,
-						     _('View the quota_management Administration')
-					) ;
-				echo '<br />';
+		$returned = false;
+		switch ($hookname) {
+			case "project_admin_plugins": {
+				// this displays the link in the project admin options page to it's  quota_management administration
+				$group_id = $params['group_id'];
+				$group = &group_get_object($group_id);
+				if ( $group->usesPlugin($this->name)) {
+					echo util_make_link('/plugins/quota_management/index.php?id='.$group->getID().'&type=admin&pluginname='.$this->name,
+							_('View the quota_management Administration')
+						) ;
+					echo '<br />';
+				}
+				$returned = true;
+				break;
 			}
-		} elseif ($hookname == "site_admin_option_hook") {
-			echo '<li>'.$this->getAdminOptionLink().'</li>';
-		} elseif ($hookname == "quota_label_project_admin") {
-			// www/project/admin/project_admin_utils.php line 80
-			$labels[] = _('Quota');
-		} elseif ($hookname == "quota_link_project_admin") {
-			// www/project/admin/project_admin_utils.php line 99
-			$group_id=$params['group'];
-			$links[] = '/plugins/quota_management/quota.php?group_id='.$group_id;
+			case "site_admin_option_hook": {
+				echo '<li>'.$this->getAdminOptionLink().'</li>';
+				$returned = true;
+				break;
+			}
+			case "groupadminmenu": {
+				$params['labels'][] = _ ('Quota');
+				$group_id = $params['group'];
+				$params['links'][] = '/plugins/quota_management/index.php?id='.$group_id.'&type=admin&pluginname='.$this->name;
+				$params['attr_r'][] = array('class' => 'tabtitle', 'title' => _('View the quota_management Administration'));
+				$returned = true;
+				break;
+			}
 		}
+		return $returned;
 	}
 
 	function getAdminOptionLink() {

Modified: trunk/src/www/project/admin/project_admin_utils.php
===================================================================
--- trunk/src/www/project/admin/project_admin_utils.php	2011-07-05 07:49:05 UTC (rev 13681)
+++ trunk/src/www/project/admin/project_admin_utils.php	2011-07-05 08:50:23 UTC (rev 13682)
@@ -29,12 +29,12 @@
 */
 
 function project_admin_header($params) {
-	global $group_id,$feedback,$HTML;
+	global $group_id, $feedback, $HTML;
 
-	$params['toptab']='admin';
-	$params['group']=$group_id;
+	$params['toptab'] = 'admin';
+	$params['group'] = $group_id;
 
-	session_require_perm ('project_admin', $group_id) ;
+	session_require_perm('project_admin', $group_id);
 
 	$project = group_get_object($group_id);
 	if (!$project || !is_object($project)) {
@@ -47,64 +47,59 @@
 
 	$labels[] = _('Project Information');
 	$attr_r[] = array('class' => 'tabtitle', 'title' => _('General information about project. Tag, trove list, description.'));
+	$links[] = '/project/admin/?group_id='.$group_id;
+
 	$labels[] = _('Users and permissions');
 	$attr_r[] = array('class' => 'tabtitle', 'title' => _('Permissions management. Edit / Create roles. Assign new permissions to user. Add / Remove member.'));
+	$links[] = '/project/admin/users.php?group_id='.$group_id;
+
 	$labels[] = _('Tools');
 	$attr_r[] = array('class' => 'tabtitle', 'title' => _('Activate / Desactivate extensions like docman, forums, plugins.'));
+	$links[] = '/project/admin/tools.php?group_id='.$group_id;
+
 	$labels[] = _('Project History');
 	$attr_r[] = array('class' => 'tabtitle', 'title' => _('Show the significant change of your project.'));
+	$links[] = '/project/admin/history.php?group_id='.$group_id;
+
 	if(forge_get_config('use_people')) {
 		$labels[] = _('Post Jobs');
 		$attr_r[] = array('class' => 'tabtitle', 'title' => _('Hiring new people. Describe the job'));
+		$links[] = '/people/createjob.php?group_id='.$group_id;
 		$labels[] = _('Edit Jobs');
 		$attr_r[] = array('class' => 'tabtitle', 'title' => _('Edit already created available position in your project.'));
+		$links[] = '/people/?group_id='.$group_id;
 	}
+
 	if(forge_get_config('use_project_multimedia')) {
 		$labels[] = _('Edit Multimedia Data');
 		//TODO: set the title.
 		$attr_r[] = array('class' => 'tabtitle', 'title' => _(''));
+		$links[] = '/project/admin/editimages.php?group_id='.$group_id;
 	}
 	if(forge_get_config('use_project_vhost')) {
 		$labels[] = _('VHOSTs');
 		//TODO: set the title.
 		$attr_r[] = array('class' => 'tabtitle', 'title' => _(''));
+		$links[] = '/project/admin/vhost.php?group_id='.$group_id;
 	}
 	if(forge_get_config('use_project_database')) {
 		$labels[] = _('Database Admin');
 		//TODO: set the title.
 		$attr_r[] = array('class' => 'tabtitle', 'title' => _(''));
+		$links[] = '/project/admin/database.php?group_id='.$group_id;
 	}
 	if ($project->usesStats()) {
 		$labels[] = _('Stats');
 		//TODO: set the title.
 		$attr_r[] = array('class' => 'tabtitle', 'title' => _(''));
+		$links[] = '/project/stats/?group_id='.$group_id;
 	}
-	plugin_hook("quota_label_project_admin");
 
-	$links[] = '/project/admin/?group_id='.$group_id;
-	$links[] = '/project/admin/users.php?group_id='.$group_id;
-	$links[] = '/project/admin/tools.php?group_id='.$group_id;
-	$links[] = '/project/admin/history.php?group_id='.$group_id;
-	if(forge_get_config('use_people')) {
-		$links[] = '/people/createjob.php?group_id='.$group_id;
-		$links[] = '/people/?group_id='.$group_id;
-	}
-	if(forge_get_config('use_project_multimedia')) {
-		$links[] = '/project/admin/editimages.php?group_id='.$group_id;
-	}
-	if(forge_get_config('use_project_vhost')) {
-		$links[] = '/project/admin/vhost.php?group_id='.$group_id;
-	}
-	if(forge_get_config('use_project_database')) {
-		$links[] = '/project/admin/database.php?group_id='.$group_id;
-	}
-	$links[] = '/project/stats/?group_id='.$group_id;
-	plugin_hook("quota_link_project_admin");
-
-	$params['submenu'] = $HTML->subMenu($labels, $links, $attr_r);
-
+	$params['labels'] =& $labels;
+	$params['links'] =& $links;
+	$params['attr_r'] =& $attr_r;
 	plugin_hook("groupadminmenu", $params);
-
+	$params['submenu'] = $HTML->subMenu($params['labels'], $params['links'], $params['attr_r']);
 	site_project_header($params);
 }
 




More information about the Fusionforge-commits mailing list