Commit 540abd98c5da5470813f8a40e7717502be2ea0a4

Authored by michael
1 parent 14995472

added copyright and gpl notice

removed owl prefix from table aliases


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2557 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DependantDocumentInstance.inc
1   -<?php
  1 +<?php
2 2 /**
3   -*
4   -* Class DependantDocumentInstance
5   -*
6   -* Represents a dependant document as per the database table dependant_document
7   -* Used to chain documents together in the collaboration process
8   -*
9   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
10   -* @date 14 May 2003
11   -* @package lib.documentmanagement
12   -*/
13   -
14   -
  3 + * $Id$
  4 + *
  5 + * Represents a dependant document instance as per the database table dependant_document_instance.
  6 + * Used to chain documents together in the collaboration process/
  7 + *
  8 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify
  11 + * it under the terms of the GNU General Public License as published by
  12 + * the Free Software Foundation; either version 2 of the License, or
  13 + * (at your option) any later version.
  14 + *
  15 + * This program is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program; if not, write to the Free Software
  22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23 + *
  24 + * @version $Revision$
  25 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  26 + * @package lib.documentmanagement
  27 + */
15 28 class DependantDocumentInstance {
16 29  
17 30 /** primary key value */
... ... @@ -114,7 +127,7 @@ class DependantDocumentInstance {
114 127 //if the object hasn't been created
115 128 if ($this -> iId < 0) {
116 129 $sql = $default -> db;
117   - $result = $sql -> query("INSERT INTO $default->owl_dependant_document_instance_table (document_title, user_id,template_document_id, parent_document_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iUserID, " . (isset($this->iTemplateDocumentID) ? "$this->iTemplateDocumentID" : "NULL") . ", " . $this->iParentDocumentID . ")");
  130 + $result = $sql -> query("INSERT INTO $default->dependant_document_instance_table (document_title, user_id,template_document_id, parent_document_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iUserID, " . (isset($this->iTemplateDocumentID) ? "$this->iTemplateDocumentID" : "NULL") . ", " . $this->iParentDocumentID . ")");
118 131 if ($result) {
119 132 $this -> iId = $sql -> insert_id();
120 133 return true;
... ... @@ -159,7 +172,7 @@ class DependantDocumentInstance {
159 172 //only delete the object if it exists in the database
160 173 if ($this -> iId >= 0) {
161 174 $sql = $default -> db;
162   - $result = $sql -> query("DELETE FROM $default->owl_dependant_document_instance_table WHERE id = $this->iId");
  175 + $result = $sql -> query("DELETE FROM $default->dependant_document_instance_table WHERE id = $this->iId");
163 176 if ($result) {
164 177 return true;
165 178 }
... ... @@ -181,14 +194,14 @@ class DependantDocumentInstance {
181 194 function & get($iDependantDocumentID) {
182 195 global $default;
183 196 $sql = $default -> db;
184   - $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_instance_table WHERE id = $iDependantDocumentID");
  197 + $result = $sql -> query("SELECT * FROM $default->dependant_document_instance_table WHERE id = $iDependantDocumentID");
185 198 if ($result) {
186 199 if ($sql -> next_record()) {
187 200 $oDependantDocument = & new DependantDocumentInstance(stripslashes($sql -> f("document_title")), $sql -> f("user_id"), $sql -> f("template_document_id"), $sql->f("parent_document_id"));
188 201 $oDependantDocument -> iId = $sql -> f("id");
189 202 return $oDependantDocument;
190 203 }
191   - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_instance_table";
  204 + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->dependant_document_instance_table";
192 205 return false;
193 206 }
194 207 $_SESSION["errorMessage"] = $lang_err_database;
... ...
lib/documentmanagement/DependantDocumentTemplate.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class DependantDocument
5   -*
6   -* Represents a dependant document as per the database table dependant_document
7   -* Used to chain documents together in the collaboration process
8   -*
9   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
10   -* @date 14 May 2003
11   -* @package lib.documentmanagement
12   -*/
13   -
14   -
  3 + * $Id$
  4 + *
  5 + * Represents a dependant document template as per the database table dependant_document_template.
  6 + * Used to chain documents together in the collaboration process.
  7 + *
  8 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify
  11 + * it under the terms of the GNU General Public License as published by
  12 + * the Free Software Foundation; either version 2 of the License, or
  13 + * (at your option) any later version.
  14 + *
  15 + * This program is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program; if not, write to the Free Software
  22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23 + *
  24 + * @version $Revision$
  25 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  26 + * @package lib.documentmanagement
  27 + */
15 28 class DependantDocumentTemplate {
16 29  
17 30 /** primary key value */
... ... @@ -122,7 +135,7 @@ class DependantDocumentTemplate {
122 135 //if the object hasn't been created
123 136 if ($this -> iId < 0) {
124 137 $sql = $default -> db;
125   - $result = $sql -> query("INSERT INTO $default->owl_dependant_document_template_table (document_title, default_user_id,template_document_id, group_folder_approval_link_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iDefaultUserID, " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", $this->iGroupFolderApprovalLinkID)");
  138 + $result = $sql -> query("INSERT INTO $default->dependant_document_template_table (document_title, default_user_id,template_document_id, group_folder_approval_link_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iDefaultUserID, " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", $this->iGroupFolderApprovalLinkID)");
126 139 if ($result) {
127 140 $this -> iId = $sql -> insert_id();
128 141 return true;
... ... @@ -130,7 +143,7 @@ class DependantDocumentTemplate {
130 143 $_SESSION["errorMessage"] = $lang_err_database;
131 144 return false;
132 145 }
133   - $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." Table = $default->owl_dependant_document_template_table";
  146 + $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." Table = $default->dependant_document_template_table";
134 147 return false;
135 148 }
136 149  
... ... @@ -145,7 +158,7 @@ class DependantDocumentTemplate {
145 158 //only update if the object has been stored
146 159 if ($this -> iId > 0) {
147 160 $sql = $default -> db;
148   - $result = $sql -> query("UPDATE $default->owl_dependant_document_template_table SET document_title = '".addslashes($this -> sDocumentTitle)."', default_user_id = $this->iDefaultUserID, template_document_id = " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", group_folder_approval_link_id = $this->iGroupFolderApprovalLinkID WHERE id = $this->iId");
  161 + $result = $sql -> query("UPDATE $default->dependant_document_template_table SET document_title = '".addslashes($this -> sDocumentTitle)."', default_user_id = $this->iDefaultUserID, template_document_id = " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", group_folder_approval_link_id = $this->iGroupFolderApprovalLinkID WHERE id = $this->iId");
149 162 if ($result) {
150 163 return true;
151 164 }
... ... @@ -167,7 +180,7 @@ class DependantDocumentTemplate {
167 180 //only delete the object if it exists in the database
168 181 if ($this -> iId >= 0) {
169 182 $sql = $default -> db;
170   - $result = $sql -> query("DELETE FROM $default->owl_dependant_document_template_table WHERE id = $this->iId");
  183 + $result = $sql -> query("DELETE FROM $default->dependant_document_template_table WHERE id = $this->iId");
171 184 if ($result) {
172 185 return true;
173 186 }
... ... @@ -189,7 +202,7 @@ class DependantDocumentTemplate {
189 202 function & get($iDependantDocumentID) {
190 203 global $default;
191 204 $sql = $default -> db;
192   - $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_template_table WHERE id = $iDependantDocumentID");
  205 + $result = $sql -> query("SELECT * FROM $default->dependant_document_template_table WHERE id = $iDependantDocumentID");
193 206 if ($result) {
194 207 if ($sql -> next_record()) {
195 208 $DependantDocumentTemplate = & new DependantDocumentTemplate(stripslashes($sql -> f("document_title")), $sql -> f("default_user_id"), $sql->f("group_folder_approval_link_id"), $sql->f("template_document_id"));
... ... @@ -199,7 +212,7 @@ class DependantDocumentTemplate {
199 212 }*/
200 213 return $DependantDocumentTemplate;
201 214 }
202   - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_template_table";
  215 + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->dependant_document_template_table";
203 216 return false;
204 217 }
205 218 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -220,7 +233,7 @@ class DependantDocumentTemplate {
220 233 settype($aDependatDocumentTemplateArray, "array");
221 234 $sql = $default->db;
222 235 // TODO: join on sys_deleted
223   - $result = $sql->query("SELECT * FROM " . $default->owl_dependant_document_template_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
  236 + $result = $sql->query("SELECT * FROM " . $default->dependant_document_template_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
224 237 if ($result) {
225 238 $iCount = 0;
226 239 while ($sql->next_record()) {
... ...
lib/documentmanagement/Document.inc
1 1 <?php
2   -
3 2 // document statuses
4 3 DEFINE("LIVE", 1);
5 4 DEFINE("PUBLISHED", 2);
6 5 DEFINE("DELETED", 3);
7 6 DEFINE("ARCHIVED", 4);
8   -
9 7 require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
10   -
11 8 /**
12 9 * $Id$
13 10 *
14   - * Represents a document as per the documents database table
  11 + * Represents a document as per the documents database table.
  12 + *
  13 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  14 + *
  15 + * This program is free software; you can redistribute it and/or modify
  16 + * it under the terms of the GNU General Public License as published by
  17 + * the Free Software Foundation; either version 2 of the License, or
  18 + * (at your option) any later version.
  19 + *
  20 + * This program is distributed in the hope that it will be useful,
  21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23 + * GNU General Public License for more details.
  24 + *
  25 + * You should have received a copy of the GNU General Public License
  26 + * along with this program; if not, write to the Free Software
  27 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 28 *
16 29 * @version $Revision$
17 30 * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
18 31 * @package lib.documentmanagement
19 32 * @todo add in document change transaction functionality
20   - */
  33 + */
21 34 class Document {
22 35 /** primary key */
23 36 var $iId;
... ... @@ -273,7 +286,7 @@ class Document {
273 286 //if the folder is not the root folder
274 287 if ($iFolderID != 0) {
275 288 $sql = $default->db;
276   - $sql->query("SELECT parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID");
  289 + $sql->query("SELECT parent_id FROM $default->folders_table WHERE ID = $iFolderID");
277 290 $sql->next_record();
278 291 return $this->generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID";
279 292 }
... ... @@ -291,7 +304,7 @@ class Document {
291 304 //if the folder is not the root folder
292 305 if ($iFolderID != 0) {
293 306 $sql = $default->db;
294   - $sql->query("SELECT name, parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID");
  307 + $sql->query("SELECT name, parent_id FROM $default->folders_table WHERE ID = $iFolderID");
295 308 $sql->next_record();
296 309 return $this->generateFullFolderPath($sql->f("parent_id")) . "/" . stripslashes($sql->f("name"));
297 310 }
... ... @@ -312,7 +325,7 @@ class Document {
312 325 $this->sFullPath = substr($sFullPath, 1, strlen($sFullPath));
313 326 $sParentFolderIDs = $this->generateParentFolderIDS($this->iFolderID);
314 327 $this->sParentFolderIDs = substr($sParentFolderIDs, 1, strlen($sParentFolderIDs));
315   - $result = $sql->query("INSERT INTO " . $default->owl_documents_table . " (document_type_id, name, filename, size, creator_id, modified, description, mime_id, folder_id, major_version, minor_version, is_checked_out, checked_out_user_id, parent_folder_ids, full_path, status_id) " .
  328 + $result = $sql->query("INSERT INTO " . $default->documents_table . " (document_type_id, name, filename, size, creator_id, modified, description, mime_id, folder_id, major_version, minor_version, is_checked_out, checked_out_user_id, parent_folder_ids, full_path, status_id) " .
316 329 "VALUES ($this->iDocumentTypeID, '" . addslashes($this->sName) . "', '" . addslashes($this->sFileName) . "', $this->iSize, $this->iCreatorID, '" . getCurrentDateTime() . "', '" . addslashes($this->sDescription) . "', $this->iMimeTypeID, $this->iFolderID, $this->iMajorVersion, $this->iMinorVersion, " . ($this->bIsCheckedOut ? 1 : 0) . ", $this->iCheckedOutUserID, '$this->sParentFolderIDs','" . addslashes($this->sFullPath) . "', $this->iStatusID)");
317 330 if ($result) {
318 331 //set the current documents primary key
... ... @@ -337,9 +350,9 @@ class Document {
337 350 // group permissions
338 351 $sGroupPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " .
339 352 "SELECT UGL.user_id AS user_id, D.id AS document_id " .
340   - "FROM $default->owl_documents_table AS D INNER JOIN folders AS F ON D.folder_id = F.id " .
341   - "INNER JOIN $default->owl_groups_folders_table AS GFL ON GFL.folder_id = F.id " .
342   - "INNER JOIN $default->owl_users_groups_table AS UGL ON UGL.group_id = GFL.group_id " .
  353 + "FROM $default->documents_table AS D INNER JOIN folders AS F ON D.folder_id = F.id " .
  354 + "INNER JOIN $default->groups_folders_table AS GFL ON GFL.folder_id = F.id " .
  355 + "INNER JOIN $default->users_groups_table AS UGL ON UGL.group_id = GFL.group_id " .
343 356 "WHERE D.id=$this->iId";
344 357 $default->log->info("addDocument groupPerms=$sGroupPerms");
345 358 if ($sql->query($sGroupPerms)) {
... ... @@ -350,7 +363,7 @@ class Document {
350 363 // role permissions
351 364 $sRolePerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " .
352 365 "SELECT user_id, document_id " .
353   - "FROM $default->owl_folders_user_roles_table " .
  366 + "FROM $default->folders_user_roles_table " .
354 367 "WHERE document_id=$this->iId";
355 368 $default->log->info("addDocument rolePerms=$sRolePerms");
356 369 if ($sql->query($sRolePerms)) {
... ... @@ -362,7 +375,7 @@ class Document {
362 375 // public folders
363 376 $sPublicFolderPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " .
364 377 "SELECT U.id, D.id " .
365   - "FROM $default->owl_users_table AS U, $default->owl_documents_table AS D INNER JOIN $default->owl_folders_table AS F ON D.folder_id = F.id " .
  378 + "FROM $default->users_table AS U, $default->documents_table AS D INNER JOIN $default->folders_table AS F ON D.folder_id = F.id " .
366 379 "WHERE F.is_public = 1 " .
367 380 "AND D.id=$this->iId";
368 381 $default->log->info("addDocument publicFolder=$sPublicFolderPerms");
... ... @@ -375,7 +388,7 @@ class Document {
375 388 // creator permissions
376 389 $sCreatorPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " .
377 390 "SELECT creator_id, id " .
378   - "FROM $default->owl_documents_table " .
  391 + "FROM $default->documents_table " .
379 392 "WHERE id=$this->iId";
380 393 $default->log->info("addDocument creatorPerms=$sCreatorPerms");
381 394 if ($sql->query($sCreatorPerms)) {
... ... @@ -394,7 +407,7 @@ class Document {
394 407 global $default, $lang_err_database, $lang_err_object_key;
395 408 if ($this->iId >= 0) {
396 409 $sql = $default->db;
397   - $sQuery = "UPDATE " . $default->owl_documents_table . " SET " .
  410 + $sQuery = "UPDATE " . $default->documents_table . " SET " .
398 411 "document_type_id = $this->iDocumentTypeID, " .
399 412 "name = '" . addslashes($this->sName) . "', " .
400 413 "filename = '" . addslashes($this->sFileName) . "', " .
... ... @@ -441,7 +454,7 @@ class Document {
441 454 global $default, $lang_err_database, $lang_err_object_key;
442 455 if ($this->iId >= 0) {
443 456 $sql = $default->db;
444   - $result = $sql->query("DELETE FROM " . $default->owl_documents_table . " WHERE id = $this->iId");
  457 + $result = $sql->query("DELETE FROM " . $default->documents_table . " WHERE id = $this->iId");
445 458 if ($result) {
446 459 $this->iId = -1;
447 460 // clean up for this deleted document
... ... @@ -463,7 +476,7 @@ class Document {
463 476 global $default;
464 477 //get the steps in this document's collaboration process
465 478 $sQuery = "SELECT FURL.id, GFAL.precedence " .
466   - "FROM $default->owl_folders_user_roles_table AS FURL INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON FURL.group_folder_approval_id = GFAL.id " .
  479 + "FROM $default->folders_user_roles_table AS FURL INNER JOIN $default->groups_folders_approval_table AS GFAL ON FURL.group_folder_approval_id = GFAL.id " .
467 480 "WHERE document_id = " . $this->iId . " " .
468 481 "ORDER BY GFAL.precedence ASC";
469 482 $sql = $default->db;
... ... @@ -522,7 +535,7 @@ class Document {
522 535 //if the user is assinged to two or more roles, make sure we get the current
523 536 //one by ordering by precedence
524 537 $sql->query("SELECT FURL.id AS id, GFAT.precedence " .
525   - "FROM $default->owl_groups_folders_approval_table AS GFAT INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
  538 + "FROM $default->groups_folders_approval_table AS GFAT INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
526 539 "WHERE document_id = $this->iId AND FURL.user_id = " . $_SESSION["userID"] . " " .
527 540 "AND done = 0 " .
528 541 "ORDER BY precedence ASC");
... ... @@ -550,7 +563,7 @@ class Document {
550 563 if (strlen($iDocumentID) > 0) {
551 564 $sql = $default->db;
552 565 // TODO: join on sys_deleted
553   - $sql->query("SELECT * FROM $default->owl_documents_table WHERE id = $iDocumentID");
  566 + $sql->query("SELECT * FROM $default->documents_table WHERE id = $iDocumentID");
554 567 if ($sql->next_record()) {
555 568 $oDocument = & new Document(stripslashes($sql->f("name")), stripslashes($sql->f("filename")), $sql->f("size"), $sql->f("creator_id"), $sql->f("mime_id"), $sql->f("folder_id"), $sql->f("description"));
556 569 $oDocument->setDocumentTypeID($sql->f("document_type_id"));
... ... @@ -587,7 +600,7 @@ class Document {
587 600 $aDocumentArray;
588 601 settype($aDocumentArray, "array");
589 602 $sql = $default->db;
590   - $result = $sql->query("SELECT * FROM " . $default->owl_documents_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
  603 + $result = $sql->query("SELECT * FROM " . $default->documents_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
591 604 if ($result) {
592 605 $iCount = 0;
593 606 while ($sql->next_record()) {
... ... @@ -642,7 +655,7 @@ class Document {
642 655 $aDocumentHistory;
643 656 settype($aDocumentHistory, "array");
644 657 $sql = $default->db;
645   - $result = $sql->query("SELECT * FROM " . $default->owl_document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime DESC");
  658 + $result = $sql->query("SELECT * FROM " . $default->document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime DESC");
646 659 if ($result) {
647 660 $iCount = 0;
648 661 while($sql->next_record()) {
... ... @@ -666,7 +679,7 @@ class Document {
666 679 global $default;
667 680 if ($this->iMimeTypeID) {
668 681 // lookup the icon from the table
669   - $sIconPath = lookupField($default->owl_mime_table, "icon_path", "id", $this->iMimeTypeID);
  682 + $sIconPath = lookupField($default->mimetypes_table, "icon_path", "id", $this->iMimeTypeID);
670 683 if (strlen($sIconPath) > 0) {
671 684 return $default->graphicsUrl . "/" . $sIconPath;
672 685 } else {
... ... @@ -717,7 +730,7 @@ class Document {
717 730 function documentExists($sFileName, $iFolderID) {
718 731 global $default;
719 732 $sql = $default->db;
720   - $sQuery = "SELECT * FROM $default->owl_documents_table " .
  733 + $sQuery = "SELECT * FROM $default->documents_table " .
721 734 "WHERE filename = '" . addslashes($sFileName) . "' " .
722 735 "AND folder_id = $iFolderID " .
723 736 "AND status_id = " . LIVE;
... ... @@ -738,7 +751,7 @@ class Document {
738 751 global $default, $lang_err_database, $lang_err_doc_not_exist;
739 752 $sql = $default->db;
740 753  
741   - if ($sql->query("SELECT name FROM " . $default->owl_documents_table . " WHERE id = $iDocumentID")) {
  754 + if ($sql->query("SELECT name FROM " . $default->documents_table . " WHERE id = $iDocumentID")) {
742 755 if ($sql->next_record()) {
743 756 return $sql->f("name");
744 757 } else {
... ... @@ -772,8 +785,8 @@ class Document {
772 785 global $default;
773 786 $sql = $default->db;
774 787 $sql->query("SELECT * " .
775   - "FROM $default->owl_folder_doctypes_table AS FDL " .
776   - "INNER JOIN $default->owl_documents_table AS D ON D.document_type_id = FDL.document_type_id " .
  788 + "FROM $default->folder_doctypes_table AS FDL " .
  789 + "INNER JOIN $default->documents_table AS D ON D.document_type_id = FDL.document_type_id " .
777 790 "WHERE FDL.id = $iFolderDocTypeID " .
778 791 "AND D.folder_id = $iFolderID");
779 792 if ($sql->next_record()) {
... ... @@ -788,8 +801,8 @@ class Document {
788 801 */
789 802 function removeInvalidDocumentTypeEntries() {
790 803 global $default;
791   - $sQuery = "SELECT field_id FROM $default->owl_document_type_fields_table DTFL " .
792   - "INNER JOIN $default->owl_fields_table AS DF ON DF.id = DTFL.field_id " .
  804 + $sQuery = "SELECT field_id FROM $default->document_type_fields_table DTFL " .
  805 + "INNER JOIN $default->document_fields_table AS DF ON DF.id = DTFL.field_id " .
793 806 "WHERE DTFL.document_type_id = $this->iDocumentTypeID " .
794 807 "AND DF.is_generic = 0";
795 808 $sql = $default->db;
... ... @@ -801,7 +814,7 @@ class Document {
801 814 }
802 815 if (count($aFieldIDs) > 0) {
803 816 //delete the entries
804   - $sQuery = "DELETE FROM $default->owl_document_fields_table WHERE document_id = $this->iId AND document_field_id IN (" . implode(",",$aFieldIDs) . ")";
  817 + $sQuery = "DELETE FROM $default->document_fields_link_table WHERE document_id = $this->iId AND document_field_id IN (" . implode(",",$aFieldIDs) . ")";
805 818 if ($sql->query($sQuery)) {
806 819 return true;
807 820 }
... ... @@ -821,7 +834,7 @@ class Document {
821 834 function hasCollaboration() {
822 835 global $default;
823 836 $sql = $default->db;
824   - $sql->query("SELECT id AS count from $default->owl_groups_folders_approval_table WHERE folder_id = $this->iFolderID");
  837 + $sql->query("SELECT id AS count from $default->groups_folders_approval_table WHERE folder_id = $this->iFolderID");
825 838 if ($sql->next_record()) {
826 839 return true;
827 840 }
... ... @@ -834,9 +847,9 @@ class Document {
834 847 function cleanupDocumentData($iDocumentID) {
835 848 global $default;
836 849 $sql = $default->db;
837   - $result = $sql->query("DELETE FROM $default->owl_document_text_table WHERE document_id = $iDocumentID") &&
  850 + $result = $sql->query("DELETE FROM $default->document_text_table WHERE document_id = $iDocumentID") &&
838 851 $sql->query("DELETE FROM $default->search_permissions_table WHERE document_id = $iDocumentID") &&
839   - $sql->query("DELETE FROM $default->owl_document_fields_table WHERE document_id = $iDocumentID");
  852 + $sql->query("DELETE FROM $default->document_fields_link_table WHERE document_id = $iDocumentID");
840 853 return $result;
841 854 }
842 855 }
... ...
lib/documentmanagement/DocumentCollaboration.inc
1 1 <?php
2   -/**
  2 +/**
  3 + * $Id$
3 4 *
4   - * Static functions dealing with the document approval process
  5 + * Static functions dealing with the document approval process.
  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.
5 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$
6 24 * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
7 25 * @package lib.documentmanagement
8 26 */
9   -
10 27 class DocumentCollaboration {
11 28  
12 29 /**
... ... @@ -17,7 +34,7 @@ class DocumentCollaboration {
17 34 function documentCollaborationStarted($iDocumentID) {
18 35 global $default;
19 36 $sql = $default->db;
20   - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND (active = 1 OR done = 1)");
  37 + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND (active = 1 OR done = 1)");
21 38 if ($sql->next_record()) {
22 39 return true;
23 40 }
... ... @@ -27,7 +44,7 @@ class DocumentCollaboration {
27 44 function documentCollaborationDone($iDocumentID) {
28 45 global $default;
29 46 $sql = $default->db;
30   - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0");
  47 + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0");
31 48 if ($sql->num_rows() > 0) {
32 49 return false;
33 50 } else {
... ... @@ -43,7 +60,7 @@ class DocumentCollaboration {
43 60 function userIsPerformingCurrentCollaborationStep($iDocumentID) {
44 61 global $default;
45 62 $sql = $default->db;
46   - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND active = 1 AND user_id = " . $_SESSION["userID"]);
  63 + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND active = 1 AND user_id = " . $_SESSION["userID"]);
47 64 if ($sql->next_record()) {
48 65 return true;
49 66 }
... ... @@ -59,7 +76,7 @@ class DocumentCollaboration {
59 76 function resetDocumentCollaborationSteps($iDocumentID) {
60 77 global $default;
61 78 $sql = $default->db;
62   - if ($sql->query("UPDATE $default->owl_folders_user_roles_table SET active = 0, done = 0 WHERE document_id = $iDocumentID")) {
  79 + if ($sql->query("UPDATE $default->folders_user_roles_table SET active = 0, done = 0 WHERE document_id = $iDocumentID")) {
63 80 return true;
64 81 }
65 82 return false;
... ... @@ -73,7 +90,7 @@ class DocumentCollaboration {
73 90 function isLastStepInCollaborationProcess($iDocumentID) {
74 91 global $default;
75 92 $sql = $default->db;
76   - $sQuery = "SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0";
  93 + $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0";
77 94 $sql->query($sQuery);
78 95 $default->log->info("lastCollabStep:$sQuery");
79 96 if ($sql->num_rows() > 1) {
... ... @@ -91,8 +108,8 @@ class DocumentCollaboration {
91 108 global $default;
92 109 $sql = $default->db;
93 110 // returns all users, the sequence of their collaboration and the time of completion
94   - $sQuery = "SELECT FURL.user_id, FURL.datetime, GFAL.precedence FROM $default->owl_folders_user_roles_table FURL " .
95   - "INNER JOIN $default->owl_groups_folders_approval_table GFAL ON FURL.group_folder_approval_id = GFAL.id " .
  111 + $sQuery = "SELECT FURL.user_id, FURL.datetime, GFAL.precedence FROM $default->folders_user_roles_table FURL " .
  112 + "INNER JOIN $default->groups_folders_approval_table GFAL ON FURL.group_folder_approval_id = GFAL.id " .
96 113 "WHERE FURL.document_id = $iDocumentID " .
97 114 "ORDER BY GFAL.precedence";
98 115 $sql->query($sQuery);
... ... @@ -124,8 +141,8 @@ class DocumentCollaboration {
124 141 //if the user is assigned to two or more roles, make sure we get the current
125 142 //one by ordering by precedence
126 143 $sql->query("SELECT FURL.id AS id, GFAT.precedence " .
127   - "FROM $default->owl_groups_folders_approval_table AS GFAT " .
128   - "INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
  144 + "FROM $default->groups_folders_approval_table AS GFAT " .
  145 + "INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
129 146 "WHERE document_id = $iDocumentID AND FURL.user_id = " . $_SESSION["userID"] . " AND done=0 " .
130 147 "ORDER BY precedence ASC");
131 148 if ($sql->next_record()) {
... ... @@ -138,16 +155,16 @@ class DocumentCollaboration {
138 155 //get it's sequence number
139 156 $iCurrentSequenceNumber = $sql->f("precedence");
140 157 $sql->query("SELECT MIN(precedence) AS precedence " .
141   - "FROM $default->owl_groups_folders_approval_table AS GFAT " .
142   - "INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
  158 + "FROM $default->groups_folders_approval_table AS GFAT " .
  159 + "INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
143 160 "WHERE document_id = $iDocumentID AND done = 0");
144 161 if ($sql->next_record()) {
145 162 if ($sql->f("precedence") != $iCurrentSequenceNumber) {
146 163 //if there are no concurrent steps outstanding
147 164 $iNextSequenceNumber = $sql->f("precedence");
148 165 $sql->query("SELECT FURL.id " .
149   - "FROM $default->owl_groups_folders_approval_table AS GFAT " .
150   - "INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
  166 + "FROM $default->groups_folders_approval_table AS GFAT " .
  167 + "INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " .
151 168 "WHERE document_id = $iDocumentID AND precedence = $iNextSequenceNumber");
152 169 while ($sql->next_record()) {
153 170 $oFolderUserRole = FolderUserRole::get($sql->f("id"));
... ... @@ -187,7 +204,7 @@ class DocumentCollaboration {
187 204 global $default;
188 205 //only create the documents if they haven't been created
189 206 if ($oFolderUserRole->getDependantDocumentsCreated() == false) {
190   - $sQuery = "SELECT * FROM $default->owl_dependant_document_template_table WHERE group_folder_approval_link_id = " . $oFolderUserRole->getGroupFolderApprovalID();
  207 + $sQuery = "SELECT * FROM $default->dependant_document_template_table WHERE group_folder_approval_link_id = " . $oFolderUserRole->getGroupFolderApprovalID();
191 208 $sql = $default->db;
192 209 $sql->query($sQuery);
193 210 while ($sql->next_record()) {
... ... @@ -231,8 +248,8 @@ class DocumentCollaboration {
231 248 global $default;
232 249 //get the current sequence number
233 250 $sQuery = "SELECT GFAT.precedence, GFAT.folder_id, FURL.id AS furl_id, FURL.document_id AS document_id " .
234   - "FROM $default->owl_folders_user_roles_table AS FURL " .
235   - "INNER JOIN $default->owl_groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " .
  251 + "FROM $default->folders_user_roles_table AS FURL " .
  252 + "INNER JOIN $default->groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " .
236 253 "WHERE FURL.document_id = $iDocumentID " .
237 254 "AND FURL.user_id = " . $_SESSION["userID"] . " " .
238 255 "AND FURL.active = 1 " .
... ... @@ -251,8 +268,8 @@ class DocumentCollaboration {
251 268 //if there are concurrent collaboration steps and one is rejected, then all
252 269 //must be rolled back, whether they were accepted or not
253 270 $sQuery = "SELECT FURL.id, FURL.user_id " .
254   - "FROM $default->owl_folders_user_roles_table AS FURL " .
255   - "INNER JOIN $default->owl_groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " .
  271 + "FROM $default->folders_user_roles_table AS FURL " .
  272 + "INNER JOIN $default->groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " .
256 273 "WHERE FURL.document_id = $iDocumentID AND GFAT.precedence = $iCurrentSequenceNumber";
257 274 $sql->query($sQuery);
258 275  
... ... @@ -287,7 +304,7 @@ class DocumentCollaboration {
287 304  
288 305 //get the previous sequence number
289 306 $sQuery = "SELECT COALESCE(MAX(precedence), -1) AS precedence " .
290   - "FROM $default->owl_groups_folders_approval_table AS GFAT " .
  307 + "FROM $default->groups_folders_approval_table AS GFAT " .
291 308 "WHERE precedence < $iCurrentSequenceNumber";
292 309 "AND folder_id = $iFolderID";
293 310 $sql->query($sQuery);
... ... @@ -312,7 +329,7 @@ class DocumentCollaboration {
312 329 } else {
313 330 //there are steps prior to this step
314 331 $sQuery = "SELECT FURL.id AS furl_id " .
315   - "FROM $default->owl_folders_user_roles_table AS FURL INNER JOIN $default->owl_groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " .
  332 + "FROM $default->folders_user_roles_table AS FURL INNER JOIN $default->groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " .
316 333 "WHERE FURL.document_id = $iDocumentID " .
317 334 "AND GFAT.precedence = " . $sql->f("precedence");
318 335  
... ... @@ -354,7 +371,7 @@ class DocumentCollaboration {
354 371 */
355 372 function documentIsPendingWebPublishing($iDocumentID) {
356 373 global $default;
357   - $sQuery = "SELECT id FROM $default->owl_web_documents_table WHERE document_id = $iDocumentID AND status_id = 1";
  374 + $sQuery = "SELECT id FROM $default->web_documents_table WHERE document_id = $iDocumentID AND status_id = 1";
358 375 $sql = $default->db;
359 376 $sql->query($sQuery);
360 377 if ($sql->next_record()) {
... ... @@ -368,7 +385,7 @@ class DocumentCollaboration {
368 385 */
369 386 function documentIsPublished($iDocumentID) {
370 387 global $default;
371   - $sQuery = "SELECT id FROM $default->owl_web_documents_table WHERE document_id = $iDocumentID AND status_id = 2";
  388 + $sQuery = "SELECT id FROM $default->web_documents_table WHERE document_id = $iDocumentID AND status_id = 2";
372 389 $sql = $default->db;
373 390 $sql->query($sQuery);
374 391 if ($sql->next_record()) {
... ... @@ -386,8 +403,8 @@ class DocumentCollaboration {
386 403 function notifyWebMaster($iDocumentID, $sComment) {
387 404 global $default;
388 405 $sQuery = "SELECT WS.web_master_id, WS.web_site_name, WS.web_site_url " .
389   - "FROM $default->owl_web_sites_table AS WS " .
390   - "INNER JOIN $default->owl_web_documents_table AS WD ON WS.id = WD.web_site_id " .
  406 + "FROM $default->web_sites_table AS WS " .
  407 + "INNER JOIN $default->web_documents_table AS WD ON WS.id = WD.web_site_id " .
391 408 "WHERE WD.document_id = $iDocumentID";
392 409  
393 410 $sql = $default->db;
... ...
lib/documentmanagement/DocumentField.inc
1 1 <?php
2 2 require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc");
3 3 /**
  4 + * $Id$
4 5 *
5   - * Class DocumentField
  6 + * Represents a document field as per the database document_fields table.
6 7 *
7   - * Represents a document field as per the database document_fields table
  8 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
8 9 *
  10 + * This program is free software; you can redistribute it and/or modify
  11 + * it under the terms of the GNU General Public License as published by
  12 + * the Free Software Foundation; either version 2 of the License, or
  13 + * (at your option) any later version.
  14 + *
  15 + * This program is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program; if not, write to the Free Software
  22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23 + *
  24 + * @version $Revision$
9 25 * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
10   - * @date 19 January 2003
11   - * @package lib.documentmanagement
12   - */
  26 + * @package lib.documentmanagement
  27 + */
13 28 class DocumentField {
14 29  
15 30 /** primary key value */
... ... @@ -146,7 +161,7 @@ class DocumentField {
146 161 //if the object hasn't been created
147 162 if ($this->iId < 0) {
148 163 $sql = $default->db;
149   - $result = $sql->query("INSERT INTO " . $default->owl_fields_table . " (name, data_type,is_generic,has_lookup) VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDataType) . "', '" . $this->bIsGeneric . "', '" . $this->bHasLookup ."')");
  164 + $result = $sql->query("INSERT INTO " . $default->document_fields_table . " (name, data_type,is_generic,has_lookup) VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDataType) . "', '" . $this->bIsGeneric . "', '" . $this->bHasLookup ."')");
150 165 if ($result) {
151 166 $this->iId = $sql->insert_id();
152 167 return true;
... ... @@ -169,7 +184,7 @@ class DocumentField {
169 184 //only update if the object has been stored
170 185 if ($this->iId > 0) {
171 186 $sql = $default->db;
172   - $result = $sql->query("UPDATE " . $default->owl_fields_table . " SET name = '" . addslashes($this->sName) . "', data_type = '" . addslashes($this->sDataType) . "', is_generic = '" . $this->bIsGeneric . "', has_lookup = '" . $this->bHasLookup . "' WHERE id = $this->iId");
  187 + $result = $sql->query("UPDATE " . $default->document_fields_table . " SET name = '" . addslashes($this->sName) . "', data_type = '" . addslashes($this->sDataType) . "', is_generic = '" . $this->bIsGeneric . "', has_lookup = '" . $this->bHasLookup . "' WHERE id = $this->iId");
173 188 if ($result) {
174 189 return true;
175 190 }
... ... @@ -191,7 +206,7 @@ class DocumentField {
191 206 //only delete the object if it exists in the database
192 207 if ($this->iId >= 0) {
193 208 $sql = $default->db;
194   - $result = $sql->query("DELETE FROM $default->owl_fields_table WHERE id = $this->iId");
  209 + $result = $sql->query("DELETE FROM $default->document_fields_table WHERE id = $this->iId");
195 210 if ($result) {
196 211 return true;
197 212 }
... ... @@ -213,14 +228,14 @@ class DocumentField {
213 228 function & get($iDocumentFieldsID) {
214 229 global $default;
215 230 $sql = $default->db;
216   - $result = $sql->query("SELECT * FROM $default->owl_fields_table WHERE id = $iDocumentFieldsID");
  231 + $result = $sql->query("SELECT * FROM $default->document_fields_table WHERE id = $iDocumentFieldsID");
217 232 if ($result) {
218 233 if ($sql->next_record()) {
219 234 $oDocumentField = & new DocumentField(stripslashes($sql->f("name")), stripslashes($sql->f("data_type")), $sql->f("is_generic"), $sql->f("has_lookup"));
220 235 $oDocumentField->iId = $sql->f("id");
221 236 return $oDocumentField;
222 237 }
223   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->owl_fields_table";
  238 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_table";
224 239 return false;
225 240 }
226 241 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -238,7 +253,7 @@ class DocumentField {
238 253 global $default;
239 254 $aDocumentFieldArray = array();
240 255 $sql = $default->db;
241   - $sQuery = "SELECT id FROM " . $default->owl_fields_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : "");
  256 + $sQuery = "SELECT id FROM " . $default->document_fields_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : "");
242 257 $result = $sql->query($sQuery);
243 258 if ($result) {
244 259 while ($sql->next_record()) {
... ... @@ -256,7 +271,7 @@ class DocumentField {
256 271 global $default;
257 272 $aDocumentTypes = array();
258 273 $sql = $default->db;
259   - $query = "SELECT document_type_id FROM " . $default->owl_document_type_fields_table . " WHERE field_id = $this->iId";
  274 + $query = "SELECT document_type_id FROM " . $default->document_type_fields_table . " WHERE field_id = $this->iId";
260 275 if ($sql->query($query)) {
261 276 while ($sql->next_record()) {
262 277 $aDocumentTypes[] = & DocumentType::get($sql->f("document_type_id"));
... ... @@ -275,7 +290,7 @@ class DocumentField {
275 290 function isFieldLinkedToType() {
276 291 global $default;
277 292 $sql = $default->db;
278   - $query = "SELECT document_type_id FROM " . $default->owl_document_type_fields_table . " WHERE field_id = $this->iId";
  293 + $query = "SELECT document_type_id FROM " . $default->document_type_fields_table . " WHERE field_id = $this->iId";
279 294 if ($sql->query($query)) {
280 295 $rows = $sql->num_rows($sql);
281 296 if ($rows > 0) {
... ... @@ -299,7 +314,7 @@ class DocumentField {
299 314 $aDataTypes;
300 315 settype($aDataTypes, "array");
301 316 $sql = $default->db;
302   - $result = $sql->query("SELECT id, name FROM " . $default->owl_data_types_table );
  317 + $result = $sql->query("SELECT id, name FROM " . $default->data_types_table );
303 318 if ($result) {
304 319 $iCount = 0;
305 320 while ($sql->next_record()) {
... ... @@ -318,7 +333,7 @@ class DocumentField {
318 333 global $default;
319 334  
320 335 $sql = $default->db;
321   - $result = $sql->query("SELECT COUNT(*) AS count FROM " . $default->owl_metadata_table . " WHERE document_field_id = " . $iDocumentFieldID);
  336 + $result = $sql->query("SELECT COUNT(*) AS count FROM " . $default->metadata_table . " WHERE document_field_id = " . $iDocumentFieldID);
322 337 if ($result) {
323 338 if ($sql->next_record()) {
324 339 return $sql->f("count");
... ...
lib/documentmanagement/DocumentFieldLink.inc
1 1 <?php
2   -
3 2 /**
4   -*
5   -* Class DocumentFieldLink
6   -*
7   -* Represents a document field link as per the database table document_fields_link
8   -*
9   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
10   -* @date 19 January 2003
11   -* @package lib.documentmanagement
12   -*/
13   -
  3 + * $Id$
  4 + *
  5 + * Represents a document field link as per the database table document_fields_link.
  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 Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.documentmanagement
  26 + */
14 27 class DocumentFieldLink {
15 28  
16 29 /** document field link primary key */
... ... @@ -119,7 +132,7 @@ class DocumentFieldLink {
119 132 //if the id >= 0, then the object has already been created
120 133 if ($this->iId < 0) {
121 134 $sql = $default->db;
122   - $result = $sql->query("INSERT INTO " . $default->owl_document_fields_table . " (document_id, document_field_id, value) " .
  135 + $result = $sql->query("INSERT INTO " . $default->document_fields_link_table . " (document_id, document_field_id, value) " .
123 136 "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '" . addslashes($this->sValue) . "')");
124 137 if ($result) {
125 138 //set the current documents primary key
... ... @@ -129,7 +142,7 @@ class DocumentFieldLink {
129 142 $_SESSION["errorMessage"] = $lang_err_database;
130 143 return false;
131 144 }
132   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_document_fields_table";
  145 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_fields_link_table";
133 146 return false;
134 147  
135 148 }
... ... @@ -143,7 +156,7 @@ class DocumentFieldLink {
143 156 global $default, $lang_err_database, $lang_err_object_key;
144 157 if ($this->iId >= 0) {
145 158 $sql = $default->db;
146   - $result = $sql->query("UPDATE " . $default->owl_document_fields_table . " SET " .
  159 + $result = $sql->query("UPDATE " . $default->document_fields_link_table . " SET " .
147 160 "document_id = $this->iDocumentID, document_field_id = $this->iDocumentFieldID, value = '" . addslashes($this->sValue) . "'" .
148 161 "WHERE id = $this->iId");
149 162 if ($result) {
... ... @@ -167,7 +180,7 @@ class DocumentFieldLink {
167 180 global $default, $lang_err_database, $lang_err_object_key;
168 181 if ($this->iId >= 0) {
169 182 $sql = $default->db;
170   - $result = $sql->query("DELETE FROM " . $default->owl_document_fields_table . " WHERE id = $this->iId");
  183 + $result = $sql->query("DELETE FROM " . $default->document_fields_link_table . " WHERE id = $this->iId");
171 184 if ($result) {
172 185 $this->iId = -1;
173 186 return true;
... ... @@ -191,13 +204,13 @@ class DocumentFieldLink {
191 204 function & get($iDocumentFieldLinkID) {
192 205 global $default, $lang_err_doc_not_exist;
193 206 $sql = $default->db;
194   - $sql->query("SELECT * FROM " . $default->owl_document_fields_table . " WHERE id = " . $iDocumentFieldLinkID);
  207 + $sql->query("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = " . $iDocumentFieldLinkID);
195 208 if ($sql->next_record()) {
196 209 $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value"));
197 210 $oDocumentFieldLink->iId = $iDocumentFieldLinkID;
198 211 return $oDocumentFieldLink;
199 212 }
200   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->owl_document_fields_table";
  213 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_link_table";
201 214 return false;
202 215 }
203 216 }
... ...
lib/documentmanagement/DocumentLink.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class DocumentLink
5   -*
6   -* Represents a document link as per the database document_link table
7   -* Links a child document to a parent document. Direction of relationship
8   -* is defined through document collaboration
9   -*
10   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
11   -* @date 14 May 2003
12   -* @package lib.documentmanagement
13   -*/
14   -
15   -
  3 + * $Id$
  4 + *
  5 + * Represents a document link as per the database document_link table.
  6 + * Links a child document to a parent document. Direction of relationship
  7 + * is defined through document collaboration.
  8 + *
  9 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify
  12 + * it under the terms of the GNU General Public License as published by
  13 + * the Free Software Foundation; either version 2 of the License, or
  14 + * (at your option) any later version.
  15 + *
  16 + * This program is distributed in the hope that it will be useful,
  17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19 + * GNU General Public License for more details.
  20 + *
  21 + * You should have received a copy of the GNU General Public License
  22 + * along with this program; if not, write to the Free Software
  23 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  24 + *
  25 + * @version $Revision$
  26 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  27 + * @package lib.documentmanagement
  28 + */
16 29 class DocumentLink {
17 30  
18 31 /** primary key value */
... ... @@ -141,7 +154,7 @@ class DocumentLink {
141 154 //only delete the object if it exists in the database
142 155 if ($this -> iId >= 0) {
143 156 $sql = $default -> db;
144   - $result = $sql -> query("DELETE FROM $default->owl_document_link_table WHERE id = $this->iId");
  157 + $result = $sql -> query("DELETE FROM $default->document_link_table WHERE id = $this->iId");
145 158 if ($result) {
146 159 return true;
147 160 }
... ... @@ -163,14 +176,14 @@ class DocumentLink {
163 176 function & get($iDocumentLinkID) {
164 177 global $default;
165 178 $sql = $default -> db;
166   - $result = $sql -> query("SELECT * FROM $default->owl_document_link_table WHERE id = $iDocumentLinkID");
  179 + $result = $sql -> query("SELECT * FROM $default->document_link_table WHERE id = $iDocumentLinkID");
167 180 if ($result) {
168 181 if ($sql -> next_record()) {
169 182 $oDocumentLink = & new DocumentLink($sql -> f("parent_document_id"), $sql -> f("parent_document_id"));
170 183 $oDocumentLink -> iId = $sql -> f("id");
171 184 return $oDocumentLink;
172 185 }
173   - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDocumentLinkID." table = $default->owl_document_link_table";
  186 + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDocumentLinkID." table = $default->document_link_table";
174 187 return false;
175 188 }
176 189 $_SESSION["errorMessage"] = $lang_err_database;
... ...
lib/documentmanagement/DocumentTransaction.inc
... ... @@ -14,21 +14,33 @@ DEFINE(&quot;EXPUNGE&quot;, 11);
14 14 DEFINE("FORCE_CHECKIN", 12);
15 15 DEFINE("EMAIL_LINK", 13);
16 16 DEFINE("COLLAB_ACCEPT", 14);
17   -
18 17 /**
19   -*
20   -* Class DocumentTransaction
21   -*
22   -* Represents a document transaction as per the database table document_transaction
23   -*
24   -* No delete or update functions are provided. Once a transaction has been stored
25   -* in the database it may not be changed.
26   -*
27   -* @author Rob Cherry, Jam Warehouse(Pty) Ltd, South Africa
28   -* @date 18 January 2003
29   -* @package lib.documentmanagement
30   -*/
31   -
  18 + * $Id$
  19 + *
  20 + * Represents a document transaction as per the database table document_transaction.
  21 + * No delete or update functions are provided. Once a transaction has been stored
  22 + * in the database it may not be changed.
  23 + *
  24 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  25 + *
  26 + * This program is free software; you can redistribute it and/or modify
  27 + * it under the terms of the GNU General Public License as published by
  28 + * the Free Software Foundation; either version 2 of the License, or
  29 + * (at your option) any later version.
  30 + *
  31 + * This program is distributed in the hope that it will be useful,
  32 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  33 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34 + * GNU General Public License for more details.
  35 + *
  36 + * You should have received a copy of the GNU General Public License
  37 + * along with this program; if not, write to the Free Software
  38 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  39 + *
  40 + * @version $Revision$
  41 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  42 + * @package lib.documentmanagement
  43 + */
32 44 class DocumentTransaction {
33 45  
34 46 /** primary key of document transaction */
... ... @@ -92,7 +104,7 @@ class DocumentTransaction {
92 104 //if the object hasn't been stored yet
93 105 if ($this->iId < 0) {
94 106 $sql = $default->db;
95   - $result = $sql->query("INSERT INTO " . $default->owl_document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " .
  107 + $result = $sql->query("INSERT INTO " . $default->document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " .
96 108 "VALUES ($this->iDocumentID, '" . addslashes($this->sVersion) . "', $this->iUserID, '" . addslashes($this->dDateTime) . "', '" . addslashes($this->sIP) . "', '" . addslashes($this->sFileName) . "', '" . addslashes($this->sComment) . "', $this->iTransactionID)");
97 109 if ($result) {
98 110 //object has been stored, set the primary key
... ... @@ -113,9 +125,7 @@ class DocumentTransaction {
113 125 global $default, $lang_err_database, $lang_err_object_key;
114 126 if ($this->iId >= 0) {
115 127 $sql = $default->db;
116   - // TODO: insert into sys_deleted
117   - //$result = $sql->query("INSERT INTO " . $default->owl_sys_deleted_table . " () VALUES ()");
118   - $result = $sql->query("DELETE FROM " . $default->owl_document_transactions_table . " WHERE id = " . $this->iId);
  128 + $result = $sql->query("DELETE FROM " . $default->document_transactions_table . " WHERE id = " . $this->iId);
119 129 if ($result) {
120 130 $this->iId = -1;
121 131 return true;
... ... @@ -138,7 +148,7 @@ class DocumentTransaction {
138 148 global $default, $lang_err_doc_not_exist;
139 149 if (strlen($iDocumentTransactionID) > 0) {
140 150 $sql = $default->db;
141   - $sql->query("SELECT * FROM $default->owl_document_transactions_table WHERE id = $iDocumentTransactionID");
  151 + $sql->query("SELECT * FROM $default->document_transactions_table WHERE id = $iDocumentTransactionID");
142 152 if ($sql->next_record()) {
143 153 $oDocumentTransaction = & new DocumentTransaction($sql->f("document_id"), stripslashes($sql->f("comment")), $sql->f("transaction_id"));
144 154 $oDocumentTransaction->iId = $sql->f("id");
... ... @@ -169,7 +179,7 @@ class DocumentTransaction {
169 179 global $default, $lang_err_database;
170 180 $aDocumentTransactionArray = array();
171 181 $sql = $default->db;
172   - $sQuery = "SELECT * FROM $default->owl_document_transactions_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "");
  182 + $sQuery = "SELECT * FROM $default->document_transactions_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "");
173 183 $result = $sql->query($sQuery);
174 184 if ($result) {
175 185 while ($sql->next_record()) {
... ...
lib/documentmanagement/DocumentType.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class DocumentType
5   -*
6   -* Represents a document type as per the database document_types_lookup table
7   -*
8   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
9   -* @date 19 January 2003
10   -* @package lib.documentmanagement
11   -*/
12   -
  3 + * $Id$
  4 + *
  5 + * Represents a document type as per the database document_types_lookup table.
  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 Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.documentmanagement
  26 + */
13 27 class DocumentType {
14 28  
15 29 /** primary key value */
... ... @@ -73,7 +87,7 @@ class DocumentType {
73 87 if ($this->iId < 0) {
74 88 //check to see if name exsits
75 89 $sql = $default->db;
76   - $query = "SELECT name FROM ". $default->owl_document_types_table ." WHERE name = '" . $this->sName . "'";
  90 + $query = "SELECT name FROM ". $default->document_types_table ." WHERE name = '" . $this->sName . "'";
77 91 $sql->query($query);
78 92 $rows = $sql->num_rows($sql);
79 93  
... ... @@ -84,7 +98,7 @@ class DocumentType {
84 98  
85 99 }else{
86 100 $sql = $default->db;
87   - $result = $sql->query("INSERT INTO " . $default->owl_document_types_table . " (name) VALUES ('" . addslashes($this->sName) . "')");
  101 + $result = $sql->query("INSERT INTO " . $default->document_types_table . " (name) VALUES ('" . addslashes($this->sName) . "')");
88 102 if ($result) {
89 103 $this->iId = $sql->insert_id();
90 104 return true;
... ... @@ -109,7 +123,7 @@ class DocumentType {
109 123 //only update if the object has been stored
110 124 if ($this->iId > 0) {
111 125 $sql = $default->db;
112   - $result = $sql->query("UPDATE " . $default->owl_document_types_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
  126 + $result = $sql->query("UPDATE " . $default->document_types_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
113 127 if ($result) {
114 128 return true;
115 129 }
... ... @@ -132,7 +146,7 @@ class DocumentType {
132 146 if ($this->iId > 0) {
133 147 //check to see if name exsits
134 148 $sql = $default->db;
135   - $query = "SELECT folder_id FROM ". $default->owl_folder_doctypes_table ." WHERE document_type_id = '" . $this->iId . "'";
  149 + $query = "SELECT folder_id FROM ". $default->folder_doctypes_table ." WHERE document_type_id = '" . $this->iId . "'";
136 150 $sql->query($query);
137 151 $rows = $sql->num_rows($sql);
138 152  
... ... @@ -143,7 +157,7 @@ class DocumentType {
143 157  
144 158 }else{
145 159 $sql = $default->db;
146   - $result = $sql->query("DELETE FROM " . $default->owl_document_types_table . " WHERE id = '" . $this->iId . "'");
  160 + $result = $sql->query("DELETE FROM " . $default->document_types_table . " WHERE id = '" . $this->iId . "'");
147 161 if ($result) {
148 162 return true;
149 163 }
... ... @@ -165,7 +179,7 @@ class DocumentType {
165 179 global $default, $lang_err_database, $lang_err_object_key;
166 180 if ($this->iId >= 0) {
167 181 $sql = $default->db;
168   - $result = $sql->query("DELETE FROM " . $default->owl_document_type_fields_table . " WHERE document_type_id = $this->iId");
  182 + $result = $sql->query("DELETE FROM " . $default->document_type_fields_table . " WHERE document_type_id = $this->iId");
169 183 if ($result) {
170 184 $this->iId = -1;
171 185 return true;
... ... @@ -187,7 +201,7 @@ class DocumentType {
187 201 function & get($iDocumentTypeID) {
188 202 global $default;
189 203 $sql = $default->db;
190   - $result = $sql->query("SELECT * FROM ". $default->owl_document_types_table ." WHERE id = $iDocumentTypeID");
  204 + $result = $sql->query("SELECT * FROM ". $default->document_types_table ." WHERE id = $iDocumentTypeID");
191 205 if ($result) {
192 206 if ($sql->next_record()) {
193 207 $oDocumentType = & new DocumentType(stripslashes($sql->f("name")));
... ... @@ -212,7 +226,7 @@ class DocumentType {
212 226 global $default, $lang_err_database;
213 227 $aDocumentTypeArray = array();
214 228 $sql = $default->db;
215   - $result = $sql->query("SELECT * FROM " . $default->owl_document_types_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : ""));
  229 + $result = $sql->query("SELECT * FROM " . $default->document_types_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : ""));
216 230 if ($result) {
217 231 while ($sql->next_record()) {
218 232 $aDocumentTypeArray[] = & DocumentType::get($sql->f("id"));
... ...
lib/documentmanagement/DocumentTypeFieldLink.inc
1 1 <?php
2 2 require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc");
3   -
4 3 /**
5   - *
6   - * Class DocumentTypeFieldLink
  4 + * $Id$
7 5 *
8 6 * Represents a document type field link as per the database table document_types_fields_link
9 7 *
  8 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  9 + *
  10 + * This program is free software; you can redistribute it and/or modify
  11 + * it under the terms of the GNU General Public License as published by
  12 + * the Free Software Foundation; either version 2 of the License, or
  13 + * (at your option) any later version.
  14 + *
  15 + * This program is distributed in the hope that it will be useful,
  16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18 + * GNU General Public License for more details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program; if not, write to the Free Software
  22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23 + *
  24 + * @version $Revision$
10 25 * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
11   - * @date 19 January 2003
12   - * @package lib.documentmanagement
13   - */
  26 + * @package lib.documentmanagement
  27 + */
14 28 class DocumentTypeFieldLink {
15 29  
16 30 /** document field link primary key */
... ... @@ -120,7 +134,7 @@ class DocumentTypeFieldLink {
120 134 if ($this->iId < 0) {
121 135 //check to see if name exsits
122 136 $sql = $default->db;
123   - $query = "SELECT id FROM ". $default->owl_document_type_fields_table ." WHERE document_type_id = '" . $this->iDocumentTypeID . "' and field_id = '". $this->iFieldID . "'";
  137 + $query = "SELECT id FROM ". $default->document_type_fields_table ." WHERE document_type_id = '" . $this->iDocumentTypeID . "' and field_id = '". $this->iFieldID . "'";
124 138 $sql->query($query);
125 139 $rows = $sql->num_rows($sql);
126 140  
... ... @@ -131,7 +145,7 @@ class DocumentTypeFieldLink {
131 145  
132 146 }else{
133 147 $sql = $default->db;
134   - $result = $sql->query("INSERT INTO " . $default->owl_document_type_fields_table . " (document_type_id, field_id, is_mandatory) " .
  148 + $result = $sql->query("INSERT INTO " . $default->document_type_fields_table . " (document_type_id, field_id, is_mandatory) " .
135 149 "VALUES ($this->iDocumentTypeID, $this->iFieldID, '" . $this->bIsMandatory . "')");
136 150 if ($result) {
137 151 //set the current documents primary key
... ... @@ -142,7 +156,7 @@ class DocumentTypeFieldLink {
142 156 return false;
143 157 }
144 158 }
145   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_document_type_fields_table";
  159 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_type_fields_table";
146 160 return false;
147 161  
148 162 }
... ... @@ -156,7 +170,7 @@ class DocumentTypeFieldLink {
156 170 global $default, $lang_err_database, $lang_err_object_key;
157 171 if ($this->iId >= 0) {
158 172 $sql = $default->db;
159   - $sQuery = "UPDATE " . $default->owl_document_type_fields_table . " SET " .
  173 + $sQuery = "UPDATE " . $default->document_type_fields_table . " SET " .
160 174 "document_type_id = $this->iDocumentTypeID, field_id = $this->iFieldID, is_mandatory = '" . $this->bIsMandatory . "'" .
161 175 "WHERE id = $this->iId";
162 176 $result = $sql->query($sQuery);
... ... @@ -181,7 +195,7 @@ class DocumentTypeFieldLink {
181 195 global $default, $lang_err_database, $lang_err_object_key;
182 196 if ($this->iId >= 0) {
183 197 $sql = $default->db;
184   - $result = $sql->query("DELETE FROM " . $default->owl_document_type_fields_table . " WHERE id = $this->iId");
  198 + $result = $sql->query("DELETE FROM " . $default->document_type_fields_table . " WHERE id = $this->iId");
185 199 if ($result) {
186 200 $this->iId = -1;
187 201 return true;
... ... @@ -205,7 +219,7 @@ class DocumentTypeFieldLink {
205 219 function & get($iDocumentTypeFieldLinkID) {
206 220 global $default;
207 221 $sql = $default->db;
208   - $sql->query("SELECT * FROM " . $default->owl_document_type_fields_table . " WHERE id = " . $iDocumentTypeFieldLinkID);
  222 + $sql->query("SELECT * FROM " . $default->document_type_fields_table . " WHERE id = " . $iDocumentTypeFieldLinkID);
209 223 if ($sql->next_record()) {
210 224 $oDocumentTypeFieldLink = & new DocumentTypeFieldLink($sql->f("document_type_id"), $sql->f("field_id"), $sql->f("is_mandatory"));
211 225 $oDocumentTypeFieldLink->iId = $iDocumentTypeFieldLinkID;
... ... @@ -222,7 +236,7 @@ class DocumentTypeFieldLink {
222 236 */
223 237 function docTypeBelongsToField($iDocTypeID) {
224 238 global $default;
225   - return lookupField("$default->owl_document_type_fields_table", "field_id", "document_type_id", $iDocTypeID );
  239 + return lookupField("$default->document_type_fields_table", "field_id", "document_type_id", $iDocTypeID );
226 240 }
227 241  
228 242 /**
... ... @@ -235,7 +249,7 @@ class DocumentTypeFieldLink {
235 249 function getByFieldAndTypeIDs($iDocTypeID, $iDocFieldID) {
236 250 global $default;
237 251 $sql = $default->db;
238   - $sQuery = "SELECT id FROM $default->owl_document_type_fields_table WHERE field_id = $iDocFieldID AND document_type_id = $iDocTypeID";
  252 + $sQuery = "SELECT id FROM $default->document_type_fields_table WHERE field_id = $iDocFieldID AND document_type_id = $iDocTypeID";
239 253 $result = $sql->query($sQuery);
240 254 if ($result) {
241 255 if ($sql->next_record()) {
... ... @@ -258,7 +272,7 @@ class DocumentTypeFieldLink {
258 272 global $default;
259 273 $aFields = array();
260 274 $sql = $default->db;
261   - $result = $sql->query("SELECT field_id FROM " . $default->owl_document_type_fields_table . " WHERE document_type_id = ". $iDocTypeID);
  275 + $result = $sql->query("SELECT field_id FROM " . $default->document_type_fields_table . " WHERE document_type_id = ". $iDocTypeID);
262 276 if ($result) {
263 277 while ($sql->next_record()) {
264 278 $aFields[] = DocumentField::get($sql->f("field_id"));
... ...
lib/documentmanagement/MetaData.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class DocumentType
5   -*
6   -* Represents a MetaData as per the database document_types_lookup table
7   -*
8   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
9   -* @date 19 January 2003
10   -* @package lib.documentmanagement
11   -*/
12   -
  3 + * $Id$
  4 + *
  5 + * Represents a document field lookups as per the database document_types_lookup table
  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 Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.documentmanagement
  26 + */
13 27 class MetaData {
14 28  
15 29 /** primary key value */
... ... @@ -98,7 +112,7 @@ class MetaData {
98 112 if ($this->iId < 0) {
99 113 //check to see if name exsits
100 114 $sql = $default->db;
101   - $query = "SELECT name FROM ". $default->owl_metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'";
  115 + $query = "SELECT name FROM ". $default->metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'";
102 116 $sql->query($query);
103 117 $rows = $sql->num_rows($sql);
104 118  
... ... @@ -109,7 +123,7 @@ class MetaData {
109 123  
110 124 }else{
111 125 $sql = $default->db;
112   - $result = $sql->query("INSERT INTO " . $default->owl_metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','" . addslashes($this->sName) . "')");
  126 + $result = $sql->query("INSERT INTO " . $default->metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','" . addslashes($this->sName) . "')");
113 127 if ($result) {
114 128 $this->iId = $sql->insert_id();
115 129 return true;
... ... @@ -134,7 +148,7 @@ class MetaData {
134 148 //only update if the object has been stored
135 149 if ($this->iId > 0) {
136 150 $sql = $default->db;
137   - $result = $sql->query("UPDATE " . $default->owl_metadata_table. " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
  151 + $result = $sql->query("UPDATE " . $default->metadata_table. " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
138 152 if ($result) {
139 153 return true;
140 154 }
... ... @@ -156,7 +170,7 @@ class MetaData {
156 170 //only delete the object if it exists in the database
157 171 if ($this->iId >= 0) {
158 172 $sql = $default->db;
159   - $result = $sql->query("DELETE FROM " . $default->owl_metadata_table. " WHERE id = $this->iId");
  173 + $result = $sql->query("DELETE FROM " . $default->metadata_table. " WHERE id = $this->iId");
160 174 if ($result) {
161 175 return true;
162 176 }
... ... @@ -178,7 +192,7 @@ class MetaData {
178 192 function & get($iMetaDataID) {
179 193 global $default;
180 194 $sql = $default->db;
181   - $result = $sql->query("SELECT * FROM ". $default->owl_metadata_table." WHERE id = $iMetaDataID");
  195 + $result = $sql->query("SELECT * FROM ". $default->metadata_table." WHERE id = $iMetaDataID");
182 196 if ($result) {
183 197 if ($sql->next_record()) {
184 198 $oDocumentType = & new MetaData($sql->f("document_field_id"),stripslashes($sql->f("name")));
... ... @@ -209,7 +223,7 @@ class MetaData {
209 223 {
210 224 global $default;
211 225 $sql = $default->db;
212   - $result = $sql->query("SELECT id FROM $default->owl_metadata_table WHERE document_field_id = $iDocFieldID and name = '" . $sMetaDataName . "' ");
  226 + $result = $sql->query("SELECT id FROM $default->metadata_table WHERE document_field_id = $iDocFieldID and name = '" . $sMetaDataName . "' ");
213 227 if ($result) {
214 228 if ($sql->next_record()) {
215 229 $id = $sql->f("id");
... ...
lib/documentmanagement/PhysicalDocumentManager.inc
... ... @@ -11,14 +11,26 @@
11 11 * o $fFolderID - primary key of folder into which file will be placed
12 12 * o When calling deleteDocument:
13 13 *
14   - * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  14 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  15 + *
  16 + * This program is free software; you can redistribute it and/or modify
  17 + * it under the terms of the GNU General Public License as published by
  18 + * the Free Software Foundation; either version 2 of the License, or
  19 + * (at your option) any later version.
  20 + *
  21 + * This program is distributed in the hope that it will be useful,
  22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24 + * GNU General Public License for more details.
  25 + *
  26 + * You should have received a copy of the GNU General Public License
  27 + * along with this program; if not, write to the Free Software
  28 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 29 *
16   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
17 30 * @version $Revision$
18   - * @date 13 January 2003
19   - * @package lib.documentmanagement
  31 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  32 + * @package lib.documentmanagement
20 33 */
21   -
22 34 class PhysicalDocumentManager {
23 35  
24 36 /**
... ... @@ -138,7 +150,7 @@ class PhysicalDocumentManager {
138 150 // FIXME: refactor array getOldVersionPaths($iDocumentID)??
139 151  
140 152 $sql = $default->db;
141   - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
  153 + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
142 154 if ($result) {
143 155 while ($sql->next_record()) {
144 156 $sVersion = $sql->f("version");
... ... @@ -212,7 +224,7 @@ class PhysicalDocumentManager {
212 224 // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions
213 225 // FIXME: refactor
214 226 $sql = $default->db;
215   - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
  227 + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
216 228 if ($result) {
217 229 while ($sql->next_record()) {
218 230 $sVersion = $sql->f("version");
... ... @@ -254,7 +266,7 @@ class PhysicalDocumentManager {
254 266 // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions
255 267 // FIXME: refactor
256 268 $sql = $default->db;
257   - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
  269 + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
258 270 if ($result) {
259 271 while ($sql->next_record()) {
260 272 $sVersion = $sql->f("version");
... ... @@ -309,7 +321,7 @@ class PhysicalDocumentManager {
309 321 // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions
310 322 // FIXME: refactor
311 323 $sql = $default->db;
312   - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
  324 + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT);
313 325 if ($result) {
314 326 while ($sql->next_record()) {
315 327 $sVersion = $sql->f("version");
... ... @@ -392,14 +404,14 @@ class PhysicalDocumentManager {
392 404  
393 405 // check by file extension
394 406 $sExtension = strtolower(substr($sFileName, strpos($sFileName, ".")+1, strlen($sFileName) - strpos($sFileName, ".")));
395   - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE LOWER(filetypes) = '$sExtension'");
  407 + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE LOWER(filetypes) = '$sExtension'");
396 408 if ($sql->next_record()) {
397 409 return $sql->f("id");
398 410 }
399 411  
400 412 //get the mime type
401 413 if (isset($sMimeType)) {
402   - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = '$sMimeType'");
  414 + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE mimetypes = '$sMimeType'");
403 415 if ($sql->next_record()) {
404 416 //get the mime type id
405 417 return $sql->f("id");
... ... @@ -419,7 +431,7 @@ class PhysicalDocumentManager {
419 431 function getDefaultMimeTypeID() {
420 432 global $default;
421 433 $sql = $default->db;
422   - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = 'text/plain'");
  434 + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE mimetypes = 'text/plain'");
423 435 $sql->next_record();
424 436 //get the mime type id
425 437 return $sql->f("id");
... ... @@ -428,7 +440,7 @@ class PhysicalDocumentManager {
428 440 function getMimeTypeName($iMimeTypeID) {
429 441 global $default;
430 442 $sql = $default->db;
431   - $sql->query("SELECT mimetypes FROM " . $default->owl_mime_table . " WHERE id = " . $iMimeTypeID);
  443 + $sql->query("SELECT mimetypes FROM " . $default->mimetypes_table . " WHERE id = " . $iMimeTypeID);
432 444 if ($sql->next_record()) {
433 445 return $sql->f("mimetypes");
434 446 }
... ...
lib/email/Email.inc
... ... @@ -2,11 +2,27 @@
2 2 /**
3 3 * $Id$
4 4 *
5   - * Contains static functions concerned with sending emails
  5 + * Contains static functions concerned with sending emails.
  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
6 22 *
7   - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
8 23 * @version $Revision$
9   - * @package lib.email
  24 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  25 + * @package lib.email
10 26 */
11 27 class Email {
12 28  
... ...