/
upload_complete.php
54 lines (47 loc) · 1.73 KB
/
upload_complete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Concrete\Controller\Dialog\File;
use Concrete\Controller\Dialog\File\Bulk\Properties as BulkPropertiesController;
class UploadComplete extends BulkPropertiesController
{
protected $viewPath = '/dialogs/file/upload_complete';
protected function checkPermissions($file)
{
$fp = new \Permissions($file);
return $fp->canViewFileInFileManager();
}
public function view()
{
parent::view();
$this->requireAsset('javascript', 'jquery/tristate');
$sets = array();
$ids = array();
$canEditFiles = true;
foreach ($this->files as $file) {
$fp = new \Permissions($file);
if (!$fp->canEditFileProperties()) {
$canEditFiles = false;
}
$ids[] = $file->getFileID();
foreach ($file->getFileSets() as $set) {
$o = $set->getJSONObject();
if (!in_array($o, $sets)) {
$sets[] = $o;
}
}
}
$this->set('canEditFiles', $canEditFiles);
$this->set('filesets', $sets);
$this->set('fileIDs', $ids);
if (count($this->files) == 1) {
$propertiesController = new Properties();
$propertiesController->setFileObject($this->files[0]);
$propertiesController->on_start();
$this->set('propertiesController', $propertiesController);
}
$bulkPropertiesController = new BulkPropertiesController();
$bulkPropertiesController->setFiles($this->files);
$bulkPropertiesController->on_start();
// stupid hoops we have to go through due to tokens
$this->set('bulkPropertiesController', $bulkPropertiesController);
}
}