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

This commit is contained in:
Ralf Becker 2013-10-10 11:29:31 +00:00
parent 60049dd085
commit 0e2e88c19b
7 changed files with 46 additions and 45 deletions

View File

@ -39,7 +39,7 @@
* 'col_filter' => // IO array of column-name value pairs (optional for the filterheaders) * '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! * // 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[$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' => // IO filter, if not 'no_filter' => True
* 'filter_no_lang' => True// I set no_lang for filter (=dont translate the options) * '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(); * 'filter_onchange'=> 'this.form.submit();' // I onChange action for filter, default: this.form.submit();
@ -59,7 +59,7 @@
* or name of import/export definition * or name of import/export definition
* 'row_id' => // I key into row content to set it's value as row-id, eg. 'id' * '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 * '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' => // 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 * '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. * '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) ? array($value) : array();
} }
$value = $value_in = array_merge($value, $filters); $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]"); //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(); $result = array();
@ -297,7 +297,8 @@ class etemplate_widget_nextmatch extends etemplate_widget
if (($parent_id = $value['parent_id'])) if (($parent_id = $value['parent_id']))
{ {
// Infolog at least wants 'parent_id' instead of $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 // 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']; 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'])); egw_json_response::get()->apply('egw_app_header', array($GLOBALS['egw_info']['flags']['app_header']));
} }
// Check for anything changed in the query // Check for anything changed in the query
// Tell the client about the changes // Tell the client about the changes
$request_value =& self::get_array(self::$request->content, $form_name,true); $request_value =& self::get_array(self::$request->content, $form_name,true);
@ -336,12 +337,12 @@ class etemplate_widget_nextmatch extends etemplate_widget
continue; continue;
} }
if($original_value == $value[$key]) continue; if($original_value == $value[$key]) continue;
// These keys we don't send row data back, as they cause a partial reload // These keys we don't send row data back, as they cause a partial reload
if(in_array($key, array('template'))) $no_rows = true; if(in_array($key, array('template'))) $no_rows = true;
$request_value[$key] = $value[$key]; $request_value[$key] = $value[$key];
egw_json_response::get()->generic('assign', array( egw_json_response::get()->generic('assign', array(
'etemplate_exec_id' => self::$request->id(), 'etemplate_exec_id' => self::$request->id(),
'id' => $form_name, 'id' => $form_name,
@ -350,7 +351,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
)); ));
} }
if($no_rows) $rows = Array(); if($no_rows) $rows = Array();
$row_id = isset($value['row_id']) ? $value['row_id'] : 'id'; $row_id = isset($value['row_id']) ? $value['row_id'] : 'id';
$row_modified = $value['row_modified']; $row_modified = $value['row_modified'];
$is_parent = $value['is_parent']; $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)); //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); egw_json_response::get()->data($result);
// If etemplate_exec_id has changed, update the client side // If etemplate_exec_id has changed, update the client side
if (($new_id = self::$request->id()) != $id) if (($new_id = self::$request->id()) != $id)
{ {

View File

@ -704,7 +704,7 @@ class filemanager_ui
$GLOBALS['egw_info']['flags']['currentapp'] = 'projectmanager'; $GLOBALS['egw_info']['flags']['currentapp'] = 'projectmanager';
} }
// do NOT store query, if hierarchical data / children are requested // 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); egw_session::appsession('index','filemanager',$query);
} }
@ -740,7 +740,7 @@ class filemanager_ui
{ {
$namefilter = '/'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i'; $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, 'mindepth' => 1,
'maxdepth' => $query['filter'] ? (int)(boolean)$query['filter'] : null, 'maxdepth' => $query['filter'] ? (int)(boolean)$query['filter'] : null,
'dirsontop' => $query['filter'] <= 1, 'dirsontop' => $query['filter'] <= 1,

View File

@ -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 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 and modification of content filemanager de Anzeigen und Verändern des Inhaltes
display of content filemanager de Anzeigen des Inhaltes display of content filemanager de Anzeigen des Inhaltes
do you want to overwrite existing file <b>%1</b> in directory <b>%2</b>? filemanager de Wollen Sie die bestehende Datei <b>%1</b> im Verzeichnis <b>%2</b> ü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? do you want to overwrite the existing file %1? filemanager de Wollen Sie die existierende Datei %1 überschreiben?
download filemanager de Herunterladen download filemanager de Herunterladen
edit comments filemanager de Kommentare bearbeiten edit comments filemanager de Kommentare bearbeiten
@ -104,7 +104,7 @@ favorites filemanager de Favoriten
file filemanager de Datei file filemanager de Datei
file %1 could not be created. filemanager de Die Datei %1 konnte nicht erzeugt werden 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 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 <b>%1</b> already exists filemanager de Es gibt schon eine Datei <b>%1</b> file %1 already exists filemanager de Es gibt schon eine Datei %1
file deleted. filemanager de Datei gelöscht. file deleted. filemanager de Datei gelöscht.
file names cannot contain "%1" filemanager de Dateinamen dürfen "%1" nicht enthalten 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! file or directory not found! filemanager de Datei oder Verzeichnis nicht gefunden!

View File

@ -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 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 and modification of content filemanager en Display and modification of content
display of content filemanager en Display of content display of content filemanager en Display of content
do you want to overwrite existing file <b>%1</b> in directory <b>%2</b>? filemanager en Do you want to overwrite existing file <b>%1</b> in directory <b>%2</b>? 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? do you want to overwrite the existing file %1? filemanager en Do you want to overwrite the existing file %1?
download filemanager en Download download filemanager en Download
edit comments filemanager en Edit comments edit comments filemanager en Edit comments
@ -104,7 +104,7 @@ favorites filemanager en Favorites
file filemanager en File file filemanager en File
file %1 could not be created. filemanager en File %1 could not be created. 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 may be too big. contact your systemadministrator for further info filemanager en File %1 might be too big.
file <b>%1</b> already exists filemanager en File <b>%1</b> already exists file %1 already exists filemanager en File %1 already exists
file deleted. filemanager en File deleted. file deleted. filemanager en File deleted.
file names cannot contain "%1" filemanager en File names cannot contain "%1" file names cannot contain "%1" filemanager en File names cannot contain "%1"
file or directory not found! filemanager en File or directory not found! file or directory not found! filemanager en File or directory not found!

View File

@ -680,16 +680,20 @@ class infolog_so
'proj' => 'projects', 'proj' => 'projects',
'event' => 'calendar' 'event' => 'calendar'
); );
$action = isset($action2app[$query['action']]) ? $action2app[$query['action']] : $query['action']; // query children independent of action
if ($action != '') if (empty($query['col_filter']['info_id_parent']))
{ {
$links = solink::get_links($action=='sp'?'infolog':$action, $action = isset($action2app[$query['action']]) ? $action2app[$query['action']] : $query['action'];
is_array($query['action_id']) ? $query['action_id'] : explode(',',$query['action_id']),'infolog'); if ($action)
if (count($links))
{ {
$links = call_user_func_array('array_merge',$links); // flatten the array $links = solink::get_links($action=='sp'?'infolog':$action,
$link_extra = ($action == 'sp' ? 'OR' : 'AND')." main.info_id IN (".implode(',',$links).')'; 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=''; $sortbycf='';

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog * @package infolog
* @copyright (c) 2003-12 by Ralf Becker <RalfBecker-AT-outdoor-training.de> * @copyright (c) 2003-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$ * @version $Id$
*/ */
@ -261,6 +261,7 @@ class infolog_ui
{ {
$info['info_number'] = $info['info_id']; $info['info_number'] = $info['info_id'];
} }
//error_log(__METHOD__."() returning ".array2string($info));
return $info; return $info;
} }
@ -274,6 +275,7 @@ class infolog_ui
*/ */
function get_rows(&$query,&$rows,&$readonlys) 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']) if (!$query['csv_export'])
{ {
unset($query['no_actions']); unset($query['no_actions']);
@ -293,7 +295,7 @@ class infolog_ui
//echo "<p>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])</p>\n"; //echo "<p>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])</p>\n";
if (!isset($query['start'])) $query['start'] = 0; 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']); $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; $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 // 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); $links = egw_link::get_links_multiple('infolog',array_keys($infos),true);
$anzSubs = $this->bo->anzSubs(array_keys($infos)); $anzSubs = $this->bo->anzSubs(array_keys($infos));
} }
$readonlys = $rows = array(); $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 // Check to see if we need to remove description
$et = new ReflectionClass('etemplate'); $is_et2 = is_subclass_of($this->tmpl, 'etemplate_widget');
$is_et2 = ($et->isSubclassOf(new ReflectionClass('etemplate_widget')));
$parent_first = count($parents) == 1; $parent_first = count($parents) == 1;
$parent_index = 0; $parent_index = 0;
foreach($infos as $id => $info) 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 (!(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['links'] =& $links[$id];
$info['info_anz_subs'] = (int)$anzSubs[$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(!) // 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 && $parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false &&
($main = $this->bo->read($info['info_id_parent']))) ($main = $this->bo->read($info['info_id_parent'])))
{ {
@ -702,7 +706,7 @@ class infolog_ui
if (!is_array($values)) if (!is_array($values))
{ {
$nm = egw_cache::getSession('infolog', $this->called_by.'session_data'); $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'] = $action = '';
$nm['action_id'] = $action_id = 0; $nm['action_id'] = $action_id = 0;

View File

@ -18,16 +18,8 @@ td.infolog_infoId:before { content:"#" }
.infolog_user_filter select { width: 100px; } .infolog_user_filter select { width: 100px; }
.inputFullWidth input { width: 100%; } .inputFullWidth input { width: 100%; }
.infolog_image16 img { height: 16px; } .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 { tr.infolog_rowHasParent > td:first-child {
background-image: url(../../../phpgwapi/templates/default/images/egw_action/arrow_up.png); background-image: url(../../../phpgwapi/templates/default/images/egw_action/arrow_up.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 0px 11px; background-position: 6px -2px;
}
tr.row_on > td:first-child, tr.row_off > td:first-child {
padding-left: 10px;
} }