예제 #1
0
/**
* Returns a <fieldset> for editing post editor styles
*
* @param	string	Item title
* @param	string	Item varname
*
* @return	string
*/
function construct_posteditor_style_code($title, $varname)
{
    global $template_cache, $vbphrase, $stylevar, $vbulletin;
    $template = $template_cache['template']["{$varname}"];
    $color = fetch_inherited_color($template['styleid'], $vbulletin->GPC['dostyleid']);
    $revertcode = construct_revert_code($template['styleid'], 'template', $varname);
    $item = fetch_posteditor_styles($template['template_un']);
    $out = "\n\t<fieldset title=\"{$title}\">\n\t\t<legend>{$title}</legend>\n\t\t<div class=\"smallfont\" style=\"padding: 2px\">\n\t\t<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" width=\"100%\">\n\t\t<col width=\"50\"></col>\n\t\t<col></col>\n\t\t<col align=\"{$stylevar['right']}\"></col>\n\t\t<tr>\n\t\t\t<td rowspan=\"5\"><img src=\"control_examples/" . substr($varname, 14) . ".gif\" alt=\"\" title=\"{$title}\" /></td>\n\t\t\t" . construct_color_row($vbphrase['background'], "commontemplate[{$varname}][background]", htmlspecialchars_uni($item['background']), $color, 12, false) . "\n\t\t</tr>\n\t\t<tr>\n\t\t\t" . construct_color_row($vbphrase['font_color'], "commontemplate[{$varname}][color]", htmlspecialchars_uni($item['color']), $color, 12, false) . "\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>{$vbphrase['padding']}</td>\n\t\t\t<td><input type=\"text\" class=\"{$color}\" name=\"commontemplate[{$varname}][padding]\" size=\"20\" value=\"" . htmlspecialchars_uni($item['padding']) . "\" tabindex=\"1\" dir=\"ltr\" /></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>{$vbphrase['border']}</td>\n\t\t\t<td><input type=\"text\" class=\"{$color}\" name=\"commontemplate[{$varname}][border]\" size=\"20\" value=\"" . htmlspecialchars_uni($item['border']) . "\" tabindex=\"1\" dir=\"ltr\" /></td>\n\t\t</tr>";
    if ($revertcode['info']) {
        $out .= "\n\t\t<tr>\n\t\t\t<td>{$revertcode['info']}</td>\n\t\t\t<td>{$revertcode['revertcode']}</td>\n\t\t</tr>";
    } else {
        $out .= "\n\t\t<tr>\n\t\t\t<td colspan=\"2\">&nbsp;</td>\n\t\t</tr>";
    }
    $out .= "\n\t\t</table>\n\t\t</div>\n\t</fieldset>";
    return $out;
}
/**
* Returns a row with an input box for use in the CSS editor
*
* @param	string	Title of item
* @param	array	Item info array
* @param	string	CSS class to display with
* @param	boolean	True if the value is a colour (will show colour picker widget)
* @param	integer	Size of input box
*
* @return	string
*/
function construct_css_input_row($title, $item, $class = 'bginput', $iscolor = false, $size = 30)
{
    global $css, $readonly, $color, $numcolors;
    eval('$value = $css' . $item . ';');
    $name = "css" . str_replace("['", "[", str_replace("']", "]", $item));
    if ($iscolor) {
        return construct_color_row($title, $name, $value, $class, $size - 8);
    }
    $value = htmlspecialchars_uni($value);
    $readonly = iif($readonly, ' readonly="readonly"', '');
    return "\n\t\t<tr>\n\t\t\t<td>{$title}</td>\n\t\t\t<td><input type=\"text\" class=\"{$class}\" name=\"{$name}\" value=\"{$value}\" title=\"\${$name}\" tabindex=\"1\" size=\"{$size}\" dir=\"ltr\" /></td>\n\t\t</tr>\n\t";
}