[Fusionforge-commits] r11939 - in branches/Branch_5_1/src: common/include www/project/admin

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Jan 6 15:58:40 CET 2011


Author: lolando
Date: 2011-01-06 15:58:40 +0100 (Thu, 06 Jan 2011)
New Revision: 11939

Modified:
   branches/Branch_5_1/src/common/include/Group.class.php
   branches/Branch_5_1/src/www/project/admin/index.php
Log:
Merged from Evolvis (wui-tweaks branch): Allow picking project tags from the ones already defined on other projects

Modified: branches/Branch_5_1/src/common/include/Group.class.php
===================================================================
--- branches/Branch_5_1/src/common/include/Group.class.php	2011-01-06 14:58:24 UTC (rev 11938)
+++ branches/Branch_5_1/src/common/include/Group.class.php	2011-01-06 14:58:40 UTC (rev 11939)
@@ -3148,6 +3148,33 @@
 	}
 }
 
+function getAllProjectTags($onlyvisible = true) {
+	$res = db_query_params('SELECT project_tags.name, groups.group_id FROM groups, project_tags WHERE groups.group_id = project_tags.group_id AND groups.status = $1 ORDER BY project_tags.name, groups.group_id',
+			       array('A'));
+
+	if (!$res || db_numrows($res) == 0) {
+		return false;
+	}
+
+	$result = array();
+
+	while ($arr = db_fetch_array($res)) {
+		$tag = $arr[0];
+		$group_id = $arr[1];
+		if (!isset($result[$tag])) {
+			$result[$tag] = array();
+		}
+
+		if (!$only_visible || forge_check_perm('project_read', $group_id)) {
+			$p = group_get_object($group_id);
+			$result[$tag][] = array('unix_group_name' => $p->getUnixName(),
+						'group_id' => $group_id);
+		}
+	}
+
+	return $result;
+}
+
 class ProjectComparator {
 	var $criterion = 'name' ;
 

Modified: branches/Branch_5_1/src/www/project/admin/index.php
===================================================================
--- branches/Branch_5_1/src/www/project/admin/index.php	2011-01-06 14:58:24 UTC (rev 11938)
+++ branches/Branch_5_1/src/www/project/admin/index.php	2011-01-06 14:58:40 UTC (rev 11939)
@@ -66,9 +66,15 @@
 	$use_frs = getStringFromRequest('use_frs');
 	$use_stats = getStringFromRequest('use_stats');
 	$tags = getStringFromRequest('form_tags');
+	$addTags = getArrayFromRequest('addTags');
 	$is_public = getIntFromRequest('is_public');
 	$new_doc_address = getStringFromRequest('new_doc_address');
 	$send_all_docs = getStringFromRequest('send_all_docs');
+	
+	if (trim($tags) != "") {
+		$tags .= ",";
+	}
+	$tags .= implode(",", $addTags);
 
 	$res = $group->update(
 		session_get_user(),
@@ -144,11 +150,48 @@
 
 <?php if (forge_get_config('use_project_tags')) { ?>
 <p>
-<?php echo _('Tags (use comma as separator)') ?>:<br />
+<h2><?php echo _('Project tags'); ?></h2>
+<?php echo _('Add tags (use comma as separator): ') ?><br />
 <input type="text" name="form_tags" size="100" value="<?php echo $group->getTags(); ?>" />
-</p>
-<?php } ?>
+</p><br />
+<?php echo _('Or pick a tag from those used by other projects: ') ?><br />
+<?php 
+	 
+	 echo '<table width="100%"><thead><tr>';
+echo '<th>'._('Tags').'</th>';
+echo '<th>'._('Projects').'</th>';
+echo '</tr></thead><tbody>';
 
+$infos = getAllProjectTags();
+
+$unix_name = $group->getUnixName();
+foreach ($infos as $tag => $plist) {
+	$disabled = '';
+	$links = array();
+	foreach($plist as $project) {
+		$links[] = util_make_link('/projects/'.$project['unix_group_name'].'/',$project['unix_group_name']);
+		if ($project['group_id'] == $group_id) {
+			$disabled = ' disabled="disabled"';
+		}
+	}
+	
+	echo '<tr>';
+	echo '<td><input type="checkbox" name="addTags[]" value="'.$tag.'"'.$disabled.' /> ';
+	if ($disabled) {
+		echo '<s>'.$tag.'</s>';
+	} else {
+		echo $tag;
+	}
+	echo '</td>';
+	echo '<td>'.implode(' ', $links).'</td>' ;
+	echo '</tr>' ;
+}
+echo '</table>' ;
+
+
+
+} ?>
+
 <h2><?php echo _('Trove Categorization'); ?></h2>
 <p>
 <a href="/project/admin/group_trove.php?group_id=<?php echo $group->getID(); ?>">[<?php echo _('Edit Trove'); ?>]</a>




More information about the Fusionforge-commits mailing list