[Fusionforge-commits] FusionForge branch master updated. 6.0.4-949-g9c7cd2c

Franck Villaume nerville at libremir.placard.fr.eu.org
Fri Sep 30 10:13:11 CEST 2016


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  9c7cd2ca65bbf32ff8a0e810054e414e264c2836 (commit)
       via  2749ce54f60213168e42f698a230461361eb1f9b (commit)
       via  a49a19b86ca9055ef1d773b767c534b43495e20d (commit)
       via  cee9ee675de653ba3302b9cc2c5ef1db5584bd3b (commit)
       via  03b68b65563ada49777f49a99f67838a8e0a080e (commit)
       via  63679b04b09618127ba5be56d69a917e268770fc (commit)
      from  eb8330790e58a1277495bb4f3d01922b306ef2e7 (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=9c7cd2ca65bbf32ff8a0e810054e414e264c2836

commit 9c7cd2ca65bbf32ff8a0e810054e414e264c2836
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Fri Sep 30 10:10:38 2016 +0200

    refactor util_gen_cross_ref

diff --git a/src/common/include/utils_crossref.php b/src/common/include/utils_crossref.php
index e5921b9..6e37c67 100644
--- a/src/common/include/utils_crossref.php
+++ b/src/common/include/utils_crossref.php
@@ -26,9 +26,6 @@ require_once $gfcommon.'docman/Document.class.php';
 
 function util_gen_cross_ref ($text, $group_id) {
 
-	// Some important information.
-	$prj = group_getunixname ($group_id);
-
 	// Handle URL in links, replace them with hyperlinks.
 	$text = util_make_links($text);
 
@@ -39,7 +36,7 @@ function util_gen_cross_ref ($text, $group_id) {
 	$text = preg_replace_callback('/\[\T(\d+)\]/', create_function('$matches', 'return _taskid2url($matches[1],'.$group_id.');'), $text);
 
 	// Handle [wiki:<pagename>] syntax
-	$text = preg_replace_callback('/\[wiki:(.*?)\]/', create_function('$matches', 'return _page2url('.$prj.',$matches[1]);'), $text);
+	$text = preg_replace_callback('/\[wiki:(.*?)\]/', create_function('$matches', 'return _page2url('.$group_id.',$matches[1]);'), $text);
 
 	// Handle FusionForge [forum:<thread_id>] Syntax => links to forum.
 	$text = preg_replace_callback('/\[forum:(\d+)\]/', create_function('$matches', 'return _forumid2url($matches[1]);'), $text);
@@ -49,7 +46,8 @@ function util_gen_cross_ref ($text, $group_id) {
 	return $text;
 }
 
-function _page2url($prj,$page) {
+function _page2url($group_id,$page) {
+	$prj = group_getunixname ($group_id);
 	return util_make_link('/wiki/g/'.$prj.'/'.rawurlencode($page), $page);
 }
 

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2749ce54f60213168e42f698a230461361eb1f9b

commit 2749ce54f60213168e42f698a230461361eb1f9b
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Fri Sep 30 10:02:07 2016 +0200

    docman: create constants

diff --git a/src/common/docman/include/constants.php b/src/common/docman/include/constants.php
new file mode 100644
index 0000000..7f9f0cb
--- /dev/null
+++ b/src/common/docman/include/constants.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * FusionForge Docman constants
+ *
+ * Copyright 2016, Franck Villaume - TrivialDev
+ *
+ * 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.
+ */
+
+define('DOCMAN__TITLE_MIN_SIZE', 5);
+define('DOCMAN__TITLE_MAX_SIZE', 255);
+define('DOCMAN__DESCRIPTION_MIN_SIZE', 10);
+define('DOCMAN__DESCRIPTION_MAX_SIZE', 255);
+define('DOCMAN__COMMENT_MAX_SIZE', 255);
+define('DOCMAN__INFAMOUS_USER_ID', 100);

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

commit a49a19b86ca9055ef1d773b767c534b43495e20d
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Fri Sep 30 10:01:36 2016 +0200

    Document: use same pattern for import data as in tracker module

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 0c6f05e..974d69a 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -34,6 +34,7 @@ require_once $gfcommon.'docman/DocumentStorage.class.php';
 require_once $gfcommon.'docman/DocumentVersion.class.php';
 require_once $gfcommon.'include/MonitorElement.class.php';
 require_once $gfcommon.'include/utils_crossref.php';
+require_once $gfcommon.'docman/include/constants.php';
 
 $DOCUMENT_OBJ = array();
 
@@ -129,36 +130,60 @@ class Document extends FFError {
 	/**
 	 * create - use this function to create a new entry in the database.
 	 *
-	 * @param	string	$filename		The filename of this document. Can be a URL.
-	 * @param	string	$filetype		The filetype of this document. If filename is URL, this should be 'URL';
-	 * @param	string	$data			The absolute path file itself.
-	 * @param	int	$doc_group		The doc_group id of the doc_groups table.
-	 * @param	string	$title			The title of this document.
-	 * @param	string	$description		The description of this document.
-	 * @param	int	$stateid		The state id of the document. At creation, cannot be deleted status.
-	 * @param	string	$vcomment		The comment of the new created version
-	 * @param	int	$createtimestamp	Timestamp of the creation of this document
+	 * @param	string	$filename	The filename of this document. Can be a URL.
+	 * @param	string	$filetype	The filetype of this document. If filename is URL, this should be 'URL';
+	 * @param	string	$data		The absolute path file itself.
+	 * @param	int	$doc_group	The doc_group id of the doc_groups table.
+	 * @param	string	$title		The title of this document.
+	 * @param	string	$description	The description of this document.
+	 * @param	int	$stateid	The state id of the document. At creation, cannot be deleted status.
+	 * @param	string	$vcomment	The comment of the new created version
+	 * @param	array	$importData	Array of data to change creator, time of creation, bypass permission check and do not send notification like:
+	 *					array('user' => 127, 'time' => 1234556789, 'nopermcheck' => 1, 'nonotice' => 1)
 	 * @return	bool	success.
 	 */
-	function create($filename, $filetype, $data, $doc_group, $title, $description, $stateid = 0, $vcomment = '', $createtimestamp = null) {
-		if (strlen($title) < 5) {
+	function create($filename, $filetype, $data, $doc_group, $title, $description, $stateid = 0, $vcomment = '', $importData = array()) {
+		if (strlen($title) < DOCMAN__TITLE_MIN_SIZE) {
 			$this->setError(_('Title Must Be At Least 5 Characters'));
 			return false;
 		}
-		if (strlen($description) < 10) {
+		if (strlen($description) < DOCMAN__DESCRIPTION_MIN_SIZE) {
 			$this->setError(_('Document Description Must Be At Least 10 Characters'));
 			return false;
 		}
 
-		$user_id = ((session_loggedin()) ? user_getid() : 100);
+		if (strlen($title) > DOCMAN__TITLE_MAX_SIZE) {
+			$this->setError(sprintf(_('Title Must Be Max %d Characters'), DOCMAN__TITLE_MAX_SIZE));
+			return false;
+		}
+
+		if (strlen($description) > DOCMAN__DESCRIPTION_MAX_SIZE) {
+			$this->setError(sprintf(_('Document Description Must Be Max %d Characters'), DOCMAN__DESCRIPTION_MAX_SIZE));
+			return false;
+		}
+
+		if (strlen($description) > DOCMAN__COMMENT_MAX_SIZE) {
+			$this->setError(sprintf(_('Document Comment Must Be Max %d Characters'), DOCMAN__COMMENT_MAX_SIZE));
+			return false;
+		}
+
+		if (isset($importData['user'])) {
+			$user_id = $importData['user'];
+		} else {
+			$user_id = ((session_loggedin()) ? user_getid() : DOCMAN__INFAMOUS_USER_ID);
+		}
 
-		$doc_initstatus = '3';
 		$perm =& $this->Group->getPermission();
-		if ($perm && is_object($perm) && $perm->isDocEditor()) {
-			if ($stateid && $stateid != 2) {
-				$doc_initstatus = $stateid;
-			} else {
-				$doc_initstatus = '1';
+		if (isset($importData['nopermcheck']) && $importData['nopermcheck']) {
+			$doc_initstatus = $stateid;
+		} else {
+			$doc_initstatus = '3';
+			if ($perm && is_object($perm) && $perm->isDocEditor()) {
+				if ($stateid && $stateid != 2) {
+					$doc_initstatus = $stateid;
+				} else {
+					$doc_initstatus = '1';
+				}
 			}
 		}
 
@@ -194,7 +219,7 @@ class Document extends FFError {
 		}
 
 		db_begin();
-		$createtimestamp = (($createtimestamp) ? $createtimestamp : time());
+		$createtimestamp = (isset($importData['time']))? $importData['time'] : time();
 		$result = db_query_params('INSERT INTO doc_data (group_id, createdate, doc_group, stateid)
 						VALUES ($1, $2, $3, $4)',
 						array($this->Group->getID(), $createtimestamp, $doc_group, $doc_initstatus));
@@ -237,7 +262,7 @@ class Document extends FFError {
 			return false;
 		}
 
-		if ($perm->isDocEditor()) {
+		if ($perm->isDocEditor() || (isset($importData['nopermcheck']) && $importData['nopermcheck'])) {
 			$localDg = documentgroup_get_object($doc_group, $this->Group->getID());
 			if (!$localDg->update($localDg->getName(), $localDg->getParentID(), 1, $localDg->getState(), $createtimestamp)) {
 				$this->setError(_('Error updating document group')._(': ').$localDg->getErrorMessage());
@@ -248,8 +273,10 @@ class Document extends FFError {
 				return false;
 			}
 		}
-		$this->sendNotice(true);
-		$this->sendApprovalNotice();
+		if (!isset($importData['nonotice'])) {
+			$this->sendNotice(true);
+			$this->sendApprovalNotice();
+		}
 		db_commit();
 		if ($filesize) {
 			DocumentStorage::instance()->commit();
@@ -800,36 +827,60 @@ class Document extends FFError {
 	 * @param	int	$version		The version to update. Default is 1.
 	 * @param	int	$current_version	Is the current version? default is 1.
 	 * @param	int	$new_version		To create a new version? default is 0. == No.
-	 * @param	int	$updatetimestamp	Timestamp of this update.
+	 * @param	array	$importData		Array of data to change creator, time of creation, bypass permission check and do not send notification like:
+	 *						array('user' => 127, 'time' => 1234556789, 'nopermcheck' => 1, 'nonotice' => 1)
 	 * @param	string	$vcomment		The comment of this version
 	 * @return	boolean	success.
 	 */
-	function update($filename, $filetype, $data, $doc_group, $title, $description, $stateid, $version = 1, $current_version = 1, $new_version = 0, $updatetimestamp = null, $vcomment = '') {
+	function update($filename, $filetype, $data, $doc_group, $title, $description, $stateid, $version = 1, $current_version = 1, $new_version = 0, $importData = array(), $vcomment = '') {
 
 		$perm =& $this->Group->getPermission();
-		if (!$perm || !is_object($perm) || !$perm->isDocEditor()) {
-			$this->setPermissionDeniedError();
+		if (!isset($importData['nopermcheck'])) {
+			if (!$perm || !is_object($perm) || !$perm->isDocEditor()) {
+				$this->setPermissionDeniedError();
+				return false;
+			}
+		}
+
+		if (isset($importData['user'])) {
+			$user = user_get_object($importData['user']);
+		} else {
+			$user = session_get_user();
+		}
+		if (!isset($importData['nopermcheck'])) {
+			if ($this->getLocked() && ($this->getLockedBy() != $user->getID())) {
+				$this->setPermissionDeniedError();
+				return false;
+			}
+		}
+
+		if (strlen($title) < DOCMAN__TITLE_MIN_SIZE) {
+			$this->setError(sprintf(_('Title Must Be At Least %d Characters'), DOCMAN__TITLE_MIN_SIZE));
 			return false;
 		}
 
-		$user = session_get_user();
-		if ($this->getLocked() && ($this->getLockedBy() != $user->getID())) {
-			$this->setPermissionDeniedError();
+		if (strlen($description) < DOCMAN__DESCRIPTION_MIN_SIZE) {
+			$this->setError(sprintf(_('Document Description Must Be At Least %d Characters'), DOCMAN__DESCRIPTION_MIN_SIZE));
 			return false;
 		}
 
-		if (strlen($title) < 5) {
-			$this->setError(_('Title Must Be At Least 5 Characters'));
+		if (strlen($title) > DOCMAN__TITLE_MAX_SIZE) {
+			$this->setError(sprintf(_('Title Must Be Max %d Characters'), DOCMAN__TITLE_MAX_SIZE));
 			return false;
 		}
 
-		if (strlen($description) < 10) {
-			$this->setError(_('Document Description Must Be At Least 10 Characters'));
+		if (strlen($description) > DOCMAN__DESCRIPTION_MAX_SIZE) {
+			$this->setError(sprintf(_('Document Description Must Be Max %d Characters'), DOCMAN__DESCRIPTION_MAX_SIZE));
+			return false;
+		}
+
+		if (strlen($description) > DOCMAN__COMMENT_MAX_SIZE) {
+			$this->setError(sprintf(_('Document Comment Must Be Max %d Characters'), DOCMAN__COMMENT_MAX_SIZE));
 			return false;
 		}
 
 		db_begin();
-		$updatetimestamp = (($updatetimestamp) ? $updatetimestamp : time());
+		$updatetimestamp = ((isset($importData['time'])) ? $importData['time'] : time());
 		$colArr = array('stateid', 'doc_group', 'updatedate', 'locked', 'locked_by');
 		$valArr = array($stateid, $doc_group, $updatetimestamp, 0, NULL);
 		if (!$this->setValueinDB($colArr, $valArr)) {
@@ -881,7 +932,7 @@ class Document extends FFError {
 			if (isset($kwords)) {
 				$version_kwords = $kwords;
 			}
-			$serial_id = $dv->create($this->getID(), $title, $description, user_getid(), $filetype, $filename, $filesize, $version_kwords, $updatetimestamp, $version, $current_version, $vcomment);
+			$serial_id = $dv->create($this->getID(), $title, $description, $user->getID(), $filetype, $filename, $filesize, $version_kwords, $updatetimestamp, $version, $current_version, $vcomment);
 			if (!$serial_id) {
 				$this->setOnUpdateError(_('Error updating document version')._(': ').$dv->getErrorMessage());
 				db_rollback();

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

commit cee9ee675de653ba3302b9cc2c5ef1db5584bd3b
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Fri Sep 30 10:00:49 2016 +0200

    less code & indent

diff --git a/src/common/tracker/Artifact.class.php b/src/common/tracker/Artifact.class.php
index 748cbf7..fdb964d 100644
--- a/src/common/tracker/Artifact.class.php
+++ b/src/common/tracker/Artifact.class.php
@@ -196,15 +196,11 @@ class Artifact extends FFError {
 				$user = $importData['user'];
 		} else {
 			if (!forge_check_perm ('tracker',$this->ArtifactType->getID(),'submit')) {
-					$this->setError(_('You are not currently allowed to submit items to this tracker.'));
-					return false;
+				$this->setError(_('You are not currently allowed to submit items to this tracker.'));
+				return false;
 			}
 
-			if (session_loggedin()) {
-				$user=user_getid();
-			} else {
-				$user=100;
-			}
+			$user_id = ((session_loggedin()) ? user_getid() : 100);
 		}
 
 		//
@@ -838,11 +834,7 @@ class Artifact extends FFError {
 		if (array_key_exists('user', $importData)){
 			$user = $importData['user'];
 		} else {
-			if (!session_loggedin()) {
-				$user=100;
-			} else {
-				$user=user_getid();
-			}
+			$user_id = ((session_loggedin()) ? user_getid() : 100);
 		}
 		if (array_key_exists('time',$importData)){
 			$time = $importData['time'];

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=03b68b65563ada49777f49a99f67838a8e0a080e

commit 03b68b65563ada49777f49a99f67838a8e0a080e
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Fri Sep 30 09:58:16 2016 +0200

    docman search: support document version

diff --git a/src/common/search/DocsSearchQuery.class.php b/src/common/search/DocsSearchQuery.class.php
index bee3eb5..40e7231 100644
--- a/src/common/search/DocsSearchQuery.class.php
+++ b/src/common/search/DocsSearchQuery.class.php
@@ -71,23 +71,23 @@ class DocsSearchQuery extends SearchQuery {
 		$params['options'] = $options;
 		plugin_hook_by_reference('docmansearch_has_hierarchy', $params);
 		if (count($params['groupIdArr'])) {
-			$qpa = db_construct_qpa($qpa, ' AND docdata_vw.group_id = ANY ($1) ', array(db_int_array_to_any_clause($params['groupIdArr'])));
+			$qpa = db_construct_qpa($qpa, ' AND doc_data.group_id = ANY ($1) ', array(db_int_array_to_any_clause($params['groupIdArr'])));
 		}
 		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)));
+			$qpa = db_construct_qpa($qpa, ' AND doc_data.doc_group = ANY ($1)', array(db_int_array_to_any_clause($sections)));
 		}
 		if ($this->showNonPublic) {
-			$qpa = db_construct_qpa($qpa, ' AND docdata_vw.stateid IN (1, 3, 4, 5)');
+			$qpa = db_construct_qpa($qpa, ' AND doc_data.stateid IN (1, 3, 4, 5)');
 		} else {
-			$qpa = db_construct_qpa($qpa, ' AND docdata_vw.stateid = 1 AND doc_groups.stateid = 1');
+			$qpa = db_construct_qpa($qpa, ' AND doc_data.stateid = 1 AND doc_groups.stateid = 1');
 		}
 
 		if (isset($options['date_begin']) && !isset($options['date_end'])) {
-			$qpa = db_construct_qpa($qpa, ' AND docdata_vw.createdate >= $1', array($options['date_begin']));
+			$qpa = db_construct_qpa($qpa, ' AND doc_data_version.createdate >= $1', array($options['date_begin']));
 		} elseif (!isset($options['date_begin']) && isset($options['date_end'])) {
-			$qpa = db_construct_qpa($qpa, ' AND docdata_vw.createdate <= $1', array($options['date_end']));
+			$qpa = db_construct_qpa($qpa, ' AND doc_data_version.createdate <= $1', array($options['date_end']));
 		} elseif (isset($options['date_begin']) && isset($options['date_end'])) {
-			$qpa = db_construct_qpa($qpa, ' AND docdata_vw.createdate between $1 and $2', array($options['date_begin'], $options['date_end']));
+			$qpa = db_construct_qpa($qpa, ' AND doc_data_version.createdate between $1 and $2', array($options['date_begin'], $options['date_end']));
 		}
 		return $qpa;
 	}
@@ -101,10 +101,10 @@ class DocsSearchQuery extends SearchQuery {
 		$words = $this->getFTIwords();
 		$options = $this->options;
 		if (!isset($options['insideDocuments']) || !$options['insideDocuments']) {
-			$qpa = db_construct_qpa(false, 'SELECT x.* FROM (SELECT docdata_vw.docid, docdata_vw.group_id AS group_id, docdata_vw.filename, ts_headline(docdata_vw.title, q) AS title, ts_headline(docdata_vw.description, q) AS description, doc_groups.groupname, docdata_vw.title||$1||description AS full_string_agg, doc_data_idx.vectors, groups.group_name as project_name FROM groups, docdata_vw, doc_groups, doc_data_idx, to_tsquery($2) AS q WHERE docdata_vw.doc_group = doc_groups.doc_group AND docdata_vw.group_id = groups.group_id AND docdata_vw.docid = doc_data_idx.docid AND (vectors @@ to_tsquery($2))',
+			$qpa = db_construct_qpa(false, 'SELECT x.* FROM (SELECT doc_data_idx.version, doc_data.docid, doc_data.group_id AS group_id, doc_data_version.filename, ts_headline(doc_data_version.title, q) AS title, ts_headline(doc_data_version.description, q) AS description, doc_groups.groupname, doc_data_version.title||$1||doc_data_version.description AS full_string_agg, doc_data_idx.vectors, doc_data_idx.version, groups.group_name as project_name FROM groups, doc_groups, doc_data_idx, doc_data_version, doc_data, to_tsquery($2) AS q WHERE doc_data.group_id = groups.group_id AND doc_data_version.docid = doc_data_idx.docid AND (vectors @@ to_tsquery($2)) AND doc_data.docid = doc_data_version.docid AND doc_data.doc_group = doc_groups.doc_group AND doc_data_version.version = doc_data_idx.version',
 					array ($this->field_separator, $words));
 		} else {
-			$qpa = db_construct_qpa(false, 'SELECT x.* FROM (SELECT docdata_vw.docid, docdata_vw.group_id AS group_id, ts_headline(docdata_vw.filename, q) AS filename, ts_headline(docdata_vw.title, q) AS title, ts_headline(docdata_vw.description, q) AS description, doc_groups.groupname, docdata_vw.title||$1||description||$1||filename AS full_string_agg, doc_data_words_idx.vectors, groups.group_name as project_name FROM groups, docdata_vw, doc_groups, doc_data_words_idx, to_tsquery($2) AS q WHERE docdata_vw.doc_group = doc_groups.doc_group AND docdata_vw.group_id = groups.group_id AND docdata_vw.docid = doc_data_words_idx.docid AND (vectors @@ to_tsquery($2))',
+			$qpa = db_construct_qpa(false, 'SELECT x.* FROM (SELECT doc_data_words_idx.version, doc_data.docid, doc_data.group_id AS group_id, ts_headline(doc_data_version.filename, q) AS filename, ts_headline(doc_data_version.title, q) AS title, ts_headline(doc_data_version.description, q) AS description, doc_groups.groupname, doc_data_version.title||$1||doc_data_version.description||$1||doc_data_version.filename AS full_string_agg, doc_data_words_idx.vectors, groups.group_name as project_name FROM groups, doc_groups, doc_data_words_idx, doc_data, doc_data_version, to_tsquery($2) AS q WHERE doc_data.group_id = groups.group_id AND doc_data_version.docid = doc_data_words_idx.docid AND (vectors @@ to_tsquery($2)) AND doc_data.docid = doc_data_version.docid AND doc_data_version.version = doc_data_words_idx.version AND doc_data.doc_group = doc_groups.doc_group',
 					array ($this->field_separator, $words));
 		}
 		$qpa = $this->addCommonQPA($qpa);
diff --git a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
index eecff0f..53f540f 100644
--- a/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
+++ b/src/www/search/include/renderers/DocsHtmlSearchRenderer.class.php
@@ -4,7 +4,7 @@
  *
  * Copyright 2004 (c) Dominik Haas, GForge Team
  * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2013,2015 Franck Villaume - TrivialDev
+ * Copyright 2013,2015-2016 Franck Villaume - TrivialDev
  * Copyright 2013, French Ministry of National Education
  * http://fusionforge.org
  *
@@ -47,7 +47,9 @@ class DocsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
 
 		$this->tableHeaders = array(
 			_('Directory'),
-			_(' '),
+			' ',
+			_('Filename'),
+			_('Version'),
 			_('Title'),
 			_('Description'),
 			_('Actions')
@@ -122,10 +124,13 @@ class DocsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
 			if ($document->isURL()) {
 				$cells[][] = util_make_link($document->getFileName(), html_image($document->getFileTypeImage(), 22, 22), array('title' => _('Visit this link')), true);
 			} else {
-				$cells[][] = util_make_link('/docman/view.php/'.$document->Group->getID().'/'.$document->getID().'/'.urlencode($document->getFileName()), html_image($document->getFileTypeImage(), 22, 22), array('title' => _('View this document')));
+				$cells[][] = util_make_link('/docman/view.php/'.$document->Group->getID().'/versions/'.$document->getID().'/'.$row['version'], html_image($document->getFileTypeImage(), 22, 22), array('title' => _('View this document')));
 			}
+			$cells[][] = $row['filename'];
+			$cells[][] = $row['version'];
 			$cells[][] = $row['title'];
-			$cells[][] = $row['description'];
+			// we call util_gen_cross_ref on top of row['description'] to keep the search engine mark
+			$cells[][] = util_gen_cross_ref($row['description'], $document->Group->getID());
 			if (forge_check_perm('docman', $document->Group->getID(), 'approve')) {
 				if (!$document->getLocked() && !$document->getReserved()) {
 					$cells[][] = util_make_link('/docman/?group_id='.$document->Group->getID().'&view=listfile&dirid='.$document->getDocGroupID().'&filedetailid='.$document->getID(), $HTML->getEditFilePic(_('Edit this document')), array('title' => _('Edit this document')));

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=63679b04b09618127ba5be56d69a917e268770fc

commit 63679b04b09618127ba5be56d69a917e268770fc
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Fri Sep 30 09:55:27 2016 +0200

    encode search string

diff --git a/src/common/docman/views/search.php b/src/common/docman/views/search.php
index 11ad87b..fa1ce0e 100644
--- a/src/common/docman/views/search.php
+++ b/src/common/docman/views/search.php
@@ -179,8 +179,8 @@ if ($searchString) {
 	$result = $docsHtmlSearchRenderer->searchQuery->getData($docsHtmlSearchRenderer->searchQuery->getRowsPerPage(),$docsHtmlSearchRenderer->searchQuery->getOffset());
 	$nbDocs = count($result);
 	$max = $docsHtmlSearchRenderer->searchQuery->getRowsTotalCount();
-	echo $HTML->paging_top($start, $paging, $max, $nbDocs, $redirect_url.'&view=search&textsearch='.$searchString.'&insideDocuments='.$insideDocuments.'&search_type='.$search_type.'&includesubprojects='.$subprojectsIncluded.'&limitByStartDate='.$limitByStartDate.'&limitByEndDate='.$limitByEndDate.'&start_date='.$received_begin.'&end_date='.$received_end);
+	echo $HTML->paging_top($start, $paging, $max, $nbDocs, $redirect_url.'&view=search&textsearch='.urlencode($searchString).'&insideDocuments='.$insideDocuments.'&search_type='.$search_type.'&includesubprojects='.$subprojectsIncluded.'&limitByStartDate='.$limitByStartDate.'&limitByEndDate='.$limitByEndDate.'&start_date='.$received_begin.'&end_date='.$received_end);
 	$docsHtmlSearchRenderer->writeBody(false);
-	echo $HTML->paging_bottom($start, $paging, $max, $redirect_url.'&view=search&textsearch='.$searchString.'&insideDocuments='.$insideDocuments.'&search_type='.$search_type.'&includesubprojects='.$subprojectsIncluded.'&limitByStartDate='.$limitByStartDate.'&limitByEndDate='.$limitByEndDate.'&start_date='.$received_begin.'&end_date='.$received_end);
+	echo $HTML->paging_bottom($start, $paging, $max, $redirect_url.'&view=search&textsearch='.urlencode($searchString).'&insideDocuments='.$insideDocuments.'&search_type='.$search_type.'&includesubprojects='.$subprojectsIncluded.'&limitByStartDate='.$limitByStartDate.'&limitByEndDate='.$limitByEndDate.'&start_date='.$received_begin.'&end_date='.$received_end);
 }
 echo html_ac(html_ap() -2);

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

Summary of changes:
 src/common/docman/Document.class.php               | 123 +++++++++++++++------
 .../docman/include/constants.php}                  |  15 +--
 src/common/docman/views/search.php                 |   4 +-
 src/common/include/utils_crossref.php              |   8 +-
 src/common/search/DocsSearchQuery.class.php        |  18 +--
 src/common/tracker/Artifact.class.php              |  16 +--
 .../renderers/DocsHtmlSearchRenderer.class.php     |  13 ++-
 7 files changed, 122 insertions(+), 75 deletions(-)
 copy src/{plugins/mantisbt/view/admin/StatPerMember.php => common/docman/include/constants.php} (70%)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list