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 81f8ce9510b5827382dbcdeff9e9201bb0c36e93 (commit)
from 6a0a69204fbf3416f499065721d31783a07dc19c (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=81f8ce9510b5827382dbcdeff9e9201bb0c36e93
commit 81f8ce9510b5827382dbcdeff9e9201bb0c36e93
Author: Franck Villaume <[email protected]>
Date: Sat Sep 19 12:18:39 2015 +0200
implement [#794]: docman, limit number of results in search query
diff --git a/src/CHANGES b/src/CHANGES
index edd8c5f..0b7d6f5 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -1,5 +1,6 @@
FusionForge 6.X:
* Spellcheck (Anders Jonsson)
+* Docman: limit number of found documents on search query [#794] (TrivialDev)
Fusionforge 6.0.3:
* Layout: fix rss url when url is absolute (TrivialDev)
diff --git a/src/common/docman/views/search.php
b/src/common/docman/views/search.php
index 33b7ac4..bd364be 100644
--- a/src/common/docman/views/search.php
+++ b/src/common/docman/views/search.php
@@ -7,7 +7,7 @@
* Copyright 2005, Fabio Bertagnin
* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
- * Copyright 2012-2014, Franck Villaume - TrivialDev
+ * Copyright 2012-2015, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
@@ -37,16 +37,17 @@ if (!forge_check_perm('docman', $group_id, 'read')) {
}
$is_editor = forge_check_perm('docman', $g->getID(), 'approve');
-$searchString = trim(getStringFromPost("textsearch"));
+$searchString = trim(getStringFromPost('textsearch'));
$insideDocuments = getStringFromPost('insideDocuments');
$subprojectsIncluded = getStringFromPost('includesubprojects');
-$allchecked = "";
-$onechecked = "";
-$insideDocumentsCheckbox = "";
+$limitNbSearchDocs = getStringFromPost('limitNbSearchDocs');
+$allchecked = '';
+$onechecked = '';
+$insideDocumentsCheckbox = '';
$attrsInputSearchAll = array('type' => 'radio', 'name' => 'search_type',
'required' => 'required', 'value' => 'all', 'title' => _('All searched words
are mandatory'));
$attrsInputSearchOne = array('type' => 'radio', 'name' => 'search_type',
'required' => 'required', 'value' => 'one', 'title' => _('At least one word
must be found'));
-if (getStringFromPost('search_type') == "one") {
+if (getStringFromPost('search_type') == 'one') {
$attrsInputSearchOne['checked'] = 'checked';
} else {
$attrsInputSearchAll['checked'] = 'checked';
@@ -78,6 +79,7 @@ if (isset($projectIDsArray) && is_array($projectIDsArray)) {
$attrsInputIncludeSubprojects['checked'] = 'checked';
echo html_e('input', $attrsInputIncludeSubprojects)._('Include child
projects');
}
+echo html_e('p', array(), _('limit search results
to').html_build_select_box_from_array(array(_('All'), '10', '25', '50', '100'),
'limitNbSearchDocs', _('All'), 1)._('documents'));
echo $HTML->addRequiredFieldsInfoBox();
echo $HTML->closeForm();
echo html_ac(html_ap() - 1);
@@ -85,7 +87,7 @@ echo html_ao('div', array('id' =>
'docman_search_query_result'));
if ($searchString) {
$mots = preg_split("/[\s,]+/",$searchString);
$qpa = db_construct_qpa(false, 'SELECT filename, filetype, docid,
doc_data.stateid as stateid, doc_states.name as statename, title, description,
createdate, updatedate, doc_group, group_id FROM doc_data, doc_states WHERE
doc_data.stateid = doc_states.stateid');
- if (getStringFromPost('search_type') == "one") {
+ if (getStringFromPost('search_type') == 'one') {
if (count($mots) > 0) {
$qpa = db_construct_qpa($qpa, ' AND (FALSE');
foreach ($mots as $mot) {
@@ -126,6 +128,9 @@ if ($searchString) {
plugin_hook('docmansearch_has_hierarchy', $params);
$qpa = db_construct_qpa($qpa, ' ) ', array());
$qpa = db_construct_qpa($qpa, ' ORDER BY updatedate, createdate');
+ if (is_integer($limitNbSearchDocs)) {
+ $qpa = db_construct_qpa($qpa, ' LIMIT $1',
array($limitNbSearchDocs));
+ }
$result = db_query_qpa($qpa);
if (!$result) {
echo $HTML->error_msg(_('Database query error'));
-----------------------------------------------------------------------
Summary of changes:
src/CHANGES | 1 +
src/common/docman/views/search.php | 19 ++++++++++++-------
2 files changed, 13 insertions(+), 7 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits