/** * Prints a block of controls for editing a CSS item on css.php?do=edit * * @param string Item title * @param string Item description * @param array Item info array * @param boolean Print links edit section * @param boolean Print table break */ function print_css_row($title, $description, $item, $dolinks = false, $restarttable = true) { global $bgcounter, $css, $css_info, $color, $vbphrase, $stylevar, $vbulletin; static $item_js; ++$item_js; $color = fetch_inherited_color($css_info["{$item}"], $vbulletin->GPC['dostyleid']); $title = htmlspecialchars_uni($title); switch ($css_info["{$item}"]) { case -1: $tblhead_title = $title; $revertlink = ''; $revertctrl = ''; break; case $vbulletin->GPC['dostyleid']: $tblhead_title = "{$title} <span class=\"normal\">(" . $vbphrase['customized_in_this_style'] . ")</span>"; $revertlink = 'title=' . urlencode($title) . '&item=' . urlencode($item); $revertctrl = "<label for=\"rvcss_{$item}\">{$vbphrase['revert_this_group_of_settings']}<input type=\"checkbox\" id=\"rvcss_{$item}\" name=\"delete[css][{$item}]\" value=\"1\" tabindex=\"1\" title=\"{$vbphrase['revert']}\" /></label>"; break; default: $tblhead_title = "{$title} <span class=\"normal\">(" . construct_phrase($vbphrase['customized_in_a_parent_style_x'], $css_info["{$item}"]) . ")</span>"; $revertlink = 'title=' . urlencode($title) . '&item=' . urlencode($item); $revertctrl = ''; break; } echo "\n\n<!-- START {$title} CSS -->\n\n"; print_column_style_code(array('width: 50%', 'width: 50%')); print_table_header($tblhead_title, 2); print_label_row("\n\t<fieldset title=\"{$vbphrase['standard_css']}\">\n\t\t<legend>{$vbphrase['standard_css']}</legend>\n\t\t<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" width=\"100%\">\n\t\t<col width=\"50%\"></col>\n" . construct_css_input_row($vbphrase['background'], "['{$item}']['background']", $color, true) . construct_css_input_row($vbphrase['font_color'], "['{$item}']['color']", $color, true) . construct_css_input_row($vbphrase['font_style'], "['{$item}']['font']['style']", $color) . construct_css_input_row($vbphrase['font_size'], "['{$item}']['font']['size']", $color) . construct_css_input_row($vbphrase['font_family'], "['{$item}']['font']['family']", $color) . construct_text_align_code($vbphrase['alignment'], "['{$item}']['text-align']", $color) . "\n\t\t</table>\n\t\t</fieldset>\n\t", "\n\t\t<fieldset id=\"extra_a_{$item_js}\" title=\"{$vbphrase['extra_css']}\">\n\t\t<legend>{$vbphrase['extra_css']}</legend>\n\t\t<div align=\"center\" style=\"padding: 2px\">\n\t\t<textarea name=\"css[{$item}][EXTRA]\" rows=\"4\" cols=\"50\" class=\"{$color}\" style=\"padding: 2px; width: 90%\" tabindex=\"1\" dir=\"ltr\">" . htmlspecialchars_uni($css["{$item}"]['EXTRA']) . "</textarea>\n\t\t</div>\n\t\t</fieldset>\n\t\t" . iif($description != '', "<fieldset id=\"desc_a_{$item_js}\" title=\"{$vbphrase['description']}\" style=\"margin-bottom:4px;\">\n\t\t<legend>{$vbphrase['description']}</legend>\n\t\t<div class=\"smallfont\" style=\"margin:4px 4px 0px 4px\">\n\t\t\t<img src=\"../cpstyles/" . $vbulletin->options['cpstylefolder'] . "/cp_help.gif\" alt=\"{$title}\" align=\"{$stylevar['right']}\" style=\"padding:0px 0px 0px 2px\" />\n\t\t\t{$description}\n\t\t</div>\n\t\t</fieldset>") . "\n", 'alt2'); if (is_browser('mozilla')) { echo "<script type=\"text/javascript\">reflow_fieldset('a_{$item_js}', true);</script>\n"; } if ($dolinks) { print_description_row(' <table cellpadding="4" cellspacing="0" border="0" width="100%"> <tr> ' . construct_link_css_input_row($vbphrase['normal_link'], $item, 'N', $color) . ' ' . construct_link_css_input_row($vbphrase['visited_link'], $item, 'V', $color) . ' ' . construct_link_css_input_row($vbphrase['hover_link'], $item, 'M', $color) . ' </tr> </table> ', 0, 2, 'alt2" style="padding: 0px'); } if ($revertctrl != '') { print_description_row('<div class="smallfont" style="text-align: center">' . $revertctrl . '</div>', 0, 2, 'thead'); } print_description_row("\n\t\t<div class=\"alt1\" style=\"border:inset 1px; padding:2px 10px 2px 10px; float:{$stylevar['left']}\">" . construct_phrase($vbphrase['css_selector_x'], "<code>{$item}</code>") . "</div>\n\t\t<!--" . iif($revertlink != '', "<input type=\"button\" class=\"button\" style=\"font-weight:normal\" value=\"{$vbphrase['show_default']}\" tabindex=\"1\" onclick=\"js_show_default_item('{$revertlink}', {$dolinks});\" />") . "-->\n\t\t<input type=\"submit\" class=\"button\" style=\"font-weight:normal\" value=\" " . $vbphrase['save_css'] . " \" tabindex=\"1\" />\n\t", 0, 2, 'tfoot" align="right'); echo "\n\n<!-- END {$title} CSS -->\n\n"; if ($restarttable) { print_table_break(' '); } }
// show the form for the $vbulletin->GPC['dostyleid'] $stylevars = fetch_stylevars_array(); // $stylevars['group']['stylevarid']['styleid'] = $stylevar (record array from db); echo "\n\t\t\t\t\t<div><select size='31' multiple='multiple' class='leftcontrol' id='varlist'>\n\t"; $groups = array_keys($stylevars); $js_stylevarlist_array = array(); foreach ($groups as $group) { //TODO use friendly name once we figure that out. echo "\n\t\t\t\t\t\t<optgroup label='{$group}'>\n\t\t"; $stylevarids = array_keys($stylevars[$group]); foreach ($stylevarids as $stylevarid) { if ($stylevarid) { // build JS stylevar array $js_stylevarlist_array[] = "\"{$stylevarid}\" : \"{$stylevarid}\""; //TODO use friendly name once we figure that out. $color = fetch_inherited_color($stylevars["{$group}"]["{$stylevarid}"]['styleid'], $vbulletin->GPC['dostyleid']); echo "\n\t\t\t\t\t<option id='varlist_stylevar{$stylevarid}' class=\"{$color}\" value='" . $stylevarid . "'>{$stylevarid}</option>\n\t\t\t\t"; } } echo "</optgroup>"; } $js_stylevarlist_array = implode(",\n\t", $js_stylevarlist_array); echo ' </select></div> <script type="text/javascript" src="../clientscript/vbulletin_list_filter.js?v=' . SIMPLE_VERSION . '"></script> <script type="text/javascript"> vBulletin.register_control("vB_List_Filter", "stylevar_filter", Array("varlist"), { ' . $js_stylevarlist_array . ' }, "_stylevar", init); vBulletin_init(); </script>
for ($depth = 0; $depth < 5; $depth++) { $jumpbits[] = construct_forumjump_css_row(construct_phrase($vbphrase['depth_x_items'], $depth), ".fjdpth{$depth}"); } $i = 0; while ($i < sizeof($jumpbits)) { print_label_row($jumpbits[$i++], $jumpbits[$i++], 'alt2'); } print_table_break(' '); // additional css print_table_header($vbphrase['additional_css']); print_textarea_row($vbphrase['additional_css_description'], 'css[EXTRA][all]', $css['EXTRA']['all'], 10, 80, true, false, 'ltr', fetch_inherited_color($css_info['EXTRA'], $vbulletin->GPC['dostyleid']) . '" style="font:9pt \'courier new\', monospace'); $revertcode = construct_revert_code($css_info['EXTRA'], 'css', 'EXTRA'); if ($revertcode['info']) { print_description_row("<span style=\"float:{$stylevar['right']}\">{$revertcode['revertcode']}</span>{$revertcode['info']}", 0, 2, 'tfoot" align="center'); } print_textarea_row('', 'css[EXTRA2][all]', $css['EXTRA2']['all'], 10, 80, true, false, 'ltr', fetch_inherited_color($css_info['EXTRA2'], $vbulletin->GPC['dostyleid']) . '" style="font:9pt \'courier new\', monospace'); $revertcode = construct_revert_code($css_info['EXTRA2'], 'css', 'EXTRA2'); if ($revertcode['info']) { print_description_row("<span style=\"float:{$stylevar['right']}\">{$revertcode['revertcode']}</span>{$revertcode['info']}", 0, 2, 'tfoot" align="center'); } print_table_break(' '); } // ############################################################################# // POST EDITOR if ($vbulletin->GPC['dowhat'] == 'posteditor' or $vbulletin->GPC['dowhat'] == 'all') { construct_hidden_code('dowhat[posteditor]', 1); print_table_header($vbphrase['text_editor_control_styles']); print_description_row($vbphrase['text_editor_control_desc']); $out = array(); foreach ($_query_special_templates as $varname) { if (substr($varname, 0, 13) == 'editor_styles') {
/** * Prints a row containing an input for editing a stylevar * * @param string Stylevar title * @param string Stylevar varname * @param integer Size of text box */ function print_stylevar_row($title, $varname, $size = 30, $validation_regex = '', $failsafe_value = '') { global $stylevars, $stylevar_info, $vbulletin; $color = fetch_inherited_color($stylevar_info["{$varname}"], $vbulletin->GPC['dostyleid']); $revertcode = construct_revert_code($stylevar_info["{$varname}"], 'stylevar', $varname); if ($help = construct_table_help_button("stylevar[{$varname}]")) { $helplink = " {$help}"; } if ($validation_regex != '') { construct_hidden_code("stylevar[_validation][{$varname}]", htmlspecialchars_uni($validation_regex)); construct_hidden_code("stylevar[_failsafe][{$varname}]", htmlspecialchars_uni($failsafe_value)); } print_cells_row(array("<span title=\"\$stylevar[{$varname}]\">{$title}</span>", "<span class=\"smallfont\"><input type=\"text\" class=\"{$color}\" title=\"\$stylevar[{$varname}]\" name=\"stylevar[{$varname}]\" tabindex=\"1\" value=\"" . htmlspecialchars_uni($stylevars["{$varname}"]) . "\" size=\"{$size}\" dir=\"ltr\" /><br />{$revertcode['info']}</span>", "<span class=\"smallfont\">{$revertcode['revertcode']}</span>{$helplink}")); }