CMS  Version 3.9
glossary_manager.inc
Go to the documentation of this file.
1 <?php
14 {
15  function GlossaryManager()
16  {
17 
18  }
19 
20  static function setDefaults()
21  {
22  Settings::setDefaultValue("glossary", "glossarize_terms", false, "Boolean", "Adds definition tooltips to matching terms within page content", null, null, 1);
23  Settings::setDefaultValue("glossary", "container_element", "body", "String", "DOM ID of the element to substitute within.", null, null, 2);
24  Settings::setDefaultValue("glossary", "target_elements", "p,div,li", "String", "CSS Selector for the elements for which content can be glossarized", null, null, 3);
25  Settings::setDefaultValue("glossary", "only_first_match", true, "Boolean", "Only attach the tooltip to the first matching term within the content area", null, null, 4);
26  Settings::setDefaultValue("glossary", "tooltip_class", "glossary_tooltip", "String", "CSS class to use for the generated tooltips", null, null, 5);
27  Settings::setDefaultValue("glossary", "term_class", "glossary_term", "String", "CSS class to use to wrap glossarized terms", null, null, 6);
28  Settings::setDefaultValue("glossary", "exclude_class", "no_glossarize", "String", "CSS class used to indicate not to glossarize a page or element", null, null, 7);
29  }
30 
31  static function glossarizeContent()
32  {
33  global $script;
34 
35  if (!Settings::getValue("glossary", "glossarize_terms")) return;
36 
37  $container = Settings::getValue("glossary", "container_element");
38  $targets = Settings::getValue("glossary", "target_elements");
39  $onlyFirst = Settings::getValue("glossary", "only_first_match") ? "true" : "false";
40  $tooltipClass = Settings::getValue("glossary", "tooltip_class");
41  $termClass = Settings::getValue("glossary", "term_class");
42  $excludeClass = Settings::getValue("glossary", "exclude_class");
43 
44  $script .= <<<ENDSCRIPT
45 <script>
46 window.addEvent('domready', function()
47 {
48  new Glossarizer('{$container}', '/action/glossary/glossary_list',
49  {
50  selector: '{$targets}',
51  firstOnly: {$onlyFirst},
52  termClass: '{$termClass}',
53  tooltipClass: '{$tooltipClass}',
54  excludeClass: '{$excludeClass}'
55  });
56 });
57 </script>
58 ENDSCRIPT;
59  }
60 
61  static function upgradeComponent($version)
62  {
64  $mgr->upgrade($version);
65  }
66 }
67 ?>
Provides a central management class for event handlers and common functionality for the glossary comp...
static upgradeComponent($version)
static glossarizeContent()
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
Definition: settings.inc:174