2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Printer - CSS Blocks
30 * Printer - CSS Blocks
32 * This framework works in conjunction with ISSO.Printer to create a unique
33 * CSS editor enviornment.
35 * @author Iris Studios, Inc.
36 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
44 * Framework registry object
55 var $descriptors = array();
62 var $masterdata = array();
69 var $customdata = array();
71 // ###################################################################
75 function __construct(&$registry)
77 $this->registry
=& $registry;
80 // ###################################################################
84 function Printer_CSS(&$registry)
86 $this->__construct($registry);
89 // ###################################################################
91 * Adds a CSS information block to the array for later use
95 * @param string Block title to display in thead
96 * @param string CSS class/descriptor/element name
97 * @param bool Show the link CSS information
99 function add_block($title, $descriptor, $dolink)
101 if (isset($this->descriptors
["$descriptor"]))
103 trigger_error('The descriptor `' . $descriptor . '` already exists', E_USER_WARNING
);
107 $this->descriptors
["$descriptor"] = array(
109 'descriptor' => $descriptor,
114 // ###################################################################
116 * Sets a master data key for a given descriptor and property
120 * @param string Descriptor
121 * @param string Property
122 * @param string Value
124 function set_master_data($descriptor, $property, $value)
126 $this->masterdata
["$descriptor"]["$property"] = $value;
129 // ###################################################################
131 * Sets a custom data key for a given descriptor and property
135 * @param string Descriptor
136 * @param string Property
137 * @param string Value
139 function set_custom_data($descriptor, $property, $value)
141 $this->customdata
["$descriptor"]["$property"] = $value;
144 // ###################################################################
146 * Generates the HTML needed to output the CSS editing blocks; this is
147 * done in the form of using ISSO.Printer
151 function generate_blocks()
153 $print =& $this->registry
->modules
['printer'];
156 'standard_css_attributes' => $this->registry
->modules
['localize']->string('Standard CSS Attributes'),
157 'extra_css_attributes' => $this->registry
->modules
['localize']->string('Extra CSS Attributes'),
159 'links_normal' => $this->registry
->modules
['localize']->string('Normal CSS Links'),
160 'links_visited' => $this->registry
->modules
['localize']->string('Visited CSS Links'),
161 'links_hover' => $this->registry
->modules
['localize']->string('Hover CSS Links'),
163 'background' => $this->registry
->modules
['localize']->string('Background'),
164 'font_color' => $this->registry
->modules
['localize']->string('Font Color'),
165 'font_style' => $this->registry
->modules
['localize']->string('Font Style'),
166 'font_size' => $this->registry
->modules
['localize']->string('Font Size'),
167 'font_family' => $this->registry
->modules
['localize']->string('Font Family'),
169 'text_decoration' => $this->registry
->modules
['localize']->string('Text Decoration')
172 foreach ($this->descriptors
AS $descriptor)
176 $print->table_start();
177 $print->table_head($descriptor['title'] . ' (' . $descriptor['descriptor'] . ')');
179 $value['background'] = $this->fetch_value($descriptor['descriptor'], 'background');
180 $value['color'] = $this->fetch_value($descriptor['descriptor'], 'color');
181 $value['font_style'] = $this->fetch_value($descriptor['descriptor'], 'font-style');
182 $value['font_size'] = $this->fetch_value($descriptor['descriptor'], 'font-size');
183 $value['font_family'] = $this->fetch_value($descriptor['descriptor'], 'font-family');
184 $value['extra'] = $this->fetch_value($descriptor['descriptor'], 'extra');
187 <table cellspacing
="0" cellpadding
="4" border
="0" width
="100%">
191 <legend
><strong
>$lang[standard_css_attributes
]</strong
></legend
>
193 <table cellspacing
="0" cellpadding
="2" border
="0" width
="100%">
195 <td width
="45%">$lang[background
]</td
>
196 <td
><input name
="css[$descriptor[descriptor]][background]" class="input" style
="width: 100%" value
="$value[background]" /></td
>
199 <td width
="45%">$lang[font_color
]</td
>
200 <td
><input name
="css[$descriptor[descriptor]][color]" class="input" style
="width: 100%" value
="$value[color]" /></td
>
203 <td width
="45%">$lang[font_style
]</td
>
204 <td
><input name
="css[$descriptor[descriptor]][font-style]" class="input" style
="width: 100%" value
="$value[font_style]" /></td
>
207 <td width
="45%">$lang[font_size
]</td
>
208 <td
><input name
="css[$descriptor[descriptor]][font-size]" class="input" style
="width: 100%" value
="$value[font_size]" /></td
>
211 <td width
="45%">$lang[font_family
]</td
>
212 <td
><input name
="css[$descriptor[descriptor]][font-family]" class="input" style
="width: 100%" value
="$value[font_family]" /></td
>
219 <fieldset style
="height: 115px">
220 <legend
><strong
>$lang[extra_css_attributes
]</strong
></legend
>
221 <textarea name
="css[$descriptor[descriptor]][extra]" style
="width: 100%; height: 90%">$value[extra
]</textarea
>
227 if ($descriptor['dolink'])
229 foreach (array('a:link' => 'a_link', 'a:visited' => 'a_visited', 'a:hover' => 'a_hover') AS $sel => $selname)
231 $value[$selname . '_background'] = $this->fetch_value($descriptor['descriptor'] . ' ' . $sel, 'background');
232 $value[$selname . '_color'] = $this->fetch_value($descriptor['descriptor'] . ' ' . $sel, 'color');
233 $value[$selname . '_text_decoration'] = $this->fetch_value($descriptor['descriptor'] . ' ' . $sel, 'text-decoration');
240 <table cellspacing
="0" cellpadding
="4" border
="0" width
="100%">
244 <legend
><strong
>$lang[links_normal
]</strong
></legend
>
246 <table cellspacing
="0" cellpadding
="2" border
="0" width
="100%">
248 <td width
="45%">$lang[background
]</td
>
249 <td
><input name
="css[$descriptor[descriptor] a:link][background]" class="input" style
="width: 100%" value
="$value[a_link_background]" /></td
>
252 <td width
="45%">$lang[font_color
]</td
>
253 <td
><input name
="css[$descriptor[descriptor] a:link][color]" class="input" style
="width: 100%" value
="$value[a_link_color]" /></td
>
256 <td width
="45%">$lang[text_decoration
]</td
>
257 <td
><input name
="css[$descriptor[descriptor] a:link][text_decoration]" class="input" style
="width: 100%" value
="$value[a_link_text_decoration]" /></td
>
265 <legend
><strong
>$lang[links_visited
]</strong
></legend
>
267 <table cellspacing
="0" cellpadding
="2" border
="0" width
="100%">
269 <td width
="45%">$lang[background
]</td
>
270 <td
><input name
="css[$descriptor[descriptor] a:visited][background]" class="input" style
="width: 100%" value
="$value[a_visited_background]" /></td
>
273 <td width
="45%">$lang[font_color
]</td
>
274 <td
><input name
="css[$descriptor[descriptor] a:visited][color]" class="input" style
="width: 100%" value
="$value[a_visited_color]" /></td
>
277 <td width
="45%">$lang[text_decoration
]</td
>
278 <td
><input name
="css[$descriptor[descriptor] a:visited][text_decoration]" class="input" style
="width: 100%" value
="$value[a_visited_text_decoration]" /></td
>
286 <legend
><strong
>$lang[links_hover
]</strong
></legend
>
288 <table cellspacing
="0" cellpadding
="2" border
="0" width
="100%">
290 <td width
="45%">$lang[background
]</td
>
291 <td
><input name
="css[$descriptor[descriptor] a:hover][background]" class="input" style
="width: 100%" value
="$value[a_hover_background]" /></td
>
294 <td width
="45%">$lang[font_color
]</td
>
295 <td
><input name
="css[$descriptor[descriptor] a:hover][color]" class="input" style
="width: 100%" value
="$value[a_hover_color]" /></td
>
298 <td width
="45%">$lang[text_decoration
]</td
>
299 <td
><input name
="css[$descriptor[descriptor] a:hover][text_decoration]" class="input" style
="width: 100%" value
="$value[a_hover_text_decoration]" /></td
>
309 $print->row_span($html, 'alt2', 'left', 1);
315 // ###################################################################
317 * Returns the value of a given descriptor and property by comparing
318 * the mater set and custom set then returning the right one
322 * @param string Descriptor
323 * @param string Property
325 * @return string Value of the given property
327 function fetch_value($descriptor, $property)
329 if ($this->customdata
["$descriptor"]["$property"] == '')
331 return $this->masterdata
["$descriptor"]["$property"];
335 return $this->customdata
["$desciptor"]["$property"];
340 /*=====================================================================*\
341 || ###################################################################
344 || ###################################################################
345 \*=====================================================================*/