mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-27 18:10:42 +00:00
set the original file name will other adjust the file type
This commit is contained in:
parent
3bedbd48a8
commit
580fa92393
|
|
@ -694,20 +694,28 @@ switch($command) {
|
||||||
$document = $content->getDocument();
|
$document = $content->getDocument();
|
||||||
if ($document->getAccessMode($user) >= M_READWRITE) {
|
if ($document->getAccessMode($user) >= M_READWRITE) {
|
||||||
$oldname = $content->getOriginalFileName();
|
$oldname = $content->getOriginalFileName();
|
||||||
if (!$content->setOriginalFilename($_REQUEST['name'])) {
|
$newname = trim($_REQUEST['name']);
|
||||||
header('Content-Type: application/json');
|
if ($oldname != $newname) {
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error setting original file name', 'data'=>''));
|
if (!$content->setOriginalFilename($newname)) {
|
||||||
} else {
|
header('Content-Type: application/json');
|
||||||
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
|
echo json_encode(array('success'=>false, 'message'=>'Error setting original file name', 'data'=>''));
|
||||||
$lucenesearch = $fulltextservice->Search();
|
} else {
|
||||||
if($hit = $lucenesearch->getDocument($document->getId())) {
|
$fileType = pathinfo($newname, PATHINFO_EXTENSION);
|
||||||
$index->reindexDocument($hit->id);
|
$content->setFileType($fileType);
|
||||||
$index->commit();
|
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
|
||||||
|
$lucenesearch = $fulltextservice->Search();
|
||||||
|
if($hit = $lucenesearch->getDocument($document->getId())) {
|
||||||
|
$index->reindexDocument($hit->id);
|
||||||
|
$index->commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_orig_filename_changed'), 'data'=>''));
|
||||||
|
add_log_line("set original filename '".$_REQUEST['name']."' of document ".$document->getId().":".$content->getVersion());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_orig_filename_changed'), 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_orig_filename_unchanged'), 'data'=>''));
|
||||||
add_log_line("set original filename '".$_REQUEST['name']."' of document ".$document->getId().":".$content->getVersion());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user