mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge branch 'seeddms-4.3.9' into develop
Conflicts: views/bootstrap/class.Bootstrap.php views/bootstrap/class.ViewFolder.php
This commit is contained in:
commit
58cdecfe21
|
@ -14,8 +14,10 @@
|
|||
- admins can edit their account details even if 'self edit' is turned off
|
||||
- consistent handling of document locking
|
||||
- op/op.ViewOnline.php returns the latest version if version<1
|
||||
- delete document with ajax call when clicking on cross-icon in document list
|
||||
- delete document/folder with ajax call when clicking on cross-icon in
|
||||
document list (ViewFolder and Search)
|
||||
- critical ajax calls require form token to be set
|
||||
- fix drag and drop from clipboard
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 4.3.8
|
||||
|
|
|
@ -275,6 +275,34 @@ switch($command) {
|
|||
}
|
||||
break; /* }}} */
|
||||
|
||||
case 'deletefolder': /* {{{ */
|
||||
if($user) {
|
||||
if(!checkFormKey('removefolder', 'GET')) {
|
||||
header('Content-Type', 'application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||
} else {
|
||||
$folder = $dms->getFolder($_REQUEST['id']);
|
||||
if($folder) {
|
||||
if ($folder->getAccessMode($user) >= M_READWRITE) {
|
||||
if($folder->remove()) {
|
||||
header('Content-Type', 'application/json');
|
||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''.$_REQUEST['formtoken']));
|
||||
} else {
|
||||
header('Content-Type', 'application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'Error removing folder', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type', 'application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No access', 'data'=>''));
|
||||
}
|
||||
} else {
|
||||
header('Content-Type', 'application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>'No folder', 'data'=>''));
|
||||
}
|
||||
}
|
||||
}
|
||||
break; /* }}} */
|
||||
|
||||
case 'deletedocument': /* {{{ */
|
||||
if($user) {
|
||||
if(!checkFormKey('removedocument', 'GET')) {
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
|
||||
$(document).ready( function() {
|
||||
/* close popovers when clicking somewhere except in the popover or the
|
||||
* remove icon
|
||||
*/
|
||||
$('html').on('click', function(e) {
|
||||
if (typeof $(e.target).data('original-title') == 'undefined' && !$(e.target).parents().is('.popover.in') && !$(e.target).is('.icon-remove')) {
|
||||
$('[data-original-title]').popover('hide');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('hidden', '.modal', function () {
|
||||
$(this).removeData('modal');
|
||||
});
|
||||
|
@ -15,6 +24,9 @@ $(document).ready( function() {
|
|||
$(".chzn-select").chosen();
|
||||
$(".chzn-select-deselect").chosen({allow_single_deselect:true});
|
||||
|
||||
/* change the color and length of the bar graph showing the password
|
||||
* strength on each change to the passwod field.
|
||||
*/
|
||||
$(".pwd").passStrength({
|
||||
url: "../op/op.Ajax.php",
|
||||
onChange: function(data, target) {
|
||||
|
@ -154,6 +166,41 @@ $(document).ready( function() {
|
|||
);
|
||||
});
|
||||
|
||||
$('body').on('click', 'button.removefolder', function(ev){
|
||||
ev.preventDefault();
|
||||
attr_rel = $(ev.currentTarget).attr('rel');
|
||||
attr_msg = $(ev.currentTarget).attr('msg');
|
||||
attr_formtoken = $(ev.currentTarget).attr('formtoken');
|
||||
id = attr_rel;
|
||||
$.get('../op/op.Ajax.php',
|
||||
{ command: 'deletefolder', id: id, formtoken: attr_formtoken },
|
||||
function(data) {
|
||||
// console.log(data);
|
||||
if(data.success) {
|
||||
$('#table-row-folder-'+id).hide('slow');
|
||||
noty({
|
||||
text: attr_msg,
|
||||
type: 'success',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
timeout: 1500,
|
||||
});
|
||||
} else {
|
||||
noty({
|
||||
text: data.message,
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
timeout: 3500,
|
||||
});
|
||||
}
|
||||
},
|
||||
'json'
|
||||
);
|
||||
});
|
||||
|
||||
$('a.addtoclipboard').click(function(ev){
|
||||
ev.preventDefault();
|
||||
attr_rel = $(ev.currentTarget).attr('rel');
|
||||
|
|
|
@ -1295,13 +1295,13 @@ $(function() {
|
|||
if (file_exists($dms->contentDir . $latestContent->getPath())) {
|
||||
print "<td><a rel=\"document_".$docid."\" draggable=\"true\" ondragstart=\"onDragStartDocument(event);\" href=\"../op/op.Download.php?documentid=".$docid."&version=".$version."\">";
|
||||
if($previewer->hasPreview($latestContent)) {
|
||||
print "<img class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
||||
print "<img draggable=\"false\" class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
||||
} else {
|
||||
print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
||||
print "<img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
|
||||
}
|
||||
print "</a></td>";
|
||||
} else
|
||||
print "<td><img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>";
|
||||
print "<td><img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>";
|
||||
|
||||
print "<td><a href=\"out.ViewDocument.php?documentid=".$docid."&showtree=".showtree()."\">" . htmlspecialchars($document->getName()) . "</a>";
|
||||
if($comment) {
|
||||
|
@ -1322,17 +1322,56 @@ $(function() {
|
|||
echo "</div>\n";
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Print button with link for deleting a document
|
||||
*
|
||||
* This button is used in document listings (e.g. on the ViewFolder page)
|
||||
* for deleting a document. In seeddms version < 4.3.9 this was just a
|
||||
* link to the out/out.RemoveDocument.php page which asks for confirmation
|
||||
* an than calls op/op.RemoveDocument.php. Starting with version 4.3.9
|
||||
* the button just opens a small popup asking for confirmation and than
|
||||
* calls the ajax command 'deletedocument'. The ajax call is called
|
||||
* in the click function of 'button.removedocument'. That button needs
|
||||
* to have two attributes: 'rel' for the id of the document, and 'msg'
|
||||
* for the message shown by notify if the document could be deleted.
|
||||
*
|
||||
* @param object $document document to be deleted
|
||||
* @param string $msg message shown in case of successful deletion
|
||||
*/
|
||||
function printDeleteDocumentButton($document, $msg){ /* {{{ */
|
||||
$docid = $document->getID();
|
||||
?>
|
||||
<a id="delete-btn-<?php echo $docid; ?>" rel="<?php echo $docid; ?>" msg="<?php printMLText($msg); ?>"><i class="icon-remove"></i></a>
|
||||
<a id="delete-document-btn-<?php echo $docid; ?>" rel="<?php echo $docid; ?>" msg="<?php printMLText($msg); ?>"><i class="icon-remove"></i></a>
|
||||
<?php
|
||||
$this->addFooterJS("
|
||||
$('#delete-btn-".$docid."').popover({
|
||||
$('#delete-document-btn-".$docid."').popover({
|
||||
title: '".getMLText("rm_document")."',
|
||||
placement: 'left',
|
||||
html: true,
|
||||
content: '<div>".getMLText("confirm_rm_document", array ("documentname" => htmlspecialchars($document->getName())))."</div><!-- div><form action=\"../op/op.RemoveDocument.php\" name=\"form1\" method=\"post\"><input type=\"hidden\" name=\"documentid\" value=\"".$docid."\">".createHiddenFieldWithKey('removedocument')."<button type=\"submit\" class=\"btn btn-danger\" style=\"float: right; margin:10px 0px;\"><i class=\"icon-remove\"></i> ".getMLText("rm_document")."</button></form --><button class=\"btn btn-danger removedocument\" style=\"float: right; margin:10px 0px;\" rel=\"".$docid."\" msg=\"".getMLText($msg)."\" formtoken=\"".createFormKey('removedocument')."\" id=\"confirm-delete-btn-".$docid."\"><i class=\"icon-remove\"></i> ".getMLText("rm_document")."</button></div>'});
|
||||
content: '<div>".getMLText("confirm_rm_document", array ("documentname" => htmlspecialchars($document->getName(), ENT_QUOTES)))."</div><div><button class=\"btn btn-danger removedocument\" style=\"float: right; margin:10px 0px;\" rel=\"".$docid."\" msg=\"".getMLText($msg)."\" formtoken=\"".createFormKey('removedocument')."\" id=\"confirm-delete-document-btn-".$docid."\"><i class=\"icon-remove\"></i> ".getMLText("rm_document")."</button> <button type=\"button\" class=\"btn\" style=\"float: right; margin:10px 10px;\" onclick=\"$("#delete-document-btn-".$docid."").popover("hide");\">".getMLText('cancel')."</button></div>'});
|
||||
");
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Print button with link for deleting a folder
|
||||
*
|
||||
* This button works like document delete button
|
||||
* {@link SeedDMS_Bootstrap_Style::printDeleteDocumentButton()}
|
||||
*
|
||||
* @param object $folder folder to be deleted
|
||||
* @param string $msg message shown in case of successful deletion
|
||||
*/
|
||||
function printDeleteFolderButton($folder, $msg){ /* {{{ */
|
||||
$folderid = $folder->getID();
|
||||
?>
|
||||
<a id="delete-folder-btn-<?php echo $folderid; ?>" rel="<?php echo $folderid; ?>" msg="<?php printMLText($msg); ?>"><i class="icon-remove"></i></a>
|
||||
<?php
|
||||
$this->addFooterJS("
|
||||
$('#delete-folder-btn-".$folderid."').popover({
|
||||
title: '".getMLText("rm_folder")."',
|
||||
placement: 'left',
|
||||
html: true,
|
||||
content: '<div>".getMLText("confirm_rm_folder", array ("foldername" => htmlspecialchars($folder->getName(), ENT_QUOTES)))."</div><div><button class=\"btn btn-danger removefolder\" style=\"float: right; margin:10px 0px;\" rel=\"".$folderid."\" msg=\"".getMLText($msg)."\" formtoken=\"".createFormKey('removefolder')."\" id=\"confirm-delete-folder-btn-".$folderid."\"><i class=\"icon-remove\"></i> ".getMLText("rm_folder")."</button> <button type=\"button\" class=\"btn\" style=\"float: right; margin:10px 10px;\" onclick=\"$("#delete-folder-btn-".$folderid."").popover("hide");\">".getMLText('cancel')."</button></div>'});
|
||||
");
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -428,6 +428,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
|
|||
} else {
|
||||
$folderName = htmlspecialchars($folder->getName());
|
||||
}
|
||||
print "<tr id=\"table-row-folder-".$folder->getID()."\" rel=\"folder_".$folder->getID()."\" class=\"folder\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">";
|
||||
print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\"><img src=\"".$this->imgpath."folder.png\" width=\"24\" height=\"24\" border=0></a></td>";
|
||||
print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\">";
|
||||
$path = $folder->getPath();
|
||||
|
@ -459,9 +460,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
|
|||
print "<td>";
|
||||
print "<div class=\"list-action\">";
|
||||
if($folder->getAccessMode($user) >= M_ALL) {
|
||||
?>
|
||||
<a class_="btn btn-mini" href="../out/out.RemoveFolder.php?folderid=<?php echo $folder->getID(); ?>"><i class="icon-remove"></i></a>
|
||||
<?php
|
||||
$this->printDeleteFolderButton($folder, 'splash_rm_folder');
|
||||
} else {
|
||||
?>
|
||||
<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>
|
||||
|
|
|
@ -244,7 +244,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
|
|||
$subdoc = $subFolder->getDocuments();
|
||||
$subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ);
|
||||
|
||||
print "<tr rel=\"folder_".$subFolder->getID()."\" class=\"folder\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">";
|
||||
print "<tr id=\"table-row-folder-".$subFolder->getID()."\" rel=\"folder_".$subFolder->getID()."\" class=\"folder\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">";
|
||||
// print "<td><img src=\"images/folder_closed.gif\" width=18 height=18 border=0></td>";
|
||||
print "<td><a rel=\"folder_".$subFolder->getID()."\" draggable=\"true\" ondragstart=\"onDragStartFolder(event);\" href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"><img draggable=\"false\" src=\"".$this->imgpath."folder.png\" width=\"24\" height=\"24\" border=0></a></td>\n";
|
||||
print "<td><a href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>";
|
||||
|
@ -278,9 +278,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
|
|||
print "<td>";
|
||||
print "<div class=\"list-action\">";
|
||||
if($subFolder->getAccessMode($user) >= M_ALL) {
|
||||
?>
|
||||
<a class_="btn btn-mini" href="../out/out.RemoveFolder.php?folderid=<?php echo $subFolder->getID(); ?>"><i class="icon-remove"></i></a>
|
||||
<?php
|
||||
$this->printDeleteFolderButton($subFolder, 'splash_rm_folder');
|
||||
} else {
|
||||
?>
|
||||
<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>
|
||||
|
|
Loading…
Reference in New Issue
Block a user