Commit 5d35573039f42b6dd231d448cfb80e7a47f41eaa
1 parent
dc5ac600
Remove old checkin and checkout pages.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4067 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
0 additions
and
466 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * Business Logic to check in a document. | ||
| 6 | - * | ||
| 7 | - * Expected form variable: | ||
| 8 | - * o $fDocumentID - primary key of document user is checking out | ||
| 9 | - * | ||
| 10 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 11 | - * | ||
| 12 | - * This program is free software; you can redistribute it and/or modify | ||
| 13 | - * it under the terms of the GNU General Public License as published by | ||
| 14 | - * the Free Software Foundation; either version 2 of the License, or | ||
| 15 | - * (at your option) any later version. | ||
| 16 | - * | ||
| 17 | - * This program is distributed in the hope that it will be useful, | ||
| 18 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | - * GNU General Public License for more details. | ||
| 21 | - * | ||
| 22 | - * You should have received a copy of the GNU General Public License | ||
| 23 | - * along with this program; if not, write to the Free Software | ||
| 24 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 25 | - * | ||
| 26 | - * @version $Revision$ | ||
| 27 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 28 | - * @package documentmanagement | ||
| 29 | - */ | ||
| 30 | - | ||
| 31 | -require_once("../../../../config/dmsDefaults.php"); | ||
| 32 | -require_once(KT_LIB_DIR . '/documentmanagement/documentutil.inc.php'); | ||
| 33 | - | ||
| 34 | -KTUtil::extractGPC('fDocumentID', 'fForStore', 'fFolderID', 'fCheckInComment', 'fCheckInType'); | ||
| 35 | - | ||
| 36 | -if (!checkSession()) { | ||
| 37 | - die("Session not set up"); | ||
| 38 | -} | ||
| 39 | - | ||
| 40 | -require_once("$default->fileSystemRoot/lib/email/Email.inc"); | ||
| 41 | - | ||
| 42 | -require_once("$default->fileSystemRoot/lib/users/User.inc"); | ||
| 43 | - | ||
| 44 | -require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); | ||
| 45 | -require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); | ||
| 46 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | ||
| 47 | - | ||
| 48 | -require_once("$default->fileSystemRoot/lib/roles/Role.inc"); | ||
| 49 | -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | ||
| 50 | - | ||
| 51 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc"); | ||
| 52 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | ||
| 53 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 54 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc"); | ||
| 55 | -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | ||
| 56 | - | ||
| 57 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentUI.inc"); | ||
| 58 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc"); | ||
| 59 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc"); | ||
| 60 | -require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 61 | -require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 62 | - | ||
| 63 | -require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc"); | ||
| 64 | - | ||
| 65 | -function checkinDocument() { | ||
| 66 | - $oPatternCustom = & new PatternCustom(); | ||
| 67 | - | ||
| 68 | - $iDocumentID = KTUtil::arrayGet($_REQUEST, 'fDocumentID'); | ||
| 69 | - | ||
| 70 | - if (empty($iDocumentID)) { | ||
| 71 | - // no document id was set when coming to this page, | ||
| 72 | - $oPatternCustom->setHtml(renderErrorPage(_("No document is currently selected for check in"))); | ||
| 73 | - return $oPatternCustom; | ||
| 74 | - } | ||
| 75 | - // instantiate the document | ||
| 76 | - $oDocument = & Document::get($iDocumentID); | ||
| 77 | - | ||
| 78 | - if (!$oDocument) { | ||
| 79 | - // couldn't instantiate the document | ||
| 80 | - $oPatternCustom->setHtml(renderErrorPage(_("Could not check in this document"))); | ||
| 81 | - return $oPatternCustom; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - // user has permission to check the document in | ||
| 85 | - if (!Permission::userHasDocumentWritePermission($oDocument)) { | ||
| 86 | - // no permission to checkout the document | ||
| 87 | - $oPatternCustom->setHtml(renderErrorPage(_("You do not have permission to check in this document"))); | ||
| 88 | - return $oPatternCustom; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - // and the document is checked out | ||
| 92 | - if (!$oDocument->getIsCheckedOut()) { | ||
| 93 | - $oPatternCustom->setHtml(renderErrorPage(_("You can't check in this document because its not checked out"))); | ||
| 94 | - return $oPatternCustom; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - // by you | ||
| 98 | - if ($oDocument->getCheckedOutUserID() != $_SESSION["userID"]) { | ||
| 99 | - // you don't have this doc checked out | ||
| 100 | - $oUser = User::get($oDocument->getCheckedOutUserID()); | ||
| 101 | - $oPatternCustom->setHtml(renderErrorPage(_("You can't check in this document because its checked out by") . $oUser->getName())); | ||
| 102 | - return $oPatternCustom; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - // if we're ready to perform the updates | ||
| 106 | - $bForStore = KTUtil::arrayGet($_REQUEST, 'fForStore'); | ||
| 107 | - if (! $bForStore) { | ||
| 108 | - // prompt the user for a check in comment and the file | ||
| 109 | - $oPatternCustom->setHtml(getCheckInPage($oDocument)); | ||
| 110 | - return $oPatternCustom; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - // make sure the user actually selected a file first | ||
| 114 | - if (strlen($_FILES['fFile']['name']) == 0) { | ||
| 115 | - $sErrorMessage = _("Please select a document by first clicking on 'Browse'. Then click 'Check-In'"); | ||
| 116 | - $oPatternCustom->setHtml(getCheckInPage($oDocument)); | ||
| 117 | - return $oPatternCustom; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - // and that the filename matches | ||
| 121 | - global $default; | ||
| 122 | - $default->log->info("checkInDocumentBL.php uploaded filename=" . $_FILES['fFile']['name'] . "; current filename=" . $oDocument->getFileName()); | ||
| 123 | - if ($oDocument->getFileName() != $_FILES['fFile']['name']) { | ||
| 124 | - $sErrorMessage = _("The file you selected does not match the current filename in the DMS. Please try again."); | ||
| 125 | - $oPatternCustom->setHtml(getCheckInPage($oDocument)); | ||
| 126 | - return $oPatternCustom; | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | - $sCheckInComment = KTUtil::arrayGet($_REQUEST, 'fCheckInComment'); | ||
| 130 | - $sCheckInType = KTUtil::arrayGet($_REQUEST, 'fCheckInType'); | ||
| 131 | - $res = KTDocumentUtil::checkin($oDocument, $_FILES['fFile']['tmp_name'], $sCheckInComment, $sCheckInType); | ||
| 132 | - if (PEAR::isError($res)) { | ||
| 133 | - $oPatternCustom->setHtml(getErrorPage($res)); | ||
| 134 | - return $oPatternCustom; | ||
| 135 | - } | ||
| 136 | - redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID()); | ||
| 137 | -} | ||
| 138 | - | ||
| 139 | -require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 140 | -$oPatternCustom = checkinDocument(); | ||
| 141 | -$main->setCentralPayload($oPatternCustom); | ||
| 142 | -$main->setFormAction($_SERVER["PHP_SELF"]); | ||
| 143 | -$main->setFormEncType("multipart/form-data"); | ||
| 144 | -if (isset($sErrorMessage)) { | ||
| 145 | - $main->setErrorMessage($sErrorMessage); | ||
| 146 | -} | ||
| 147 | -$main->render(); | ||
| 148 | - | ||
| 149 | -?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentUI.inc deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * Check in document UI functions. | ||
| 6 | - * | ||
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | - * | ||
| 9 | - * This program is free software; you can redistribute it and/or modify | ||
| 10 | - * it under the terms of the GNU General Public License as published by | ||
| 11 | - * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | - * (at your option) any later version. | ||
| 13 | - * | ||
| 14 | - * This program is distributed in the hope that it will be useful, | ||
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | - * GNU General Public License for more details. | ||
| 18 | - * | ||
| 19 | - * You should have received a copy of the GNU General Public License | ||
| 20 | - * along with this program; if not, write to the Free Software | ||
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 22 | - * | ||
| 23 | - * @version $Revision$ | ||
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | - * @package documentmanagement | ||
| 26 | - */ | ||
| 27 | - | ||
| 28 | -/** | ||
| 29 | - * Prompts the user for a check in comment and revision type | ||
| 30 | - * | ||
| 31 | - * @param object the document we're checking in | ||
| 32 | - */ | ||
| 33 | -function renderCheckInPage($oDocument) { | ||
| 34 | - global $default; | ||
| 35 | - | ||
| 36 | - $sToRender = "<table>\n"; | ||
| 37 | - $sToRender .= "<tr><td>" . _("Select the file to check in") . ":</td></tr>\n"; | ||
| 38 | - $sToRender .= "<tr><td><input type=\"file\" name=\"fFile\">"; | ||
| 39 | - /* | ||
| 40 | - $sToRender .= "<tr><td><input type=\"file\" name=\"browse\" style=\"display:none\">"; | ||
| 41 | - $sToRender .= "<input type=\"text\" name=\"fFile\"\>\n"; | ||
| 42 | - $sToRender .= "<a href=\"#\" onClick=\"document.MainForm.browse.click();document.MainForm.fFile.value=document.MainForm.browse.value;return false;\">"; | ||
| 43 | - $sToRender .= "<img src=\"" . KTHtml::getBrowseButton() . "\" alt=\"browse\" border=\"0\"></a>\n"; | ||
| 44 | - */ | ||
| 45 | - $sToRender .= "</td></tr>\n"; | ||
| 46 | - $sToRender .= "</table>\n"; | ||
| 47 | - | ||
| 48 | - $sToRender .= "<table>\n"; | ||
| 49 | - $sToRender .= "<tr><td>" . _("Enter a check in comment for the document") . "</td></tr>\n"; | ||
| 50 | - $sToRender .= "<tr/>\n"; | ||
| 51 | - $sToRender .= "<tr><td><input type=\"text\" name=\"fCheckInComment\" size=\"30\"/></td></tr>\n"; | ||
| 52 | - $sToRender .= "<input type=\"hidden\" name=\"fForStore\" value=\"1\"/>\n"; | ||
| 53 | - $sToRender .= "<input type=\"hidden\" name=\"fDocumentID\" value=\"" . $oDocument->getID() . "\"/>\n"; | ||
| 54 | - $sToRender .= "<input type=\"hidden\" name=\"fCheckInType\" value=\"major\"/>\n"; | ||
| 55 | - | ||
| 56 | - /* | ||
| 57 | - $sToRender .= "<tr><td>\n"; | ||
| 58 | - $sToRender .= "<input type=\"radio\" name=\"fCheckInType\" value=\"minor\" checked /> Minor Revision\n"; | ||
| 59 | - $sToRender .= "</tr></td>\n"; | ||
| 60 | - $sToRender .= "<tr><td>\n"; | ||
| 61 | - $sToRender .= "<input type=\"radio\" name=\"fCheckInType\" value=\"major\"/> Major Revision\n"; | ||
| 62 | - $sToRender .= "</tr></td>\n"; | ||
| 63 | - */ | ||
| 64 | - $sToRender .= "</table>\n"; | ||
| 65 | - | ||
| 66 | - $sToRender .= "<table>\n"; | ||
| 67 | - $sToRender .= "<tr>\n"; | ||
| 68 | - // FIXME: if the document name contains an apostrophe this js doesn't work | ||
| 69 | - $sToRender .= "<td><input type=\"image\" border=\"0\" src =\"" . KTHtml::getCheckInButton() . "\" value=\"Submit\" onClick=\"if (validRequired(document.MainForm.fFile, 'Check-In File') && validRequired(document.MainForm.fCheckInComment, 'Check-In Comment')) { return confirm('Are you sure you want to overwrite " . $oDocument->getFileName() . " with ' + document.MainForm.fFile.value + '?'); } else return false;\"/>\n"; | ||
| 70 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a></td>\n"; | ||
| 71 | - $sToRender .= "</tr>\n"; | ||
| 72 | - $sToRender .= "</table>\n"; | ||
| 73 | - | ||
| 74 | - /* | ||
| 75 | - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n"; | ||
| 76 | - $sToRender .= "function validateCheckIn() {\n"; | ||
| 77 | - $sToRender .= "alert('blah'); return false;\n"; | ||
| 78 | - $sToRender .= " if (validRequired(document.MainForm.fFile, 'Check-In File') && validRequired(document.MainForm.fCheckInComment, 'Check-In Comment')) {\n"; | ||
| 79 | - $sToRender .= " var directoryTokensArray=document.MainForm.fComment.split('\');\n"; | ||
| 80 | - $sToRender .= " if (directoryTokensArray.length == 0) {\n"; | ||
| 81 | - $sToRender .= " directoryTokensArray = document.MainForm.fComment.split('/');\n"; | ||
| 82 | - $sToRender .= " }\n"; | ||
| 83 | - //$sToRender .= "alert('filename=' + directoryTokensArray[directoryTokensArray.length-1]);\n"; | ||
| 84 | - $sToRender .= " if ('" . $oDocument->getFileName() . "' <> directoryTokensArray[directoryTokensArray.length-1]) {\n"; | ||
| 85 | - $sToRender .= " alert('Please check in the same file, you attempted to check in ' + document.MainForm.fComment + '!');\n"; | ||
| 86 | - $sToRender .= " return false;\n"; | ||
| 87 | - $sToRender .= " } else {\n"; | ||
| 88 | - $sToRender .= " return confirm('Are you sure you want to overwrite " . $oDocument->getName() . " with ' + document.MainForm.fFile.value + '?');\n"; | ||
| 89 | - $sToRender .= " }\n"; | ||
| 90 | - $sToRender .= " } else {\n"; | ||
| 91 | - $sToRender .= " return false;\n"; | ||
| 92 | - $sToRender .= " }\n"; | ||
| 93 | - $sToRender .= "}\n"; | ||
| 94 | - $sToRender .= "//-->\n</script>\n\n"; | ||
| 95 | - */ | ||
| 96 | - return $sToRender; | ||
| 97 | -} | ||
| 98 | - | ||
| 99 | -/** | ||
| 100 | - * Displays the document view page with additional input controls | ||
| 101 | - * for checking in the document | ||
| 102 | - * | ||
| 103 | - * @param object the document to view and check out | ||
| 104 | - */ | ||
| 105 | -function getCheckInPage($oDocument) { | ||
| 106 | - $sToRender .= renderHeading(_("Check In Document")); | ||
| 107 | - $sToRender .= renderDocumentPath($oDocument, false) . "\n\n"; | ||
| 108 | - $sToRender .= renderCheckInPage($oDocument); | ||
| 109 | - $sToRender .= renderDocumentData($oDocument, $bEdit); | ||
| 110 | - return $sToRender; | ||
| 111 | -} | ||
| 112 | -?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentBL.php deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * Business Logic to check out a document | ||
| 6 | - * | ||
| 7 | - * Expected form variable: | ||
| 8 | - * o $fDocumentID - primary key of document user is checking out | ||
| 9 | - * | ||
| 10 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 11 | - * | ||
| 12 | - * This program is free software; you can redistribute it and/or modify | ||
| 13 | - * it under the terms of the GNU General Public License as published by | ||
| 14 | - * the Free Software Foundation; either version 2 of the License, or | ||
| 15 | - * (at your option) any later version. | ||
| 16 | - * | ||
| 17 | - * This program is distributed in the hope that it will be useful, | ||
| 18 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | - * GNU General Public License for more details. | ||
| 21 | - * | ||
| 22 | - * You should have received a copy of the GNU General Public License | ||
| 23 | - * along with this program; if not, write to the Free Software | ||
| 24 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 25 | - * | ||
| 26 | - * @version $Revision$ | ||
| 27 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 28 | - * @package documentmanagement | ||
| 29 | - */ | ||
| 30 | - | ||
| 31 | -require_once("../../../../config/dmsDefaults.php"); | ||
| 32 | - | ||
| 33 | -KTUtil::extractGPC('fDocumentID', 'fForStore', 'fCheckOutComment'); | ||
| 34 | - | ||
| 35 | -if (checkSession()) { | ||
| 36 | - | ||
| 37 | - require_once("$default->fileSystemRoot/lib/email/Email.inc"); | ||
| 38 | - | ||
| 39 | - require_once("$default->fileSystemRoot/lib/users/User.inc"); | ||
| 40 | - | ||
| 41 | - require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); | ||
| 42 | - require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); | ||
| 43 | - require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | ||
| 44 | - | ||
| 45 | - require_once("$default->fileSystemRoot/lib/roles/Role.inc"); | ||
| 46 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | ||
| 47 | - | ||
| 48 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc"); | ||
| 49 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | ||
| 50 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | ||
| 51 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc"); | ||
| 52 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | ||
| 53 | - | ||
| 54 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentUI.inc"); | ||
| 55 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc"); | ||
| 56 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc"); | ||
| 57 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 58 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | ||
| 59 | - | ||
| 60 | - require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc"); | ||
| 61 | - | ||
| 62 | - $oPatternCustom = & new PatternCustom(); | ||
| 63 | - | ||
| 64 | - if (isset($fDocumentID)) { | ||
| 65 | - // instantiate the document | ||
| 66 | - $oDocument = & Document::get($fDocumentID); | ||
| 67 | - if ($oDocument) { | ||
| 68 | - // user has permission to check the document out | ||
| 69 | - if (Permission::userHasDocumentWritePermission($oDocument)) { | ||
| 70 | - // and its not checked out already | ||
| 71 | - if (!$oDocument->getIsCheckedOut()) { | ||
| 72 | - // if we're ready to perform the updates | ||
| 73 | - if ($fForStore) { | ||
| 74 | - // flip the checkout status | ||
| 75 | - $oDocument->setIsCheckedOut(true); | ||
| 76 | - // set the user checking the document out | ||
| 77 | - $oDocument->setCheckedOutUserID($_SESSION["userID"]); | ||
| 78 | - // update it | ||
| 79 | - if ($oDocument->update()) { | ||
| 80 | - | ||
| 81 | - //create the document transaction record | ||
| 82 | - $oDocumentTransaction = & new DocumentTransaction($oDocument->getID(), $fCheckOutComment, CHECKOUT); | ||
| 83 | - // TODO: check transaction creation status? | ||
| 84 | - $oDocumentTransaction->create(); | ||
| 85 | - | ||
| 86 | - // fire subscription alerts for the checked out document | ||
| 87 | - $count = SubscriptionEngine::fireSubscription($fDocumentID, SubscriptionConstants::subscriptionAlertType("CheckOutDocument"), | ||
| 88 | - SubscriptionConstants::subscriptionType("DocumentSubscription"), | ||
| 89 | - array( "folderID" => $oDocument->getFolderID(), | ||
| 90 | - "modifiedDocumentName" => $oDocument->getName() )); | ||
| 91 | - $default->log->info("checkOutDocumentBL.php fired $count subscription alerts for checked out document " . $oDocument->getName()); | ||
| 92 | - | ||
| 93 | - // display checkout success message in the document view page | ||
| 94 | - controllerRedirect("viewDocument", "fDocumentID=$fDocumentID&fCheckedOut=1"); | ||
| 95 | - | ||
| 96 | - } else { | ||
| 97 | - // document update failed | ||
| 98 | - $oPatternCustom->setHtml(renderErrorPage(_("An error occurred while storing this document in the database"))); | ||
| 99 | - } | ||
| 100 | - } else { | ||
| 101 | - // prompt the user for a checkout comment | ||
| 102 | - $oPatternCustom->setHtml(getCheckOutPage($oDocument)); | ||
| 103 | - } | ||
| 104 | - } else { | ||
| 105 | - // this document is already checked out | ||
| 106 | - // TODO: for extra credit, tell the user who has this document checked out | ||
| 107 | - // but we don't display the check out button unless they have the document checked out already | ||
| 108 | - // so we should ever get here. | ||
| 109 | - $oPatternCustom->setHtml(renderErrorPage(_("This document is already checked out"), $fDocumentID)); | ||
| 110 | - } | ||
| 111 | - } else { | ||
| 112 | - // no permission to checkout the document | ||
| 113 | - $oPatternCustom->setHtml(renderErrorPage(_("You don't have permission to check out this document"), $fDocumentID)); | ||
| 114 | - } | ||
| 115 | - } else { | ||
| 116 | - // couldn't instantiate the document | ||
| 117 | - $oPatternCustom->setHtml(renderErrorPage(_("Could not check out this document"), $fDocumentID)); | ||
| 118 | - } | ||
| 119 | - } else { | ||
| 120 | - // no document id was set when coming to this page, | ||
| 121 | - $oPatternCustom->setHtml(renderErrorPage(_("No document is currently selected for check out"))); | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | ||
| 125 | - $main->setCentralPayload($oPatternCustom); | ||
| 126 | - $main->setFormAction($_SERVER["PHP_SELF"]); | ||
| 127 | - $main->render(); | ||
| 128 | -} | ||
| 129 | -?> |
presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentUI.inc deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * $Id$ | ||
| 4 | - * | ||
| 5 | - * Check out document UI functions. | ||
| 6 | - * | ||
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | - * | ||
| 9 | - * This program is free software; you can redistribute it and/or modify | ||
| 10 | - * it under the terms of the GNU General Public License as published by | ||
| 11 | - * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | - * (at your option) any later version. | ||
| 13 | - * | ||
| 14 | - * This program is distributed in the hope that it will be useful, | ||
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | - * GNU General Public License for more details. | ||
| 18 | - * | ||
| 19 | - * You should have received a copy of the GNU General Public License | ||
| 20 | - * along with this program; if not, write to the Free Software | ||
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 22 | - * | ||
| 23 | - * @version $Revision$ | ||
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | - * @package documentmanagement | ||
| 26 | - */ | ||
| 27 | - | ||
| 28 | -/** | ||
| 29 | - * Prompts the user for a checkout comment | ||
| 30 | - * | ||
| 31 | - * @param object the document we're checking out | ||
| 32 | - */ | ||
| 33 | -function renderCheckOutPage($oDocument) { | ||
| 34 | - global $default; | ||
| 35 | - | ||
| 36 | - $sToRender = "<table>\n"; | ||
| 37 | - $sToRender .= "<tr><td>" . _("Enter a check out comment for the document") . "</td></tr>\n"; | ||
| 38 | - $sToRender .= "<tr/>\n"; | ||
| 39 | - $sToRender .= "<tr><td><input type=\"text\" name=\"fCheckOutComment\" size=\"30\"/></td></tr>\n"; | ||
| 40 | - $sToRender .= "<tr><td><input type=\"hidden\" name=\"fForStore\" value=\"1\"/></td></tr>\n"; | ||
| 41 | - $sToRender .= "<tr><td><input type=\"hidden\" name=\"fDocumentID\" value=\"" . $oDocument->getID() . "\"/></td></tr>\n"; | ||
| 42 | - $sToRender .= "<tr>\n"; | ||
| 43 | - $sToRender .= "</tr>\n"; | ||
| 44 | - $sToRender .= "<tr>\n"; | ||
| 45 | - $sToRender .= "<td><input type=\"image\" border=\"0\" src =\"" . KTHtml::getCheckOutButton() . "\" value=\"Submit\"/>\n"; | ||
| 46 | - $sToRender .= generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\">") . "</td>\n"; | ||
| 47 | - $sToRender .= "</tr>\n"; | ||
| 48 | - $sToRender .= "</table>\n"; | ||
| 49 | - | ||
| 50 | - return $sToRender; | ||
| 51 | -} | ||
| 52 | - | ||
| 53 | -/** | ||
| 54 | - * Displays the document view page with additional input controls | ||
| 55 | - * for checking out the document | ||
| 56 | - * | ||
| 57 | - * @param object the document to view and check out | ||
| 58 | - */ | ||
| 59 | -function getCheckOutPage($oDocument, $bCheckedOut = false) { | ||
| 60 | - global $default; | ||
| 61 | - | ||
| 62 | - $sToRender .= renderHeading(_("Check Out Document")); | ||
| 63 | - $sToRender .= renderDocumentPath($oDocument, false) . "\n\n"; | ||
| 64 | - if ($bCheckedOut) { | ||
| 65 | - $sToRender .= "<table>"; | ||
| 66 | - $sToRender .= "<tr><td>" . _("You have now checked out this document. No one else can make updates to the document while you have it checked out. Click the Download button to get the latest version of the file. Please check it back in, as soon as you finish working on it.") . "</td></tr>\n"; | ||
| 67 | - $sToRender .= "<tr><td><a href=\"$default->rootUrl/control.php?action=downloadDocument&fDocumentID=" . $oDocument->getID() . "\"><img src=\"" . KTHtml::getDownloadButton() . "\" border=\"0\" /></a>\n"; | ||
| 68 | - $sToRender .= "<a href=\"$default->rootUrl/control.php?action=viewDocument&fDocumentID=" . $oDocument->getID() . "\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\" /></a></td>\n"; | ||
| 69 | - $sToRender .= "</table>"; | ||
| 70 | - } else { | ||
| 71 | - $sToRender .= renderCheckOutPage($oDocument); | ||
| 72 | - } | ||
| 73 | - $sToRender .= renderDocumentData($oDocument, $bEdit); | ||
| 74 | - return $sToRender; | ||
| 75 | -} | ||
| 76 | -?> |