Commit 837611e2fcb75b3e39161b2d183a24e39c945686

Authored by Neil Blakey-Milner
1 parent 3dd1c0bb

Fix some merge errors from the KT3 UI landing.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4015 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/actions/actionregistry.inc.php
... ... @@ -14,11 +14,16 @@ class KTActionRegistry {
14 14 function registerAction($slot, $name, $nsname, $path = "") {
15 15 $this->actions[$slot] = KTUtil::arrayGet($this->actions, $slot, array());
16 16 $this->actions[$slot][$nsname] = array($name, $path, $nsname);
  17 + $this->nsnames[$nsname] = array($name, $path, $nsname);
17 18 }
18 19  
19 20 function getActions($slot) {
20 21 return $this->actions[$slot];
21 22 }
  23 +
  24 + function getActionByNsname($nsname) {
  25 + return $this->nsnames[$nsname];
  26 + }
22 27 }
23 28  
24 29 ?>
... ...
lib/actions/documentaction.inc.php
... ... @@ -2,8 +2,9 @@
2 2  
3 3 require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php');
4 4 require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php');
  5 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
5 6  
6   -class KTDocumentAction {
  7 +class KTDocumentAction extends KTStandardDispatcher {
7 8 var $sName;
8 9 var $sDescription;
9 10 var $sDisplayName;
... ... @@ -14,9 +15,18 @@ class KTDocumentAction {
14 15 var $_bDisabled;
15 16 var $_sDisabledText = null;
16 17  
17   - function KTDocumentAction($oDocument, $oUser) {
18   - $this->oDocument = $oDocument;
19   - $this->oUser = $oUser;
  18 + function KTDocumentAction($oDocument = null, $oUser = null) {
  19 + $this->oDocument =& $oDocument;
  20 + $this->oUser =& $oUser;
  21 + parent::KTStandardDispatcher();
  22 + }
  23 +
  24 + function setDocument(&$oDocument) {
  25 + $this->oDocument =& $oDocument;
  26 + }
  27 +
  28 + function setUser(&$oUser) {
  29 + $this->oUser =& $oUser;
20 30 }
21 31  
22 32 function _show() {
... ... @@ -53,7 +63,7 @@ class KTDocumentAction {
53 63 }
54 64  
55 65 function getURL() {
56   - return sprintf("/plugin.php/%s?fDocumentID=%d", $this->sName, $this->oDocument->getID());
  66 + return sprintf("/action.php/%s?fDocumentId=%d", $this->sName, $this->oDocument->getID());
57 67 }
58 68  
59 69 function getInfo() {
... ... @@ -86,6 +96,15 @@ class KTDocumentAction {
86 96 function customiseInfo($aInfo) {
87 97 return $aInfo;
88 98 }
  99 +
  100 + function check() {
  101 + $this->oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']);
  102 + return true;
  103 + }
  104 +
  105 + function do_main() {
  106 + return "Dispatcher component of action not implemented.";
  107 + }
89 108 }
90 109  
91 110 class KTDocumentActionUtil {
... ...
lib/documentmanagement/DocumentFieldLink.inc
... ... @@ -29,12 +29,18 @@ class DocumentFieldLink extends KTEntity {
29 29 /** document field link primary key */
30 30 var $iId;
31 31 /** primary key of document to which field is linked */
32   - var $iDocumentID;
  32 + var $iDocumentId;
33 33 /** primary key of field to which document is linked */
34   - var $iDocumentFieldID;
  34 + var $iDocumentFieldId;
35 35 /** field value */
36 36 var $sValue;
37   -
  37 +
  38 + var $_aFieldToSelect = array(
  39 + 'iId' => 'id',
  40 + 'iDocumentId' => 'document_id',
  41 + 'iDocumentFieldId' => 'document_field_id',
  42 + 'sValue' => 'value',
  43 + );
38 44  
39 45 /**
40 46 * Default constructor
... ... @@ -44,11 +50,11 @@ class DocumentFieldLink extends KTEntity {
44 50 * @param Value of field
45 51 *
46 52 */
47   - function DocumentFieldLink($iNewDocumentID, $iNewDocumentFieldID, $sNewValue) {
  53 + function DocumentFieldLink($iNewDocumentId = null, $iNewDocumentFieldId = null, $sNewValue = null) {
48 54 //object not create in database yet
49 55 $this->iId = -1;
50   - $this->iDocumentID = $iNewDocumentID;
51   - $this->iDocumentFieldID = $iNewDocumentFieldID;
  56 + $this->iDocumentId = $iNewDocumentId;
  57 + $this->iDocumentFieldId = $iNewDocumentFieldId;
52 58 $this->sValue = $sNewValue;
53 59 }
54 60  
... ... @@ -58,7 +64,7 @@ class DocumentFieldLink extends KTEntity {
58 64 * @return int document field link primary key
59 65 *
60 66 */
61   - function getID() {
  67 + function getId() {
62 68 return $this->iId;
63 69 }
64 70  
... ... @@ -68,8 +74,8 @@ class DocumentFieldLink extends KTEntity {
68 74 * @return int document primary key to which the field is linked
69 75 *
70 76 */
71   - function getDocumentID() {
72   - return $this->iDocumentID;
  77 + function getDocumentId() {
  78 + return $this->iDocumentId;
73 79 }
74 80  
75 81 /**
... ... @@ -78,8 +84,8 @@ class DocumentFieldLink extends KTEntity {
78 84 * @param Document primary key to which field is linked
79 85 *
80 86 */
81   - function setDocumentID($iNewValue) {
82   - $this->iDocumentID = $iNewValue;
  87 + function setDocumentId($iNewValue) {
  88 + $this->iDocumentId = $iNewValue;
83 89 }
84 90  
85 91 /**
... ... @@ -88,8 +94,8 @@ class DocumentFieldLink extends KTEntity {
88 94 * @return int primary key of field to which the document is related
89 95 *
90 96 */
91   - function getDocumentFieldID() {
92   - return $this->iDocumentFieldID;
  97 + function getDocumentFieldId() {
  98 + return $this->iDocumentFieldId;
93 99 }
94 100  
95 101 /**
... ... @@ -98,8 +104,8 @@ class DocumentFieldLink extends KTEntity {
98 104 * @param New primary key of field to which document is related
99 105 *
100 106 */
101   - function setDocumentFieldID($iNewVale) {
102   - $this->iDocumentFieldID = $iNewValue;
  107 + function setDocumentFieldId($iNewVale) {
  108 + $this->iDocumentFieldId = $iNewValue;
103 109 }
104 110  
105 111 /**
... ... @@ -122,14 +128,6 @@ class DocumentFieldLink extends KTEntity {
122 128 $this->sValue = $sNewValue;
123 129 }
124 130  
125   - function _fieldValues () {
126   - return array(
127   - 'document_id' => $this->iDocumentID,
128   - 'document_field_id' => $this->iDocumentFieldID,
129   - 'value' => $this->sValue,
130   - );
131   - }
132   -
133 131 function _table () {
134 132 global $default;
135 133 return $default->document_fields_link_table;
... ... @@ -143,16 +141,16 @@ class DocumentFieldLink extends KTEntity {
143 141 *
144 142 * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"]
145 143 */
146   - function & get($iDocumentFieldLinkID) {
  144 + function & get($iDocumentFieldLinkId) {
147 145 global $default, $lang_err_doc_not_exist;
148 146 $sql = $default->db;
149   - $sql->query(array("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = ?", $iDocumentFieldLinkID));/*ok*/
  147 + $sql->query(array("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = ?", $iDocumentFieldLinkId));/*ok*/
150 148 if ($sql->next_record()) {
151 149 $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value"));
152   - $oDocumentFieldLink->iId = $iDocumentFieldLinkID;
  150 + $oDocumentFieldLink->iId = $iDocumentFieldLinkId;
153 151 return $oDocumentFieldLink;
154 152 }
155   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_link_table";
  153 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentId . " table = $default->document_fields_link_table";
156 154 return false;
157 155 }
158 156  
... ... @@ -162,9 +160,17 @@ class DocumentFieldLink extends KTEntity {
162 160  
163 161  
164 162 function &getByDocument($oDocument) {
  163 + $iDocumentId = KTUtil::getId($oDocument);
165 164 return KTEntityUtil::getByDict('DocumentFieldLink', array(
166   - 'document_id' => $oDocument->getID(),
  165 + 'document_id' => $iDocumentId,
167 166 ), array('multi' => true));
168 167 }
  168 +
  169 + function &getByDocumentAndField($oDocument, $oField) {
  170 + return KTEntityUtil::getByDict('DocumentFieldLink', array(
  171 + 'document_id' => KTUtil::getId($oDocument),
  172 + 'document_field_id' => KTUtil::getId($oDocument),
  173 + ));
  174 + }
169 175 }
170 176 ?>
... ...
lib/documentmanagement/DocumentTransaction.inc
... ... @@ -15,6 +15,7 @@ DEFINE("FORCE_CHECKIN", 12);
15 15 DEFINE("EMAIL_LINK", 13);
16 16 DEFINE("COLLAB_ACCEPT", 14);
17 17 DEFINE("EMAIL_ATTACH", 15);
  18 +DEFINE("WORKFLOW_TRANSITION", 16);
18 19 /**
19 20 * $Id$
20 21 *
... ... @@ -102,6 +103,10 @@ class DocumentTransaction {
102 103 return $this->sVersion;
103 104 }
104 105  
  106 + function getComment() {
  107 + return $this->sComment;
  108 + }
  109 +
105 110 function _table() {
106 111 global $default;
107 112 return $default->document_transactions_table;
... ... @@ -197,7 +202,12 @@ class DocumentTransaction {
197 202 * @return Array array of DocumentTransaction objects, false otherwise and set $_SESSION["errorMessage"]
198 203 */
199 204 function getList($sWhereClause = null) {
200   - return KTEntityUtil::getList(DocumentTransaction::_table(), 'DocumentTransaction', $sWhereClause);
  205 + return KTEntityUtil::getList2('DocumentTransaction', $sWhereClause);
  206 + }
  207 +
  208 + function getByDocument($oDocument) {
  209 + $iDocumentId = KTUtil::getId($oDocument);
  210 + return DocumentTransaction::getList(array('document_id = ?', array($iDocumentId)));
201 211 }
202 212 }
203 213 ?>
... ...
lib/metadata/fieldset.inc.php
... ... @@ -133,6 +133,12 @@ class KTFieldset extends KTEntity {
133 133 $iFieldsetId = $oField->getParentFieldsetId();
134 134 return KTFieldset::get($iFieldsetId);
135 135 }
  136 +
  137 + function &getByNamespace($sNamespace) {
  138 + return KTEntityUtil::getByDict('KTFieldset', array(
  139 + 'namespace' => $sNamespace,
  140 + ));
  141 + }
136 142 }
137 143  
138 144 ?>
... ...
lib/storage/ondiskpathstoragemanager.inc.php
... ... @@ -73,6 +73,15 @@ class KTOnDiskPathStorageManager extends KTStorageManager {
73 73 $sStoragePath = sprintf("%s/%s", Document::_generateFolderPath($oDocument->getFolderID()), $oDocument->getFileName());
74 74 return $sStoragePath;
75 75 }
  76 +
  77 + function temporaryFile(&$oDocument) {
  78 + $oConfig =& KTConfig::getSingleton();
  79 + return sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oDocument));
  80 + }
  81 +
  82 + function freeTemporaryFile($sPath) {
  83 + return;
  84 + }
76 85  
77 86 function download($oDocument) {
78 87 //get the path to the document on the server
... ...
lib/visualpatterns/NavBar.inc
1 1 <?php
2   -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
  2 +require_once(KT_LIB_DIR . "/visualpatterns/PatternCustom.inc");
3 3 /**
4 4 * $Id$
5 5 *
... ...