From 0c876a155f511244f4968487291b6b7814f14f29 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 4 Jan 2009 19:19:48 -0800 Subject: [PATCH] Removing the BSPrinter module * Printer.php: Removed * PrinterAbstract.php: Removed * PrinterElement.php: Removed * PrinterElementLabel.php: Removed * PrinterElementTable.php: Removed * PrinterNavigation.php: Removed * PrinterRootAbstract.php: Removed * PrinterRootForm.php: Removed * PrinterRootPage.php: Removed * PrinterRootTable.php: Removed * docs/printertest.php: Removed * printer.css.php: Removed --- CHANGES | 1 + Printer.php | 182 ----------------- PrinterAbstract.php | 165 ---------------- PrinterElement.php | 246 ----------------------- PrinterElementLabel.php | 87 --------- PrinterElementTable.php | 390 ------------------------------------- PrinterNavigation.php | 238 ---------------------- PrinterRootAbstract.php | 69 ------- PrinterRootForm.php | 145 -------------- PrinterRootPage.php | 368 ----------------------------------- PrinterRootTable.php | 174 ----------------- docs/printertest.php | 57 ------ printer.css.php | 422 ---------------------------------------- 13 files changed, 1 insertion(+), 2543 deletions(-) delete mode 100644 Printer.php delete mode 100644 PrinterAbstract.php delete mode 100644 PrinterElement.php delete mode 100644 PrinterElementLabel.php delete mode 100644 PrinterElementTable.php delete mode 100644 PrinterNavigation.php delete mode 100644 PrinterRootAbstract.php delete mode 100644 PrinterRootForm.php delete mode 100644 PrinterRootPage.php delete mode 100644 PrinterRootTable.php delete mode 100644 docs/printertest.php delete mode 100755 printer.css.php diff --git a/CHANGES b/CHANGES index 18c3703..52301bb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 3.2.0 =================== - New: Decorator.css.php and Decorator.js to be used to create HTML templates with standard formatting +- Removed: BSPrinter* and all its variants have been removed, use Decorator+Template instead 3.1.3 =================== diff --git a/Printer.php b/Printer.php deleted file mode 100644 index fa36349..0000000 --- a/Printer.php +++ /dev/null @@ -1,182 +0,0 @@ - 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8'); - - /** - * CSS stylesheet to link to - * @var string - */ - private $stylesheet; - - /** - * Realm; the extra bit added to the title - * @var string - */ - private $realm = 'BSPrinterOutput'; - - /** - * The copyright string used in the footer - * @var string - */ - private $copyright; - - /** - * Constructor (private) - */ - private function __construct() {} - - /** - * Returns the singleton instance - * - * @return BSPrinter Singleton instance - */ - private static function _instance() - { - if (!self::$instance) - { - self::$instance = new BSPrinter(); - } - return self::$instance; - } - - /** - * Returns the copyright string - * - * @return string - */ - public static function get_copyright() - { - self::_instance()->copyright; - } - - /** - * Sets the copyright string - * - * @param string The copyright string - */ - public static function set_copyright($copyright) - { - self::_instance()->copyright = $copyright; - } - - /** - * Returns the realm - * - * @return string Realm - */ - public static function get_realm() - { - return self::_instance()->realm; - } - - /** - * Sets the realm - * - * @param string Realm - */ - public static function set_realm($realm) - { - self::_instance()->realm = $realm; - } - - /** - * Returns the language array - * - * @return array Language array - */ - public static function get_language_information() - { - return self::_instance()->language; - } - - /** - * Sets the language array information - * - * @param array Language array - */ - public static function set_language_information($lang) - { - self::_instance()->language = $lang; - } - - /** - * Returns the stylesheet URL - * - * @return string Stylesheet link - */ - public static function get_stylesheet() - { - return self::_instance()->stylesheet; - } - - /** - * Sets the path to the CSS style sheet - * - * @param string Path - */ - public static function set_stylesheet($stylesheet) - { - self::_instance()->stylesheet = $stylesheet; - } -} - -?> \ No newline at end of file diff --git a/PrinterAbstract.php b/PrinterAbstract.php deleted file mode 100644 index be53b26..0000000 --- a/PrinterAbstract.php +++ /dev/null @@ -1,165 +0,0 @@ -paint(); - } - - /** - * Sets the CSS class to use. Use ":swap:" to alternate - * - * @param string CSS class - * - * @return fluent interface - */ - public function setCssClass($class) - { - $this->cssClass = $class; - return $this; - } - - /** - * Sets the style information - * - * @param array Style attributes - * - * @return fluent interface - */ - public function setStyle(Array $attributes) - { - $this->style = $attributes; - return $this; - } - - /** - * Sets the DOM/CSS ID of the element - * - * @param string The ID - * - * @return fluent interface - */ - public function setId($id) - { - $this->id = $id; - return $this; - } - - /** - * Returns a string of style attributes, that include id, style, and class - * - * @return string Style attributes - */ - protected function _prepareStyle() - { - if (empty($this->style) && empty($this->cssClass) && empty($this->id)) - { - return; - } - - if ($this->cssClass == ':swap:') - { - BSFunctions::swap_css_classes(); - $class = BSFunctions::$cssClass; - } - else - { - $class = $this->cssClass; - } - - $attrs = array(); - - foreach ($this->style as $prop => $value) - { - $attrs[] = $prop . ': ' . $value; - } - - $style = implode('; ', $attrs); - - $string = ''; - if ($class) - { - $string .= ' class="' . $class . '"'; - } - if ($style) - { - $string .= ' style="' . $style . '"'; - } - if ($this->id) - { - $string .= ' id="' . $this->id . '"'; - } - - return $string; - } -} - -?> \ No newline at end of file diff --git a/PrinterElement.php b/PrinterElement.php deleted file mode 100644 index 21590c6..0000000 --- a/PrinterElement.php +++ /dev/null @@ -1,246 +0,0 @@ -type = $type; - $this->name = $name; - $this->value = $value; - $this->setCssClass('input'); - - if ($type == 'textarea') - { - $this->setStyle(array('width' => '100%', 'height' => '50px')); - } - } - - /** - * Makes a new instance of the object in a static fashion - * - * @return object - */ - public static function make() - { - $obj = new ReflectionClass(__CLASS__); - $args = func_get_args(); - return $obj->newInstanceArgs($args); - } - - /** - * If the type is either checkbox, radio, or option then this will - * set the selected/checked attribute - * - * @param boolean Active? - * - * @return fluent interface - */ - public function setActive($active) - { - if (!in_array($this->type, array('checkbox', 'radio', 'option'))) - { - throw new Exception('BSPrinterElement::setActive() can only be used on elements of type checkbox, radio, or option'); - } - $this->active = $active; - return $this; - } - - /** - * Sets the JavaScript onclick action - * - * @param string onClick attribute value - * - * @return fluent interface - */ - public function setOnClick($onClick) - { - $this->onClick = $onClick; - return $this; - } - - /** - * Sets the accesskey attribute value - * - * @param string Access key - * - * @return fluent interface - */ - public function setAccessKey($accessKey) - { - $this->accessKey = $accessKey; - return $this; - } - - /** - * Returns the type - * - * @return string Element type - */ - public function getType() - { - return $this->type; - } - - /** - * Returns the name of the element - * - * @return string Name - */ - public function getName() - { - return $this->name; - } - - /** - * Sets the name of the element - * - * @param string A new name - * - * @return fluent interface - */ - public function setName($name) - { - $this->name = $name; - return $this; - } - - /** - * Returns the output HTML - * - * @return string Output HTML - */ - public function paint() - { - $name = ' name="' . $this->name . '"'; - $value = ' value="' . $this->value . '"'; - $onclick = ($this->onClick ? ' onclick="' . $this->onClick . '"' : ''); - $accesskey = ($this->accessKey ? ' accesskey="' . $this->accessKey . '"' : ''); - - $attrs = $name . $value . $onclick . $accesskey; - - switch ($this->type) - { - case 'text': - case 'password': - case 'button': - case 'submit': - case 'reset': - return 'type == 'text' || $this->type == 'password') ? ' size="35" maxlength="255"' : ''). $this->_prepareStyle() . ' />'; - break; - - case 'hidden': - return ''; - break; - - case 'checkbox': - case 'radio': - return 'active ? ' checked="checked"' : '') . $this->_prepareStyle() . ' />'; - break; - - case 'upload': - return '_prepareStyle() . ' />'; - break; - - case 'option': - return 'active ? ' selected="selected"' : '') . $this->_prepareStyle() . '>' . $this->name . ''; - break; - - case 'select': - return '_prepareStyle() . $accesskey . '>' . $this->value . ''; - break; - - case 'textarea': - if (!isset($this->style['height']) || !isset($this->style['width'])) - { - throw new Exception('BSPrinterElement of type "textarea" require a "height" and "width" style attribute'); - } - - return '_prepareStyle() . $accesskey . '>' . $this->value . ''; - break; - - default: - throw new Exception('Invalid BSPrinterElement type "' . $this->type . '"'); - break; - } - } -} - -?> \ No newline at end of file diff --git a/PrinterElementLabel.php b/PrinterElementLabel.php deleted file mode 100644 index 673ab80..0000000 --- a/PrinterElementLabel.php +++ /dev/null @@ -1,87 +0,0 @@ -string = $string; - $this->setCssClass(null); - } - - /** - * Makes a new instance of the object in a static fashion - * - * @return object - */ - public static function make() - { - $obj = new ReflectionClass(__CLASS__); - $args = func_get_args(); - return $obj->newInstanceArgs($args); - } - - /** - * Prints the string - * - * @return string The string; wrapped in a if it has styling - */ - public function paint() - { - if ($this->_prepareStyle()) - { - return '_prepareStyle() . '>' . $this->string . ''; - } - return $this->string; - } -} - -?> \ No newline at end of file diff --git a/PrinterElementTable.php b/PrinterElementTable.php deleted file mode 100644 index 7243426..0000000 --- a/PrinterElementTable.php +++ /dev/null @@ -1,390 +0,0 @@ - $value) - { - if (!($value instanceof BSPrinterAbstract)) - { - $childs[$key] = BSPrinterElementLabel::make($value); - } - } - $this->children = $childs; - } - } - - /** - * Makes a new instance of the object in a static fashion - * - * @return object - */ - public static function make() - { - $obj = new ReflectionClass(__CLASS__); - $args = func_get_args(); - return $obj->newInstanceArgs($args); - } - - /** - * Prints a simple row of text and text - * - * @param string Label (left side) - * @param string Value (right side) - * - * @return BSPrinterElementTable Table row element - */ - public static function row_label($label, $value) - { - $tr = new BSPrinterElementTable(); - - $tr->addChild(new BSPrinterElementLabel($label)); - $tr->addChild(new BSPrinterElementLabel($value)); - - return $tr; - } - - /** - * Creates an input[text/password] field row - * - * @param string Label - * @param string Field name - * @param mixed Default value - * @param bool A password field? - * - * @return BPrinterElementTable Table row element - */ - public static function row_text($label, $name, $value = null, $password = false) - { - $tr = new BSPrinterElementTable(); - - $tr->addChild(new BSPrinterElementLabel($label)); - $tr->addChild(new BSPrinterElement(($password ? 'password' : 'text'), $name, $value)); - - return $tr; - } - - /** - * Creates a submit row - * - * @param array Child elements to add before the buttons - * @param string Save button text - * @param string Reset button text - * - * @return BSPrinterElementTable Table row element - */ - public static function row_submit(Array $children = null, $save = ':submit:', $reset = ':reset:') - { - $build = ''; - if (sizeof($children) > 0) - { - foreach ($children as $child) - { - $build .= "\n\t\t\t" . $child->paint(); - } - } - - $save = ($save == ':submit:' ? _('Submit') : $save); - $reset = ($reset == ':reset:' ? _('Reset') : $reset); - - if (!is_null($save)) - { - $elm = new BSPrinterElement('submit', '__submit__', " $save "); - $elm->setAccessKey('s'); - $build .= "\n\t\t\t" . $elm->paint(); - } - - if (!is_null($reset)) - { - $elm = new BSPrinterElement('reset', '__reset__', " $reset "); - $elm->setAccessKey('r'); - $build .= "\n\t\t\t" . $elm->paint() . "\n\t\t"; - } - - $tr = new BSPrinterElementTable(); - $tr->addChild(new BSPrinterElementLabel($build)); - $tr->setCssClass('tfoot'); - - return $tr; - } - - /** - * Constructs a - * - * @return BSPrinterElementTable Upload form - */ - public static function row_upload($label, $name) - { - $tr = new BSPrinterElementTable(); - - $tr->addChild(new BSPrinterElementLabel($label)); - $tr->addChild(new BSPrinterElement('upload', $name)); - - return $tr; - } - - /** - * Creates a row with a radio select option for yes/no - * - * @param string Row label - * @param string Name of the radio buttons - * @param bool Yes is selected? (if false, No is selected) - * - * @return BSPrinterElementTable Yes-No row - */ - public static function row_yes_no($label, $name, $yes) - { - $elm = new BSPrinterElement('radio', $name, 1); - $elm->setActive($yes); - - $build = $elm->paint() . ' ' . _('Yes') . ' '; - - $elm = new BSPrinterElement('radio', $name, 0); - $elm->setActive(!$yes); - - $build .= $elm->paint() . ' ' . _('No'); - - $tr = new BSPrinterElementTable(); - $tr->addChild(new BSPrinterElementLabel($label)); - $tr->addChild(new BSPrinterElementLabel($build)); - return $tr; - } - - /** - * Prints a row with a textarea - * - * @param string Label - * @param string Textarea name - * @param string Value to fill with - * - * @return BSPrinterElementTable Table row - */ - public static function row_textarea($label, $name, $value = null) - { - $tr = new BSPrinterElementTable(); - - $tr->addChild(new BSPrinterElementLabel($label)); - $tr->addChild(new BSPrinterElement('textarea', $name, $value)); - - return $tr; - } - - /** - * Returns the number of columns in this element - * - * @return integer Column count - */ - public function numberOfColumns() - { - return sizeof($this->children); - } - - /** - * Adds a child node to the element - * - * @param BSPrinterAbstract A child element - * - * @return fluent interface - */ - public function addChild(BSPrinterAbstract $child) - { - $this->children[] = $child; - return $this; - } - - /** - * Sets the number of columns this row should have and pads the - * elements accordingly - * - * @param integer Column count - * - * @return fluent interface - */ - public function setColumnNumber($cols) - { - if ($cols < $this->numberOfColumns()) - { - throw new Exception('You need to have at least ' . $this->numberOfColumns() . ' columns'); - } - $this->colspan = $cols; - return $this; - } - - /** - * Returns the HTML for all printed children elements - * - * @return string Printed HTML - */ - protected function _paintChildren() - { - $builder = ''; - - $numCols = $this->numberOfColumns(); - $even = true; - - if ($this->colspan % $numCols == 0) - { - $cols = $this->colspan / $numCols; - $even = true; - } - else - { - $cols = intval($this->colspan / $numCols); - $even = false; - } - - $i = 0; - foreach ($this->children as $child) - { - $i++; - $colspan = (($i == $numCols && !$even) ? $cols + 1 : $cols); - $builder .= "\n\t\t 1 ? ' colspan="' . $colspan . '"' : '') . ">" . $child->paint() . ""; - } - - return $builder; - } - - /** - * Paints the entire table row - * - * @return string Table row HTML - */ - public function paint() - { - return "\t_prepareStyle() . ">" . $this->_paintChildren() . "\n\t"; - } -} - -?> \ No newline at end of file diff --git a/PrinterNavigation.php b/PrinterNavigation.php deleted file mode 100644 index b41175a..0000000 --- a/PrinterNavigation.php +++ /dev/null @@ -1,238 +0,0 @@ -structure = new SimpleXMLElement($xml); - } - - /** - * Adds focus to a given key - * - * @param string Key - */ - public function addFocus($key) - { - if (sizeof($this->structure->xpath('//*[@key="' . $key . '"]')) != 1) - { - throw new Exception('The key passed to BSPrinterNavigation::addFocus() is either too vague or nonexistent'); - } - $this->focusKeys[] = $key; - } - - /** - * Adds a section to display. The order in which sections are added is the order - * in which they are painted - * - * @param string Key - */ - public function addSection($key) - { - if (sizeof($this->structure->xpath('//*[@key="' . $key . '"]')) != 1) - { - throw new Exception('The key passed to BSPrinterNavigation::addSection() is either too vague or nonexistent'); - } - $this->displaySections[] = $key; - } - - /** - * Generates the header HTML that is called in BSPrinterRootPage - * to setup the navigation frame - * - * @return string Generated HTML content - */ - public function constructHeaderHtml() - { - $output = '' . "\n\n"; - - // ------------------------------------------------------------------- - - if (isset($this->structure->links)) - { - $links = array(); - foreach ($this->structure->links->link as $link) - { - $attrs = $link->attributes(); - $links[] = '' . $link . ''; - } - } - - $output .= "\n" . ''; - - // ------------------------------------------------------------------- - - $output .= "\n\n" . '
'; - - // ------------------------------------------------------------------- - - if (isset($this->structure->tabs)) - { - $output .= "\n" . '
'; - foreach ($this->structure->tabs->tab as $tab) - { - $link = "\n\t" . 'focusKeys)) - { - $link .= ' id="focustab"'; - } - - $link .= '>' . $tab . ''; - - $output .= $link; - } - $output .= "\n" . '
'; - } - - // ------------------------------------------------------------------- - - $output .= "\n\n" . ''; - $output .= "\n" . ''; - - // ------------------------------------------------------------------- - - $output .= "\n" . ''; - - // ------------------------------------------------------------------- - - $output .= "\n" . ''; - $output .= "\n" . ''; - - $output .= "\n\n" . '
'; - $output .= "\n\n" . '' . "\n"; - - return $output; - } - - /** - * Generates the HTML that is inserted in BSPrinterRootPage that - * closes all of the navigation HTML stuff - * - * @return string Generated HTML content - */ - public function constructFooterHtml() - { - $output = ''; - - $output .= "\n" . '' . "\n"; - - $output .= "\n" . '
'; - - $output .= "\n\n" . '
'; - - return $output; - } -} - -?> \ No newline at end of file diff --git a/PrinterRootAbstract.php b/PrinterRootAbstract.php deleted file mode 100644 index d470871..0000000 --- a/PrinterRootAbstract.php +++ /dev/null @@ -1,69 +0,0 @@ -children[] = $child; - return $this; - } -} - -?> \ No newline at end of file diff --git a/PrinterRootForm.php b/PrinterRootForm.php deleted file mode 100644 index 4d03735..0000000 --- a/PrinterRootForm.php +++ /dev/null @@ -1,145 +0,0 @@ - object. This can have a parent or not: if it does, - * then it will be painted as a child, otherwise it will act as a root. - * - * @author Blue Static - * @copyright Copyright (c)2005 - 2009, Blue Static - * @package ISSO - * - */ -class BSPrinterRootForm extends BSPrinterRootAbstract -{ - /** - * The form's action - * @var string - */ - private $action; - - /** - * "Do" parameter - * @var string - */ - private $do; - - /** - * The form's name - * @var string - */ - private $name; - - /** - * This form is upload-ready - * @var bool - */ - private $upload; - - /** - * Constructor - */ - public function __construct($action, $do, $name = 'issoform') - { - $this->action = $action; - $this->do = $do; - $this->name = $name; - } - - /** - * Makes a new instance of the object in a static fashion - * - * @return object - */ - public static function make() - { - $obj = new ReflectionClass(__CLASS__); - $args = func_get_args(); - return $obj->newInstanceArgs($args); - } - - /** - * Should this form be used for upload? - * - * @param bool Upload? - * - * @return fluent interface - */ - public function setUpload($upload) - { - $this->upload = $upload; - return $this; - } - - /** - * Adds a table row into the child list - * - * @param BSPrinterAbstract Table element - * - * @return fluent interface - */ - public function addChild(BSPrinterAbstract $tr) - { - $this->children[] = $tr; - return $this; - } - - /** - * Returns the HTML for all printed children elements - * - * @return string Printed HTML - */ - protected function _paintChildren() - { - $builder = ''; - - foreach ($this->children as $child) - { - $builder .= "\n" . $child->paint(); - } - - return $builder; - } - - /** - * Paints the - * - * @return string Table HTML code - */ - public function paint() - { - array_push($this->children, new BSPrinterElement('hidden', 'do', $this->do)); - - return "\nname . "\" action=\"" . $this->action . "\" method=\"post\"" . ($this->upload ? ' enctype="multipart/form-data"' : '') . ">\n" . $this->_paintChildren() . "\n"; - } -} - -?> \ No newline at end of file diff --git a/PrinterRootPage.php b/PrinterRootPage.php deleted file mode 100644 index 6a46bcf..0000000 --- a/PrinterRootPage.php +++ /dev/null @@ -1,368 +0,0 @@ -title = $title; - } - - /** - * Makes a new instance of the object in a static fashion - * - * @return object - */ - public static function make() - { - $obj = new ReflectionClass(__CLASS__); - $args = func_get_args(); - return $obj->newInstanceArgs($args); - } - - /** - * Sets the navigation object - * - * @param BSPrinterNavigation Navigator - * - * @return fluent interface - */ - public function setNavigator(BSPrinterNavigation $nav) - { - $this->navigator = $nav; - return $this; - } - - /** - * Returns the printer navigation object - * - * @return BSPrinterNavigation Navigation object - */ - public function getNavigatior() - { - return $this->navigatior; - } - - /** - * Sets the code to inject into the element of the page - * - * @param string Code - */ - public function setHeaderCode($code) - { - $this->headerCode = $code; - } - - /** - * Creates a redirect to another page; constructs the header and footer - * (therefore execution stops) - * - * @param string Location - * @param string Redirect message to be shown - * @param array An aray of POST variables to send through on the redirect - */ - public static function redirect($location, $message = null, $postvars = array()) - { - if (!defined('ISSO_PRINTER_NO_NAVIGATION')) - { - define('ISSO_PRINTER_NO_NAVIGATION', 1); - } - - $page = new BSPrinterRootPage(_('Redirect')); - - $page->addChild(new BSPrinterElementLabel(' - ')); - - if ($postvars) - { - $vars = new BSPrinterRootForm($location, $postvars['do'], 'postvars'); - unset($postvars['do']); - - foreach ($postvars as $key => $value) - { - $vars->addChild(new BSPrinterElement('hidden', $key, $value)); - } - - $page->addChild($vars); - } - - $redir = _('Please wait to be redirected. This page will load in a few seconds.'); - if ($message == null) - { - $showmessage = $redir; - } - else - { - $showmessage = '
' . $message . '
'; - $showmessage .= "\n

" . $redir . "

"; - } - - $page->addChild(BSPrinterRootPage::message(_('Redirect'), $showmessage)); - - $page->paint(); - exit; - } - - /** - * Prints a complete table message - * - * @param string Message title - * @param string Message text - * - * @return BSPrinterRootTable A table - */ - public static function message($title, $message) - { - $table = new BSPrinterRootTable(); - - $head = new BSPrinterElementTable(); - $head->setCssClass('tcat'); - $head->addChild(new BSPrinterElementLabel($title)); - $table->addHeadingChild($head); - - $msg = new BSPrinterElementTable(); - $msg->addChild(new BSPrinterElementLabel((strpos($message, '$message" : $message))); - $table->addChild($msg); - - return $table; - } - - /** - * Produces an entire page layout that asks the user whether or not - * they want to perform X action and provides a link to the YES and NO - * action - * - * @param string Message that asks if they want to do X - * @param string Location to go to if the user confirms - * @param string Form 'do' value - * @param array Hidden parameters to pass to the next page - */ - public static function confirm($message, $action, $do, $params) - { - if (!defined('ISSO_PRINTER_NO_NAVIGATION')) - { - define('ISSO_PRINTER_NO_NAVIGATION', 1); - } - - $page = new BSPrinterRootPage(_('Confirm')); - - $form = new BSPrinterRootForm($action, $do); - foreach ($params as $key => $value) - { - $form->addChild(new BSPrinterElement('hidden', $key, $value)); - } - $page->addChild($form); - - $table = new BSPrinterRootTable(); - $table->setWidth('75%'); - - $head = new BSPrinterElementTable(); - $head->addChild(new BSPrinterElementLabel(_('Confirm'))); - $head->setCssClass('tcat'); - $table->addChild($head); - - $table->addChild(new BSPrinterElementTable(new BSPrinterElementLabel("
$message
"))); - $no = new BSPrinterElement('button', '__no__', _('No')); - $no->setOnClick('history.back(1); return false;'); - $table->addChild(BSPrinterElementTable::row_submit(array($no), _('Yes'), null)); - - $form->addChild($table); - - $page->paint(); - exit; - } - - /** - * Throws a fatal error message - * - * @param string Error string - */ - public static function error($message) - { - if (!defined('ISSO_PRINTER_NO_NAVIGATION')) - { - define('ISSO_PRINTER_NO_NAVIGATION', 1); - } - - $page = new BSPrinterRootPage(_('Error')); - $page->addChild(BSPrinterRootPage::message(_('Error'), $message)); - $page->paint(); - - exit; - } - - /** - * Returns the HTML for all printed children elements - * - * @return string Printed HTML - */ - protected function _paintChildren() - { - $builder = ''; - - foreach ($this->children as $child) - { - $builder .= "\n" . $child->paint() . "\n"; - } - - return $builder; - } - - /** - * Tells the element to paint itself (and any children) - */ - public function paint() - { - $language = BSPrinter::get_language_information(); - - echo "\n"; - echo "\n"; - echo "\n\t" . BSPrinter::get_realm() . " - " . $this->title . ""; - echo "\n\t"; - echo "\n\t"; - echo "\n" . $this->headerCode; - echo "\n\n\n"; - - if ($this->navigator && (!defined('ISSO_PRINTER_NO_NAVIGATION') || !constant('ISSO_PRINTER_NO_NAVIGATION'))) - { - echo $this->navigator->constructHeaderHtml(); - } - - echo $this->_paintChildren(); - - if ($this->navigator && (!defined('ISSO_PRINTER_NO_NAVIGATION') || !constant('ISSO_PRINTER_NO_NAVIGATION'))) - { - echo $this->navigator->constructFooterHtml(); - } - - $copyright = "\n
\n

\n\t" . BSPrinter::get_copyright() . "\n

"; - - if (!defined('ISSO_PRINTER_HIDE_SETUP')) - { - echo "\n$copyright"; - - echo "\n\n\n"; - - if (BSApp::get_debug()) - { - if (defined('SVN') && preg_match('#^\$Id:?#', constant('SVN'))) - { - echo preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', "\n
\n" . '
\1 — r\2
', constant('SVN')); - } - - if (defined('ISSO_MT_START')) - { - require_once ISSO . '/Functions.php'; - echo "\n
Executed in " . round(BSFunctions::fetch_microtime_diff(ISSO_MT_START), 10) . ' seconds
'; - } - - echo "\n
" . BSApp::get_debug_list() . "
\n"; - - if (BSApp::$db) - { - $queries = BSApp::$db->getHistory(); - - $table = new BSPrinterRootTable(); - $head = new BSPrinterElementTable(); - $head->addChild(new BSPrinterElementLabel('Query Debug')); - $head->setCssClass('thead'); - $table->addHeadingChild($head); - - foreach ($queries as $query) - { - $tr = new BSPrinterElementTable(); - $tr->addChild(new BSPrinterElementLabel("\n\t\t\t" . $query['query'] . "\n\n\t\t\t
(" . $query['time'] . ")
\n\n\t\t")); - $table->addChild($tr); - } - - $table->setWidth('30%'); - - echo $table->paint(); - } - } - } - - echo "\n\n\n"; - } -} - -?> \ No newline at end of file diff --git a/PrinterRootTable.php b/PrinterRootTable.php deleted file mode 100644 index 3ce8514..0000000 --- a/PrinterRootTable.php +++ /dev/null @@ -1,174 +0,0 @@ - object. This can have a parent or not: if it does, - * then it will be painted as a child, otherwise it will act as a root. - * - * @author Blue Static - * @copyright Copyright (c)2005 - 2009, Blue Static - * @package ISSO - * - */ -class BSPrinterRootTable extends BSPrinterRootAbstract -{ - /** - * Maximum number of columns - * @var integer - */ - private $colspan = 0; - - /** - * Heading child elements - * @var array - */ - private $headers = array(); - - /** - * Width of the table - * @var string - */ - private $width = '90%'; - - /** - * Constructor - */ - public function __construct() - { - $this->setCssClass('tborder'); - } - - /** - * Makes a new instance of the object in a static fashion - * - * @return object - */ - public static function make() - { - $obj = new ReflectionClass(__CLASS__); - $args = func_get_args(); - return $obj->newInstanceArgs($args); - } - - /** - * Adds a table row into the child list - * - * @param BSPrinterElementTable Table element - * - * @return fluent interface - */ - public function addChild(BSPrinterAbstract $tr) - { - if (!$tr instanceof BSPrinterElementTable) - { - throw new Exception('BSPrinterRootTable::addChild() only accepts BSPrinterElementTable objects as children'); - } - $this->children[] = $tr; - return $this; - } - - /** - * Adds a table element to be a heading of the table. This is still - * considered a child, but it goes before all other child elemends - * - * @param BSPrinterElementTable Child element - * - * @return fluent interface - */ - public function addHeadingChild(BSPrinterElementTable $tr) - { - $this->headers[] = $tr; - return $this; - } - - /** - * Sets the width of the table - * - * @param string Width value - * - * @return fluent interface - */ - public function setWidth($width) - { - $this->width = $width; - return $this; - } - - /** - * Calculates the number of columns to display based on the colspan - * of children elements - */ - private function _calculateColumnCount() - { - foreach ($this->children as $child) - { - if ($child->numberOfColumns() > $this->colspan) - { - $this->colspan = $child->numberOfColumns(); - } - } - } - - /** - * Returns the HTML for all printed children elements - * - * @return string Printed HTML - */ - protected function _paintChildren() - { - $builder = ''; - - $this->children = array_merge($this->headers, $this->children); - $this->headers = array(); - - $this->_calculateColumnCount(); - - foreach ($this->children as $child) - { - $child->setColumnNumber($this->colspan); - $builder .= "\n" . $child->paint(); - } - - return $builder; - } - - /** - * Paints the
- * - * @return string Table HTML code - */ - public function paint() - { - return "
\n
width . "\"" . $this->_prepareStyle() . ">" . $this->_paintChildren() . "\n
"; - } -} - -?> \ No newline at end of file diff --git a/docs/printertest.php b/docs/printertest.php deleted file mode 100644 index c0c63a8..0000000 --- a/docs/printertest.php +++ /dev/null @@ -1,57 +0,0 @@ - - - - This is Tab One - Tab 2 - 3 - - - - Top Link 1 - Top Link 2 - - - -
- First Link - Second Link -
- -
- Third Link -
- -
- This is the fifth link -
-
- - - -XML; - -$navigator = new BSPrinterNavigation($xml); - -$navigator->addFocus('tab2'); -$navigator->addSection('combined'); - -BSApp::set_debug(true); -BSPrinter::set_stylesheet('printer.css.php'); -BSPrinter::set_realm('Printer Test'); - -BSPrinterRootPage::make('Title')->setNavigator($navigator) - ->paint(); - -?> diff --git a/printer.css.php b/printer.css.php deleted file mode 100755 index d98db28..0000000 --- a/printer.css.php +++ /dev/null @@ -1,422 +0,0 @@ - */ -#mainbody -{ - width: 80%; - - vertical-align: top; - - padding: 5px 5px 5px 0px; -} - -#wrapper #contentbody #mainbody table -{ - width: 100%; -} - -/* Menu frame */ -#menu -{ - width: 20%; - - padding: 15px; - - vertical-align: top; -} - -/* A menu list of items */ -#menu ul -{ - list-style: none; - - padding: 0px; - margin: 0px; -} - -/* An individual item in the menu list */ -#menu li span -{ - display: block; - - padding: 2px 2px 2px 7px; - margin-top: 1px; - - background-color: rgb(208, 208, 208); -} - -/* Links in the menu list */ -#menu li a -{ - color: rgb(64, 64, 64); - text-decoration: none; - font-size: 10px; - font-weight: bold; -} - -/* A :hover for the row of a menu item */ -#menu li a:hover span -{ - background-color: rgb(158, 236, 95); -} - -/* A header item row */ -#menu li.header span -{ - font-weight: bold; - text-transform: uppercase; - color: rgb(255, 255, 255); - - padding: 3px; - - background-color: rgb(96, 106, 90); -} - -/* A focused item row */ -#menu li.focus span -{ - background-color: rgb(182, 216, 154); - - text-decoration: underline; -} - -CSS; - -echo $css; - -?> \ No newline at end of file -- 2.22.5