mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 06:51:14 +01:00
Add changes in linked files into history log (et2)
This commit is contained in:
parent
b025809df1
commit
3d4b28ae15
@ -175,10 +175,17 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],{
|
|||||||
// Add in handling for links
|
// Add in handling for links
|
||||||
if(typeof this.options.value['status-widgets']['~link~'] == 'undefined')
|
if(typeof this.options.value['status-widgets']['~link~'] == 'undefined')
|
||||||
{
|
{
|
||||||
this.columns[2].widget.optionValues['~link~'] = this.egw().lang('link');
|
this.columns[this.FIELD].widget.optionValues['~link~'] = this.egw().lang('link');
|
||||||
this.options.value['status-widgets']['~link~'] = 'link';
|
this.options.value['status-widgets']['~link~'] = 'link';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add in handling for files
|
||||||
|
if(typeof this.options.value['status-widgets']['~file~'] == 'undefined')
|
||||||
|
{
|
||||||
|
this.columns[this.FIELD].widget.optionValues['~file~'] = this.egw().lang('File');
|
||||||
|
this.options.value['status-widgets']['~file~'] = 'vfs';
|
||||||
|
}
|
||||||
|
|
||||||
// Per-field widgets - new value & old value
|
// Per-field widgets - new value & old value
|
||||||
this.fields = {};
|
this.fields = {};
|
||||||
|
|
||||||
|
@ -205,17 +205,52 @@ class historylog
|
|||||||
{
|
{
|
||||||
$total = $GLOBALS['egw']->db->select(self::TABLE,'COUNT(*)',$filter,__LINE__,__FILE__,false,'','phpgwapi',0)->fetchColumn();
|
$total = $GLOBALS['egw']->db->select(self::TABLE,'COUNT(*)',$filter,__LINE__,__FILE__,false,'','phpgwapi',0)->fetchColumn();
|
||||||
}
|
}
|
||||||
foreach($GLOBALS['egw']->db->select(
|
$_query = array(array(
|
||||||
self::TABLE,
|
'table' => self::TABLE,
|
||||||
$mysql_calc_rows.'*',
|
'cols' => array('history_id', 'history_record_id','history_appname','history_owner','history_status','history_new_value', 'history_timestamp','history_old_value'),
|
||||||
$filter,
|
'where' => $filter,
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add in files, if possible
|
||||||
|
if($GLOBALS['egw_info']['user']['apps']['filemanager'] &&
|
||||||
|
$file = sqlfs_stream_wrapper::url_stat("/apps/{$query['appname']}/{$query['record_id']}",STREAM_URL_STAT_LINK))
|
||||||
|
{
|
||||||
|
$_query[] = array(
|
||||||
|
'table' => sqlfs_stream_wrapper::TABLE,
|
||||||
|
'cols' =>array('fs_id', 'fs_dir', '"filemanager"','fs_modifier','"~file~"','fs_name','fs_modified', '""'),
|
||||||
|
'where' => array('fs_dir' => $file['ino'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$new_file_id = array();
|
||||||
|
foreach($GLOBALS['egw']->db->union(
|
||||||
|
$_query,
|
||||||
__LINE__, __FILE__,
|
__LINE__, __FILE__,
|
||||||
|
' ORDER BY ' . ($query['order'] ? $query['order'] : 'history_timestamp') . ' ' . ($query['sort'] ? $query['sort'] : 'DESC'),
|
||||||
$query['start'],
|
$query['start'],
|
||||||
'ORDER BY ' . ($query['order'] ? $query['order'] : 'history_id') . ' ' . ($query['sort'] ? $query['sort'] : 'DESC'),
|
|
||||||
'phpgwapi',
|
|
||||||
$query['num_rows']
|
$query['num_rows']
|
||||||
) as $row) {
|
) as $row) {
|
||||||
$row['user_ts'] = $GLOBALS['egw']->db->from_timestamp($row['history_timestamp']) + 3600 * $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
|
$row['user_ts'] = $GLOBALS['egw']->db->from_timestamp($row['history_timestamp']) + 3600 * $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
|
||||||
|
|
||||||
|
// Get information needed for proper display
|
||||||
|
if($row['history_appname'] == 'filemanager')
|
||||||
|
{
|
||||||
|
$new_version = $new_file_id[$row['history_new_value']];
|
||||||
|
$new_file_id[$row['history_new_value']] = count($rows);
|
||||||
|
$path = sqlfs_stream_wrapper::id2path($row['history_id']);
|
||||||
|
|
||||||
|
// Apparently we don't have to do anything with it, just ask...
|
||||||
|
// without this, previous versions are not handled properly
|
||||||
|
egw_vfs::getExtraInfo($path);
|
||||||
|
|
||||||
|
$row['history_new_value'] = array(
|
||||||
|
'path' => $path,
|
||||||
|
'name' => basename($path)
|
||||||
|
);
|
||||||
|
if($new_version !== null)
|
||||||
|
{
|
||||||
|
$rows[$new_version]['old_value'] = $row['history_new_value'];
|
||||||
|
}
|
||||||
|
}
|
||||||
$rows[] = egw_db::strip_array_keys($row,'history_');
|
$rows[] = egw_db::strip_array_keys($row,'history_');
|
||||||
}
|
}
|
||||||
if ($mysql_calc_rows)
|
if ($mysql_calc_rows)
|
||||||
|
Loading…
Reference in New Issue
Block a user