mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
532db722a6
|
@ -232,6 +232,10 @@
|
|||
- add chart with number of folders per document
|
||||
- add number of links, attachments, versions of a selected user in the user
|
||||
manager
|
||||
- add support for drag and drop of attachments
|
||||
- show all folders in tree when selecting a target folder for move operations
|
||||
even if they are not writable, otherwise sub folders may not appear in the
|
||||
tree, because parent folders are not writable
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.22
|
||||
|
|
|
@ -912,6 +912,83 @@ switch($command) {
|
|||
}
|
||||
break; /* }}} */
|
||||
|
||||
case 'addfile': /* {{{ */
|
||||
if($user) {
|
||||
if(checkFormKey('addfile')) {
|
||||
if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_doc_id")));
|
||||
exit;
|
||||
}
|
||||
|
||||
$documentid = $_POST["documentid"];
|
||||
$document = $dms->getDocument($documentid);
|
||||
|
||||
if (!is_object($document)) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_doc_id")));
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($document->getAccessMode($user, 'addDocumentFile') < M_READWRITE) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText("access_denied")));
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!is_uploaded_file($_FILES["userfile"]["tmp_name"]) || $_FILES['userfile']['error']!=0){
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_failed")));
|
||||
exit;
|
||||
}
|
||||
if ($_FILES["userfile"]["size"]==0) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_zerosize")));
|
||||
exit;
|
||||
}
|
||||
|
||||
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
|
||||
if ($maxuploadsize && $_FILES["userfile"]["size"] > $maxuploadsize) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_maxsize")));
|
||||
exit;
|
||||
}
|
||||
|
||||
$userfiletmp = $_FILES["userfile"]["tmp_name"];
|
||||
$userfiletype = $_FILES["userfile"]["type"];
|
||||
$userfilename = $_FILES["userfile"]["name"];
|
||||
|
||||
$fileType = ".".pathinfo($userfilename, PATHINFO_EXTENSION);
|
||||
|
||||
if($settings->_overrideMimeType) {
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$userfiletype = finfo_file($finfo, $userfiletmp);
|
||||
}
|
||||
|
||||
if (!empty($_POST["name"]))
|
||||
$name = $_POST["name"];
|
||||
else
|
||||
$name = utf8_basename($userfilename);
|
||||
$comment = '';
|
||||
$version = 0;
|
||||
$public = false;
|
||||
$res = $document->addDocumentFile($name, $comment, $user, $userfiletmp,
|
||||
utf8_basename($userfilename),$fileType, $userfiletype, $version, $public);
|
||||
if (is_bool($res) && !$res) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText('error_occured'), 'data'=>''));
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_added'), 'data'=>$document->getID()));
|
||||
add_log_line();
|
||||
}
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('success'=>false, 'message'=>getMLText('invalid_request_token'), 'data'=>''));
|
||||
}
|
||||
}
|
||||
break; /* }}} */
|
||||
|
||||
case 'indexdocument':
|
||||
case 'indexfolder': /* {{{ */
|
||||
if($user && $user->isAdmin()) {
|
||||
|
|
|
@ -79,6 +79,7 @@ if($view) {
|
|||
$view->setParam('viewonlinefiletypes', $settings->_viewOnlineFileTypes);
|
||||
$view->setParam('enablereceiptworkflow', $settings->_enableReceiptWorkflow);
|
||||
$view->setParam('enablerevisionworkflow', $settings->_enableRevisionWorkflow);
|
||||
$view->setParam('enableDropUpload', $settings->_enableDropUpload);
|
||||
$view->setParam('enableownerrevapp', $settings->_enableOwnerRevApp);
|
||||
$view->setParam('enableremoverevapp', $settings->_enableRemoveRevApp);
|
||||
$view->setParam('enableownerreceipt', $settings->_enableOwnerReceipt);
|
||||
|
|
|
@ -2121,10 +2121,10 @@ $(document).ready(function() {
|
|||
$this->contentStart();
|
||||
}
|
||||
|
||||
print "<div class=\"alert alert-error\">";
|
||||
print "<h4>".getMLText('error')."!</h4>";
|
||||
print htmlspecialchars($error);
|
||||
print "</div>";
|
||||
$html = '';
|
||||
$html .= "<h4>".getMLText('error')."!</h4>";
|
||||
$html .= htmlspecialchars($error);
|
||||
$this->errorMsg($html);
|
||||
if(!$plain) {
|
||||
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
|
||||
|
||||
|
@ -3298,10 +3298,10 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
|||
$this->contentStart();
|
||||
}
|
||||
|
||||
print "<div class=\"alert alert-error\">";
|
||||
print "<h4>".getMLText('error')."!</h4>";
|
||||
print htmlspecialchars($errormsg);
|
||||
print "</div>";
|
||||
$html = '';
|
||||
$html .= "<h4>".getMLText('error')."!</h4>";
|
||||
$html .= htmlspecialchars($errormsg);
|
||||
$this->errorMsg($html);
|
||||
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
|
||||
|
||||
$this->contentEnd();
|
||||
|
|
|
@ -94,9 +94,7 @@ class SeedDMS_View_ImportFS extends SeedDMS_Theme_Style {
|
|||
print "</form>\n";
|
||||
$this->contentContainerEnd();
|
||||
} else {
|
||||
echo "<div class=\"alert alert-warning\">";
|
||||
printMLText("dropfolderdir_missing");
|
||||
echo "</div>\n";
|
||||
$this->warningMsg(getMLText("dropfolderdir_missing"));
|
||||
}
|
||||
|
||||
$this->contentEnd();
|
||||
|
|
|
@ -55,7 +55,7 @@ class SeedDMS_View_MoveDocument extends SeedDMS_Theme_Style {
|
|||
<input type="hidden" name="documentid" value="<?php print $document->getID();?>">
|
||||
<?php
|
||||
$this->contentContainerStart('warning');
|
||||
$this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READWRITE, -1, $target));
|
||||
$this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READ, -1, $target));
|
||||
$this->contentContainerEnd();
|
||||
$this->formSubmit(getMLText('move'));
|
||||
?>
|
||||
|
|
|
@ -56,7 +56,7 @@ class SeedDMS_View_MoveFolder extends SeedDMS_Theme_Style {
|
|||
<input type="hidden" name="showtree" value="<?php echo showtree();?>">
|
||||
<?php
|
||||
$this->contentContainerStart();
|
||||
$this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READWRITE, $folder->getID(), $target));
|
||||
$this->formField(getMLText("choose_target_folder"), $this->getFolderChooserHtml("form1", M_READ, $folder->getID(), $target));
|
||||
$this->contentContainerEnd();
|
||||
$this->formSubmit(getMLText('move_folder'));
|
||||
?>
|
||||
|
|
|
@ -39,11 +39,7 @@ class SeedDMS_View_TransferObjects extends SeedDMS_Theme_Style {
|
|||
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
||||
$this->contentHeading(getMLText("transfer_objects"));
|
||||
|
||||
?>
|
||||
<div class="alert">
|
||||
<?php printMLText("confirm_transfer_objects", array ("username" => htmlspecialchars($rmuser->getFullName())));?>
|
||||
</div>
|
||||
<?php
|
||||
$this->warningMsg(getMLText("confirm_transfer_objects", array ("username" => htmlspecialchars($rmuser->getFullName()))));
|
||||
$this->contentContainerStart();
|
||||
?>
|
||||
<form class="form-horizontal" action="../op/op.UsrMgr.php" name="form1" method="post">
|
||||
|
|
|
@ -166,24 +166,23 @@ console.log(element);
|
|||
|
||||
$lockingUser = $document->getLockingUser();
|
||||
|
||||
print "<div class=\"alert alert-warning\">";
|
||||
|
||||
printMLText("update_locked_msg", array("username" => htmlspecialchars($lockingUser->getFullName()), "email" => $lockingUser->getEmail()));
|
||||
$html = '';
|
||||
$html .= getMLText("update_locked_msg", array("username" => htmlspecialchars($lockingUser->getFullName()), "email" => $lockingUser->getEmail())).' ';
|
||||
|
||||
if ($lockingUser->getID() == $user->getID())
|
||||
printMLText("unlock_cause_locking_user");
|
||||
$html .= getMLText("unlock_cause_locking_user");
|
||||
else if ($document->getAccessMode($user) == M_ALL)
|
||||
printMLText("unlock_cause_access_mode_all");
|
||||
$html .= getMLText("unlock_cause_access_mode_all");
|
||||
else
|
||||
{
|
||||
printMLText("no_update_cause_locked");
|
||||
print "</div>";
|
||||
$html .= getMLText("no_update_cause_locked");
|
||||
$this->warningMsg($html);
|
||||
$this->contentEnd();
|
||||
$this->htmlEndPage();
|
||||
exit;
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
$this->warningMsg($html);
|
||||
}
|
||||
|
||||
$latestContent = $document->getLatestContent();
|
||||
|
|
|
@ -180,6 +180,8 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$document = $this->params['document'];
|
||||
$enableDropUpload = $this->params['enableDropUpload'];
|
||||
$maxuploadsize = $this->params['maxuploadsize'];
|
||||
|
||||
header('Content-Type: application/javascript; charset=UTF-8');
|
||||
parent::jsTranslations(array('js_form_error', 'js_form_errors', 'cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
|
||||
|
@ -202,6 +204,17 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
$this->printDeleteDocumentButtonJs();
|
||||
/* Add js for catching click on document in one page mode */
|
||||
$this->printClickDocumentJs();
|
||||
if ($enableDropUpload && $document->getAccessMode($user) >= M_READWRITE) {
|
||||
echo "SeedDMSUpload.setUrl('".$this->params['settings']->_httpRoot."op/op.Ajax.php');";
|
||||
echo "SeedDMSUpload.setAbortBtnLabel('".getMLText("cancel")."');";
|
||||
echo "SeedDMSUpload.setEditBtnLabel('');";
|
||||
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
|
||||
if($maxuploadsize && $maxuploadsize < $mus2)
|
||||
echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);\n";
|
||||
else
|
||||
echo "SeedDMSUpload.setMaxFileSize($mus2);\n";
|
||||
echo "SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');";
|
||||
}
|
||||
?>
|
||||
$(document).ready( function() {
|
||||
$("#form1").validate({
|
||||
|
@ -219,6 +232,111 @@ $(document).ready( function() {
|
|||
<?php
|
||||
} /* }}} */
|
||||
|
||||
function documentFiles() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$document = $this->params['document'];
|
||||
$accessobject = $this->params['accessobject'];
|
||||
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$previewwidthdetail = $this->params['previewWidthDetail'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
$xsendfile = $this->params['xsendfile'];
|
||||
$documentid = $document->getId();
|
||||
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
||||
$previewer->setConverters($previewconverters);
|
||||
$latestContent = $this->callHook('documentLatestContent', $document);
|
||||
if($latestContent === null)
|
||||
$latestContent = $document->getLatestContent();
|
||||
$files = $document->getDocumentFiles($latestContent->getVersion());
|
||||
$files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files);
|
||||
|
||||
if (count($files) > 0) {
|
||||
|
||||
print "<table class=\"table\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th width='20%'></th>\n";
|
||||
print "<th width='20%'>".getMLText("file")."</th>\n";
|
||||
print "<th width='40%'>".getMLText("comment")."</th>\n";
|
||||
print "<th width='20%'></th>\n";
|
||||
print "</tr>\n</thead>\n<tbody>\n";
|
||||
|
||||
foreach($files as $file) {
|
||||
|
||||
$file_exists=file_exists($dms->contentDir . $file->getPath());
|
||||
|
||||
$responsibleUser = $file->getUser();
|
||||
|
||||
print "<tr>";
|
||||
print "<td>";
|
||||
$previewer->createPreview($file, $previewwidthdetail);
|
||||
if($file_exists) {
|
||||
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
|
||||
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
|
||||
print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">";
|
||||
}
|
||||
} else {
|
||||
if($accessobject->check_controller_access('Download', array('action'=>'file'))) {
|
||||
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($previewer->hasPreview($file)) {
|
||||
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">");
|
||||
} else {
|
||||
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
|
||||
}
|
||||
if($file_exists) {
|
||||
if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
|
||||
print "</a>";
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print "<td><ul class=\"actions unstyled\">\n";
|
||||
print "<li>".htmlspecialchars($file->getName())."</li>\n";
|
||||
if($file->getName() != $file->getOriginalFileName())
|
||||
print "<li>".htmlspecialchars($file->getOriginalFileName())."</li>\n";
|
||||
if ($file_exists)
|
||||
print "<li>".SeedDMS_Core_File::format_filesize(filesize($dms->contentDir . $file->getPath())) ." bytes, ".htmlspecialchars($file->getMimeType())."</li>";
|
||||
else print "<li>".htmlspecialchars($file->getMimeType())." - <span class=\"warning\">".getMLText("document_deleted")."</span></li>";
|
||||
|
||||
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".htmlspecialchars($responsibleUser->getEmail())."\">".htmlspecialchars($responsibleUser->getFullName())."</a></li>";
|
||||
print "<li>".getLongReadableDate($file->getDate())."</li>";
|
||||
if($file->getVersion())
|
||||
print "<li>".getMLText('linked_to_current_version')."</li>";
|
||||
else
|
||||
print "<li>".getMLText('linked_to_document')."</li>";
|
||||
print "</ul></td>";
|
||||
print "<td>".htmlspecialchars($file->getComment())."</td>";
|
||||
|
||||
print "<td><ul class=\"unstyled actions\">";
|
||||
if ($file_exists) {
|
||||
if($accessobject->check_controller_access('Download', array('action'=>'file'))) {
|
||||
print "<li><a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><i class=\"fa fa-download\"></i>".getMLText('download')."</a></li>";
|
||||
}
|
||||
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
|
||||
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
|
||||
print "<li><a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\"><i class=\"fa fa-star\"></i>" . getMLText("view_online") . "</a></li>";
|
||||
}
|
||||
}
|
||||
} else print "<li><img class=\"mimeicon\" src=\"images/icons/".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
|
||||
echo "</ul><ul class=\"unstyled actions\">";
|
||||
if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) {
|
||||
print $this->html_link('RemoveDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), '<i class="fa fa-remove"></i>'.getMLText("delete"), false, true, array('<li>', '</li>'));
|
||||
print $this->html_link('EditDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), '<i class="fa fa-edit"></i>'.getMLText("edit"), false, true, array('<li>', '</li>'));
|
||||
}
|
||||
print "</ul></td>";
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
print "</tbody>\n</table>\n";
|
||||
|
||||
}
|
||||
else $this->infoMsg(getMLText("no_attached_files"));
|
||||
} /* }}} */
|
||||
|
||||
function documentInfos() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -700,6 +818,7 @@ $(document).ready( function() {
|
|||
$document = $this->params['document'];
|
||||
$accessobject = $this->params['accessobject'];
|
||||
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
||||
$enableDropUpload = $this->params['enableDropUpload'];
|
||||
$enableownerrevapp = $this->params['enableownerrevapp'];
|
||||
$enableremoverevapp = $this->params['enableremoverevapp'];
|
||||
$enableownerreceipt = $this->params['enableownerreceipt'];
|
||||
|
@ -739,11 +858,7 @@ $(document).ready( function() {
|
|||
if(is_string($txt))
|
||||
echo $txt;
|
||||
else {
|
||||
?>
|
||||
<div class="alert alert-warning">
|
||||
<?php printMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName())));?>
|
||||
</div>
|
||||
<?php
|
||||
$this->warningMsg(getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1658,102 +1773,28 @@ $(document).ready( function() {
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="tab-pane <?php if($currenttab == 'attachments') echo 'active'; ?>" id="attachments" role="tabpanel">
|
||||
<div class="tab-pane <?php if($currenttab == 'attachments') echo 'active'; ?>" id="attachments" role="tabpanel">
|
||||
<?php
|
||||
|
||||
if (count($files) > 0) {
|
||||
|
||||
print "<table class=\"table\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th width='20%'></th>\n";
|
||||
print "<th width='20%'>".getMLText("file")."</th>\n";
|
||||
print "<th width='40%'>".getMLText("comment")."</th>\n";
|
||||
print "<th width='20%'></th>\n";
|
||||
print "</tr>\n</thead>\n<tbody>\n";
|
||||
|
||||
foreach($files as $file) {
|
||||
|
||||
$file_exists=file_exists($dms->contentDir . $file->getPath());
|
||||
|
||||
$responsibleUser = $file->getUser();
|
||||
|
||||
print "<tr>";
|
||||
print "<td>";
|
||||
$previewer->createPreview($file, $previewwidthdetail);
|
||||
if($file_exists) {
|
||||
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
|
||||
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
|
||||
print "<a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">";
|
||||
}
|
||||
} else {
|
||||
if($accessobject->check_controller_access('Download', array('action'=>'file'))) {
|
||||
print "<a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($previewer->hasPreview($file)) {
|
||||
print("<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">");
|
||||
} else {
|
||||
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\" src=\"".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
|
||||
}
|
||||
if($file_exists) {
|
||||
if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
|
||||
print "</a>";
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print "<td><ul class=\"actions unstyled\">\n";
|
||||
print "<li>".htmlspecialchars($file->getName())."</li>\n";
|
||||
if($file->getName() != $file->getOriginalFileName())
|
||||
print "<li>".htmlspecialchars($file->getOriginalFileName())."</li>\n";
|
||||
if ($file_exists)
|
||||
print "<li>".SeedDMS_Core_File::format_filesize(filesize($dms->contentDir . $file->getPath())) ." bytes, ".htmlspecialchars($file->getMimeType())."</li>";
|
||||
else print "<li>".htmlspecialchars($file->getMimeType())." - <span class=\"warning\">".getMLText("document_deleted")."</span></li>";
|
||||
|
||||
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".htmlspecialchars($responsibleUser->getEmail())."\">".htmlspecialchars($responsibleUser->getFullName())."</a></li>";
|
||||
print "<li>".getLongReadableDate($file->getDate())."</li>";
|
||||
if($file->getVersion())
|
||||
print "<li>".getMLText('linked_to_current_version')."</li>";
|
||||
else
|
||||
print "<li>".getMLText('linked_to_document')."</li>";
|
||||
print "</ul></td>";
|
||||
print "<td>".htmlspecialchars($file->getComment())."</td>";
|
||||
|
||||
print "<td><ul class=\"unstyled actions\">";
|
||||
if ($file_exists) {
|
||||
if($accessobject->check_controller_access('Download', array('action'=>'file'))) {
|
||||
print "<li><a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><i class=\"fa fa-download\"></i>".getMLText('download')."</a></li>";
|
||||
}
|
||||
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
|
||||
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
|
||||
print "<li><a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\"><i class=\"fa fa-star\"></i>" . getMLText("view_online") . "</a></li>";
|
||||
}
|
||||
}
|
||||
} else print "<li><img class=\"mimeicon\" src=\"images/icons/".$this->getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">";
|
||||
echo "</ul><ul class=\"unstyled actions\">";
|
||||
if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) {
|
||||
print $this->html_link('RemoveDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), '<i class="fa fa-remove"></i>'.getMLText("delete"), false, true, array('<li>', '</li>'));
|
||||
print $this->html_link('EditDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), '<i class="fa fa-edit"></i>'.getMLText("edit"), false, true, array('<li>', '</li>'));
|
||||
}
|
||||
print "</ul></td>";
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
print "</tbody>\n</table>\n";
|
||||
|
||||
}
|
||||
else $this->infoMsg(getMLText("no_attached_files"));
|
||||
|
||||
$this->rowStart();
|
||||
$this->columnStart(9);
|
||||
?>
|
||||
<div class="ajax" data-view="ViewDocument" data-action="documentFiles" data-no-spinner="true" <?php echo ($document ? "data-query=\"documentid=".$document->getID()."\"" : "") ?>></div>
|
||||
<?php
|
||||
$this->columnEnd();
|
||||
$this->columnStart(3);
|
||||
if($accessobject->check_controller_access('AddFile')) {
|
||||
if ($document->getAccessMode($user) >= M_READWRITE){
|
||||
if(0){
|
||||
if($enableDropUpload){
|
||||
?>
|
||||
<div id="_draganddrophandler" class="droptarget well alert" data-droptarget="attachment_<?= $document->getID(); ?>" data-target="<?= $document->getID(); ?>" data-uploadformtoken="<?= createFormKey(''); ?>"><?php printMLText('drop_files_here'); echo $this->html_link("AddFile", array('documentid'=>$document->getID()), array(), getMLText('add')); ?></div>
|
||||
<div id="draganddrophandler" class="well alert alert-warning" data-droptarget="attachment_<?= $document->getID(); ?>" data-target="<?= $document->getID(); ?>" data-uploadformtoken="<?= createFormKey('addfile'); ?>"><?php echo $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'alert alert-warning'), getMLText('drop_files_here_or_click'), false, true); ?></div>
|
||||
<?php
|
||||
} else {
|
||||
print $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'btn btn-primary'), getMLText("add"), false, true)."\n";
|
||||
}
|
||||
print $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'btn btn-primary'), getMLText("add"), false, true)."\n";
|
||||
}
|
||||
}
|
||||
$this->columnEnd();
|
||||
$this->rowEnd();
|
||||
?>
|
||||
</div>
|
||||
<div class="tab-pane <?php if($currenttab == 'links') echo 'active'; ?>" id="links" role="tabpanel">
|
||||
|
|
|
@ -713,7 +713,8 @@ function onAddClipboard(ev) { /* {{{ */
|
|||
theme: 'defaultTheme',
|
||||
timeout: 1500
|
||||
});
|
||||
status.statusbar.after($('<a href="'+seeddms_webroot+'out/out.EditDocument.php?documentid=' + data.data + '" class="btn btn-mini btn-primary">' + editBtnLabel + '</a>'));
|
||||
if(editBtnLabel)
|
||||
status.statusbar.after($('<a href="'+seeddms_webroot+'out/out.EditDocument.php?documentid=' + data.data + '" class="btn btn-mini btn-primary">' + editBtnLabel + '</a>'));
|
||||
if(callback) {
|
||||
callback();
|
||||
}
|
||||
|
@ -839,6 +840,32 @@ function onAddClipboard(ev) { /* {{{ */
|
|||
}
|
||||
}
|
||||
*/
|
||||
} else if(target_type == 'attachment' && target_id) {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
if(files[i].size <= maxFileSize) {
|
||||
var fd = new FormData();
|
||||
fd.append('targettype', target_type);
|
||||
fd.append('documentid', target_id);
|
||||
fd.append('formtoken', obj.data('uploadformtoken'));
|
||||
fd.append('userfile', files[i]);
|
||||
fd.append('command', 'addfile');
|
||||
|
||||
var status = new createStatusbar(statusbar);
|
||||
status.setFileNameSize(files[i].name,files[i].size);
|
||||
sendFileToServer(fd,status, function(){
|
||||
$("div.ajax[data-action='documentFiles']").trigger('update', {documentid: target_id});
|
||||
});
|
||||
} else {
|
||||
noty({
|
||||
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
timeout: 5000
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}( window.SeedDMSUpload = window.SeedDMSUpload || {}, jQuery )); /* }}} */
|
||||
|
@ -1074,9 +1101,9 @@ $(document).ready(function() { /* {{{ */
|
|||
}
|
||||
}
|
||||
} else if(target_type == 'attachment') {
|
||||
console.log('attachment');
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
if(files.length > 0) {
|
||||
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2086,10 +2086,10 @@ $(document).ready(function() {
|
|||
$this->contentStart();
|
||||
}
|
||||
|
||||
print "<div class=\"alert alert-error\">";
|
||||
print "<h4>".getMLText('error')."!</h4>";
|
||||
print htmlspecialchars($error);
|
||||
print "</div>";
|
||||
$html = '';
|
||||
$html .= "<h4>".getMLText('error')."!</h4>";
|
||||
$html .= htmlspecialchars($error);
|
||||
$this->errorMsg($html);
|
||||
if(!$plain) {
|
||||
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
|
||||
|
||||
|
@ -3287,10 +3287,10 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
|||
$this->contentStart();
|
||||
}
|
||||
|
||||
print "<div class=\"alert alert-error\">";
|
||||
print "<h4>".getMLText('error')."!</h4>";
|
||||
print htmlspecialchars($errormsg);
|
||||
print "</div>";
|
||||
$html = '';
|
||||
$html .= "<h4>".getMLText('error')."!</h4>";
|
||||
$html .= htmlspecialchars($errormsg);
|
||||
$this->errorMsg($html);
|
||||
print "<div><button class=\"btn history-back\">".getMLText('back')."</button></div>";
|
||||
|
||||
$this->contentEnd();
|
||||
|
|
|
@ -744,7 +744,8 @@ function onAddClipboard(ev) { /* {{{ */
|
|||
theme: 'defaultTheme',
|
||||
timeout: 1500
|
||||
});
|
||||
status.statusbar.after($('<a href="'+seeddms_webroot+'out/out.EditDocument.php?documentid=' + data.data + '" class="btn btn-mini btn-primary">' + editBtnLabel + '</a>'));
|
||||
if(editBtnLabel)
|
||||
status.statusbar.after($('<a href="'+seeddms_webroot+'out/out.EditDocument.php?documentid=' + data.data + '" class="btn btn-mini btn-primary">' + editBtnLabel + '</a>'));
|
||||
if(callback) {
|
||||
callback();
|
||||
}
|
||||
|
@ -870,6 +871,32 @@ function onAddClipboard(ev) { /* {{{ */
|
|||
}
|
||||
}
|
||||
*/
|
||||
} else if(target_type == 'attachment' && target_id) {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
if(files[i].size <= maxFileSize) {
|
||||
var fd = new FormData();
|
||||
fd.append('targettype', target_type);
|
||||
fd.append('documentid', target_id);
|
||||
fd.append('formtoken', obj.data('uploadformtoken'));
|
||||
fd.append('userfile', files[i]);
|
||||
fd.append('command', 'addfile');
|
||||
|
||||
var status = new createStatusbar(statusbar);
|
||||
status.setFileNameSize(files[i].name,files[i].size);
|
||||
sendFileToServer(fd,status, function(){
|
||||
$("div.ajax[data-action='documentFiles']").trigger('update', {documentid: target_id});
|
||||
});
|
||||
} else {
|
||||
noty({
|
||||
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
timeout: 5000
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}( window.SeedDMSUpload = window.SeedDMSUpload || {}, jQuery )); /* }}} */
|
||||
|
@ -1124,9 +1151,9 @@ $(document).ready(function() { /* {{{ */
|
|||
}
|
||||
}
|
||||
} else if(target_type == 'attachment') {
|
||||
console.log('attachment');
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
if(files.length > 0) {
|
||||
SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user