From daaa751a995cf4767b2f0fc55795725ef0ccb314 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 11 Oct 2006 02:32:25 +0000 Subject: [PATCH] Changes to the printer module and page_start() to be a little more helpful with the way it works. Added language support to the Printer module to allow for RTL and languages. --- dev/changes.txt | 4 +++ printer.css.php | 2 ++ printer.php | 72 ++++++++++++++++++++++++++++--------------------- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/dev/changes.txt b/dev/changes.txt index 0cedda6..79ef115 100644 --- a/dev/changes.txt +++ b/dev/changes.txt @@ -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
s [printer.php] + 2.0.1 =============== - Added TYPE_NONE as an alias for TYPE_NOCLEAN diff --git a/printer.css.php b/printer.css.php index 9664687..f1640e0 100755 --- a/printer.css.php +++ b/printer.css.php @@ -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 */ diff --git a/printer.php b/printer.php index 355e7d9..b738a19 100644 --- a/printer.php +++ b/printer.php @@ -39,10 +39,6 @@ * 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
that all content is placed in * @param string Extra HTML to imbed in the tag * @param string onLoad action to imbed - * @param integer Margin of the actual 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 "\n"; - echo "\n"; + echo "language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n"; echo "\n\t$title"; - echo "\n\t"; + echo "\n\t"; echo $this->css; echo $this->code; echo ($extra ? "\n$extra" : ''); - echo "\n\n\n"; - - if (is_callable($this->page_start_hook)) - { - call_user_func($this->page_start_hook); - } - - echo "
\n\n\n"; + echo "\n\n\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\n
\n$copyright"; + echo "\n$copyright"; echo $this->registry->construct_debug_block(false); } - else - { - echo "\n\n
"; - } echo "\n\n\n"; -- 2.22.5