2012-02-13 08:28:34 +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
|
2012-02-13 08:28:34 +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");
|
2012-02-13 08:28:34 +00:00
|
|
|
include("../inc/inc.Language.php");
|
|
|
|
include("../inc/inc.ClassUI.php");
|
|
|
|
include("../inc/inc.Authentication.php");
|
|
|
|
|
|
|
|
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"));
|
|
|
|
}
|
2012-08-28 07:18:00 +00:00
|
|
|
$documentid = intval($_GET["documentid"]);
|
2010-11-12 22:47:41 +00:00
|
|
|
$document = $dms->getDocument($documentid);
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
if (!is_object($document)) {
|
|
|
|
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
|
|
|
}
|
|
|
|
|
|
|
|
$folder = $document->getFolder();
|
2011-12-02 16:23:36 +00:00
|
|
|
$docPathHTML = getFolderPathHTML($folder, true). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".htmlspecialchars($document->getName())."</a>";
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
if ($document->getAccessMode($user) < M_READWRITE) {
|
|
|
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
|
|
|
|
2012-02-13 08:28:34 +00:00
|
|
|
UI::htmlStartPage(getMLText("document_title", array("documentname" => $document->getName())));
|
|
|
|
UI::globalNavigation($folder);
|
2010-10-29 13:19:51 +00:00
|
|
|
UI::pageNavigation($docPathHTML, "view_document");
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script language="JavaScript">
|
|
|
|
function checkForm()
|
|
|
|
{
|
|
|
|
msg = "";
|
|
|
|
if (document.form1.userfile.value == "") msg += "<?php printMLText("js_no_file");?>\n";
|
|
|
|
<?php
|
|
|
|
if (isset($settings->_strictFormCheck) && $settings->_strictFormCheck) {
|
|
|
|
?>
|
|
|
|
if (document.form1.comment.value == "") msg += "<?php printMLText("js_no_comment");?>\n";
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
if (msg != "")
|
|
|
|
{
|
|
|
|
alert(msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
UI::contentHeading(getMLText("update_document"));
|
|
|
|
UI::contentContainerStart();
|
|
|
|
|
2010-10-29 13:19:51 +00:00
|
|
|
if ($document->isLocked()) {
|
2012-02-13 08:28:34 +00:00
|
|
|
|
2010-10-29 13:19:51 +00:00
|
|
|
$lockingUser = $document->getLockingUser();
|
2012-02-13 08:28:34 +00:00
|
|
|
|
2010-10-29 13:19:51 +00:00
|
|
|
print "<table><tr><td class=\"warning\">";
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
printMLText("update_locked_msg", array("username" => htmlspecialchars($lockingUser->getFullName()), "email" => $lockingUser->getEmail()));
|
|
|
|
|
|
|
|
if ($lockingUser->getID() == $user->getID())
|
|
|
|
printMLText("unlock_cause_locking_user");
|
|
|
|
else if ($document->getAccessMode($user) == M_ALL)
|
|
|
|
printMLText("unlock_cause_access_mode_all");
|
|
|
|
else
|
|
|
|
{
|
2010-10-29 13:19:51 +00:00
|
|
|
printMLText("no_update_cause_locked");
|
2012-02-13 08:28:34 +00:00
|
|
|
print "</td></tr></table>";
|
|
|
|
UI::contentContainerEnd();
|
|
|
|
UI::htmlEndPage();
|
|
|
|
exit;
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
print "</td></tr></table><br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Retrieve a list of all users and groups that have review / approve
|
|
|
|
// privileges.
|
|
|
|
$docAccess = $document->getApproversList();
|
|
|
|
?>
|
|
|
|
|
2010-11-05 21:45:21 +00:00
|
|
|
<table>
|
|
|
|
<tr>
|
2010-12-14 16:04:23 +00:00
|
|
|
<td class="warning"><?php echo getMLText("max_upload_size")." : ".ini_get( "upload_max_filesize"); ?></td>
|
2012-02-13 08:28:34 +00:00
|
|
|
</tr>
|
2011-10-25 13:37:45 +00:00
|
|
|
<?php
|
|
|
|
if($settings->_enableLargeFileUpload) {
|
|
|
|
?>
|
2011-03-10 14:50:07 +00:00
|
|
|
<tr>
|
|
|
|
<td><?php printf(getMLText('link_alt_updatedocument'), "out.UpdateDocument2.php?documentid=".$documentid); ?></td>
|
2012-02-13 08:28:34 +00:00
|
|
|
</tr>
|
2011-10-25 13:37:45 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2010-11-05 21:45:21 +00:00
|
|
|
</table><br>
|
|
|
|
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
<form action="../op/op.UpdateDocument.php" enctype="multipart/form-data" method="post" name="form1" onsubmit="return checkForm();">
|
|
|
|
<input type="Hidden" name="documentid" value="<?php print $documentid; ?>">
|
|
|
|
<table>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><?php printMLText("local_file");?>:</td>
|
|
|
|
<td><input type="File" name="userfile" size="60"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><?php printMLText("comment");?>:</td>
|
|
|
|
<td class="standardText">
|
|
|
|
<textarea name="comment" rows="4" cols="80"></textarea>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><?php printMLText("expires");?>:</td>
|
|
|
|
<td class="standardText">
|
|
|
|
<input type="Radio" name="expires" value="false"<?php if (!$document->expires()) print " checked";?>><?php printMLText("does_not_expire");?><br>
|
|
|
|
<input type="radio" name="expires" value="true"<?php if ($document->expires()) print " checked";?>><?php UI::printDateChooser(-1, "exp");?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2010-10-29 13:19:51 +00:00
|
|
|
<td colspan=2>
|
|
|
|
|
|
|
|
<?php UI::contentSubHeading(getMLText("assign_reviewers")); ?>
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
<div class="cbSelectTitle"><?php printMLText("individuals");?>:</div>
|
|
|
|
<div class="cbSelectContainer cbSelectMargin">
|
|
|
|
<ul class="cbSelectList">
|
2010-10-29 13:19:51 +00:00
|
|
|
<?php
|
|
|
|
$res=$user->getMandatoryReviewers();
|
2012-02-13 08:28:34 +00:00
|
|
|
|
2010-10-29 13:19:51 +00:00
|
|
|
foreach ($docAccess["users"] as $usr) {
|
|
|
|
|
2012-02-13 08:28:34 +00:00
|
|
|
if ($usr->getID()==$user->getID()) continue;
|
2010-10-29 13:19:51 +00:00
|
|
|
|
|
|
|
$mandatory=false;
|
|
|
|
foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $mandatory=true;
|
2012-02-13 08:28:34 +00:00
|
|
|
|
2011-12-02 16:23:36 +00:00
|
|
|
if ($mandatory) print "<li class=\"cbSelectItem\"><input type='checkbox' checked='checked' disabled='disabled'>". htmlspecialchars($usr->getFullName());
|
2012-02-13 08:28:34 +00:00
|
|
|
else print "<li class=\"cbSelectItem\"><input id='revInd".$usr->getID()."' type='checkbox' name='indReviewers[]' value='". $usr->getID() ."'>". htmlspecialchars($usr->getFullName());
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
2012-02-13 08:28:34 +00:00
|
|
|
?>
|
|
|
|
</ul>
|
2010-10-29 13:19:51 +00:00
|
|
|
</div>
|
2012-02-13 08:28:34 +00:00
|
|
|
<div class="cbSelectTitle"><?php printMLText("groups");?>:</div>
|
|
|
|
<div class="cbSelectContainer">
|
|
|
|
<ul class="cbSelectList">
|
|
|
|
<?php
|
2010-10-29 13:19:51 +00:00
|
|
|
foreach ($docAccess["groups"] as $grp) {
|
|
|
|
|
|
|
|
$mandatory=false;
|
2012-02-13 08:28:34 +00:00
|
|
|
foreach ($res as $r) if ($r['reviewerGroupID']==$grp->getID()) $mandatory=true;
|
|
|
|
|
2011-12-02 16:23:36 +00:00
|
|
|
if ($mandatory) print "<li class=\"cbSelectItem\"><input type='checkbox' checked='checked' disabled='disabled'>".htmlspecialchars($grp->getName());
|
2012-02-13 08:28:34 +00:00
|
|
|
else print "<li class=\"cbSelectItem\"><input id='revGrp".$grp->getID()."' type='checkbox' name='grpReviewers[]' value='". $grp->getID() ."'>".htmlspecialchars($grp->getName());
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
2012-02-13 08:28:34 +00:00
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2010-10-29 13:19:51 +00:00
|
|
|
|
|
|
|
<?php UI::contentSubHeading(getMLText("assign_approvers")); ?>
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
<div class="cbSelectTitle"><?php printMLText("individuals");?>:</div>
|
|
|
|
<div class="cbSelectContainer cbSelectMargin">
|
|
|
|
<ul class="cbSelectList">
|
|
|
|
<?php
|
2010-10-29 13:19:51 +00:00
|
|
|
$res=$user->getMandatoryApprovers();
|
2012-02-13 08:28:34 +00:00
|
|
|
|
2010-10-29 13:19:51 +00:00
|
|
|
foreach ($docAccess["users"] as $usr) {
|
2012-02-13 08:28:34 +00:00
|
|
|
|
|
|
|
if ($usr->getID()==$user->getID()) continue;
|
2010-10-29 13:19:51 +00:00
|
|
|
|
|
|
|
$mandatory=false;
|
|
|
|
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $mandatory=true;
|
|
|
|
|
2012-02-13 08:28:34 +00:00
|
|
|
if ($mandatory) print "<li class=\"cbSelectItem\"><input type='checkbox' checked='checked' disabled='disabled'>". htmlspecialchars($usr->getFullName());
|
|
|
|
else print "<li class=\"cbSelectItem\"><input id='appInd".$usr->getID()."' type='checkbox' name='indApprovers[]' value='". $usr->getID() ."'>". htmlspecialchars($usr->getFullName());
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
2012-02-13 08:28:34 +00:00
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="cbSelectTitle"><?php printMLText("groups");?>:</div>
|
|
|
|
<div class="cbSelectContainer">
|
|
|
|
<ul class="cbSelectList">
|
|
|
|
<?php
|
2010-10-29 13:19:51 +00:00
|
|
|
foreach ($docAccess["groups"] as $grp) {
|
2012-02-13 08:28:34 +00:00
|
|
|
|
2010-10-29 13:19:51 +00:00
|
|
|
$mandatory=false;
|
2012-02-13 08:28:34 +00:00
|
|
|
foreach ($res as $r) if ($r['approverGroupID']==$grp->getID()) $mandatory=true;
|
|
|
|
|
2011-12-02 16:23:36 +00:00
|
|
|
if ($mandatory) print "<li class=\"cbSelectItem\"><input type='checkbox' checked='checked' disabled='disabled'>".htmlspecialchars($grp->getName());
|
2012-02-13 08:28:34 +00:00
|
|
|
else print "<li class=\"cbSelectItem\"><input id='appGrp".$grp->getID()."' type='checkbox' name='grpApprovers[]' value='". $grp->getID() ."'>".htmlspecialchars($grp->getName());
|
2010-10-29 13:19:51 +00:00
|
|
|
|
|
|
|
}
|
2012-02-13 08:28:34 +00:00
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2010-10-29 13:19:51 +00:00
|
|
|
</td>
|
2012-02-13 08:28:34 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2"><?php printMLText("add_doc_reviewer_approver_warning")?></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2"><input type="Submit" value="<?php printMLText("update_document")?>"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
UI::contentContainerEnd();
|
|
|
|
UI::htmlEndPage();
|
|
|
|
?>
|