When nodes containing glossary terms are printed it would be great if the list of terms and definitions was added to the end of the display, as the tooltips and url links are not useful in the print context.

Comments

jzornig’s picture

I ended up hacking the Print module to get what I wanted. if anyone is interested the patch follows.


--- print.pages.inc.original	2010-08-22 09:11:03.000000000 +1000
+++ print.pages.inc	2010-12-02 11:10:19.000000000 +1000
@@ -369,6 +369,11 @@
     if (preg_match('!^(?:href|src)\s*?=(.*)!i', $attribs[$i], $urls) > 0) {
       $url = trim($urls[1], " \t\n\r\0\x0B\"'");
 
+      // handle glossary links
+      if (strpos(html_entity_decode($url), 'lossary:')) {
+        $newurl = html_entity_decode($url);
+      }
+      else
       if (strpos(html_entity_decode($url), '://') || preg_match('!^mailto:.*?@.*?\..*?$!iu', html_entity_decode($url))) {
         // URL is absolute, do nothing
         $newurl = $url;
@@ -543,6 +548,9 @@
     // Disable the AdSense module ads
     $content = preg_replace('!<div class=[\'"]adsense[\'"].*?</div>!sim', '', $content);
 
+    // remove abbr tags and add a glossary link
+    $content = preg_replace('#<abbr title="([^"]+)"><a class="glossary-term" href="/glossary/term/[^"]+">([^<]+)</a></abbr>#', '<a href="Glossary: $2 - $1">$2</a>', $content);
+
     if ($teaser) {
       $node->teaser = $content;
       unset($node->body);
jshorb’s picture

I don't think this hack works when using HoverTips (since there is no title="" attribute when using HoverTips). If the Glossary module had a on/off feature on the configuration page for which views to be active for - that would be good. However, I don't think that is possible if the Glossary operates on the cached version of the pages. I am not sure how that works.

It's possible that the above hack can be extended to work on HoverTips as well. I'll post if I find anything.

NancyDru’s picture

Issue summary: View changes
Status: Active » Closed (outdated)