Exemplo n.º 1
0
	protected function print_color_input_row($title, $name, $value)
	{
		$cp = "";

		//only include the colorpicker on the first color element.
		if (self::$need_colorpicker)
		{
			//construct all of the markup/javascript for the color picker.
			global $vbulletin;

			//set from construct_color_picker
			global $colorPickerWidth, $colorPickerType;

			$cp = '<script type="text/javascript" src="' . $vbulletin->options['bburl'] .
				'/clientscript/vbulletin_cpcolorpicker.js?v=' .
				$vbulletin->options['simpleversion'] . '"></script>' . "\n";
			$cp .= construct_color_picker(11);

			$js_phrases[] = array();
			foreach (array(
				'css_value_invalid',
				'color_picker_not_ready',
			) AS $phrasename)
			{
				$js_phrases[] = "vbphrase.$phrasename = \"" . fetch_js_safe_string($vbphrase["$phrasename"]) . "\"";
			}

			$js_phrases = implode(";\r\n\t", $js_phrases) . ";\r\n";

			$cp .= '
					<script type="text/javascript">
					<!--
					var bburl = "' . $vbulletin->options['bburl'] .'";
					var cpstylefolder = "' . $vbulletin->options['cpstylefolder'] .'";
					var colorPickerWidth = ' . intval($colorPickerWidth) . ';
					var colorPickerType = ' . intval($colorPickerType) . ';
					if(vbphrase == undefined) {vbphrase = new Object();}
					' . $js_phrases . '

					vBulletin.events.systemInit.subscribe(function()
					{
						init_color_preview();
					});
					var cleargifurl = "' .$vbulletin->options['cleargifurl'] .'";
					//-->
				</script>';

			self::$need_colorpicker = false;
		}

		$id = 'color_'. self::$count;

		$color_preview = '<div id="preview_' . self::$count .
			'" class="colorpreview" onclick="open_color_picker(' . self::$count . ', event)"></div>';

		$title_attr = ($vbulletin->debug ? " title=\"name=&quot;$name&quot;\"" : '');
		$cell =
			"<div id=\"ctrl_$name\" class=\"color_input_container\">" .
				"<input type=\"text\" name=\"$name\" id=\"$id\" " .
					"value=\"$value\" " .
					"tabindex=\"1\" $title_attr />" .
			"</div>";

		print_label_row(
			$title,
			$cp . $cell . $color_preview,
			'', 'top', $name
		);

		self::$count++;
	}
Exemplo n.º 2
0
    $usercss->save();
    print_stop_message2('saved_profile_customizations_successfully', 'user', array('do' => 'edit', 'u' => $userinfo['userid']));
}
// ########################################################################
if ($_REQUEST['do'] == 'usercss') {
    require_once DIR . '/includes/adminfunctions_template.php';
    ?>
	<script type="text/javascript" src="<?php 
    echo $vbulletin->options['bburl'];
    ?>
/clientscript/vbulletin_cpcolorpicker.js?v=<?php 
    echo SIMPLE_VERSION;
    ?>
"></script>
	<?php 
    $colorPicker = construct_color_picker(11);
    $allowedfonts = $usercss->build_admin_select_option($vbulletin->options['usercss_allowed_fonts'], 'usercss_font_');
    $allowedfontsizes = $usercss->build_admin_select_option($vbulletin->options['usercss_allowed_font_sizes'], 'usercss_fontsize_');
    $allowedborderwidths = $usercss->build_admin_select_option($vbulletin->options['usercss_allowed_border_widths'], 'usercss_borderwidth_');
    $allowedpaddings = $usercss->build_admin_select_option($vbulletin->options['usercss_allowed_padding'], 'usercss_padding_');
    $allowedborderstyles = array('' => '', 'none' => $vbphrase['usercss_borderstyle_none'], 'hidden' => $vbphrase['usercss_borderstyle_hidden'], 'dotted' => $vbphrase['usercss_borderstyle_dotted'], 'dashed' => $vbphrase['usercss_borderstyle_dashed'], 'solid' => $vbphrase['usercss_borderstyle_solid'], 'double' => $vbphrase['usercss_borderstyle_double'], 'groove' => $vbphrase['usercss_borderstyle_groove'], 'ridge' => $vbphrase['usercss_borderstyle_ridge'], 'inset' => $vbphrase['usercss_borderstyle_inset'], 'outset' => $vbphrase['usercss_borderstyle_outset']);
    $allowedbackgroundrepeats = array('' => '', 'repeat' => $vbphrase['usercss_repeat_repeat'], 'repeat-x' => $vbphrase['usercss_repeat_repeat_x'], 'repeat-y' => $vbphrase['usercss_repeat_repeat_y'], 'no-repeat' => $vbphrase['usercss_repeat_no_repeat']);
    $cssdisplayinfo = $usercss->build_display_array();
    print_form_header('usertools', 'updateusercss');
    print_table_header(construct_phrase($vbphrase['edit_profile_style_customizations_for_x'], $userinfo['username']));
    construct_hidden_code('userid', $userinfo['userid']);
    $have_output = false;
    foreach ($cssdisplayinfo as $selectorname => $selectorinfo) {
        if (empty($selectorinfo['properties'])) {
            $selectorinfo['properties'] = $usercss->cssedit["{$selectorname}"]['properties'];
        }
Exemplo n.º 3
0
    protected function print_color_input_row($title, $stylevarid, $color_value, $stylevar_value)
    {
        global $vbphrase;
        $cp = "";
        $color_value = htmlspecialchars_uni($color_value);
        //only include the colorpicker on the first color element.
        if (self::$need_colorpicker) {
            //construct all of the markup/javascript for the color picker.
            //set from construct_color_picker
            global $colorPickerWidth, $colorPickerType;
            $cp = '<script type="text/javascript" src="' . vB::getDatastore()->getOption('bburl') . '/clientscript/vbulletin_cpcolorpicker.js?v=' . vB::getDatastore()->getOption('simpleversion') . '"></script>' . "\n";
            $cp .= construct_color_picker(11);
            $js_phrases = array();
            foreach (array('css_value_invalid', 'color_picker_not_ready') as $phrasename) {
                $js_phrases[] = "vbphrase.{$phrasename} = \"" . fetch_js_safe_string($vbphrase["{$phrasename}"]) . "\"";
            }
            $js_phrases = implode(";\r\n\t", $js_phrases) . ";\r\n";
            $cp .= '
					<script type="text/javascript">
					<!--
					var bburl = "' . vB::getDatastore()->getOption('bburl') . '";
					var cpstylefolder = "' . vB::getDatastore()->getOption('cpstylefolder') . '";
					var colorPickerWidth = ' . intval($colorPickerWidth) . ';
					var colorPickerType = ' . intval($colorPickerType) . ';
					if(vbphrase == undefined) {vbphrase = new Object();}
					' . $js_phrases . '

					vBulletin.events.systemInit.subscribe(function()
					{
						init_color_preview();
					});
					var cleargifurl = "' . vB::getDatastore()->getOption('bburl') . '/' . vB::getDatastore()->getOption('cleargifurl') . '";
					//-->
				</script>';
            self::$need_colorpicker = false;
        }
        $vb5_config =& vB::getConfig();
        $id = 'color_' . self::$count;
        $color_name = 'stylevar[' . $stylevarid . '][color]';
        $title_attr = $vb5_config['Misc']['debug'] ? " title=\"name=&quot;{$color_name}&quot;\"" : '';
        $cell = "<div id=\"ctrl_{$color_name}\" class=\"color_input_container\">" . "<input type=\"text\" name=\"{$color_name}\" id=\"{$id}\" " . "value=\"{$color_value}\" " . "tabindex=\"1\" {$title_attr} />" . "</div>";
        $color_preview = '<div id="preview_' . self::$count . '" class="colorpreview" onclick="open_color_picker(' . self::$count . ', event)"></div>';
        $or_stylevar = $this->fetch_stylevar_input($stylevarid, 'color', $stylevar_value);
        print_label_row($title, $cp . $cell . $color_preview . $or_stylevar, '', 'top', $color_name);
        construct_hidden_code('stylevar[' . $stylevarid . '][original_color]', $color_value, false);
        self::$count++;
    }