Merge branch 'seeddms-4.3.x' into seeddms-5.0.x

This commit is contained in:
Uwe Steinmann 2016-12-22 09:36:15 +01:00
commit 8d20d39a07
4 changed files with 158 additions and 132 deletions

View File

@ -1,3 +1,9 @@
--------------------------------------------------------------------------------
Changes in version 5.0.9
--------------------------------------------------------------------------------
- merged changes from 4.3.32
- add hooks for previewing documents
--------------------------------------------------------------------------------
Changes in version 5.0.8
--------------------------------------------------------------------------------
@ -57,6 +63,11 @@
- add .xml to online file types by default
- add home folder for users
--------------------------------------------------------------------------------
Changes in version 4.3.32
--------------------------------------------------------------------------------
- fix saving new mimetype for fulltext search, available languages
--------------------------------------------------------------------------------
Changes in version 4.3.31
--------------------------------------------------------------------------------

View File

@ -58,8 +58,11 @@ if ($action == "saveSettings")
$settings->_siteName = $_POST["siteName"];
$settings->_footNote = $_POST["footNote"];
$settings->_printDisclaimer = getBoolValue("printDisclaimer");
$settings->_language = $_POST["language"];
$settings->_availablelanguages = $_POST["availablelanguages"];
$settings->_language = $_POST["language"];
if(empty($_POST["availablelanguages"]))
$settings->_availablelanguages = array();
else
$settings->_availablelanguages = $_POST["availablelanguages"];
$settings->_theme = $_POST["theme"];
$settings->_previewWidthList = $_POST["previewWidthList"];
$settings->_previewWidthDetail = $_POST["previewWidthDetail"];

View File

@ -425,8 +425,9 @@ function uploadDocument($id) { /* {{{ */
fclose($handle);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$userfiletype = finfo_file($finfo, $temp);
$fileType = ".".pathinfo($origfilename, PATHINFO_EXTENSION);
finfo_close($finfo);
$res = $mfolder->addDocument($docname, '', 0, $userobj, '', array(), $temp, $origfilename ? $origfilename : basename($temp), '.', $userfiletype, 0);
$res = $mfolder->addDocument($docname, '', 0, $userobj, '', array(), $temp, $origfilename ? $origfilename : basename($temp), $fileType, $userfiletype, 0);
unlink($temp);
if($res) {
$doc = $res[0];

View File

@ -165,7 +165,142 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$this->printDocumentChooserJs("form1");
} /* }}} */
function documentInfos() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$document = $this->params['document'];
$this->contentHeading(getMLText("document_infos"));
$this->contentContainerStart();
$txt = $this->callHook('preDocumentInfos', $document);
if(is_string($txt))
echo $txt;
$txt = $this->callHook('documentInfos', $document);
if(is_string($txt))
echo $txt;
else {
?>
<table class="table-condensed">
<?php
if($user->isAdmin()) {
echo "<tr>";
echo "<td>".getMLText("id").":</td>\n";
echo "<td>".htmlspecialchars($document->getID())."</td>\n";
echo "</tr>";
}
?>
<tr>
<td><?php printMLText("name");?>:</td>
<td><?php print htmlspecialchars($document->getName());?></td>
</tr>
<tr>
<td><?php printMLText("owner");?>:</td>
<td>
<?php
$owner = $document->getOwner();
print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".htmlspecialchars($owner->getFullName())."</a>";
?>
</td>
</tr>
<?php
if($document->getComment()) {
?>
<tr>
<td><?php printMLText("comment");?>:</td>
<td><?php print htmlspecialchars($document->getComment());?></td>
</tr>
<?php
}
if($user->isAdmin()) {
echo "<tr>";
echo "<td>".getMLText('default_access').":</td>";
echo "<td>".$this->getAccessModeText($document->getDefaultAccess())."</td>";
echo "</tr>";
if($document->inheritsAccess()) {
echo "<tr>";
echo "<td>".getMLText("access_mode").":</td>\n";
echo "<td>";
echo getMLText("inherited")."<br />";
$this->printAccessList($document);
echo "</tr>";
} else {
echo "<tr>";
echo "<td>".getMLText('access_mode').":</td>";
echo "<td>";
$this->printAccessList($document);
echo "</td>";
echo "</tr>";
}
}
?>
<tr>
<td><?php printMLText("used_discspace");?>:</td>
<td><?php print SeedDMS_Core_File::format_filesize($document->getUsedDiskSpace());?></td>
</tr>
<tr>
<td><?php printMLText("creation_date");?>:</td>
<td><?php print getLongReadableDate($document->getDate()); ?></td>
</tr>
<?php
if($document->expires()) {
?>
<tr>
<td><?php printMLText("expires");?>:</td>
<td><?php print getReadableDate($document->getExpires()); ?></td>
</tr>
<?php
}
if($document->getKeywords()) {
?>
<tr>
<td><?php printMLText("keywords");?>:</td>
<td><?php print htmlspecialchars($document->getKeywords());?></td>
</tr>
<?php
}
if($cats = $document->getCategories()) {
?>
<tr>
<td><?php printMLText("categories");?>:</td>
<td>
<?php
$ct = array();
foreach($cats as $cat)
$ct[] = htmlspecialchars($cat->getName());
echo implode(', ', $ct);
?>
</td>
</tr>
<?php
}
?>
<?php
$attributes = $document->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentAttribute', $document, $attribute);
if(is_array($arr)) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
} else {
$this->printAttribute($attribute);
}
}
}
?>
</table>
<?php
}
$txt = $this->callHook('postDocumentInfos', $document);
if(is_string($txt))
echo $txt;
$this->contentContainerEnd();
} /* }}} */
function preview() { /* {{{ */
$dms = $this->params['dms'];
$document = $this->params['document'];
$timeout = $this->params['timeout'];
$showfullpreview = $this->params['showFullPreview'];
@ -303,133 +438,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
<div class="row-fluid">
<div class="span4">
<?php
$this->contentHeading(getMLText("document_infos"));
$this->contentContainerStart();
$txt = $this->callHook('preDocumentInfos', $document);
if(is_string($txt))
echo $txt;
$txt = $this->callHook('documentInfos', $document);
if(is_string($txt))
echo $txt;
else {
?>
<table class="table-condensed">
<?php
if($user->isAdmin()) {
echo "<tr>";
echo "<td>".getMLText("id").":</td>\n";
echo "<td>".htmlspecialchars($document->getID())."</td>\n";
echo "</tr>";
}
?>
<tr>
<td><?php printMLText("name");?>:</td>
<td><?php print htmlspecialchars($document->getName());?></td>
</tr>
<tr>
<td><?php printMLText("owner");?>:</td>
<td>
<?php
$owner = $document->getOwner();
print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".htmlspecialchars($owner->getFullName())."</a>";
?>
</td>
</tr>
<?php
if($document->getComment()) {
?>
<tr>
<td><?php printMLText("comment");?>:</td>
<td><?php print htmlspecialchars($document->getComment());?></td>
</tr>
<?php
}
if($user->isAdmin()) {
echo "<tr>";
echo "<td>".getMLText('default_access').":</td>";
echo "<td>".$this->getAccessModeText($document->getDefaultAccess())."</td>";
echo "</tr>";
if($document->inheritsAccess()) {
echo "<tr>";
echo "<td>".getMLText("access_mode").":</td>\n";
echo "<td>";
echo getMLText("inherited")."<br />";
$this->printAccessList($document);
echo "</tr>";
} else {
echo "<tr>";
echo "<td>".getMLText('access_mode').":</td>";
echo "<td>";
$this->printAccessList($document);
echo "</td>";
echo "</tr>";
}
}
?>
<tr>
<td><?php printMLText("used_discspace");?>:</td>
<td><?php print SeedDMS_Core_File::format_filesize($document->getUsedDiskSpace());?></td>
</tr>
<tr>
<td><?php printMLText("creation_date");?>:</td>
<td><?php print getLongReadableDate($document->getDate()); ?></td>
</tr>
<?php
if($document->expires()) {
?>
<tr>
<td><?php printMLText("expires");?>:</td>
<td><?php print getReadableDate($document->getExpires()); ?></td>
</tr>
<?php
}
if($document->getKeywords()) {
?>
<tr>
<td><?php printMLText("keywords");?>:</td>
<td><?php print htmlspecialchars($document->getKeywords());?></td>
</tr>
<?php
}
if($cats = $document->getCategories()) {
?>
<tr>
<td><?php printMLText("categories");?>:</td>
<td>
<?php
$ct = array();
foreach($cats as $cat)
$ct[] = htmlspecialchars($cat->getName());
echo implode(', ', $ct);
?>
</td>
</tr>
<?php
}
?>
<?php
$attributes = $document->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentAttribute', $document, $attribute);
if(is_array($arr)) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
} else {
$this->printAttribute($attribute);
}
}
}
?>
</table>
<?php
}
$txt = $this->callHook('postDocumentInfos', $document);
if(is_string($txt))
echo $txt;
$this->contentContainerEnd();
$this->documentInfos();
$this->preview();
?>
</div>
@ -561,8 +570,10 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
}
print "</ul>";
print "<ul class=\"unstyled actions\">";
if($accessop->mayEditVersion()) {
print "<li><a href=\"../out/out.EditOnline.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\"><i class=\"icon-edit\"></i>".getMLText("edit_version")."</a></li>";
if ($file_exists){
if($accessop->mayEditVersion()) {
print "<li><a href=\"../out/out.EditOnline.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\"><i class=\"icon-edit\"></i>".getMLText("edit_version")."</a></li>";
}
}
/* Only admin has the right to remove version in any case or a regular
* user if enableVersionDeletion is on