- use $dms->contentDir

This commit is contained in:
steinm 2011-01-28 07:42:10 +00:00
parent b61813474a
commit 38760a712d
2 changed files with 544 additions and 543 deletions

View File

@ -1,156 +1,156 @@
<?php <?php
// MyDMS. Document Management System // MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal // Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe // Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2006-2008 Malcolm Cowe // Copyright (C) 2006-2008 Malcolm Cowe
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php"); include("../inc/inc.Settings.php");
include("../inc/inc.Utils.php"); include("../inc/inc.Utils.php");
include("../inc/inc.DBInit.php"); include("../inc/inc.DBInit.php");
include("../inc/inc.Language.php"); include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
$folderid = $_GET["folderid"]; $folderid = $_GET["folderid"];
$folder = $dms->getFolder($folderid); $folder = $dms->getFolder($folderid);
if (!is_object($folder)) { if (!is_object($folder)) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
$folderPathHTML = getFolderPathHTML($folder, true); $folderPathHTML = getFolderPathHTML($folder, true);
if ($folder->getAccessMode($user) < M_READ) { if ($folder->getAccessMode($user) < M_READ) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied")); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied"));
} }
$notifyList = $folder->getNotifyList(); $notifyList = $folder->getNotifyList();
UI::htmlStartPage(getMLText("folder_title", array("foldername" => $folder->getName()))); UI::htmlStartPage(getMLText("folder_title", array("foldername" => $folder->getName())));
UI::globalNavigation($folder); UI::globalNavigation($folder);
UI::pageNavigation($folderPathHTML, "view_folder", $folder); UI::pageNavigation($folderPathHTML, "view_folder", $folder);
?> ?>
<script language="JavaScript"> <script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = ""; msg = "";
if ((document.form1.userid.options[document.form1.userid.selectedIndex].value == -1) && if ((document.form1.userid.options[document.form1.userid.selectedIndex].value == -1) &&
(document.form1.groupid.options[document.form1.groupid.selectedIndex].value == -1)) (document.form1.groupid.options[document.form1.groupid.selectedIndex].value == -1))
msg += "<?php printMLText("js_select_user_or_group");?>\n"; msg += "<?php printMLText("js_select_user_or_group");?>\n";
if (msg != "") if (msg != "")
{ {
alert(msg); alert(msg);
return false; return false;
} }
else else
return true; return true;
} }
</script> </script>
<?php <?php
UI::contentHeading(getMLText("edit_existing_notify")); UI::contentHeading(getMLText("edit_existing_notify"));
UI::contentContainerStart(); UI::contentContainerStart();
$userNotifyIDs = array(); $userNotifyIDs = array();
$groupNotifyIDs = array(); $groupNotifyIDs = array();
print "<table class=\"defaultView\">\n"; print "<table class=\"defaultView\">\n";
if ((count($notifyList["users"]) == 0) && (count($notifyList["groups"]) == 0)) { if (empty($notifyList["users"]) && empty($notifyList["groups"])) {
print "<tr><td>".getMLText("empty_notify_list")."</td></tr>"; print "<tr><td>".getMLText("empty_notify_list")."</td></tr>";
} }
else { else {
foreach ($notifyList["users"] as $userNotify) { foreach ($notifyList["users"] as $userNotify) {
print "<tr>"; print "<tr>";
print "<td><img src=\"images/usericon.gif\" class=\"mimeicon\"></td>"; print "<td><img src=\"images/usericon.gif\" class=\"mimeicon\"></td>";
print "<td>" . $userNotify->getFullName() . "</td>"; print "<td>" . $userNotify->getFullName() . "</td>";
if ($user->isAdmin() || $user->getID() == $userNotify->getID()) { if ($user->isAdmin() || $user->getID() == $userNotify->getID()) {
print "<td><a href=\"../op/op.FolderNotify.php?folderid=". $folderid . "&action=delnotify&userid=".$userNotify->getID()."\"><img src=\"images/del.gif\" class=\"mimeicon\"></a>".getMLText("delete")."</td>"; print "<td><a href=\"../op/op.FolderNotify.php?folderid=". $folderid . "&action=delnotify&userid=".$userNotify->getID()."\"><img src=\"images/del.gif\" class=\"mimeicon\"></a>".getMLText("delete")."</td>";
}else print "<td></td>"; }else print "<td></td>";
print "</tr>"; print "</tr>";
$userNotifyIDs[] = $userNotify->getID(); $userNotifyIDs[] = $userNotify->getID();
} }
foreach ($notifyList["groups"] as $groupNotify) { foreach ($notifyList["groups"] as $groupNotify) {
print "<tr>"; print "<tr>";
print "<td><img src=\"images/groupicon.gif\" class=\"mimeicon\"></td>"; print "<td><img src=\"images/groupicon.gif\" class=\"mimeicon\"></td>";
print "<td>" . $groupNotify->getName() . "</td>"; print "<td>" . $groupNotify->getName() . "</td>";
if ($user->isAdmin() || $groupNotify->isMember($user,true)) { if ($user->isAdmin() || $groupNotify->isMember($user,true)) {
print "<td><a href=\"../op/op.FolderNotify.php?folderid=". $folderid . "&action=delnotify&groupid=".$groupNotify->getID()."\"><img src=\"images/del.gif\" class=\"mimeicon\"></a>".getMLText("delete")."</td>"; print "<td><a href=\"../op/op.FolderNotify.php?folderid=". $folderid . "&action=delnotify&groupid=".$groupNotify->getID()."\"><img src=\"images/del.gif\" class=\"mimeicon\"></a>".getMLText("delete")."</td>";
}else print "<td></td>"; }else print "<td></td>";
print "</tr>"; print "</tr>";
$groupNotifyIDs[] = $groupNotify->getID(); $groupNotifyIDs[] = $groupNotify->getID();
} }
} }
print "</table>\n"; print "</table>\n";
?> ?>
<br> <br>
<form action="../op/op.FolderNotify.php" name="form1" onsubmit="return checkForm();"> <form action="../op/op.FolderNotify.php" name="form1" onsubmit="return checkForm();">
<input type="Hidden" name="folderid" value="<?php print $folderid?>"> <input type="Hidden" name="folderid" value="<?php print $folderid?>">
<input type="Hidden" name="action" value="addnotify"> <input type="Hidden" name="action" value="addnotify">
<table> <table>
<tr> <tr>
<td><?php printMLText("user");?>:</td> <td><?php printMLText("user");?>:</td>
<td> <td>
<select name="userid"> <select name="userid">
<option value="-1"><?php printMLText("select_one");?> <option value="-1"><?php printMLText("select_one");?>
<?php <?php
if ($user->isAdmin()) { if ($user->isAdmin()) {
$allUsers = $dms->getAllUsers(); $allUsers = $dms->getAllUsers();
foreach ($allUsers as $userObj) { foreach ($allUsers as $userObj) {
if (!$userObj->isGuest() && !in_array($userObj->getID(), $userNotifyIDs)) if (!$userObj->isGuest() && !in_array($userObj->getID(), $userNotifyIDs))
print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n"; print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
} }
} }
elseif (!$user->isGuest() && !in_array($user->getID(), $userNotifyIDs)) { elseif (!$user->isGuest() && !in_array($user->getID(), $userNotifyIDs)) {
print "<option value=\"".$user->getID()."\">" . $user->getFullName() . "\n"; print "<option value=\"".$user->getID()."\">" . $user->getFullName() . "\n";
} }
?> ?>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("group");?>:</td> <td><?php printMLText("group");?>:</td>
<td> <td>
<select name="groupid"> <select name="groupid">
<option value="-1"><?php printMLText("select_one");?> <option value="-1"><?php printMLText("select_one");?>
<?php <?php
$allGroups = $dms->getAllGroups(); $allGroups = $dms->getAllGroups();
foreach ($allGroups as $groupObj) { foreach ($allGroups as $groupObj) {
if (($user->isAdmin() || $groupObj->isMember($user,true)) && !in_array($groupObj->getID(), $groupNotifyIDs)) { if (($user->isAdmin() || $groupObj->isMember($user,true)) && !in_array($groupObj->getID(), $groupNotifyIDs)) {
print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n"; print "<option value=\"".$groupObj->getID()."\">" . $groupObj->getName() . "\n";
} }
} }
?> ?>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><input type="Submit" value="<?php printMLText("add") ?>"></td> <td colspan="2"><input type="Submit" value="<?php printMLText("add") ?>"></td>
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php
UI::contentContainerEnd(); UI::contentContainerEnd();
UI::htmlEndPage(); UI::htmlEndPage();
?> ?>

View File

@ -1,31 +1,32 @@
<?php <?php
// MyDMS. Document Management System // MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal // Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe // Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli // Copyright (C) 2010 Matteo Lucarelli
// // Copyright (C) 2011 Uwe Steinmann
// 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 // This program is free software; you can redistribute it and/or modify
// the Free Software Foundation; either version 2 of the License, or // it under the terms of the GNU General Public License as published by
// (at your option) any later version. // 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 // This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. // 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 // You should have received a copy of the GNU General Public License
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // 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"); include("../inc/inc.Settings.php");
include("../inc/inc.Utils.php");
include("../inc/inc.DBInit.php"); include("../inc/inc.DBInit.php");
include("../inc/inc.Language.php"); include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
function filterDocumentLinks($user, $links) { function filterDocumentLinks($user, $links) { /* {{{ */
GLOBAL $settings; GLOBAL $settings;
$tmp = array(); $tmp = array();
@ -33,249 +34,249 @@ function filterDocumentLinks($user, $links) {
if ($link->isPublic() || ($link->_userID == $user->getID()) || $user->isAdmin()) if ($link->isPublic() || ($link->_userID == $user->getID()) || $user->isAdmin())
array_push($tmp, $link); array_push($tmp, $link);
return $tmp; return $tmp;
} /* }}} */
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
} }
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { $documentid = $_GET["documentid"];
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
}
$documentid = $_GET["documentid"];
$document = $dms->getDocument($documentid); $document = $dms->getDocument($documentid);
if (!is_object($document)) { if (!is_object($document)) {
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
} }
$folder = $document->getFolder(); $folder = $document->getFolder();
$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName(); $docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName();
if ($document->getAccessMode($user) < M_READ) { if ($document->getAccessMode($user) < M_READ) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
} }
if ($document->verifyLastestContentExpriry()){ if ($document->verifyLastestContentExpriry()){
header("Location:../out/out.ViewDocument.php?documentid=".$documentid); header("Location:../out/out.ViewDocument.php?documentid=".$documentid);
} }
$versions = $document->getContent(); $versions = $document->getContent();
$latestContent = $document->getLatestContent(); $latestContent = $document->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
$reviewStatus = $latestContent->getReviewStatus(); $reviewStatus = $latestContent->getReviewStatus();
$approvalStatus = $latestContent->getApprovalStatus(); $approvalStatus = $latestContent->getApprovalStatus();
// verify if file exists // verify if file exists
$file_exists=file_exists($settings->_contentDir . $latestContent->getPath()); $file_exists=file_exists($dms->contentDir . $latestContent->getPath());
UI::htmlStartPage(getMLText("document_title", array("documentname" => $document->getName()))); UI::htmlStartPage(getMLText("document_title", array("documentname" => $document->getName())));
UI::globalNavigation($folder); UI::globalNavigation($folder);
UI::pageNavigation($docPathHTML, "view_document"); UI::pageNavigation($docPathHTML, "view_document");
UI::contentHeading(getMLText("document_infos")); UI::contentHeading(getMLText("document_infos"));
UI::contentContainerStart(); UI::contentContainerStart();
?> ?>
<table> <table>
<?php <?php
if ($document->isLocked()) { if ($document->isLocked()) {
$lockingUser = $document->getLockingUser(); $lockingUser = $document->getLockingUser();
?> ?>
<tr> <tr>
<td class="warning" colspan=2><?php printMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => $lockingUser->getFullName()));?></td> <td class="warning" colspan=2><?php printMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => $lockingUser->getFullName()));?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
<tr> <tr>
<td><?php printMLText("owner");?>:</td> <td><?php printMLText("owner");?>:</td>
<td> <td>
<?php <?php
$owner = $document->getOwner(); $owner = $document->getOwner();
print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".$owner->getFullName()."</a>"; print "<a class=\"infos\" href=\"mailto:".$owner->getEmail()."\">".$owner->getFullName()."</a>";
?> ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("comment");?>:</td> <td><?php printMLText("comment");?>:</td>
<td><?php print $document->getComment();?></td> <td><?php print $document->getComment();?></td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("creation_date");?>:</td> <td><?php printMLText("creation_date");?>:</td>
<td><?php print getLongReadableDate($document->getDate()); ?></td> <td><?php print getLongReadableDate($document->getDate()); ?></td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("keywords");?>:</td> <td><?php printMLText("keywords");?>:</td>
<td><?php print $document->getKeywords();?></td> <td><?php print $document->getKeywords();?></td>
</tr> </tr>
</table> </table>
<?php <?php
UI::contentContainerEnd(); UI::contentContainerEnd();
UI::contentHeading(getMLText("current_version")); UI::contentHeading(getMLText("current_version"));
UI::contentContainerStart(); UI::contentContainerStart();
print "<table class=\"folderView\">"; print "<table class=\"folderView\">";
print "<thead>\n<tr>\n"; print "<thead>\n<tr>\n";
print "<th width='10%'></th>\n"; print "<th width='10%'></th>\n";
print "<th width='10%'>".getMLText("version")."</th>\n"; print "<th width='10%'>".getMLText("version")."</th>\n";
print "<th width='20%'>".getMLText("file")."</th>\n"; print "<th width='20%'>".getMLText("file")."</th>\n";
print "<th width='25%'>".getMLText("comment")."</th>\n"; print "<th width='25%'>".getMLText("comment")."</th>\n";
print "<th width='15%'>".getMLText("status")."</th>\n"; print "<th width='15%'>".getMLText("status")."</th>\n";
print "<th width='20%'></th>\n"; print "<th width='20%'></th>\n";
print "</tr></thead><tbody>\n"; print "</tr></thead><tbody>\n";
print "<tr>\n"; print "<tr>\n";
print "<td><ul class=\"actions\">"; print "<td><ul class=\"actions\">";
if ($file_exists){ if ($file_exists){
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\"><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($latestContent->getFileType())."\" title=\"".$latestContent->getMimeType()."\">".getMLText("download")."</a></li>"; print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\"><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($latestContent->getFileType())."\" title=\"".$latestContent->getMimeType()."\">".getMLText("download")."</a></li>";
if ($latestContent->viewOnline()) if ($latestContent->viewOnline())
print "<li><a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=". $latestContent->getVersion()."\"><img src=\"images/view.gif\" class=\"mimeicon\">" . getMLText("view_online") . "</a></li>"; print "<li><a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=". $latestContent->getVersion()."\"><img src=\"images/view.gif\" class=\"mimeicon\">" . getMLText("view_online") . "</a></li>";
}else print "<li><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($latestContent->getFileType())."\" title=\"".$latestContent->getMimeType()."\"></li>"; }else print "<li><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($latestContent->getFileType())."\" title=\"".$latestContent->getMimeType()."\"></li>";
print "</ul></td>\n"; print "</ul></td>\n";
print "<td>".$latestContent->getVersion()."</td>\n"; print "<td>".$latestContent->getVersion()."</td>\n";
print "<td><ul class=\"documentDetail\">\n"; print "<td><ul class=\"documentDetail\">\n";
print "<li>".$latestContent->getOriginalFileName() ."</li>\n"; print "<li>".$latestContent->getOriginalFileName() ."</li>\n";
if ($file_exists) if ($file_exists)
print "<li>". formatted_size(filesize($settings->_contentDir . $latestContent->getPath())) ." ".$latestContent->getMimeType()."</li>"; print "<li>". formatted_size(filesize($dms->contentDir . $latestContent->getPath())) ." ".$latestContent->getMimeType()."</li>";
else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>"; else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
$updatingUser = $latestContent->getUser(); $updatingUser = $latestContent->getUser();
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".$updatingUser->getEmail()."\">".$updatingUser->getFullName()."</a></li>"; print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".$updatingUser->getEmail()."\">".$updatingUser->getFullName()."</a></li>";
print "<li>".getLongReadableDate($latestContent->getDate())."</li>"; print "<li>".getLongReadableDate($latestContent->getDate())."</li>";
print "</ul>\n"; print "</ul>\n";
print "<td>".$latestContent->getComment()."</td>"; print "<td>".$latestContent->getComment()."</td>";
print "<td width='10%'>".getOverallStatusText($status["status"]); print "<td width='10%'>".getOverallStatusText($status["status"]);
if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_EXPIRED ){ if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_EXPIRED ){
print "<br><span".($document->hasExpired()?" class=\"warning\" ":"").">".(!$document->getExpires() ? getMLText("does_not_expire") : getMLText("expires").": ".getReadableDate($document->getExpires()))."</span>"; print "<br><span".($document->hasExpired()?" class=\"warning\" ":"").">".(!$document->getExpires() ? getMLText("does_not_expire") : getMLText("expires").": ".getReadableDate($document->getExpires()))."</span>";
} }
print "</td>"; print "</td>";
print "<td>"; print "<td>";
print "<ul class=\"actions\">"; print "<ul class=\"actions\">";
if (($document->getAccessMode($user) >= M_READWRITE) && (count($versions) > 1)) { if (($document->getAccessMode($user) >= M_READWRITE) && (count($versions) > 1)) {
print "<li><a href=\"out.RemoveVersion.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("rm_version")."</a></li>"; print "<li><a href=\"out.RemoveVersion.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("rm_version")."</a></li>";
} }
if ($document->getAccessMode($user) == M_ALL) { if ($document->getAccessMode($user) == M_ALL) {
if ( $status["status"]==S_RELEASED || $status["status"]==S_OBSOLETE ){ if ( $status["status"]==S_RELEASED || $status["status"]==S_OBSOLETE ){
print "<li><a href='../out/out.OverrideContentStatus.php?documentid=".$documentid."&version=".$latestContent->getVersion()."'>".getMLText("change_status")."</a></li>"; print "<li><a href='../out/out.OverrideContentStatus.php?documentid=".$documentid."&version=".$latestContent->getVersion()."'>".getMLText("change_status")."</a></li>";
} }
if ( $status["status"]==S_RELEASED || $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP ){ if ( $status["status"]==S_RELEASED || $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP ){
print "<li><a href='../out/out.SetReviewersApprovers.php?documentid=".$documentid."&version=".$latestContent->getVersion()."'>".getMLText("change_assignments")."</a></li>"; print "<li><a href='../out/out.SetReviewersApprovers.php?documentid=".$documentid."&version=".$latestContent->getVersion()."'>".getMLText("change_assignments")."</a></li>";
} }
if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_EXPIRED ){ if ( $status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP || $status["status"]==S_EXPIRED ){
print "<li><a href='../out/out.SetExpires.php?documentid=".$documentid."'>".getMLText("set_expiry")."</a></li>"; print "<li><a href='../out/out.SetExpires.php?documentid=".$documentid."'>".getMLText("set_expiry")."</a></li>";
} }
} }
if ($document->getAccessMode($user) >= M_READWRITE) { if ($document->getAccessMode($user) >= M_READWRITE) {
print "<li><a href=\"out.EditComment.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("edit_comment")."</a></li>"; print "<li><a href=\"out.EditComment.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("edit_comment")."</a></li>";
} }
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&vfile=1\">".getMLText("versioning_info")."</a></li>"; print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&vfile=1\">".getMLText("versioning_info")."</a></li>";
print "</ul>"; print "</ul>";
echo "</td>"; echo "</td>";
print "</tr></tbody>\n</table>\n"; print "</tr></tbody>\n</table>\n";
// //
// retrieve if the user is a reviewer or approver for this document. // retrieve if the user is a reviewer or approver for this document.
// //
$userRStat = $user->getReviewStatus($documentid, $latestContent->getVersion()); $userRStat = $user->getReviewStatus($documentid, $latestContent->getVersion());
$userAStat = $user->getApprovalStatus($documentid, $latestContent->getVersion()); $userAStat = $user->getApprovalStatus($documentid, $latestContent->getVersion());
$is_reviewer = false; $is_reviewer = false;
$is_approver = false; $is_approver = false;
if (!is_bool($userRStat)) { if (!is_bool($userRStat)) {
if (count($userRStat["indstatus"])>0) { if (count($userRStat["indstatus"])>0) {
if ($userRStat["indstatus"][0]["status"]==0) { if ($userRStat["indstatus"][0]["status"]==0) {
$is_reviewer = true; $is_reviewer = true;
} }
} }
else { else {
foreach ($userRStat["grpstatus"] as $grpstatus) { foreach ($userRStat["grpstatus"] as $grpstatus) {
if ($grpstatus["status"]==0) { if ($grpstatus["status"]==0) {
$is_reviewer = true; $is_reviewer = true;
break; break;
} }
} }
} }
} }
if (!is_bool($userAStat)) { if (!is_bool($userAStat)) {
if (count($userAStat["indstatus"])>0) { if (count($userAStat["indstatus"])>0) {
if ($userAStat["indstatus"][0]["status"]==0) { if ($userAStat["indstatus"][0]["status"]==0) {
$is_approver = true; $is_approver = true;
} }
} }
else { else {
foreach ($userAStat["grpstatus"] as $grpstatus) { foreach ($userAStat["grpstatus"] as $grpstatus) {
if ($grpstatus["status"]==0) { if ($grpstatus["status"]==0) {
$is_approver = true; $is_approver = true;
break; break;
} }
} }
} }
} }
print "<table class=\"folderView\">\n"; print "<table class=\"folderView\">\n";
if (is_array($reviewStatus) && count($reviewStatus)>0) { if (is_array($reviewStatus) && count($reviewStatus)>0) {
print "<tr><td colspan=5>\n"; print "<tr><td colspan=5>\n";
UI::contentSubHeading(getMLText("reviewers")); UI::contentSubHeading(getMLText("reviewers"));
print "</tr>"; print "</tr>";
print "<tr>\n"; print "<tr>\n";
print "<td width='20%'><b>".getMLText("name")."</b></td>\n"; print "<td width='20%'><b>".getMLText("name")."</b></td>\n";
print "<td width='20%'><b>".getMLText("last_update")."</b></td>\n"; print "<td width='20%'><b>".getMLText("last_update")."</b></td>\n";
print "<td width='25%'><b>".getMLText("comment")."</b></td>"; print "<td width='25%'><b>".getMLText("comment")."</b></td>";
print "<td width='15%'><b>".getMLText("status")."</b></td>\n"; print "<td width='15%'><b>".getMLText("status")."</b></td>\n";
print "<td width='20%'></td>\n"; print "<td width='20%'></td>\n";
print "</tr>\n"; print "</tr>\n";
foreach ($reviewStatus as $r) { foreach ($reviewStatus as $r) {
$required = null; $required = null;
switch ($r["type"]) { switch ($r["type"]) {
case 0: // Reviewer is an individual. case 0: // Reviewer is an individual.
$required = $dms->getUser($r["required"]); $required = $dms->getUser($r["required"]);
if (!is_object($required)) { if (!is_object($required)) {
$reqName = getMLText("unknown_user")." '".$r["required"]."'"; $reqName = getMLText("unknown_user")." '".$r["required"]."'";
} }
else { else {
$reqName = $required->getFullName(); $reqName = $required->getFullName();
} }
break; break;
case 1: // Reviewer is a group. case 1: // Reviewer is a group.
$required = $dms->getGroup($r["required"]); $required = $dms->getGroup($r["required"]);
if (!is_object($required)) { if (!is_object($required)) {
$reqName = getMLText("unknown_group")." '".$r["required"]."'"; $reqName = getMLText("unknown_group")." '".$r["required"]."'";
} }
else { else {
$reqName = "<i>".$required->getName()."</i>"; $reqName = "<i>".$required->getName()."</i>";
} }
break; break;
} }
print "<tr>\n"; print "<tr>\n";
print "<td>".$reqName."</td>\n"; print "<td>".$reqName."</td>\n";
print "<td><ul class=\"documentDetail\"><li>".$r["date"]."</li>"; print "<td><ul class=\"documentDetail\"><li>".$r["date"]."</li>";
$updateUser = $dms->getUser($r["userID"]); $updateUser = $dms->getUser($r["userID"]);
print "<li>".(is_object($updateUser) ? $updateUser->getFullName() : "unknown user id '".$r["userID"]."'")."</li></ul></td>"; print "<li>".(is_object($updateUser) ? $updateUser->getFullName() : "unknown user id '".$r["userID"]."'")."</li></ul></td>";
print "<td>".$r["comment"]."</td>\n"; print "<td>".$r["comment"]."</td>\n";
print "<td>".getReviewStatusText($r["status"])."</td>\n"; print "<td>".getReviewStatusText($r["status"])."</td>\n";
print "<td><ul class=\"actions\">"; print "<td><ul class=\"actions\">";
if ($is_reviewer && $status["status"]==S_DRAFT_REV) { if ($is_reviewer && $status["status"]==S_DRAFT_REV) {
print "<li><a href=\"../out/out.ReviewDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("submit_review")."</a></li>"; print "<li><a href=\"../out/out.ReviewDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("submit_review")."</a></li>";
}else if (($updateUser==$user)&&(($r["status"]==1)||($r["status"]==-1))&&(!$document->hasExpired())){ }else if (($updateUser==$user)&&(($r["status"]==1)||($r["status"]==-1))&&(!$document->hasExpired())){
print "<li><a href=\"../out/out.ReviewDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("edit")."</a></li>"; print "<li><a href=\"../out/out.ReviewDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("edit")."</a></li>";
} }
print "</ul></td>\n"; print "</ul></td>\n";
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
} }
} }
if (is_array($approvalStatus) && count($approvalStatus)>0) { if (is_array($approvalStatus) && count($approvalStatus)>0) {
@ -283,239 +284,239 @@ if (is_array($approvalStatus) && count($approvalStatus)>0) {
UI::contentSubHeading(getMLText("approvers")); UI::contentSubHeading(getMLText("approvers"));
print "</tr>"; print "</tr>";
print "<tr>\n"; print "<tr>\n";
print "<td width='20%'><b>".getMLText("name")."</b></td>\n"; print "<td width='20%'><b>".getMLText("name")."</b></td>\n";
print "<td width='20%'><b>".getMLText("last_update")."</b></td>\n"; print "<td width='20%'><b>".getMLText("last_update")."</b></td>\n";
print "<td width='25%'><b>".getMLText("comment")."</b></td>"; print "<td width='25%'><b>".getMLText("comment")."</b></td>";
print "<td width='15%'><b>".getMLText("status")."</b></td>\n"; print "<td width='15%'><b>".getMLText("status")."</b></td>\n";
print "<td width='20%'></td>\n"; print "<td width='20%'></td>\n";
print "</tr>\n"; print "</tr>\n";
foreach ($approvalStatus as $a) { foreach ($approvalStatus as $a) {
$required = null; $required = null;
switch ($a["type"]) { switch ($a["type"]) {
case 0: // Approver is an individual. case 0: // Approver is an individual.
$required = $dms->getUser($a["required"]); $required = $dms->getUser($a["required"]);
if (!is_object($required)) { if (!is_object($required)) {
$reqName = getMLText("unknown_user")." '".$r["required"]."'"; $reqName = getMLText("unknown_user")." '".$r["required"]."'";
} }
else { else {
$reqName = $required->getFullName(); $reqName = $required->getFullName();
} }
break; break;
case 1: // Approver is a group. case 1: // Approver is a group.
$required = $dms->getGroup($a["required"]); $required = $dms->getGroup($a["required"]);
if (!is_object($required)) { if (!is_object($required)) {
$reqName = getMLText("unknown_group")." '".$r["required"]."'"; $reqName = getMLText("unknown_group")." '".$r["required"]."'";
} }
else { else {
$reqName = "<i>".$required->getName()."</i>"; $reqName = "<i>".$required->getName()."</i>";
} }
break; break;
} }
print "<tr>\n"; print "<tr>\n";
print "<td>".$reqName."</td>\n"; print "<td>".$reqName."</td>\n";
print "<td><ul class=\"documentDetail\"><li>".$a["date"]."</li>"; print "<td><ul class=\"documentDetail\"><li>".$a["date"]."</li>";
$updateUser = $dms->getUser($a["userID"]); $updateUser = $dms->getUser($a["userID"]);
print "<li>".(is_object($updateUser) ? $updateUser->getFullName() : "unknown user id '".$a["userID"]."'")."</li></ul></td>"; print "<li>".(is_object($updateUser) ? $updateUser->getFullName() : "unknown user id '".$a["userID"]."'")."</li></ul></td>";
print "<td>".$a["comment"]."</td>\n"; print "<td>".$a["comment"]."</td>\n";
print "<td>".getApprovalStatusText($a["status"])."</td>\n"; print "<td>".getApprovalStatusText($a["status"])."</td>\n";
print "<td><ul class=\"actions\">"; print "<td><ul class=\"actions\">";
if ($is_approver && $status["status"]==S_DRAFT_APP) { if ($is_approver && $status["status"]==S_DRAFT_APP) {
print "<li><a href=\"../out/out.ApproveDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("submit_approval")."</a></li>"; print "<li><a href=\"../out/out.ApproveDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("submit_approval")."</a></li>";
}else if (($updateUser==$user)&&(($a["status"]==1)||($a["status"]==-1))&&(!$document->hasExpired())){ }else if (($updateUser==$user)&&(($a["status"]==1)||($a["status"]==-1))&&(!$document->hasExpired())){
print "<li><a href=\"../out/out.ApproveDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("edit")."</a></li>"; print "<li><a href=\"../out/out.ApproveDocument.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">".getMLText("edit")."</a></li>";
} }
print "</ul></td>\n"; print "</ul></td>\n";
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
} }
} }
print "</table>\n"; print "</table>\n";
UI::contentContainerEnd();
UI::contentHeading(getMLText("previous_versions"));
UI::contentContainerStart();
if (count($versions)>1) {
print "<table class=\"folderView\">";
print "<thead>\n<tr>\n";
print "<th width='10%'></th>\n";
print "<th width='10%'>".getMLText("version")."</th>\n";
print "<th width='20%'>".getMLText("file")."</th>\n";
print "<th width='25%'>".getMLText("comment")."</th>\n";
print "<th width='15%'>".getMLText("status")."</th>\n";
print "<th width='20%'></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
for ($i = count($versions)-2; $i >= 0; $i--) {
$version = $versions[$i];
$vstat = $version->getStatus();
$comment = $version->getComment();
// verify if file exists
$file_exists=file_exists($settings->_contentDir . $version->getPath());
print "<tr>\n";
print "<td><ul class=\"actions\">";
if ($file_exists){
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$version->getVersion()."\"><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($version->getFileType())."\" title=\"".$version->getMimeType()."\">".getMLText("download")."</a>";
if ($version->viewOnline())
print "<li><a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=".$version->getVersion()."\"><img src=\"images/view.gif\" class=\"mimeicon\">" . getMLText("view_online") . "</a>";
}else print "<li><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($version->getFileType())."\" title=\"".$version->getMimeType()."\">";
print "</ul></td>\n";
print "<td>".$version->getVersion()."</td>\n";
print "<td><ul class=\"documentDetail\">\n";
print "<li>".$version->getOriginalFileName()."</li>\n";
if ($file_exists) print "<li>". formatted_size(filesize($settings->_contentDir . $version->getPath())) ." ".$version->getMimeType()."</li>";
else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
$updatingUser = $version->getUser();
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".$updatingUser->getEmail()."\">".$updatingUser->getFullName()."</a><li>";
print "<li>".getLongReadableDate($version->getDate())."</li>";
print "</ul>\n";
print "<td>".$version->getComment()."</td>";
print "<td>".getOverallStatusText($vstat["status"])."</td>";
print "<td>";
print "<ul class=\"actions\">";
if (($document->getAccessMode($user) == M_ALL) && (count($versions) > 1)) {
print "<li><a href=\"out.RemoveVersion.php?documentid=".$documentid."&version=".$version->getVersion()."\">".getMLText("rm_version")."</a></li>";
}
print "<li><a href='../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$version->getVersion()."'>".getMLText("details")."</a></li>";
print "</ul>";
print "</td>\n</tr>\n";
}
print "</tbody>\n</table>\n";
}
else printMLText("no_previous_versions");
UI::contentContainerEnd(); UI::contentContainerEnd();
UI::contentHeading(getMLText("linked_files")); UI::contentHeading(getMLText("previous_versions"));
UI::contentContainerStart(); UI::contentContainerStart();
if (count($versions)>1) {
print "<table class=\"folderView\">";
print "<thead>\n<tr>\n";
print "<th width='10%'></th>\n";
print "<th width='10%'>".getMLText("version")."</th>\n";
print "<th width='20%'>".getMLText("file")."</th>\n";
print "<th width='25%'>".getMLText("comment")."</th>\n";
print "<th width='15%'>".getMLText("status")."</th>\n";
print "<th width='20%'></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
for ($i = count($versions)-2; $i >= 0; $i--) {
$version = $versions[$i];
$vstat = $version->getStatus();
$comment = $version->getComment();
// verify if file exists
$file_exists=file_exists($dms->contentDir . $version->getPath());
print "<tr>\n";
print "<td><ul class=\"actions\">";
if ($file_exists){
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$version->getVersion()."\"><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($version->getFileType())."\" title=\"".$version->getMimeType()."\">".getMLText("download")."</a>";
if ($version->viewOnline())
print "<li><a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=".$version->getVersion()."\"><img src=\"images/view.gif\" class=\"mimeicon\">" . getMLText("view_online") . "</a>";
}else print "<li><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($version->getFileType())."\" title=\"".$version->getMimeType()."\">";
print "</ul></td>\n";
print "<td>".$version->getVersion()."</td>\n";
print "<td><ul class=\"documentDetail\">\n";
print "<li>".$version->getOriginalFileName()."</li>\n";
if ($file_exists) print "<li>". formatted_size(filesize($dms->contentDir . $version->getPath())) ." ".$version->getMimeType()."</li>";
else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
$updatingUser = $version->getUser();
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".$updatingUser->getEmail()."\">".$updatingUser->getFullName()."</a><li>";
print "<li>".getLongReadableDate($version->getDate())."</li>";
print "</ul>\n";
print "<td>".$version->getComment()."</td>";
print "<td>".getOverallStatusText($vstat["status"])."</td>";
print "<td>";
print "<ul class=\"actions\">";
if (($document->getAccessMode($user) == M_ALL) && (count($versions) > 1)) {
print "<li><a href=\"out.RemoveVersion.php?documentid=".$documentid."&version=".$version->getVersion()."\">".getMLText("rm_version")."</a></li>";
}
print "<li><a href='../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$version->getVersion()."'>".getMLText("details")."</a></li>";
print "</ul>";
print "</td>\n</tr>\n";
}
print "</tbody>\n</table>\n";
}
else printMLText("no_previous_versions");
UI::contentContainerEnd();
UI::contentHeading(getMLText("linked_files"));
UI::contentContainerStart();
$files = $document->getDocumentFiles(); $files = $document->getDocumentFiles();
if (count($files) > 0) { if (count($files) > 0) {
print "<table class=\"folderView\">"; print "<table class=\"folderView\">";
print "<thead>\n<tr>\n"; print "<thead>\n<tr>\n";
print "<th width='20%'></th>\n"; print "<th width='20%'></th>\n";
print "<th width='20%'>".getMLText("file")."</th>\n"; print "<th width='20%'>".getMLText("file")."</th>\n";
print "<th width='40%'>".getMLText("comment")."</th>\n"; print "<th width='40%'>".getMLText("comment")."</th>\n";
print "<th width='20%'></th>\n"; print "<th width='20%'></th>\n";
print "</tr>\n</thead>\n<tbody>\n"; print "</tr>\n</thead>\n<tbody>\n";
foreach($files as $file) { foreach($files as $file) {
$file_exists=file_exists($settings->_contentDir . $file->getPath()); $file_exists=file_exists($dms->contentDir . $file->getPath());
$responsibleUser = $file->getUser(); $responsibleUser = $file->getUser();
print "<tr>"; print "<tr>";
print "<td><ul class=\"actions\">"; print "<td><ul class=\"actions\">";
if ($file_exists) if ($file_exists)
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($file->getFileType())."\" title=\"".$file->getMimeType()."\">".$file->getName()."</a>"; print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($file->getFileType())."\" title=\"".$file->getMimeType()."\">".$file->getName()."</a>";
else print "<li><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($file->getFileType())."\" title=\"".$file->getMimeType()."\">"; else print "<li><img class=\"mimeicon\" src=\"images/icons/".UI::getMimeIcon($file->getFileType())."\" title=\"".$file->getMimeType()."\">";
print "</ul></td>"; print "</ul></td>";
print "<td><ul class=\"documentDetail\">\n"; print "<td><ul class=\"documentDetail\">\n";
print "<li>".$file->getOriginalFileName() ."</li>\n"; print "<li>".$file->getOriginalFileName() ."</li>\n";
if ($file_exists) if ($file_exists)
print "<li>". filesize($settings->_contentDir . $file->getPath()) ." bytes ".$file->getMimeType()."</li>"; print "<li>". filesize($dms->contentDir . $file->getPath()) ." bytes ".$file->getMimeType()."</li>";
else print "<li>".$file->getMimeType()." - <span class=\"warning\">".getMLText("document_deleted")."</span></li>"; else print "<li>".$file->getMimeType()." - <span class=\"warning\">".getMLText("document_deleted")."</span></li>";
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".$responsibleUser->getEmail()."\">".$responsibleUser->getFullName()."</a></li>";
print "<li>".getLongReadableDate($file->getDate())."</li>";
print "<td>".$file->getComment()."</td>"; print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".$responsibleUser->getEmail()."\">".$responsibleUser->getFullName()."</a></li>";
print "<li>".getLongReadableDate($file->getDate())."</li>";
print "<td>".$file->getComment()."</td>";
print "<td><span class=\"actions\">"; print "<td><span class=\"actions\">";
if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID()))
print "<a href=\"../out/out.RemoveDocumentFile.php?documentid=".$documentid."&fileid=".$file->getID()."\">".getMLText("delete")."</a>"; print "<a href=\"../out/out.RemoveDocumentFile.php?documentid=".$documentid."&fileid=".$file->getID()."\">".getMLText("delete")."</a>";
print "</span></td>"; print "</span></td>";
print "</tr>"; print "</tr>";
} }
print "</tbody>\n</table>\n"; print "</tbody>\n</table>\n";
} }
else printMLText("no_attached_files"); else printMLText("no_attached_files");
if ($document->getAccessMode($user) >= M_READWRITE){ if ($document->getAccessMode($user) >= M_READWRITE){
print "<br>"; print "<br>";
print "<ul class=\"actions\"><li><a href=\"../out/out.AddFile.php?documentid=".$documentid."\">".getMLText("add")."</a></ul>\n"; print "<ul class=\"actions\"><li><a href=\"../out/out.AddFile.php?documentid=".$documentid."\">".getMLText("add")."</a></ul>\n";
}
UI::contentContainerEnd();
UI::contentHeading(getMLText("linked_documents"));
UI::contentContainerStart();
$links = $document->getDocumentLinks();
$links = filterDocumentLinks($user, $links);
if (count($links) > 0) {
print "<table class=\"folderView\">";
print "<thead>\n<tr>\n";
print "<th width='40%'></th>\n";
print "<th width='25%'>".getMLText("comment")."</th>\n";
print "<th width='15%'>".getMLText("document_link_by")."</th>\n";
print "<th width='20%'></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($links as $link) {
$responsibleUser = $link->getUser();
$targetDoc = $link->getTarget();
print "<tr>";
print "<td><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
print "<td>".$targetDoc->getComment()."</td>";
print "<td>".$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 "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\">".getMLText("delete")."</a>";
print "</span></td>";
print "</tr>";
}
print "</tbody>\n</table>\n";
}
else printMLText("no_linked_files");
if (!$user->isGuest()){
?>
<br>
<form action="../op/op.AddDocumentLink.php" name="form1">
<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
<table>
<tr>
<td><?php printMLText("add_document_link");?>:</td>
<td><?php UI::printDocumentChooser("form1");?></td>
</tr>
<?php
if ($document->getAccessMode($user) >= M_READWRITE) {
print "<tr><td>".getMLText("document_link_public")."</td>";
print "<td><ul class=\"actions\">";
print "<li><input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes")."</li>";
print "<li><input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no")."</li>";
print "</ul></td></tr>";
}
?>
<tr>
<td colspan="2"><input type="Submit" value="<?php printMLText("update");?>"></td>
</tr>
</table>
</form>
<?php
} }
UI::contentContainerEnd(); UI::contentContainerEnd();
UI::htmlEndPage();
?> UI::contentHeading(getMLText("linked_documents"));
UI::contentContainerStart();
$links = $document->getDocumentLinks();
$links = filterDocumentLinks($user, $links);
if (count($links) > 0) {
print "<table class=\"folderView\">";
print "<thead>\n<tr>\n";
print "<th width='40%'></th>\n";
print "<th width='25%'>".getMLText("comment")."</th>\n";
print "<th width='15%'>".getMLText("document_link_by")."</th>\n";
print "<th width='20%'></th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($links as $link) {
$responsibleUser = $link->getUser();
$targetDoc = $link->getTarget();
print "<tr>";
print "<td><a href=\"out.ViewDocument.php?documentid=".$targetDoc->getID()."\" class=\"linklist\">".$targetDoc->getName()."</a></td>";
print "<td>".$targetDoc->getComment()."</td>";
print "<td>".$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 "<a href=\"../op/op.RemoveDocumentLink.php?documentid=".$documentid."&linkid=".$link->getID()."\">".getMLText("delete")."</a>";
print "</span></td>";
print "</tr>";
}
print "</tbody>\n</table>\n";
}
else printMLText("no_linked_files");
if (!$user->isGuest()){
?>
<br>
<form action="../op/op.AddDocumentLink.php" name="form1">
<input type="Hidden" name="documentid" value="<?php print $documentid;?>">
<table>
<tr>
<td><?php printMLText("add_document_link");?>:</td>
<td><?php UI::printDocumentChooser("form1");?></td>
</tr>
<?php
if ($document->getAccessMode($user) >= M_READWRITE) {
print "<tr><td>".getMLText("document_link_public")."</td>";
print "<td><ul class=\"actions\">";
print "<li><input type=\"Radio\" name=\"public\" value=\"true\" checked>" . getMLText("yes")."</li>";
print "<li><input type=\"Radio\" name=\"public\" value=\"false\">" . getMLText("no")."</li>";
print "</ul></td></tr>";
}
?>
<tr>
<td colspan="2"><input type="Submit" value="<?php printMLText("update");?>"></td>
</tr>
</table>
</form>
<?php
}
UI::contentContainerEnd();
UI::htmlEndPage();
?>