- Add setting to select-cat to display missing IDs as Missing: #

- Use select-cat setting in historylog widget to display something for deleted categories
This commit is contained in:
Nathan Gray 2011-02-18 18:27:01 +00:00
parent 1280527169
commit 99df873aa3
2 changed files with 16 additions and 3 deletions

View File

@ -74,6 +74,12 @@ class historylog_widget
{
list($type,$options) = explode(':',$type,2);
}
// For all select-cats, show missing entries as IDs
if($type == 'select-cat') {
list($rows,$type1,$type2,$type3,$type4,$type5,$type6) = explode(',',(array)$options);
$type6 = true;
$options = implode(',',array($rows,$type1,$type2,$type3,$type4,$type5,$type6));
}
$cell = etemplate::empty_cell($type,$cell['name'],array('readonly' => true,'size' => $options));
if (is_array($type))
{

View File

@ -102,7 +102,7 @@ class select_widget
*/
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
{
list($rows,$type,$type2,$type3,$type4,$type5) = explode(',',$cell['size']);
list($rows,$type,$type2,$type3,$type4,$type5,$type6) = explode(',',$cell['size']);
$extension_data['type'] = $cell['type'];
@ -168,7 +168,7 @@ class select_widget
$cell['no_lang'] = True;
break;
case 'select-cat': // !$type == globals cats too, $type2: extraStyleMultiselect, $type3: application, if not current-app, $type4: parent-id, $type5=owner (-1=global)
case 'select-cat': // !$type == globals cats too, $type2: extraStyleMultiselect, $type3: application, if not current-app, $type4: parent-id, $type5=owner (-1=global),$type6=show missing
if ($readonly) // for readonly we dont need to fetch all cat's, nor do we need to indent them by level
{
$cell['no_lang'] = True;
@ -183,7 +183,14 @@ class select_widget
}
else
{
unset($value[$key]); // remove not (longer) existing or inaccessible cats
if(!$type6)
{
unset($value[$key]); // remove not (longer) existing or inaccessible cats
}
elseif ($id) // Display id of no longer existing cat
{
$cell['sel_options'][$id] = lang('Missing: %1',$id);
}
}
}
}