Skip to content

Commit

Permalink
Add dir/file name in context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan-Aleev committed Jun 18, 2023
1 parent 793589b commit b286c44
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions core/src/Revolution/Sources/modMediaSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public function getContainerList($path)
$directories[$file_name]['visibility'] = $visibility;
}
$directories[$file_name]['menu'] = [
'items' => $this->getListDirContextMenu(),
'items' => $this->getListDirContextMenu($file_name),
];

}
Expand Down Expand Up @@ -2087,13 +2087,19 @@ protected function getExtJSDirClasses()
*
* @return array
*/
protected function getListDirContextMenu()
protected function getListDirContextMenu($dirName)
{
$canSave = $this->checkPolicy('save');
$canRemove = $this->checkPolicy('remove');
$canCreate = $this->checkPolicy('create');

$menu = [];
$menu[] = [
'text' => '<b>' . htmlentities($dirName) . '</b>',
'handler' => '',
'header' => true,
];
$menu[] = '-';
$menu[] = [
'text' => $this->xpdo->lexicon('directory_refresh'),
'handler' => 'this.refreshActiveNode',
Expand Down Expand Up @@ -2160,13 +2166,21 @@ protected function getListDirContextMenu()
*/
protected function getListFileContextMenu($path, $editable = true, $data = [])
{
$fileName = basename($path);

$canSave = $this->checkPolicy('save');
$canRemove = $this->checkPolicy('remove');
$canView = $this->checkPolicy('view');
$canOpen = !empty($data['urlExternal']) &&
(empty($data['visibility']) || $data['visibility'] === Visibility::PUBLIC);

$menu = [];
$menu[] = [
'text' => '<b>' . htmlentities($fileName) . '</b>',
'handler' => '',
'header' => true,
];
$menu[] = '-';
if ($this->hasPermission('file_update') && $canSave) {
if ($editable) {
$menu[] = [
Expand Down

0 comments on commit b286c44

Please sign in to comment.