mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* Filemanager: Add action to unlock files
This commit is contained in:
parent
e6b08cce70
commit
0bac2ff1e8
@ -142,58 +142,68 @@ class filemanager_ui
|
||||
public static function get_actions()
|
||||
{
|
||||
$actions = array(
|
||||
'open' => array(
|
||||
'caption' => lang('Open'),
|
||||
'icon' => '',
|
||||
'group' => $group=1,
|
||||
'open' => array(
|
||||
'caption' => lang('Open'),
|
||||
'icon' => '',
|
||||
'group' => $group = 1,
|
||||
'allowOnMultiple' => false,
|
||||
'onExecute' => 'javaScript:app.filemanager.open',
|
||||
'default' => true
|
||||
'onExecute' => 'javaScript:app.filemanager.open',
|
||||
'default' => true
|
||||
),
|
||||
'new' => array(
|
||||
'caption' => 'New',
|
||||
'group' => $group,
|
||||
'new' => array(
|
||||
'caption' => 'New',
|
||||
'group' => $group,
|
||||
'disableClass' => 'noEdit',
|
||||
'children' => array (
|
||||
'document' => array (
|
||||
'caption' => 'Document',
|
||||
'icon' => 'new',
|
||||
'children' => array(
|
||||
'document' => array(
|
||||
'caption' => 'Document',
|
||||
'icon' => 'new',
|
||||
'onExecute' => 'javaScript:app.filemanager.create_new',
|
||||
)
|
||||
)
|
||||
),
|
||||
'mkdir' => array(
|
||||
'caption' => lang('Create directory'),
|
||||
'icon' => 'filemanager/button_createdir',
|
||||
'group' => $group,
|
||||
'mkdir' => array(
|
||||
'caption' => lang('Create directory'),
|
||||
'icon' => 'filemanager/button_createdir',
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => false,
|
||||
'disableClass' => 'noEdit',
|
||||
'onExecute' => 'javaScript:app.filemanager.createdir'
|
||||
'disableClass' => 'noEdit',
|
||||
'onExecute' => 'javaScript:app.filemanager.createdir'
|
||||
),
|
||||
'edit' => array(
|
||||
'caption' => lang('Edit settings'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => false,
|
||||
'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs',
|
||||
'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
|
||||
'edit' => array(
|
||||
'caption' => lang('Edit settings'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => false,
|
||||
'onExecute' => Api\Header\UserAgent::mobile() ? 'javaScript:app.filemanager.viewEntry' : 'javaScript:app.filemanager.editprefs',
|
||||
'mobileViewTemplate' => 'file?' . filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
|
||||
),
|
||||
'saveas' => array(
|
||||
'caption' => lang('Save as'),
|
||||
'group' => $group,
|
||||
'unlock' => array(
|
||||
'caption' => lang('Unlock'),
|
||||
'icon' => 'unlock',
|
||||
'enableClass' => 'locked',
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => true,
|
||||
'icon' => 'filesave',
|
||||
'onExecute' => 'javaScript:app.filemanager.force_download',
|
||||
'disableClass' => 'isDir',
|
||||
'enabled' => 'javaScript:app.filemanager.is_multiple_allowed',
|
||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 83, 'caption' => 'Ctrl + Shift + S'),
|
||||
'hideOnDisabled' => true
|
||||
),
|
||||
'saveas' => array(
|
||||
'caption' => lang('Save as'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => true,
|
||||
'icon' => 'filesave',
|
||||
'onExecute' => 'javaScript:app.filemanager.force_download',
|
||||
'disableClass' => 'isDir',
|
||||
'enabled' => 'javaScript:app.filemanager.is_multiple_allowed',
|
||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 83,
|
||||
'caption' => 'Ctrl + Shift + S'),
|
||||
),
|
||||
'saveaszip' => array(
|
||||
'caption' => lang('Save as ZIP'),
|
||||
'group' => $group,
|
||||
'caption' => lang('Save as ZIP'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => true,
|
||||
'icon' => 'save_zip',
|
||||
'postSubmit' => true,
|
||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 90, 'caption' => 'Ctrl + Shift + Z'),
|
||||
'icon' => 'save_zip',
|
||||
'postSubmit' => true,
|
||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 90,
|
||||
'caption' => 'Ctrl + Shift + Z'),
|
||||
),
|
||||
'egw_paste' => array(
|
||||
'enabled' => false,
|
||||
@ -815,7 +825,7 @@ class filemanager_ui
|
||||
|
||||
case 'createdir':
|
||||
$dst = Vfs::concat($dir, is_array($selected) ? $selected[0] : $selected);
|
||||
if (Vfs::mkdir($dst, null, STREAM_MKDIR_RECURSIVE))
|
||||
if(Vfs::mkdir($dst, null, STREAM_MKDIR_RECURSIVE))
|
||||
{
|
||||
return lang("Directory successfully created.");
|
||||
}
|
||||
@ -824,16 +834,36 @@ class filemanager_ui
|
||||
case 'saveaszip':
|
||||
Vfs::download_zip($selected);
|
||||
exit;
|
||||
|
||||
case 'unlock':
|
||||
foreach((array)$selected as $target)
|
||||
{
|
||||
$link = Vfs::concat($dir, Vfs::basename($target));
|
||||
$lock = Vfs::checkLock($link);
|
||||
if($lock && Vfs::unlock($link, $lock['token']))
|
||||
{
|
||||
$files++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$errs++;
|
||||
}
|
||||
}
|
||||
return lang('%1 files unlocked.', $files);
|
||||
default:
|
||||
list($action, $settings) = explode('_', $action, 2);
|
||||
switch($action)
|
||||
{
|
||||
case 'document':
|
||||
if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document'];
|
||||
if(!$settings)
|
||||
{
|
||||
$settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document'];
|
||||
}
|
||||
$document_merge = new filemanager_merge(Vfs::decodePath($dir));
|
||||
$msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']);
|
||||
if($msg) return $msg;
|
||||
if($msg)
|
||||
{
|
||||
return $msg;
|
||||
}
|
||||
$errs = count($selected);
|
||||
return false;
|
||||
}
|
||||
@ -1009,16 +1039,27 @@ class filemanager_ui
|
||||
$row['class'] .= 'noExecute';
|
||||
}
|
||||
}
|
||||
elseif (!$dir_is_writable[Vfs::dirname($path)])
|
||||
elseif(!$dir_is_writable[Vfs::dirname($path)])
|
||||
{
|
||||
$row['class'] .= 'noEdit ';
|
||||
}
|
||||
if($lock = Vfs::checkLock($path))
|
||||
{
|
||||
$row['locked'] = 'lock';
|
||||
if($GLOBALS['egw_info']['user']['apps']['admin'] || Vfs::$is_admin || Vfs::$is_root ||
|
||||
$lock['owner'] == $GLOBALS['egw_info']['user']['account_id'] ||
|
||||
$lock['owner'] == 'mailto:' . $GLOBALS['egw_info']['user']['account_email']
|
||||
)
|
||||
{
|
||||
$row['class'] .= ' locked ';
|
||||
}
|
||||
}
|
||||
|
||||
$row['class'] .= !$dir_is_writable[$dir] ? 'noDelete' : '';
|
||||
$row['download_url'] = Vfs::download_url($path);
|
||||
$row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal
|
||||
$row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal
|
||||
|
||||
foreach(['mtime','ctime'] as $date_field)
|
||||
foreach(['mtime', 'ctime'] as $date_field)
|
||||
{
|
||||
$row[$date_field] = Api\DateTime::server2user($row[$date_field]);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
%1 files deleted. filemanager en %1 files deleted.
|
||||
%1 files moved. filemanager en %1 files moved.
|
||||
%1 files or directories deleted in %2 seconds. filemanager en %1 files or directories deleted in %2 seconds.
|
||||
%1 files unlocked. filemanager en %1 files unlocked.
|
||||
%1 shares deleted. filemanager en %1 shares deleted.
|
||||
%1 starts with '%2' filemanager en %1 starts with '%2'
|
||||
%1 successful unmounted. filemanager en %1 successful unmounted.
|
||||
|
@ -6,6 +6,7 @@
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column width="150"/>
|
||||
<column width="80"/>
|
||||
<column width="50%"/>
|
||||
<column width="80"/>
|
||||
<column width="120"/>
|
||||
@ -19,6 +20,7 @@
|
||||
<rows>
|
||||
<row class="th">
|
||||
<nextmatch-sortheader align="center" label="Type" id="mime"/>
|
||||
<nextmatch-header align="center" label="Lock" id="lock"/>
|
||||
<nextmatch-sortheader label="Name" id="name"/>
|
||||
<nextmatch-sortheader label="Size" id="size"/>
|
||||
<nextmatch-sortheader label="Modified" id="mtime"/>
|
||||
@ -31,6 +33,7 @@
|
||||
</row>
|
||||
<row class="row $row_cont[class]">
|
||||
<vfs-mime align="center" id="$row"/>
|
||||
<image src="${row}[locked]"/>
|
||||
<vfs id="$row" no_lang="1"/>
|
||||
<vfs-size align="right" id="${row}[size]"/>
|
||||
<date-time id="${row}[mtime]" readonly="true"/>
|
||||
|
Loading…
Reference in New Issue
Block a user