1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-29 10:38:08 +01:00

Admin-UI:Form Handler - renderTableRow() now calls a new method: renderTableCells() to generate the table cells.

This commit is contained in:
Cameron 2020-03-19 14:51:38 -07:00
parent 3cfdab25e4
commit b431e6796c
2 changed files with 54 additions and 27 deletions

View File

@ -5812,7 +5812,16 @@ class e_admin_ui extends e_admin_controller_ui
echo ADLAN_86; //Forbidden
$result = var_export($this->fields[$_name], true);
$this->logajax("Forbidden\nAction:".$this->getAction()."\nField:\n".$result);
$problem = array();
$problem['noedit'] = !empty($this->fields[$_name]['noedit']) ? 'yes' : 'no';
$problem['nolist'] = !empty($this->fields[$_name]['nolist']) ? 'yes' : 'no';
$problem['inline'] = empty($this->fields[$_name]['inline']) ? 'yes' : 'no';
$problem['token'] = empty($_token) ? 'yes' : 'no';
$problem['password'] = !password_verify(session_id(),$_token) ? 'yes' : 'no';
$result .= "\nForbidden Caused by: ".print_r($problem,true);
$this->logajax("Forbidden\nAction:".$this->getAction()."\nField (".$_name."):\n".$result);
return;
}

View File

@ -4303,19 +4303,11 @@ var_dump($select_options);*/
* @param string $pid - eg. table_id
* @return string
*/
function renderTableRow($fieldarray, $currentlist, $fieldvalues, $pid)
function renderTableCells($fieldarray, $currentlist, $fieldvalues, $pid)
{
$cnt = 0;
$ret = '';
/*$fieldarray = $obj->fields;
$currentlist = $obj->fieldpref;
$pid = $obj->pid;*/
// $trclass = vartrue($fieldvalues['__trclass']) ? ' class="'.$trclass.'"' : '';
unset($fieldvalues['__trclass']);
$trclass = '';
$text = '';
foreach ($fieldarray as $field => $data)
{
@ -4329,7 +4321,7 @@ var_dump($select_options);*/
$field = $data['alias'];
}
*/
//Not found
if((!varset($data['forced']) && !in_array($field, $currentlist)) || varset($data['nolist']))
{
@ -4337,7 +4329,7 @@ var_dump($select_options);*/
}
elseif(vartrue($data['type']) != 'method' && !$data['forced'] && !isset($fieldvalues[$field]) && $fieldvalues[$field] !== NULL)
{
$ret .= "
$text .= "
<td>
Not Found! ($field)
</td>
@ -4347,13 +4339,12 @@ var_dump($select_options);*/
}
$tdclass = vartrue($data['class']);
if($field == 'checkboxes') $tdclass = $tdclass ? $tdclass.' autocheck e-pointer' : 'autocheck e-pointer';
if($field == 'options') $tdclass = $tdclass ? $tdclass.' options' : 'options';
// there is no other way for now - prepare user data
if('user' == vartrue($data['type']) /* && isset($data['readParms']['idField'])*/)
{
@ -4376,17 +4367,17 @@ var_dump($select_options);*/
$data['readParms']['__nameval'] = $fieldvalues['user_name'];
}
}
$value = $this->renderValue($field, varset($fieldvalues[$field]), $data, varset($fieldvalues[$pid]));
$value = $this->renderValue($field, varset($fieldvalues[$field]), $data, varset($fieldvalues[$pid]));
if($tdclass)
{
$tdclass = ' class="'.$tdclass.'"';
}
$ret .= '
$text .= '
<td'.$tdclass.'>
'.$value.'
</td>
@ -4397,16 +4388,43 @@ var_dump($select_options);*/
if($cnt)
{
return '
<tr'.$trclass.' id="row-'.$fieldvalues[$pid].'">
return $text;
}
return null;
}
/**
* Render Table row and cells from field listing.
*
* @param array $fieldArray - eg. $this->fields
* @param array $fieldPref - eg $this->fieldpref
* @param array $fieldValues - eg. $row
* @param string $pid - eg. table_id
* @return string
*/
function renderTableRow($fieldArray, $fieldPref, $fieldValues, $pid)
{
if(!$ret = $this->renderTableCells($fieldArray, $fieldPref, $fieldValues, $pid))
{
return '';
}
$trclass = '';
// $trclass = vartrue($fieldvalues['__trclass']) ? ' class="'.$trclass.'"' : '';
unset($fieldValues['__trclass']);
return '
<tr'.$trclass.' id="row-' . $fieldValues[$pid].'">
'.$ret.'
</tr>
';
}
return '';
}
/**
* Inline Token
* @return string