Changes to the printer module and page_start() to be a little more helpful with the...
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 11 Oct 2006 02:32:25 +0000 (02:32 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 11 Oct 2006 02:32:25 +0000 (02:32 +0000)
dev/changes.txt
printer.css.php
printer.php

index 0cedda6d5112dbf26aa555f631c37530f648b0ec..79ef1158e82001efce4dcaf75c850c759323e3cc 100644 (file)
@@ -1,3 +1,7 @@
+2.0.2
+===============
+- ** API BREAK ** changed Printer->page_start() to be more internationalization-friendly and to use more CSS rather than nested <div>s [printer.php]
+
 2.0.1
 ===============
 - Added TYPE_NONE as an alias for TYPE_NOCLEAN
index 9664687521314ca614b544f2f660cc7e672f263c..f1640e008834500ee9bf2dba793cf6df7bc417bb 100755 (executable)
@@ -73,6 +73,8 @@ body
        color: rgb(96, 106, 90);
        
        background-color: rgb(232, 255, 198);
+       
+       padding: 15px;
 }
 
 /* Border area around tables and inbetween spacing */
index 355e7d93e78c8174cf1dbcd797e54da39ad05d21..b738a1981afd21187147185630009847ee232887 100644 (file)
 *                                                                      box) from being printed
 *              ISSO_PRINTER_NO_NAVIGATION - Do not show the navigation frame from ISSO.Printer.Navigation
 *
-* Hooks:
-*              $this->page_start_hook - Define function to echo() data after the page header
-*                                                              has been outputted
-*
 * @author              Blue Static
 * @copyright   Copyright ©2002 - [#]year[#], Blue Static
 * @version             $Revision$
@@ -86,14 +82,20 @@ class Printer
        */
        var $page_start_hook = ':=NO METHOD=:';
        
+       /**
+       * Language information array: ('langcode' =>, 'direction' =>, 'charset' =>)
+       * @var  array
+       * @access       private
+       */
+       var $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8');
+       
        /**
        * Fields array that is used in this module
        * @var  array
        * @access       private
        */
        var $fields = array(
-               'realm'                         => array(REQ_YES,       null,   false),
-               'page_start_hook'       => array(REQ_NO,        null,   false)
+               'realm'                         => array(REQ_YES,       null,   false)
        );
        
        // ###################################################################
@@ -128,6 +130,32 @@ class Printer
                $this->registry->do_set($name, $value, 'printer');
        }
        
+       // ###################################################################
+       /**
+       * Gets the language array information
+       *
+       * @access       public
+       *
+       * @return       array   Language array
+       */
+       function getLanguageInformation()
+       {               
+               return $this->language;
+       }
+       
+       // ###################################################################
+       /**
+       * Sets the language array information
+       *
+       * @access       public
+       *
+       * @param        array   Language array
+       */
+       function setLanguageInformation($lang)
+       {               
+               $this->language = $lang;
+       }
+       
        // ###################################################################
        /**
        * Gets an ISSO field
@@ -278,14 +306,10 @@ JS;
        *
        * @param        string  Title of the page
        * @param        string  Class of the page to be applied to the body
-       * @param        integer Margin of the <div> that all content is placed in
        * @param        string  Extra HTML to imbed in the <head> tag
        * @param        string  <body> onLoad action to imbed
-       * @param        integer Margin of the actual <body > tag
-       * @param        string  Relative path where the CSS data is stored
-       * @param        bool    Will force re-print the header if it has already been printed
        */
-       function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.', $override = false)
+       function page_start($actiontitle, $pageclass = null, $extra = '', $onload = false)
        {
                $this->registry->check_isso_fields(get_class($this));
                
@@ -294,31 +318,21 @@ JS;
                        ob_start();
                }
                
-               if (defined('ISSO_PRINTER_DONE_HEADER') AND !$override)
+               if (defined('ISSO_PRINTER_DONE_HEADER') AND constant('ISSO_PRINTER_DONE_HEADER'))
                {
-                       if (constant('ISSO_PRINTER_DONE_HEADER') AND !$override)
-                       {
-                               return;
-                       }
+                       return;
                }
                
                $title = sprintf($this->registry->modules['localize']->string('%1$s - %2$s - %3$s'), $this->registry->application, $this->realm, $actiontitle);
                
                echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
-               echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>";
+               echo "<html xml:lang=\"" . $this->language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n<head>";
                echo "\n\t<title>$title</title>";
-               echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
+               echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $this->language['charset'] . "\" />";
                echo $this->css;
                echo $this->code;
                echo ($extra ? "\n$extra" : '');
-               echo "\n</head>\n<body style=\"margin: {$margin}px;\"" . (($pageclass !== ':default:') ? " class=\"$pageclass\"" : '') . (($onload) ? " onload=\"$onload\"" : '') . ">\n";
-               
-               if (is_callable($this->page_start_hook))
-               {
-                       call_user_func($this->page_start_hook);
-               }
-               
-               echo "<div style=\"margin: {$pagemargin}px;\">\n<!-- / page head -->\n\n";
+               echo "\n</head>\n<body" . ($pageclass != null ? " class=\"$pageclass\"" : '') . ($onload ? " onload=\"$onload\"" : '') . ">\n";
                
                if ($this->registry->is_loaded('printer_navigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true)))
                {
@@ -472,13 +486,9 @@ JS;
                                
                if (!defined('ISSO_PRINTER_HIDE_SETUP'))
                {
-                       echo "\n<!-- page end -->\n</div>\n$copyright";
+                       echo "\n$copyright";
                        echo $this->registry->construct_debug_block(false);
                }
-               else
-               {
-                       echo "\n<!-- page end -->\n</div>";
-               }
                
                echo "\n\n</body>\n</html>";