SF Bug #3003777 - Multivalue attributes with hundred of values hangs on modify

This commit is contained in:
Deon George 2011-04-29 00:19:53 +10:00
parent c23db377c2
commit 2ea1fc6314
2 changed files with 8 additions and 18 deletions

View File

@ -71,15 +71,16 @@ if (count($request['template']->getLDAPmodify(true))) {
if (! $attribute->getOldValues())
printf('<span style="color: green">[%s]</span>',_('attribute doesnt exist'));
$dv = $attribute->getRemovedValues();
foreach ($attribute->getOldValues() as $key => $value) {
# For multiple values, we'll highlight the changed ones
if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues()))
if ($x = ((count($attribute->getOldValues()) > 5) && count($attribute->getValues()) && in_array($value,$dv)))
echo '<span style="color:#880000; background:#FFFFA0">';
$request['page']->draw('OldValue',$attribute,$key);
# For multiple values, close the highlighting
if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues()))
if ($x)
echo '</span>';
echo '<br />';
@ -93,15 +94,16 @@ if (count($request['template']->getLDAPmodify(true))) {
if (! $attribute->getValueCount() || $attribute->isForceDelete())
printf('<span style="color: red">[%s]</span>',_('attribute deleted'));
$dv = $attribute->getAddedValues();
foreach ($attribute->getValues() as $key => $value) {
# For multiple values, we'll highlight the changed ones
if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues()))
if ($x = ((count($attribute->getValues()) > 5) && count($attribute->getOldValues()) && in_array($value,$dv)))
echo '<span style="color:#004400; background:#FFFFA0">';
$request['page']->draw('CurrentValue',$attribute,$key);
# For multiple values, close the highlighting
if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues()))
if ($x)
echo '</span>';
echo '<br />';

View File

@ -838,13 +838,7 @@ class Attribute {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array();
foreach ($this->getOldValues() as $value)
if (! in_array($value,$this->getValues()))
array_push($return,$value);
return $return;
return array_diff($this->getOldValues(),$this->getValues());
}
/**
@ -854,13 +848,7 @@ class Attribute {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array();
foreach ($this->getValues() as $value)
if (! in_array($value,$this->getOldValues()))
array_push($return,$value);
return $return;
return array_diff($this->getValues(),$this->getOldValues());
}
/**