/[drupal]/contributions/modules/glossary/glossary.module
ViewVC logotype

Diff of /contributions/modules/glossary/glossary.module

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

revision 1.121.2.44, Mon Jun 16 16:00:10 2008 UTC revision 1.121.2.45, Tue Jun 17 01:25:46 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: glossary.module,v 1.121.2.43 2008/06/16 15:37:20 nancyw Exp $  // $Id: glossary.module,v 1.121.2.44 2008/06/16 16:00:10 nancyw Exp $
3    
4  /**  /**
5   * @file   * @file
6   *   Glossary terms will be automatically marked with links to their descriptions.   *   Glossary terms will be automatically marked with links to their descriptions.
7   */   */
8    
9  define ('GLOSSARY_VERSION', '$Id: glossary.module,v 1.121.2.43 2008/06/16 15:37:20 nancyw Exp $');  define ('GLOSSARY_VERSION', '$Id: glossary.module,v 1.121.2.44 2008/06/16 16:00:10 nancyw Exp $');
10    
11  function glossary_help($section, $args = null) {  function glossary_help($section, $args = null) {
12    $output = '';    $output = '';
# Line 454  function _glossary_filter_process($forma Line 454  function _glossary_filter_process($forma
454        }        }
455        $ins_before = $ins_after = null;        $ins_before = $ins_after = null;
456        // Let's try to get Drupal to show non-Latin letters right.        // Let's try to get Drupal to show non-Latin letters right.
457        $linkto = htmlspecialchars_decode($linkto);        $linkto = decode_entities($linkto);
458    
459        switch ($replace_mode) {        switch ($replace_mode) {
460          case 'superscript':          case 'superscript':
# Line 524  function _glossary_filter_process($forma Line 524  function _glossary_filter_process($forma
524        }        }
525    
526        // Replace term and synonyms with the desired new HTML code.        // Replace term and synonyms with the desired new HTML code.
527        $terms_replace[] = array('synonyms' => $term->synonyms, 'ins_before' => htmlspecialchars_decode($ins_before), 'ins_after' => htmlspecialchars_decode($ins_after));        $terms_replace[] = array('synonyms' => $term->synonyms, 'ins_before' => decode_entities($ins_before), 'ins_after' => decode_entities($ins_after));
528      }      }
529      return _glossary_insertlink($format, $text, $terms_replace);      return _glossary_insertlink($format, $text, $terms_replace);
530    }    }
# Line 928  function theme_glossary_overview_item($t Line 928  function theme_glossary_overview_item($t
928        }        }
929      }      }
930    }    }
931    return htmlspecialchars_decode($output);    return decode_entities($output);
932  }  }
933    
934  function glossary_admin_links($vocabulary, $destination = null) {  function glossary_admin_links($vocabulary, $destination = null) {
# Line 1139  function _glossary_cmp_strcase($a, $b) { Line 1139  function _glossary_cmp_strcase($a, $b) {
1139  function glossary_settings_page() {  function glossary_settings_page() {
1140    $mb_status = extension_loaded('mbstring') ? t('enabled') : t('disabled');    $mb_status = extension_loaded('mbstring') ? t('enabled') : t('disabled');
1141    $overload = ini_get('mbstring.func_overload') ? t('enabled') : t('disabled');    $overload = ini_get('mbstring.func_overload') ? t('enabled') : t('disabled');
1142    $output = '<p>'. t('Multibyte string support is !status; multibyte function overload is !overload.', array('!status' => $mb_status, '!overload' => $overload)) .'</p>';    $output = '<p>'. t('Multibyte string support is !status; multibyte function overload is !overload.', array('!status' => $mb_status, '!overload' => $overload)) .'</p>';
1143    
1144      drupal_add_js(drupal_get_path('module', 'glossary') .'/glossary.js', 'module');
1145    
1146    $output .= drupal_get_form(glossary_general_settings_form);    $output .= drupal_get_form(glossary_general_settings_form);
1147    return $output;    return $output;
1148  }  }
# Line 1329  function glossary_alphabet_form_submit($ Line 1332  function glossary_alphabet_form_submit($
1332   */   */
1333  function glossary_filter_form($format = 1) {  function glossary_filter_form($format = 1) {
1334    $form = array();    $form = array();
1335    
1336      drupal_add_js(drupal_get_path('module', 'glossary') .'/glossary.js', 'module');
1337    
1338    $options = array();    $options = array();
1339    $result = db_query(db_rewrite_sql('SELECT v.vid, v.name FROM {vocabulary} v ORDER BY v.name', 'v', 'vid'));    $result = db_query(db_rewrite_sql('SELECT v.vid, v.name FROM {vocabulary} v ORDER BY v.name', 'v', 'vid'));
1340    while ($vocabulary = db_fetch_array($result)) {    while ($vocabulary = db_fetch_array($result)) {
# Line 1509  function glossary_filter_form($format = Line 1514  function glossary_filter_form($format =
1514      $indicator_options['hovertip'] = t('Hovertip');      $indicator_options['hovertip'] = t('Hovertip');
1515    }    }
1516    
1517    $form['filter']['indicator']["glossary_replace_$format"] = array(    $form['filter']['indicator']["glossary_replace"] = array(
1518      '#type' => 'radios',      '#type' => 'radios',
1519      '#title' => t('Term Indicator'),      '#title' => t('Term Indicator'),
1520      '#default_value' => variable_get("glossary_replace_$format", 'superscript'),      '#default_value' => variable_get("glossary_replace_$format", 'superscript'),
# Line 1520  function glossary_filter_form($format = Line 1525  function glossary_filter_form($format =
1525      '#suffix' => '</div>',      '#suffix' => '</div>',
1526      );      );
1527    
1528    $form['filter']['indicator']["glossary_superscript_$format"] = array(    $form['filter']['indicator']["glossary_superscript"] = array(
1529      '#type' => 'textfield',      '#type' => 'textfield',
1530      '#title' => t('Superscript'),      '#title' => t('Superscript'),
1531      '#default_value' =>  variable_get("glossary_superscript_$format", 'i'),      '#default_value' =>  variable_get("glossary_superscript_$format", 'i'),
# Line 1528  function glossary_filter_form($format = Line 1533  function glossary_filter_form($format =
1533      '#maxlength' => 255,      '#maxlength' => 255,
1534      '#description' => t('If you chose "superscript" above, enter the superscript text.'),      '#description' => t('If you chose "superscript" above, enter the superscript text.'),
1535      '#validate' => array('glossary_indicator_intercept' => array()),      '#validate' => array('glossary_indicator_intercept' => array()),
1536        '#prefix' => '<div class="glossary_superscript">',
1537        '#suffix' => '</div>',
1538      );      );
1539    
1540    $mypath = base_path() . drupal_get_path('module', 'glossary');    $mypath = base_path() . drupal_get_path('module', 'glossary');
1541    $form['filter']['indicator']["glossary_icon_$format"] = array(    $form['filter']['indicator']["glossary_icon"] = array(
1542      '#type' => 'textfield',      '#type' => 'textfield',
1543      '#title' => t('Glossary Icon URL'),      '#title' => t('Glossary Icon URL'),
1544      '#default_value' => variable_get("glossary_icon_$format", $mypath .'/glossary.gif'),      '#default_value' => variable_get("glossary_icon_$format", $mypath .'/glossary.gif'),
1545      '#size' => 50,      '#size' => 50,
1546      '#maxlength' => 255,      '#maxlength' => 255,
1547      '#description' => t('If you chose "icon" above, enter the URL of the glossary icon relative to the root of your Drupal site.'),      '#description' => t('If you chose "icon" above, enter the URL of the glossary icon relative to the root of your Drupal site.'),
1548        '#prefix' => '<div class="glossary_icon">',
1549        '#suffix' => '</div>',
1550      );      );
1551    
1552    $form['submit'] = array(    $form['submit'] = array(
# Line 1558  function glossary_filter_form_submit($fo Line 1567  function glossary_filter_form_submit($fo
1567    $match_name = "glossary_match_$format";    $match_name = "glossary_match_$format";
1568    $case_name = "glossary_case_$format";    $case_name = "glossary_case_$format";
1569    $replace_all_name = "glossary_replace_all_$format";    $replace_all_name = "glossary_replace_all_$format";
   $replace_name = "glossary_replace_$format";  
1570    $blocking_tags_name = "glossary_blocking_tags_$format";    $blocking_tags_name = "glossary_blocking_tags_$format";
   $superscript_name = "glossary_superscript_$format";  
   $icon_name = "glossary_icon_$format";  
1571    foreach ($form_values[$vids_name] as $vid => $value) {    foreach ($form_values[$vids_name] as $vid => $value) {
1572      if ($value == 0) {      if ($value == 0) {
1573        unset($form_values[$vids_name][$vid]);        unset($form_values[$vids_name][$vid]);
# Line 1572  function glossary_filter_form_submit($fo Line 1578  function glossary_filter_form_submit($fo
1578    variable_set($match_name, $form_values[$match_name]);    variable_set($match_name, $form_values[$match_name]);
1579    variable_set($case_name, $form_values[$case_name]);    variable_set($case_name, $form_values[$case_name]);
1580    variable_set($replace_all_name, $form_values[$replace_all_name]);    variable_set($replace_all_name, $form_values[$replace_all_name]);
   variable_set($replace_name, $form_values[$replace_name]);  
1581    variable_set($blocking_tags_name, $form_values[$blocking_tags_name]);    variable_set($blocking_tags_name, $form_values[$blocking_tags_name]);
1582    variable_set($superscript_name, $form_values[$superscript_name]);    variable_set("glossary_replace_$format", $form_values["glossary_replace"]);
1583    variable_set($icon_name, $form_values[$icon_name]);    variable_set("glossary_superscript_$format", $form_values["glossary_superscript"]);
1584      variable_set("glossary_icon_$format", $form_values["glossary_icon"]);
1585    drupal_set_message(t('Configuration has been updated.'));    drupal_set_message(t('Configuration has been updated.'));
1586    
1587    return;    return;

Legend:
Removed from v.1.121.2.44  
changed lines
  Added in v.1.121.2.45

  ViewVC Help
Powered by ViewVC 1.1.2