| 1 |
<?php |
| 2 |
class Element_Color extends Element_Textbox { |
| 3 |
protected $jQueryOptions; |
| 4 |
|
| 5 |
public function jQueryDocumentReady() { |
| 6 |
parent::jQueryDocumentReady(); |
| 7 |
|
| 8 |
if(empty($this->jQueryOptions["onSubmit"])) |
| 9 |
$this->jQueryOptions["onSubmit"] = 'js:function(hsb, hex, rgb, el) { jQuery(el).val("#" + hex); jQuery(el).ColorPickerHide(); }'; |
| 10 |
if(empty($this->jQueryOptions["onBeforeShow"])) |
| 11 |
$this->jQueryOptions["onBeforeShow"] = 'js:function() { jQuery(this).ColorPickerSetColor(this.value); }'; |
| 12 |
|
| 13 |
echo 'jQuery("#', $this->attributes["id"], '").ColorPicker(', $this->jQueryOptions(), ').bind("keyup", function() { jQuery(this).ColorPickerSetColor(this.value); });'; |
| 14 |
} |
| 15 |
|
| 16 |
function getCSSFiles() { |
| 17 |
return array( |
| 18 |
$this->form->getResourcesPath() . "/colorpicker/css/colorpicker.css" |
| 19 |
); |
| 20 |
} |
| 21 |
|
| 22 |
function getJSFiles() { |
| 23 |
return array( |
| 24 |
$this->form->getResourcesPath() . "/colorpicker/js/colorpicker.js" |
| 25 |
); |
| 26 |
} |
| 27 |
} |
| 28 |
|