|
@@ -4236,13 +4236,6 @@ function <?php echo $jsToogleFiltrProcesuFunctionName; ?>(n) {
|
|
|
$this->sendAjaxResponseJson('ajaxFileList', $_REQUEST);
|
|
$this->sendAjaxResponseJson('ajaxFileList', $_REQUEST);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- case 'FILE_REMOVE': {
|
|
|
|
|
- $args = array();
|
|
|
|
|
- $args['ID'] = V::get('ID', '', $_REQUEST);
|
|
|
|
|
- $args['filename'] = V::get('filename', '', $_POST);
|
|
|
|
|
- $this->sendAjaxResponseJson('ajaxFileRemove', $args);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
case 'filePermsRefresh': {
|
|
case 'filePermsRefresh': {
|
|
|
$this->sendAjaxResponseJson('ajaxFilePermsRefresh', $_REQUEST);
|
|
$this->sendAjaxResponseJson('ajaxFilePermsRefresh', $_REQUEST);
|
|
|
break;
|
|
break;
|
|
@@ -5056,37 +5049,6 @@ jQuery(document).ready(function(){
|
|
|
return $retJson;
|
|
return $retJson;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function ajaxFileRemove($args) {
|
|
|
|
|
- $id = V::get('ID', 0, $args, 'int');
|
|
|
|
|
- if ($id <= 0) throw new HttpException("404", 404);
|
|
|
|
|
- $filename = V::get('filename', '', $args);
|
|
|
|
|
- if (empty($filename)) throw new Exception("Nie wybrano pliku do usunięcia");
|
|
|
|
|
- $dbID = $this->_acl->getDB();
|
|
|
|
|
- $db = DB::getDB($dbID);
|
|
|
|
|
- if (!$db) throw new HttpException("No DB ({$dbID})", 406);
|
|
|
|
|
- $record = $this->_acl->buildQuery([])->getItem($id);
|
|
|
|
|
- if (!$record) throw new HttpException("No item ID({$id})", 404);
|
|
|
|
|
- if (!$this->_acl->canReadRecord($record)) throw new Exception("Brak uprawnień do odczytu");
|
|
|
|
|
- if (!$this->_acl->canWriteRecord($record)) throw new Exception("Brak uprawnień do zapisu");
|
|
|
|
|
- $tblName = $this->_acl->getName();
|
|
|
|
|
- $confTblName = "{$tblName}_COLUMN";
|
|
|
|
|
- $folderConfAll = FoldersConfig::getRawData();
|
|
|
|
|
- if (!FoldersConfig::hasConfig($confTblName)) throw new HttpException("Brak danych konfiguracyjnych ({$tblName})", 404);
|
|
|
|
|
- $folderConf = FoldersConfig::getAll($confTblName);
|
|
|
|
|
-
|
|
|
|
|
- $uploader = new FileUploader($confTblName, (object)$record);
|
|
|
|
|
- if (!$uploader->setConfig($folderConf)) throw new HttpException("Błąd danych konfiguracyjnych ({$tblName})", 404);
|
|
|
|
|
- $uploader->findFolder();
|
|
|
|
|
-
|
|
|
|
|
- $errorMsg = '';
|
|
|
|
|
- $removed = $uploader->tryRemoveFromAjax($filename, $errorMsg);
|
|
|
|
|
- if (!$removed) throw new Exception($errorMsg);
|
|
|
|
|
- $retJson = new stdClass();
|
|
|
|
|
- $retJson->type = 'SUCCESS';
|
|
|
|
|
- $retJson->msg = 'Plik został poprawnie usunięty';
|
|
|
|
|
- return $retJson;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public function ajaxFileList($args) {
|
|
public function ajaxFileList($args) {
|
|
|
$id = V::get('ID', 0, $args, 'int');
|
|
$id = V::get('ID', 0, $args, 'int');
|
|
|
if ($id <= 0) throw new HttpException("404", 404);
|
|
if ($id <= 0) throw new HttpException("404", 404);
|
|
@@ -5623,6 +5585,7 @@ jQuery(document).ready(function(){
|
|
|
]),
|
|
]),
|
|
|
]);
|
|
]);
|
|
|
$className = __CLASS__;
|
|
$className = __CLASS__;
|
|
|
|
|
+ $namespace = $acl->getNamespace();
|
|
|
UI::inlineJS(__FILE__ . '.files.js', [
|
|
UI::inlineJS(__FILE__ . '.files.js', [
|
|
|
'UNIQ_HASH' => $this->_htmlID,
|
|
'UNIQ_HASH' => $this->_htmlID,
|
|
|
'FUNCTION_FILE_LIST_UPDATE_AJAX' => "fileListUpdateAjax{$this->_htmlID}", // fileListUpdateAjax
|
|
'FUNCTION_FILE_LIST_UPDATE_AJAX' => "fileListUpdateAjax{$this->_htmlID}", // fileListUpdateAjax
|
|
@@ -5639,7 +5602,7 @@ jQuery(document).ready(function(){
|
|
|
'NODE_ID_FILES_LIST_ACTIONS' => "FILES_LIST_ACTIONS_{$this->_htmlID}",
|
|
'NODE_ID_FILES_LIST_ACTIONS' => "FILES_LIST_ACTIONS_{$this->_htmlID}",
|
|
|
'NODE_ID_FILES_MULTIPLE_UPLOAD' => "FILES_MULTIPLE_UPLOAD_{$this->_htmlID}",
|
|
'NODE_ID_FILES_MULTIPLE_UPLOAD' => "FILES_MULTIPLE_UPLOAD_{$this->_htmlID}",
|
|
|
'URL_FILE_LIST_UPDATE_AJAX' => "index-ajax.php?_zasobID={$this->_zasobID};&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_LIST&ID={$record['ID']}",
|
|
'URL_FILE_LIST_UPDATE_AJAX' => "index-ajax.php?_zasobID={$this->_zasobID};&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_LIST&ID={$record['ID']}",
|
|
|
- 'URL_FILE_REMOVE_AJAX' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=FILE_REMOVE&ID={$record['ID']}",
|
|
|
|
|
|
|
+ 'URL_FILE_REMOVE_AJAX' => "index.php?_route=ViewTableAjax&namespace={$namespace}&_task=removeFileAjax&ID={$record['ID']}",
|
|
|
'URL_CONNECTED_TABLE_LIST' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_CONN_TBL_LIST&ID={$record['ID']}",
|
|
'URL_CONNECTED_TABLE_LIST' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_CONN_TBL_LIST&ID={$record['ID']}",
|
|
|
'URL_FILE_PERMS_REFRESH' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=filePermsRefresh&ID={$record['ID']}",
|
|
'URL_FILE_PERMS_REFRESH' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=filePermsRefresh&ID={$record['ID']}",
|
|
|
'URL_FILE_UPLOAD' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_UPLOAD&ID={$record['ID']}",
|
|
'URL_FILE_UPLOAD' => "index-ajax.php?_zasobID={$this->_zasobID}&_cls={$className}&_hash={$this->_htmlID}&_task=FILES_UPLOAD&ID={$record['ID']}",
|