mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
add missing files for revision workflow and document reception
This commit is contained in:
parent
040839714d
commit
0addaf56d3
308
op/op.SetRecipients.php
Normal file
308
op/op.SetRecipients.php
Normal file
|
@ -0,0 +1,308 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
// Copyright (C) 2010-2015 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
|
||||
// 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.LogInit.php");
|
||||
include("../inc/inc.ClassEmail.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.Init.php");
|
||||
include("../inc/inc.Extension.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
$documentid = $_POST["documentid"];
|
||||
$document = $dms->getDocument($documentid);
|
||||
|
||||
if (!is_object($document)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
if ($document->getAccessMode($user) < M_ALL) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["version"]) || !is_numeric($_POST["version"]) || intval($_POST["version"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$version = $_POST["version"];
|
||||
$content = $document->getContentByVersion($version);
|
||||
|
||||
if (!is_object($content)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
// Retrieve a list of all users and groups that have read rights.
|
||||
// Afterwards, reorganize them in two arrays with its key being the
|
||||
// userid or groupid
|
||||
$docAccess = $document->getReadAccessList();
|
||||
$accessIndex = array("i"=>array(), "g"=>array());
|
||||
foreach ($docAccess["users"] as $i=>$da) {
|
||||
$accessIndex["i"][$da->getID()] = $da;
|
||||
}
|
||||
foreach ($docAccess["groups"] as $i=>$da) {
|
||||
$accessIndex["g"][$da->getID()] = $da;
|
||||
}
|
||||
|
||||
// Retrieve list of currently assigned recipients, along with
|
||||
// their latest status.
|
||||
$receiptStatus = $content->getReceiptStatus();
|
||||
// Index the receipt results for easy cross-reference with the Approvers List.
|
||||
$receiptIndex = array("i"=>array(), "g"=>array());
|
||||
foreach ($receiptStatus as $i=>$rs) {
|
||||
if ($rs["status"]!=-2) {
|
||||
if ($rs["type"]==0) {
|
||||
$receiptIndex["i"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
}
|
||||
else if ($rs["type"]==1) {
|
||||
$receiptIndex["g"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the list of proposed recipients, stripping out any duplicates.
|
||||
$pIndRev = (isset($_POST["indRecipients"]) ? array_values(array_unique($_POST["indRecipients"])) : array());
|
||||
$pGrpRev = (isset($_POST["grpRecipients"]) ? array_values(array_unique($_POST["grpRecipients"])) : array());
|
||||
foreach ($pIndRev as $p) {
|
||||
if (is_numeric($p)) {
|
||||
if (isset($accessIndex["i"][$p])) {
|
||||
// Proposed recipient is on the list of possible recipients.
|
||||
if (!isset($receiptIndex["i"][$p])) {
|
||||
// Proposed recipient is not a current recipient, so add as a new
|
||||
// recipient.
|
||||
$res = $content->addIndRecipient($accessIndex["i"][$p], $user);
|
||||
$unm = $accessIndex["i"][$p]->getFullName();
|
||||
$uml = $accessIndex["i"][$p]->getEmail();
|
||||
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_request_email_subject";
|
||||
$message = "receipt_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_assigned"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Proposed recipient is already in the list of recipients.
|
||||
// Remove recipient from the index of possible recipients. If there are
|
||||
// any recipients left over in the list of possible recipients, they
|
||||
// will be removed from the receipt process for this document revision.
|
||||
unset($receiptIndex["i"][$p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($receiptIndex["i"]) > 0) {
|
||||
foreach ($receiptIndex["i"] as $rx=>$rv) {
|
||||
if ($rv["status"] == 0) {
|
||||
// User is to be removed from the recipients list.
|
||||
if (!isset($accessIndex["i"][$rx])) {
|
||||
// User does not have any receipt privileges for this document
|
||||
// revision or does not exist.
|
||||
$queryStr = "INSERT INTO `tblDocumentReceiptLog` (`receiptID`, `status`, `comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $receiptStatus[$rv["idx"]]["receiptID"] ."', '-2', '".getMLText("removed_recipient")."', NOW(), '". $user->getID() ."')";
|
||||
$res = $db->getResult($queryStr);
|
||||
}
|
||||
else {
|
||||
$res = $content->delIndRecipient($accessIndex["i"][$rx], $user);
|
||||
$unm = $accessIndex["i"][$rx]->getFullName();
|
||||
$uml = $accessIndex["i"][$rx]->getEmail();
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the recipients.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_deletion_email_subject";
|
||||
$message = "receipt_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_removed"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($pGrpRev as $p) {
|
||||
if (is_numeric($p)) {
|
||||
if (isset($accessIndex["g"][$p])) {
|
||||
// Proposed recipient is on the list of possible recipients.
|
||||
if (!isset($receiptIndex["g"][$p])) {
|
||||
// Proposed recipient is not a current recipient, so add as a new
|
||||
// recipient.
|
||||
$res = $content->addGrpRecipient($accessIndex["g"][$p], $user);
|
||||
$gnm = $accessIndex["g"][$p]->getName();
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_request_email_subject";
|
||||
$message = "receipt_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_assigned"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Remove recipient from the index of possible recipients.
|
||||
unset($receiptIndex["g"][$p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($receiptIndex["g"]) > 0) {
|
||||
foreach ($receiptIndex["g"] as $rx=>$rv) {
|
||||
if ($rv["status"] == 0) {
|
||||
// Group is to be removed from the recipientist.
|
||||
if (!isset($accessIndex["g"][$rx])) {
|
||||
// Group does not have any receipt privileges for this document
|
||||
// revision or does not exist.
|
||||
$queryStr = "INSERT INTO `tblDocumentReceiptLog` (`receiptID`, `status`, `comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $receiptStatus[$rv["idx"]]["receiptID"] ."', '-2', '".getMLText("removed_recipient")."', NOW(), '". $user->getID() ."')";
|
||||
$res = $db->getResult($queryStr);
|
||||
}
|
||||
else {
|
||||
$res = $content->delGrpRecipient($accessIndex["g"][$rx], $user);
|
||||
$gnm = $accessIndex["g"][$rx]->getName();
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the recipients group.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_deletion_email_subject";
|
||||
$message = "receipt_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_removed"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_log_line("?documentid=".$documentid);
|
||||
header("Location:../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$version);
|
||||
|
||||
?>
|
308
op/op.SetRevisers.php
Normal file
308
op/op.SetRevisers.php
Normal file
|
@ -0,0 +1,308 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
// Copyright (C) 2010-2015 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
|
||||
// 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.LogInit.php");
|
||||
include("../inc/inc.ClassEmail.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.Init.php");
|
||||
include("../inc/inc.Extension.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
$documentid = $_POST["documentid"];
|
||||
$document = $dms->getDocument($documentid);
|
||||
|
||||
if (!is_object($document)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
if ($document->getAccessMode($user) < M_ALL) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["version"]) || !is_numeric($_POST["version"]) || intval($_POST["version"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$version = $_POST["version"];
|
||||
$content = $document->getContentByVersion($version);
|
||||
|
||||
if (!is_object($content)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
// Retrieve a list of all users and groups that have read rights.
|
||||
// Afterwards, reorganize them in two arrays with its key being the
|
||||
// userid or groupid
|
||||
$docAccess = $document->getReadAccessList();
|
||||
$accessIndex = array("i"=>array(), "g"=>array());
|
||||
foreach ($docAccess["users"] as $i=>$da) {
|
||||
$accessIndex["i"][$da->getID()] = $da;
|
||||
}
|
||||
foreach ($docAccess["groups"] as $i=>$da) {
|
||||
$accessIndex["g"][$da->getID()] = $da;
|
||||
}
|
||||
|
||||
// Retrieve list of currently assigned recipients, along with
|
||||
// their latest status.
|
||||
$revisionStatus = $content->getRevisionStatus();
|
||||
// Index the revision results for easy cross-reference with the Approvers List.
|
||||
$revisionIndex = array("i"=>array(), "g"=>array());
|
||||
foreach ($revisionStatus as $i=>$rs) {
|
||||
if ($rs["status"]!=-2) {
|
||||
if ($rs["type"]==0) {
|
||||
$revisionIndex["i"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
}
|
||||
else if ($rs["type"]==1) {
|
||||
$revisionIndex["g"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the list of proposed recipients, stripping out any duplicates.
|
||||
$pIndRev = (isset($_POST["indRevisers"]) ? array_values(array_unique($_POST["indRevisers"])) : array());
|
||||
$pGrpRev = (isset($_POST["grpRevisers"]) ? array_values(array_unique($_POST["grpRevisers"])) : array());
|
||||
foreach ($pIndRev as $p) {
|
||||
if (is_numeric($p)) {
|
||||
if (isset($accessIndex["i"][$p])) {
|
||||
// Proposed recipient is on the list of possible recipients.
|
||||
if (!isset($revisionIndex["i"][$p])) {
|
||||
// Proposed recipient is not a current recipient, so add as a new
|
||||
// recipient.
|
||||
$res = $content->addIndReviser($accessIndex["i"][$p], $user);
|
||||
$unm = $accessIndex["i"][$p]->getFullName();
|
||||
$uml = $accessIndex["i"][$p]->getEmail();
|
||||
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_request_email_subject";
|
||||
$message = "revision_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_assigned"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Proposed recipient is already in the list of recipients.
|
||||
// Remove recipient from the index of possible recipients. If there are
|
||||
// any recipients left over in the list of possible recipients, they
|
||||
// will be removed from the revision process for this document revision.
|
||||
unset($revisionIndex["i"][$p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($revisionIndex["i"]) > 0) {
|
||||
foreach ($revisionIndex["i"] as $rx=>$rv) {
|
||||
if ($rv["status"] == 0) {
|
||||
// User is to be removed from the recipients list.
|
||||
if (!isset($accessIndex["i"][$rx])) {
|
||||
// User does not have any revision privileges for this document
|
||||
// revision or does not exist.
|
||||
$queryStr = "INSERT INTO `tblDocumentRevisionLog` (`revisionID`, `status`, `comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $revisionStatus[$rv["idx"]]["revisionID"] ."', '-2', '".getMLText("removed_recipient")."', NOW(), '". $user->getID() ."')";
|
||||
$res = $db->getResult($queryStr);
|
||||
}
|
||||
else {
|
||||
$res = $content->delIndReviser($accessIndex["i"][$rx], $user);
|
||||
$unm = $accessIndex["i"][$rx]->getFullName();
|
||||
$uml = $accessIndex["i"][$rx]->getEmail();
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the recipients.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_deletion_email_subject";
|
||||
$message = "revision_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_removed"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($pGrpRev as $p) {
|
||||
if (is_numeric($p)) {
|
||||
if (isset($accessIndex["g"][$p])) {
|
||||
// Proposed recipient is on the list of possible recipients.
|
||||
if (!isset($revisionIndex["g"][$p])) {
|
||||
// Proposed recipient is not a current recipient, so add as a new
|
||||
// recipient.
|
||||
$res = $content->addGrpReviser($accessIndex["g"][$p], $user);
|
||||
$gnm = $accessIndex["g"][$p]->getName();
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_request_email_subject";
|
||||
$message = "revision_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_assigned"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Remove recipient from the index of possible recipients.
|
||||
unset($revisionIndex["g"][$p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($revisionIndex["g"]) > 0) {
|
||||
foreach ($revisionIndex["g"] as $rx=>$rv) {
|
||||
if ($rv["status"] == 0) {
|
||||
// Group is to be removed from the recipientist.
|
||||
if (!isset($accessIndex["g"][$rx])) {
|
||||
// Group does not have any revision privileges for this document
|
||||
// revision or does not exist.
|
||||
$queryStr = "INSERT INTO `tblDocumentRevisionLog` (`revisionID`, `status`, `comment`, `date`, `userID`) ".
|
||||
"VALUES ('". $revisionStatus[$rv["idx"]]["revisionID"] ."', '-2', '".getMLText("removed_recipient")."', NOW(), '". $user->getID() ."')";
|
||||
$res = $db->getResult($queryStr);
|
||||
}
|
||||
else {
|
||||
$res = $content->delGrpReviser($accessIndex["g"][$rx], $user);
|
||||
$gnm = $accessIndex["g"][$rx]->getName();
|
||||
switch ($res) {
|
||||
case 0:
|
||||
// Send an email notification to the recipients group.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_deletion_email_subject";
|
||||
$message = "revision_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->_version;
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("internal_error"));
|
||||
break;
|
||||
case -2:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
break;
|
||||
case -3:
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("recipient_already_removed"));
|
||||
break;
|
||||
case -4:
|
||||
// email error
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_log_line("?documentid=".$documentid);
|
||||
header("Location:../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$version);
|
||||
|
||||
?>
|
71
out/out.SetRecipients.php
Normal file
71
out/out.SetRecipients.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
// Copyright (C) 2010-2015 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
|
||||
// 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");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.Init.php");
|
||||
include("../inc/inc.Extension.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.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"));
|
||||
}
|
||||
$document = $dms->getDocument($_GET["documentid"]);
|
||||
|
||||
if (!is_object($document)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
if ($document->getAccessMode($user) < M_ALL) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_GET["version"]) || !is_numeric($_GET["version"]) || intval($_GET["version"]<1)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$content = $document->getContentByVersion($_GET["version"]);
|
||||
if (!is_object($content)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
if(!$settings->_enableVersionModification) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("no_version_modification"));
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
/* Create object for checking access to certain operations */
|
||||
$accessop = new SeedDMS_AccessOperation($document, $user, $settings);
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$content, 'enableadminrevapp'=>$settings->_enableAdminRevApp, 'enableownerrevapp'=>$settings->_enableOwnerRevApp, 'enableselfrevapp'=>$settings->_enableSelfRevApp));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
71
out/out.SetRevisers.php
Normal file
71
out/out.SetRevisers.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
// MyDMS. Document Management System
|
||||
// Copyright (C) 2002-2005 Markus Westphal
|
||||
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||
// Copyright (C) 2010 Matteo Lucarelli
|
||||
// Copyright (C) 2010-2015 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
|
||||
// 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");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.Init.php");
|
||||
include("../inc/inc.Extension.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.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"));
|
||||
}
|
||||
$document = $dms->getDocument($_GET["documentid"]);
|
||||
|
||||
if (!is_object($document)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
if ($document->getAccessMode($user) < M_ALL) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_GET["version"]) || !is_numeric($_GET["version"]) || intval($_GET["version"]<1)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
$content = $document->getContentByVersion($_GET["version"]);
|
||||
if (!is_object($content)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
}
|
||||
|
||||
if(!$settings->_enableVersionModification) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("no_version_modification"));
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
/* Create object for checking access to certain operations */
|
||||
$accessop = new SeedDMS_AccessOperation($document, $user, $settings);
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$content));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
132
views/bootstrap/class.SetRecipients.php
Normal file
132
views/bootstrap/class.SetRecipients.php
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of SetRecipients view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @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-2015 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include parent class
|
||||
*/
|
||||
require_once("class.Bootstrap.php");
|
||||
|
||||
/**
|
||||
* Class which outputs the html page for SetRecipients view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @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-2015 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_View_SetRecipients extends SeedDMS_Bootstrap_Style {
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$folder = $this->params['folder'];
|
||||
$document = $this->params['document'];
|
||||
$content = $this->params['version'];
|
||||
|
||||
$overallStatus = $content->getStatus();
|
||||
|
||||
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
||||
$this->globalNavigation($folder);
|
||||
$this->contentStart();
|
||||
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
||||
$this->contentHeading(getMLText("change_assignments"));
|
||||
|
||||
// Retrieve a list of all users and groups that have receipt privileges.
|
||||
$docAccess = $document->getReadAccessList();
|
||||
|
||||
// Retrieve list of currently assigned recipients, along with
|
||||
// their latest status.
|
||||
$receiptStatus = $content->getReceiptStatus();
|
||||
|
||||
// Index the receipt results for easy cross-reference with the recipient list.
|
||||
$receiptIndex = array("i"=>array(), "g"=>array());
|
||||
foreach ($receiptStatus as $i=>$rs) {
|
||||
if ($rs["type"]==0) {
|
||||
$receiptIndex["i"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
} elseif ($rs["type"]==1) {
|
||||
$receiptIndex["g"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php $this->contentContainerStart(); ?>
|
||||
|
||||
<form action="../op/op.SetRecipients.php" method="post" name="form1">
|
||||
|
||||
<?php $this->contentSubHeading(getMLText("update_recipients"));?>
|
||||
|
||||
<div class="cbSelectTitle"><?php printMLText("individuals")?>:</div>
|
||||
<select class="chzn-select span9" name="indRecipients[]" multiple="multiple" data-placeholder="<?php printMLText('select_ind_recipients'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
|
||||
<?php
|
||||
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if (isset($receiptIndex["i"][$usr->getID()])) {
|
||||
|
||||
switch ($receiptIndex["i"][$usr->getID()]["status"]) {
|
||||
case 0:
|
||||
print "<option value='". $usr->getID() ."' selected='selected'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
break;
|
||||
case -2:
|
||||
print "<option value='". $usr->getID() ."'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
break;
|
||||
default:
|
||||
print "<option value='". $usr->getID() ."' disabled='disabled'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
print "<option value='". $usr->getID() ."'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<div class="cbSelectTitle"><?php printMLText("groups")?>:</div>
|
||||
<select class="chzn-select span9" name="grpRecipients[]" multiple="multiple" data-placeholder="<?php printMLText('select_grp_recipients'); ?>" data-no_results_text="<?php printMLText('unknown_group'); ?>">
|
||||
<?php
|
||||
foreach ($docAccess["groups"] as $group) {
|
||||
if (isset($receiptIndex["g"][$group->getID()])) {
|
||||
switch ($receiptIndex["g"][$group->getID()]["status"]) {
|
||||
case 0:
|
||||
print "<option value='". $group->getID() ."' selected='selected'>".htmlspecialchars($group->getName())."</option>";
|
||||
break;
|
||||
case -2:
|
||||
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
||||
break;
|
||||
default:
|
||||
print "<option id='recGrp".$group->getID()."' type='checkbox' name='grpRecipients[]' value='". $group->getID() ."' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<p>
|
||||
<input type='hidden' name='documentid' value='<?php echo $document->getID() ?>'/>
|
||||
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
|
||||
<input type="submit" class="btn" value="<?php printMLText("update");?>">
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
$this->contentContainerEnd();
|
||||
$this->htmlEndPage();
|
||||
} /* }}} */
|
||||
}
|
||||
?>
|
138
views/bootstrap/class.SetRevisers.php
Normal file
138
views/bootstrap/class.SetRevisers.php
Normal file
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of SetRevisers view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @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-2015 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include parent class
|
||||
*/
|
||||
require_once("class.Bootstrap.php");
|
||||
|
||||
/**
|
||||
* Class which outputs the html page for SetRevisers view
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @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-2015 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_View_SetRevisers extends SeedDMS_Bootstrap_Style {
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$folder = $this->params['folder'];
|
||||
$document = $this->params['document'];
|
||||
$content = $this->params['version'];
|
||||
|
||||
$overallStatus = $content->getStatus();
|
||||
|
||||
$this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))));
|
||||
$this->globalNavigation($folder);
|
||||
$this->contentStart();
|
||||
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
|
||||
$this->contentHeading(getMLText("change_assignments"));
|
||||
|
||||
// Retrieve a list of all users and groups that have revision privileges.
|
||||
$docAccess = $document->getReadAccessList();
|
||||
|
||||
// Retrieve list of currently assigned revisers, along with
|
||||
// their latest status.
|
||||
$revisionStatus = $content->getRevisionStatus();
|
||||
$startdate = '2015-05-23';
|
||||
|
||||
// Index the revision results for easy cross-reference with the reviser list.
|
||||
$revisionIndex = array("i"=>array(), "g"=>array());
|
||||
foreach ($revisionStatus as $i=>$rs) {
|
||||
if ($rs["type"]==0) {
|
||||
$revisionIndex["i"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
} elseif ($rs["type"]==1) {
|
||||
$revisionIndex["g"][$rs["required"]] = array("status"=>$rs["status"], "idx"=>$i);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php $this->contentContainerStart(); ?>
|
||||
|
||||
<form action="../op/op.SetRevisers.php" method="post" name="form1">
|
||||
|
||||
<?php $this->contentSubHeading(getMLText("update_revisers"));?>
|
||||
|
||||
<span class="input-append date" style="display: inline;" id="revisionstartdate" data-date="<?php echo date('d-m-Y'); ?>" data-date-format="dd-mm-yyyy" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
|
||||
<input class="span4" size="16" name="startdate" type="text" value="<?php if($startdate) echo $startdate; else echo date('d-m-Y'); ?>">
|
||||
<span class="add-on"><i class="icon-calendar"></i></span>
|
||||
</span>
|
||||
|
||||
<div class="cbSelectTitle"><?php printMLText("individuals")?>:</div>
|
||||
<select class="chzn-select span9" name="indRevisers[]" multiple="multiple" data-placeholder="<?php printMLText('select_ind_revisers'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
|
||||
<?php
|
||||
|
||||
foreach ($docAccess["users"] as $usr) {
|
||||
if (isset($revisionIndex["i"][$usr->getID()])) {
|
||||
|
||||
switch ($revisionIndex["i"][$usr->getID()]["status"]) {
|
||||
case 0:
|
||||
print "<option value='". $usr->getID() ."' selected='selected'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
break;
|
||||
case -2:
|
||||
print "<option value='". $usr->getID() ."'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
break;
|
||||
default:
|
||||
print "<option value='". $usr->getID() ."' disabled='disabled'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
print "<option value='". $usr->getID() ."'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<div class="cbSelectTitle"><?php printMLText("groups")?>:</div>
|
||||
<select class="chzn-select span9" name="grpRevisers[]" multiple="multiple" data-placeholder="<?php printMLText('select_grp_revisers'); ?>" data-no_results_text="<?php printMLText('unknown_group'); ?>">
|
||||
<?php
|
||||
foreach ($docAccess["groups"] as $group) {
|
||||
if (isset($revisionIndex["g"][$group->getID()])) {
|
||||
switch ($revisionIndex["g"][$group->getID()]["status"]) {
|
||||
case 0:
|
||||
print "<option value='". $group->getID() ."' selected='selected'>".htmlspecialchars($group->getName())."</option>";
|
||||
break;
|
||||
case -2:
|
||||
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
||||
break;
|
||||
default:
|
||||
print "<option id='recGrp".$group->getID()."' type='checkbox' name='grpRevisers[]' value='". $group->getID() ."' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<p>
|
||||
<input type='hidden' name='documentid' value='<?php echo $document->getID() ?>'/>
|
||||
<input type='hidden' name='version' value='<?php echo $content->getVersion() ?>'/>
|
||||
<input type="submit" class="btn" value="<?php printMLText("update");?>">
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
$this->contentContainerEnd();
|
||||
$this->htmlEndPage();
|
||||
} /* }}} */
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user