diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php index 31924e4..c08486e 100644 --- a/lib/documentmanagement/documentutil.inc.php +++ b/lib/documentmanagement/documentutil.inc.php @@ -125,9 +125,9 @@ class KTDocumentUtil { // FIXME at the moment errors this _does not_ rollback. - $this->oDocument->setIsCheckedOut(true); - $this->oDocument->setCheckedOutUserID($oUser->getId()); - if (!$this->oDocument->update()) { return PEAR::raiseError(_("There was a problem checking out the document.")); } + $oDocument->setIsCheckedOut(true); + $oDocument->setCheckedOutUserID($oUser->getId()); + if (!$oDocument->update()) { return PEAR::raiseError(_("There was a problem checking out the document.")); } $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); $aTriggers = $oKTTriggerRegistry->getTriggers('checkout', 'postValidate'); @@ -646,7 +646,8 @@ class KTDocumentUtil { function copy($oDocument, $oDestinationFolder) { // 1. generate a new triad of content, metadata and core objects. // 2. update the storage path. - + //print '--------------------------------- BEFORE'; + //print_r($oDocument); // grab the "source "data $sTable = KTUtil::getTableName('documents'); @@ -690,6 +691,11 @@ class KTDocumentUtil { // now, we have a semi-sane document object. get it. $oNewDocument = Document::get($oCore->getId()); + //print '--------------------------------- AFTER'; + //print_r($oDocument); + //print '======'; + //print_r($oNewDocument); + // copy the metadata from old to new. $res = KTDocumentUtil::copyMetadata($oNewDocument, $oDocument->getMetadataVersionId()); if (PEAR::isError($res)) { return $res; } diff --git a/lib/foldermanagement/folderutil.inc.php b/lib/foldermanagement/folderutil.inc.php index a362922..10632b1 100644 --- a/lib/foldermanagement/folderutil.inc.php +++ b/lib/foldermanagement/folderutil.inc.php @@ -260,7 +260,10 @@ class KTFolderUtil { return true; } - function copy($oFolder, $oDestFolder, $oUser, $sReason) { + function copy($oSrcFolder, $oDestFolder, $oUser, $sReason) { + if (KTFolderUtil::exists($oDestFolder, $oSrcFolder->getName())) { + return PEAR::raiseError("Folder with the same name already exists in the new parent folder"); + } // // FIXME the failure cleanup code here needs some serious work. // @@ -276,7 +279,7 @@ class KTFolderUtil { $aFailedDocuments = array(); // of String $aFailedFolders = array(); // of String - $aRemainingFolders = array($oFolder->getId()); + $aRemainingFolders = array($oSrcFolder->getId()); DBUtil::startTransaction(); @@ -332,7 +335,7 @@ class KTFolderUtil { $sTable = KTUtil::getTableName('folders'); $sGetQuery = 'SELECT * FROM ' . $sTable . ' WHERE id = ? '; - $aParams = array($oFolder->getId()); + $aParams = array($oSrcFolder->getId()); $aRow = DBUtil::getOneResult(array($sGetQuery, $aParams)); unset($aRow['id']); $aRow['parent_id'] = $oDestFolder->getId(); @@ -341,7 +344,7 @@ class KTFolderUtil { DBUtil::rollback(); return $id; } - $aFolderMap[$oFolder->getId()] = $id; + $aFolderMap[$oSrcFolder->getId()] = $id; $oNewBaseFolder = Folder::get($id); $res = $oStorage->createFolder($oNewBaseFolder); if (PEAR::isError($res)) { @@ -349,7 +352,7 @@ class KTFolderUtil { DBUtil::rollback(); return $res; } - $aRemainingFolders = Folder::getList(array('parent_id = ?', array($oFolder->getId())), array('ids' => true)); + $aRemainingFolders = Folder::getList(array('parent_id = ?', array($oSrcFolder->getId())), array('ids' => true)); while (!empty($aRemainingFolders)) { @@ -364,10 +367,12 @@ class KTFolderUtil { $id = DBUtil::autoInsert($sTable, $aRow); if (PEAR::isError($id)) { + $oStorage->removeFolder($oNewBaseFolder); DBUtil::rollback(); return $id; } $aFolderMap[$iFolderId] = $id; + $oNewFolder = Folder::get($id); $res = $oStorage->createFolder($oNewFolder); if (PEAR::isError($res)) { @@ -382,12 +387,15 @@ class KTFolderUtil { } + var_dump($aFolderMap); // now we can go ahead. foreach ($aDocuments as $oDocument) { $oChildDestinationFolder = Folder::get($aFolderMap[$oDocument->getFolderID()]); + var_dump($oDocument->getFolderID()); $res = KTDocumentUtil::copy($oDocument, $oChildDestinationFolder); if (PEAR::isError($res) || ($res === false)) { + $oStorage->removeFolder($oNewBaseFolder); DBUtil::rollback(); return PEAR::raiseError(_('Delete Aborted. Unexpected failure to copydocument: ') . $oDocument->getName() . $res->getMessage()); } diff --git a/lib/storage/ondiskpathstoragemanager.inc.php b/lib/storage/ondiskpathstoragemanager.inc.php index 2755f91..8dc7ebb 100644 --- a/lib/storage/ondiskpathstoragemanager.inc.php +++ b/lib/storage/ondiskpathstoragemanager.inc.php @@ -283,9 +283,8 @@ class KTOnDiskPathStorageManager extends KTStorageManager { $oConfig =& KTConfig::getSingleton(); $sDocumentRoot = $oConfig->get('urls/documentRoot'); - $sOldPath = sprintf("%s/%s-%s", KTDocumentCore::_generateFolderPath($oSrcDocument->getFolderID()), $oSrcDocument->_oDocumentContentVersion->getId(), $oSrcDocument->_oDocumentContentVersion->getFileName()); - $sNewPath = sprintf("%s/%s-%s", KTDocumentCore::_generateFolderPath($oNewDocument->getFolderID()), $oNewDocument->_oDocumentContentVersion->getId(), $oNewDocument->_oDocumentContentVersion->getFileName()); - $sFullOldPath = sprintf("%s/%s", $sDocumentRoot, $sOldPath); + $sNewPath = $this->generateStoragePath($oNewDocument); + $sFullOldPath = sprintf("%s/%s", $sDocumentRoot, $this->generateStoragePath($oSrcDocument)); $sFullNewPath = sprintf("%s/%s", $sDocumentRoot, $sNewPath); $res = KTUtil::copyFile($sFullOldPath, $sFullNewPath); diff --git a/templates/ktcore/metadata/conditional/editsimple.smarty b/templates/ktcore/metadata/conditional/editsimple.smarty index 330e7d0..e1cfbef 100644 --- a/templates/ktcore/metadata/conditional/editsimple.smarty +++ b/templates/ktcore/metadata/conditional/editsimple.smarty @@ -1,6 +1,7 @@ {capture assign=sCSS} {literal} /* inactivity */ + .active .inactivity_message { display: none; } select { width: 100%; } @@ -14,11 +15,11 @@ select { width: 100%; } .active.editing .edit_button { display: none; } -.active { position: relative; } + td { vertical-align: top; } .buttonset.inactive { background: transparent; } -.inactive { background: #ccc; position: relative; } +.inactive { background: #ccc; } .inactive .fixed_message, .inactive .unassigned_items, .inactive .available_behaviours, @@ -79,11 +80,14 @@ refresh the page.
| {$oField->getName()} | {/foreach}
|---|
| @@ -112,7 +118,11 @@ refresh the page. | {/foreach}