mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-27 18:10:42 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
5d8f63a33c
|
|
@ -349,6 +349,7 @@
|
||||||
already (in menu task list and document list)
|
already (in menu task list and document list)
|
||||||
- break long original file names on viewDocument page
|
- break long original file names on viewDocument page
|
||||||
- fix potential XSS attack in many fields of settings
|
- fix potential XSS attack in many fields of settings
|
||||||
|
- allow to edit original filename
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.1.40
|
Changes in version 5.1.40
|
||||||
|
|
|
||||||
|
|
@ -691,6 +691,44 @@ switch($command) {
|
||||||
}
|
}
|
||||||
break; /* }}} */
|
break; /* }}} */
|
||||||
|
|
||||||
|
case 'setoriginalname': /* {{{ */
|
||||||
|
if($user && $user->isAdmin()) {
|
||||||
|
if(checkFormKey('setoriginalname')) {
|
||||||
|
$content = $dms->getDocumentContent($_REQUEST['contentid']);
|
||||||
|
if($content) {
|
||||||
|
$document = $content->getDocument();
|
||||||
|
if ($document->getAccessMode($user) >= M_READWRITE) {
|
||||||
|
$oldname = $content->getOriginalFileName();
|
||||||
|
if (!$content->setOriginalFilename($_REQUEST['name'])) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>'Error setting original file name', 'data'=>''));
|
||||||
|
} else {
|
||||||
|
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');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>getMLText('access_denied'), 'data'=>''));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_doc_id'), 'data'=>''));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break; /* }}} */
|
||||||
|
|
||||||
case 'setmimetype': /* {{{ */
|
case 'setmimetype': /* {{{ */
|
||||||
if($user && $user->isAdmin()) {
|
if($user && $user->isAdmin()) {
|
||||||
if(checkFormKey('setmimetype', 'GET')) {
|
if(checkFormKey('setmimetype', 'GET')) {
|
||||||
|
|
|
||||||
|
|
@ -2706,6 +2706,22 @@ $(function() {
|
||||||
echo $text;
|
echo $text;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrap text in inline editing tags
|
||||||
|
*
|
||||||
|
* @param string text
|
||||||
|
*/
|
||||||
|
function printInlineEditOriginalName($text, $object){ /* {{{ */
|
||||||
|
if(!empty($this->params['settings']->_inlineEditing)) {
|
||||||
|
echo "<span class=\"editorigname editable\" contenteditable=\"true\"";
|
||||||
|
if($object->isType('documentcontent'))
|
||||||
|
echo " data-content=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setoriginalname')."\"";
|
||||||
|
echo ">".$text;
|
||||||
|
echo "</span>\n";
|
||||||
|
} else
|
||||||
|
echo $text;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print button with link for deleting a document
|
* Print button with link for deleting a document
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -777,7 +777,16 @@ $(document).ready( function() {
|
||||||
$this->columnEnd();
|
$this->columnEnd();
|
||||||
$this->columnStart(5);
|
$this->columnStart(5);
|
||||||
print "<ul class=\"actions unstyled\">\n";
|
print "<ul class=\"actions unstyled\">\n";
|
||||||
print "<li style=\"overflow-wrap: break-word;\">".htmlspecialchars($latestContent->getOriginalFileName())."</li>\n";
|
print "<li style=\"overflow-wrap: break-word;\">";
|
||||||
|
if ($latestContent->getDocument()->getAccessMode($user) >= M_READWRITE) {
|
||||||
|
$this->printInlineEditOriginalName(htmlspecialchars($latestContent->getOriginalFileName()), $latestContent);
|
||||||
|
} else {
|
||||||
|
print htmlspecialchars($latestContent->getOriginalFileName());
|
||||||
|
}
|
||||||
|
if(!$latestContent->checkOriginalFileName()) {
|
||||||
|
echo " <i class=\"fa fa-exclamation-triangle\" title=\"".getMLText('problematic_filename')."\"></i> ";
|
||||||
|
}
|
||||||
|
print "</li>\n";
|
||||||
print "<li>".getMLText('version').": ".$latestContent->getVersion()."</li>\n";
|
print "<li>".getMLText('version').": ".$latestContent->getVersion()."</li>\n";
|
||||||
|
|
||||||
if ($file_exists) {
|
if ($file_exists) {
|
||||||
|
|
|
||||||
|
|
@ -736,6 +736,21 @@ $(document).ready( function() {
|
||||||
});
|
});
|
||||||
}); /* }}} */
|
}); /* }}} */
|
||||||
|
|
||||||
|
$("body").on("blur", "span.editorigname", function(e) { /* {{{ */
|
||||||
|
e.preventDefault();
|
||||||
|
$.post(seeddms_webroot+"op/op.Ajax.php", { command: "setoriginalname", contentid: $(this).data('content'), formtoken: $(this).data('formtoken'), name: $(this).text() })
|
||||||
|
.done(function( data ) {
|
||||||
|
noty({
|
||||||
|
text: data.message,
|
||||||
|
type: data.success ? 'success' : 'error',
|
||||||
|
dismissQueue: true,
|
||||||
|
layout: 'topRight',
|
||||||
|
theme: 'defaultTheme',
|
||||||
|
timeout: 1500
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}); /* }}} */
|
||||||
|
|
||||||
$("body").on("keypress", "span.editable", function(e) { /* {{{ */
|
$("body").on("keypress", "span.editable", function(e) { /* {{{ */
|
||||||
if(e.which == 13) {
|
if(e.which == 13) {
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
|
|
|
||||||
|
|
@ -2656,6 +2656,22 @@ $(function() {
|
||||||
echo $text;
|
echo $text;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrap text in inline editing tags
|
||||||
|
*
|
||||||
|
* @param string text
|
||||||
|
*/
|
||||||
|
function printInlineEditOriginalName($text, $object){ /* {{{ */
|
||||||
|
if(!empty($this->params['settings']->_inlineEditing)) {
|
||||||
|
echo "<span class=\"editorigname editable\" contenteditable=\"true\"";
|
||||||
|
if($object->isType('documentcontent'))
|
||||||
|
echo " data-content=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setoriginalname')."\"";
|
||||||
|
echo ">".$text;
|
||||||
|
echo "</span>\n";
|
||||||
|
} else
|
||||||
|
echo $text;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print button with link for deleting a document
|
* Print button with link for deleting a document
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -784,6 +784,21 @@ $(document).ready( function() {
|
||||||
});
|
});
|
||||||
}); /* }}} */
|
}); /* }}} */
|
||||||
|
|
||||||
|
$("body").on("blur", "span.editorigname", function(e) { /* {{{ */
|
||||||
|
e.preventDefault();
|
||||||
|
$.post(seeddms_webroot+"op/op.Ajax.php", { command: "setoriginalname", contentid: $(this).data('content'), formtoken: $(this).data('formtoken'), name: $(this).text() })
|
||||||
|
.done(function( data ) {
|
||||||
|
noty({
|
||||||
|
text: data.message,
|
||||||
|
type: data.success ? 'success' : 'error',
|
||||||
|
dismissQueue: true,
|
||||||
|
layout: 'topRight',
|
||||||
|
theme: 'defaultTheme',
|
||||||
|
timeout: 1500
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}); /* }}} */
|
||||||
|
|
||||||
$("body").on("keypress", "span.editable", function(e) { /* {{{ */
|
$("body").on("keypress", "span.editable", function(e) { /* {{{ */
|
||||||
if(e.which == 13) {
|
if(e.which == 13) {
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user