| verzia 1.6, 2006/09/16 18:43:47 |
verzia 1.7, 2008/03/18 10:45:25 |
|
|
| * |
* |
| * Contribution of Adam Hammond <php@pixolet.co.uk>, London, UK |
* Contribution of Adam Hammond <php@pixolet.co.uk>, London, UK |
| * Contribution of Ezudin Kurtowich <ekurtovic@ieee.org>, Sarajevo |
* Contribution of Ezudin Kurtowich <ekurtovic@ieee.org>, Sarajevo |
| * Copyright (c) 2003-2006 Platon Group, http://platon.sk/ |
* Copyright (c) 2003-2008 Platon Group, http://platon.sk/ |
| * All rights reserved. |
* All rights reserved. |
| * |
* |
| |
* Updated 18th Mar 2008 |
| |
* |
| |
* Updated to be in sync with latest CVS |
| |
* |
| |
* |
| * Updated 28th Jul 2005 |
* Updated 28th Jul 2005 |
| * |
* |
| * Updated to use TinyMCE instead of HTMLArea |
* Updated to use TinyMCE instead of HTMLArea |
|
|
| * http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon$ */ |
/* $Platon: phpMyEdit/extensions/phpMyEdit-mce-cal.class.php,v 1.6 2006-09-16 18:43:47 nepto Exp $ */ |
| |
|
| /* |
/* |
| OVERVIEW |
OVERVIEW |
| Riadok 268 require_once dirname(__FILE__).'/../phpM |
|
| Riadok 273 require_once dirname(__FILE__).'/../phpM |
|
| |
|
| class phpMyEdit_mce_cal extends phpMyEdit |
class phpMyEdit_mce_cal extends phpMyEdit |
| { |
{ |
| /* calendar mod start */ |
|
| |
|
| var $calendars; // Array for collecting list of fields with calendar popups |
var $calendars; // Array for collecting list of fields with calendar popups |
| |
|
| /* Array of valid options for passing to Calendar.setup */ |
/* Array of valid options for passing to Calendar.setup */ |
| Riadok 327 class phpMyEdit_mce_cal extends phpMyEdi |
|
| Riadok 330 class phpMyEdit_mce_cal extends phpMyEdi |
|
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| |
|
| /* calendar mod end */ |
function htmlTextarea($name, $css, $k, $value = null, $js = NULL) |
| |
{ |
| |
$ret = '<textarea class="'.$css.'" name="'.$name.'"'; |
| |
$ret .= ($this->readonly($k) ? ' disabled' : ''); |
| |
if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
| |
$ret .= ' rows="'.$this->fdd[$k]['textarea']['rows'].'"'; |
| |
} |
| |
if (intval($this->fdd[$k]['textarea']['cols']) > 0) { |
| |
$ret .= ' cols="'.$this->fdd[$k]['textarea']['cols'].'"'; |
| |
} |
| |
if (isset($this->fdd[$k]['textarea']['wrap'])) { |
| |
$ret .= ' wrap="'.$this->fdd[$k]['textarea']['wrap'].'"'; |
| |
} else { |
| |
$ret .= ' wrap="virtual"'; |
| |
} |
| |
// mce_cal mod start |
| |
if (isset($this->fdd[$k]['textarea']['html'])) { |
| |
$mce_tag = 'editable'; |
| |
if (is_string($this->fdd[$k]['textarea']['html'])) { |
| |
$mce_tag = $this->fdd[$k]['textarea']['html']; |
| |
}; |
| |
$ret .= ' mce_'.$mce_tag.'=true '; |
| |
}; |
| |
// mce_cal mod end |
| |
$ret .= '>'; |
| |
if($escape) $ret .= htmlspecialchars($value); |
| |
else $ret .= $value; |
| |
$ret .= '</textarea>'."\n"; |
| |
return $ret; |
| |
} /* }}} */ |
| |
|
| function display_add_record() /* {{{ */ |
function display_add_record() /* {{{ */ |
| { |
{ |
| for ($tab = 0, $k = 0; $k < $this->num_fds; $k++) { |
for ($tab = 0, $k = 0; $k < $this->num_fds; $k++) { |
| Riadok 348 class phpMyEdit_mce_cal extends phpMyEdi |
|
| Riadok 380 class phpMyEdit_mce_cal extends phpMyEdi |
|
| } |
} |
| $css_postfix = @$this->fdd[$k]['css']['postfix']; |
$css_postfix = @$this->fdd[$k]['css']['postfix']; |
| $css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix); |
$css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix); |
| |
$escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true; |
| echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n"; |
echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n"; |
| echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">'; |
echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">'; |
| echo $this->fdd[$k]['name'],'</td>',"\n"; |
echo $this->fdd[$k]['name'],'</td>',"\n"; |
| Riadok 356 class phpMyEdit_mce_cal extends phpMyEdi |
|
| Riadok 389 class phpMyEdit_mce_cal extends phpMyEdi |
|
| if ($this->col_has_values($k)) { |
if ($this->col_has_values($k)) { |
| $vals = $this->set_values($k); |
$vals = $this->set_values($k); |
| $selected = @$this->fdd[$k]['default']; |
$selected = @$this->fdd[$k]['default']; |
| $multiple = $this->col_has_multiple_select($k); |
$multiple = $this->col_has_multiple($k); |
| $readonly = $this->readonly($k); |
$readonly = $this->readonly($k); |
| $strip_tags = true; |
$strip_tags = true; |
| $escape = true; |
//$escape = true; |
| echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, |
if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) { |
| $vals, $selected, $multiple, $readonly, $strip_tags, $escape); |
echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k], |
| } elseif (isset ($this->fdd[$k]['textarea'])) { |
$css_class_name, $vals, $selected, $multiple, $readonly, |
| echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
$strip_tags, $escape); |
| echo ($this->readonly($k) ? ' disabled' : ''); |
|
| if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
|
| echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
|
| } |
|
| if (intval($this->fdd[$k]['textarea']['cols']) > 0) { |
|
| echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"'; |
|
| } |
|
| if (isset($this->fdd[$k]['textarea']['wrap'])) { |
|
| echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"'; |
|
| } else { |
} else { |
| echo ' wrap="virtual"'; |
echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], |
| }; |
$css_class_name, $vals, $selected, $multiple, $readonly, |
| // mce mod start |
$strip_tags, $escape); |
| if (isset($this->fdd[$k]['textarea']['html'])) { |
} |
| $mce_tag = 'editable'; |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
| if (is_string($this->fdd[$k]['textarea']['html'])) { |
echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $this->fdd[$k]['default']); |
| $mce_tag = $this->fdd[$k]['textarea']['html']; |
} elseif ($this->col_has_php($k)) { |
| }; |
echo include($this->fdd[$k]['php']); |
| echo ' mce_'.$mce_tag.'=true '; |
|
| }; |
|
| // mce mod end |
|
| echo '>',htmlspecialchars($this->fdd[$k]['default']),'</textarea>',"\n"; |
|
| } else { |
} else { |
| // Simple edit box required |
// Simple edit box required |
| $size_ml_props = ''; |
$len_props = ''; |
| $maxlen = intval($this->fdd[$k]['maxlen']); |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60); |
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60); |
| $size && $size_ml_props .= ' size="'.$size.'"'; |
if ($size > 0) { |
| $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
$len_props .= ' size="'.$size.'"'; |
| |
} |
| |
if ($maxlen > 0) { |
| |
$len_props .= ' maxlength="'.$maxlen.'"'; |
| |
} |
| echo '<input class="',$css_class_name,'" '; |
echo '<input class="',$css_class_name,'" '; |
| echo ($this->password($k) ? 'type="password"' : 'type="text"'); |
echo ($this->password($k) ? 'type="password"' : 'type="text"'); |
| echo ($this->readonly($k) ? ' disabled' : ''); |
echo ($this->readonly($k) ? ' disabled' : ''); |
| /* calendar mod start */ |
/* mce_cal mod start */ |
| echo ' id="',$this->dhtml['prefix'].'fld_'.$this->fds[$k],'"'; |
echo ' id="',$this->dhtml['prefix'].'fld_'.$this->fds[$k],'"'; |
| /* calendar mod end */ |
/* mce_cal mod end */ |
| echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
| echo $size_ml_props,' value="'; |
echo $len_props,' value="'; |
| echo htmlspecialchars($this->fdd[$k]['default']),'">'; |
if($escape) echo htmlspecialchars($this->fdd[$k]['default']); |
| /* calendar mod start */ |
else echo $this->fdd[$k]['default']; |
| |
echo '" />'; |
| |
/* mce_cal mod start */ |
| /* Call htmlcal helper function */ |
/* Call htmlcal helper function */ |
| $this->calPopup_helper($k, null); |
$this->calPopup_helper($k, null); |
| /* calendar mod end */ |
/* mce_cal mod end */ |
| } |
} |
| echo '</td>',"\n"; |
echo '</td>',"\n"; |
| if ($this->guidance) { |
if ($this->guidance) { |
| Riadok 416 class phpMyEdit_mce_cal extends phpMyEdi |
|
| Riadok 442 class phpMyEdit_mce_cal extends phpMyEdi |
|
| echo '</tr>',"\n"; |
echo '</tr>',"\n"; |
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| |
|
| function display_change_field($row, $k) /* {{{ */ |
function display_change_field($row, $k) /* {{{ */ |
| { |
{ |
| $css_postfix = @$this->fdd[$k]['css']['postfix']; |
$css_postfix = @$this->fdd[$k]['css']['postfix']; |
| $css_class_name = $this->getCSSclass('input', null, true, $css_postfix); |
$css_class_name = $this->getCSSclass('input', null, true, $css_postfix); |
| |
$escape = isset($this->fdd[$k]['escape']) ? $this->fdd[$k]['escape'] : true; |
| echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"'; |
echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'"'; |
| echo $this->getColAttributes($k),">\n"; |
echo $this->getColAttributes($k),">\n"; |
| if ($this->col_has_values($k)) { |
if ($this->col_has_values($k)) { |
| $vals = $this->set_values($k); |
$vals = $this->set_values($k); |
| $multiple = $this->col_has_multiple_select($k); |
$multiple = $this->col_has_multiple($k); |
| $readonly = $this->readonly($k); |
$readonly = $this->readonly($k); |
| $strip_tags = true; |
$strip_tags = true; |
| $escape = true; |
//$escape = true; |
| echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, |
if ($this->col_has_checkboxes($k) || $this->col_has_radio_buttons($k)) { |
| $vals, $row["qf$k"], $multiple, $readonly, $strip_tags, $escape); |
echo $this->htmlRadioCheck($this->cgi['prefix']['data'].$this->fds[$k], |
| } elseif (isset($this->fdd[$k]['textarea'])) { |
$css_class_name, $vals, $row["qf$k"], $multiple, $readonly, |
| echo '<textarea class="',$css_class_name,'" name="',$this->cgi['prefix']['data'].$this->fds[$k],'"'; |
$strip_tags, $escape); |
| echo ($this->readonly($k) ? ' disabled' : ''); |
|
| if (intval($this->fdd[$k]['textarea']['rows']) > 0) { |
|
| echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"'; |
|
| } |
|
| if (intval($this->fdd[$k]['textarea']['cols']) > 0) { |
|
| echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"'; |
|
| } |
|
| if (isset($this->fdd[$k]['textarea']['wrap'])) { |
|
| echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"'; |
|
| } else { |
} else { |
| echo ' wrap="virtual"'; |
echo $this->htmlSelect($this->cgi['prefix']['data'].$this->fds[$k], |
| }; |
$css_class_name, $vals, $row["qf$k"], $multiple, $readonly, |
| // mce mod start |
$strip_tags, $escape); |
| if (isset($this->fdd[$k]['textarea']['html'])) { |
} |
| $mce_tag = 'editable'; |
} elseif (isset($this->fdd[$k]['textarea'])) { |
| if (is_string($this->fdd[$k]['textarea']['html'])) { |
echo $this->htmlTextarea($this->cgi['prefix']['data'].$this->fds[$k], $css_class_name, $k, $row["qf$k"]); |
| $mce_tag = $this->fdd[$k]['textarea']['html']; |
} elseif ($this->col_has_php($k)) { |
| }; |
echo include($this->fdd[$k]['php']); |
| echo ' mce_'.$mce_tag.'=true '; |
|
| }; |
|
| // mce mod end |
|
| echo '>',htmlspecialchars($row["qf$k"]),'</textarea>',"\n"; |
|
| } else { |
} else { |
| $size_ml_props = ''; |
$len_props = ''; |
| $maxlen = intval($this->fdd[$k]['maxlen']); |
$maxlen = intval($this->fdd[$k]['maxlen']); |
| $size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60); |
$size = isset($this->fdd[$k]['size']) ? $this->fdd[$k]['size'] : min($maxlen, 60); |
| $size && $size_ml_props .= ' size="'.$size.'"'; |
if ($size > 0) { |
| $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"'; |
$len_props .= ' size="'.$size.'"'; |
| echo '<input class="',$css_class_name,'" type="text" '; |
} |
| echo ($this->readonly($k) ? 'disabled ' : ''); |
if ($maxlen > 0) { |
| /* calendar mod start */ |
$len_props .= ' maxlength="'.$maxlen.'"'; |
| |
} |
| |
echo '<input class="',$css_class_name,'" type="text"'; |
| |
echo ($this->readonly($k) ? ' disabled' : ''); |
| |
/* mce_cal mod start */ |
| echo ' id="',$this->dhtml['prefix'].'fld_'.$this->fds[$k],'"'; |
echo ' id="',$this->dhtml['prefix'].'fld_'.$this->fds[$k],'"'; |
| /* calendar mod end */ |
/* mce_cal mod end */ |
| echo 'name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="'; |
echo ' name="',$this->cgi['prefix']['data'].$this->fds[$k],'" value="'; |
| echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,'>',"\n"; |
if($escape) echo htmlspecialchars($row["qf$k"]); |
| /* calendar mod start */ |
else echo $row["qf$k"]; |
| |
echo '"',$len_props,' />',"\n"; |
| |
/* mce_cal mod start */ |
| /* Call calPopup helper function */ |
/* Call calPopup helper function */ |
| $this->calPopup_helper($k, htmlspecialchars($row["qf$k"])); |
$this->calPopup_helper($k, htmlspecialchars($row["qf$k"])); |
| /* calendar mod end */ |
/* mce_cal mod end */ |
| } |
} |
| echo '</td>',"\n"; |
echo '</td>',"\n"; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| function form_end() /* {{{ */ |
function form_end() /* {{{ */ |
| { |
{ |
| if ($this->display['form']) { |
if ($this->display['form']) { |
| echo '</form>',"\n"; |
echo '</form>',"\n"; |
| |
|
| /* calendar mod start */ |
/* mce_cal mod start */ |
| |
|
| /* Add script calls to the end of the form for all fields |
/* Add script calls to the end of the form for all fields |
| with calendar popups. */ |
with calendar popups. */ |
| Riadok 500 class phpMyEdit_mce_cal extends phpMyEdi |
|
| Riadok 520 class phpMyEdit_mce_cal extends phpMyEdi |
|
| echo '// -->',"\n"; |
echo '// -->',"\n"; |
| echo '</script>',"\n"; |
echo '</script>',"\n"; |
| }; |
}; |
| /* calendar mod end */ |
/* mce_cal mod end */ |
| }; |
}; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| } |
} |
| |
|
| ?> |
?> |