mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +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()
|
public static function get_actions()
|
||||||
{
|
{
|
||||||
$actions = array(
|
$actions = array(
|
||||||
'open' => array(
|
'open' => array(
|
||||||
'caption' => lang('Open'),
|
'caption' => lang('Open'),
|
||||||
'icon' => '',
|
'icon' => '',
|
||||||
'group' => $group=1,
|
'group' => $group = 1,
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'onExecute' => 'javaScript:app.filemanager.open',
|
'onExecute' => 'javaScript:app.filemanager.open',
|
||||||
'default' => true
|
'default' => true
|
||||||
),
|
),
|
||||||
'new' => array(
|
'new' => array(
|
||||||
'caption' => 'New',
|
'caption' => 'New',
|
||||||
'group' => $group,
|
'group' => $group,
|
||||||
'disableClass' => 'noEdit',
|
'disableClass' => 'noEdit',
|
||||||
'children' => array (
|
'children' => array(
|
||||||
'document' => array (
|
'document' => array(
|
||||||
'caption' => 'Document',
|
'caption' => 'Document',
|
||||||
'icon' => 'new',
|
'icon' => 'new',
|
||||||
'onExecute' => 'javaScript:app.filemanager.create_new',
|
'onExecute' => 'javaScript:app.filemanager.create_new',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'mkdir' => array(
|
'mkdir' => array(
|
||||||
'caption' => lang('Create directory'),
|
'caption' => lang('Create directory'),
|
||||||
'icon' => 'filemanager/button_createdir',
|
'icon' => 'filemanager/button_createdir',
|
||||||
'group' => $group,
|
'group' => $group,
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'disableClass' => 'noEdit',
|
'disableClass' => 'noEdit',
|
||||||
'onExecute' => 'javaScript:app.filemanager.createdir'
|
'onExecute' => 'javaScript:app.filemanager.createdir'
|
||||||
),
|
),
|
||||||
'edit' => array(
|
'edit' => array(
|
||||||
'caption' => lang('Edit settings'),
|
'caption' => lang('Edit settings'),
|
||||||
'group' => $group,
|
'group' => $group,
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs',
|
'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'))
|
'mobileViewTemplate' => 'file?' . filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
|
||||||
),
|
),
|
||||||
'saveas' => array(
|
'unlock' => array(
|
||||||
'caption' => lang('Save as'),
|
'caption' => lang('Unlock'),
|
||||||
'group' => $group,
|
'icon' => 'unlock',
|
||||||
|
'enableClass' => 'locked',
|
||||||
|
'group' => $group,
|
||||||
'allowOnMultiple' => true,
|
'allowOnMultiple' => true,
|
||||||
'icon' => 'filesave',
|
'hideOnDisabled' => true
|
||||||
'onExecute' => 'javaScript:app.filemanager.force_download',
|
),
|
||||||
'disableClass' => 'isDir',
|
'saveas' => array(
|
||||||
'enabled' => 'javaScript:app.filemanager.is_multiple_allowed',
|
'caption' => lang('Save as'),
|
||||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 83, 'caption' => 'Ctrl + Shift + S'),
|
'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(
|
'saveaszip' => array(
|
||||||
'caption' => lang('Save as ZIP'),
|
'caption' => lang('Save as ZIP'),
|
||||||
'group' => $group,
|
'group' => $group,
|
||||||
'allowOnMultiple' => true,
|
'allowOnMultiple' => true,
|
||||||
'icon' => 'save_zip',
|
'icon' => 'save_zip',
|
||||||
'postSubmit' => true,
|
'postSubmit' => true,
|
||||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 90, 'caption' => 'Ctrl + Shift + Z'),
|
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 90,
|
||||||
|
'caption' => 'Ctrl + Shift + Z'),
|
||||||
),
|
),
|
||||||
'egw_paste' => array(
|
'egw_paste' => array(
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
@ -815,7 +825,7 @@ class filemanager_ui
|
|||||||
|
|
||||||
case 'createdir':
|
case 'createdir':
|
||||||
$dst = Vfs::concat($dir, is_array($selected) ? $selected[0] : $selected);
|
$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.");
|
return lang("Directory successfully created.");
|
||||||
}
|
}
|
||||||
@ -824,16 +834,36 @@ class filemanager_ui
|
|||||||
case 'saveaszip':
|
case 'saveaszip':
|
||||||
Vfs::download_zip($selected);
|
Vfs::download_zip($selected);
|
||||||
exit;
|
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:
|
default:
|
||||||
list($action, $settings) = explode('_', $action, 2);
|
list($action, $settings) = explode('_', $action, 2);
|
||||||
switch($action)
|
switch($action)
|
||||||
{
|
{
|
||||||
case 'document':
|
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));
|
$document_merge = new filemanager_merge(Vfs::decodePath($dir));
|
||||||
$msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_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);
|
$errs = count($selected);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1009,16 +1039,27 @@ class filemanager_ui
|
|||||||
$row['class'] .= 'noExecute';
|
$row['class'] .= 'noExecute';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (!$dir_is_writable[Vfs::dirname($path)])
|
elseif(!$dir_is_writable[Vfs::dirname($path)])
|
||||||
{
|
{
|
||||||
$row['class'] .= 'noEdit ';
|
$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['class'] .= !$dir_is_writable[$dir] ? 'noDelete' : '';
|
||||||
$row['download_url'] = Vfs::download_url($path);
|
$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]);
|
$row[$date_field] = Api\DateTime::server2user($row[$date_field]);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
%1 files deleted. filemanager en %1 files deleted.
|
%1 files deleted. filemanager en %1 files deleted.
|
||||||
%1 files moved. filemanager en %1 files moved.
|
%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 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 shares deleted. filemanager en %1 shares deleted.
|
||||||
%1 starts with '%2' filemanager en %1 starts with '%2'
|
%1 starts with '%2' filemanager en %1 starts with '%2'
|
||||||
%1 successful unmounted. filemanager en %1 successful unmounted.
|
%1 successful unmounted. filemanager en %1 successful unmounted.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<grid width="100%">
|
<grid width="100%">
|
||||||
<columns>
|
<columns>
|
||||||
<column width="150"/>
|
<column width="150"/>
|
||||||
|
<column width="80"/>
|
||||||
<column width="50%"/>
|
<column width="50%"/>
|
||||||
<column width="80"/>
|
<column width="80"/>
|
||||||
<column width="120"/>
|
<column width="120"/>
|
||||||
@ -19,6 +20,7 @@
|
|||||||
<rows>
|
<rows>
|
||||||
<row class="th">
|
<row class="th">
|
||||||
<nextmatch-sortheader align="center" label="Type" id="mime"/>
|
<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="Name" id="name"/>
|
||||||
<nextmatch-sortheader label="Size" id="size"/>
|
<nextmatch-sortheader label="Size" id="size"/>
|
||||||
<nextmatch-sortheader label="Modified" id="mtime"/>
|
<nextmatch-sortheader label="Modified" id="mtime"/>
|
||||||
@ -31,6 +33,7 @@
|
|||||||
</row>
|
</row>
|
||||||
<row class="row $row_cont[class]">
|
<row class="row $row_cont[class]">
|
||||||
<vfs-mime align="center" id="$row"/>
|
<vfs-mime align="center" id="$row"/>
|
||||||
|
<image src="${row}[locked]"/>
|
||||||
<vfs id="$row" no_lang="1"/>
|
<vfs id="$row" no_lang="1"/>
|
||||||
<vfs-size align="right" id="${row}[size]"/>
|
<vfs-size align="right" id="${row}[size]"/>
|
||||||
<date-time id="${row}[mtime]" readonly="true"/>
|
<date-time id="${row}[mtime]" readonly="true"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user