Bug #8465: Print view now handled entirely by HTML/CSS
authorMichael M Slusarz <slusarz@curecanti.org>
Sun, 16 Aug 2009 23:19:01 +0000 (17:19 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sun, 16 Aug 2009 23:19:01 +0000 (17:19 -0600)
turba/contact.php
turba/lib/Turba.php
turba/lib/View/Contact.php
turba/themes/screen.css

index baab1dd..b87d089 100644 (file)
@@ -52,14 +52,11 @@ if ($vars->get('action') == 'mark_own') {
     $notification->push(_("This contact has been marked as your own."), 'horde.success');
 }
 
-// Are we printing?
-$print_view = (bool)Horde_Util::getFormData('print');
-
 // Get view.
 $viewName = Horde_Util::getFormData('view', 'Contact');
 switch ($viewName) {
 case 'Contact':
-    $view = new Turba_View_Contact($contact, $print_view);
+    $view = new Turba_View_Contact($contact);
     if (!$vars->get('url')) {
         $vars->set('url', $contact->url(null, true));
     }
@@ -104,15 +101,9 @@ if ($own_source == $source && $own_id == $contact->getValue('__key')) {
 $title = $view->getTitle();
 Horde::addScriptFile('contact_tabs.js', 'turba', true);
 require TURBA_TEMPLATES . '/common-header.inc';
-if ($print_view) {
-    require_once $registry->get('templates', 'horde') . '/javascript/print.js';
-} else {
-    require TURBA_TEMPLATES . '/menu.inc';
-}
+require TURBA_TEMPLATES . '/menu.inc';
 echo '<div id="page">';
-if (!$print_view) {
-    echo $tabs->render($viewName);
-}
+echo $tabs->render($viewName);
 echo '<h1 class="header">' . $own_link
     . ($contact->getValue('name')
        ? htmlspecialchars($contact->getValue('name'))
index 68ba601..093a7fb 100644 (file)
@@ -601,11 +601,6 @@ class Turba {
             $menu->add(Horde::applicationUrl('data.php'), _("_Import/Export"), 'data.png', $GLOBALS['registry']->getImageDir('horde'));
         }
 
-        /* Print. */
-        if (isset($GLOBALS['print_link'])) {
-            $menu->add($GLOBALS['print_link'], _("_Print"), 'print.png', $GLOBALS['registry']->getImageDir('horde'), '_blank', Horde::popupJs($GLOBALS['print_link'], array('urlencode' => true)) . 'return false);', '__noselection');
-        }
-
         return $menu;
     }
 
index 9183c32..da9a14f 100644 (file)
@@ -16,24 +16,11 @@ class Turba_View_Contact {
     var $contact;
 
     /**
-     * @var boolean
-     */
-    var $print = false;
-
-    /**
      * @param Turba_Object &$contact
      */
-    public function __construct(&$contact, $print = null)
+    public function __construct(&$contact)
     {
         $this->contact = &$contact;
-        if (!is_null($print)) {
-            $this->print = $print;
-        }
-
-        /* Set print link. */
-        if (!$this->print) {
-            $GLOBALS['print_link'] = Horde_Util::addParameter($this->contact->url(), 'print', 1);
-        }
     }
 
     function getTitle()
@@ -104,7 +91,7 @@ class Turba_View_Contact {
         if (!empty($comments['threads'])) {
             echo '<br />' . $comments['threads'];
         }
-        if (!empty($comments['comments']) && !$this->print) {
+        if (!empty($comments['comments'])) {
             echo '<br />' . $comments['comments'];
         }
 
index 058b001..1c72208 100644 (file)
@@ -105,3 +105,9 @@ table#addressbook-list th.sortdown {
     margin-right: 2px;
     cursor: default;
 }
+
+@media print {
+    .tabset, #page h1.header span.smallheader {
+        display: none !important;
+    }
+}