Bug #8463: First attempt at converting print view in kronolith to pure CSS
authorMichael M Slusarz <slusarz@curecanti.org>
Sat, 15 Aug 2009 18:50:44 +0000 (12:50 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 15 Aug 2009 20:06:23 +0000 (14:06 -0600)
17 files changed:
kronolith/config/conf.xml
kronolith/day.php
kronolith/event.php
kronolith/js/views.js
kronolith/lib/Kronolith.php
kronolith/month.php
kronolith/templates/calendar_titles.inc
kronolith/templates/common-header.inc
kronolith/themes/graphics/az.png [deleted file]
kronolith/themes/graphics/redbox_spinner.gif [deleted file]
kronolith/themes/graphics/za.png [deleted file]
kronolith/themes/print/screen.css [deleted file]
kronolith/themes/screen.css
kronolith/view.php
kronolith/week.php
kronolith/workweek.php
kronolith/year.php

index 2aeb714..5f339f5 100644 (file)
@@ -81,8 +81,6 @@
 
  <configsection name="menu">
   <configheader>Menu Settings</configheader>
-  <configboolean name="print" desc="Should we display a Print link in the
-   Kronolith menu?">true</configboolean>
   <configboolean name="import_export" desc="Should we display an Import/Export
    link in the Horde application menus?">true</configboolean>
   <configmultienum name="apps" desc="Select any applications that should be
index 907f05d..c17a7f0 100644 (file)
@@ -13,27 +13,16 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 $view = Kronolith::getView('Day');
 $title = $view->getTime($prefs->getValue('date_format'));
-$print_view = (bool)Horde_Util::getFormData('print');
 
 Horde::addScriptFile('tooltips.js', 'horde', true);
 require KRONOLITH_TEMPLATES . '/common-header.inc';
-
-if ($print_view) {
-    require $registry->get('templates', 'horde') . '/javascript/print.js';
-} else {
-    require KRONOLITH_TEMPLATES . '/menu.inc';
-}
+require KRONOLITH_TEMPLATES . '/menu.inc';
 
 echo '<div id="page">';
-if (!$print_view) {
-    Kronolith::tabs();
-}
+Kronolith::tabs();
 $view->html(KRONOLITH_TEMPLATES);
 echo '</div>';
 
-if ($print_view) {
-    require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
-} else {
-    require KRONOLITH_TEMPLATES . '/panel.inc';
-}
+require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
+require KRONOLITH_TEMPLATES . '/panel.inc';
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 4e71f64..7dc6fe4 100644 (file)
@@ -44,19 +44,11 @@ case 'EditEvent':
 }
 
 $title = $view->getTitle();
-$print_view = (bool)Horde_Util::getFormData('print');
 require KRONOLITH_TEMPLATES . '/common-header.inc';
-
-if ($print_view) {
-    require_once $registry->get('templates', 'horde') . '/javascript/print.js';
-} else {
-    require KRONOLITH_TEMPLATES . '/menu.inc';
-}
+require KRONOLITH_TEMPLATES . '/menu.inc';
 
 echo '<div id="page">';
-if (!$print_view) {
-    Kronolith::eventTabs($viewName, $view->event);
-}
+Kronolith::eventTabs($viewName, $view->event);
 $view->html();
 echo '</div>';
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index eb3e90f..ef2e391 100644 (file)
@@ -92,7 +92,6 @@ function _ShowView()
     if (viewVars) {
         kronolithView = viewVars.readAttribute('view');
         kronolithDate = new Date(viewVars.readAttribute('date'));
-        kronolithPrintLink = viewVars.readAttribute('print');
     }
 }
 
index 5fa886c..39e7347 100644 (file)
@@ -1783,31 +1783,21 @@ class Kronolith
     }
 
     /**
-     * Should we show event location, based on the show_location
-     * preference and $print_view?
+     * Should we show event location, based on the show_location pref?
      */
     public static function viewShowLocation()
     {
         $show = @unserialize($GLOBALS['prefs']->getValue('show_location'));
-        if (!empty($GLOBALS['print_view'])) {
-            return @in_array('print', $show);
-        } else {
-            return @in_array('screen', $show);
-        }
+        return @in_array('screen', $show);
     }
 
     /**
-     * Should we show event time, based on the show_time preference
-     * and $print_view?
+     * Should we show event time, based on the show_time preference?
      */
     public static function viewShowTime()
     {
         $show = @unserialize($GLOBALS['prefs']->getValue('show_time'));
-        if (!empty($GLOBALS['print_view'])) {
-            return @in_array('print', $show);
-        } else {
-            return @in_array('screen', $show);
-        }
+        return @in_array('screen', $show);
     }
 
     /**
@@ -1891,12 +1881,6 @@ class Kronolith
             $menu->add(Horde::applicationUrl('data.php'), _("_Import/Export"), 'data.png', $registry->getImageDir('horde'));
         }
 
-        /* Print. */
-        if ($conf['menu']['print'] && ($view = Horde_Util::nonInputVar('view'))) {
-            Horde::addScriptFile('popup.js', 'horde', true);
-            $menu->add(Horde_Util::addParameter($view->link(), 'print', 1), _("_Print"), 'print.png', $registry->getImageDir('horde'), '_blank', 'Horde.popup({ url: kronolithPrintLink ? kronolithPrintLink : this.href });return false;', '__noselection');
-        }
-
         return $menu;
     }
 
index f656b90..4e76c05 100644 (file)
@@ -12,27 +12,16 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 $view = Kronolith::getView('Month');
 $title = $view->date->strftime('%B %Y');
-$print_view = (bool)Horde_Util::getFormData('print');
 
 Horde::addScriptFile('tooltips.js', 'horde', true);
 require KRONOLITH_TEMPLATES . '/common-header.inc';
-
-if ($print_view) {
-    require $registry->get('templates', 'horde') . '/javascript/print.js';
-} else {
-    require KRONOLITH_TEMPLATES . '/menu.inc';
-}
+require KRONOLITH_TEMPLATES . '/menu.inc';
 
 echo '<div id="page">';
-if (!$print_view) {
-    Kronolith::tabs();
-}
+Kronolith::tabs();
 $view->html();
 echo '</div>';
 
-if ($print_view) {
-    require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
-} else {
-    require KRONOLITH_TEMPLATES . '/panel.inc';
-}
+require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
+require KRONOLITH_TEMPLATES . '/panel.inc';
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 2ebd8ba..587bc99 100644 (file)
@@ -4,6 +4,8 @@ foreach ($GLOBALS['display_calendars'] as $calendarId) {
     $calendar_names[] = htmlspecialchars($GLOBALS['all_calendars'][$calendarId]->get('name'));
 }
 ?>
-<br />
-<h3><?php echo _("Calendars Printed: ") ?></h3>
-<p><?php echo implode(', ', $calendar_names) ?></p>
+<div id="calendarPrint">
+ <br />
+ <h3><?php echo _("Calendars Printed: ") ?></h3>
+ <p><?php echo implode(', ', $calendar_names) ?></p>
+</div>
index 5211209..0740ed1 100644 (file)
@@ -40,7 +40,6 @@ $currentDate = Kronolith::currentDate();
 <script type="text/javascript">//<![CDATA[
 var kronolithView = '<?php if (isset($view) && is_object($view)) echo $view->getName() ?>';
 var kronolithDate = new Date(<?php printf('%d, %d, %d', $currentDate->year, $currentDate->month - 1, $currentDate->mday) ?>);
-var kronolithPrintLink = '';
 //]]></script>
 <title><?php echo htmlspecialchars($page_title) ?></title>
 <link href="<?php echo $GLOBALS['registry']->getImageDir()?>/favicon.ico" rel="SHORTCUT ICON" />
diff --git a/kronolith/themes/graphics/az.png b/kronolith/themes/graphics/az.png
deleted file mode 100644 (file)
index 2b646f9..0000000
Binary files a/kronolith/themes/graphics/az.png and /dev/null differ
diff --git a/kronolith/themes/graphics/redbox_spinner.gif b/kronolith/themes/graphics/redbox_spinner.gif
deleted file mode 100644 (file)
index 35218b3..0000000
Binary files a/kronolith/themes/graphics/redbox_spinner.gif and /dev/null differ
diff --git a/kronolith/themes/graphics/za.png b/kronolith/themes/graphics/za.png
deleted file mode 100644 (file)
index a154237..0000000
Binary files a/kronolith/themes/graphics/za.png and /dev/null differ
diff --git a/kronolith/themes/print/screen.css b/kronolith/themes/print/screen.css
deleted file mode 100644 (file)
index 660b220..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-.rowEven td, .rowOdd td {
-    background: #fff;
-    color: #000;
-    border-bottom: thin solid #000;
-}
-.rowEven td td, .rowOdd td td {
-    border: none;
-}
-.selected-control {
-    background: #fff;
-    border-bottom: thin solid #000;
-}
-
-.iconAlarm, .iconDelete, .iconEdit, .iconRecur, .iconAdd, a.newEvent, .iconNav {
-    display: none;
-}
-
-.day, .othermonth, .weekend {
-    background-color: #fff;
-    color: #000;
-}
-.day {
-    border-right: thin solid #000;
-    border-bottom: thin solid #000;
-}
-.year-event {
-    background: #fff;
-}
-table.monthgrid {
-    border-top: thin solid #000;
-    border-left: thin solid #000;
-}
-table.monthgrid th, table.monthgrid td {
-    border-right: thin solid #000;
-    border-bottom: thin solid #000;
-    padding: 2px;
-}
-table.monthgrid td.today {
-    border-top: none;
-    border-left: none;
-    border-right: thin solid #000;
-    border-bottom: thin solid #000;
-}
-.month-eventbox {
-    border: none;
-    -moz-border-radius: 0;
-    -webkit-border-radius: 0;
-    border-bottom: thin solid #000;
-}
-
-body.rightPanel #page {
-    margin: 0;
-}
index 02d1757..134bbb6 100644 (file)
@@ -1,70 +1,3 @@
-#menu {
-    /* Menu bottom margin, added for BC. */
-    margin-bottom: 8px;
-}
-
-/* Image alignment, added for BC. */
-img {
-    vertical-align: middle;
-}
-
-/* Added for BC. */
-.hidden {
-    display: none;
-}
-
-/* Alternating styles. item0, item1 are deprecated. */
-.rowEven {
-    background: #eee;
-}
-.rowOdd {
-    background: #ddd;
-}
-
-/* Sort arrow styles, added for BC. */
-.sortup {
-    background: #bbcbff url("graphics/za.png") center left no-repeat;
-    padding-left: 10px;
-}
-.sortdown {
-    background: #bbcbff url("graphics/az.png") center left no-repeat;
-    padding-left: 10px;
-}
-
-/* Calendar Popup, added for BC. */
-table.calendarPopup {
-    border: 1px solid #ccc;
-    background: #fff;
-    width: auto;
-}
-.calendarPopup thead {
-    font-weight: bold;
-}
-.calendarPopup th {
-    border-bottom: 1px solid #ccc;
-}
-.calendarPopup tbody {
-    text-align: right;
-}
-.calendarPopup a {
-    color: #000;
-    display: block;
-    padding: 2px;
-}
-.calendarPopup tbody a:hover {
-    background: #ffc;
-}
-.calendarPopup .week {
-    font-style: italic;
-}
-.calendarPopup .current {
-    font-weight: bold;
-    background: #eef;
-}
-.calendarPopup .today {
-    font-weight: bold;
-}
-
 /* Autocomplete styles. */
 .autocomplete {
     background: #f4f4f4;
@@ -100,8 +33,6 @@ table.calendarPopup {
     font-weight: bold;
     vertical-align: super;
 }
-.event {
-}
 .event-tentative {
     font-style: italic;
 }
@@ -371,14 +302,6 @@ table#calendar-list td {
     border-right: 1px solid #ddd;
     border-bottom: 1px solid #ddd;
 }
-table#calendar-list th.sortup {
-    background: #bbcbff url("graphics/za.png") center left no-repeat;
-    padding-left: 10px;
-}
-table#calendar-list th.sortdown {
-    background: #bbcbff url("graphics/az.png") center left no-repeat;
-    padding-left: 10px;
-}
 
 #calendar-list-buttons {
     padding: 1em;
@@ -401,41 +324,6 @@ table#calendar-list th.sortdown {
     width: 1%;
 }
 
-/* Redbox styles. */
-#RB_overlay {
-    position: absolute;
-    z-index: 100;
-    width: 100%;
-    height: 100%;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    min-height: 100%;
-    background-color: #000;
-    opacity: .6;
-    filter: alpha(opacity=60);
-}
-#RB_loading {
-    z-index: 101;
-    width: 66;
-    margin-left: auto;
-    margin-right: auto;
-    margin-top: 200px;
-    padding-bottom: 66px;
-    text-align: center;
-    background: url("graphics/redbox_spinner.gif") no-repeat center bottom;
-}
-#RB_window {
-    z-index: 102;
-    background-color: #fff;
-    display: block;
-    text-align: left;
-    overflow: hidden;
-    margin: 20px auto 0 auto;
-    position: absolute;
-}
-
 #RB_confirm {
     width: 20em;
     padding: 1em;
@@ -1414,3 +1302,70 @@ li.panel-tags {
     border-color: #807b00;
     color: #000;
 }
+
+#calendarPrint {
+    display: none;
+}
+
+@media print {
+    .rowEven td, .rowOdd td {
+        background: #fff;
+        color: #000;
+        border-bottom: thin solid #000;
+    }
+    .rowEven td td, .rowOdd td td {
+        border: none;
+    }
+    .selected-control {
+        background: #fff;
+        border-bottom: thin solid #000;
+    }
+
+    .iconAlarm, .iconDelete, .iconEdit, .iconRecur, .iconAdd, a.newEvent, .iconNav, #kronolithMenu, #kronolithBar, #kronolithHeader, .tabset {
+        display: none;
+    }
+
+    #kronolithBody {
+        position: static;
+    }
+
+    #calendarPrint {
+        display: block;
+    }
+
+    .day, .othermonth, .weekend {
+        background-color: #fff;
+        color: #000;
+    }
+    .day {
+        border-right: thin solid #000;
+        border-bottom: thin solid #000;
+    }
+    .year-event {
+        background: #fff;
+    }
+    table.monthgrid {
+        border-top: thin solid #000;
+        border-left: thin solid #000;
+    }
+    table.monthgrid th, table.monthgrid td {
+        border-right: thin solid #000;
+        border-bottom: thin solid #000;
+        padding: 2px;
+    }
+    table.monthgrid td.today {
+        border-top: none;
+        border-left: none;
+        border-right: thin solid #000;
+        border-bottom: thin solid #000;
+    }
+    .month-eventbox {
+        border: none;
+        -moz-border-radius: 0;
+        -webkit-border-radius: 0;
+        border-bottom: thin solid #000;
+    }
+    body.rightPanel #page {
+        margin: 0;
+    }
+}
index 921a8f5..77ef9bc 100644 (file)
@@ -12,8 +12,7 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 $view = Kronolith::getView(Horde_Util::getFormData('view'));
 if ($view) {
-    $print_view = false;
     Kronolith::tabs(strtolower(str_replace('kronolith_view_', '', Horde_String::lower(get_class($view)))));
     $view->html();
-    echo '<div style="display:none" id="view_vars" view="' . htmlspecialchars(Horde_Util::getFormData('view')) . '" date="' . Kronolith::currentDate()->format(DATE_RFC2822) . '" print="' . Horde_Util::addParameter($view->link(), 'print', 1) . '">';
+    echo '<div style="display:none" id="view_vars" view="' . htmlspecialchars(Horde_Util::getFormData('view')) . '" date="' . Kronolith::currentDate()->format(DATE_RFC2822) . '">';
 }
index 2624605..ad2438e 100644 (file)
@@ -13,27 +13,16 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 $view = Kronolith::getView('Week');
 $title = sprintf(_("Week %d"), $view->week);
-$print_view = (bool)Horde_Util::getFormData('print');
 
 Horde::addScriptFile('tooltips.js', 'horde', true);
 require KRONOLITH_TEMPLATES . '/common-header.inc';
-
-if ($print_view) {
-    require $registry->get('templates', 'horde') . '/javascript/print.js';
-} else {
-    require KRONOLITH_TEMPLATES . '/menu.inc';
-}
+require KRONOLITH_TEMPLATES . '/menu.inc';
 
 echo '<div id="page">';
-if (!$print_view) {
-    Kronolith::tabs();
-}
+Kronolith::tabs();
 $view->html(KRONOLITH_TEMPLATES);
 echo '</div>';
 
-if ($print_view) {
-    require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
-} else {
-    require KRONOLITH_TEMPLATES . '/panel.inc';
-}
+require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
+require KRONOLITH_TEMPLATES . '/panel.inc';
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index af0523e..14534dc 100644 (file)
@@ -13,27 +13,16 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 $view = Kronolith::getView('WorkWeek');
 $title = sprintf(_("Week %d"), $view->week);
-$print_view = (bool)Horde_Util::getFormData('print');
 
 Horde::addScriptFile('tooltips.js', 'horde', true);
 require KRONOLITH_TEMPLATES . '/common-header.inc';
-
-if ($print_view) {
-    require $registry->get('templates', 'horde') . '/javascript/print.js';
-} else {
-    require KRONOLITH_TEMPLATES . '/menu.inc';
-}
+require KRONOLITH_TEMPLATES . '/menu.inc';
 
 echo '<div id="page">';
-if (!$print_view) {
-    Kronolith::tabs();
-}
+Kronolith::tabs();
 $view->html(KRONOLITH_TEMPLATES);
 echo '</div>';
 
-if ($print_view) {
-    require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
-} else {
-    require KRONOLITH_TEMPLATES . '/panel.inc';
-}
+require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
+require KRONOLITH_TEMPLATES . '/panel.inc';
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index 91c9fed..6bacf70 100644 (file)
@@ -13,27 +13,16 @@ require_once dirname(__FILE__) . '/lib/base.php';
 
 $view = Kronolith::getView('Year');
 $title = $view->year;
-$print_view = (bool)Horde_Util::getFormData('print');
 
 Horde::addScriptFile('tooltips.js', 'horde', true);
 require KRONOLITH_TEMPLATES . '/common-header.inc';
-
-if ($print_view) {
-    require $registry->get('templates', 'horde') . '/javascript/print.js';
-} else {
-    require KRONOLITH_TEMPLATES . '/menu.inc';
-}
+require KRONOLITH_TEMPLATES . '/menu.inc';
 
 echo '<div id="page">';
-if (!$print_view) {
-    Kronolith::tabs();
-}
+Kronolith::tabs();
 $view->html();
 echo '</div>';
 
-if ($print_view) {
-    require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
-} else {
-    require KRONOLITH_TEMPLATES . '/panel.inc';
-}
+require KRONOLITH_TEMPLATES . '/calendar_titles.inc';
+require KRONOLITH_TEMPLATES . '/panel.inc';
 require $registry->get('templates', 'horde') . '/common-footer.inc';