From 5741fd4ba5a670dda694f550262f179449fd5561 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Tue, 9 Nov 2010 12:40:56 +0000 Subject: [PATCH] MDL-24625 Dropped $CFG->block_search_text and $CFG->block_search_button We should never store strings in the database, use get_string() whenever possible. Also, I removed legacy config_global.html even though I know Apu kept it intentionally for regressions test. The file can always be searched in the repository history, no need to keep it. --- blocks/search/block_search.php | 9 +- blocks/search/config_global.html | 300 ------------------- blocks/search/db/upgrade.php | 7 +- blocks/search/lang/en/block_search.php | 4 - blocks/search/settings.php | 8 - blocks/search/version.php | 2 +- blocks/search_forums/block_search_forums.php | 11 +- 7 files changed, 13 insertions(+), 328 deletions(-) delete mode 100644 blocks/search/config_global.html diff --git a/blocks/search/block_search.php b/blocks/search/block_search.php index ea8b7820edc..436af7fe8c0 100644 --- a/blocks/search/block_search.php +++ b/blocks/search/block_search.php @@ -41,17 +41,12 @@ class block_search extends block_base { $this->content = new stdClass; - //lazy check for the moment - //fetch values if defined in admin, otherwise use defaults - $label = (!empty($CFG->block_search_text)) ? $CFG->block_search_text : get_string('searchmoodle', 'block_search'); - $button = (!empty($CFG->block_search_button)) ? $CFG->block_search_button : get_string('go', 'block_search'); - //basic search form $this->content->text = '
' - . '' + . '' . '' - . '' + . '' . '
'; //no footer, thanks diff --git a/blocks/search/config_global.html b/blocks/search/config_global.html deleted file mode 100644 index f809533d2e3..00000000000 --- a/blocks/search/config_global.html +++ /dev/null @@ -1,300 +0,0 @@ -dirroot."/search/lib.php"; - -$defaultfiletypes = "PDF,TXT,HTML,PPT,XML,DOC,HTM"; - -global $DB; -?> -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- : - -
-
- : - -

-
- : - - block_search_enable_file_indexing) && $CFG->block_search_enable_file_indexing) { - echo " checked=\"checked\" "; - } ?> /> - - block_search_enable_file_indexing) || !$CFG->block_search_enable_file_indexing) { - echo " checked=\"checked\" "; - } ?> /> -

-
- : - - -

-
- : - - block_search_usemoodleroot)) ? 'checked="checked"' : '' ; - $notusemoodleroot = (!isset($CFG->block_search_usemoodleroot)) ? 'checked="checked"' : '' ; - ?> - value="1"/> - - value="0"/> -

-
- : - -

-
- -
- - - - - - -
- : - - "/>

-
-
- -
- - - - - - - - - - -
- : - - "/>

-
- : - - dirroot}\\lib\\antiword\\win32"); - } - else{ - p("ANTIWORDHOME={$CFG->dirroot}/lib/antiword/linux/usr/share/antiword"); - } - } ?>"/>

-
-
- -block_search_filetypes); -if (!empty($types)){ - foreach($types as $type) { - $utype = strtoupper($type); - $type = strtolower($type); - $type = trim($type); - if (preg_match("/\\b$type\\b/i", $defaultfiletypes)) continue; -?> -
- - - - - - - - - - -
- : - - $propname)) { - p($CFG->$propname); - } - ?>"/> -

-
- : - - $propname)) { - echo $CFG->$propname; - } ?>"/>

-
-
- - -
- - - - - -
-
-            get_in_or_equal($searchnames);
-            ?>
-            
-
-
- -
- - - - - -
-get_records_select('modules', "name $searchable_list", $params, 'name', 'id,name')){ - foreach($modules as $module){ - $i++; - $keyname = "search_in_{$module->name}"; - $checkedup = (!isset($CFG->$keyname) || $CFG->$keyname) ? 'checked="checked"' : '' ; - $checkeddown = !(!isset($CFG->$keyname) || $CFG->$keyname) ? 'checked="checked"' : '' ; - echo "name}\" value=\"0\" {$checkeddown} /> " . get_string('no'); - echo " - name}\" value=\"1\" {$checkedup} /> " . get_string('yes'); - echo " - ".get_string('modulename', $module->name).'
'; - if ($i % 20 == 0){ - echo "
"; - } - $found_searchable_modules = 1; - } -} -if (!$found_searchable_modules) { - print_string('nosearchablemodules', 'block_search'); -} -?> - -
-
- -
- - - - - -
-get_records_select('block', "name $searchable_list", $params, 'name', 'id,name')){ - foreach($blocks as $block){ - $i++; - $keyname = "search_in_{$block->name}"; - $checked = (!isset($CFG->$keyname) || $CFG->$keyname) ? 'checked="checked"' : '' ; - echo "name}\" value=\"1\" {$checked} />"; - - // multiple fallback strategy to get the name of the block - $blocklabel = get_string('pluginname', 'block_'.$block->name); - echo " - ".$blocklabel.'
'; - if ($i % 20 == 0){ - echo "
"; - } - $found_searchable_blocks = 1; - } -} -if (!$found_searchable_blocks) { - print_string('nosearchableblocks', 'block_search'); -} -?> - -
-
- - - - - -
- -
-
diff --git a/blocks/search/db/upgrade.php b/blocks/search/db/upgrade.php index 18af760c0cb..ee8b4848646 100644 --- a/blocks/search/db/upgrade.php +++ b/blocks/search/db/upgrade.php @@ -77,6 +77,11 @@ function xmldb_block_search_upgrade($oldversion) { upgrade_block_savepoint(true, 2010101800, 'search'); } + if ($oldversion < 2010110900) { + unset_config('block_search_text'); + unset_config('block_search_button'); + upgrade_block_savepoint(true, 2010110900, 'search'); + } return $result; -} \ No newline at end of file +} diff --git a/blocks/search/lang/en/block_search.php b/blocks/search/lang/en/block_search.php index 262ff86a4ee..06df0ed30c2 100644 --- a/blocks/search/lang/en/block_search.php +++ b/blocks/search/lang/en/block_search.php @@ -25,12 +25,10 @@ $string['blockssearchswitches'] = 'Indexer activation for blocks'; $string['bytes'] = 'bytes (0 stands for no limits)'; -$string['configbuttonlabel'] = 'Button label'; $string['configenablefileindexing'] = 'Enable file indexing'; $string['configfiletypes'] = 'File types handled'; $string['configlimitindexbody'] = 'Indexed body size limitation'; $string['configpdftotextcmd'] = 'Path to command pdftotext'; -$string['configsearchtext'] = 'Search text'; $string['configtypetotxtcmd'] = 'Converter\'s command line'; $string['configtypetotxtenv'] = 'Environment define for converter'; $string['configwordtotextcmd'] = 'Path to command doctotext'; @@ -42,9 +40,7 @@ $string['enableindexinginblock'] = 'Allow indexing of the {$a} block'; $string['envforcmdtotextfor'] = 'Environment for {$a} conversion command to text'; $string['go'] = 'Go!'; $string['handlingfor'] = 'Extra handling for'; -$string['headingofsearchblock'] = 'The title shown above the search box in the block'; $string['indexbodylimit'] = 'The limit of indexing the body'; -$string['labelofsearchbutton'] = 'The text in the block search button itself'; $string['listoffiletypes'] = 'The list of file types handled'; $string['modulessearchswitches'] = 'Indexer activation for modules'; $string['nosearchableblocks'] = 'No searchable blocks'; diff --git a/blocks/search/settings.php b/blocks/search/settings.php index 9e070c2daa8..f3d8ca24077 100644 --- a/blocks/search/settings.php +++ b/blocks/search/settings.php @@ -4,14 +4,6 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { - //Search text - $settings->add(new admin_setting_configtext('block_search_text', get_string('configsearchtext', 'block_search'), - get_string('headingofsearchblock', 'block_search'), get_string('searchmoodle', 'block_search'), PARAM_TEXT )); - - //Button Label - $settings->add(new admin_setting_configtext('block_search_button', get_string('configbuttonlabel', 'block_search'), - get_string('labelofsearchbutton', 'block_search'), get_string('go', 'block_search'), PARAM_TEXT)); - //Enable file indexing (y/n) $settings->add(new admin_setting_configcheckbox('block_search_enable_file_indexing', get_string('configenablefileindexing', 'block_search'), get_string('enablefileindexing', 'block_search'), 0, 1, 0)); diff --git a/blocks/search/version.php b/blocks/search/version.php index 84d4c91bd82..77f60501e83 100644 --- a/blocks/search/version.php +++ b/blocks/search/version.php @@ -15,5 +15,5 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -$plugin->version = 2010101800; +$plugin->version = 2010110900; $plugin->cron = 1; diff --git a/blocks/search_forums/block_search_forums.php b/blocks/search_forums/block_search_forums.php index 02eef48001d..cf22705b1cb 100644 --- a/blocks/search_forums/block_search_forums.php +++ b/blocks/search_forums/block_search_forums.php @@ -22,18 +22,15 @@ class block_search_forums extends block_base { $advancedsearch = get_string('advancedsearch', 'block_search_forums'); - $search = get_string('search'); - - //Accessibility: replaced with configurable text/'silent' character. - // Theme config, $CFG->block_search_button = get_arrow_right() .''.get_string('search').''; - $button = (isset($CFG->block_search_button)) ? $CFG->block_search_button : get_string('go'); + $strsearch = get_string('search'); + $strgo = get_string('go'); $this->content->text = '
'; $this->content->text .= '
'; $this->content->text .= ''; // course - $this->content->text .= ''. + $this->content->text .= ''. ''; - $this->content->text .= '
'; + $this->content->text .= '
'; $this->content->text .= ''.$advancedsearch.''; $this->content->text .= $OUTPUT->help_icon('search'); $this->content->text .= '
'; -- 2.43.0