78 public $HTMLcolorList =
'aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,purple,red,silver,teal,yellow,white';
110 $GLOBALS[
'LANG']->includeLLFile(
'EXT:lang/locallang_wizards.xlf');
133 $this->imageError =
'';
134 if ($this->exampleImg) {
136 if (!$this->pickerImage || !@is_file($this->pickerImage)) {
137 $this->imageError =
'ERROR: The image, "' . $this->exampleImg .
'", could not be found!';
143 $fieldChangeFuncArr = unserialize($this->fieldChangeFunc);
144 unset($fieldChangeFuncArr[
'alert']);
145 foreach ($fieldChangeFuncArr as $v) {
147 parent.opener.' . $v;
152 $this->doc->backPath =
$GLOBALS[
'BACK_PATH'];
153 $this->doc->JScode = $this->doc->wrapScriptTags(
' 154 function checkReference() { // 155 if (parent.opener && parent.opener.document && parent.opener.document.' . $this->formName .
' && parent.opener.document.' . $this->formName .
'["' . $this->fieldName .
'"]) { 156 return parent.opener.document.' . $this->formName .
'["' . $this->fieldName .
'"]; 161 function changeBGcolor(color) { // Changes the color in the table sample back in the TCEform. 162 if (parent.opener.document.layers) { 163 parent.opener.document.layers["' . $this->md5ID .
'"].bgColor = color; 164 } else if (parent.opener.document.all) { 165 parent.opener.document.all["' . $this->md5ID .
'"].style.background = color; 166 } else if (parent.opener.document.getElementById && parent.opener.document.getElementById("' . $this->md5ID .
'")) { 167 parent.opener.document.getElementById("' . $this->md5ID .
'").bgColor = color; 170 function setValue(input) { // 171 var field = checkReference(); 175 changeBGcolor(input); 178 function getValue() { // 179 var field = checkReference(); 184 $this->content .= $this->doc->startPage(
$GLOBALS[
'LANG']->getLL(
'colorpicker_title'));
205 <p class="c-head">' .
$GLOBALS[
'LANG']->getLL(
'colorpicker_colorValue', TRUE) .
'</p> 206 <table border="0" cellpadding="0" cellspacing="3"> 208 <td><input type="text" ' . $this->doc->formWidth(7) .
' maxlength="10" name="colorValue" value="' . htmlspecialchars($this->colorValue) .
'" /></td> 209 <td style="background-color:' . htmlspecialchars($this->colorValue) .
'; border: 1px solid black;"> <span style="color: black;">' .
$GLOBALS[
'LANG']->getLL(
'colorpicker_black', TRUE) .
'</span> <span style="color: white;">' .
$GLOBALS[
'LANG']->getLL(
'colorpicker_white', TRUE) .
'</span> </td> 210 <td><input type="submit" name="save_close" value="' .
$GLOBALS[
'LANG']->getLL(
'colorpicker_setClose', TRUE) .
'" /></td> 214 <!-- Hidden fields with values that has to be kept constant --> 215 <input type="hidden" name="showPicker" value="1" /> 216 <input type="hidden" name="fieldChangeFunc" value="' . htmlspecialchars($this->fieldChangeFunc) .
'" /> 217 <input type="hidden" name="fieldChangeFuncHash" value="' . htmlspecialchars($this->fieldChangeFuncHash) .
'" /> 218 <input type="hidden" name="fieldName" value="' . htmlspecialchars($this->fieldName) .
'" /> 219 <input type="hidden" name="formName" value="' . htmlspecialchars($this->formName) .
'" /> 220 <input type="hidden" name="md5ID" value="' . htmlspecialchars($this->md5ID) .
'" /> 221 <input type="hidden" name="exampleImg" value="' . htmlspecialchars($this->exampleImg) .
'" /> 225 $content .= $this->doc->wrapScriptTags(
' 231 $this->content .= $this->doc->section(
$GLOBALS[
'LANG']->getLL(
'colorpicker_title'),
$content, 0, 1);
242 $this->content .= $this->doc->endPage();
243 $this->content = $this->doc->insertStylesAndJS($this->content);
257 $GLOBALS[
'TBE_TEMPLATE']->docType =
'xhtml_frames';
258 $GLOBALS[
'TBE_TEMPLATE']->JScode =
$GLOBALS[
'TBE_TEMPLATE']->wrapScriptTags(
' 259 if (!window.opener) { 260 alert("ERROR: Sorry, no link to main window... Closing"); 264 $this->content =
$GLOBALS[
'TBE_TEMPLATE']->startPage(
$GLOBALS[
'LANG']->getLL(
'colorpicker_title'));
267 'wizard_colorpicker',
270 'colorValue' => $this->P[
'currentValue'],
271 'fieldName' => $this->P[
'itemName'],
272 'formName' => $this->P[
'formName'],
273 'exampleImg' => $this->P[
'exampleImg'],
274 'md5ID' => $this->P[
'md5ID'],
275 'fieldChangeFunc' => serialize($this->P[
'fieldChangeFunc']),
276 'fieldChangeFuncHash' => $this->P[
'fieldChangeFuncHash'],
280 <frameset rows="*,1" framespacing="0" frameborder="0" border="0"> 281 <frame name="content" src="' . htmlspecialchars($url) .
'" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" /> 282 <frame name="menu" src="dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" /> 304 for ($rr = 0; $rr < 256; $rr += $steps) {
305 for ($gg = 0; $gg < 256; $gg += $steps) {
306 for ($bb = 0; $bb < 256; $bb += $steps) {
307 $color[] =
'#' . substr((
'0' . dechex($rr)), -2) . substr((
'0' . dechex($gg)), -2) . substr((
'0' . dechex($bb)), -2);
315 while (isset($color[$columns * $rows])) {
317 for ($i = 0; $i < $columns; $i++) {
319 <td bgcolor="' . $color[($columns * $rows + $i)] .
'" onclick="document.colorform.colorValue.value = \'' . $color[($columns * $rows + $i)] .
'\'; document.colorform.submit();
" title="' . $color[($columns * $rows + $i)] . '"> </td>'; 322 <tr>' . implode('', $tCells) . ' 327 <p class="c-head
">' . $GLOBALS['LANG']->getLL('colorpicker_fromMatrix', TRUE) . '</p> 328 <table border="0
" cellpadding="1
" cellspacing="1
" style="width:100%; border: 1px solid black; cursor:crosshair;
">' . implode('', $tRows) . ' 339 public function colorList() { 340 // Initialize variables: 341 $colors = explode(',', $this->HTMLcolorList); 342 $currentValue = strtolower($this->colorValue); 344 $opt[] = '<option value=""></option>'; 345 // Traverse colors, making option tags for selector box. 346 foreach ($colors as $colorName) { 347 $opt[] = '<option style="background-color:
' . $colorName . ';
" value="' . htmlspecialchars($colorName) . '"' . ($currentValue == $colorName ? ' selected="selected
"' : '') . '>' . htmlspecialchars($colorName) . '</option>'; 349 // Compile selector box and return result: 351 <p class="c-head
">' . $GLOBALS['LANG']->getLL('colorpicker_fromList', TRUE) . '</p> 352 <select onchange="document.colorform.colorValue.value = this.options[this.selectedIndex].value; document.colorform.submit();
return false;
"> 365 public function colorImage() { 366 // Handling color-picker image if any: 367 if (!$this->imageError) { 368 if ($this->pickerImage) { 369 if (GeneralUtility::_POST('coords_x')) { 370 $this->colorValue = '#' . $this->getIndex(\TYPO3\CMS\Core\Imaging\GraphicalFunctions::imageCreateFromFile($this->pickerImage), GeneralUtility::_POST('coords_x'), GeneralUtility::_POST('coords_y')); 373 <p class="c-head
">' . $GLOBALS['LANG']->getLL('colorpicker_fromImage', TRUE) . '</p> 374 <input type="image
" src="../
' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($this->pickerImage) . '" name="coords
" style="cursor:crosshair;
" /><br />'; 376 $pickerFormImage = ''; 380 <p class="c-head
">' . htmlspecialchars($this->imageError) . '</p>'; 382 return $pickerFormImage; 396 public function getIndex($im, $x, $y) { 397 $rgb = ImageColorAt($im, $x, $y); 398 $colorrgb = imagecolorsforindex($im, $rgb); 399 $index['r'] = dechex($colorrgb['red']); 400 $index['g'] = dechex($colorrgb['green']); 401 $index['b'] = dechex($colorrgb['blue']); 402 foreach ($index as $value) { 403 if (strlen($value) == 1) { 404 $hexvalue[] = strtoupper('0' . $value); 406 $hexvalue[] = strtoupper($value); 409 $hex = implode('', $hexvalue); 419 protected function areFieldChangeFunctionsValid() { 420 return $this->fieldChangeFunc && $this->fieldChangeFuncHash && $this->fieldChangeFuncHash === GeneralUtility::hmac($this->fieldChangeFunc);
static quoteJSvalue($value)
static makeInstance($className)
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
areFieldChangeFunctionsValid()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)