From 837611e2fcb75b3e39161b2d183a24e39c945686 Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Wed, 16 Nov 2005 19:04:56 +0000 Subject: [PATCH] Fix some merge errors from the KT3 UI landing. --- lib/actions/actionregistry.inc.php | 5 +++++ lib/actions/documentaction.inc.php | 29 ++++++++++++++++++++++++----- lib/documentmanagement/DocumentFieldLink.inc | 62 ++++++++++++++++++++++++++++++++++---------------------------- lib/documentmanagement/DocumentTransaction.inc | 12 +++++++++++- lib/metadata/fieldset.inc.php | 6 ++++++ lib/storage/ondiskpathstoragemanager.inc.php | 9 +++++++++ lib/visualpatterns/NavBar.inc | 2 +- 7 files changed, 90 insertions(+), 35 deletions(-) diff --git a/lib/actions/actionregistry.inc.php b/lib/actions/actionregistry.inc.php index 2ea9bea..585389b 100644 --- a/lib/actions/actionregistry.inc.php +++ b/lib/actions/actionregistry.inc.php @@ -14,11 +14,16 @@ class KTActionRegistry { function registerAction($slot, $name, $nsname, $path = "") { $this->actions[$slot] = KTUtil::arrayGet($this->actions, $slot, array()); $this->actions[$slot][$nsname] = array($name, $path, $nsname); + $this->nsnames[$nsname] = array($name, $path, $nsname); } function getActions($slot) { return $this->actions[$slot]; } + + function getActionByNsname($nsname) { + return $this->nsnames[$nsname]; + } } ?> diff --git a/lib/actions/documentaction.inc.php b/lib/actions/documentaction.inc.php index b858642..680404f 100644 --- a/lib/actions/documentaction.inc.php +++ b/lib/actions/documentaction.inc.php @@ -2,8 +2,9 @@ require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php'); require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php'); +require_once(KT_LIB_DIR . '/dispatcher.inc.php'); -class KTDocumentAction { +class KTDocumentAction extends KTStandardDispatcher { var $sName; var $sDescription; var $sDisplayName; @@ -14,9 +15,18 @@ class KTDocumentAction { var $_bDisabled; var $_sDisabledText = null; - function KTDocumentAction($oDocument, $oUser) { - $this->oDocument = $oDocument; - $this->oUser = $oUser; + function KTDocumentAction($oDocument = null, $oUser = null) { + $this->oDocument =& $oDocument; + $this->oUser =& $oUser; + parent::KTStandardDispatcher(); + } + + function setDocument(&$oDocument) { + $this->oDocument =& $oDocument; + } + + function setUser(&$oUser) { + $this->oUser =& $oUser; } function _show() { @@ -53,7 +63,7 @@ class KTDocumentAction { } function getURL() { - return sprintf("/plugin.php/%s?fDocumentID=%d", $this->sName, $this->oDocument->getID()); + return sprintf("/action.php/%s?fDocumentId=%d", $this->sName, $this->oDocument->getID()); } function getInfo() { @@ -86,6 +96,15 @@ class KTDocumentAction { function customiseInfo($aInfo) { return $aInfo; } + + function check() { + $this->oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']); + return true; + } + + function do_main() { + return "Dispatcher component of action not implemented."; + } } class KTDocumentActionUtil { diff --git a/lib/documentmanagement/DocumentFieldLink.inc b/lib/documentmanagement/DocumentFieldLink.inc index 3eeed58..12c70dc 100644 --- a/lib/documentmanagement/DocumentFieldLink.inc +++ b/lib/documentmanagement/DocumentFieldLink.inc @@ -29,12 +29,18 @@ class DocumentFieldLink extends KTEntity { /** document field link primary key */ var $iId; /** primary key of document to which field is linked */ - var $iDocumentID; + var $iDocumentId; /** primary key of field to which document is linked */ - var $iDocumentFieldID; + var $iDocumentFieldId; /** field value */ var $sValue; - + + var $_aFieldToSelect = array( + 'iId' => 'id', + 'iDocumentId' => 'document_id', + 'iDocumentFieldId' => 'document_field_id', + 'sValue' => 'value', + ); /** * Default constructor @@ -44,11 +50,11 @@ class DocumentFieldLink extends KTEntity { * @param Value of field * */ - function DocumentFieldLink($iNewDocumentID, $iNewDocumentFieldID, $sNewValue) { + function DocumentFieldLink($iNewDocumentId = null, $iNewDocumentFieldId = null, $sNewValue = null) { //object not create in database yet $this->iId = -1; - $this->iDocumentID = $iNewDocumentID; - $this->iDocumentFieldID = $iNewDocumentFieldID; + $this->iDocumentId = $iNewDocumentId; + $this->iDocumentFieldId = $iNewDocumentFieldId; $this->sValue = $sNewValue; } @@ -58,7 +64,7 @@ class DocumentFieldLink extends KTEntity { * @return int document field link primary key * */ - function getID() { + function getId() { return $this->iId; } @@ -68,8 +74,8 @@ class DocumentFieldLink extends KTEntity { * @return int document primary key to which the field is linked * */ - function getDocumentID() { - return $this->iDocumentID; + function getDocumentId() { + return $this->iDocumentId; } /** @@ -78,8 +84,8 @@ class DocumentFieldLink extends KTEntity { * @param Document primary key to which field is linked * */ - function setDocumentID($iNewValue) { - $this->iDocumentID = $iNewValue; + function setDocumentId($iNewValue) { + $this->iDocumentId = $iNewValue; } /** @@ -88,8 +94,8 @@ class DocumentFieldLink extends KTEntity { * @return int primary key of field to which the document is related * */ - function getDocumentFieldID() { - return $this->iDocumentFieldID; + function getDocumentFieldId() { + return $this->iDocumentFieldId; } /** @@ -98,8 +104,8 @@ class DocumentFieldLink extends KTEntity { * @param New primary key of field to which document is related * */ - function setDocumentFieldID($iNewVale) { - $this->iDocumentFieldID = $iNewValue; + function setDocumentFieldId($iNewVale) { + $this->iDocumentFieldId = $iNewValue; } /** @@ -122,14 +128,6 @@ class DocumentFieldLink extends KTEntity { $this->sValue = $sNewValue; } - function _fieldValues () { - return array( - 'document_id' => $this->iDocumentID, - 'document_field_id' => $this->iDocumentFieldID, - 'value' => $this->sValue, - ); - } - function _table () { global $default; return $default->document_fields_link_table; @@ -143,16 +141,16 @@ class DocumentFieldLink extends KTEntity { * * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"] */ - function & get($iDocumentFieldLinkID) { + function & get($iDocumentFieldLinkId) { global $default, $lang_err_doc_not_exist; $sql = $default->db; - $sql->query(array("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = ?", $iDocumentFieldLinkID));/*ok*/ + $sql->query(array("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = ?", $iDocumentFieldLinkId));/*ok*/ if ($sql->next_record()) { $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value")); - $oDocumentFieldLink->iId = $iDocumentFieldLinkID; + $oDocumentFieldLink->iId = $iDocumentFieldLinkId; return $oDocumentFieldLink; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_link_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentId . " table = $default->document_fields_link_table"; return false; } @@ -162,9 +160,17 @@ class DocumentFieldLink extends KTEntity { function &getByDocument($oDocument) { + $iDocumentId = KTUtil::getId($oDocument); return KTEntityUtil::getByDict('DocumentFieldLink', array( - 'document_id' => $oDocument->getID(), + 'document_id' => $iDocumentId, ), array('multi' => true)); } + + function &getByDocumentAndField($oDocument, $oField) { + return KTEntityUtil::getByDict('DocumentFieldLink', array( + 'document_id' => KTUtil::getId($oDocument), + 'document_field_id' => KTUtil::getId($oDocument), + )); + } } ?> diff --git a/lib/documentmanagement/DocumentTransaction.inc b/lib/documentmanagement/DocumentTransaction.inc index 952f2e5..2eb4628 100644 --- a/lib/documentmanagement/DocumentTransaction.inc +++ b/lib/documentmanagement/DocumentTransaction.inc @@ -15,6 +15,7 @@ DEFINE("FORCE_CHECKIN", 12); DEFINE("EMAIL_LINK", 13); DEFINE("COLLAB_ACCEPT", 14); DEFINE("EMAIL_ATTACH", 15); +DEFINE("WORKFLOW_TRANSITION", 16); /** * $Id$ * @@ -102,6 +103,10 @@ class DocumentTransaction { return $this->sVersion; } + function getComment() { + return $this->sComment; + } + function _table() { global $default; return $default->document_transactions_table; @@ -197,7 +202,12 @@ class DocumentTransaction { * @return Array array of DocumentTransaction objects, false otherwise and set $_SESSION["errorMessage"] */ function getList($sWhereClause = null) { - return KTEntityUtil::getList(DocumentTransaction::_table(), 'DocumentTransaction', $sWhereClause); + return KTEntityUtil::getList2('DocumentTransaction', $sWhereClause); + } + + function getByDocument($oDocument) { + $iDocumentId = KTUtil::getId($oDocument); + return DocumentTransaction::getList(array('document_id = ?', array($iDocumentId))); } } ?> diff --git a/lib/metadata/fieldset.inc.php b/lib/metadata/fieldset.inc.php index e1e0b1c..4738cca 100644 --- a/lib/metadata/fieldset.inc.php +++ b/lib/metadata/fieldset.inc.php @@ -133,6 +133,12 @@ class KTFieldset extends KTEntity { $iFieldsetId = $oField->getParentFieldsetId(); return KTFieldset::get($iFieldsetId); } + + function &getByNamespace($sNamespace) { + return KTEntityUtil::getByDict('KTFieldset', array( + 'namespace' => $sNamespace, + )); + } } ?> diff --git a/lib/storage/ondiskpathstoragemanager.inc.php b/lib/storage/ondiskpathstoragemanager.inc.php index cbf3144..35242f7 100644 --- a/lib/storage/ondiskpathstoragemanager.inc.php +++ b/lib/storage/ondiskpathstoragemanager.inc.php @@ -73,6 +73,15 @@ class KTOnDiskPathStorageManager extends KTStorageManager { $sStoragePath = sprintf("%s/%s", Document::_generateFolderPath($oDocument->getFolderID()), $oDocument->getFileName()); return $sStoragePath; } + + function temporaryFile(&$oDocument) { + $oConfig =& KTConfig::getSingleton(); + return sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oDocument)); + } + + function freeTemporaryFile($sPath) { + return; + } function download($oDocument) { //get the path to the document on the server diff --git a/lib/visualpatterns/NavBar.inc b/lib/visualpatterns/NavBar.inc index 292fc89..3b32f0b 100644 --- a/lib/visualpatterns/NavBar.inc +++ b/lib/visualpatterns/NavBar.inc @@ -1,5 +1,5 @@ fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); +require_once(KT_LIB_DIR . "/visualpatterns/PatternCustom.inc"); /** * $Id$ * -- libgit2 0.21.4