From 0e2e88c19b030db998d7ebec45f18c254e1aad63 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 10 Oct 2013 11:29:31 +0000 Subject: [PATCH] fixed hiearchy display in infolog and reset of subs view via clicking on InfoLog icon/header, using now value of nm[parent_id] as key for col_filter --- .../class.etemplate_widget_nextmatch.inc.php | 19 ++++++------ filemanager/inc/class.filemanager_ui.inc.php | 4 +-- filemanager/lang/egw_de.lang | 4 +-- filemanager/lang/egw_en.lang | 4 +-- infolog/inc/class.infolog_so.inc.php | 20 ++++++++----- infolog/inc/class.infolog_ui.inc.php | 30 +++++++++++-------- infolog/templates/default/app.css | 10 +------ 7 files changed, 46 insertions(+), 45 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index c672ecaa98..415c624ed7 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -39,7 +39,7 @@ * 'col_filter' => // IO array of column-name value pairs (optional for the filterheaders) * // grid requires implementation of folowing filters in get_rows, even if not used as regular filters! * // O col_filter[$row_id] to query certain rows only - * // O col_filter[parent_id] row_id of parent to query children for hierachical display + * // O col_filter[$parent_id] row_id of parent to query children for hierachical display * 'filter' => // IO filter, if not 'no_filter' => True * 'filter_no_lang' => True// I set no_lang for filter (=dont translate the options) * 'filter_onchange'=> 'this.form.submit();' // I onChange action for filter, default: this.form.submit(); @@ -59,7 +59,7 @@ * or name of import/export definition * 'row_id' => // I key into row content to set it's value as row-id, eg. 'id' * 'row_modified' => // I key into row content for modification date or state of a row, to not query it again - * 'parent_id' => // I key into row content of children linking them to their parent + * 'parent_id' => // I key into row content of children linking them to their parent, also used as col_filter to query children * 'is_parent' => // I key into row content to mark a row to have children * 'is_parent_value'=> // I if set value of is_parent, otherwise is_parent is evaluated as boolean * 'dataStorePrefix' => // I Optional prefix for client side cache to prevent collisions in applications that have more than one data set, such as ProjectManager / Project elements. Defaults to appname if not set. @@ -278,7 +278,7 @@ class etemplate_widget_nextmatch extends etemplate_widget $value = ($value) ? array($value) : array(); } $value = $value_in = array_merge($value, $filters); - + //error_log(__METHOD__."('".substr($exec_id,0,10)."...', range=".array2string($queriedRange).', filters='.array2string($filters).", '$form_name', knownUids=".array2string($knownUids).", lastModified=$lastModified) parent_id=$value[parent_id], is_parent=$value[is_parent]"); $result = array(); @@ -297,7 +297,8 @@ class etemplate_widget_nextmatch extends etemplate_widget if (($parent_id = $value['parent_id'])) { // Infolog at least wants 'parent_id' instead of $parent_id - $value['col_filter']['parent_id'] = $queriedRange['parent_id']; + $value['col_filter'][$parent_id] = $queriedRange['parent_id']; + if ($queriedRange['parent_id']) $value['csv_export'] = 'children'; } // Set current app for get_rows @@ -323,7 +324,7 @@ class etemplate_widget_nextmatch extends etemplate_widget self::$request->app_header = $GLOBALS['egw_info']['flags']['app_header']; egw_json_response::get()->apply('egw_app_header', array($GLOBALS['egw_info']['flags']['app_header'])); } - + // Check for anything changed in the query // Tell the client about the changes $request_value =& self::get_array(self::$request->content, $form_name,true); @@ -336,12 +337,12 @@ class etemplate_widget_nextmatch extends etemplate_widget continue; } if($original_value == $value[$key]) continue; - + // These keys we don't send row data back, as they cause a partial reload if(in_array($key, array('template'))) $no_rows = true; $request_value[$key] = $value[$key]; - + egw_json_response::get()->generic('assign', array( 'etemplate_exec_id' => self::$request->id(), 'id' => $form_name, @@ -350,7 +351,7 @@ class etemplate_widget_nextmatch extends etemplate_widget )); } if($no_rows) $rows = Array(); - + $row_id = isset($value['row_id']) ? $value['row_id'] : 'id'; $row_modified = $value['row_modified']; $is_parent = $value['is_parent']; @@ -434,7 +435,7 @@ class etemplate_widget_nextmatch extends etemplate_widget //foreach($result as $name => $value) if ($name != 'readonlys') error_log(__METHOD__."() result['$name']=".array2string($name == 'data' ? array_keys($value) : $value)); egw_json_response::get()->data($result); - + // If etemplate_exec_id has changed, update the client side if (($new_id = self::$request->id()) != $id) { diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index bdc0803cf8..440878e273 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -704,7 +704,7 @@ class filemanager_ui $GLOBALS['egw_info']['flags']['currentapp'] = 'projectmanager'; } // do NOT store query, if hierarchical data / children are requested - if (empty($query['col_filter']['parent_id'])) + if (!$query['csv_export']) { egw_session::appsession('index','filemanager',$query); } @@ -740,7 +740,7 @@ class filemanager_ui { $namefilter = '/'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i'; } - foreach(egw_vfs::find(!empty($query['col_filter']['parent_id']) ? $query['col_filter']['parent_id'] : $query['path'],array( + foreach(egw_vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'],array( 'mindepth' => 1, 'maxdepth' => $query['filter'] ? (int)(boolean)$query['filter'] : null, 'dirsontop' => $query['filter'] <= 1, diff --git a/filemanager/lang/egw_de.lang b/filemanager/lang/egw_de.lang index c01027bc25..2ac3da8c91 100644 --- a/filemanager/lang/egw_de.lang +++ b/filemanager/lang/egw_de.lang @@ -76,7 +76,7 @@ directory successfully created. filemanager de Verzeichnis erfolgreich angelegt. directory with documents to insert entries filemanager de Verzeichnis mit Dokumenten zum Einfügen von Daten display and modification of content filemanager de Anzeigen und Verändern des Inhaltes display of content filemanager de Anzeigen des Inhaltes -do you want to overwrite existing file %1 in directory %2? filemanager de Wollen Sie die bestehende Datei %1 im Verzeichnis %2 überschreiben? +do you want to overwrite existing file %1 in directory %2? filemanager de Wollen Sie die bestehende Datei %1 im Verzeichnis %2 überschreiben? do you want to overwrite the existing file %1? filemanager de Wollen Sie die existierende Datei %1 überschreiben? download filemanager de Herunterladen edit comments filemanager de Kommentare bearbeiten @@ -104,7 +104,7 @@ favorites filemanager de Favoriten file filemanager de Datei file %1 could not be created. filemanager de Die Datei %1 konnte nicht erzeugt werden file %1 may be too big. contact your systemadministrator for further info filemanager de Die Datei %1 ist eventuell zu gross. Kontaktieren Sie Ihren Systemadministrator für weiterreichende Informationen. -file %1 already exists filemanager de Es gibt schon eine Datei %1 +file %1 already exists filemanager de Es gibt schon eine Datei %1 file deleted. filemanager de Datei gelöscht. file names cannot contain "%1" filemanager de Dateinamen dürfen "%1" nicht enthalten file or directory not found! filemanager de Datei oder Verzeichnis nicht gefunden! diff --git a/filemanager/lang/egw_en.lang b/filemanager/lang/egw_en.lang index 2a3db063c0..9089ae3fc0 100644 --- a/filemanager/lang/egw_en.lang +++ b/filemanager/lang/egw_en.lang @@ -76,7 +76,7 @@ directory successfully created. filemanager en Directory successfully created. directory with documents to insert entries filemanager en Directory with documents to insert entries display and modification of content filemanager en Display and modification of content display of content filemanager en Display of content -do you want to overwrite existing file %1 in directory %2? filemanager en Do you want to overwrite existing file %1 in directory %2? +do you want to overwrite existing file %1 in directory %2? filemanager en Do you want to overwrite existing file %1 in directory %2? do you want to overwrite the existing file %1? filemanager en Do you want to overwrite the existing file %1? download filemanager en Download edit comments filemanager en Edit comments @@ -104,7 +104,7 @@ favorites filemanager en Favorites file filemanager en File file %1 could not be created. filemanager en File %1 could not be created. file %1 may be too big. contact your systemadministrator for further info filemanager en File %1 might be too big. -file %1 already exists filemanager en File %1 already exists +file %1 already exists filemanager en File %1 already exists file deleted. filemanager en File deleted. file names cannot contain "%1" filemanager en File names cannot contain "%1" file or directory not found! filemanager en File or directory not found! diff --git a/infolog/inc/class.infolog_so.inc.php b/infolog/inc/class.infolog_so.inc.php index 7af62966d8..afc7d9f7b9 100644 --- a/infolog/inc/class.infolog_so.inc.php +++ b/infolog/inc/class.infolog_so.inc.php @@ -680,16 +680,20 @@ class infolog_so 'proj' => 'projects', 'event' => 'calendar' ); - $action = isset($action2app[$query['action']]) ? $action2app[$query['action']] : $query['action']; - if ($action != '') + // query children independent of action + if (empty($query['col_filter']['info_id_parent'])) { - $links = solink::get_links($action=='sp'?'infolog':$action, - is_array($query['action_id']) ? $query['action_id'] : explode(',',$query['action_id']),'infolog'); - - if (count($links)) + $action = isset($action2app[$query['action']]) ? $action2app[$query['action']] : $query['action']; + if ($action) { - $links = call_user_func_array('array_merge',$links); // flatten the array - $link_extra = ($action == 'sp' ? 'OR' : 'AND')." main.info_id IN (".implode(',',$links).')'; + $links = solink::get_links($action=='sp'?'infolog':$action, + is_array($query['action_id']) ? $query['action_id'] : explode(',',$query['action_id']),'infolog'); + + if (count($links)) + { + $links = call_user_func_array('array_merge',$links); // flatten the array + $link_extra = ($action == 'sp' ? 'OR' : 'AND')." main.info_id IN (".implode(',',$links).')'; + } } } $sortbycf=''; diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 259e01bfda..68312880e3 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @author Ralf Becker * @package infolog - * @copyright (c) 2003-12 by Ralf Becker + * @copyright (c) 2003-13 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -261,6 +261,7 @@ class infolog_ui { $info['info_number'] = $info['info_id']; } + //error_log(__METHOD__."() returning ".array2string($info)); return $info; } @@ -274,6 +275,7 @@ class infolog_ui */ function get_rows(&$query,&$rows,&$readonlys) { + //error_log(__METHOD__."() query[csv_export]=".array2string($query['csv_export']).", query[filter]=".array2string($query['filter']).", query[col_filter]=".array2string(array_diff($query['col_filter'],array('',0))).' '.function_backtrace()); if (!$query['csv_export']) { unset($query['no_actions']); @@ -293,7 +295,7 @@ class infolog_ui //echo "

infolog_ui.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]',col_filter=".print_r($query['col_filter'],True).",sort=$query[sort],order=$query[order])

\n"; if (!isset($query['start'])) $query['start'] = 0; - if ($query['csv_export'] && $query['csv_export'] !== 'knownUids') + if ($query['csv_export'] && $query['csv_export'] === true) { $query['csv_fields'] = $this->csv_export_fields($query['col_filter']['info_type']); } @@ -369,27 +371,29 @@ class infolog_ui $this->prefs['show_times'] = strpos($this->prefs['nextmatch-'.$query['columnselection_pref']],'info_used_time_info_planned_time') !== false; // query all links and sub counts in one go - if ($infos && (!$query['csv_export'] || $query['csv_export'] === 'knownUids')) + if ($infos && (!$query['csv_export'] || !is_array($query['csv_export']))) { $links = egw_link::get_links_multiple('infolog',array_keys($infos),true); $anzSubs = $this->bo->anzSubs(array_keys($infos)); } $readonlys = $rows = array(); - $parents = $query['action'] == 'sp' && $query['action_id'] ? (array)$query['action_id'] : array(); - if (count($parents) == 1 && is_array($query['action_id'])) - { - $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header - } + if (empty($query['col_filter']['info_id_parent'])) + { + $parents = $query['action'] == 'sp' && $query['action_id'] ? (array)$query['action_id'] : array(); + if (count($parents) == 1 && is_array($query['action_id'])) + { + $query['action_id'] = array_shift($query['action_id']); // display single parent as app_header + } + } // Check to see if we need to remove description - $et = new ReflectionClass('etemplate'); - $is_et2 = ($et->isSubclassOf(new ReflectionClass('etemplate_widget'))); + $is_et2 = is_subclass_of($this->tmpl, 'etemplate_widget'); $parent_first = count($parents) == 1; $parent_index = 0; foreach($infos as $id => $info) { if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) $info['info_addr'] = str_replace(',',', ',$info['info_addr']); - if (!$query['csv_export'] || $query['csv_export'] === 'knownUids') + if (!$query['csv_export'] || !is_array($query['csv_export'])) { $info['links'] =& $links[$id]; $info['info_anz_subs'] = (int)$anzSubs[$id]; @@ -402,7 +406,7 @@ class infolog_ui } } // for subs view ('sp') add parent(s) in front of subs once(!) - if ($parent_first && ($main = $this->bo->read($query['action_id'])) || + if ($parent_first && ($main = $this->bo->read($query['action_id'])) || $parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false && ($main = $this->bo->read($info['info_id_parent']))) { @@ -702,7 +706,7 @@ class infolog_ui if (!is_array($values)) { $nm = egw_cache::getSession('infolog', $this->called_by.'session_data'); - if ($values === 'reset_action_view') + if ($values === 'reset_action_view' || $_GET['ajax'] === 'true') { $nm['action'] = $action = ''; $nm['action_id'] = $action_id = 0; diff --git a/infolog/templates/default/app.css b/infolog/templates/default/app.css index 7d0e74e769..66fcb6be77 100644 --- a/infolog/templates/default/app.css +++ b/infolog/templates/default/app.css @@ -18,16 +18,8 @@ td.infolog_infoId:before { content:"#" } .infolog_user_filter select { width: 100px; } .inputFullWidth input { width: 100%; } .infolog_image16 img { height: 16px; } -tr.infolog_rowHasSubs > td:first-child { - background-image: url(../../../phpgwapi/templates/default/images/egw_action/arrow_left.png); - background-repeat: no-repeat; - background-position: 0px 11px; -} tr.infolog_rowHasParent > td:first-child { background-image: url(../../../phpgwapi/templates/default/images/egw_action/arrow_up.png); background-repeat: no-repeat; - background-position: 0px 11px; -} -tr.row_on > td:first-child, tr.row_off > td:first-child { - padding-left: 10px; + background-position: 6px -2px; }