Add Drupal.searchHelp, Drupal.drupalHelpArg
jpmckinney - October 11, 2009 - 21:06
| Project: | JavaScript Theming |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
<?php
Drupal.searchHelp = function (path, arg) {
switch (path) {
case 'admin/help#search':
var output = '<p>' + Drupal.t('The search module adds the ability to search for content by keywords. Search is often the only practical way to find content on a large site, and is useful for finding both users and posts.') + '</p>';
output += '<p>' + Drupal.t('To provide keyword searching, the search engine maintains an index of words found in your site\'s content. To build and maintain this index, a correctly configured <a href="@cron">cron maintenance task</a> is required. Indexing behavior can be adjusted using the <a href="@searchsettings">search settings page</a>; for example, the <em>Number of items to index per cron run</em> sets the maximum number of items indexed in each pass of a <a href="@cron">cron maintenance task</a>. If necessary, reduce this number to prevent timeouts and memory errors when indexing.', { '@cron': Drupal.url('admin/reports/status'), '@searchsettings': Drupal.url('admin/settings/search') }) + '</p>';
output += '<p>' + Drupal.t('For more information, see the online handbook entry for <a href="@search">Search module</a>.', { '@search': 'http://drupal.org/handbook/modules/search/' }) + '</p>';
return output;
case 'admin/settings/search':
return '<p>' + Drupal.t('The search engine maintains an index of words found in your site\'s content. To build and maintain this index, a correctly configured <a href="@cron">cron maintenance task</a> is required. Indexing behavior can be adjusted using the settings below.', { '@cron': Drupal.url('admin/reports/status') }) + '</p>';
case 'search#noresults':
return Drupal.t('<ul>\
<li>Check if your spelling is correct.</li>\
<li>Remove quotes around phrases to match each word individually: <em>"blue smurf"</em> will match less than <em>blue smurf</em>.</li>\
<li>Consider loosening your query with <em>OR</em>: <em>blue smurf</em> will match less than <em>blue OR smurf</em>.</li>\
</ul>');
}
}
Drupal.drupalHelpArg = function (arg) {
if (arg == undefined) {
arg = [];
}
return arg.concat([ '', '', '', '', '', '', '', '', '', '', '', '' ]);
}
?>
#1
What are the use cases for this?
ALso be sure to attach an actual patch. Read here on how to make a patch: http://drupal.org/patch
#2
If you are creating an AJAX search engine, e.g. http://drupal.org/project/apachesolr_ajax, you'll want to have these methods available.