Skip to content

Commit 4adbef4

Browse files
author
Serghey Rodin
committed
FileManager move function + small bugfixes
1 parent 7b924c0 commit 4adbef4

38 files changed

+562
-565
lines changed

web/css/file_manager.css

Lines changed: 48 additions & 338 deletions
Large diffs are not rendered by default.

web/file_manager/fm_api.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,29 @@
3737

3838
case 'rename_file':
3939
$dir = $_REQUEST['dir'];
40-
$item = $_REQUEST['item'];
41-
$target_name = $_REQUEST['target_name'];
42-
print json_encode($fm->renameFile($dir, $item, $target_name));
40+
$item = $dir . '/' . $_REQUEST['item'];
41+
$target_name = $dir . '/' . $_REQUEST['target_name'];
42+
print json_encode($fm->renameFile($item, $target_name));
4343
break;
4444

4545
case 'rename_directory':
4646
$dir = $_REQUEST['dir'];
47+
$item = $dir.$_REQUEST['item'];
48+
$target_name = $dir.$_REQUEST['target_name'];
49+
50+
print json_encode($fm->renameDirectory($item, $target_name));
51+
break;
52+
53+
case 'move_file':
4754
$item = $_REQUEST['item'];
4855
$target_name = $_REQUEST['target_name'];
56+
print json_encode($fm->renameFile($item, $target_name));
57+
break;
4958

50-
print json_encode($fm->renameDirectory($dir, $item, $target_name));
59+
case 'move_directory':
60+
$item = $_REQUEST['item'];
61+
$target_name = $_REQUEST['target_name'];
62+
print json_encode($fm->renameDirectory($item, $target_name));
5163
break;
5264

5365
case 'delete_files':
@@ -98,11 +110,9 @@
98110
break;
99111

100112
case 'pack_item':
101-
$dir = $_REQUEST['dir'];
102-
$target_dir = $_REQUEST['dir_target'];
103-
$filename = $_REQUEST['filename'];
104-
$item = $_REQUEST['item'];
105-
print json_encode($fm->packItem($item, $dir, $target_dir, $filename));
113+
$items = $_REQUEST['items'];
114+
$dst_item = $_REQUEST['dst_item'];
115+
print json_encode($fm->packItem($items, $dst_item));
106116
break;
107117

108118
case 'backup':

web/file_manager/fm_core.php

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,18 @@ function createFile($dir, $filename) {
150150
}
151151
}
152152

153-
function packItem($item, $dir, $target_dir, $filename) {
154-
$item = $this->formatFullPath($item);
155-
$dst_item = $this->formatFullPath($target_dir);
156-
153+
function packItem($items, $dst_item) {
154+
$items_arr = explode(',', $items);
155+
foreach($items_arr as $key => $item){
156+
$items_arr[$key] = $this->formatFullPath($item);
157+
}
158+
$items = implode(' ', $items_arr);
159+
160+
$dst_item = $this->formatFullPath($dst_item);
157161
$dst_item = str_replace('.tar.gz', '', $dst_item);
158162

159-
exec (VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$item}", $output, $return_var);
163+
// echo VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$items}";
164+
exec (VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$items}", $output, $return_var);
160165

161166
$error = self::check_return_code($return_var, $output);
162167

@@ -233,9 +238,12 @@ function unpackItem($item, $dir, $target_dir, $filename) {
233238
}
234239
}
235240

236-
function renameFile($dir, $item, $target_name) {
237-
$item = $this->formatFullPath($dir . '/' . $item);
238-
$dst_item = $this->formatFullPath($dir . '/' . $target_name);
241+
function renameFile($item, $target_name) {
242+
// $item = $this->formatFullPath($dir . '/' . $item);
243+
// $dst_item = $this->formatFullPath($dir . '/' . $target_name);
244+
245+
$item = $this->formatFullPath($item);
246+
$dst_item = $this->formatFullPath($target_name);
239247

240248
exec (VESTA_CMD . "v-move-fs-file {$this->user} {$item} {$dst_item}", $output, $return_var);
241249

@@ -254,9 +262,9 @@ function renameFile($dir, $item, $target_name) {
254262
}
255263
}
256264

257-
function renameDirectory($dir, $item, $target_name) {
258-
$item = $this->formatFullPath($dir . $item);
259-
$dst_item = $this->formatFullPath($dir . $target_name);
265+
function renameDirectory($item, $target_name) {
266+
$item = $this->formatFullPath($item);
267+
$dst_item = $this->formatFullPath($target_name);
260268

261269
if ($item == $dst_item) {
262270
return array(

web/images/flat_icons.png

709 Bytes
Loading

web/inc/i18n/ar.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@
591591
'NEW DIR' => 'مجلد جديد',
592592
'DELETE' => 'حذف',
593593
'RENAME' => 'إعادة تسمية',
594+
'MOVE' => 'MOVE',
594595
'RIGHTS' => 'الحقوق',
595596
'COPY' => 'نسخ',
596597
'ARCHIVE' => 'ضغط',
@@ -611,6 +612,7 @@
611612
'Copy' => 'نسخ',
612613
'Cancel' => 'إلغاء',
613614
'Rename' => 'إعادة تسمية',
615+
'Move' => 'Move',
614616
'Change Rights' => 'تغيير الحقوق',
615617
'Delete' => 'حذف',
616618
'Extract' => 'فك ضغط',
@@ -621,7 +623,9 @@
621623
'YOU ARE REMOVING' => 'تقوم بالحذف',
622624
'Delete items' => 'حذف العناصر',
623625
'Copy files' => 'نسخ الملفات',
626+
'Move files' => 'Move files',
624627
'Are you sure you want to copy' => 'هل أنت متأكد أنك تريد نسخ',
628+
'Are you sure you want to move' => 'Are you sure you want to move',
625629
'Are you sure you want to delete' => 'هل انت متأكد أنك تريد حذف',
626630
'into' => 'إلى',
627631
'existing files will be replaced' => 'الملفات الموجودة مسبقاً سوف تستبدل',
@@ -674,6 +678,7 @@
674678
'Go to the Top of the File List' => 'إذهب إلى أعلى قائمة الملفات',
675679
'Go to the Last File' => 'إذهب إلى آخر ملف',
676680
'Open File / Enter Directory' => 'فتح ملف / مجلد',
681+
'Edit File' => 'Edit File',
677682
'Go to Parent Directory' => 'الذهاب للمجلد الأب',
678683
'Select Current File' => 'حدد الملف الحالي',
679684
'Select Bunch of Files' => 'حدد مجموعة ملفات',

web/inc/i18n/bs.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@
591591
'NEW DIR' => 'NEW DIR',
592592
'DELETE' => 'DELETE',
593593
'RENAME' => 'RENAME',
594+
'MOVE' => 'MOVE',
594595
'RIGHTS' => 'RIGHTS',
595596
'COPY' => 'COPY',
596597
'ARCHIVE' => 'ARCHIVE',
@@ -611,6 +612,7 @@
611612
'Copy' => 'Kopirati',
612613
'Cancel' => 'Odustati',
613614
'Rename' => 'Izmijeniti',
615+
'Move' => 'Move',
614616
'Change Rights' => 'Change Rights',
615617
'Delete' => 'Izbrisati',
616618
'Extract' => 'Ekstraktovati',
@@ -621,7 +623,9 @@
621623
'YOU ARE REMOVING' => 'YOU ARE REMOVING',
622624
'Delete items' => 'Delete items',
623625
'Copy files' => 'Copy files',
626+
'Move files' => 'Move files',
624627
'Are you sure you want to copy' => 'Are you sure you want to copy',
628+
'Are you sure you want to move' => 'Are you sure you want to move',
625629
'Are you sure you want to delete' => 'Are you sure you want to delete',
626630
'into' => 'into',
627631
'existing files will be replaced' => 'existing files will be replaced',
@@ -674,6 +678,7 @@
674678
'Go to the Top of the File List' => 'Go to the Top of the File List',
675679
'Go to the Last File' => 'Go to the Last File',
676680
'Open File / Enter Directory' => 'Open File / Enter Directory',
681+
'Edit File' => 'Edit File',
677682
'Go to Parent Directory' => 'Go to Parent Directory',
678683
'Select Current File' => 'Select Current File',
679684
'Select Bunch of Files' => 'Select Bunch of Files',

web/inc/i18n/cn.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@
591591
'NEW DIR' => 'NEW DIR',
592592
'DELETE' => 'DELETE',
593593
'RENAME' => 'RENAME',
594+
'MOVE' => 'MOVE',
594595
'RIGHTS' => 'RIGHTS',
595596
'COPY' => 'COPY',
596597
'ARCHIVE' => 'ARCHIVE',
@@ -611,6 +612,7 @@
611612
'Copy' => 'Copy',
612613
'Cancel' => 'Cancel',
613614
'Rename' => 'Rename',
615+
'Move' => 'Move',
614616
'Change Rights' => 'Change Rights',
615617
'Delete' => 'Delete',
616618
'Extract' => 'Extract',
@@ -621,7 +623,9 @@
621623
'YOU ARE REMOVING' => 'YOU ARE REMOVING',
622624
'Delete items' => 'Delete items',
623625
'Copy files' => 'Copy files',
626+
'Move files' => 'Move files',
624627
'Are you sure you want to copy' => 'Are you sure you want to copy',
628+
'Are you sure you want to move' => 'Are you sure you want to move',
625629
'Are you sure you want to delete' => 'Are you sure you want to delete',
626630
'into' => 'into',
627631
'existing files will be replaced' => 'existing files will be replaced',
@@ -674,6 +678,7 @@
674678
'Go to the Top of the File List' => 'Go to the Top of the File List',
675679
'Go to the Last File' => 'Go to the Last File',
676680
'Open File / Enter Directory' => 'Open File / Enter Directory',
681+
'Edit File' => 'Edit File',
677682
'Go to Parent Directory' => 'Go to Parent Directory',
678683
'Select Current File' => 'Select Current File',
679684
'Select Bunch of Files' => 'Select Bunch of Files',

web/inc/i18n/cz.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@
592592
'NEW DIR' => 'NEW DIR',
593593
'DELETE' => 'DELETE',
594594
'RENAME' => 'RENAME',
595+
'MOVE' => 'MOVE',
595596
'RIGHTS' => 'RIGHTS',
596597
'COPY' => 'COPY',
597598
'ARCHIVE' => 'ARCHIVE',
@@ -612,6 +613,7 @@
612613
'Copy' => 'Copy',
613614
'Cancel' => 'Cancel',
614615
'Rename' => 'Rename',
616+
'Move' => 'Move',
615617
'Change Rights' => 'Change Rights',
616618
'Delete' => 'Delete',
617619
'Extract' => 'Extract',
@@ -622,7 +624,9 @@
622624
'YOU ARE REMOVING' => 'YOU ARE REMOVING',
623625
'Delete items' => 'Delete items',
624626
'Copy files' => 'Copy files',
627+
'Move files' => 'Move files',
625628
'Are you sure you want to copy' => 'Are you sure you want to copy',
629+
'Are you sure you want to move' => 'Are you sure you want to move',
626630
'Are you sure you want to delete' => 'Are you sure you want to delete',
627631
'into' => 'into',
628632
'existing files will be replaced' => 'existing files will be replaced',
@@ -675,6 +679,7 @@
675679
'Go to the Top of the File List' => 'Go to the Top of the File List',
676680
'Go to the Last File' => 'Go to the Last File',
677681
'Open File / Enter Directory' => 'Open File / Enter Directory',
682+
'Edit File' => 'Edit File',
678683
'Go to Parent Directory' => 'Go to Parent Directory',
679684
'Select Current File' => 'Select Current File',
680685
'Select Bunch of Files' => 'Select Bunch of Files',

web/inc/i18n/da.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@
593593
'NEW DIR' => 'NEW DIR',
594594
'DELETE' => 'DELETE',
595595
'RENAME' => 'RENAME',
596+
'MOVE' => 'MOVE',
596597
'RIGHTS' => 'RIGHTS',
597598
'COPY' => 'COPY',
598599
'ARCHIVE' => 'ARCHIVE',
@@ -613,6 +614,7 @@
613614
'Copy' => 'Copy',
614615
'Cancel' => 'Cancel',
615616
'Rename' => 'Rename',
617+
'Move' => 'Move',
616618
'Change Rights' => 'Change Rights',
617619
'Delete' => 'Delete',
618620
'Extract' => 'Extract',
@@ -623,7 +625,9 @@
623625
'YOU ARE REMOVING' => 'YOU ARE REMOVING',
624626
'Delete items' => 'Delete items',
625627
'Copy files' => 'Copy files',
628+
'Move files' => 'Move files',
626629
'Are you sure you want to copy' => 'Are you sure you want to copy',
630+
'Are you sure you want to move' => 'Are you sure you want to move',
627631
'Are you sure you want to delete' => 'Are you sure you want to delete',
628632
'into' => 'into',
629633
'existing files will be replaced' => 'existing files will be replaced',
@@ -676,6 +680,7 @@
676680
'Go to the Top of the File List' => 'Go to the Top of the File List',
677681
'Go to the Last File' => 'Go to the Last File',
678682
'Open File / Enter Directory' => 'Open File / Enter Directory',
683+
'Edit File' => 'Edit File',
679684
'Go to Parent Directory' => 'Go to Parent Directory',
680685
'Select Current File' => 'Select Current File',
681686
'Select Bunch of Files' => 'Select Bunch of Files',

web/inc/i18n/de.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@
591591
'NEW DIR' => 'NEW DIR',
592592
'DELETE' => 'DELETE',
593593
'RENAME' => 'RENAME',
594+
'MOVE' => 'MOVE',
594595
'RIGHTS' => 'RIGHTS',
595596
'COPY' => 'COPY',
596597
'ARCHIVE' => 'ARCHIVE',
@@ -611,6 +612,7 @@
611612
'Copy' => 'Copy',
612613
'Cancel' => 'Cancel',
613614
'Rename' => 'Rename',
615+
'Move' => 'Move',
614616
'Change Rights' => 'Change Rights',
615617
'Delete' => 'Delete',
616618
'Extract' => 'Extract',
@@ -621,7 +623,9 @@
621623
'YOU ARE REMOVING' => 'YOU ARE REMOVING',
622624
'Delete items' => 'Delete items',
623625
'Copy files' => 'Copy files',
626+
'Move files' => 'Move files',
624627
'Are you sure you want to copy' => 'Are you sure you want to copy',
628+
'Are you sure you want to move' => 'Are you sure you want to move',
625629
'Are you sure you want to delete' => 'Are you sure you want to delete',
626630
'into' => 'into',
627631
'existing files will be replaced' => 'existing files will be replaced',
@@ -674,6 +678,7 @@
674678
'Go to the Top of the File List' => 'Go to the Top of the File List',
675679
'Go to the Last File' => 'Go to the Last File',
676680
'Open File / Enter Directory' => 'Open File / Enter Directory',
681+
'Edit File' => 'Edit File',
677682
'Go to Parent Directory' => 'Go to Parent Directory',
678683
'Select Current File' => 'Select Current File',
679684
'Select Bunch of Files' => 'Select Bunch of Files',

0 commit comments

Comments
 (0)