Commit b1a60df4 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3466 / Input Typeahead: optional only allow specified input

Implementation started - code is broken
parent eec448c0
......@@ -399,6 +399,7 @@ const MODE_DB_NO_LOG = 'noLog';
// PHP class Typeahead
const TYPEAHEAD_API_QUERY = 'query'; // Name of parameter in API call of typeahead.php?query=...&s=... - See also FE_TYPE_AHEAD_SQL
const TYPEAHEAD_API_PREFETCH = 'prefetch'; // Name of parameter in API call of typeahead.php?prefetch=...&s=... - See also FE_TYPE_AHEAD_SQL
const TYPEAHEAD_API_SIP = 'sip'; // Name of parameter in API call of typeahead.php?query=...&s=...
const TYPEAHEAD_DEFAULT_LIMIT = 20;
const TYPEAHEAD_SQL_KEY_NAME = 'id';
......
......@@ -34,11 +34,12 @@ class TypeAhead {
*/
public function __construct($phpUnit = false) {
if (!isset($_GET[TYPEAHEAD_API_QUERY]) || !isset($_GET[TYPEAHEAD_API_SIP])) {
throw new CodeException('Missing GET parameter "' . TYPEAHEAD_API_SIP . '" or "' . TYPEAHEAD_API_QUERY . '"');
if ((!isset($_GET[TYPEAHEAD_API_QUERY]) && !isset($_GET[TYPEAHEAD_API_PREFETCH])) || !isset($_GET[TYPEAHEAD_API_SIP])) {
throw new CodeException('Missing GET parameter "' . TYPEAHEAD_API_SIP . '" or "' . TYPEAHEAD_API_QUERY . '" or "' . TYPEAHEAD_API_PREFETCH . '"');
}
$this->vars[TYPEAHEAD_API_QUERY] = $_GET[TYPEAHEAD_API_QUERY];
$this->vars[TYPEAHEAD_API_QUERY] = isset($_GET[TYPEAHEAD_API_QUERY]) ? $_GET[TYPEAHEAD_API_QUERY] : '';
$this->vars[TYPEAHEAD_API_PREFETCH] = isset($_GET[TYPEAHEAD_API_PREFETCH]) ? $_GET[TYPEAHEAD_API_PREFETCH] : '';
$this->vars[TYPEAHEAD_API_SIP] = $_GET[TYPEAHEAD_API_SIP];
$session = Session::getInstance($phpUnit);
......@@ -66,6 +67,7 @@ class TypeAhead {
$arr = $this->typeAheadSql($sipVars, $this->vars[TYPEAHEAD_API_QUERY]);
} elseif (isset($sipVars[FE_LDAP_SERVER])) {
$ldap = new Ldap();
//TODO hier weiter machen mit Implementierung PREFETCH
$arr = $ldap->process($sipVars, $this->vars[TYPEAHEAD_API_QUERY]);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment