Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2018-01-30 08:05:00 +01:00
commit 89ad08a537
15 changed files with 235 additions and 315 deletions

View File

@ -70,6 +70,9 @@
- add preview for webm videos (Closes #374)
- add support for apache mod_xsendfile, minor optimization of file download
- animate button to download more objects in folder list which loading is active
- use converters for creating preview images as configured in settings (Closes #389)
- propperly check if user is already in database when doing ldap auth (Closes #388)
- list linked documents on the ViewDocument page in the way as in other document lists
--------------------------------------------------------------------------------
Changes in version 5.1.5

View File

@ -24,6 +24,8 @@
*/
class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
protected $errormsg;
static function execWithTimeout($cmd, $timeout=2) { /* {{{ */
$descriptorspec = array(
0 => array("pipe", "r"),
@ -37,17 +39,23 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
if (!is_resource($process)) {
throw new Exception("proc_open failed on: " . $cmd);
}
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
$output = '';
$output = $error = '';
$timeleft = $timeout - time();
$read = array($pipes[1]);
$read = array($pipes[1], $pipes[2]);
$write = NULL;
$exeptions = NULL;
do {
stream_select($read, $write, $exeptions, $timeleft, 200000);
$num_changed_streams = stream_select($read, $write, $exeptions, $timeleft, 200000);
if (!empty($read)) {
if ($num_changed_streams === false) {
proc_terminate($process);
throw new Exception("stream select failed on: " . $cmd);
} elseif ($num_changed_streams > 0) {
$output .= fread($pipes[1], 8192);
$error .= fread($pipes[2], 8192);
}
$timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0);
@ -56,7 +64,7 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
proc_terminate($process);
throw new Exception("command timeout on: " . $cmd);
} else {
return $output;
return array('stdout'=>$output, 'stderr'=>$error);
}
} /* }}} */
@ -64,7 +72,8 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
* Constructor. Creates our indexable document and adds all
* necessary fields to it using the passed in document
*/
public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) {
public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) { /* {{{ */
$this->errormsg = '';
$_convcmd = array(
'application/pdf' => 'pdftotext -enc UTF-8 -nopgbrk %s - |sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'',
'application/postscript' => 'ps2pdf14 %s - | pdftotext -enc UTF-8 -nopgbrk - - | sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'',
@ -137,13 +146,20 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
if($cmd) {
try {
$content = self::execWithTimeout($cmd, $timeout);
if($content) {
$this->addField(Zend_Search_Lucene_Field::UnStored('content', $content, 'utf-8'));
if($content['stdout']) {
$this->addField(Zend_Search_Lucene_Field::UnStored('content', $content['stdout'], 'utf-8'));
}
if($content['stderr']) {
$this->errormsg = $content['stderr'];
}
} catch (Exception $e) {
}
}
}
}
} /* }}} */
public function getErrorMsg() { /* {{{ */
return $this->errormsg;
} /* }}} */
}
?>

View File

@ -11,11 +11,11 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2017-12-04</date>
<date>2018-01-30</date>
<time>10:58:13</time>
<version>
<release>1.1.11</release>
<api>1.1.11</api>
<release>1.1.12</release>
<api>1.1.12</api>
</version>
<stability>
<release>stable</release>
@ -23,7 +23,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
allow conversion commands for mimetypes with wildcards
execWithTimeout() reads data from stderr and saves it into error msg
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -267,5 +267,21 @@ make all functions in Indexer.php static
catch exception in execWithTimeout()
</notes>
</release>
<release>
<date>2017-12-04</date>
<time>10:58:13</time>
<version>
<release>1.1.11</release>
<api>1.1.11</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
allow conversion commands for mimetypes with wildcards
</notes>
</release>
</changelog>
</package>

View File

@ -70,18 +70,24 @@ class SeedDMS_Preview_Base {
if (!is_resource($process)) {
throw new Exception("proc_open failed on: " . $cmd);
}
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
$output = '';
$output = $error = '';
$timeleft = $timeout - time();
$read = array($pipes[1]);
$read = array($pipes[1], $pipes[2]);
$write = NULL;
$exeptions = NULL;
do {
stream_select($read, $write, $exeptions, $timeleft, 200000);
$num_changed_streams = stream_select($read, $write, $exeptions, $timeleft, 200000);
if (!empty($read)) {
if ($num_changed_streams === false) {
proc_terminate($process);
throw new Exception("stream select failed on: " . $cmd);
} elseif ($num_changed_streams > 0) {
$output .= fread($pipes[1], 8192);
}
$error .= fread($pipes[2], 8192);
}
$timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0);
@ -89,7 +95,7 @@ class SeedDMS_Preview_Base {
proc_terminate($process);
throw new Exception("command timeout on: " . $cmd);
} else {
return $output;
return array('stdout'=>$output, 'stderr'=>$error);
}
} /* }}} */

View File

@ -115,27 +115,6 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
$cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters['*']);
}
/*
switch($mimetype) {
case "image/png":
case "image/gif":
case "image/jpeg":
case "image/jpg":
case "image/svg+xml":
$cmd = 'convert -resize '.$width.'x '.$infile.' '.$target.'.png';
break;
case "application/pdf":
case "application/postscript":
$cmd = 'convert -density 100 -resize '.$width.'x '.$infile.'[0] '.$target.'.png';
break;
case "text/plain":
$cmd = 'convert -resize '.$width.'x '.$infile.'[0] '.$target.'.png';
break;
case "application/x-compressed-tar":
$cmd = 'tar tzvf '.$infile.' | convert -density 100 -resize '.$width.'x text:-[0] '.$target.'.png';
break;
}
*/
if($cmd) {
try {
self::execWithTimeout($cmd, $this->timeout);

View File

@ -25,6 +25,7 @@
<notes>
add SeedDMS_Preview_Base::sendFile() as a replacement for readfile() which uses
mod_xsendfile if available
execWithTimeout() reads data from stderr and returns it together with stdout in array
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">

View File

@ -29,6 +29,8 @@ require_once('Document.php');
*/
class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
protected $errormsg;
static function execWithTimeout($cmd, $timeout=2) { /* {{{ */
$descriptorspec = array(
0 => array("pipe", "r"),
@ -42,17 +44,23 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
if (!is_resource($process)) {
throw new Exception("proc_open failed on: " . $cmd);
}
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
$output = '';
$output = $error = '';
$timeleft = $timeout - time();
$read = array($pipes[1]);
$read = array($pipes[1], $pipes[2]);
$write = NULL;
$exeptions = NULL;
do {
stream_select($read, $write, $exeptions, $timeleft, 200000);
$num_changed_streams = stream_select($read, $write, $exeptions, $timeleft, 200000);
if (!empty($read)) {
if ($num_changed_streams === false) {
proc_terminate($process);
throw new Exception("stream select failed on: " . $cmd);
} elseif ($num_changed_streams > 0) {
$output .= fread($pipes[1], 8192);
$error .= fread($pipes[2], 8192);
}
$timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0);
@ -61,7 +69,7 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
proc_terminate($process);
throw new Exception("command timeout on: " . $cmd);
} else {
return $output;
return array('stdout'=>$output, 'stderr'=>$error);
}
} /* }}} */
@ -69,7 +77,8 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
* Constructor. Creates our indexable document and adds all
* necessary fields to it using the passed in document
*/
public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) {
public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) { /* {{{ */
$this->errormsg = '';
$_convcmd = array(
'application/pdf' => 'pdftotext -enc UTF-8 -nopgbrk %s - |sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'',
'application/postscript' => 'ps2pdf14 %s - | pdftotext -enc UTF-8 -nopgbrk - - | sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'',
@ -142,13 +151,20 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
if($cmd) {
try {
$content = self::execWithTimeout($cmd, $timeout);
if($content) {
$this->addField('content', $content, 'unstored');
if($content['stdout']) {
$this->addField('content', $content['stdout'], 'unstored');
}
if($content['stderr']) {
$this->errormsg = $content['stderr'];
}
} catch (Exception $e) {
}
}
}
}
} /* }}} */
public function getErrorMsg() { /* {{{ */
return $this->errormsg;
} /* }}} */
}
?>

View File

@ -11,11 +11,11 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2017-12-04</date>
<date>2018-01-30</date>
<time>11:00:40</time>
<version>
<release>1.0.8</release>
<api>1.0.8</api>
<release>1.0.9</release>
<api>1.0.9</api>
</version>
<stability>
<release>stable</release>
@ -23,7 +23,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
allow conversion commands for mimetypes with wildcards
execWithTimeout() reads data from stderr and saves it into error msg
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -194,5 +194,21 @@ fix calculation of timeout (see bug #269)
catch exception in execWithTimeout()
</notes>
</release>
<release>
<date>2017-12-04</date>
<time>11:00:40</time>
<version>
<release>1.0.8</release>
<api>1.0.8</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
allow conversion commands for mimetypes with wildcards
</notes>
</release>
</changelog>
</package>

View File

@ -38,7 +38,7 @@ class SeedDMS_ExtExample extends SeedDMS_ExtBase {
* Use this method to do some initialization like setting up the hooks
* You have access to the following global variables:
* $GLOBALS['settings'] : current global configuration
* $GLOBALS['settings']['_extensions']['example'] : configuration of this extension
* $GLOBALS['settings']->_extensions['example'] : configuration of this extension
* $GLOBALS['LANG'] : the language array with translations for all languages
* $GLOBALS['SEEDDMS_HOOKS'] : all hooks added so far
*/

View File

@ -125,11 +125,15 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
/* No do the actual authentication of the user */
$bind = @ldap_bind($ds, $dn, $password);
$user = $dms->getUserByLogin($username);
if($user === false) {
ldap_close($ds);
return false;
}
if ($bind) {
// Successfully authenticated. Now check to see if the user exists within
// the database. If not, add them in if _restricted is not set,
// but do not add their password.
if (is_bool($user) && !$settings->_restricted) {
if (is_null($user) && !$settings->_restricted) {
// Retrieve the user's LDAP information.
if (isset($settings->_ldapFilter) && strlen($settings->_ldapFilter) > 0) {
$search = ldap_search($ds, $settings->_ldapBaseDN, "(&(".$ldapSearchAttribut.$username.")".$settings->_ldapFilter.")");

View File

@ -872,16 +872,22 @@ switch($command) {
if($index) {
$indexconf['Indexer']::init($settings->_stopWordsFile);
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout);
if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
if (method_exists($hookObj, 'preIndexDocument')) {
$hookObj->preIndexDocument(null, $document, $idoc);
$error = $idoc->getErrorMsg();
if(!$error) {
if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
if (method_exists($hookObj, 'preIndexDocument')) {
$hookObj->preIndexDocument(null, $document, $idoc);
}
}
}
$index->addDocument($idoc);
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_indexed'), 'data'=>$document->getID()));
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>$error, 'data'=>$document->getID()));
}
$index->addDocument($idoc);
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_indexed'), 'data'=>$document->getID()));
} else {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText('error_occured'), 'data'=>$document->getID()));

View File

@ -37,8 +37,8 @@ class SeedDMS_View_ApproveDocument extends SeedDMS_Bootstrap_Style {
function checkIndForm()
{
msg = new Array();
if (document.form1.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_status");?>");
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (document.formind.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_status");?>");
if (document.formind.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (msg != "") {
noty({
text: msg.join('<br />'),
@ -56,9 +56,9 @@ function checkIndForm()
function checkGrpForm()
{
msg = new Array();
// if (document.form2.approvalGroup.value == "") msg.push("<?php printMLText("js_no_approval_group");?>");
if (document.form2.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_status");?>");
if (document.form2.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
// if (document.formgrp.approvalGroup.value == "") msg.push("<?php printMLText("js_no_approval_group");?>");
if (document.formgrp.approvalStatus.value == "") msg.push("<?php printMLText("js_no_approval_status");?>");
if (document.formgrp.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (msg != "")
{
noty({
@ -75,11 +75,11 @@ function checkGrpForm()
return true;
}
$(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
$('body').on('submit', '#formind', function(ev){
if(checkIndForm()) return;
ev.preventDefault();
});
$('body').on('submit', '#form2', function(ev){
$('body').on('submit', '#formgrp', function(ev){
if(checkGrpForm()) return;
ev.preventDefault();
});
@ -112,24 +112,24 @@ $(document).ready(function() {
$this->contentContainerStart();
// Display the Approval form.
if ($approvalStatus['type'] == 0) {
if($approvalStatus["status"]!=0) {
$approvaltype = ($approvalStatus['type'] == 0) ? 'ind' : 'grp';
if($approvalStatus["status"]!=0) {
print "<table class=\"folderView\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printApprovalStatusText($approvalStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($approvalStatus["comment"])."</td>";
$indUser = $dms->getUser($approvalStatus["userID"]);
print "<td>".$approvalStatus["date"]." - ". $indUser->getFullname() ."</td>";
print "</tr></tbody></table><br>\n";
}
print "<table class=\"folderView\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printApprovalStatusText($approvalStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($approvalStatus["comment"])."</td>";
$indUser = $dms->getUser($approvalStatus["userID"]);
print "<td>".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
?>
<form method="post" action="../op/op.ApproveDocument.php" id="form1" name="form1" enctype="multipart/form-data">
<form method="POST" action="../op/op.ApproveDocument.php" id="form<?= $approvaltype ?>" name="form<?= $approvaltype ?>" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('approvedocument'); ?>
<table>
<tr>
@ -141,57 +141,6 @@ $(document).ready(function() {
<td>
<?php
$this->printFileChooser('approvalfile', false);
?>
</td>
</tr>
<tr><td><?php printMLText("approval_status")?>:</td>
<td><select name="approvalStatus">
<?php if($approvalStatus['status'] != 1) { ?>
<option value='1'><?php printMLText("status_approved")?></option>
<?php } ?>
<?php if($approvalStatus['status'] != -1) { ?>
<option value='-1'><?php printMLText("rejected")?></option>
<?php } ?>
</select>
</td></tr><tr><td></td><td>
<input type='hidden' name='approvalType' value='ind'/>
<input type='hidden' name='documentid' value='<?php echo $document->getId() ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<input type='submit' class="btn" name='indApproval' value='<?php printMLText("submit_approval")?>'/>
</td></tr></table>
</form>
<?php
}
else if ($approvalStatus['type'] == 1) {
if($approvalStatus["status"]!=0) {
print "<table class=\"folderView\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printApprovalStatusText($approvalStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($approvalStatus["comment"])."</td>";
$indUser = $dms->getUser($approvalStatus["userID"]);
print "<td>".$approvalStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
?>
<form method="POST" action="../op/op.ApproveDocument.php" id="form2" name="form2" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('approvedocument'); ?>
<table>
<tr><td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea>
</td></tr>
<tr>
<td><?php printMLText("approval_file")?>:</td>
<td>
<?php
$this->printFileChooser('approvalfile', false);
?>
</td>
</tr>
@ -207,15 +156,16 @@ $(document).ready(function() {
</select>
</td></tr>
<tr><td></td><td>
<input type='submit' class="btn" name='<?= $approvaltype ?>Approval' value='<?php printMLText("submit_approval")?>'/></td></tr>
</table>
<input type='hidden' name='approvalType' value='<?= $approvaltype ?>'/>
<?php if($approvaltype == 'grp'): ?>
<input type='hidden' name='approvalGroup' value="<?php echo $approvalStatus['required']; ?>" />
<input type='hidden' name='approvalType' value='grp'/>
<?php endif; ?>
<input type='hidden' name='documentid' value='<?php echo $document->getId() ?>'/>
<input type='hidden' name='version' value='<?php echo $latestContent->getVersion(); ?>'/>
<input type='submit' class="btn" name='groupApproval' value='<?php printMLText("submit_approval")?>'/></td></tr>
</table>
</form>
<?php
}
$this->contentContainerEnd();
$this->contentEnd();

View File

@ -71,7 +71,7 @@ function check_queue() {
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
timeout: 5000,
});
},
success: function(data) {

View File

@ -37,8 +37,8 @@ class SeedDMS_View_ReviewDocument extends SeedDMS_Bootstrap_Style {
function checkIndForm()
{
msg = new Array();
if (document.form1.reviewStatus.value == "") msg.push("<?php printMLText("js_no_review_status");?>");
if (document.form1.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (document.formind.reviewStatus.value == "") msg.push("<?php printMLText("js_no_review_status");?>");
if (document.formind.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (msg != "") {
noty({
text: msg.join('<br />'),
@ -55,10 +55,10 @@ function checkIndForm()
}
function checkGrpForm()
{
msg = "";
if (document.form2.reviewGroup.value == "") msg += "<?php printMLText("js_no_review_group");?>\n";
if (document.form2.reviewStatus.value == "") msg += "<?php printMLText("js_no_review_status");?>\n";
if (document.form2.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
msg = new Array();
// if (document.formgrp.reviewGroup.value == "") msg.push("<?php printMLText("js_no_review_group");?>");
if (document.formgrp.reviewStatus.value == "") msg.push("<?php printMLText("js_no_review_status");?>");
if (document.formgrp.comment.value == "") msg.push("<?php printMLText("js_no_comment");?>");
if (msg != "")
{
noty({
@ -75,11 +75,11 @@ function checkGrpForm()
return true;
}
$(document).ready(function() {
$('body').on('submit', '#form1', function(ev){
$('body').on('submit', '#formind', function(ev){
if(checkIndForm()) return;
ev.preventDefault();
});
$('body').on('submit', '#form2', function(ev){
$('body').on('submit', '#formgrp', function(ev){
if(checkGrpForm()) return;
ev.preventDefault();
});
@ -110,82 +110,24 @@ $(document).ready(function() {
$this->contentContainerStart();
// Display the Review form.
if ($reviewStatus['type'] == 0) {
if($reviewStatus["status"]!=0) {
$reviewtype = ($reviewStatus['type'] == 0) ? 'ind' : 'grp';
if($reviewStatus["status"]!=0) {
print "<table class=\"folderView\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printReviewStatusText($reviewStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($reviewStatus["comment"])."</td>";
$indUser = $dms->getUser($reviewStatus["userID"]);
print "<td>".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>";
}
?>
<form method="post" action="../op/op.ReviewDocument.php" id="form1" name="form1" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?>
<table class="table-condensed">
<tr>
<td><?php printMLText("comment")?>:</td>
<td><textarea name="comment" cols="80" rows="4"></textarea></td>
</tr>
<tr>
<td><?php printMLText("review_file")?>:</td>
<td>
<?php
$this->printFileChooser('reviewfile', false);
?>
</td>
</tr>
<tr>
<td><?php printMLText("review_status")?></td>
<td>
<select name="reviewStatus">
<?php if($reviewStatus['status'] != 1) { ?>
<option value='1'><?php printMLText("status_reviewed")?></option>
<?php } ?>
<?php if($reviewStatus['status'] != -1) { ?>
<option value='-1'><?php printMLText("rejected")?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type='submit' class="btn" name='indReview' value='<?php printMLText("submit_review")?>'/></td>
</tr>
</table>
<input type='hidden' name='reviewType' value='ind'/>
<input type='hidden' name='documentid' value='<?php echo $document->getID() ?>'/>
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
</form>
<?php
print "<table class=\"folderView\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printReviewStatusText($reviewStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($reviewStatus["comment"])."</td>";
$indUser = $dms->getUser($reviewStatus["userID"]);
print "<td>".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
else if ($reviewStatus['type'] == 1) {
if($reviewStatus["status"]!=0) {
print "<table class=\"folderView\"><thead><tr>";
print "<th>".getMLText("status")."</th>";
print "<th>".getMLText("comment")."</th>";
print "<th>".getMLText("last_update")."</th>";
print "</tr></thead><tbody><tr>";
print "<td>";
printReviewStatusText($reviewStatus["status"]);
print "</td>";
print "<td>".htmlspecialchars($reviewStatus["comment"])."</td>";
$indUser = $dms->getUser($reviewStatus["userID"]);
print "<td>".$reviewStatus["date"]." - ". htmlspecialchars($indUser->getFullname()) ."</td>";
print "</tr></tbody></table><br>\n";
}
?>
<form method="post" action="../op/op.ReviewDocument.php" id="form2" name="form2" enctype="multipart/form-data">
<form method="post" action="../op/op.ReviewDocument.php" id="form<?= $reviewtype ?>" name="form<?= $reviewtype ?>" enctype="multipart/form-data">
<?php echo createHiddenFieldWithKey('reviewdocument'); ?>
<table class="table-condensed">
<tr>
@ -215,16 +157,18 @@ $(document).ready(function() {
</tr>
<tr>
<td></td>
<td><input type='submit' class="btn" name='groupReview' value='<?php printMLText("submit_review")?>'/></td>
<td><input type='submit' class="btn" name='<?= $reviewtype ?>Review' value='<?php printMLText("submit_review")?>'/></td>
</tr>
</table>
<input type='hidden' name='reviewType' value='grp'/>
<input type='hidden' name='reviewType' value='<?= $reviewtype ?>'/>
<?php if($reviewtype == 'grp'): ?>
<input type='hidden' name='reviewGroup' value='<?php echo $reviewStatus['required']; ?>'/>
<?php endif; ?>
<input type='hidden' name='documentid' value='<?php echo $document->getID() ?>'/>
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
</form>
<?php
}
$this->contentContainerEnd();
$this->contentEnd();
$this->htmlEndPage();

View File

@ -192,6 +192,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$this->printTimelineJs('out.ViewDocument.php?action=timelinedata&documentid='.$document->getID(), 300, '', date('Y-m-d'));
}
$this->printDocumentChooserJs("form1");
$this->printDeleteDocumentButtonJs();
} /* }}} */
function documentInfos() { /* {{{ */
@ -376,6 +377,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
break;
case 'video/webm':
case 'video/mp4':
case 'video/x-msvideo':
$this->contentHeading(getMLText("preview"));
?>
<video controls style="width: 100%;">
@ -441,6 +443,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$versions = $document->getContent();
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
$this->htmlAddHeader('<link href="../styles/'.$this->theme.'/timeline/timeline.css" rel="stylesheet">'."\n", 'css');
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/timeline/timeline-min.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/timeline/timeline-locales.js"></script>'."\n", 'js');
@ -1635,55 +1638,33 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
</div>
<div class="tab-pane <?php if($currenttab == 'links') echo 'active'; ?>" id="links">
<?php
$this->contentContainerStart();
if (count($links) > 0) {
print "<table class=\"table table-condensed\">";
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th></th>\n";
print "<th>".getMLText("comment")."</th>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "<th></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($links as $link) {
$responsibleUser = $link->getUser();
$targetDoc = $link->getTarget();
$targetlc = $targetDoc->getLatestContent();
$previewer->createPreview($targetlc, $previewwidthdetail);
echo "<tr id=\"table-row-transmittalitem-".$link->getID()."\">";
echo $this->documentListRow($targetDoc, $previewer, true);
print "<td><small>".getMLText("document_link_by")." ".htmlspecialchars($responsibleUser->getFullName());
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL )) {
print "<br />".getMLText("document_link_public").": ".(($link->isPublic()) ? getMLText("yes") : getMLText("no"));
print "<form action=\"../op/op.RemoveDocumentLink.php\" method=\"post\">".createHiddenFieldWithKey('removedocumentlink')."<input type=\"hidden\" name=\"documentid\" value=\"".$documentid."\" /><input type=\"hidden\" name=\"linkid\" value=\"".$link->getID()."\" /><button type=\"submit\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("delete")."</button></form>";
echo "<tr id=\"table-row-document-".$targetDoc->getId()."\" class=\"table-row-document\" rel=\"document_".$targetDoc->getId()."\" formtoken=\"".createFormKey('movedocument')."\" draggable=\"true\">";
$targetDoc->verifyLastestContentExpriry();
$txt = $this->callHook('documentListItem', $targetDoc, $previewer, 'reverselinks');
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($targetDoc, $previewer, true);
}
print "</small></td>";
echo "</tr>";
if(0){
print "<tr>";
print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
if($accessop->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"../op/op.Download.php?documentid=".$targetDoc->getID()."&version=".$targetlc->getVersion()."\">";
if($previewer->hasPreview($targetlc)) {
print "<img class=\"mimeicon\" width=\"".$previewwidthlist."\" src=\"../op/op.Preview.php?documentid=".$targetDoc->getID()."&version=".$targetlc->getVersion()."&width=".$previewwidthlist."\" title=\"".htmlspecialchars($targetlc->getMimeType())."\">";
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthlist."\" src=\"".$this->getMimeIcon($targetlc->getFileType())."\" title=\"".htmlspecialchars($targetlc->getMimeType())."\">";
}
if($accessop->check_controller_access('Download', array('action'=>'run')))
print "</a>";
print "</td>";
print "<td><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".htmlspecialchars($targetDoc->getName())."</a></td>";
print "<td>".htmlspecialchars($targetDoc->getComment())."</td>";
print "<td>".getMLText("document_link_by")." ".htmlspecialchars($responsibleUser->getFullName());
print "<td><span class=\"actions\">";
print getMLText("document_link_by")." ".htmlspecialchars($responsibleUser->getFullName());
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL ))
print "<br />".getMLText("document_link_public").": ".(($link->isPublic()) ? getMLText("yes") : getMLText("no"));
print "</td>";
print "<td><span class=\"actions\">";
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL ))
print "<form action=\"../op/op.RemoveDocumentLink.php\" method=\"post\">".createHiddenFieldWithKey('removedocumentlink')."<input type=\"hidden\" name=\"documentid\" value=\"".$documentid."\" /><input type=\"hidden\" name=\"linkid\" value=\"".$link->getID()."\" /><button type=\"submit\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("delete")."</button></form>";
print "</span></td>";
@ -1695,81 +1676,63 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
else printMLText("no_linked_files");
if (!$user->isGuest()){
$this->contentContainerStart();
?>
<br>
<form action="../op/op.AddDocumentLink.php" name="form1">
<form action="../op/op.AddDocumentLink.php" name="form1" class="form-inline">
<input type="hidden" name="documentid" value="<?php print $documentid;?>">
<table class="table-condensed">
<tr>
<td><?php printMLText("add_document_link");?>:</td>
<td><?php $this->printDocumentChooserHtml("form1");?></td>
</tr>
<?php printMLText("add_document_link");?>:
<?php $this->printDocumentChooserHtml("form1");?>
<?php
if ($document->getAccessMode($user) >= M_READWRITE) {
print "<tr><td>".getMLText("document_link_public")."</td>";
print "<td>";
print "<label class=\"checkbox\">";
print "<input type=\"checkbox\" name=\"public\" value=\"true\" checked />";
print "</td></tr>";
print getMLText("document_link_public");
print "</label>";
}
?>
<tr>
<td></td>
<td><button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button></td>
</tr>
</table>
<button type="submit" class="btn"><i class="icon-save"></i> <?php printMLText("save")?></button>
</form>
<?php
$this->contentContainerEnd();
}
$this->contentContainerEnd();
if (count($reverselinks) > 0) {
$this->contentHeading(getMLText("reverse_links"));
$this->contentContainerStart();
// $this->contentContainerStart();
print "<table class=\"table table-condensed\">";
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th></th>\n";
print "<th>".getMLText("comment")."</th>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "<th></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($reverselinks as $link) {
$responsibleUser = $link->getUser();
$sourceDoc = $link->getDocument();
/* Check if latest content is accessible. Could be that even if the document
* is accessible, the document content isn't because of its status
*/
if($sourcelc = $sourceDoc->getLatestContent()) {
$previewer->createPreview($sourcelc, $previewwidthdetail);
print "<tr>";
print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
if($accessop->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"../op/op.Download.php?documentid=".$sourceDoc->getID()."&version=".$sourcelc->getVersion()."\">";
if($previewer->hasPreview($sourcelc)) {
print "<img class=\"mimeicon\" width=\"".$previewwidthlist."\" src=\"../op/op.Preview.php?documentid=".$sourceDoc->getID()."&version=".$sourcelc->getVersion()."&width=".$previewwidthlist."\" title=\"".htmlspecialchars($sourcelc->getMimeType())."\">";
} else {
print "<img class=\"mimeicon\" width=\"".$previewwidthlist."\" src=\"".$this->getMimeIcon($sourcelc->getFileType())."\" title=\"".htmlspecialchars($sourcelc->getMimeType())."\">";
}
if($accessop->check_controller_access('Download', array('action'=>'run')))
print "</a>";
print "</td>";
print "<td><a href=\"out.ViewDocument.php?documentid=".$sourceDoc->getID()."\" class=\"linklist\">".htmlspecialchars($sourceDoc->getName())."</a></td>";
print "<td>".htmlspecialchars($sourceDoc->getComment())."</td>";
print "<td>".getMLText("document_link_by")." ".htmlspecialchars($responsibleUser->getFullName());
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL ))
print "<br />".getMLText("document_link_public").": ".(($link->isPublic()) ? getMLText("yes") : getMLText("no"));
print "</td>";
print "<td><span class=\"actions\">";
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL ))
print "<form action=\"../op/op.RemoveDocumentLink.php\" method=\"post\">".createHiddenFieldWithKey('removedocumentlink')."<input type=\"hidden\" name=\"documentid\" value=\"".$documentid."\" /><input type=\"hidden\" name=\"linkid\" value=\"".$link->getID()."\" /><button type=\"submit\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("delete")."</button></form>";
print "</span></td>";
print "</tr>";
echo "<tr id=\"table-row-document-".$sourceDoc->getId()."\" class=\"table-row-document\" rel=\"document_".$sourceDoc->getId()."\" formtoken=\"".createFormKey('movedocument')."\" draggable=\"true\">";
$sourceDoc->verifyLastestContentExpriry();
$txt = $this->callHook('documentListItem', $sourceDoc, $previewer, 'reverselinks');
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($sourceDoc, $previewer, true);
}
print "<td><span class=\"actions\">";
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL ))
print getMLText("document_link_by")." ".htmlspecialchars($responsibleUser->getFullName());
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL ))
print "<br />".getMLText("document_link_public").": ".(($link->isPublic()) ? getMLText("yes") : getMLText("no"));
print "<form action=\"../op/op.RemoveDocumentLink.php\" method=\"post\">".createHiddenFieldWithKey('removedocumentlink')."<input type=\"hidden\" name=\"documentid\" value=\"".$sourceDoc->getId()."\" /><input type=\"hidden\" name=\"linkid\" value=\"".$link->getID()."\" /><button type=\"submit\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("delete")."</button></form>";
print "</span></td>";
print "</tr>";
}
print "</tbody>\n</table>\n";
$this->contentContainerEnd();
// $this->contentContainerEnd();
}
?>
</div>