From 99df873aa3fd9138932e287dc5d11bac87e0b0f7 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 18 Feb 2011 18:27:01 +0000 Subject: [PATCH] - Add setting to select-cat to display missing IDs as Missing: # - Use select-cat setting in historylog widget to display something for deleted categories --- etemplate/inc/class.historylog_widget.inc.php | 6 ++++++ etemplate/inc/class.select_widget.inc.php | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/etemplate/inc/class.historylog_widget.inc.php b/etemplate/inc/class.historylog_widget.inc.php index 0a63d3571f..94be71de71 100644 --- a/etemplate/inc/class.historylog_widget.inc.php +++ b/etemplate/inc/class.historylog_widget.inc.php @@ -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)) { diff --git a/etemplate/inc/class.select_widget.inc.php b/etemplate/inc/class.select_widget.inc.php index 44227160be..82c3fd771a 100644 --- a/etemplate/inc/class.select_widget.inc.php +++ b/etemplate/inc/class.select_widget.inc.php @@ -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); + } } } }