mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Closes #316
This commit is contained in:
@@ -605,9 +605,6 @@ class page_admin_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
new page_admin();
|
new page_admin();
|
||||||
require_once('auth.php');
|
require_once('auth.php');
|
||||||
|
|
||||||
|
@@ -521,7 +521,8 @@ class links_model_admin_tree extends e_admin_tree_model
|
|||||||
$src[$id] = $model;
|
$src[$id] = $model;
|
||||||
if($modified)
|
if($modified)
|
||||||
{
|
{
|
||||||
$model->set('link_name', $level_image.$this->bcClean($model->get('link_name')));
|
$model->set('link_name', $this->bcClean($model->get('link_name')))
|
||||||
|
->set('link_indent', $level_image);
|
||||||
}
|
}
|
||||||
$this->_tree_order($id, $search, $src, $level + 1, $modified);
|
$this->_tree_order($id, $search, $src, $level + 1, $modified);
|
||||||
}
|
}
|
||||||
@@ -676,6 +677,27 @@ class links_admin_form_ui extends e_admin_form_ui
|
|||||||
return in_array($parent_id, $path);
|
return in_array($parent_id, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New core feature - triggered before values are rendered
|
||||||
|
*/
|
||||||
|
function renderValueTrigger(&$field, &$value, &$params, $id)
|
||||||
|
{
|
||||||
|
if($field !== 'link_name') return;
|
||||||
|
$tree = $this->getController()->getTreeModel();
|
||||||
|
// notify we need modified tree
|
||||||
|
$tree->modify = true;
|
||||||
|
|
||||||
|
//retrieve array of data models
|
||||||
|
$data = $tree->getTree();
|
||||||
|
// retrieve the propper model by id
|
||||||
|
$model = varset($data[$id]);
|
||||||
|
|
||||||
|
if(!$model) return;
|
||||||
|
|
||||||
|
// Add indent as 'pre' parameter
|
||||||
|
$params['pre'] = $model->get('link_indent');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override Create list view
|
* Override Create list view
|
||||||
*
|
*
|
||||||
|
@@ -2263,6 +2263,8 @@ class e_form
|
|||||||
if(vartrue($attributes['inline'])) $parms['editable'] = true; // attribute alias
|
if(vartrue($attributes['inline'])) $parms['editable'] = true; // attribute alias
|
||||||
if(vartrue($attributes['sort'])) $parms['sort'] = true; // attribute alias
|
if(vartrue($attributes['sort'])) $parms['sort'] = true; // attribute alias
|
||||||
|
|
||||||
|
$this->renderValueTrigger($field, $value, $parms, $id);
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
switch($field) // special fields
|
switch($field) // special fields
|
||||||
{
|
{
|
||||||
@@ -2831,7 +2833,7 @@ class e_form
|
|||||||
* #param array (under construction) $required_data required array as defined in e_model/validator
|
* #param array (under construction) $required_data required array as defined in e_model/validator
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function renderElement($key, $value, $attributes, $required_data = array())
|
function renderElement($key, $value, $attributes, $required_data = array(), $id = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$parms = vartrue($attributes['writeParms'], array());
|
$parms = vartrue($attributes['writeParms'], array());
|
||||||
@@ -2881,6 +2883,8 @@ class e_form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->renderElementTrigger($key, $value, $parms, $required_data, $id);
|
||||||
|
|
||||||
switch($attributes['type'])
|
switch($attributes['type'])
|
||||||
{
|
{
|
||||||
case 'number':
|
case 'number':
|
||||||
@@ -3512,7 +3516,7 @@ class e_form
|
|||||||
".$required."<span{$required_class}>".defset(vartrue($att['title']), vartrue($att['title']))."</span>".$label."
|
".$required."<span{$required_class}>".defset(vartrue($att['title']), vartrue($att['title']))."</span>".$label."
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
".$this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()))."
|
".$this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()), $model->getId())."
|
||||||
{$help}
|
{$help}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -3684,7 +3688,7 @@ class e_form
|
|||||||
|
|
||||||
if(!vartrue($tmp['show']))
|
if(!vartrue($tmp['show']))
|
||||||
{
|
{
|
||||||
$hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()));
|
$hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()), $model->getId());
|
||||||
unset($tmp);
|
unset($tmp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3965,105 +3969,30 @@ class e_form
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The 2 functions below are for demonstration purposes only, and may be moved/modified before release.
|
|
||||||
/*
|
|
||||||
function filterType($fieldarray)
|
|
||||||
{
|
|
||||||
return " frm-> filterType() is Deprecated ";
|
|
||||||
}
|
|
||||||
|
|
||||||
function filterValue($type = '', $fields = '')
|
|
||||||
{
|
|
||||||
return " frm-> filterValue() is Deprecated. ";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED!!! Use e_admin_form_ui::renderBatch()
|
* Render Value Trigger - override to modify field/value/parameters
|
||||||
* Generates a batch options select component
|
* @param string $field field name
|
||||||
* This component is generally associated with a table of items where one or more rows in the table can be selected (using checkboxes).
|
* @param mixed $value field value
|
||||||
* The list options determine some processing that wil lbe applied to all checked rows when the form is submitted.
|
* @param array $params 'writeParams' key (see $controller->fields array)
|
||||||
*
|
* @param int $id record ID
|
||||||
* @param array $options associative array of option elements, keyed on the option value
|
|
||||||
* @param array ucOptions [optional] associative array of userclass option groups to display, keyed on the option value prefix
|
|
||||||
* @return string the HTML for the form component
|
|
||||||
*/
|
*/
|
||||||
/*
|
public function renderValueTrigger(&$field, &$value, &$params, $id)
|
||||||
function batchoptions($options, $ucOptions = null)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$text = "
|
|
||||||
<div class='f-left btn-group'>
|
|
||||||
<img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' />
|
|
||||||
".$this->select_open('execute_batch', array('class' => 'tbox select batch e-autosubmit', 'id' => false))."
|
|
||||||
".$this->option('With selected...', '', true, 'hellodisabled')."
|
|
||||||
";
|
|
||||||
|
|
||||||
|
|
||||||
//used for getperms() check
|
|
||||||
$permissions = vartrue($options['__permissions'], array());
|
|
||||||
//used for check_classs() check
|
|
||||||
$classes = vartrue($options['__check_class'], array());
|
|
||||||
unset($options['__permissions'], $options['__check_class']);
|
|
||||||
|
|
||||||
foreach ($options as $key => $val)
|
|
||||||
{
|
|
||||||
if(isset($permissions[$key]) && !getperms($permissions[$key]))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$disabled = false;
|
|
||||||
if(isset($classes[$key]) && !is_array($classes[$key]) && !check_class($classes[$key]))
|
|
||||||
{
|
|
||||||
$disabled = true;
|
|
||||||
}
|
|
||||||
if(!is_array($val))
|
|
||||||
{
|
|
||||||
if($disabled) $val = $val.' ('.LAN_NOPERMISSION.')';
|
|
||||||
$text .= "\t".$this->option(' '.$val, $key, false, array('disabled' => $disabled))."\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if($disabled) $val[0] = $val[0].' ('.LAN_NOPERMISSION.')';
|
|
||||||
|
|
||||||
$text .= "\t".$this->optgroup_open($val[0], $disabled)."\n";
|
|
||||||
foreach ($val[1] as $k => $v)
|
|
||||||
{
|
|
||||||
$disabled = false;
|
|
||||||
if(isset($classes[$key][$k]) && !check_class($classes[$key][$k]))
|
|
||||||
{
|
|
||||||
$disabled = true;
|
|
||||||
$v = $v.' ('.LAN_NOPERMISSION.')';
|
|
||||||
}
|
|
||||||
$text .= "\t\t".$this->option($v, $key.'_selected_'.$k, false, array('disabled' => $disabled))."\n";
|
|
||||||
}
|
|
||||||
$text .= $this->optgroup_close()."\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
if ($ucOptions) // Userclass List.
|
* Render Element Trigger - override to modify field/value/parameters/validation data
|
||||||
{
|
* @param string $field field name
|
||||||
foreach ($ucOptions as $ucKey => $ucVal)
|
* @param mixed $value field value
|
||||||
{
|
* @param array $params 'writeParams' key (see $controller->fields array)
|
||||||
$text .= "\t".$this->optgroup_open($ucVal[0])."\n";
|
* @param array $required_data validation data
|
||||||
foreach ($ucVal[1] as $key => $val)
|
* @param int $id record ID
|
||||||
{
|
|
||||||
$text .= "\t\t".$this->option($val['userclass_name']['userclass_name'], $ucKey.'_selected_'.$val['userclass_name']['userclass_id'])."\n";
|
|
||||||
}
|
|
||||||
$text .= $this->optgroup_close()."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
".$this->select_close().$this->admin_button('trigger_execute_batch', 'trigger_execute_batch', 'submit multi e-hide-if-js', 'Go')."
|
|
||||||
</div><div class='clear'></div>
|
|
||||||
";
|
|
||||||
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
public function renderElementTrigger(&$field, &$value, &$params, &$required_data, $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class form
|
class form
|
||||||
|
Reference in New Issue
Block a user