/[drupal]/contributions/modules/help_soc/help/help.module
ViewVC logotype

Diff of /contributions/modules/help_soc/help/help.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13, Tue Aug 12 17:36:54 2008 UTC revision 1.14, Tue Aug 12 18:16:39 2008 UTC
# Line 50  function help_menu() { Line 50  function help_menu() {
50    $items['admin/help'] = array(    $items['admin/help'] = array(
51      'title' => 'Help',      'title' => 'Help',
52      'page callback' => 'help_index_page',      'page callback' => 'help_index_page',
53      'access arguments' => array('access help pages'),      'access arguments' => array('access help'),
54      'weight' => 9,      'weight' => 9,
55      'help' => $help,      'help' => $help,
56    );    );
57    $items['admin/help/by-module'] = array(    $items['admin/help/by-module'] = array(
58      'title' => 'By module',      'title' => 'By module',
59      'page callback' => 'help_index_page',      'page callback' => 'help_index_page',
60      'access arguments' => array('access help pages'),      'access arguments' => array('access help'),
61      'type' => MENU_DEFAULT_LOCAL_TASK,      'type' => MENU_DEFAULT_LOCAL_TASK,
62      'parent' => 'admin/help',      'parent' => 'admin/help',
63    );    );
64    $items['admin/help/%'] = array(    $items['admin/help/%'] = array(
65      'page callback' => 'help_topic_page',      'page callback' => 'help_topic_page',
66      'page arguments' => array(2),      'page arguments' => array(2),
67      'access arguments' => array('access help pages'),      'access arguments' => array('access help'),
68      'type' => MENU_CALLBACK,      'type' => MENU_CALLBACK,
69    );    );
70    $items['admin/help/%/%'] = array(    $items['admin/help/%/%'] = array(
71      'page callback' => 'help_topic_page',      'page callback' => 'help_topic_page',
72      'page arguments' => array(2, 3),      'page arguments' => array(2, 3),
73      'access arguments' => array('access help pages'),      'access arguments' => array('access help'),
74      'type' => MENU_CALLBACK,      'type' => MENU_CALLBACK,
75    );    );
76    
# Line 115  function help_process($element, $form_st Line 115  function help_process($element, $form_st
115  function help_search($op = 'search', $keys = null) {  function help_search($op = 'search', $keys = null) {
116    switch ($op) {    switch ($op) {
117      case 'name':      case 'name':
118        return t('Help');        if (user_access('search help') && user_access('access help')) {
119            return t('Help');
120          }
121        break;        break;
122      case 'reset':      case 'reset':
123        variable_del('help_last_cron');        variable_del('help_last_cron');
124        return;        return;
125        break;        break;
126      case 'search':      case 'search':
127        drupal_function_exists('help_get_topics');        if (user_access('search help') && user_access('access help')) {
128        $topics = help_get_topics();          drupal_function_exists('help_get_topics');
129        $find = do_search($keys, 'help');          $topics = help_get_topics();
130        if (!$find) {          $find = do_search($keys, 'help');
131          return;          if (!$find) {
132        }            return;
133            }
134    
135        $results = array();          $results = array();
136    
137        $placeholders = implode(', ', array_fill(0, count($find), '%d'));          $placeholders = implode(', ', array_fill(0, count($find), '%d'));
138        foreach ($find as $item) {          foreach ($find as $item) {
139          $sids[] = $item->sid;            $sids[] = $item->sid;
140        }          }
141    
142        $result = db_query("SELECT * FROM {help_index} WHERE sid IN ($placeholders)", $sids);          $result = db_query("SELECT * FROM {help_index} WHERE sid IN ($placeholders)", $sids);
143        while ($sid = db_fetch_object($result)) {          while ($sid = db_fetch_object($result)) {
144          // Guard against removed help topics that are still indexed.            // Guard against removed help topics that are still indexed.
145          if (empty($topics[$sid->module][$sid->topic])) {            if (empty($topics[$sid->module][$sid->topic])) {
146            continue;              continue;
147              }
148              $info = $topics[$sid->module][$sid->topic];
149              $text = help_view_topic($sid->module, $sid->topic);
150              $results[] = array(
151                'link' => help_url("admin/help/$sid->module/$sid->topic"),
152                'title' => $info['title'],
153                'snippet' => search_excerpt($keys, $text),
154              );
155          }          }
156          $info = $topics[$sid->module][$sid->topic];          return $results;
         $text = help_view_topic($sid->module, $sid->topic);  
         $results[] = array(  
           'link' => help_url("admin/help/$sid->module/$sid->topic"),  
           'title' => $info['title'],  
           'snippet' => search_excerpt($keys, $text),  
         );  
157        }        }
       return $results;  
158        break;        break;
159    }    }
160  }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.2