From e652d164102544e480930c75d5deb19c1afd521f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 25 Dec 2006 23:35:22 +0000 Subject: [PATCH] Retrofitted BSPrinterCss --- printer_css.php | 100 +++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/printer_css.php b/printer_css.php index ea0df48..eacab16 100644 --- a/printer_css.php +++ b/printer_css.php @@ -20,8 +20,7 @@ \*=====================================================================*/ /** -* Printer - CSS Blocks -* printer_css.php +* Printer: CSS Editor (PrinterCss.php) * * @package ISSO */ @@ -29,13 +28,13 @@ require_once('ISSO/Functions.php'); /** -* Printer - CSS Blocks +* Printer: CSS Editor * -* This framework works in conjunction with ISSO.Printer to create a unique +* This framework works in conjunction with BSPrinter to create a * CSS editor enviornment. * * Hooks: -* $this->fetch_modified_link_hook - Required hook that is run when +* $this->_fetchModifiedLinkHook - Required hook that is run when * preparing revert links for properties * * @author Blue Static @@ -44,7 +43,7 @@ require_once('ISSO/Functions.php'); * @package ISSO * */ -class Printer_CSS +class BSPrinterCss { /** * CSS block list @@ -78,7 +77,7 @@ class Printer_CSS ); /** - * Hook ran in fetch_modified_link; takes three params: $descriptor, $property, $name + * Hook ran in _fetchModifiedLink; takes three params: $descriptor, $property, $name * @var string */ private $modifiedLinkHook = ':undefined:'; @@ -113,7 +112,7 @@ class Printer_CSS * @param string CSS class/descriptor/element name * @param bool Show the link CSS information */ - public function add_block($title, $descriptor, $dolink) + public function addBlock($title, $descriptor, $dolink) { if (isset($this->descriptors["$descriptor"])) { @@ -136,7 +135,7 @@ class Printer_CSS * @param string Property * @param string Value */ - public function set_master_data($descriptor, $property, $value) + public function setMasterData($descriptor, $property, $value) { $this->masterdata["$descriptor"]["$property"] = $value; } @@ -149,7 +148,7 @@ class Printer_CSS * @param string Property * @param string Value */ - public function set_custom_data($descriptor, $property, $value) + public function setCustomData($descriptor, $property, $value) { $this->customdata["$descriptor"]["$property"] = $value; } @@ -157,12 +156,10 @@ class Printer_CSS // ################################################################### /** * Generates the HTML needed to output the CSS editing blocks; this is - * done in the form of using ISSO.Printer + * done in the form of using BSPrinter */ - public function generate_blocks() + public function printEditor() { - $print =& BSRegister::GetType('Printer'); - $lang = array( 'standard_css_attributes' => _('Standard CSS Attributes'), 'extra_css_attributes' => _('Extra CSS Attributes'), @@ -190,16 +187,18 @@ class Printer_CSS $desc = $descriptor['descriptor']; - $print->table_start(); - $print->table_head($descriptor['title']); + $table = new BSPrinterRootElementTable(); + $head = new BSPrinterTableElement(new BSPrinterLabelElement($descriptor['title'])); + $head->setCssClass('tcat'); + $table->addHeadingChild($head); foreach ($this->properties AS $prop => $name) { - $value["$name"] = $this->fetch_value($descriptor['descriptor'], $prop); - $status["$name"] = $this->fetch_modified_status($descriptor['descriptor'], $prop); + $value["$name"] = $this->_fetchValue($descriptor['descriptor'], $prop); + $status["$name"] = $this->_fetchModifiedStatus($descriptor['descriptor'], $prop); } - $value['extra'] = $this->fetch_value($descriptor['descriptor'], 'extra'); + $value['extra'] = $this->_fetchValue($descriptor['descriptor'], 'extra'); $html = " @@ -209,23 +208,23 @@ class Printer_CSS
- + - + - + - + - +
" . $this->fetch_modified_link($desc, 'background', $lang['background']) . "" . $this->_fetchModifiedLink($desc, 'background', $lang['background']) . "
" . $this->fetch_modified_link($desc, 'color', $lang['font_color']) . "" . $this->_fetchModifiedLink($desc, 'color', $lang['font_color']) . "
" . $this->fetch_modified_link($desc, 'font-style', $lang['font_style']) . "" . $this->_fetchModifiedLink($desc, 'font-style', $lang['font_style']) . "
" . $this->fetch_modified_link($desc, 'font-size', $lang['font_size']) . "" . $this->_fetchModifiedLink($desc, 'font-size', $lang['font_size']) . "
" . $this->fetch_modified_link($desc, 'font-family', $lang['font_family']) . "" . $this->_fetchModifiedLink($desc, 'font-family', $lang['font_family']) . "
@@ -234,7 +233,7 @@ class Printer_CSS
- " . $this->fetch_modified_link($desc, 'extra', $lang['extra_css_attributes']) . " + " . $this->_fetchModifiedLink($desc, 'extra', $lang['extra_css_attributes']) . "
@@ -246,8 +245,8 @@ class Printer_CSS { foreach (array('background' => 'background', 'color' => 'color', 'text-decoration' => 'text_decoration') AS $prop => $name) { - $value["{$selname}_{$name}"] = $this->fetch_value($descriptor['descriptor'] . ' ' . $sel, $prop); - $status["{$selname}_{$name}"] = $this->fetch_modified_status($descriptor['descriptor'] . ' ' . $sel, $prop); + $value["{$selname}_{$name}"] = $this->_fetchValue($descriptor['descriptor'] . ' ' . $sel, $prop); + $status["{$selname}_{$name}"] = $this->_fetchModifiedStatus($descriptor['descriptor'] . ' ' . $sel, $prop); } } @@ -261,15 +260,15 @@ class Printer_CSS - + - + - +
" . $this->fetch_modified_link($desc . ' a:link', 'background', $lang['background']) . "" . $this->_fetchModifiedLink($desc . ' a:link', 'background', $lang['background']) . "
" . $this->fetch_modified_link($desc . ' a:link', 'color', $lang['font_color']) . "" . $this->_fetchModifiedLink($desc . ' a:link', 'color', $lang['font_color']) . "
" . $this->fetch_modified_link($desc . ' a:link', 'text-decoration', $lang['text_decoration']) . "" . $this->_fetchModifiedLink($desc . ' a:link', 'text-decoration', $lang['text_decoration']) . "
@@ -282,15 +281,15 @@ class Printer_CSS - + - + - +
" . $this->fetch_modified_link($desc . ' a:visited', 'background', $lang['background']) . "" . $this->_fetchModifiedLink($desc . ' a:visited', 'background', $lang['background']) . "
" . $this->fetch_modified_link($desc . ' a:visited', 'color', $lang['font_color']) . "" . $this->_fetchModifiedLink($desc . ' a:visited', 'color', $lang['font_color']) . "
" . $this->fetch_modified_link($desc . ' a:visited', 'text-decoration', $lang['text_decoration']) . "" . $this->_fetchModifiedLink($desc . ' a:visited', 'text-decoration', $lang['text_decoration']) . "
@@ -303,15 +302,15 @@ class Printer_CSS - + - + - +
" . $this->fetch_modified_link($desc . ' a:hover', 'background', $lang['background']) . "" . $this->_fetchModifiedLink($desc . ' a:hover', 'background', $lang['background']) . "
" . $this->fetch_modified_link($desc . ' a:hover', 'color', $lang['font_color']) . "" . $this->_fetchModifiedLink($desc . ' a:hover', 'color', $lang['font_color']) . "
" . $this->fetch_modified_link($desc . ' a:hover', 'text-decoration', $lang['text_decoration']) . "" . $this->_fetchModifiedLink($desc . ' a:hover', 'text-decoration', $lang['text_decoration']) . "
@@ -321,13 +320,18 @@ class Printer_CSS "; } - $print->row_span($html, 'alt2', 'left', 1); + $row = new BSPrinterTableElement(new BSPrinterLabelElement($html)); + $row->setCssClass('alt2'); + $table->addChild($row); - $print->row_span(' + $row = new BSPrinterTableElement(new BSPrinterLabelElement('
' . $lang['css_selector'] . ': ' . $descriptor['descriptor'] . '
- ', 'tfoot', 'right', 1); + ')); + $row->setCssClass('tfoot'); + $row->setStyle(array('text-align' => 'right')); + $table->addChild($row) - $print->table_end(); + echo $table->paint(); } } @@ -341,7 +345,7 @@ class Printer_CSS * * @return string Value of the given property */ - private function fetch_value($descriptor, $property) + private function _fetchValue($descriptor, $property) { if (!isset($this->customdata["$descriptor"]["$property"])) { @@ -364,7 +368,7 @@ class Printer_CSS * * @return bool Modified from the master value? */ - private function fetch_modified_status($descriptor, $property) + private function _fetchModifiedStatus($descriptor, $property) { return ($this->masterdata["$descriptor"]["$property"] != $this->customdata["$descriptor"]["$property"] AND isset($this->customdata["$descriptor"]["$property"])); } @@ -380,9 +384,9 @@ class Printer_CSS * * @return string Output HTML */ - private function fetch_modified_link($descriptor, $property, $name) + private function _fetchModifiedLink($descriptor, $property, $name) { - $status = $this->fetch_modified_status($descriptor, $property); + $status = $this->_fetchModifiedStatus($descriptor, $property); if ($status) { @@ -392,7 +396,7 @@ class Printer_CSS } else { - trigger_error('Printer_CSS::fetch_modified_link() needs to have the fetchModifiedLinkHook( $descriptor , $property , $name ) defined'); + trigger_error('BSPrinterCss::_fetchModifiedLink() needs to have the fetchModifiedLinkHook( $descriptor , $property , $name ) defined'); } } else @@ -418,7 +422,7 @@ class Printer_CSS * * @return array Queries that need to be evaluated then ran */ - public function generate_change_query($data) + public function fetchChangeQuery($data) { $queries[0] = '--- RESERVED FOR LATER USE ---'; @@ -494,7 +498,7 @@ class Printer_CSS * * @return string CSS output */ - public function generate_css_output() + public function fetchCssOutput() { $data = array(); @@ -527,7 +531,7 @@ class Printer_CSS } } - $output = '/* CSS Style Sheet (generated by ISSO.Printer.CSS $Revision$) */'; + $output = '/* CSS Style Sheet (generated by BSPrinterCss $Revision$) */'; foreach ($data AS $selector => $props) { -- 2.22.5