Author: Michael Slusarz (slusarz@horde.org)
Inheritance: extends Horde_Core_Ajax_Imple
Esempio n. 1
0
 /**
  * Return the encode list of options.
  *
  * @return array  Options list.
  */
 protected function _getOpts(Horde_Core_Ajax_Imple_AutoCompleter $ac)
 {
     $opts = array();
     if (!isset($this->params['indicator'])) {
         $this->params['indicator'] = $ac->getDomId() . '_loading_img';
     }
     foreach ($this->params as $key => $val) {
         $opts[] = $key . ':' . (in_array($key, $this->_raw) ? $val : Horde_Serialize::serialize($val, Horde_Serialize::JSON));
     }
     return $opts;
 }
Esempio n. 2
0
 /**
  */
 public function generate(Horde_Core_Ajax_Imple_AutoCompleter $ac)
 {
     $dom_id = $ac->getDomId();
     if (!isset($this->params['trigger'])) {
         $this->params['trigger'] = $dom_id;
     }
     if (!isset($this->params['uri'])) {
         $this->params['uri'] = strval($ac->getImpleUrl()->setRaw(true));
     }
     return 'new PrettyAutocompleter(' . Horde_Serialize::serialize($dom_id, Horde_Serialize::JSON) . ',' . '{' . implode(',', $this->_getOpts($ac)) . '})';
 }
Esempio n. 3
0
 /**
  */
 public function generate(Horde_Core_Ajax_Imple_AutoCompleter $ac)
 {
     $dom_id = $ac->getDomId();
     if (!isset($this->params['trigger'])) {
         $this->params['trigger'] = $dom_id;
     }
     if (!isset($this->params['uri'])) {
         $this->params['uri'] = strval($ac->getImpleUrl()->add(array('input' => $this->params['trigger']))->setRaw(true));
     }
     return 'new IMP_PrettyAutocompleter(' . json_encode($dom_id) . ',' . '{' . implode(',', $this->_getOpts($ac)) . '})';
 }
Esempio n. 4
0
 /**
  */
 protected function _attach($init)
 {
     global $page_output;
     if (!self::$_initAc) {
         $page_output->addScriptPackage('Horde_Core_Script_Package_Autocomplete');
         $page_output->addInlineJsVars(array('HordeImple.AutoCompleter' => new stdClass()));
         self::$_initAc = true;
     }
     $page_output->addInlineScript(array('HordeImple.AutoCompleter["' . $this->getDomId() . '"]=' . $this->_getAutoCompleter()->generate($this)), true);
     return false;
 }
Esempio n. 5
0
 /**
  */
 public function generate(Horde_Core_Ajax_Imple_AutoCompleter $ac)
 {
     $dom_id = $ac->getDomId();
     return 'new Autocompleter.Local(' . Horde_Serialize::serialize($dom_id, Horde_Serialize::JSON) . ',' . (is_string($this->_search) ? $this->_search : Horde_Serialize::serialize($this->_search, Horde_Serialize::JSON)) . ',' . '{' . implode(',', $this->_getOpts($ac)) . '})';
 }