[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/Form/Action/ -> updatefield.php (source)

   1  <?php
   2  /**
   3   * Horde_Form_Action_updatefield is a Horde_Form_Action that updates
   4   * the value of one Horde_Form variable as the variable the action is
   5   * attached to is updated.
   6   *
   7   * $Horde: framework/Form/Form/Action/updatefield.php,v 1.5.12.4 2006/01/01 21:28:17 jan Exp $
   8   *
   9   * Copyright 2002-2006 Chuck Hagenbuch <chuck@horde.org>
  10   *
  11   * See the enclosed file COPYING for license information (LGPL). If you
  12   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  13   *
  14   * @author  Chuck Hagenbuch <chuck@horde.org>
  15   * @package Horde_Form
  16   */
  17  class Horde_Form_Action_updatefield extends Horde_Form_Action {
  18  
  19      var $_trigger = array('onchange', 'onload', 'onkeyup');
  20  
  21      function getActionScript(&$form, &$renderer, $varname)
  22      {
  23          return 'updateField' . $this->id() . '();';
  24      }
  25  
  26      function setValues(&$vars, $sourceVal, $arrayVal = false)
  27      {
  28      }
  29  
  30      function printJavaScript()
  31      {
  32          $this->_printJavaScriptStart();
  33          $pieces = explode('%s', $this->_params['format']);
  34          $fields = $this->_params['fields'];
  35          $val_first = (substr($this->_params['format'], 0, 2) == '%s');
  36          if ($val_first) {
  37              array_shift($pieces);
  38          }
  39          if (substr($this->_params['format'], -2) == '%s') {
  40              array_pop($pieces);
  41          }
  42  
  43          $args = array();
  44          if ($val_first) {
  45              $args[] = "document.getElementById('" . array_shift($fields) . "').value";
  46          }
  47          while (count($pieces)) {
  48              $args[] = "'" . array_shift($pieces) . "'";
  49              $args[] = "document.getElementById('" . array_shift($fields) . "').value";
  50          }
  51  ?>
  52  // Updater for <?php echo $this->getTarget() ?>.
  53  function updateField<?php echo $this->id() ?>()
  54  {
  55      var target = document.getElementById('<?php echo $this->getTarget() ?>');
  56      if (target) {
  57          target.value = <?php echo implode(' + ', str_replace("\n", "\\n", $args)) ?>;
  58      }
  59  }<?php
  60          $this->_printJavaScriptEnd();
  61      }
  62  
  63  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7