2012-12-14 07:53:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of ViewFolder view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include parent class
|
|
|
|
*/
|
|
|
|
require_once("class.Bootstrap.php");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for ViewFolder view
|
|
|
|
*
|
|
|
|
* @category DMS
|
2013-02-14 11:10:53 +00:00
|
|
|
* @package SeedDMS
|
2012-12-14 07:53:13 +00:00
|
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2013-02-14 11:10:53 +00:00
|
|
|
class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2013-02-06 13:58:36 +00:00
|
|
|
function getAccessModeText($defMode) { /* {{{ */
|
|
|
|
switch($defMode) {
|
|
|
|
case M_NONE:
|
|
|
|
return getMLText("access_mode_none");
|
|
|
|
break;
|
|
|
|
case M_READ:
|
|
|
|
return getMLText("access_mode_read");
|
|
|
|
break;
|
|
|
|
case M_READWRITE:
|
|
|
|
return getMLText("access_mode_readwrite");
|
|
|
|
break;
|
|
|
|
case M_ALL:
|
|
|
|
return getMLText("access_mode_all");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function printAccessList($obj) { /* {{{ */
|
|
|
|
$accessList = $obj->getAccessList();
|
|
|
|
if (count($accessList["users"]) == 0 && count($accessList["groups"]) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for ($i = 0; $i < count($accessList["groups"]); $i++)
|
|
|
|
{
|
|
|
|
$group = $accessList["groups"][$i]->getGroup();
|
|
|
|
$accesstext = $this->getAccessModeText($accessList["groups"][$i]->getMode());
|
|
|
|
print $accesstext.": ".htmlspecialchars($group->getName());
|
|
|
|
if ($i+1 < count($accessList["groups"]) || count($accessList["users"]) > 0)
|
|
|
|
print "<br />";
|
|
|
|
}
|
|
|
|
for ($i = 0; $i < count($accessList["users"]); $i++)
|
|
|
|
{
|
|
|
|
$user = $accessList["users"][$i]->getUser();
|
|
|
|
$accesstext = $this->getAccessModeText($accessList["users"][$i]->getMode());
|
|
|
|
print $accesstext.": ".htmlspecialchars($user->getFullName());
|
|
|
|
if ($i+1 < count($accessList["users"]))
|
|
|
|
print "<br />";
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$folder = $this->params['folder'];
|
|
|
|
$orderby = $this->params['orderby'];
|
|
|
|
$enableFolderTree = $this->params['enableFolderTree'];
|
2013-01-30 20:00:05 +00:00
|
|
|
$enableClipboard = $this->params['enableClipboard'];
|
2014-07-11 06:42:57 +00:00
|
|
|
$enableDropUpload = $this->params['enableDropUpload'];
|
2013-09-06 13:24:51 +00:00
|
|
|
$expandFolderTree = $this->params['expandFolderTree'];
|
2012-12-14 07:53:13 +00:00
|
|
|
$showtree = $this->params['showtree'];
|
|
|
|
$cachedir = $this->params['cachedir'];
|
2013-04-18 11:38:52 +00:00
|
|
|
$workflowmode = $this->params['workflowmode'];
|
2013-04-10 13:42:11 +00:00
|
|
|
$enableRecursiveCount = $this->params['enableRecursiveCount'];
|
|
|
|
$maxRecursiveCount = $this->params['maxRecursiveCount'];
|
2014-03-18 09:55:24 +00:00
|
|
|
$previewwidth = $this->params['previewWidthList'];
|
2014-02-21 20:51:53 +00:00
|
|
|
|
2012-12-14 07:53:13 +00:00
|
|
|
$folderid = $folder->getId();
|
|
|
|
|
|
|
|
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
|
|
|
|
|
|
|
|
$this->globalNavigation($folder);
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation($this->getFolderPathHTML($folder), "view_folder", $folder);
|
|
|
|
|
|
|
|
echo "<div class=\"row-fluid\">\n";
|
2013-06-13 12:57:16 +00:00
|
|
|
|
2013-06-17 13:50:00 +00:00
|
|
|
// dynamic columns - left column removed if no content and right column then fills span12.
|
|
|
|
if (!($enableFolderTree || $enableClipboard)) {
|
|
|
|
$LeftColumnSpan = 0;
|
|
|
|
$RightColumnSpan = 12;
|
|
|
|
} else {
|
|
|
|
$LeftColumnSpan = 4;
|
|
|
|
$RightColumnSpan = 8;
|
2013-06-13 12:57:16 +00:00
|
|
|
}
|
2013-06-17 13:50:00 +00:00
|
|
|
if ($LeftColumnSpan > 0) {
|
2013-06-13 12:57:16 +00:00
|
|
|
echo "<div class=\"span".$LeftColumnSpan."\">\n";
|
|
|
|
if ($enableFolderTree) {
|
|
|
|
if ($showtree==1){
|
|
|
|
$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=0\"><i class=\"icon-minus-sign\"></i></a>", true);
|
|
|
|
$this->contentContainerStart();
|
2013-05-26 16:55:57 +00:00
|
|
|
?>
|
|
|
|
<script language="JavaScript">
|
|
|
|
function folderSelected(id, name) {
|
|
|
|
window.location = '../out/out.ViewFolder.php?folderid=' + id;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<?php
|
2014-02-21 09:58:27 +00:00
|
|
|
$this->printNewTreeNavigation($folderid, M_READ, 0, '', $expandFolderTree == 2, $orderby);
|
2013-06-13 12:57:16 +00:00
|
|
|
$this->contentContainerEnd();
|
|
|
|
} else {
|
|
|
|
$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=1\"><i class=\"icon-plus-sign\"></i></a>", true);
|
|
|
|
}
|
2013-05-26 16:55:57 +00:00
|
|
|
}
|
2014-06-04 19:42:08 +00:00
|
|
|
if ($enableClipboard) $this->printClipboard($this->params['session']->getClipboard());
|
2014-07-11 06:42:57 +00:00
|
|
|
|
2014-06-04 19:42:08 +00:00
|
|
|
echo "</div>\n";
|
2013-05-26 16:55:57 +00:00
|
|
|
}
|
2013-06-13 12:57:16 +00:00
|
|
|
echo "<div class=\"span".$RightColumnSpan."\">\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
|
2014-11-11 15:01:36 +00:00
|
|
|
if ($enableDropUpload && $folder->getAccessMode($user) >= M_READWRITE) {
|
2014-07-11 06:42:57 +00:00
|
|
|
echo "<div class=\"row-fluid\">";
|
|
|
|
echo "<div class=\"span8\">";
|
|
|
|
}
|
2014-07-11 10:58:44 +00:00
|
|
|
$owner = $folder->getOwner();
|
2014-07-11 06:42:57 +00:00
|
|
|
$this->contentHeading(getMLText("folder_infos"));
|
2012-12-14 07:53:13 +00:00
|
|
|
$this->contentContainerStart();
|
|
|
|
echo "<table class=\"table-condensed\">\n";
|
2013-02-07 21:40:13 +00:00
|
|
|
if($user->isAdmin()) {
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>".getMLText("id").":</td>\n";
|
|
|
|
echo "<td>".htmlspecialchars($folder->getID())."</td>\n";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>".getMLText("owner").":</td>\n";
|
|
|
|
echo "<td><a href=\"mailto:".htmlspecialchars($owner->getEmail())."\">".htmlspecialchars($owner->getFullName())."</a></td>\n";
|
|
|
|
echo "</tr>";
|
2013-02-06 13:58:36 +00:00
|
|
|
if($folder->getComment()) {
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>".getMLText("comment").":</td>\n";
|
|
|
|
echo "<td>".htmlspecialchars($folder->getComment())."</td>\n";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if($user->isAdmin()) {
|
|
|
|
if($folder->inheritsAccess()) {
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>".getMLText("access_mode").":</td>\n";
|
|
|
|
echo "<td>";
|
|
|
|
echo getMLText("inherited");
|
|
|
|
echo "</tr>";
|
|
|
|
} else {
|
|
|
|
echo "<tr>";
|
2013-02-16 18:43:39 +00:00
|
|
|
echo "<td>".getMLText('default_access').":</td>";
|
2013-02-06 13:58:36 +00:00
|
|
|
echo "<td>".$this->getAccessModeText($folder->getDefaultAccess())."</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
2013-02-16 18:43:39 +00:00
|
|
|
echo "<td>".getMLText('access_mode').":</td>";
|
2013-02-06 13:58:36 +00:00
|
|
|
echo "<td>";
|
|
|
|
$this->printAccessList($folder);
|
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
$attributes = $folder->getAttributes();
|
|
|
|
if($attributes) {
|
|
|
|
foreach($attributes as $attribute) {
|
|
|
|
$attrdef = $attribute->getAttributeDefinition();
|
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
2014-11-13 07:21:49 +00:00
|
|
|
<td><?php echo htmlspecialchars(implode(', ', $attribute->getValueAsArray())); ?></td>
|
2012-12-14 07:53:13 +00:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
$this->contentContainerEnd();
|
2014-11-11 15:01:36 +00:00
|
|
|
if ($enableDropUpload && $folder->getAccessMode($user) >= M_READWRITE) {
|
2014-07-11 06:42:57 +00:00
|
|
|
echo "</div>";
|
|
|
|
echo "<div class=\"span4\">";
|
|
|
|
$this->contentHeading(getMLText("dropupload"), true);
|
|
|
|
$this->addFooterJS("SeedDMSUpload.setUrl('../op/op.Ajax.php');");
|
2014-07-11 10:04:13 +00:00
|
|
|
$this->addFooterJS("SeedDMSUpload.setAbortBtnLabel('".getMLText("cancel")."');");
|
2014-07-11 06:42:57 +00:00
|
|
|
$this->addFooterJS("SeedDMSUpload.setEditBtnLabel('".getMLText("edit_document_props")."');");
|
2014-07-11 10:04:13 +00:00
|
|
|
$this->addFooterJS("SeedDMSUpload.setMaxFileSize(".SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize")).");");
|
|
|
|
$this->addFooterJS("SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');");
|
2014-07-11 06:42:57 +00:00
|
|
|
?>
|
|
|
|
<div id="dragandrophandler" class="well alert" data-target="<?php echo $folder->getID(); ?>" data-formtoken="<?php echo createFormKey('adddocument'); ?>"><?php printMLText('drop_files_here'); ?></div>
|
|
|
|
<?php
|
|
|
|
echo "</div>";
|
|
|
|
echo "</div>";
|
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
$this->contentHeading(getMLText("folder_contents"));
|
|
|
|
|
|
|
|
$subFolders = $folder->getSubFolders($orderby);
|
2013-02-14 11:10:53 +00:00
|
|
|
$subFolders = SeedDMS_Core_DMS::filterAccess($subFolders, $user, M_READ);
|
2012-12-14 07:53:13 +00:00
|
|
|
$documents = $folder->getDocuments($orderby);
|
2013-02-14 11:10:53 +00:00
|
|
|
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
if ((count($subFolders) > 0)||(count($documents) > 0)){
|
2014-06-04 17:22:54 +00:00
|
|
|
print "<table id=\"viewfolder-table\" class=\"table\">";
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<thead>\n<tr>\n";
|
|
|
|
print "<th></th>\n";
|
2014-02-01 14:23:19 +00:00
|
|
|
print "<th><a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"?"&orderby=s":"&orderby=n")."\">".getMLText("name")."</a></th>\n";
|
2013-05-31 12:33:54 +00:00
|
|
|
// print "<th>".getMLText("owner")."</th>\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
print "<th>".getMLText("status")."</th>\n";
|
2013-05-31 12:33:54 +00:00
|
|
|
// print "<th>".getMLText("version")."</th>\n";
|
2013-02-02 16:01:55 +00:00
|
|
|
print "<th>".getMLText("action")."</th>\n";
|
2012-12-14 07:53:13 +00:00
|
|
|
print "</tr>\n</thead>\n<tbody>\n";
|
|
|
|
}
|
2013-01-24 09:31:17 +00:00
|
|
|
else printMLText("empty_folder_list");
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
foreach($subFolders as $subFolder) {
|
2014-06-06 12:00:59 +00:00
|
|
|
echo $this->folderListRow($subFolder);
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
|
2014-02-21 20:51:53 +00:00
|
|
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth);
|
2012-12-14 07:53:13 +00:00
|
|
|
foreach($documents as $document) {
|
2014-06-06 12:00:59 +00:00
|
|
|
echo $this->documentListRow($document, $previewer);
|
2012-12-14 07:53:13 +00:00
|
|
|
}
|
|
|
|
|
2014-07-11 10:58:44 +00:00
|
|
|
if ((count($subFolders) > 0)||(count($documents) > 0)) {
|
2014-06-06 12:00:59 +00:00
|
|
|
echo "</tbody>\n</table>\n";
|
2014-07-11 10:58:44 +00:00
|
|
|
}
|
2012-12-14 07:53:13 +00:00
|
|
|
|
2014-06-06 12:00:59 +00:00
|
|
|
echo "</div>\n"; // End of right column div
|
2012-12-14 07:53:13 +00:00
|
|
|
|
|
|
|
$this->contentEnd();
|
|
|
|
|
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|