From fddf3deb03f71f63c55947444c55876012b7a386 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 29 Oct 2010 16:38:42 -0600 Subject: [PATCH] Set title of print page to subject of e-mail message --- imp/templates/print/print.html | 4 +++- imp/view.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/imp/templates/print/print.html b/imp/templates/print/print.html index 29c8e59b0..341a6ddb3 100644 --- a/imp/templates/print/print.html +++ b/imp/templates/print/print.html @@ -1,6 +1,8 @@ - + + <tag:title /> + diff --git a/imp/view.php b/imp/view.php index 4a4f42c0a..0aa76c4c3 100644 --- a/imp/view.php +++ b/imp/view.php @@ -302,6 +302,16 @@ case 'print_attach': $bodyelt = $doc->dom->getElementsByTagName('body')->item(0); $bodyelt->insertBefore($doc->dom->importNode($div, true), $bodyelt->firstChild); + /* Make the title the e-mail subject. */ + $headers = $contents->getHeaderOb(); + $imp_ui_mbox = new IMP_Ui_Mailbox(); + + $headelt = $doc->dom->getElementsByTagName('head')->item(0); + foreach ($headelt->getElementsByTagName('title') as $node) { + $headelt->removeChild($node); + } + $headelt->appendChild($doc->dom->createElement('title', htmlspecialchars($imp_ui_mbox->getSubject($headers->getValue('subject'))))); + echo $doc->returnHtml(); } else { echo $render[$key]['data']; @@ -312,8 +322,12 @@ case 'print_attach': break; default: + $headers = $contents->getHeaderOb(); + $imp_ui_mbox = new IMP_Ui_Mailbox(); $self_url = Horde::selfUrl(true, true); + $t = $injector->createInstance('Horde_Template'); + $t->set('title', htmlspecialchars($imp_ui_mbox->getSubject($headers->getValue('subject')))); $t->set('headers', $self_url->copy()->add('pmode', 'headers')); $t->set('content', $self_url->copy()->add('pmode', 'content')); echo $t->fetch(IMP_TEMPLATES . '/print/print.html'); -- 2.11.0