* eTemplate/all apps: removed custom-field widget type IP again, as it caused too many problems in various modules

This commit is contained in:
Ralf Becker 2014-04-08 11:52:12 +00:00
parent 3a324a2308
commit 8a529cc4af
4 changed files with 16 additions and 34 deletions

View File

@ -647,17 +647,13 @@ class boetemplate extends soetemplate
*/
static function &get_array(&$arr,$idx,$reference_into=False,$skip_empty=False)
{
// return content of $arr itself (but no reference!) in all error-cases: $arr no array or $idx an object
if (is_object($idx) || !is_array($arr))
if (!is_array($arr))
{
$ret = $arr;
return $ret;
throw new egw_exception_assertion_failed(__METHOD__."(\$arr,'$idx',$reference_into,$skip_empty) \$arr is no array!");
}
if ((string)$idx === '')
{
$idxs = array();
}
elseif (count($idxs = explode('[', $idx, 2)) > 1)
if (is_object($idx)) return false; // given an error in php5.2
if (count($idxs = explode('[', $idx, 2)) > 1)
{
$idxs = array_merge(array($idxs[0]), explode('][', substr($idxs[1],0,-1)));
}

View File

@ -59,7 +59,6 @@ class customfields_widget
'url-email'=> 'EMail',
'url-phone'=> 'Phone number',
'htmlarea' => 'Formatted Text (HTML)',
'client-ip'=> 'IP address',
'link-entry' => 'Select entry', // should be last type, as the individual apps get added behind
);
@ -340,12 +339,6 @@ class customfields_widget
'size' => implode(',',$options)
));
break;
case 'client-ip':
if (empty($value[$this->prefix.$lname]))
{
$value[$this->prefix.$lname] = egw_session::getuser_ip();
}
// fall through
case 'text' :
case 'textarea' :
case '' : // not set

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @author Ralf Becker <RalfBecker@outdoor-training.de>
* @copyright 2002-13 by RalfBecker@outdoor-training.de
* @copyright 2002-11 by RalfBecker@outdoor-training.de
* @package etemplate
* @subpackage api
* @version $Id$
@ -386,7 +386,7 @@ class etemplate extends boetemplate
* @param string $cname=null name-prefix, which need to be ignored, default self::$name_vars
* @return boolean true if there are not ignored validation errors, false otherwise
*/
static function validation_errors($ignore_validation='',$cname=null)
function validation_errors($ignore_validation='',$cname=null)
{
if (is_null($cname)) $cname = self::$name_vars;
//echo "<p>uietemplate::validation_errors('$ignore_validation','$cname') validation_error="; _debug_array(self::$validation_errors);
@ -1081,8 +1081,9 @@ class etemplate extends boetemplate
list($name) = explode('=',$name);
}
$form_name = self::form_name($cname,$name);
$value =& $this->get_array($content,$name);
$old_value = $value; // remember value to be able to restore it
$value = $this->get_array($content,$name);
$options = '';
if ($readonly = $cell['readonly'] && $readonlys[$name] !== false || // allow to overwrite readonly settings of a cell
@$readonlys[$name] && !is_array($readonlys[$name]) || $readonlys['__ALL__'] && (!is_string($name) || $readonlys[$name] !== false) ||
@ -1294,6 +1295,8 @@ class etemplate extends boetemplate
case 'hidden':
case 'passwd':
case 'text': // size: [length][,maxLength[,preg[,html5type]]]
$autocompletion_off='';
if ($type == 'passwd') $autocompletion_off='autocomplete="off"';
$cell_opts = $c = self::csv_split($cell_options); // allows to enclose preg in quote to allow comma
// fix preg, in case it contains a comma (html5type is only letters and always last option!)
if (count($cell_opts) > 3 && ($cell_opts2 = explode(',',$cell_options)) && $cell_opts2[2][0] != '"')
@ -1313,14 +1316,9 @@ class etemplate extends boetemplate
}
else
{
if ($cell_opts[0] < 0)
{
$cell_opts[0] = abs($cell_opts[0]);
$options .= ' readonly="readonly"';
}
if ($cell_opts[0] < 0) $cell_opts[0] = abs($cell_opts[0]);
$html .= html::input($form_name,$value,$type == 'passwd' ? 'password' : ($type == 'hidden' ? 'hidden' : $cell_opts[3]),
$options.html::formatOptions($cell_opts,'SIZE,MAXLENGTH').
($cell['needed']?' required="required"':'').($type == 'passwd'?' autocomplete="off"':''));
$options.html::formatOptions($cell_opts,'SIZE,MAXLENGTH').($cell['needed']?' required="required"':'').($autocompletion_off?' '.$autocompletion_off:''));
if (!$readonly)
{
@ -1893,10 +1891,6 @@ class etemplate extends boetemplate
self::$request->unset_to_process($form_name);
self::$request->set_to_process($form_name,'ext-'.$ext_type,$to_process);
}
// restoring value, as it is a reference into content
// some widgets change it and rely on it being a reference
// using same name for multiple widgets breaks, if we dont restore it now
$value = $old_value;
// save blur-value to strip it in process_exec
if (!empty($blur) && self::$request->isset_to_process($form_name))
{

View File

@ -6,7 +6,7 @@
* @package etemplate
* @link http://www.egroupware.org
* @author RalfBecker-At-outdoor-training.de
* @copyright 2006-13 by RalfBecker-At-outdoor-training.de
* @copyright 2006-11 by RalfBecker-At-outdoor-training.de
* @license GPL - GNU General Public License
* @version $Id$
*/
@ -212,8 +212,7 @@ class historylog_widget
}
else
{
self::$status_widgets['#'.$cf_name] = !in_array($cf_data['type'], array('text', 'client-ip')) ?
$cf_data['type'] : 'label';
self::$status_widgets['#'.$cf_name] = $cf_data['type'] != 'text' ? $cf_data['type'] : 'label';
}
}
elseif($cf_data['values']['@'])