diff --git a/lib/documentmanagement/DependantDocumentInstance.inc b/lib/documentmanagement/DependantDocumentInstance.inc index a25a33a..689a8b2 100644 --- a/lib/documentmanagement/DependantDocumentInstance.inc +++ b/lib/documentmanagement/DependantDocumentInstance.inc @@ -1,17 +1,30 @@ - iId < 0) { $sql = $default -> db; - $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 . ")"); + $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 . ")"); if ($result) { $this -> iId = $sql -> insert_id(); return true; @@ -159,7 +172,7 @@ class DependantDocumentInstance { //only delete the object if it exists in the database if ($this -> iId >= 0) { $sql = $default -> db; - $result = $sql -> query("DELETE FROM $default->owl_dependant_document_instance_table WHERE id = $this->iId"); + $result = $sql -> query("DELETE FROM $default->dependant_document_instance_table WHERE id = $this->iId"); if ($result) { return true; } @@ -181,14 +194,14 @@ class DependantDocumentInstance { function & get($iDependantDocumentID) { global $default; $sql = $default -> db; - $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_instance_table WHERE id = $iDependantDocumentID"); + $result = $sql -> query("SELECT * FROM $default->dependant_document_instance_table WHERE id = $iDependantDocumentID"); if ($result) { if ($sql -> next_record()) { $oDependantDocument = & new DependantDocumentInstance(stripslashes($sql -> f("document_title")), $sql -> f("user_id"), $sql -> f("template_document_id"), $sql->f("parent_document_id")); $oDependantDocument -> iId = $sql -> f("id"); return $oDependantDocument; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_instance_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->dependant_document_instance_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; diff --git a/lib/documentmanagement/DependantDocumentTemplate.inc b/lib/documentmanagement/DependantDocumentTemplate.inc index de6ece1..745668f 100644 --- a/lib/documentmanagement/DependantDocumentTemplate.inc +++ b/lib/documentmanagement/DependantDocumentTemplate.inc @@ -1,17 +1,30 @@ iId < 0) { $sql = $default -> db; - $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)"); + $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)"); if ($result) { $this -> iId = $sql -> insert_id(); return true; @@ -130,7 +143,7 @@ class DependantDocumentTemplate { $_SESSION["errorMessage"] = $lang_err_database; return false; } - $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." Table = $default->owl_dependant_document_template_table"; + $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." Table = $default->dependant_document_template_table"; return false; } @@ -145,7 +158,7 @@ class DependantDocumentTemplate { //only update if the object has been stored if ($this -> iId > 0) { $sql = $default -> db; - $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"); + $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"); if ($result) { return true; } @@ -167,7 +180,7 @@ class DependantDocumentTemplate { //only delete the object if it exists in the database if ($this -> iId >= 0) { $sql = $default -> db; - $result = $sql -> query("DELETE FROM $default->owl_dependant_document_template_table WHERE id = $this->iId"); + $result = $sql -> query("DELETE FROM $default->dependant_document_template_table WHERE id = $this->iId"); if ($result) { return true; } @@ -189,7 +202,7 @@ class DependantDocumentTemplate { function & get($iDependantDocumentID) { global $default; $sql = $default -> db; - $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_template_table WHERE id = $iDependantDocumentID"); + $result = $sql -> query("SELECT * FROM $default->dependant_document_template_table WHERE id = $iDependantDocumentID"); if ($result) { if ($sql -> next_record()) { $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 { }*/ return $DependantDocumentTemplate; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_template_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->dependant_document_template_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -220,7 +233,7 @@ class DependantDocumentTemplate { settype($aDependatDocumentTemplateArray, "array"); $sql = $default->db; // TODO: join on sys_deleted - $result = $sql->query("SELECT * FROM " . $default->owl_dependant_document_template_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->dependant_document_template_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); if ($result) { $iCount = 0; while ($sql->next_record()) { diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index 635bdac..a295dfd 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -1,23 +1,36 @@ fileSystemRoot/lib/foldermanagement/Folder.inc"); - /** * $Id$ * - * Represents a document as per the documents database table + * Represents a document as per the documents database table. + * + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @version $Revision$ * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa * @package lib.documentmanagement * @todo add in document change transaction functionality - */ + */ class Document { /** primary key */ var $iId; @@ -273,7 +286,7 @@ class Document { //if the folder is not the root folder if ($iFolderID != 0) { $sql = $default->db; - $sql->query("SELECT parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID"); + $sql->query("SELECT parent_id FROM $default->folders_table WHERE ID = $iFolderID"); $sql->next_record(); return $this->generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID"; } @@ -291,7 +304,7 @@ class Document { //if the folder is not the root folder if ($iFolderID != 0) { $sql = $default->db; - $sql->query("SELECT name, parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID"); + $sql->query("SELECT name, parent_id FROM $default->folders_table WHERE ID = $iFolderID"); $sql->next_record(); return $this->generateFullFolderPath($sql->f("parent_id")) . "/" . stripslashes($sql->f("name")); } @@ -312,7 +325,7 @@ class Document { $this->sFullPath = substr($sFullPath, 1, strlen($sFullPath)); $sParentFolderIDs = $this->generateParentFolderIDS($this->iFolderID); $this->sParentFolderIDs = substr($sParentFolderIDs, 1, strlen($sParentFolderIDs)); - $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) " . + $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) " . "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)"); if ($result) { //set the current documents primary key @@ -337,9 +350,9 @@ class Document { // group permissions $sGroupPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . "SELECT UGL.user_id AS user_id, D.id AS document_id " . - "FROM $default->owl_documents_table AS D INNER JOIN folders AS F ON D.folder_id = F.id " . - "INNER JOIN $default->owl_groups_folders_table AS GFL ON GFL.folder_id = F.id " . - "INNER JOIN $default->owl_users_groups_table AS UGL ON UGL.group_id = GFL.group_id " . + "FROM $default->documents_table AS D INNER JOIN folders AS F ON D.folder_id = F.id " . + "INNER JOIN $default->groups_folders_table AS GFL ON GFL.folder_id = F.id " . + "INNER JOIN $default->users_groups_table AS UGL ON UGL.group_id = GFL.group_id " . "WHERE D.id=$this->iId"; $default->log->info("addDocument groupPerms=$sGroupPerms"); if ($sql->query($sGroupPerms)) { @@ -350,7 +363,7 @@ class Document { // role permissions $sRolePerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . "SELECT user_id, document_id " . - "FROM $default->owl_folders_user_roles_table " . + "FROM $default->folders_user_roles_table " . "WHERE document_id=$this->iId"; $default->log->info("addDocument rolePerms=$sRolePerms"); if ($sql->query($sRolePerms)) { @@ -362,7 +375,7 @@ class Document { // public folders $sPublicFolderPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . "SELECT U.id, D.id " . - "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 " . + "FROM $default->users_table AS U, $default->documents_table AS D INNER JOIN $default->folders_table AS F ON D.folder_id = F.id " . "WHERE F.is_public = 1 " . "AND D.id=$this->iId"; $default->log->info("addDocument publicFolder=$sPublicFolderPerms"); @@ -375,7 +388,7 @@ class Document { // creator permissions $sCreatorPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . "SELECT creator_id, id " . - "FROM $default->owl_documents_table " . + "FROM $default->documents_table " . "WHERE id=$this->iId"; $default->log->info("addDocument creatorPerms=$sCreatorPerms"); if ($sql->query($sCreatorPerms)) { @@ -394,7 +407,7 @@ class Document { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - $sQuery = "UPDATE " . $default->owl_documents_table . " SET " . + $sQuery = "UPDATE " . $default->documents_table . " SET " . "document_type_id = $this->iDocumentTypeID, " . "name = '" . addslashes($this->sName) . "', " . "filename = '" . addslashes($this->sFileName) . "', " . @@ -441,7 +454,7 @@ class Document { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM " . $default->owl_documents_table . " WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM " . $default->documents_table . " WHERE id = $this->iId"); if ($result) { $this->iId = -1; // clean up for this deleted document @@ -463,7 +476,7 @@ class Document { global $default; //get the steps in this document's collaboration process $sQuery = "SELECT FURL.id, GFAL.precedence " . - "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 " . + "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 " . "WHERE document_id = " . $this->iId . " " . "ORDER BY GFAL.precedence ASC"; $sql = $default->db; @@ -522,7 +535,7 @@ class Document { //if the user is assinged to two or more roles, make sure we get the current //one by ordering by precedence $sql->query("SELECT FURL.id AS id, GFAT.precedence " . - "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 " . + "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 " . "WHERE document_id = $this->iId AND FURL.user_id = " . $_SESSION["userID"] . " " . "AND done = 0 " . "ORDER BY precedence ASC"); @@ -550,7 +563,7 @@ class Document { if (strlen($iDocumentID) > 0) { $sql = $default->db; // TODO: join on sys_deleted - $sql->query("SELECT * FROM $default->owl_documents_table WHERE id = $iDocumentID"); + $sql->query("SELECT * FROM $default->documents_table WHERE id = $iDocumentID"); if ($sql->next_record()) { $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")); $oDocument->setDocumentTypeID($sql->f("document_type_id")); @@ -587,7 +600,7 @@ class Document { $aDocumentArray; settype($aDocumentArray, "array"); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_documents_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->documents_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); if ($result) { $iCount = 0; while ($sql->next_record()) { @@ -642,7 +655,7 @@ class Document { $aDocumentHistory; settype($aDocumentHistory, "array"); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime DESC"); + $result = $sql->query("SELECT * FROM " . $default->document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime DESC"); if ($result) { $iCount = 0; while($sql->next_record()) { @@ -666,7 +679,7 @@ class Document { global $default; if ($this->iMimeTypeID) { // lookup the icon from the table - $sIconPath = lookupField($default->owl_mime_table, "icon_path", "id", $this->iMimeTypeID); + $sIconPath = lookupField($default->mimetypes_table, "icon_path", "id", $this->iMimeTypeID); if (strlen($sIconPath) > 0) { return $default->graphicsUrl . "/" . $sIconPath; } else { @@ -717,7 +730,7 @@ class Document { function documentExists($sFileName, $iFolderID) { global $default; $sql = $default->db; - $sQuery = "SELECT * FROM $default->owl_documents_table " . + $sQuery = "SELECT * FROM $default->documents_table " . "WHERE filename = '" . addslashes($sFileName) . "' " . "AND folder_id = $iFolderID " . "AND status_id = " . LIVE; @@ -738,7 +751,7 @@ class Document { global $default, $lang_err_database, $lang_err_doc_not_exist; $sql = $default->db; - if ($sql->query("SELECT name FROM " . $default->owl_documents_table . " WHERE id = $iDocumentID")) { + if ($sql->query("SELECT name FROM " . $default->documents_table . " WHERE id = $iDocumentID")) { if ($sql->next_record()) { return $sql->f("name"); } else { @@ -772,8 +785,8 @@ class Document { global $default; $sql = $default->db; $sql->query("SELECT * " . - "FROM $default->owl_folder_doctypes_table AS FDL " . - "INNER JOIN $default->owl_documents_table AS D ON D.document_type_id = FDL.document_type_id " . + "FROM $default->folder_doctypes_table AS FDL " . + "INNER JOIN $default->documents_table AS D ON D.document_type_id = FDL.document_type_id " . "WHERE FDL.id = $iFolderDocTypeID " . "AND D.folder_id = $iFolderID"); if ($sql->next_record()) { @@ -788,8 +801,8 @@ class Document { */ function removeInvalidDocumentTypeEntries() { global $default; - $sQuery = "SELECT field_id FROM $default->owl_document_type_fields_table DTFL " . - "INNER JOIN $default->owl_fields_table AS DF ON DF.id = DTFL.field_id " . + $sQuery = "SELECT field_id FROM $default->document_type_fields_table DTFL " . + "INNER JOIN $default->document_fields_table AS DF ON DF.id = DTFL.field_id " . "WHERE DTFL.document_type_id = $this->iDocumentTypeID " . "AND DF.is_generic = 0"; $sql = $default->db; @@ -801,7 +814,7 @@ class Document { } if (count($aFieldIDs) > 0) { //delete the entries - $sQuery = "DELETE FROM $default->owl_document_fields_table WHERE document_id = $this->iId AND document_field_id IN (" . implode(",",$aFieldIDs) . ")"; + $sQuery = "DELETE FROM $default->document_fields_link_table WHERE document_id = $this->iId AND document_field_id IN (" . implode(",",$aFieldIDs) . ")"; if ($sql->query($sQuery)) { return true; } @@ -821,7 +834,7 @@ class Document { function hasCollaboration() { global $default; $sql = $default->db; - $sql->query("SELECT id AS count from $default->owl_groups_folders_approval_table WHERE folder_id = $this->iFolderID"); + $sql->query("SELECT id AS count from $default->groups_folders_approval_table WHERE folder_id = $this->iFolderID"); if ($sql->next_record()) { return true; } @@ -834,9 +847,9 @@ class Document { function cleanupDocumentData($iDocumentID) { global $default; $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_document_text_table WHERE document_id = $iDocumentID") && + $result = $sql->query("DELETE FROM $default->document_text_table WHERE document_id = $iDocumentID") && $sql->query("DELETE FROM $default->search_permissions_table WHERE document_id = $iDocumentID") && - $sql->query("DELETE FROM $default->owl_document_fields_table WHERE document_id = $iDocumentID"); + $sql->query("DELETE FROM $default->document_fields_link_table WHERE document_id = $iDocumentID"); return $result; } } diff --git a/lib/documentmanagement/DocumentCollaboration.inc b/lib/documentmanagement/DocumentCollaboration.inc index ddfb3ac..01a786f 100644 --- a/lib/documentmanagement/DocumentCollaboration.inc +++ b/lib/documentmanagement/DocumentCollaboration.inc @@ -1,12 +1,29 @@ db; - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND (active = 1 OR done = 1)"); + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND (active = 1 OR done = 1)"); if ($sql->next_record()) { return true; } @@ -27,7 +44,7 @@ class DocumentCollaboration { function documentCollaborationDone($iDocumentID) { global $default; $sql = $default->db; - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"); + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"); if ($sql->num_rows() > 0) { return false; } else { @@ -43,7 +60,7 @@ class DocumentCollaboration { function userIsPerformingCurrentCollaborationStep($iDocumentID) { global $default; $sql = $default->db; - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND active = 1 AND user_id = " . $_SESSION["userID"]); + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND active = 1 AND user_id = " . $_SESSION["userID"]); if ($sql->next_record()) { return true; } @@ -59,7 +76,7 @@ class DocumentCollaboration { function resetDocumentCollaborationSteps($iDocumentID) { global $default; $sql = $default->db; - if ($sql->query("UPDATE $default->owl_folders_user_roles_table SET active = 0, done = 0 WHERE document_id = $iDocumentID")) { + if ($sql->query("UPDATE $default->folders_user_roles_table SET active = 0, done = 0 WHERE document_id = $iDocumentID")) { return true; } return false; @@ -73,7 +90,7 @@ class DocumentCollaboration { function isLastStepInCollaborationProcess($iDocumentID) { global $default; $sql = $default->db; - $sQuery = "SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"; + $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"; $sql->query($sQuery); $default->log->info("lastCollabStep:$sQuery"); if ($sql->num_rows() > 1) { @@ -91,8 +108,8 @@ class DocumentCollaboration { global $default; $sql = $default->db; // returns all users, the sequence of their collaboration and the time of completion - $sQuery = "SELECT FURL.user_id, FURL.datetime, GFAL.precedence FROM $default->owl_folders_user_roles_table FURL " . - "INNER JOIN $default->owl_groups_folders_approval_table GFAL ON FURL.group_folder_approval_id = GFAL.id " . + $sQuery = "SELECT FURL.user_id, FURL.datetime, GFAL.precedence FROM $default->folders_user_roles_table FURL " . + "INNER JOIN $default->groups_folders_approval_table GFAL ON FURL.group_folder_approval_id = GFAL.id " . "WHERE FURL.document_id = $iDocumentID " . "ORDER BY GFAL.precedence"; $sql->query($sQuery); @@ -124,8 +141,8 @@ class DocumentCollaboration { //if the user is assigned to two or more roles, make sure we get the current //one by ordering by precedence $sql->query("SELECT FURL.id AS id, GFAT.precedence " . - "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 " . + "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 " . "WHERE document_id = $iDocumentID AND FURL.user_id = " . $_SESSION["userID"] . " AND done=0 " . "ORDER BY precedence ASC"); if ($sql->next_record()) { @@ -138,16 +155,16 @@ class DocumentCollaboration { //get it's sequence number $iCurrentSequenceNumber = $sql->f("precedence"); $sql->query("SELECT MIN(precedence) AS precedence " . - "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 " . + "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 " . "WHERE document_id = $iDocumentID AND done = 0"); if ($sql->next_record()) { if ($sql->f("precedence") != $iCurrentSequenceNumber) { //if there are no concurrent steps outstanding $iNextSequenceNumber = $sql->f("precedence"); $sql->query("SELECT FURL.id " . - "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 " . + "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 " . "WHERE document_id = $iDocumentID AND precedence = $iNextSequenceNumber"); while ($sql->next_record()) { $oFolderUserRole = FolderUserRole::get($sql->f("id")); @@ -187,7 +204,7 @@ class DocumentCollaboration { global $default; //only create the documents if they haven't been created if ($oFolderUserRole->getDependantDocumentsCreated() == false) { - $sQuery = "SELECT * FROM $default->owl_dependant_document_template_table WHERE group_folder_approval_link_id = " . $oFolderUserRole->getGroupFolderApprovalID(); + $sQuery = "SELECT * FROM $default->dependant_document_template_table WHERE group_folder_approval_link_id = " . $oFolderUserRole->getGroupFolderApprovalID(); $sql = $default->db; $sql->query($sQuery); while ($sql->next_record()) { @@ -231,8 +248,8 @@ class DocumentCollaboration { global $default; //get the current sequence number $sQuery = "SELECT GFAT.precedence, GFAT.folder_id, FURL.id AS furl_id, FURL.document_id AS document_id " . - "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 " . + "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 " . "WHERE FURL.document_id = $iDocumentID " . "AND FURL.user_id = " . $_SESSION["userID"] . " " . "AND FURL.active = 1 " . @@ -251,8 +268,8 @@ class DocumentCollaboration { //if there are concurrent collaboration steps and one is rejected, then all //must be rolled back, whether they were accepted or not $sQuery = "SELECT FURL.id, FURL.user_id " . - "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 " . + "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 " . "WHERE FURL.document_id = $iDocumentID AND GFAT.precedence = $iCurrentSequenceNumber"; $sql->query($sQuery); @@ -287,7 +304,7 @@ class DocumentCollaboration { //get the previous sequence number $sQuery = "SELECT COALESCE(MAX(precedence), -1) AS precedence " . - "FROM $default->owl_groups_folders_approval_table AS GFAT " . + "FROM $default->groups_folders_approval_table AS GFAT " . "WHERE precedence < $iCurrentSequenceNumber"; "AND folder_id = $iFolderID"; $sql->query($sQuery); @@ -312,7 +329,7 @@ class DocumentCollaboration { } else { //there are steps prior to this step $sQuery = "SELECT FURL.id AS furl_id " . - "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 " . + "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 " . "WHERE FURL.document_id = $iDocumentID " . "AND GFAT.precedence = " . $sql->f("precedence"); @@ -354,7 +371,7 @@ class DocumentCollaboration { */ function documentIsPendingWebPublishing($iDocumentID) { global $default; - $sQuery = "SELECT id FROM $default->owl_web_documents_table WHERE document_id = $iDocumentID AND status_id = 1"; + $sQuery = "SELECT id FROM $default->web_documents_table WHERE document_id = $iDocumentID AND status_id = 1"; $sql = $default->db; $sql->query($sQuery); if ($sql->next_record()) { @@ -368,7 +385,7 @@ class DocumentCollaboration { */ function documentIsPublished($iDocumentID) { global $default; - $sQuery = "SELECT id FROM $default->owl_web_documents_table WHERE document_id = $iDocumentID AND status_id = 2"; + $sQuery = "SELECT id FROM $default->web_documents_table WHERE document_id = $iDocumentID AND status_id = 2"; $sql = $default->db; $sql->query($sQuery); if ($sql->next_record()) { @@ -386,8 +403,8 @@ class DocumentCollaboration { function notifyWebMaster($iDocumentID, $sComment) { global $default; $sQuery = "SELECT WS.web_master_id, WS.web_site_name, WS.web_site_url " . - "FROM $default->owl_web_sites_table AS WS " . - "INNER JOIN $default->owl_web_documents_table AS WD ON WS.id = WD.web_site_id " . + "FROM $default->web_sites_table AS WS " . + "INNER JOIN $default->web_documents_table AS WD ON WS.id = WD.web_site_id " . "WHERE WD.document_id = $iDocumentID"; $sql = $default->db; diff --git a/lib/documentmanagement/DocumentField.inc b/lib/documentmanagement/DocumentField.inc index 231c8e6..8602b9f 100644 --- a/lib/documentmanagement/DocumentField.inc +++ b/lib/documentmanagement/DocumentField.inc @@ -1,15 +1,30 @@ fileSystemRoot/lib/documentmanagement/DocumentType.inc"); /** + * $Id$ * - * Class DocumentField + * Represents a document field as per the database document_fields table. * - * Represents a document field as per the database document_fields table + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa - * @date 19 January 2003 - * @package lib.documentmanagement - */ + * @package lib.documentmanagement + */ class DocumentField { /** primary key value */ @@ -146,7 +161,7 @@ class DocumentField { //if the object hasn't been created if ($this->iId < 0) { $sql = $default->db; - $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 ."')"); + $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 ."')"); if ($result) { $this->iId = $sql->insert_id(); return true; @@ -169,7 +184,7 @@ class DocumentField { //only update if the object has been stored if ($this->iId > 0) { $sql = $default->db; - $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"); + $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"); if ($result) { return true; } @@ -191,7 +206,7 @@ class DocumentField { //only delete the object if it exists in the database if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_fields_table WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM $default->document_fields_table WHERE id = $this->iId"); if ($result) { return true; } @@ -213,14 +228,14 @@ class DocumentField { function & get($iDocumentFieldsID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_fields_table WHERE id = $iDocumentFieldsID"); + $result = $sql->query("SELECT * FROM $default->document_fields_table WHERE id = $iDocumentFieldsID"); if ($result) { if ($sql->next_record()) { $oDocumentField = & new DocumentField(stripslashes($sql->f("name")), stripslashes($sql->f("data_type")), $sql->f("is_generic"), $sql->f("has_lookup")); $oDocumentField->iId = $sql->f("id"); return $oDocumentField; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->owl_fields_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -238,7 +253,7 @@ class DocumentField { global $default; $aDocumentFieldArray = array(); $sql = $default->db; - $sQuery = "SELECT id FROM " . $default->owl_fields_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : ""); + $sQuery = "SELECT id FROM " . $default->document_fields_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : ""); $result = $sql->query($sQuery); if ($result) { while ($sql->next_record()) { @@ -256,7 +271,7 @@ class DocumentField { global $default; $aDocumentTypes = array(); $sql = $default->db; - $query = "SELECT document_type_id FROM " . $default->owl_document_type_fields_table . " WHERE field_id = $this->iId"; + $query = "SELECT document_type_id FROM " . $default->document_type_fields_table . " WHERE field_id = $this->iId"; if ($sql->query($query)) { while ($sql->next_record()) { $aDocumentTypes[] = & DocumentType::get($sql->f("document_type_id")); @@ -275,7 +290,7 @@ class DocumentField { function isFieldLinkedToType() { global $default; $sql = $default->db; - $query = "SELECT document_type_id FROM " . $default->owl_document_type_fields_table . " WHERE field_id = $this->iId"; + $query = "SELECT document_type_id FROM " . $default->document_type_fields_table . " WHERE field_id = $this->iId"; if ($sql->query($query)) { $rows = $sql->num_rows($sql); if ($rows > 0) { @@ -299,7 +314,7 @@ class DocumentField { $aDataTypes; settype($aDataTypes, "array"); $sql = $default->db; - $result = $sql->query("SELECT id, name FROM " . $default->owl_data_types_table ); + $result = $sql->query("SELECT id, name FROM " . $default->data_types_table ); if ($result) { $iCount = 0; while ($sql->next_record()) { @@ -318,7 +333,7 @@ class DocumentField { global $default; $sql = $default->db; - $result = $sql->query("SELECT COUNT(*) AS count FROM " . $default->owl_metadata_table . " WHERE document_field_id = " . $iDocumentFieldID); + $result = $sql->query("SELECT COUNT(*) AS count FROM " . $default->metadata_table . " WHERE document_field_id = " . $iDocumentFieldID); if ($result) { if ($sql->next_record()) { return $sql->f("count"); diff --git a/lib/documentmanagement/DocumentFieldLink.inc b/lib/documentmanagement/DocumentFieldLink.inc index f517bb1..3ca130c 100644 --- a/lib/documentmanagement/DocumentFieldLink.inc +++ b/lib/documentmanagement/DocumentFieldLink.inc @@ -1,16 +1,29 @@ = 0, then the object has already been created if ($this->iId < 0) { $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->owl_document_fields_table . " (document_id, document_field_id, value) " . + $result = $sql->query("INSERT INTO " . $default->document_fields_link_table . " (document_id, document_field_id, value) " . "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '" . addslashes($this->sValue) . "')"); if ($result) { //set the current documents primary key @@ -129,7 +142,7 @@ class DocumentFieldLink { $_SESSION["errorMessage"] = $lang_err_database; return false; } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_document_fields_table"; + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_fields_link_table"; return false; } @@ -143,7 +156,7 @@ class DocumentFieldLink { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("UPDATE " . $default->owl_document_fields_table . " SET " . + $result = $sql->query("UPDATE " . $default->document_fields_link_table . " SET " . "document_id = $this->iDocumentID, document_field_id = $this->iDocumentFieldID, value = '" . addslashes($this->sValue) . "'" . "WHERE id = $this->iId"); if ($result) { @@ -167,7 +180,7 @@ class DocumentFieldLink { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM " . $default->owl_document_fields_table . " WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM " . $default->document_fields_link_table . " WHERE id = $this->iId"); if ($result) { $this->iId = -1; return true; @@ -191,13 +204,13 @@ class DocumentFieldLink { function & get($iDocumentFieldLinkID) { global $default, $lang_err_doc_not_exist; $sql = $default->db; - $sql->query("SELECT * FROM " . $default->owl_document_fields_table . " WHERE id = " . $iDocumentFieldLinkID); + $sql->query("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = " . $iDocumentFieldLinkID); if ($sql->next_record()) { $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value")); $oDocumentFieldLink->iId = $iDocumentFieldLinkID; return $oDocumentFieldLink; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->owl_document_fields_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_link_table"; return false; } } diff --git a/lib/documentmanagement/DocumentLink.inc b/lib/documentmanagement/DocumentLink.inc index 4af3a15..da811fd 100644 --- a/lib/documentmanagement/DocumentLink.inc +++ b/lib/documentmanagement/DocumentLink.inc @@ -1,18 +1,31 @@ iId >= 0) { $sql = $default -> db; - $result = $sql -> query("DELETE FROM $default->owl_document_link_table WHERE id = $this->iId"); + $result = $sql -> query("DELETE FROM $default->document_link_table WHERE id = $this->iId"); if ($result) { return true; } @@ -163,14 +176,14 @@ class DocumentLink { function & get($iDocumentLinkID) { global $default; $sql = $default -> db; - $result = $sql -> query("SELECT * FROM $default->owl_document_link_table WHERE id = $iDocumentLinkID"); + $result = $sql -> query("SELECT * FROM $default->document_link_table WHERE id = $iDocumentLinkID"); if ($result) { if ($sql -> next_record()) { $oDocumentLink = & new DocumentLink($sql -> f("parent_document_id"), $sql -> f("parent_document_id")); $oDocumentLink -> iId = $sql -> f("id"); return $oDocumentLink; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDocumentLinkID." table = $default->owl_document_link_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDocumentLinkID." table = $default->document_link_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; diff --git a/lib/documentmanagement/DocumentTransaction.inc b/lib/documentmanagement/DocumentTransaction.inc index 7f80226..2776a1b 100644 --- a/lib/documentmanagement/DocumentTransaction.inc +++ b/lib/documentmanagement/DocumentTransaction.inc @@ -14,21 +14,33 @@ DEFINE("EXPUNGE", 11); DEFINE("FORCE_CHECKIN", 12); DEFINE("EMAIL_LINK", 13); DEFINE("COLLAB_ACCEPT", 14); - /** -* -* Class DocumentTransaction -* -* Represents a document transaction as per the database table document_transaction -* -* No delete or update functions are provided. Once a transaction has been stored -* in the database it may not be changed. -* -* @author Rob Cherry, Jam Warehouse(Pty) Ltd, South Africa -* @date 18 January 2003 -* @package lib.documentmanagement -*/ - + * $Id$ + * + * Represents a document transaction as per the database table document_transaction. + * No delete or update functions are provided. Once a transaction has been stored + * in the database it may not be changed. + * + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa + * @package lib.documentmanagement + */ class DocumentTransaction { /** primary key of document transaction */ @@ -92,7 +104,7 @@ class DocumentTransaction { //if the object hasn't been stored yet if ($this->iId < 0) { $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->owl_document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " . + $result = $sql->query("INSERT INTO " . $default->document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " . "VALUES ($this->iDocumentID, '" . addslashes($this->sVersion) . "', $this->iUserID, '" . addslashes($this->dDateTime) . "', '" . addslashes($this->sIP) . "', '" . addslashes($this->sFileName) . "', '" . addslashes($this->sComment) . "', $this->iTransactionID)"); if ($result) { //object has been stored, set the primary key @@ -113,9 +125,7 @@ class DocumentTransaction { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - // TODO: insert into sys_deleted - //$result = $sql->query("INSERT INTO " . $default->owl_sys_deleted_table . " () VALUES ()"); - $result = $sql->query("DELETE FROM " . $default->owl_document_transactions_table . " WHERE id = " . $this->iId); + $result = $sql->query("DELETE FROM " . $default->document_transactions_table . " WHERE id = " . $this->iId); if ($result) { $this->iId = -1; return true; @@ -138,7 +148,7 @@ class DocumentTransaction { global $default, $lang_err_doc_not_exist; if (strlen($iDocumentTransactionID) > 0) { $sql = $default->db; - $sql->query("SELECT * FROM $default->owl_document_transactions_table WHERE id = $iDocumentTransactionID"); + $sql->query("SELECT * FROM $default->document_transactions_table WHERE id = $iDocumentTransactionID"); if ($sql->next_record()) { $oDocumentTransaction = & new DocumentTransaction($sql->f("document_id"), stripslashes($sql->f("comment")), $sql->f("transaction_id")); $oDocumentTransaction->iId = $sql->f("id"); @@ -169,7 +179,7 @@ class DocumentTransaction { global $default, $lang_err_database; $aDocumentTransactionArray = array(); $sql = $default->db; - $sQuery = "SELECT * FROM $default->owl_document_transactions_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""); + $sQuery = "SELECT * FROM $default->document_transactions_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""); $result = $sql->query($sQuery); if ($result) { while ($sql->next_record()) { diff --git a/lib/documentmanagement/DocumentType.inc b/lib/documentmanagement/DocumentType.inc index 6b524aa..a88b563 100644 --- a/lib/documentmanagement/DocumentType.inc +++ b/lib/documentmanagement/DocumentType.inc @@ -1,15 +1,29 @@ iId < 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT name FROM ". $default->owl_document_types_table ." WHERE name = '" . $this->sName . "'"; + $query = "SELECT name FROM ". $default->document_types_table ." WHERE name = '" . $this->sName . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -84,7 +98,7 @@ class DocumentType { }else{ $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->owl_document_types_table . " (name) VALUES ('" . addslashes($this->sName) . "')"); + $result = $sql->query("INSERT INTO " . $default->document_types_table . " (name) VALUES ('" . addslashes($this->sName) . "')"); if ($result) { $this->iId = $sql->insert_id(); return true; @@ -109,7 +123,7 @@ class DocumentType { //only update if the object has been stored if ($this->iId > 0) { $sql = $default->db; - $result = $sql->query("UPDATE " . $default->owl_document_types_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); + $result = $sql->query("UPDATE " . $default->document_types_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); if ($result) { return true; } @@ -132,7 +146,7 @@ class DocumentType { if ($this->iId > 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT folder_id FROM ". $default->owl_folder_doctypes_table ." WHERE document_type_id = '" . $this->iId . "'"; + $query = "SELECT folder_id FROM ". $default->folder_doctypes_table ." WHERE document_type_id = '" . $this->iId . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -143,7 +157,7 @@ class DocumentType { }else{ $sql = $default->db; - $result = $sql->query("DELETE FROM " . $default->owl_document_types_table . " WHERE id = '" . $this->iId . "'"); + $result = $sql->query("DELETE FROM " . $default->document_types_table . " WHERE id = '" . $this->iId . "'"); if ($result) { return true; } @@ -165,7 +179,7 @@ class DocumentType { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM " . $default->owl_document_type_fields_table . " WHERE document_type_id = $this->iId"); + $result = $sql->query("DELETE FROM " . $default->document_type_fields_table . " WHERE document_type_id = $this->iId"); if ($result) { $this->iId = -1; return true; @@ -187,7 +201,7 @@ class DocumentType { function & get($iDocumentTypeID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM ". $default->owl_document_types_table ." WHERE id = $iDocumentTypeID"); + $result = $sql->query("SELECT * FROM ". $default->document_types_table ." WHERE id = $iDocumentTypeID"); if ($result) { if ($sql->next_record()) { $oDocumentType = & new DocumentType(stripslashes($sql->f("name"))); @@ -212,7 +226,7 @@ class DocumentType { global $default, $lang_err_database; $aDocumentTypeArray = array(); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_document_types_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : "")); + $result = $sql->query("SELECT * FROM " . $default->document_types_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : "")); if ($result) { while ($sql->next_record()) { $aDocumentTypeArray[] = & DocumentType::get($sql->f("id")); diff --git a/lib/documentmanagement/DocumentTypeFieldLink.inc b/lib/documentmanagement/DocumentTypeFieldLink.inc index 64adbf0..8648dad 100644 --- a/lib/documentmanagement/DocumentTypeFieldLink.inc +++ b/lib/documentmanagement/DocumentTypeFieldLink.inc @@ -1,16 +1,30 @@ fileSystemRoot/lib/documentmanagement/DocumentField.inc"); - /** - * - * Class DocumentTypeFieldLink + * $Id$ * * Represents a document type field link as per the database table document_types_fields_link * + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @version $Revision$ * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa - * @date 19 January 2003 - * @package lib.documentmanagement - */ + * @package lib.documentmanagement + */ class DocumentTypeFieldLink { /** document field link primary key */ @@ -120,7 +134,7 @@ class DocumentTypeFieldLink { if ($this->iId < 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT id FROM ". $default->owl_document_type_fields_table ." WHERE document_type_id = '" . $this->iDocumentTypeID . "' and field_id = '". $this->iFieldID . "'"; + $query = "SELECT id FROM ". $default->document_type_fields_table ." WHERE document_type_id = '" . $this->iDocumentTypeID . "' and field_id = '". $this->iFieldID . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -131,7 +145,7 @@ class DocumentTypeFieldLink { }else{ $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->owl_document_type_fields_table . " (document_type_id, field_id, is_mandatory) " . + $result = $sql->query("INSERT INTO " . $default->document_type_fields_table . " (document_type_id, field_id, is_mandatory) " . "VALUES ($this->iDocumentTypeID, $this->iFieldID, '" . $this->bIsMandatory . "')"); if ($result) { //set the current documents primary key @@ -142,7 +156,7 @@ class DocumentTypeFieldLink { return false; } } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_document_type_fields_table"; + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_type_fields_table"; return false; } @@ -156,7 +170,7 @@ class DocumentTypeFieldLink { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - $sQuery = "UPDATE " . $default->owl_document_type_fields_table . " SET " . + $sQuery = "UPDATE " . $default->document_type_fields_table . " SET " . "document_type_id = $this->iDocumentTypeID, field_id = $this->iFieldID, is_mandatory = '" . $this->bIsMandatory . "'" . "WHERE id = $this->iId"; $result = $sql->query($sQuery); @@ -181,7 +195,7 @@ class DocumentTypeFieldLink { global $default, $lang_err_database, $lang_err_object_key; if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM " . $default->owl_document_type_fields_table . " WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM " . $default->document_type_fields_table . " WHERE id = $this->iId"); if ($result) { $this->iId = -1; return true; @@ -205,7 +219,7 @@ class DocumentTypeFieldLink { function & get($iDocumentTypeFieldLinkID) { global $default; $sql = $default->db; - $sql->query("SELECT * FROM " . $default->owl_document_type_fields_table . " WHERE id = " . $iDocumentTypeFieldLinkID); + $sql->query("SELECT * FROM " . $default->document_type_fields_table . " WHERE id = " . $iDocumentTypeFieldLinkID); if ($sql->next_record()) { $oDocumentTypeFieldLink = & new DocumentTypeFieldLink($sql->f("document_type_id"), $sql->f("field_id"), $sql->f("is_mandatory")); $oDocumentTypeFieldLink->iId = $iDocumentTypeFieldLinkID; @@ -222,7 +236,7 @@ class DocumentTypeFieldLink { */ function docTypeBelongsToField($iDocTypeID) { global $default; - return lookupField("$default->owl_document_type_fields_table", "field_id", "document_type_id", $iDocTypeID ); + return lookupField("$default->document_type_fields_table", "field_id", "document_type_id", $iDocTypeID ); } /** @@ -235,7 +249,7 @@ class DocumentTypeFieldLink { function getByFieldAndTypeIDs($iDocTypeID, $iDocFieldID) { global $default; $sql = $default->db; - $sQuery = "SELECT id FROM $default->owl_document_type_fields_table WHERE field_id = $iDocFieldID AND document_type_id = $iDocTypeID"; + $sQuery = "SELECT id FROM $default->document_type_fields_table WHERE field_id = $iDocFieldID AND document_type_id = $iDocTypeID"; $result = $sql->query($sQuery); if ($result) { if ($sql->next_record()) { @@ -258,7 +272,7 @@ class DocumentTypeFieldLink { global $default; $aFields = array(); $sql = $default->db; - $result = $sql->query("SELECT field_id FROM " . $default->owl_document_type_fields_table . " WHERE document_type_id = ". $iDocTypeID); + $result = $sql->query("SELECT field_id FROM " . $default->document_type_fields_table . " WHERE document_type_id = ". $iDocTypeID); if ($result) { while ($sql->next_record()) { $aFields[] = DocumentField::get($sql->f("field_id")); diff --git a/lib/documentmanagement/MetaData.inc b/lib/documentmanagement/MetaData.inc index d8d1dc9..effd4cb 100644 --- a/lib/documentmanagement/MetaData.inc +++ b/lib/documentmanagement/MetaData.inc @@ -1,15 +1,29 @@ iId < 0) { //check to see if name exsits $sql = $default->db; - $query = "SELECT name FROM ". $default->owl_metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'"; + $query = "SELECT name FROM ". $default->metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'"; $sql->query($query); $rows = $sql->num_rows($sql); @@ -109,7 +123,7 @@ class MetaData { }else{ $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->owl_metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','" . addslashes($this->sName) . "')"); + $result = $sql->query("INSERT INTO " . $default->metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','" . addslashes($this->sName) . "')"); if ($result) { $this->iId = $sql->insert_id(); return true; @@ -134,7 +148,7 @@ class MetaData { //only update if the object has been stored if ($this->iId > 0) { $sql = $default->db; - $result = $sql->query("UPDATE " . $default->owl_metadata_table. " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); + $result = $sql->query("UPDATE " . $default->metadata_table. " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); if ($result) { return true; } @@ -156,7 +170,7 @@ class MetaData { //only delete the object if it exists in the database if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM " . $default->owl_metadata_table. " WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM " . $default->metadata_table. " WHERE id = $this->iId"); if ($result) { return true; } @@ -178,7 +192,7 @@ class MetaData { function & get($iMetaDataID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM ". $default->owl_metadata_table." WHERE id = $iMetaDataID"); + $result = $sql->query("SELECT * FROM ". $default->metadata_table." WHERE id = $iMetaDataID"); if ($result) { if ($sql->next_record()) { $oDocumentType = & new MetaData($sql->f("document_field_id"),stripslashes($sql->f("name"))); @@ -209,7 +223,7 @@ class MetaData { { global $default; $sql = $default->db; - $result = $sql->query("SELECT id FROM $default->owl_metadata_table WHERE document_field_id = $iDocFieldID and name = '" . $sMetaDataName . "' "); + $result = $sql->query("SELECT id FROM $default->metadata_table WHERE document_field_id = $iDocFieldID and name = '" . $sMetaDataName . "' "); if ($result) { if ($sql->next_record()) { $id = $sql->f("id"); diff --git a/lib/documentmanagement/PhysicalDocumentManager.inc b/lib/documentmanagement/PhysicalDocumentManager.inc index 855ebde..fc6acf0 100644 --- a/lib/documentmanagement/PhysicalDocumentManager.inc +++ b/lib/documentmanagement/PhysicalDocumentManager.inc @@ -11,14 +11,26 @@ * o $fFolderID - primary key of folder into which file will be placed * o When calling deleteDocument: * - * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING. + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa * @version $Revision$ - * @date 13 January 2003 - * @package lib.documentmanagement + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa + * @package lib.documentmanagement */ - class PhysicalDocumentManager { /** @@ -138,7 +150,7 @@ class PhysicalDocumentManager { // FIXME: refactor array getOldVersionPaths($iDocumentID)?? $sql = $default->db; - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); if ($result) { while ($sql->next_record()) { $sVersion = $sql->f("version"); @@ -212,7 +224,7 @@ class PhysicalDocumentManager { // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions // FIXME: refactor $sql = $default->db; - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); if ($result) { while ($sql->next_record()) { $sVersion = $sql->f("version"); @@ -254,7 +266,7 @@ class PhysicalDocumentManager { // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions // FIXME: refactor $sql = $default->db; - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); if ($result) { while ($sql->next_record()) { $sVersion = $sql->f("version"); @@ -309,7 +321,7 @@ class PhysicalDocumentManager { // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions // FIXME: refactor $sql = $default->db; - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); if ($result) { while ($sql->next_record()) { $sVersion = $sql->f("version"); @@ -392,14 +404,14 @@ class PhysicalDocumentManager { // check by file extension $sExtension = strtolower(substr($sFileName, strpos($sFileName, ".")+1, strlen($sFileName) - strpos($sFileName, "."))); - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE LOWER(filetypes) = '$sExtension'"); + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE LOWER(filetypes) = '$sExtension'"); if ($sql->next_record()) { return $sql->f("id"); } //get the mime type if (isset($sMimeType)) { - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = '$sMimeType'"); + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE mimetypes = '$sMimeType'"); if ($sql->next_record()) { //get the mime type id return $sql->f("id"); @@ -419,7 +431,7 @@ class PhysicalDocumentManager { function getDefaultMimeTypeID() { global $default; $sql = $default->db; - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = 'text/plain'"); + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE mimetypes = 'text/plain'"); $sql->next_record(); //get the mime type id return $sql->f("id"); @@ -428,7 +440,7 @@ class PhysicalDocumentManager { function getMimeTypeName($iMimeTypeID) { global $default; $sql = $default->db; - $sql->query("SELECT mimetypes FROM " . $default->owl_mime_table . " WHERE id = " . $iMimeTypeID); + $sql->query("SELECT mimetypes FROM " . $default->mimetypes_table . " WHERE id = " . $iMimeTypeID); if ($sql->next_record()) { return $sql->f("mimetypes"); } diff --git a/lib/email/Email.inc b/lib/email/Email.inc index a2d9eca..e1cebff 100644 --- a/lib/email/Email.inc +++ b/lib/email/Email.inc @@ -2,11 +2,27 @@ /** * $Id$ * - * Contains static functions concerned with sending emails + * Contains static functions concerned with sending emails. + * + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa * @version $Revision$ - * @package lib.email + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa + * @package lib.email */ class Email {