From 6cabb4d37f11aac4ef8502a9a6dfb5e1708b17a9 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 27 Aug 2014 14:38:03 +0000 Subject: [PATCH] reintroduced old list-no-subs preferences as "Show sub-entries" with options "Always", "Only if there is a filter", "Only while searching" --- infolog/inc/class.infolog_hooks.inc.php | 14 +++++++++++ infolog/inc/class.infolog_so.inc.php | 4 +++- infolog/inc/class.infolog_ui.inc.php | 32 ++++++++++++++++++++++++- infolog/lang/egw_de.lang | 5 +++- infolog/lang/egw_en.lang | 5 +++- 5 files changed, 56 insertions(+), 4 deletions(-) diff --git a/infolog/inc/class.infolog_hooks.inc.php b/infolog/inc/class.infolog_hooks.inc.php index d47d3d3a73..464ae3dd83 100644 --- a/infolog/inc/class.infolog_hooks.inc.php +++ b/infolog/inc/class.infolog_hooks.inc.php @@ -227,6 +227,20 @@ class infolog_hooks 'admin' => False, 'default'=> '1', // Yes ), + 'listNoSubs' => array( + 'type' => 'select', + 'label' => 'Show sub-entries', + 'name' => 'listNoSubs', + 'values' => array( + '0' => lang('Always show them'), + 'filter' => lang('Only show them if there is a filter'), + '1' => lang('Only show them while searching'), + ), + 'help' => 'Should InfoLog show Subtasks, -calls or -notes in the normal view or not. You can always view the Subs via there parent.', + 'xmlrpc' => True, + 'admin' => False, + 'default'=> '0', // Allways show them + ), 'show_links' => array( 'type' => 'select', 'label' => 'Show in the InfoLog list', diff --git a/infolog/inc/class.infolog_so.inc.php b/infolog/inc/class.infolog_so.inc.php index 9418af50e9..0560b3b1ee 100644 --- a/infolog/inc/class.infolog_so.inc.php +++ b/infolog/inc/class.infolog_so.inc.php @@ -838,7 +838,9 @@ class infolog_so } $pid = 'AND ' . $this->db->expression($this->info_table,array('info_id_parent' => ($action == 'sp' ?$query['action_id'] : 0))); - if ($action != 'sp' || isset($query['subs']) && $query['subs'] || $action != 'sp' && !empty($query['search'])) + if ($GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] != '1' && $action != 'sp' || + (string)$query['col_filter']['info_id_parent'] !== '' || + isset($query['subs']) && $query['subs'] || $action != 'sp' && !empty($query['search'])) { $pid = ''; } diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 1ee93e91ea..f5929b4b92 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -267,6 +267,27 @@ class infolog_ui return $info; } + /** + * Check if no filter is active + * + * @param array $query + * @return string name of 1. filter found or null + */ + protected static function filter(array $query) + { + $filter = $query['filter'] ? 'filter' : ($query['cat_id'] ? 'cat_id' : null); + foreach((array)$query['col_filter'] as $name => $value) + { + if ((string)$value !== '') + { + $filter = $name; + break; + } + } + //error_log(__METHOD__."(col_filter=".array2string($query['col_filter']).") returning ".array2string($filter)); + return $filter; + } + /** * Callback for nextmatch widget * @@ -281,7 +302,16 @@ class infolog_ui if (!$query['csv_export']) { unset($query['no_actions']); - $parent_id = (int)$query['col_filter']['parent_id']; + if (!$query['col_filter']['parent_id'] && !$query['search'] && + ($this->prefs['listNoSubs'] == '1' || $this->prefs['listNoSubs'] === 'filter' && !self::filter($query))) + { + $parent_id = 0; + } + else + { + $parent_id = $query['col_filter']['parent_id']; + } + //error_log(__METHOD__."() prefs[listNoSubs]=".array2string($this->prefs['listNoSubs'])." --> parent_id=$parent_id"); unset($query['col_filter']['parent_id']); if(!$query['action']) { diff --git a/infolog/lang/egw_de.lang b/infolog/lang/egw_de.lang index b9bed07a07..7ad017c679 100644 --- a/infolog/lang/egw_de.lang +++ b/infolog/lang/egw_de.lang @@ -54,6 +54,7 @@ all other %1 fields are valid infolog de Alle anderen %1 Felder sind gültig all projects infolog de Alle Projekte allows to set the status of an entry, eg. set a todo to done if it's finished (values depend on entry-typ) infolog de erlaubt den Status eines Eintrags zu setzen, z.B. eine Aufgabe auf erledigt wenn sie beendet ist (Werte hängen vom Type des Eintrags ab) alternatives infolog de Alternativen +always show them infolog de Immer anzeigen application mail expected but got: %1 infolog de Mail-Applikation erwartet aber %1 erhalten apply the action on the whole query, not only the shown entries!!! infolog de Wendet den Befehl auf die gesamte Abfrage an, NICHT nur auf die angezeigten Datensätze !! apply the changes infolog de Übernimmt die Änderungen @@ -270,7 +271,6 @@ links infolog de Verknüpfungen links and attached files infolog de Verknüpfungen und Dateianhänge links of this entry infolog de Verknüpfungen dieses Eintrags list all categories infolog de Alle Kategorien anzeigen -list no subs/childs infolog de Untereinträge nicht anzeigen list of files linked to the current record infolog de Liste der Dateien die mit dem aktuellen Datensatz verknüpft sind load custom fields in index, if filtered by selected types (eg. to display them in a type-specific index template) infolog de Benutzerdefinierte Felder in Liste laden, wenn nach einem der folgenden InfoLog Typen gefiltert wird (z. B. für ein type-spezifisches Listen-Template) location infolog de Ort @@ -312,6 +312,8 @@ one day in advance infolog de am Vortag ongoing infolog de in Arbeit only for details infolog de Nur bei Details only if i get assigned or removed infolog de Nur wenn ich zugewiesen oder entfernt werde +only show them if there is a filter infolog de Nur anzeigen wenn gefiltert wird +only show them while searching infolog de Nur bei einer Suche anzeigen only the attachments infolog de nur die Anhänge only the links infolog de nur die Verknüpfungen open and upcoming infolog de zukünftige und offene @@ -428,6 +430,7 @@ show full usernames infolog de Kompletten Benutzernamen anzeigen show in the infolog list infolog de In der InfoLog Liste anzeigen show last modified infolog de Zuletzt geändert anzeigen show status and percent done separate infolog de Status und Prozent erledigt separat anzeigen +show sub-entries infolog de Untereinträge anzeigen show ticket id infolog de Ticketnummer anzeigen show times infolog de Zeiten anzeigen small view infolog de schmale Ansicht diff --git a/infolog/lang/egw_en.lang b/infolog/lang/egw_en.lang index 4aa7e78d13..1cc620454a 100644 --- a/infolog/lang/egw_en.lang +++ b/infolog/lang/egw_en.lang @@ -54,6 +54,7 @@ all other %1 fields are valid infolog en All other %1 fields are valid all projects infolog en All projects allows to set the status of an entry, eg. set a todo to done if it's finished (values depend on entry-typ) infolog en Allows to set the status of an entry, e.g. set a ToDo to done if it's finished. Values depend on entry type. alternatives infolog en Alternatives +always show them infolog en Always show them application mail expected but got: %1 infolog en Application mail expected but got: %1 apply the action on the whole query, not only the shown entries!!! infolog en Apply the action on the whole query, NOT only the shown entries!!! apply the changes infolog en Apply the changes @@ -279,7 +280,6 @@ links of this entry infolog en Links of this entry links to specified application. example: {{links/infolog}} infolog en Links to specified application. Example: {{links/infolog}} links wrapped in an href tag with download link infolog en Links wrapped in an HREF tag with download link list all categories infolog en List all categories -list no subs/childs infolog en List no subs/childs list of files linked to the current record infolog en List of files linked to the current record load custom fields in index, if filtered by selected types (eg. to display them in a type-specific index template) infolog en Load custom fields in index, if filtered by selected types (eg. to display them in a type-specific index template) location infolog en Location @@ -322,6 +322,8 @@ one day in advance infolog en One day in advance ongoing infolog en Ongoing only for details infolog en Only for details only if i get assigned or removed infolog en Only if I get assigned or removed +only show them if there is a filter infolog en Only show them if there is a filter +only show them while searching infolog en Only show them while searching only the attachments infolog en Only the attachments only the links infolog en Only the links open and upcoming infolog en Open and upcoming @@ -438,6 +440,7 @@ show full usernames infolog en Show full user names show in the infolog list infolog en Show in the InfoLog list show last modified infolog en Show last modified show status and percent done separate infolog en Show status and percent done separate +show sub-entries infolog en Show sub-entries show ticket id infolog en Show ticket ID show times infolog en Show times small view infolog en Small view