, Jam Warehouse (Pty) Ltd, South Africa * @package presentation.lookAndFeel.knowledgeTree.documentmanagement */ require_once("../../../../config/dmsDefaults.php"); if (checkSession()) { require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); require_once("$default->owl_fs_root/lib/foldermanagement/Folder.inc"); require_once("$default->owl_fs_root/lib/documentmanagement/Document.inc"); require_once("$default->owl_fs_root/lib/documentmanagement/PhysicalDocumentManager.inc"); $oPatternCustom = & new PatternCustom(); if (isset($fDocumentID)) { // if the user selected a document to delete // retrieve the document from the db $oDocument = & Document::get($fDocumentID); // retrieve the folderID $iFolderID = $oDocument->getFolderID(); if (Permission::userHasFolderWritePermission($iFolderID)) { // user has permission to remove a document from this folder // remove the document from the database (making sure that it exists first) if (Document::documentExists($oDocument->getFileName(), $oDocument->getFolderID())) { /* $sDeletedName = $oDocument->getFileName() . "_deleted_" . getCurrentDateTime(); // rename physical file if (PhysicalDocumentManager::renamePhysicalDocument($oDocument, $sDeletedName)) { // rename filename in database $oDocument->setFileName($sDeletedName); if ($oDocument->update()) {*/ if ($oDocument->delete()) { // TODO: insert into sys_deleted // success, redirect to the browse folder view controllerRedirect("browse", "fFolderID=$iFolderID"); } else { // failure deleting document $oPatternCustom->setHtml("

There was an error removing the document.

\n"); } /*} else { // fs rename failed $oPatternCustom->setHtml("

There was am error removing the document.

\n"); }*/ } else { // document doesn't exist $oPatternCustom->setHtml("

The document you're trying to remove does not exist.

\n"); } } else { // no permission to remove document $oPatternCustom->setHtml("

You do not have permission to remove a document from this folder.

\n"); } } else { // no documentID passed in $oPatternCustom->setHtml("

No document which can be removed is currently selected.

\n"); } require_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); $main->setCentralPayload($oPatternCustom); $main->render(); } ?>