seeddms-code/out/out.ViewFolder.php

163 lines
6.5 KiB
PHP
Raw Normal View History

2011-12-02 08:03:01 +00:00
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
2010-10-29 13:19:51 +00:00
// Copyright (C) 2010 Matteo Lucarelli
2011-12-02 08:03:01 +00:00
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php");
include("../inc/inc.Utils.php");
2010-10-29 13:19:51 +00:00
include("../inc/inc.DBInit.php");
2011-12-02 08:03:01 +00:00
include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php");
2010-10-29 13:19:51 +00:00
include("../inc/inc.Authentication.php");
2011-12-02 08:03:01 +00:00
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
$folderid = $settings->_rootFolderID;
}
else {
2012-08-28 07:18:00 +00:00
$folderid = intval($_GET["folderid"]);
2011-12-02 08:03:01 +00:00
}
$folder = $dms->getFolder($folderid);
2010-10-29 13:19:51 +00:00
if (!is_object($folder)) {
2011-12-02 08:03:01 +00:00
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
2010-10-29 13:19:51 +00:00
}
$showtree=showtree();
if (isset($_GET["orderby"]) && strlen($_GET["orderby"])==1 ) {
$orderby=$_GET["orderby"];
2011-12-02 08:03:01 +00:00
}else $orderby="";
$folderPathHTML = getFolderPathHTML($folder);
2011-12-02 08:03:01 +00:00
if ($folder->getAccessMode($user) < M_READ) {
2012-09-05 21:00:14 +00:00
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied"));
2011-12-02 08:03:01 +00:00
}
2010-10-29 13:19:51 +00:00
2012-09-05 21:00:14 +00:00
UI::htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
2011-12-02 08:03:01 +00:00
UI::globalNavigation($folder);
2010-10-29 13:19:51 +00:00
UI::pageNavigation($folderPathHTML, "view_folder", $folder);
if ($settings->_enableFolderTree) UI::printTreeNavigation($folderid,$showtree);
UI::contentHeading(getMLText("folder_infos"));
2011-12-02 08:03:01 +00:00
$owner = $folder->getOwner();
2012-10-09 10:16:36 +00:00
UI::contentContainerStart();
print "<table>\n<tr>\n".
2011-12-02 08:03:01 +00:00
"<td>".getMLText("owner").":</td>\n".
"<td><a class=\"infos\" href=\"mailto:".htmlspecialchars($owner->getEmail())."\">".htmlspecialchars($owner->getFullName())."</a>".
2011-12-02 08:03:01 +00:00
"</td>\n</tr>\n<tr>\n".
"<td>".getMLText("comment").":</td>\n".
2012-10-09 10:16:36 +00:00
"<td>".htmlspecialchars($folder->getComment())."</td>\n</tr>\n";
$attributes = $folder->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$attrdef = $attribute->getAttributeDefinition();
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php echo htmlspecialchars($attribute->getValue()); ?></td>
</tr>
<?php
}
}
print "</table>\n";
UI::contentContainerEnd();
2011-12-02 08:03:01 +00:00
UI::contentHeading(getMLText("folder_contents"));
UI::contentContainerStart();
$subFolders = $folder->getSubFolders($orderby);
$subFolders = LetoDMS_Core_DMS::filterAccess($subFolders, $user, M_READ);
$documents = $folder->getDocuments($orderby);
$documents = LetoDMS_Core_DMS::filterAccess($documents, $user, M_READ);
2010-10-29 13:19:51 +00:00
if ((count($subFolders) > 0)||(count($documents) > 0)){
2011-12-02 08:03:01 +00:00
print "<table class=\"folderView\">";
print "<thead>\n<tr>\n";
2010-10-29 13:19:51 +00:00
print "<th></th>\n";
2011-12-02 08:03:01 +00:00
print "<th><a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"?"":"&orderby=n")."\">".getMLText("name")."</a></th>\n";
2010-10-29 13:19:51 +00:00
print "<th>".getMLText("owner")."</th>\n";
2011-12-02 08:03:01 +00:00
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("comment")."</th>\n";
2010-10-29 13:19:51 +00:00
print "</tr>\n</thead>\n<tbody>\n";
}
else printMLText("empty_notify_list");
2011-12-02 08:03:01 +00:00
2010-10-29 13:19:51 +00:00
foreach($subFolders as $subFolder) {
2011-12-02 08:03:01 +00:00
$owner = $subFolder->getOwner();
2010-10-29 13:19:51 +00:00
$comment = $subFolder->getComment();
if (strlen($comment) > 50) $comment = substr($comment, 0, 47) . "...";
$subsub = $subFolder->getSubFolders();
$subsub = LetoDMS_Core_DMS::filterAccess($subsub, $user, M_READ);
2010-10-29 13:19:51 +00:00
$subdoc = $subFolder->getDocuments();
$subdoc = LetoDMS_Core_DMS::filterAccess($subdoc, $user, M_READ);
2011-12-02 08:03:01 +00:00
print "<tr class=\"folder\">";
// print "<td><img src=\"images/folder_closed.gif\" width=18 height=18 border=0></td>";
print "<td><a href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"><img src=\"images/folder_closed.gif\" width=18 height=18 border=0></a></td>\n";
print "<td><a href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a></td>\n";
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
print "<td colspan=\"1\"><small>".count($subsub)." ".getMLText("folders").", ".count($subdoc)." ".getMLText("documents")."</small></td>";
2011-12-02 08:03:01 +00:00
print "<td></td>";
print "<td>".htmlspecialchars($comment)."</td>";
2011-12-02 08:03:01 +00:00
print "</tr>\n";
}
2010-10-29 13:19:51 +00:00
foreach($documents as $document) {
2011-12-02 08:03:01 +00:00
$owner = $document->getOwner();
$comment = $document->getComment();
2010-10-29 13:19:51 +00:00
if (strlen($comment) > 50) $comment = substr($comment, 0, 47) . "...";
$docID = $document->getID();
$latestContent = $document->getLatestContent();
$version = $latestContent->getVersion();
$status = $latestContent->getStatus();
2011-12-02 08:03:01 +00:00
2010-10-29 13:19:51 +00:00
print "<tr>";
2011-01-28 08:03:54 +00:00
2011-12-02 08:03:01 +00:00
if (file_exists($dms->contentDir . $latestContent->getPath()))
print "<td><a href=\"../op/op.Download.php?documentid=".$docID."&version=".$version."\"><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></a></td>";
else print "<td><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>";
2010-10-29 13:19:51 +00:00
print "<td><a href=\"out.ViewDocument.php?documentid=".$docID."&showtree=".$showtree."\">" . htmlspecialchars($document->getName()) . "</a></td>\n";
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
print "<td>";
if ( $document->isLocked() ) {
print "<img src=\"".UI::getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
2011-12-02 08:03:01 +00:00
print getOverallStatusText($status["status"])."</td>";
print "<td>".$version."</td>";
print "<td>".htmlspecialchars($comment)."</td>";
2011-12-02 08:03:01 +00:00
print "</tr>\n";
}
2010-10-29 13:19:51 +00:00
if ((count($subFolders) > 0)||(count($documents) > 0)) echo "</tbody>\n</table>\n";
2011-12-02 08:03:01 +00:00
2010-10-29 13:19:51 +00:00
UI::contentContainerEnd();
if ($settings->_enableFolderTree) print "</td></tr></table>";
2011-12-02 08:03:01 +00:00
UI::htmlEndPage();
?>