mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 20:51:53 +02:00
Fixes #140: Sitelinks: Inline editing broken
This commit is contained in:
parent
713e401e68
commit
30d922cadf
@ -4547,7 +4547,11 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$_POST[$_name] = $_value; // set current field only
|
||||
|
||||
// generic handler - same as regular edit form submit
|
||||
$res = $this->_manageSubmit('beforeUpdate', 'afterUpdate', 'onUpdateError', 'edit');
|
||||
$this->convertToData($_POST);
|
||||
$model->setPostedData($_POST, null, false, false)
|
||||
->setParam('validateAvailable', true) // new param to control validate of available data only, reset on validate event
|
||||
->update(true);
|
||||
//$res = $this->_manageSubmit('beforeUpdate', 'afterUpdate', 'onUpdateError', 'edit');
|
||||
|
||||
if($model->hasError())
|
||||
{
|
||||
|
@ -2204,17 +2204,6 @@ class e_front_model extends e_model
|
||||
return $this;
|
||||
}
|
||||
|
||||
/* XXX - Wrong? Should validator keep track on validated data at all?
|
||||
// retrieve only valid data
|
||||
if($validate)
|
||||
{
|
||||
$data = $this->getValidator()->getValidData();
|
||||
}
|
||||
else // retrieve all posted data
|
||||
{
|
||||
$data = $this->getPostedData();
|
||||
}*/
|
||||
|
||||
$data = $this->getPostedData();
|
||||
$valid_data = $validate ? $this->getValidator()->getValidData() : array();
|
||||
|
||||
@ -2312,7 +2301,17 @@ class e_front_model extends e_model
|
||||
{
|
||||
$data = $this->getPostedData();
|
||||
}
|
||||
return $this->getValidator()->validate($data);
|
||||
|
||||
// New param to control validate process - useful when part of the data is going to be updated
|
||||
// Use it with cautious!!!
|
||||
$availableOnly = false;
|
||||
if($this->getParam('validateAvailable'))
|
||||
{
|
||||
$availableOnly = true;
|
||||
$this->setParam('validateAvailable', null); // reset it
|
||||
}
|
||||
|
||||
return $this->getValidator()->validate($data, $availableOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -295,9 +295,10 @@ class e_validator
|
||||
* Validate data
|
||||
*
|
||||
* @param array $data
|
||||
* @param boolean $availableOnly check only against available data if true
|
||||
* @return boolean
|
||||
*/
|
||||
function validate($data)
|
||||
function validate($data, $availableOnly = false)
|
||||
{
|
||||
$this->reset();
|
||||
|
||||
@ -309,9 +310,13 @@ class e_validator
|
||||
$this->_valid_data = $data;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$fieldList = $rules;
|
||||
if($availableOnly) $fieldList = array_keys($data);
|
||||
|
||||
foreach ($rules as $field_name)
|
||||
{
|
||||
if(!in_array($field_name, $fieldList)) continue;
|
||||
$value = varset($data[$field_name], null);
|
||||
$required = $this->isRequiredField($field_name);
|
||||
if(($required || $this->isOptionalField($field_name)) && !$this->validateField($field_name, $value, $required))
|
||||
|
Loading…
x
Reference in New Issue
Block a user