Yaron Koren has submitted this change and it was merged.

Change subject: Improved check in Drilldown of whether to display "All files" 
text search
......................................................................


Improved check in Drilldown of whether to display "All files" text search

Change-Id: Ia7101a02fdbb90f0e8f33875f239f6b6939fe9a1
---
M drilldown/CargoSpecialDrilldown.php
1 file changed, 13 insertions(+), 4 deletions(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/drilldown/CargoSpecialDrilldown.php 
b/drilldown/CargoSpecialDrilldown.php
index a3109d9..b28e1aa 100644
--- a/drilldown/CargoSpecialDrilldown.php
+++ b/drilldown/CargoSpecialDrilldown.php
@@ -945,7 +945,7 @@
        }
 
        function getPageHeader() {
-               global $wgRequest, $wgCargoPageDataColumns;
+               global $wgRequest, $wgCargoPageDataColumns, 
$wgCargoFileDataColumns;
                global $cgScriptPath;
 
                $tables = CargoUtils::getTables();
@@ -959,11 +959,20 @@
                if ( !$this->showSingleTable ) {
                        $header .= $this->printTablesList( $tables );
                }
+
+               // @TODO - this needs to be a little more complex, because
+               // there's the possibility that a table will have
+               // text-searchable files even if the pages themselves are not
+               // searchable.
+               $displaySearchInput = ( $this->tableName == '_fileData' &&
+                       in_array( 'fullText', $wgCargoFileDataColumns ) ) ||
+                       ( $this->tableName != '_fileData' &&
+                       in_array( 'fullText', $wgCargoPageDataColumns ) );
+
                // If there are no fields for this table,
                // escape now that we've (possibly) printed the
                // tables list.
-               if ( count( $this->all_filters ) == 0 &&
-                       !array_key_exists( 'fullText', $wgCargoPageDataColumns 
) ) {
+               if ( count( $this->all_filters ) == 0 && !$displaySearchInput ) 
{
                        return $header;
                }
 
@@ -1055,7 +1064,7 @@
                $cur_url = $this->makeBrowseURL( $this->tableName, 
$this->fullTextSearchTerm, $this->applied_filters );
                $cur_url .= ( strpos( $cur_url, '?' ) ) ? '&' : '?';
 
-               if ( in_array( 'fullText', $wgCargoPageDataColumns ) ) {
+               if ( $displaySearchInput ) {
                        $fullTextSearchInput = $this->printTextInput( 
'_search', 0, true, $this->fullTextSearchTerm );
                        $filtersHTML .= self::printFilterLine( $this->msg( 
'cargo-drilldown-fulltext' )->text(), false, false, $fullTextSearchInput );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/319069
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7101a02fdbb90f0e8f33875f239f6b6939fe9a1
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to