[Fusionforge-commits] FusionForge branch master updated. v6.0.3-285-gdedd0e2

Franck Villaume nerville at libremir.placard.fr.eu.org
Mon Dec 14 22:58:35 CET 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  dedd0e269383fe39f2fede8860b3bc9970b7e220 (commit)
      from  edc34eff6bdde4254171ac16415746899ffd19ae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=dedd0e269383fe39f2fede8860b3bc9970b7e220

commit dedd0e269383fe39f2fede8860b3bc9970b7e220
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Mon Dec 14 22:58:00 2015 +0100

    docman search engine: support projects-hierarchy

diff --git a/src/common/search/DocsSearchQuery.class.php b/src/common/search/DocsSearchQuery.class.php
index 9721e1a..854a617 100644
--- a/src/common/search/DocsSearchQuery.class.php
+++ b/src/common/search/DocsSearchQuery.class.php
@@ -68,11 +68,16 @@ class DocsSearchQuery extends SearchQuery {
 	 */
 	function addCommonQPA($qpa) {
 		$options = $this->options;
-		if (count($this->groupIdArr)) {
-			$qpa = db_construct_qpa($qpa, ' AND doc_data.group_id = ANY ($1) ', array(db_int_array_to_any_clause($this->groupIdArr)));
+		$groupIdArr = $this->groupIdArr;
+		$sections = $this->sections;
+		$params['groupIdArr'] = $this->groupIdArr;
+		$params['options'] = $options;
+		plugin_hook_by_reference('docmansearch_has_hierarchy', $params);
+		if (count($params['groupIdArr'])) {
+			$qpa = db_construct_qpa($qpa, ' AND doc_data.group_id = ANY ($1) ', array(db_int_array_to_any_clause($params['groupIdArr'])));
 		}
-		if ($this->sections != SEARCH__ALL_SECTIONS) {
-			$qpa = db_construct_qpa($qpa, ' AND doc_groups.doc_group = ANY ($1)', array(db_int_array_to_any_clause($this->sections)));
+		if ($sections != SEARCH__ALL_SECTIONS) {
+			$qpa = db_construct_qpa($qpa, ' AND doc_groups.doc_group = ANY ($1)', array(db_int_array_to_any_clause($sections)));
 		}
 		if ($this->showNonPublic) {
 			$qpa = db_construct_qpa($qpa, ' AND doc_data.stateid IN (1, 4, 5)') ;
@@ -102,11 +107,11 @@ class DocsSearchQuery extends SearchQuery {
 			$options = $this->options;
 			if (!isset($options['insideDocuments']) || !$options['insideDocuments']) {
 				$qpa = db_construct_qpa(false,
-						 'SELECT x.* FROM (SELECT doc_data.docid, doc_data.title, doc_data.filename, doc_data.description, doc_groups.groupname, title||$1||description AS full_string_agg, groups.group_name as project_name FROM doc_data, doc_groups, groups WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id ',
+						 'SELECT x.* FROM (SELECT doc_data.docid, doc_data.group_id AS group_id, doc_data.title, doc_data.filename, doc_data.description, doc_groups.groupname, title||$1||description AS full_string_agg, groups.group_name as project_name FROM doc_data, doc_groups, groups WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id ',
 						 array ($this->field_separator));
 			} else {
 				$qpa = db_construct_qpa(false,
-						 'SELECT x.* FROM (SELECT doc_data.docid, doc_data.title, doc_data.filename, doc_data.description, doc_groups.groupname, title||$1||description||$1||data_words AS full_string_agg, groups.group_name as project_name FROM doc_data, doc_groups, groups WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id ',
+						 'SELECT x.* FROM (SELECT doc_data.docid, doc_data.group_id AS group_id, doc_data.title, doc_data.filename, doc_data.description, doc_groups.groupname, title||$1||description||$1||data_words AS full_string_agg, groups.group_name as project_name FROM doc_data, doc_groups, groups WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id ',
 						 array ($this->field_separator));
 			}
 			$qpa = $this->addCommonQPA($qpa);
@@ -122,11 +127,11 @@ class DocsSearchQuery extends SearchQuery {
 		$options = $this->options;
 		if (!isset($options['insideDocuments']) || !$options['insideDocuments']) {
 			$qpa = db_construct_qpa(false,
-					'SELECT x.* FROM (SELECT doc_data.docid, doc_data.filename, ts_headline(doc_data.title, q) AS title, ts_headline(doc_data.description, q) AS description, doc_groups.groupname, doc_data.title||$1||description AS full_string_agg, doc_data_idx.vectors, groups.group_name as project_name FROM groups, doc_data, doc_groups, doc_data_idx, to_tsquery($2) AS q WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id AND doc_data.docid = doc_data_idx.docid AND (vectors @@ to_tsquery($2))',
+					'SELECT x.* FROM (SELECT doc_data.docid, doc_data.group_id AS group_id, doc_data.filename, ts_headline(doc_data.title, q) AS title, ts_headline(doc_data.description, q) AS description, doc_groups.groupname, doc_data.title||$1||description AS full_string_agg, doc_data_idx.vectors, groups.group_name as project_name FROM groups, doc_data, doc_groups, doc_data_idx, to_tsquery($2) AS q WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id AND doc_data.docid = doc_data_idx.docid AND (vectors @@ to_tsquery($2))',
 					array ($this->field_separator, $words));
 		} else {
 			$qpa = db_construct_qpa(false,
-					'SELECT x.* FROM (SELECT doc_data.docid, ts_headline(doc_data.filename, q) AS filename, ts_headline(doc_data.title, q) AS title, ts_headline(doc_data.description, q) AS description, doc_groups.groupname, doc_data.title||$1||description||$1||filename AS full_string_agg, doc_data_words_idx.vectors, groups.group_name as project_name FROM groups, doc_data, doc_groups, doc_data_words_idx, to_tsquery($2) AS q WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id AND doc_data.docid = doc_data_words_idx.docid AND (vectors @@ to_tsquery($2))',
+					'SELECT x.* FROM (SELECT doc_data.docid, doc_data.group_id AS group_id, ts_headline(doc_data.filename, q) AS filename, ts_headline(doc_data.title, q) AS title, ts_headline(doc_data.description, q) AS description, doc_groups.groupname, doc_data.title||$1||description||$1||filename AS full_string_agg, doc_data_words_idx.vectors, groups.group_name as project_name FROM groups, doc_data, doc_groups, doc_data_words_idx, to_tsquery($2) AS q WHERE doc_data.doc_group = doc_groups.doc_group AND doc_data.group_id = groups.group_id AND doc_data.docid = doc_data_words_idx.docid AND (vectors @@ to_tsquery($2))',
 					array ($this->field_separator, $words));
 		}
 		$qpa = $this->addCommonQPA($qpa);
@@ -136,7 +141,7 @@ class DocsSearchQuery extends SearchQuery {
 			$qpa = $this->addMatchCondition($qpa, 'full_string_agg');
 		}
 		$qpa = db_construct_qpa($qpa,
-					 ' ORDER BY ts_rank(vectors, to_tsquery($1)) DESC, groupname ASC, title ASC',
+					 ' ORDER BY ts_rank(vectors, to_tsquery($1)) DESC, group_id ASC, groupname ASC, title ASC',
 					 array($words));
 
 		return $qpa;
diff --git a/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php b/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php
index 83c28b5..2e0eb86 100644
--- a/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php
+++ b/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php
@@ -4,7 +4,7 @@
  *
  * Copyright 2006 (c) Fabien Regnier - Sogeti
  * Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2012-2014, Franck Villaume - TrivialDev
+ * Copyright 2012-2015, Franck Villaume - TrivialDev
  * Copyright 2013, French Ministry of National Education
  * http://fusionforge.org
  *
@@ -126,15 +126,15 @@ _('Organise projects hierarchically, relation type 1-n');
 				break;
 			}
 			case 'docmansearch_has_hierarchy': {
-				if ($params['includesubprojects']) {
-					$group_id = $params['group_id'];
-					$group = group_get_object($group_id);
-					if ($group->usesPlugin($this->name)) {
-						$arrayChilds= $this->getFamily($group_id, 'child', true, 'validated');
-						foreach ( $arrayChilds as $childId ) {
-							$params['qpa'] = db_construct_qpa($params['qpa'], ' OR group_id = $1', array($childId));
+				if (isset($params['options']['includesubprojects']) && $params['options']['includesubprojects']) {
+					$added_groupid = array();
+					foreach ($params['groupIdArr'] as $param_groupid) {
+						$group = group_get_object($param_groupid);
+						if ($group->usesPlugin($this->name)) {
+							$added_groupid = array_merge($this->getFamily($param_groupid, 'child', true, 'validated'), $added_groupid);
 						}
 					}
+					$params['groupIdArr'] = array_merge($params['groupIdArr'], $added_groupid);
 				}
 				$returned = true;
 				break;
diff --git a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
index 27e7ed1..8410156 100644
--- a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
+++ b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
@@ -81,8 +81,15 @@ class DocsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
 			$currentDocGroup = documentgroup_get_object($document->getDocGroupID());
 			//section changed
 			if ($lastDocGroupID != $currentDocGroup->getID()) {
-				$return .= '<tr><td colspan="4">'.html_image('ic/folder.png', 22, 22, array('border' => '0')).$currentDocGroup->getPath(true).'</td></tr>';
+				//project changed
+				$content = '';
+				if ($this->groupId != $currentDocGroup->Group->getID()) {
+					$content = _('Project')._(': ').util_make_link('/docman/?group_id='.$currentDocGroup->Group->getID(),$currentDocGroup->Group->getPublicName()).' ';
+				}
+				$cells = array();
+				$cells[] = array($content.html_image('ic/folder.png', 22, 22, array('border' => '0')).$currentDocGroup->getPath(true), 'colspan' => 4);
 				$lastDocGroupID = $currentDocGroup->getID();
+				$return .= $HTML->multiTableRow(array(), $cells);
 				$rowColor = 0;
 			}
 			$cells = array();

-----------------------------------------------------------------------

Summary of changes:
 src/common/search/DocsSearchQuery.class.php        | 23 +++++++++++++---------
 .../common/projects-hierarchyPlugin.class.php      | 16 +++++++--------
 .../renderers/DocsHtmlSearchRenderer.class.php     |  9 ++++++++-
 3 files changed, 30 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list