| 1 |
<?php |
<?php |
| 2 |
// $Id: glossary.admin.inc,v 1.1.2.20 2008/06/06 21:19:38 nancyw Exp $ |
// $Id: glossary.admin.inc,v 1.1.2.21 2008/06/16 15:37:36 nancyw Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 209 |
*/ |
*/ |
| 210 |
function glossary_filter_form($form_state, $format = 1) { |
function glossary_filter_form($form_state, $format = 1) { |
| 211 |
$form = array(); |
$form = array(); |
| 212 |
|
|
| 213 |
|
drupal_add_js(drupal_get_path('module', 'glossary') .'/glossary.js', 'module'); |
| 214 |
|
|
| 215 |
$options = array(); |
$options = array(); |
| 216 |
$result = db_query('SELECT vid, name FROM {vocabulary} ORDER BY name'); |
$result = db_query('SELECT vid, name FROM {vocabulary} ORDER BY name'); |
| 217 |
while ($vocabulary = db_fetch_array($result)) { |
while ($vocabulary = db_fetch_array($result)) { |
| 378 |
$indicator_options['hovertip'] = t('Hovertip'); |
$indicator_options['hovertip'] = t('Hovertip'); |
| 379 |
} |
} |
| 380 |
|
|
| 381 |
$form['filter']['indicator']["glossary_replace_$format"] = array( |
$form['filter']['indicator']["glossary_replace"] = array( |
| 382 |
'#type' => 'radios', |
'#type' => 'radios', |
| 383 |
'#title' => t('Term Indicator'), |
'#title' => t('Term Indicator'), |
| 384 |
'#default_value' => variable_get("glossary_replace_$format", 'superscript'), |
'#default_value' => variable_get("glossary_replace_$format", 'superscript'), |
| 389 |
'#suffix' => '</div>', |
'#suffix' => '</div>', |
| 390 |
); |
); |
| 391 |
|
|
| 392 |
$form['filter']['indicator']["glossary_superscript_$format"] = array( |
$form['filter']['indicator']["glossary_superscript"] = array( |
| 393 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 394 |
'#title' => t('Superscript'), |
'#title' => t('Superscript'), |
| 395 |
'#default_value' => variable_get("glossary_superscript_$format", 'i'), |
'#default_value' => variable_get("glossary_superscript_$format", 'i'), |
| 397 |
'#maxlength' => 255, |
'#maxlength' => 255, |
| 398 |
'#description' => t('If you chose "superscript" above, enter the superscript text.'), |
'#description' => t('If you chose "superscript" above, enter the superscript text.'), |
| 399 |
'#validate' => array('glossary_indicator_intercept' => array()), |
'#validate' => array('glossary_indicator_intercept' => array()), |
| 400 |
|
'#prefix' => '<div class="glossary_superscript">', |
| 401 |
|
'#suffix' => '</div>', |
| 402 |
); |
); |
| 403 |
|
|
| 404 |
$mypath = base_path() . drupal_get_path('module', 'glossary'); |
$mypath = base_path() . drupal_get_path('module', 'glossary'); |
| 405 |
$form['filter']['indicator']["glossary_icon_$format"] = array( |
$form['filter']['indicator']["glossary_icon"] = array( |
| 406 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 407 |
'#title' => t('Glossary Icon URL'), |
'#title' => t('Glossary Icon URL'), |
| 408 |
'#default_value' => variable_get("glossary_icon_$format", $mypath .'/glossary.gif'), |
'#default_value' => variable_get("glossary_icon_$format", $mypath .'/glossary.gif'), |
| 409 |
'#size' => 50, |
'#size' => 50, |
| 410 |
'#maxlength' => 255, |
'#maxlength' => 255, |
| 411 |
'#description' => t('If you chose "icon" above, enter the URL of the glossary icon relative to the root ("%root") of your Drupal site.', |
'#description' => t('If you chose "icon" above, enter the URL of the glossary icon relative to the root ("%root") of your Drupal site.', array('%root' => base_path())), |
| 412 |
array('%root' => base_path())), |
'#prefix' => '<div class="glossary_icon">', |
| 413 |
|
'#suffix' => '</div>', |
| 414 |
); |
); |
| 415 |
|
|
| 416 |
$form['submit'] = array( |
$form['submit'] = array( |
| 431 |
$match_name = "glossary_match_$format"; |
$match_name = "glossary_match_$format"; |
| 432 |
$case_name = "glossary_case_$format"; |
$case_name = "glossary_case_$format"; |
| 433 |
$replace_all_name = "glossary_replace_all_$format"; |
$replace_all_name = "glossary_replace_all_$format"; |
|
$replace_name = "glossary_replace_$format"; |
|
| 434 |
$blocking_tags_name = "glossary_blocking_tags_$format"; |
$blocking_tags_name = "glossary_blocking_tags_$format"; |
|
$superscript_name = "glossary_superscript_$format"; |
|
|
$icon_name = "glossary_icon_$format"; |
|
| 435 |
foreach ($form_state['values'][$vids_name] as $vid => $value) { |
foreach ($form_state['values'][$vids_name] as $vid => $value) { |
| 436 |
if ($value == 0) { |
if ($value == 0) { |
| 437 |
unset($form_state['values'][$vids_name][$vid]); |
unset($form_state['values'][$vids_name][$vid]); |
| 442 |
variable_set($match_name, $form_state['values'][$match_name]); |
variable_set($match_name, $form_state['values'][$match_name]); |
| 443 |
variable_set($case_name, $form_state['values'][$case_name]); |
variable_set($case_name, $form_state['values'][$case_name]); |
| 444 |
variable_set($replace_all_name, $form_state['values'][$replace_all_name]); |
variable_set($replace_all_name, $form_state['values'][$replace_all_name]); |
|
variable_set($replace_name, $form_state['values'][$replace_name]); |
|
| 445 |
variable_set($blocking_tags_name, $form_state['values'][$blocking_tags_name]); |
variable_set($blocking_tags_name, $form_state['values'][$blocking_tags_name]); |
| 446 |
variable_set($superscript_name, $form_state['values'][$superscript_name]); |
variable_set("glossary_replace_$format", $form_state['values']["glossary_replace"]); |
| 447 |
variable_set($icon_name, $form_state['values'][$icon_name]); |
variable_set("glossary_superscript_$format", $form_state['values']["glossary_superscript"]); |
| 448 |
|
variable_set("glossary_icon_$format", $form_state['values']["glossary_icon"]); |
| 449 |
drupal_set_message(t('Configuration has been updated.')); |
drupal_set_message(t('Configuration has been updated.')); |
| 450 |
|
|
| 451 |
return; |
return; |