diff --git a/lib/label/label.php b/lib/label/label.php
index 5df892d..6e70770 100644
--- a/lib/label/label.php
+++ b/lib/label/label.php
@@ -2,7 +2,12 @@
class pz_label extends pz_model
{
+ const COLOR = '#23b3db';
+
+ const BORDER = '#1699d6';
+
public $vars = [];
+
public $isLabel = false;
public static $var_labels = 6;
diff --git a/lib/label/label_screen.php b/lib/label/label_screen.php
index 872d7e3..6d3d8ad 100644
--- a/lib/label/label_screen.php
+++ b/lib/label/label_screen.php
@@ -91,10 +91,16 @@ public function getEditForm($p = [])
$xform->setValueField('text', ['name', pz_i18n::msg('label_name')]);
$xform->setValidateField('empty', ['name', pz_i18n::msg('error_label_name_empty')]);
- $xform->setValueField('text', ['color', pz_i18n::msg('label_color')]);
+ $xform->setValueField('pz_color_screen',
+ ['color', pz_i18n::msg('label_color'), 'default_color'=>pz_label::COLOR]
+ );
+
$xform->setValidateField('empty', ['color', pz_i18n::msg('error_label_color_empty')]);
- $xform->setValueField('text', ['border', pz_i18n::msg('label_border')]);
+ $xform->setValueField('pz_color_screen',
+ ['border', pz_i18n::msg('label_border'), 'default_color'=>pz_label::BORDER]
+ );
+
$xform->setValidateField('empty', ['border', pz_i18n::msg('error_label_bordercolor_empty')]);
$xform->setActionField('db', ['pz_label', 'id='.$this->label->getId()]); // array("id"=>$this->label->getId())
@@ -143,9 +149,16 @@ public static function getAddForm($p = [])
$xform->setValueField('objparams', ['fragment', 'pz_screen_xform.tpl']);
$xform->setValueField('text', ['name', pz_i18n::msg('label_name')]);
$xform->setValidateField('empty', ['name', pz_i18n::msg('error_label_name_empty')]);
- $xform->setValueField('text', ['color', pz_i18n::msg('label_color')]);
+
+ $xform->setValueField('pz_color_screen',
+ ['color', pz_i18n::msg('label_color'), 'default_color'=>pz_label::COLOR ]
+ );
+
$xform->setValidateField('empty', ['color', pz_i18n::msg('error_label_color_empty')]);
- $xform->setValueField('text', ['border', pz_i18n::msg('label_border')]);
+
+ $xform->setValueField('pz_color_screen',
+ ['border', pz_i18n::msg('label_border'), 'default_color'=>pz_label::BORDER ]
+ );
$xform->setValidateField('empty', ['border', pz_i18n::msg('error_label_bordercolor_empty')]);
$xform->setActionField('db', []); // array("id"=>$label_id)
$return = $xform->getForm();
diff --git a/xform/value/class.xform.pz_color_screen.inc.php b/xform/value/class.xform.pz_color_screen.inc.php
new file mode 100644
index 0000000..da8b7aa
--- /dev/null
+++ b/xform/value/class.xform.pz_color_screen.inc.php
@@ -0,0 +1,88 @@
+getValue() == '' && !$this->params['send']) {
+ $this->setValue($this->getElement(3));
+ }
+
+ $class = $this->getHTMLClass();
+ $classes = $class;
+
+ if ($this->getElement(5) != '') {
+ $classes .= ' '.$this->getElement(5);
+ }
+
+ if (isset($this->params['warning'][$this->getId()])) {
+ $classes .= ' '.$this->params['warning'][$this->getId()];
+ }
+
+ $classes = (trim($classes) != '') ? ' class="'.trim($classes).'"' : '';
+
+ if ($this->getElement('disabled')) {
+ $disabled = ' disabled="disabled"';
+ }
+
+ $value = htmlspecialchars(stripslashes($this->getValue()));
+ if ($this->getElement('default_color') && !$this->getValue()) {
+ $value = htmlspecialchars(stripslashes($this->getElement('default_color')));
+ }
+
+
+ $label = ($this->getElement(2) == '')?:
+ '';
+
+ $field = 'getFieldName().'" value="'.$value.'"'.$disabled.' />';
+
+ $html_id = $this->getHTMLId();
+ $name = $this->getName();
+
+ $f = new pz_fragment();
+
+ $f->setVar('before', $before, false);
+ $f->setVar('after', $after, false);
+ $f->setVar('label', $label, false);
+ $f->setVar('field', $field, false);
+ $f->setVar('extra', $extra, false);
+ $f->setVar('html_id', $html_id, false);
+ $f->setVar('name', $name, false);
+ $f->setVar('class', $class, false);
+
+ $fragment = $this->params['fragment'];
+ $this->params['form_output'][$this->getId()] = $f->parse($fragment);
+
+ $this->params['form_output'][$this->getId()] .= '';
+
+ $this->params['value_pool']['email'][$this->getElement(1)] = stripslashes($this->getValue());
+ if ($this->getElement(4) != 'no_db') {
+ $this->params['value_pool']['sql'][$this->getElement(1)] = $this->getValue();
+ }
+ }
+
+ /**
+ * @see rex_xform_pz_color_screen::getDescription()
+ */
+ public function getDescription()
+ {
+ // do nothing
+ }
+}