Skip to content

Commit

Permalink
MDL-24625 Dropped $CFG->block_search_text and $CFG->block_search_button
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mudrd8mz committed Nov 9, 2010
1 parent 03276af commit 5741fd4
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 328 deletions.
9 changes: 2 additions & 7 deletions blocks/search/block_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,12 @@ function get_content() {

$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 =
'<form id="searchquery" method="get" action="'. $CFG->wwwroot .'/search/query.php"><div>'
. '<label for="block_search_q">'. $label .'</label>'
. '<label for="block_search_q">' . get_string('searchmoodle', 'block_search') . '</label>'
. '<input id="block_search_q" type="text" name="query_string" />'
. '<input type="submit" value="'.$button.'" />'
. '<input type="submit" value="' . s(get_string('go', 'block_search')) . '" />'
. '</div></form>';

//no footer, thanks
Expand Down
300 changes: 0 additions & 300 deletions blocks/search/config_global.html

This file was deleted.

7 changes: 6 additions & 1 deletion blocks/search/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 0 additions & 4 deletions blocks/search/lang/en/block_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -42,9 +40,7 @@
$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';
Expand Down
8 changes: 0 additions & 8 deletions blocks/search/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

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));
Expand Down
2 changes: 1 addition & 1 deletion blocks/search/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

$plugin->version = 2010101800;
$plugin->version = 2010110900;
$plugin->cron = 1;

0 comments on commit 5741fd4

Please sign in to comment.