diff --git a/lib/browse/Browser.inc b/lib/browse/Browser.inc index 439053f..e6417fc 100644 --- a/lib/browse/Browser.inc +++ b/lib/browse/Browser.inc @@ -1,21 +1,31 @@ fileSystemRoot/lib/security/permission.inc"); require_once("$default->fileSystemRoot/lib/users/User.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); - /** - * * $Id$ - * + * * Contains document browsing business logic. * - * Licensed under the GNU GPL. For full terms see the file 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 * * @version $Revision$ * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * * @package lib.browse */ class Browser { diff --git a/lib/browse/BrowserFactory.inc b/lib/browse/BrowserFactory.inc index 50eddad..1ddebbd 100644 --- a/lib/browse/BrowserFactory.inc +++ b/lib/browse/BrowserFactory.inc @@ -4,18 +4,29 @@ require_once("$default->fileSystemRoot/lib/browse/Browser.inc"); require_once("$default->fileSystemRoot/lib/browse/FolderBrowser.inc"); require_once("$default->fileSystemRoot/lib/browse/CategoryBrowser.inc"); require_once("$default->fileSystemRoot/lib/browse/DocumentTypeBrowser.inc"); - /** - * * $Id$ - * + * * Responsible for generating the appropriate browser class instance. * - * Licensed under the GNU GPL. For full terms see the file 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 * * @version $Revision$ * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * * @package lib.browse */ class BrowserFactory { diff --git a/lib/browse/CategoryBrowser.inc b/lib/browse/CategoryBrowser.inc index da73881..33eef57 100644 --- a/lib/browse/CategoryBrowser.inc +++ b/lib/browse/CategoryBrowser.inc @@ -4,19 +4,30 @@ require_once("$default->fileSystemRoot/lib/security/permission.inc"); require_once("$default->fileSystemRoot/lib/users/User.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); - /** - * * $Id$ - * - * Contains document browsing business logic. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Contains category view document browsing business logic. + * + * 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 Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * - * @package lib.documentmanagement + * @package lib.browse */ class CategoryBrowser extends Browser { @@ -48,7 +59,7 @@ class CategoryBrowser extends Browser { $sql = $default->db; // lookup document_fields id for category - $categoryFieldID = lookupID($default->owl_fields_table, "name", "$categoryField"); + $categoryFieldID = lookupID($default->document_fields_table, "name", "$categoryField"); $default->log->debug("CategoryBrowser::browse() categoryFieldID=$categoryFieldID"); if ($sCategoryName == "") { @@ -57,7 +68,7 @@ class CategoryBrowser extends Browser { // set the first value to "categories" $results["categories"][] = "Categories"; // get a list of category values - $query = "SELECT DISTINCT value FROM $default->owl_document_fields_table WHERE document_field_id=$categoryFieldID ORDER BY value " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC"); + $query = "SELECT DISTINCT value FROM $default->document_fields_link_table WHERE document_field_id=$categoryFieldID ORDER BY value " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC"); $default->log->info("CategoryBrowser::browse() category listing query=$query; $this->sSortField"); $sql->query($query); // loop through resultset, build array and return @@ -74,8 +85,8 @@ class CategoryBrowser extends Browser { // we have a category to use, so find all the documents // with this category value - $categoryQuery = "SELECT df.document_id FROM $default->owl_document_fields_table df " . - "INNER JOIN $default->owl_documents_table d ON df.document_id = d.id "; + $categoryQuery = "SELECT df.document_id FROM $default->document_fields_link_table df " . + "INNER JOIN $default->documents_table d ON df.document_id = d.id "; if ( isset($aLookupCriteria) ) { $categoryQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON "; $categoryQuery .= "d.$this->sSortField" . "=lt." . (isset($aLookupCriteria["joinColumn"]) ? $aLookupCriteria["joinColumn"] : "id"); diff --git a/lib/browse/DocumentTypeBrowser.inc b/lib/browse/DocumentTypeBrowser.inc index 7a73c06..63c0017 100644 --- a/lib/browse/DocumentTypeBrowser.inc +++ b/lib/browse/DocumentTypeBrowser.inc @@ -1,22 +1,32 @@ fileSystemRoot/lib/security/permission.inc"); require_once("$default->fileSystemRoot/lib/users/User.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); - /** - * * $Id$ - * - * Contains document browsing business logic. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Contains document type view document browsing business logic. + * + * 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 Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * - * @package lib.documentmanagement + * @package lib.browse */ class DocumentTypeBrowser extends Browser { @@ -51,7 +61,7 @@ class DocumentTypeBrowser extends Browser { $results["documentTypes"][] = array("name" => "Document Types"); // return a list of document types - $query = "SELECT * FROM $default->owl_document_types_table ORDER BY name " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC"); + $query = "SELECT * FROM $default->document_types_table ORDER BY name " . ($this->sSortField == "name" ? $this->sSortDirection : "ASC"); $sql->query($query); while ($sql->next_record()) { @@ -62,11 +72,11 @@ class DocumentTypeBrowser extends Browser { $aLookupCriteria = $this->aSortCriteria[$this->sSortField]["lookup"]; // lookup document type name from the passed in id - $documentTypeName = lookupField($default->owl_document_types_table, "name", "id", $iDocumentTypeID); + $documentTypeName = lookupField($default->document_types_table, "name", "id", $iDocumentTypeID); $results["documentTypes"][] = array("id" => $iDocumentTypeID, "name" => $documentTypeName); // create query to retrieve documents with this document type - $documentQuery = "SELECT d.id as id FROM $default->owl_documents_table d "; + $documentQuery = "SELECT d.id as id FROM $default->documents_table d "; if ( isset($aLookupCriteria) ) { //$documentQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON d.$this->sSortField=lt.id "; $documentQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON "; diff --git a/lib/browse/FolderBrowser.inc b/lib/browse/FolderBrowser.inc index 79b9b2f..a5492f8 100644 --- a/lib/browse/FolderBrowser.inc +++ b/lib/browse/FolderBrowser.inc @@ -1,23 +1,33 @@ fileSystemRoot/lib/browse/Browser.inc"); require_once("$default->fileSystemRoot/lib/security/permission.inc"); require_once("$default->fileSystemRoot/lib/users/User.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); - /** - * * $Id$ - * - * Contains document browsing business logic. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Contains folder view document browsing business logic. + * + * 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 Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * - * @package lib.documentmanagement + * @package lib.browse */ class FolderBrowser extends Browser { @@ -58,7 +68,7 @@ class FolderBrowser extends Browser { // if the user is in a unit, start at the unit's root folder // lookup the unit name - $unitName = lookupField($default->owl_units_table, "name", "id", $unitID); + $unitName = lookupField($default->units_table, "name", "id", $unitID); // the unit root folder has the same name as the unit // FIXME: dodgy i know, but its easy @@ -69,7 +79,7 @@ class FolderBrowser extends Browser { if (!$aFolders) { // no folder exists with this name, so start at the root - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0); + $iFolderID = lookupID($default->folders_table, "parent_id", 0); } else { $iFolderID = $aFolders[0]->getID(); } @@ -77,7 +87,7 @@ class FolderBrowser extends Browser { } else { // else just start at the root // FIXME: start at the root folder for the default organisation - $iFolderID = lookupID($default->owl_folders_table, "parent_id", 0); + $iFolderID = lookupID($default->folders_table, "parent_id", 0); } } @@ -93,7 +103,7 @@ class FolderBrowser extends Browser { $aLookupCriteria = $this->aSortCriteria[$this->sSortField]["lookup"]; // if we're sorting by name or creator_id then sort folders in the appropriate direction - $sFolderQuery = "SELECT f.id FROM $default->owl_folders_table AS f "; + $sFolderQuery = "SELECT f.id FROM $default->folders_table AS f "; if (in_array($this->sSortField, array("name", "creator_id"))) { if (isset($aLookupCriteria)) { $sFolderQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON f.$this->sSortField=lt.id WHERE parent_id=" . $iFolderID; @@ -113,7 +123,7 @@ class FolderBrowser extends Browser { } // create query to retrieve documents in this folder - $documentQuery = "SELECT d.id as id FROM $default->owl_documents_table AS d "; + $documentQuery = "SELECT d.id as id FROM $default->documents_table AS d "; if ( isset($aLookupCriteria) ) { $documentQuery .= "INNER JOIN " . $aLookupCriteria["table"] . " lt ON "; $documentQuery .= "d.$this->sSortField" . "=lt." . (isset($aLookupCriteria["joinColumn"]) ? $aLookupCriteria["joinColumn"] : "id"); diff --git a/lib/dashboard/Dashboard.inc b/lib/dashboard/Dashboard.inc index d51a4a2..27d41c0 100644 --- a/lib/dashboard/Dashboard.inc +++ b/lib/dashboard/Dashboard.inc @@ -1,23 +1,34 @@ fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); require_once("$default->fileSystemRoot/lib/links/link.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/DependantDocumentInstance.inc"); require_once("$default->fileSystemRoot/lib/archiving/ArchiveRestorationRequest.inc"); - /** * $Id$ + * + * Contains dashboard helper functions. + * + * 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. * - * Contains dashboard helper functions + * 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. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * 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 Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.dashboard */ - class Dashboard { /** @@ -66,7 +77,7 @@ class Dashboard { function getPendingCollaborationDocuments(){ global $default; - $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $this->iUserID; + $sQuery = "SELECT document_id FROM $default->folders_user_roles_table WHERE active=1 AND user_id=" . $this->iUserID; $aDocumentList = array(); $sql = $default->db; if ($sql->query($sQuery)) { @@ -109,7 +120,7 @@ class Dashboard { */ function getDependantDocuments() { global $default; - $sQuery = "SELECT id FROM $default->owl_dependant_document_instance_table WHERE user_id = " . $this->iUserID; + $sQuery = "SELECT id FROM $default->dependant_document_instance_table WHERE user_id = " . $this->iUserID; $aDocumentList = array(); $sql = $default->db; $sql->query($sQuery); diff --git a/lib/dashboard/DashboardNews.inc b/lib/dashboard/DashboardNews.inc index 10d890a..3256781 100644 --- a/lib/dashboard/DashboardNews.inc +++ b/lib/dashboard/DashboardNews.inc @@ -1,19 +1,30 @@ fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); - /** * $Id$ - * + * * Represents a dashboard news item. + * + * 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. * - * Licensed under the GNU GPL. For full terms see the file COPYING. + * 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 Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package lib.dashboard */ - class DashboardNews { /** @@ -294,7 +305,7 @@ class DashboardNews { //if the id >= 0, then the object has already been created if ($this->iId < 0) { $sql = $default->db; - $result = $sql->query("INSERT INTO $default->owl_news_table (synopsis, body, rank, image, image_size, image_mime_type_id, active) " . + $result = $sql->query("INSERT INTO $default->news_table (synopsis, body, rank, image, image_size, image_mime_type_id, active) " . "VALUES ('" . addslashes($this->sSynopsis) . "', '" . addslashes($this->sBody) . "', $this->iRank, " . "'" . addslashes($this->sImage) . "', $this->iImageSize, $this->iImageMimeTypeID, " . ($this->bActive ? "1" : "0") . ")"); if ($result) { @@ -303,7 +314,7 @@ class DashboardNews { if ($this->bActive) { // we're setting this entry to active, so set all the others to inactive - $sql->query("UPDATE $default->owl_news_table SET active=0 WHERE id <> $this->iId"); + $sql->query("UPDATE $default->news_table SET active=0 WHERE id <> $this->iId"); } return true; @@ -322,7 +333,7 @@ class DashboardNews { global $default; if ($this->iId >= 0) { $sql = $default->db; - $sQuery = "UPDATE " . $default->owl_news_table . " SET " . + $sQuery = "UPDATE " . $default->news_table . " SET " . "synopsis = '" . addslashes($this->sSynopsis) . "', " . "body = '" . addslashes($this->sBody) . "', " . "rank = $this->iRank, " . @@ -335,12 +346,12 @@ class DashboardNews { if ($result) { if ($this->bActive) { // we're setting this entry to active, so set all the others to inactive - $sql->query("UPDATE $default->owl_news_table SET active=0"); + $sql->query("UPDATE $default->news_table SET active=0"); // now set our entry to active - $sql->query("UPDATE $default->owl_news_table SET active=1 where id=$this->iId"); + $sql->query("UPDATE $default->news_table SET active=1 where id=$this->iId"); } else { // set this to inactive - $sql->query("UPDATE $default->owl_news_table SET active=0 where id=$this->iId"); + $sql->query("UPDATE $default->news_table SET active=0 where id=$this->iId"); } return true; } @@ -359,7 +370,7 @@ class DashboardNews { global $default; if ($this->iId >= 0) { $sql = $default->db; - $result = $sql->query("DELETE FROM " . $default->owl_news_table . " WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM " . $default->news_table . " WHERE id = $this->iId"); if ($result) { $this->iId = -1; return true; @@ -379,7 +390,7 @@ class DashboardNews { function & get($iNewsID) { global $default; $sql = $default->db; - $sql->query("SELECT * FROM $default->owl_news_table WHERE id = $iNewsID"); + $sql->query("SELECT * FROM $default->news_table WHERE id = $iNewsID"); if ($sql->next_record()) { $aImage = array( "image" => $sql->f("image"), "filesize" => $sql->f("image_size"), @@ -403,7 +414,7 @@ class DashboardNews { global $default; $aDashboardNewsArray = array(); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "") . " ORDER BY rank ASC"); + $result = $sql->query("SELECT * FROM " . $default->news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "") . " ORDER BY rank ASC"); if ($result) { $iCount = 0; while ($sql->next_record()) { diff --git a/lib/database/datetime.inc b/lib/database/datetime.inc index 16556c8..3797682 100644 --- a/lib/database/datetime.inc +++ b/lib/database/datetime.inc @@ -1,15 +1,28 @@ , Jam Warehouse (Pty) Ltd, South Africa - * @package lib.database + * @package lib.database */ /** diff --git a/lib/database/db.inc b/lib/database/db.inc index 62b1066..17c7699 100644 --- a/lib/database/db.inc +++ b/lib/database/db.inc @@ -4,11 +4,25 @@ * * The default database wrapper class. * - * Licensed under the GNU GPL. For full terms see the file COPYING. - * - * @version $Revision$ - * @author Mukhtar Dharsey - * @package lib.database + * 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 Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa + * @package lib.database */ class Database extends DB_Sql { diff --git a/lib/database/lookup.inc b/lib/database/lookup.inc index ef2633a..ff7e1e7 100644 --- a/lib/database/lookup.inc +++ b/lib/database/lookup.inc @@ -1,15 +1,28 @@ , Jam Warehouse (Pty) Ltd, South Africa - * @package lib.database +* @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa + * @package lib.database */ /** @@ -37,7 +50,7 @@ function lookupName($tableName, $idFieldValue){ function lookupStatusID($statusName) { global $default; - return lookupID($default->owl_status_table, "name", $statusName); + return lookupID($default->status_table, "name", $statusName); } /** @@ -51,7 +64,7 @@ function lookupGroupIDs($userID) { $groupIDs = array(); $sql = $default->db; - $sql->query("select group_id from $default->owl_users_groups_table where user_id = '$userID'"); + $sql->query("select group_id from $default->users_groups_table where user_id = '$userID'"); while($sql->next_record()) { $groupIDs[] = $sql->f("group_id"); } diff --git a/lib/discussions/DiscussionComment.inc b/lib/discussions/DiscussionComment.inc index e8e9236..ea4ba4f 100644 --- a/lib/discussions/DiscussionComment.inc +++ b/lib/discussions/DiscussionComment.inc @@ -2,11 +2,27 @@ /** * $Id$ * - * Contains static functions concerned with sending emails + * Represents a document discussion comment. + * + * 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 Omar Rahbeeni, CS Holdings, South Africa * @version $Revision$ - * @package lib.discussions + * @author Omar Rahbeeni, CS Holdings, South Africa + * @package lib.discussions */ class DiscussionComment { @@ -123,7 +139,7 @@ class DiscussionComment { function & get($iNewCommentID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_discussion_comments_table WHERE id = $iNewCommentID"); + $result = $sql->query("SELECT * FROM $default->discussion_comments_table WHERE id = $iNewCommentID"); if ($result) { if ($sql->next_record()) { $oDiscussionComment = & new DiscussionComment($sql->f("body"),$sql->f("subject"),$sql->f("user_id"),$sql->f("thread_id")); @@ -131,7 +147,7 @@ class DiscussionComment { $oDiscussionComment->dDate = $sql->f("date"); return $oDiscussionComment; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewCommentID . " table = $default->owl_discussion_comments_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewCommentID . " table = $default->discussion_comments_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -144,7 +160,7 @@ class DiscussionComment { if ($this->iId < 0) { //check to see if comment exists $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->owl_discussion_comments_table . " (thread_id,user_id,subject, body, date)" . + $result = $sql->query("INSERT INTO " . $default->discussion_comments_table . " (thread_id,user_id,subject, body, date)" . "VALUES (" . $this->iThreadID . "," . $this->iUserID . ",\"" . $this->sSubject . "\",\"" . $this->sBody . "\",Now())"); if ($result) { $this->iId = $sql->insert_id(); @@ -154,7 +170,7 @@ class DiscussionComment { return false; } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_units_table"; + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->units_table"; return false; } @@ -165,7 +181,7 @@ class DiscussionComment { $sql = $default->db; // Do update query - $result = $sql->query( "UPDATE " . $default->owl_discussion_comments_table . + $result = $sql->query( "UPDATE " . $default->discussion_comments_table . " SET thread_id = " . $this->iThreadID . " AND user_id = " . $this->iUserID . " AND subject = " . $this->sSubject . @@ -189,7 +205,7 @@ class DiscussionComment { if ($this->iId > 0) { //check to see if group is linked to a unit $sql = $default->db; - $query = "SELECT * FROM ". $default->owl_discussion_comments_table . " WHERE id = " . $this->iId ; + $query = "SELECT * FROM ". $default->discussion_comments_table . " WHERE id = " . $this->iId ; $sql->query($query); $rows = $sql->num_rows($sql); @@ -200,7 +216,7 @@ class DiscussionComment { } else { $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_discussion_comments_table WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM $default->discussion_comments_table WHERE id = $this->iId"); if ($result) { return true; } diff --git a/lib/discussions/DiscussionThread.inc b/lib/discussions/DiscussionThread.inc index a2fe117..df4784f 100644 --- a/lib/discussions/DiscussionThread.inc +++ b/lib/discussions/DiscussionThread.inc @@ -2,11 +2,27 @@ /** * $Id$ * - * Contains static functions concerned with Discusion threads + * Represents a document discussion thread. + * + * 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 Omar Rahbeeni, CS Holdings, South Africa * @version $Revision$ - * @package lib.discussions + * @author Omar Rahbeeni, CS Holdings, South Africa + * @package lib.discussions */ class DiscussionThread { @@ -114,12 +130,12 @@ class DiscussionThread { global $default; $sql = $default->db; - $result = $sql->query("SELECT id FROM $default->owl_discussion_threads_table WHERE document_id = $this->iDocumentID ORDER BY id"); + $result = $sql->query("SELECT id FROM $default->discussion_threads_table WHERE document_id = $this->iDocumentID ORDER BY id"); if ($result) { $sql->next_record(); $iThreadID = $sql->f("id"); - $result = $sql->query("SELECT id FROM $default->owl_discussion_comments_table WHERE thread_id = $iThreadID ORDER BY date Desc"); + $result = $sql->query("SELECT id FROM $default->discussion_comments_table WHERE thread_id = $iThreadID ORDER BY date Desc"); if ($result) { while ($sql->next_record()) { @@ -142,7 +158,7 @@ class DiscussionThread { function getThreadIDforDoc($iDocumentID){ global $default; $sql = $default->db; - $result = $sql->query("SELECT id FROM $default->owl_discussion_threads_table WHERE document_id = $iDocumentID"); + $result = $sql->query("SELECT id FROM $default->discussion_threads_table WHERE document_id = $iDocumentID"); if ($result) { if ($sql->next_record()) { if ($sql->f("id") > 0) { @@ -151,7 +167,7 @@ class DiscussionThread { return "false"; } } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "Document_id = " . $iDocumentID . " table = $default->owl_discussion_threads_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "Document_id = " . $iDocumentID . " table = $default->discussion_threads_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -170,7 +186,7 @@ class DiscussionThread { function & get($iNewThreadID) { global $default; $sql = $default->db; - $result = $sql->query("SELECT * FROM $default->owl_discussion_threads_table WHERE id = $iNewThreadID"); + $result = $sql->query("SELECT * FROM $default->discussion_threads_table WHERE id = $iNewThreadID"); if ($result) { if ($sql->next_record()) { @@ -184,7 +200,7 @@ class DiscussionThread { $oDiscussionThread->iNumberOfReplies = $sql->f("replies"); return $oDiscussionThread; } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewThreadID . " table = $default->owl_discussion_threads_table"; + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iNewThreadID . " table = $default->discussion_threads_table"; return false; } $_SESSION["errorMessage"] = $lang_err_database; @@ -200,7 +216,7 @@ class DiscussionThread { $sQuery = "what the hell"; if ($this->iId < 0) { //check to see if entry exists $sql = $default->db; - $sQuery = "INSERT INTO " . $default->owl_discussion_threads_table . + $sQuery = "INSERT INTO " . $default->discussion_threads_table . " (document_id, first_comment_id, last_comment_id, views, replies, creator_id) " . "VALUES (" . $this->iDocumentID . "," . $this->iFirstCommentID . "," . $this->iLastCommentID . "," . $this->iNumberOfViews . "," . $this->iNumberOfReplies ."," . $this->iCreatorID . ")"; $result = $sql->query($sQuery); @@ -212,7 +228,7 @@ class DiscussionThread { $_SESSION["errorMessage"] = $lang_err_database; return false; } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_discussion_threads_table"; + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->discussion_threads_table"; return false; } @@ -224,7 +240,7 @@ class DiscussionThread { //only update if the object has been stored if ($this->iId > 0) { $sql = $default->db; - $sQuery = "UPDATE " . $default->owl_discussion_threads_table . + $sQuery = "UPDATE " . $default->discussion_threads_table . " SET document_id = " . $this->iDocumentID . ", first_comment_id = " . $this->iFirstCommentID . ", last_comment_id = " . $this->iLastCommentID . @@ -256,7 +272,7 @@ class DiscussionThread { if ($this->iId > 0) { //check to see if group is linked to a unit $sql = $default->db; - $query = "SELECT * FROM ". $default->owl_discussion_threads_table ." WHERE id = " . $this->iId ; + $query = "SELECT * FROM ". $default->discussion_threads_table ." WHERE id = " . $this->iId ; $sql->query($query); $rows = $sql->num_rows($sql); @@ -267,7 +283,7 @@ class DiscussionThread { } else { $sql = $default->db; - $result = $sql->query("DELETE FROM $default->owl_discussion_threads_table WHERE id = $this->iId"); + $result = $sql->query("DELETE FROM $default->discussion_threads_table WHERE id = $this->iId"); if ($result) { return true; }