/usr/share/php/Horde/Form/Action/updatefield.php is in php-horde-form 2.0.12-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | <?php
/**
* Horde_Form_Action_updatefield is a Horde_Form_Action that updates
* the value of one Horde_Form variable as the variable the action is
* attached to is updated.
*
* Copyright 2002-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @package Form
*/
class Horde_Form_Action_updatefield extends Horde_Form_Action {
var $_trigger = array('onchange', 'onload', 'onkeyup');
function getActionScript(&$form, &$renderer, $varname)
{
return 'updateField' . $this->id() . '();';
}
function setValues(&$vars, $sourceVal, $arrayVal = false)
{
}
function printJavaScript()
{
$pieces = explode('%s', $this->_params['format']);
$fields = $this->_params['fields'];
$val_first = (substr($this->_params['format'], 0, 2) == '%s');
if ($val_first) {
array_shift($pieces);
}
if (substr($this->_params['format'], -2) == '%s') {
array_pop($pieces);
}
$args = array();
if ($val_first) {
$args[] = "document.getElementById('" . array_shift($fields) . "').value";
}
while (count($pieces)) {
$args[] = "'" . array_shift($pieces) . "'";
$args[] = "document.getElementById('" . array_shift($fields) . "').value";
}
Horde::startBuffer();
?>
// Updater for <?php echo $this->getTarget() ?>.
function updateField<?php echo $this->id() ?>()
{
var target = document.getElementById('<?php echo $this->getTarget() ?>');
if (target) {
target.value = (<?php echo implode(' + ', str_replace("\n", "\\n", $args)) ?>).replace(/(^ +| +$)/, '').replace(/ +/g, ' ');
}
}<?php
$GLOBALS['injector']->getInstance('Horde_PageOutput')
->addInlineScript(Horde::endBuffer());
}
}
|