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
===================
+++ /dev/null
-<?php
-/*=====================================================================*\
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer System (printer.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterAbstract.php');
-require_once(ISSO . '/PrinterElement.php');
-require_once(ISSO . '/PrinterElementLabel.php');
-require_once(ISSO . '/PrinterElementTable.php');
-require_once(ISSO . '/PrinterRootAbstract.php');
-require_once(ISSO . '/PrinterRootForm.php');
-require_once(ISSO . '/PrinterRootPage.php');
-require_once(ISSO . '/PrinterRootTable.php');
-require_once(ISSO . '/PrinterNavigation.php');
-
-/**
- * Printer System
- *
- * This is the root static framework module for the HTML printer system that
- * works without templates. Here, you simply set the language and stylesheet
- * information and use the other classes to generate the code.
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-class BSPrinter
-{
- /**
- * Singleton instance
- * @var BSPrinter
- */
- private static $instance;
-
- /**
- * Language information for all printer elements with format array(langcode: en_US, direction: ltr/rtl, charset: utf-8)
- * @var string
- */
- private $language = array('langcode' => '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
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer Element Abstract Class (PrinterAbstract.php)
- *
- * @package ISSO
- */
-
-/**
- * Printer Element
- *
- * This abstract class is used for all printer elements and describes
- * the basic functionality of an element.
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-abstract class BSPrinterAbstract
-{
- /**
- * Style information
- * @var array
- */
- protected $style = array();
-
- /**
- * The CSS class to use
- * @var string
- */
- protected $cssClass = ':swap:';
-
- /**
- * DOM ID of the element
- * @var string
- */
- protected $id;
-
- /**
- * Fluent object instantiation
- */
- public abstract static function make();
-
- /**
- * Tells the element to paint itself (and any children)
- */
- public abstract function paint();
-
- /**
- * To-string method which invokes paint()
- */
- public function __toString()
- {
- return $this->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
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Base Printer Element (PrinterElement.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterAbstract.php');
-
-/**
- * Base Printer Element
- *
- * This class represents the lowest level of printer elements:
- * buttons, input fields, etc. These cannot have children elements
- * and are only attached to a parent.
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-class BSPrinterElement extends BSPrinterAbstract
-{
- /**
- * The name of the element
- * @var string
- */
- private $name;
-
- /**
- * Type of element
- * @var string
- */
- private $type;
-
- /**
- * The value of the element
- * @var string
- */
- private $value;
-
- /**
- * The checked/selected attribute (checkbox, radio, and option only)
- * @var boolean
- */
- private $active;
-
- /**
- * The JavaScript onClick attribute
- * @var string
- */
- private $onClick;
-
- /**
- * Accesskey attribute
- * @var string
- */
- private $accessKey;
-
- /**
- * Constructor
- */
- function __construct($type, $name, $value = '')
- {
- $this->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 '<input type="' . $this->type . '"' . $attrs . (($this->type == 'text' || $this->type == 'password') ? ' size="35" maxlength="255"' : ''). $this->_prepareStyle() . ' />';
- break;
-
- case 'hidden':
- return '<input type="hidden"' . $name . $value . ' />';
- break;
-
- case 'checkbox':
- case 'radio':
- return '<input type="' . $this->type . '"' . $attrs . ($this->active ? ' checked="checked"' : '') . $this->_prepareStyle() . ' />';
- break;
-
- case 'upload':
- return '<input type="file" size="35"' . $name . $this->_prepareStyle() . ' />';
- break;
-
- case 'option':
- return '<option' . $value . ($this->active ? ' selected="selected"' : '') . $this->_prepareStyle() . '>' . $this->name . '</option>';
- break;
-
- case 'select':
- return '<select' . $name . $this->_prepareStyle() . $accesskey . '>' . $this->value . '</select>';
- 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 '<textarea' . $name . ' cols="50" rows="2"' . $this->_prepareStyle() . $accesskey . '>' . $this->value . '</textarea>';
- break;
-
- default:
- throw new Exception('Invalid BSPrinterElement type "' . $this->type . '"');
- break;
- }
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer Label Element (PrinterElementLabel.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterAbstract.php');
-
-/**
- * Printer Label Element
- *
- * This element is a wrapper for a PHP string to be displayed in the
- * standard printer
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-class BSPrinterElementLabel extends BSPrinterAbstract
-{
- /**
- * The value to print
- * @var string
- */
- private $string = '';
-
- /**
- * Constructor
- *
- * @param string String to display
- */
- function __construct($string)
- {
- $this->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 <span> if it has styling
- */
- public function paint()
- {
- if ($this->_prepareStyle())
- {
- return '<span' . $this->_prepareStyle() . '>' . $this->string . '</span>';
- }
- return $this->string;
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer Table Element (PrinterElementTable.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterRootTable.php');
-require_once(ISSO . '/PrinterElement.php');
-
-/**
- * Printer Table Element
- *
- * This represents a table row that holds elements.
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-class BSPrinterElementTable extends BSPrinterAbstract
-{
- /**
- * Array of child nodes
- * @var array
- */
- private $children = array();
-
- /**
- * Number of columns to span
- * @var integer
- */
- private $colspan = 0;
-
- /**
- * Creates a table element; takes a variable number of arguments which
- * are added as children in the order passed
- *
- * @param BSPrinterElementTable... Variable number (or no) children
- */
- public function __construct()
- {
- $childs = func_get_args();
- if (is_array($childs))
- {
- foreach ($childs as $key => $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 <select> row from an array of BSPrinterElement's
- *
- * @param string Label
- * @param string Name
- * @param array Array of BSPrinterElement[option]'s
- *
- * @return BSPrinterElementTable Table row
- */
- public static function row_list($label, $name, Array $options)
- {
- $build = '';
- foreach ($options as $option)
- {
- if ($option->getType() == 'option')
- {
- $build .= $option->paint();
- }
- else
- {
- throw new Exception('Only BSPrinterElement\'s of type "option" are allowed in BSPrinterElementTable::row_list()');
- }
- }
-
- $tr = new BSPrinterElementTable();
-
- $tr->addChild(new BSPrinterElementLabel($label));
- $tr->addChild(new BSPrinterElement('select', $name, $build));
-
- return $tr;
- }
-
- /**
- * Constructs a row from an array of BSPrinterElement's of checkboxes
- *
- * @param string Label
- * @param string Name
- * @param array Array of BSPrinterElement[checkbox]'s that follow array(box label => BSPrinterElement)
- *
- * @return BSPrinterElementTable Table row
- */
- public static function row_checkbox($label, $name, Array $boxes)
- {
- $build = '';
- foreach ($boxes as $boxLabel => $box)
- {
- if ($box->getType() == 'checkbox')
- {
- if ($box->getName() == null)
- {
- $box->setName($name . '[]');
- }
- $build .= '<div>' . $box->paint() . ' ' . $boxLabel . '</div>';
- }
- else
- {
- throw new Exception('Only BSPrinterElement\'s of type "checkbox" are allowed in BSPrinterElementTable::row_checkbox()');
- }
- }
-
- $tr = new BSPrinterElementTable();
-
- $tr->addChild(new BSPrinterElementLabel($label));
- $tr->addChild(new BSPrinterElementLabel($build));
-
- return $tr;
- }
-
- /**
- * Factory method to create an upload form element; requires that the
- * form this is attached to have the upload flag set
- *
- * @param string Label for the element
- * @param string Name of the <input>
- *
- * @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 <td>
- * 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<td" . ($colspan > 1 ? ' colspan="' . $colspan . '"' : '') . ">" . $child->paint() . "</td>";
- }
-
- return $builder;
- }
-
- /**
- * Paints the entire table row
- *
- * @return string Table row HTML
- */
- public function paint()
- {
- return "\t<tr" . $this->_prepareStyle() . ">" . $this->_paintChildren() . "\n\t</tr>";
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*\
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer: Navigation Generator (PrinterNavigation.php)
- *
- * @package ISSO
- */
-
-/**
- * Printer: Navigation Generator
- *
- * This framework works in conjunction with BSPrinter to generate a page header
- * and sidebar to be used for navigation. You set the navigation array and then can
- * specify a given key to highlight elements. Elements are broken into three types:
- * tabs (top of the page), groups (blocks of link actions), and links
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-class BSPrinterNavigation
-{
- /**
- * XML document structure
- * @var SimpleXMLElement
- */
- private $structure;
-
- /**
- * Keys to set focus on
- * @var array
- */
- private $focusKeys = array();
-
- /**
- * Sections to display
- * @var array
- */
- private $displaySections = array();
-
- /**
- * Constructor
- *
- * @param string Navigation XML data
- */
- public function __construct($xml)
- {
- $this->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 = '<!-- navigation start -->' . "\n\n";
-
- // -------------------------------------------------------------------
-
- if (isset($this->structure->links))
- {
- $links = array();
- foreach ($this->structure->links->link as $link)
- {
- $attrs = $link->attributes();
- $links[] = '<a href="' . $attrs->target . '">' . $link . '</a>';
- }
- }
-
- $output .= "\n" . '<div id="toplinks">';
- $output .= "\n\t" . '<div>' . BSPrinter::get_realm() . '</div>';
- if (isset($links))
- {
- $output .= "\n\t" . '<div id="toplinks-links">' . implode(' • ', $links) . '</div>';
- }
- $output .= "\n" . '</div>';
-
- // -------------------------------------------------------------------
-
- $output .= "\n\n" . '<div id="wrapper">';
-
- // -------------------------------------------------------------------
-
- if (isset($this->structure->tabs))
- {
- $output .= "\n" . '<div id="tabbar">';
- foreach ($this->structure->tabs->tab as $tab)
- {
- $link = "\n\t" . '<a href="' . $tab['target'] . '"';
- if (in_array($tab['key'], $this->focusKeys))
- {
- $link .= ' id="focustab"';
- }
-
- $link .= '><span>' . $tab . '</span></a>';
-
- $output .= $link;
- }
- $output .= "\n" . '</div>';
- }
-
- // -------------------------------------------------------------------
-
- $output .= "\n\n" . '<table id="contentbody" cellspacing="0" cellpadding="0" border="0">';
- $output .= "\n" . '<tr>';
-
- // -------------------------------------------------------------------
-
- $output .= "\n" . '<td id="menu">';
- foreach ($this->structure->sections->section as $section)
- {
- if (!in_array($section['key'], $this->displaySections))
- {
- continue;
- }
-
- // handle inherited sections
- $links = array();
- if ($section['inherits'])
- {
- $keys = explode(',', $section['inherits']);
-
- foreach ($keys as $parKey)
- {
- $parLinks = $this->structure->xpath('/navigation/sections/section[@key="' . $parKey . '"]/link');
- $links = array_merge($links, $parLinks);
- }
-
- // add the links from the hybrid section
- if (is_array($section->link))
- {
- $links = array_merge($links, $section->link);
- }
- else
- {
- $links[] = $section->link;
- }
- }
- // no inheritance, so the links are straight from the section
- else
- {
- $links = $section->link;
- }
-
- $output .= "\n" . '<ul>';
- $output .= "\n\t" . '<li class="header"><span>' . $section['name'] . '</span></li>';
- foreach ($links as $link)
- {
- $output .= "\n\t" . '<li' . (in_array($link['key'], $this->focusKeys) ? ' class="focus"' : '') . '><a href="' . $link['target'] . '"><span>' . $link . '</span></a></li>';
- }
- $output .= "\n" . '</ul>' . "\n";
- }
- $output .= "\n" . '</td>';
-
- // -------------------------------------------------------------------
-
- $output .= "\n" . '<td id="mainbody">';
- $output .= "\n\n" . '<!-- main content body -->' . "\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" . '<!-- / main content body -->' . "\n";
-
- $output .= "\n" . '</td>';
- $output .= "\n" . '</tr>';
-
- $output .= "\n\n" . '</table>';
-
- $output .= "\n\n" . '</div>';
-
- return $output;
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer Root Element (PrinterRootAbstract.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterAbstract.php');
-
-/**
- * Printer Root Element
- *
- * This is a root element class. That means that elements can be printed
- * directly into this and this can stand alone as a page. However, that
- * does not mean that all root elements produce valid XHTML.
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-abstract class BSPrinterRootAbstract extends BSPrinterAbstract
-{
- /**
- * Child elements
- * @var string
- */
- protected $children = array();
-
- /**
- * Returns all of the children painted in the right order
- */
- protected abstract function _paintChildren();
-
- /**
- * 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;
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer Root Element: Form (PrinterRootForm.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterRootAbstract.php');
-
-/**
- * Printer Root Element: Form
- *
- * Represents a <form> 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 <table>
- *
- * @return string Table HTML code
- */
- public function paint()
- {
- array_push($this->children, new BSPrinterElement('hidden', 'do', $this->do));
-
- return "\n<form name=\"" . $this->name . "\" action=\"" . $this->action . "\" method=\"post\"" . ($this->upload ? ' enctype="multipart/form-data"' : '') . ">\n" . $this->_paintChildren() . "\n</form>";
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer Root Element: Page (PrinterRootPage.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterRootAbstract.php');
-
-/**
- * Printer Root Element: Page
- *
- * This root element represents the entire page and is usually used for all
- * printer applications
- *
- * @author Blue Static
- * @copyright Copyright (c)2005 - 2009, Blue Static
- * @package ISSO
- *
- */
-class BSPrinterRootPage extends BSPrinterRootAbstract
-{
- /**
- * The page title
- * @var string
- */
- private $title;
-
- /**
- * Navigation object
- * @var BSPrinterNavigation
- */
- private $navigator;
-
- /**
- * The header code for the page
- * @var string
- */
- private $headerCode;
-
- /**
- * Constructor
- *
- * @param string Page title
- */
- function __construct($title)
- {
- $this->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 <head> 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('
- <script type="text/javascript">
- <!--
- var timeout = 2000;
-
- if (timeout > 0)
- {
- setTimeout("redirect()", timeout);
- }
- else
- {
- redirect();
- }
-
- function redirect()
- {
- ' . ($postvars ? 'document.forms.postvars.submit();' : 'window.location = "' . $location . '";') . '
- }
-
- //-->
- </script>'));
-
- 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 = '<blockquote>' . $message . '</blockquote>';
- $showmessage .= "\n<p>" . $redir . "</p>";
- }
-
- $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, '<blockquote') === false ? "<blockquote>$message</blockquote>" : $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("<blockquote>$message</blockquote>")));
- $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 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
- echo "<html xml:lang=\"" . $language['langcode'] . "\" lang=\"" . $language['langcode'] . "\" dir=\"" . $language['direction'] . "\">\n<head>";
- echo "\n\t<title>" . BSPrinter::get_realm() . " - " . $this->title . "</title>";
- echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $language['charset'] . "\" />";
- echo "\n\t<link rel=\"stylesheet\" href=\"" . BSPrinter::get_stylesheet() . "\" />";
- echo "\n" . $this->headerCode;
- echo "\n</head>\n<body>\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<br />\n<p align=\"center\" class=\"copyright\">\n\t" . BSPrinter::get_copyright() . "\n</p>";
-
- 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<br />\n" . '<div align="center"><strong>\1</strong> — r\2</div>', constant('SVN'));
- }
-
- if (defined('ISSO_MT_START'))
- {
- require_once ISSO . '/Functions.php';
- echo "\n<div align=\"center\">Executed in " . round(BSFunctions::fetch_microtime_diff(ISSO_MT_START), 10) . ' seconds</div>';
- }
-
- echo "\n<br /><div align=\"center\">" . BSApp::get_debug_list() . "</div>\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<div class=\"smallfont\">(" . $query['time'] . ")</div>\n<!--\n" . $query['trace'] . "\n-->\n\t\t"));
- $table->addChild($tr);
- }
-
- $table->setWidth('30%');
-
- echo $table->paint();
- }
- }
- }
-
- echo "\n\n</body>\n</html>";
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
- * Printer Root Element: Table (PrinterRootTable.php)
- *
- * @package ISSO
- */
-
-require_once(ISSO . '/PrinterRootAbstract.php');
-
-/**
- * Printer Root Element: Table
- *
- * Represents a <table> 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 <table>
- *
- * @return string Table HTML code
- */
- public function paint()
- {
- return "<br />\n<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" align=\"center\" width=\"" . $this->width . "\"" . $this->_prepareStyle() . ">" . $this->_paintChildren() . "\n</table>";
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-error_reporting(E_ALL);
-
-define('ISSO_MT_START', microtime());
-define('ISSO', getcwd());
-
-require_once ISSO . '/App.php';
-require_once ISSO . '/Printer.php';
-require_once ISSO . '/Functions.php';
-
-$xml = <<<XML
-<navigation>
-
- <tabs>
- <tab key="tab1" target="tab1.php">This is Tab One</tab>
- <tab key="tab2" target="tab2.php">Tab 2</tab>
- <tab key="tab3" target="tab3.php">3</tab>
- </tabs>
-
- <links>
- <link target="toplink1.php">Top Link 1</link>
- <link target="toplink2.php">Top Link 2</link>
- </links>
-
- <sections>
- <section key="beginning" name="Beginning Section">
- <link key="first" target="firstlink.php">First Link</link>
- <link key="second" target="secondlink.php">Second Link</link>
- </section>
-
- <section key="ending" name="Last Section">
- <link key="third" target="thirdlink.php">Third Link</link>
- </section>
-
- <section inherits="beginning,ending" key="combined" name="Combined View">
- <link key="fifth" target="fifthlink.php">This is the fifth link</link>
- </section>
- </sections>
-
-</navigation>
-
-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();
-
-?>
+++ /dev/null
-<?php
-/*=====================================================================*\
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-$path = dirname(isset($_SERVER['SCRIPT_URL']) ? $_SERVER['SCRIPT_URL'] : $_SERVER['REQUEST_URI']);
-
-// Gecko browsers need this to display right
-header("Content-Type: text/css");
-
-$css = <<<CSS
-/*=====================================================================*\
-|| ###################################################################
-|| # Blue Static ISSO Framework
-|| # Copyright (c)2005-2009 Blue Static
-|| #
-|| # This program is free software; you can redistribute it and/or modify
-|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/* ################################################################### */
-/* Body and table elements */
-/* ################################################################### */
-
-/* Work-around for Mozilla (bug #243751) and Opera (bug #???) bugs in viewpoint rendering */
-html
-{
- height: 100%;
-}
-
-/* Main window background colour and font colour */
-body
-{
- color: rgb(96, 106, 90);
-
- background-color: rgb(232, 255, 198);
-
- padding: 15px;
-}
-
-/* Border area around tables and inbetween spacing */
-.tborder
-{
- border: none;
-}
-
-/* First row set in all tables */
-.tcat
-{
- color: rgb(30, 35, 46);
- font-weight: bold;
- text-align: center;
-
- background-color: rgb(109, 187, 45);
-}
-
-/* Links within the TCAT class */
-.tcat a:link, .tcat a:visited, .tcat a:active
-{
- color: rgb(55, 55, 55);
-}
-
-/* Row under the TCAT row (often used for column headers) */
-.thead, .alt3
-{
- color: rgb(45, 45, 45);
-
- font-weight: bold;
- font-size: 11px;
-
- background-color: rgb(165, 165, 165);
-}
-
-/* Links for the THEAD class */
-.thead a:link, .thead a:visited, .thead a:active, .alt3 a:link, .alt3 a:visited, .alt3 a:active
-{
- color: rgb(45, 45, 45);
-}
-
-/* The first type of row used in the alternation cycle */
-.alt1
-{
- color: rgb(41, 63, 91);
-
- background-color: rgb(237, 245, 230);
-}
-
-/* The second type of row used in the alternation cycle */
-.alt2
-{
- color: rgb(41, 63, 91);
-
- background-color: rgb(255, 255, 255);
-}
-
-/* The third alternation, used in special cases */
-.alt3
-{
- border-width: 0px;
-}
-
-/* The last row in the table (often used for the submit buttons) */
-.tfoot
-{
- color: rgb(55, 55, 55);
- text-align: center;
- font-weight: bold;
-
- background-color: rgb(64, 64, 64);
-}
-
-/* ################################################################### */
-/* Text elements */
-/* ################################################################### */
-
-/* Font settings for all non-styled elements */
-body
-{
- font-family: verdana, geneva, arial, helvetica, sans-serif;
- font-size: 11px;
-}
-
-/* Small text (used in copyright) */
-.smallfont, .copyright, dfn
-{
- font-family: tahoma, verdana, geneva, arial, helvetica, sans-serif;
- font-size: 9px;
-}
-
-/* Description text */
-dfn
-{
- font-style: italic;
-}
-
-/* Table headings */
-.tcat, .thead, .tfoot
-{
- font-family: tahoma, verdana, geneva, arial, helvetica, sans-serif;
- font-size: 12px;
-}
-
-/* Normal links */
-a:link, a:visited, a:active
-{
- color: rgb(109, 187, 45);
-}
-
-/* Hover links */
-a:hover, .tcat a:hover, .thead a:hover, .tfoot a:hover, .alt3 a:hover
-{
- color: rgb(143, 236, 9);
-}
-
-.copyright a:hover, .copyright a:link, .copyright a:visited, .copyright a:active
-{
- text-decoration: none;
-}
-
-/* Mono-space */
-.code
-{
- font-family: 'courier new', courier, monospace;
- font-size: 9pt;
-}
-
-/* ################################################################### */
-/* Form styling elements */
-/* ################################################################### */
-
-/* Input elements in a form */
-input, textarea, select, option
-{
- font-family: verdana, geneva, arial, helvetica, sans-serif;
- font-size: 11px;
-}
-
-/* Input formatting */
-.input
-{
- font-family: tahoma, verdana, geneva, arial, helvetica, sans-serif;
- font-size: 11px;
-
- margin: 3px 1px 1px 1px;
-}
-
-/* Button styling */
-.button
-{
- color: rgb(0, 0, 0);
-
- font-family: tahoma, verdana, geneva, arial, helvetica, sans-serif;
- font-size: 11px;
- font-weight: bold;
-
- margin: 3px 1px 1px 1px;
-}
-
-/* ################################################################### */
-/* Navigation panel */
-/* ################################################################### */
-
-/* The links that appear in the upper-right corner */
-#toplinks
-{
- float: right;
-
- font-size: 14px;
-}
-
- #toplinks #toplinks-links
- {
- font-size: 10px;
- }
-
-/* Wrapper for the entire navigation system; including tabs */
-#wrapper
-{
- padding-top: 12px;
-}
-
-/* The content panel that draws the background color for the panel */
-#contentbody
-{
- padding: 5px;
-
- background-color: rgb(255, 255, 255);
-
- border-color: rgb(124, 128, 135);
- border-width: 1px;
- border-style: solid;
-
- color: rgb(55, 55, 55);
-
- width: 100%;
-}
-
-/* The actual tabbar */
-#tabbar
-{
- height: 35px;
-
- padding-left: 10px;
-
- margin-top: 10px;
- margin-bottom: -14px;
-}
-
-/* Links in the tabbar */
-#tabbar a
-{
- font-weight: bold;
- color: rgb(122, 151, 101);
-
- text-transform: uppercase;
- text-decoration: none;
-
- padding: 8px 0px 8px 0px;
- margin: 0px;
-
- background-image: url($path/images/tabs.gif);
- background-repeat: no-repeat;
- background-position: 0% -35px;
-}
-
-/* Blocks of the tab link */
-#tabbar a span
-{
- height: 33px;
- width: 100%;
-
- padding: 8px 15px 8px 15px;
-
- background-image: url($path/images/tabs-ends.gif);
- background-repeat: no-repeat;
- background-position: 100% -35px;
-}
-
-/* The current, active tab */
-#tabbar #focustab, #tabbar #focustab a:hover
-{
- color: rgb(64, 64, 64);
-
- background-position: 0% 0px;
-
- padding: 8px 0px 9px 0px;
-}
-
-/* Blocks of a focused tab link */
-#tabbar #focustab span
-{
- background-position: 100% 0px;
-
- padding-bottom: 9px;
-}
-
-/* Hovered tabs */
-#tabbar a:hover
-{
- background-position: 0% -70px;
-
- color: rgb(143, 236, 9);
-}
-
-/* Blocks of a hovered tab link */
-#tabbar a:hover span
-{
- background-position: 100% -70px;
-}
-
-/* Main content frame <td> */
-#mainbody
-{
- width: 80%;
-
- vertical-align: top;
-
- padding: 5px 5px 5px 0px;
-}
-
-#wrapper #contentbody #mainbody table
-{
- width: 100%;
-}
-
-/* Menu frame <td> */
-#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