Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
[gui.ajax] Always limit search engine to 100 results by default, use …
Browse files Browse the repository at this point in the history
…bulkUpdating when parsing results, and display the total count plus a "show all" link.
  • Loading branch information
cdujeu committed Dec 4, 2015
1 parent 7f2ecc9 commit 604fc1c
Show file tree
Hide file tree
Showing 29 changed files with 129 additions and 37 deletions.
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/ca.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/cs.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,5 +633,7 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/da.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,5 +640,7 @@
"540" => "Fehler beim Hochladen: Ordner für temporäre Dateien nicht gefunden",
"541" => "Fehler beim Hochladen: Kein Schreibzugriff auf Ordner für temporäre Dateien",
"542" => "Fehler beim Hochladen: Hochladen wurde durch PHP-Erweiterung unterbrochen",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,6 @@
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
6 changes: 4 additions & 2 deletions core/src/plugins/core.ajaxplorer/i18n/et.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
/* END SENTENCE */
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/eus.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/fi.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,8 @@
"539" => "Erreur de transfert: le fichier est partiellement transferé.",
"540" => "Erreur de transfert: impossible d'ouvrir le répertoire temporaire.",
"541" => "Erreur de transfert: impossible d'écrire dans le répertoire temporaire.",
"542" => "Erreur de transfert: une extension PHP a stoppé le processus."
"542" => "Erreur de transfert: une extension PHP a stoppé le processus.",
"543" => "Résultats limités au 100 premiers sur %s.",
"544" => "Voir tout",
/* END SENTENCE */
);
6 changes: 4 additions & 2 deletions core/src/plugins/core.ajaxplorer/i18n/gr.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
/* END SENTENCE */
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
6 changes: 4 additions & 2 deletions core/src/plugins/core.ajaxplorer/i18n/he.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
/* END SENTENCE */
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/hu.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,8 @@
"539" => "Errore caricamento: il file è parziale",
"540" => "Errore caricamento: impossibile trovare la cartella temporanea",
"541" => "Errore caricamento: non è possibile scrivere nella cartella temporanea",
"542" => "Errore caricamento: un'estensione PHP ha bloccato il processo di caricamento"
"542" => "Errore caricamento: un'estensione PHP ha bloccato il processo di caricamento",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/ja.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* 文章はここまで */
/* 文章終了 */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/kr.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/no.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/pl.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/pt-br.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/pt.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,9 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
/* password strength tester */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/ru.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,5 +633,7 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
);
6 changes: 3 additions & 3 deletions core/src/plugins/core.ajaxplorer/i18n/si.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
/* password strength tester */
/* quick access keys */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/sv.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
6 changes: 4 additions & 2 deletions core/src/plugins/core.ajaxplorer/i18n/tr.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
/* END SENTENCE */
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/zh-tw.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/zh.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@
"539" => "Upload error: file is partial",
"540" => "Upload error: cannot find the temporary directory",
"541" => "Upload error: cannot write into the temporary directory",
"542" => "Upload error: a PHP extension stopped the upload process."
"542" => "Upload error: a PHP extension stopped the upload process.",
"543" => "Results limited to 100 out of %s.",
"544" => "Show All",
/* END SENTENCE */
);
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ Class.create("SearchEngine", AjxpPane, {
this._inputBox.observe("input", function(e){
if(this._inputBox.getValue().length > 2){
bufferCallback('searchByTyping', 300, this.searchWhenTyping.bind(this));
bufferCallback('fullSearch', 2000, this.searchCompleteTypedResults.bind(this));
bufferCallback('fullSearch', 1000, this.searchCompleteTypedResults.bind(this));
}
}.bind(this));

Expand Down Expand Up @@ -691,10 +691,10 @@ Class.create("SearchEngine", AjxpPane, {
if(text == this.crtText){
if(ProtoCompat.map2values(this._rootNode.getChildren()).length >= 9) {
// Get more
this.search(50, true);
this.search(0, true);
}
}else{
this.search(50, false);
this.search(0, false);
}
}
},
Expand All @@ -703,6 +703,12 @@ Class.create("SearchEngine", AjxpPane, {
* Perform search
*/
search : function(limit, skipClear){
if(!limit){
this.currentLimitDefault = true;
limit = 100;
}else{
this.currentLimitDefault = false;
}
var text = this._inputBox.value.toLowerCase();
var searchQuery;
var metadata = this.parseMetadataForm();
Expand Down Expand Up @@ -1037,13 +1043,30 @@ Class.create("SearchEngine", AjxpPane, {
this.updateStateFinished();
return;
}
var nodes = XPathSelectNodes(oXmlDoc.documentElement, "tree");
var paginationNode = XMLUtils.XPathSelectSingleNode(oXmlDoc.documentElement, "pagination");
var showAllDiv = this.htmlElement.down('#search_show_all');
if(showAllDiv) showAllDiv.remove();
if(paginationNode && this.currentLimitDefault){
var totalCount = parseInt(paginationNode.getAttribute("count"));
showAllDiv = new Element('div', {id:'search_show_all'}).update(pydio.MessageHash['543'].replace('%s', totalCount) + ' ');
var showAllLink = new Element('a').update(pydio.MessageHash['544']);
showAllLink.observe("click", function(){
this.search(totalCount, true);
}.bind(this));
showAllDiv.insert(showAllLink);
this.htmlElement.down("#basic_search").insert(showAllDiv);
}
var nodes = XMLUtils.XPathSelectNodes(oXmlDoc.documentElement, "tree");
if(!nodes.length){
this.addNoResultString();
}else{
var noRes = $(this._resultsBoxId).down('#no-results-found');
if(noRes) noRes.remove();
}
if(this._fileList){
this._fileList.setBulkUpdatingMode();
}
var resultsCount = 0;
for (var i = 0; i < nodes.length; i++)
{
if (nodes[i].tagName == "tree")
Expand All @@ -1066,9 +1089,10 @@ Class.create("SearchEngine", AjxpPane, {
this.addResult(currentFolder, ajxpNode);
}
}
}
}
if(this._fileList){
//this._fileList.reload();
this._fileList.flushBulkUpdatingMode();
this._fileList._sortableTable.sort(0);
}
},
Expand Down
Loading

0 comments on commit 604fc1c

Please sign in to comment.