$this->getName() . '1185966508field', 'onChange' => 'relateColor(\'' . $this->getName() . '1185966508\', this.value);', )); return parent::setValue($color); } function toHtml() { static $jsShown; $html = ''; $html = '
'; $html .= parent::toHtml(); if (!$this->_flagFrozen) { if ($jsCPShown !=true ) { $html .= << var perline = 9; var divSet = false; var curId; var colorLevels = Array('0', '3', '6', '9', 'C', 'F'); var colorArray = Array(); var ie = false; var nocolor = 'none'; if (document.all) { ie = true; nocolor = ''; } function getObj(id) { if (ie) { return document.all[id]; } else { return document.getElementById(id); } } function addColor(r, g, b) { var red = colorLevels[r]; var green = colorLevels[g]; var blue = colorLevels[b]; addColorValue(red, green, blue); } function addColorValue(r, g, b) { colorArray[colorArray.length] = '#' + r + r + g + g + b + b; } function setColor(color) { var link = getObj(curId); var field = getObj(curId + 'field'); var picker = getObj('colorpicker'); field.value = color; if (color == '') { link.style.background = nocolor; link.style.color = nocolor; color = nocolor; } else { link.style.background = color; link.style.color = color; } picker.style.display = 'none'; eval(getObj(curId + 'field').title); } function setDiv() { if (!document.createElement) { return; } var elemDiv = document.createElement('div'); if (typeof(elemDiv.innerHTML) != 'string') { return; } genColors(); elemDiv.id = 'colorpicker'; elemDiv.style.position = 'absolute'; elemDiv.style.display = 'none'; elemDiv.style.border = '#000000 1px solid'; elemDiv.style.background = '#FFFFFF'; elemDiv.innerHTML = 'Pick a color: ' + '(No color)
' + getColorTable() ; //+ '
color picker by flooble
'; EOQ; $html .= "\nvar d = document.getElementById('id_" . $this->getName() . "_div');\n"; $html .= <<    '; if (i % perline == perline - 1) { tableCode += ''; } } if (i % perline != 0) { tableCode += ''; } tableCode += ''; return tableCode; } function relateColor(id, color) { var link = getObj(id); if (color == '') { link.style.background = nocolor; link.style.color = nocolor; color = nocolor; } else { link.style.background = color; link.style.color = color; } eval(getObj(id + 'field').title); } function getAbsoluteOffsetTop(obj) { var top = obj.offsetTop; var parent = obj.offsetParent; while (parent != document.body) { top += parent.offsetTop; parent = parent.offsetParent; } return top; } function getAbsoluteOffsetLeft(obj) { var left = obj.offsetLeft; var parent = obj.offsetParent; while (parent != document.body) { left += parent.offsetLeft; parent = parent.offsetParent; } return left; } EOQ; $jsCPShown = true; } /**/ $html .= '      '; $html .= "
"; } return $html; } } ?>