diff --git a/lib/DefaultLookup.inc b/lib/DefaultLookup.inc index 0c3277d..a77508c 100644 --- a/lib/DefaultLookup.inc +++ b/lib/DefaultLookup.inc @@ -81,14 +81,18 @@ class DefaultLookup { global $default; //don't create the object if it's aready been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $this->sTableName (name) VALUES ('$this->sName')"); - if ($result) { - //set the primary key; - $this->iId = $sql->insert_id(); - return true; - } - return false; + $sTable = $this->sTableName; + $aFieldValues = array( + 'name' => $this->sName, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } return false; } diff --git a/lib/archiving/ArchiveRestorationRequest.inc b/lib/archiving/ArchiveRestorationRequest.inc index ffa18d0..8ba16e0 100644 --- a/lib/archiving/ArchiveRestorationRequest.inc +++ b/lib/archiving/ArchiveRestorationRequest.inc @@ -145,15 +145,21 @@ class ArchiveRestorationRequest { global $default; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->archive_restoration_table (document_id, request_user_id, admin_user_id, datetime) " . - "VALUES ($this->iDocumentID, $this->iRequestUserID, $this->iAdminUserID, '$this->dDateTime')"); - if ($result) { - //set the current primary key - $this->iId = $sql->insert_id(); - return true; + $sTable = $default->archive_restoration_table; + $aFieldValues = array( + 'document_id' => $this->iDocumentID, + 'request_user_id' => $this->iRequestUserID, + 'admin_user_id' => $this->iAdminUserID, + 'datetime' => $this->dDateTime, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + return true; } return false; } @@ -260,4 +266,4 @@ class ArchiveRestorationRequest { } return false; } -} \ No newline at end of file +} diff --git a/lib/archiving/ArchivingSettings.inc b/lib/archiving/ArchivingSettings.inc index feadeb5..e90eca5 100644 --- a/lib/archiving/ArchivingSettings.inc +++ b/lib/archiving/ArchivingSettings.inc @@ -144,17 +144,21 @@ class ArchivingSettings { global $default; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $sQuery = "INSERT INTO $default->archiving_settings_table (archiving_type_id, expiration_date, document_transaction_id, time_period_id) " . - "VALUES ($this->iArchivingTypeID, " . $this->addQuotes($this->dExpirationDate) . ", $this->iDocumentTransactionID, $this->iTimePeriodID)"; - $result = $sql->query($sQuery); - $default->log->info($sQuery); - if ($result) { - //set the current primary key - $this->iId = $sql->insert_id(); - return true; + $sTable = $default->archiving_settings_table; + $aFieldValues = array( + 'archiving_type_id' => $this->iArchivingTypeID, + 'expiration_date' => $this->dExpirationDate, + 'document_transaction_id' => $this->iDocumentTransactionID, + 'time_period_id' => $this->iTimePeriodID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + return true; } return false; } @@ -255,4 +259,4 @@ class ArchivingSettings { return false; } } -?> \ No newline at end of file +?> diff --git a/lib/archiving/ArchivingType.inc b/lib/archiving/ArchivingType.inc index 3abd0fe..8dd3cb8 100644 --- a/lib/archiving/ArchivingType.inc +++ b/lib/archiving/ArchivingType.inc @@ -80,15 +80,18 @@ class ArchivingType { global $default; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->archiving_type_lookup_table (name) " . - "VALUES ('$this->sName')"); - if ($result) { - //set the current primary key - $this->iId = $sql->insert_id(); - return true; + $sTable = $default->archiving_type_lookup_table; + $aFieldValues = array( + 'name' => $this->sName, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + return true; } return false; } @@ -175,4 +178,4 @@ class ArchivingType { } return false; } -} \ No newline at end of file +} diff --git a/lib/archiving/DocumentArchiving.inc b/lib/archiving/DocumentArchiving.inc index 87d9ef0..c77870f 100644 --- a/lib/archiving/DocumentArchiving.inc +++ b/lib/archiving/DocumentArchiving.inc @@ -103,15 +103,19 @@ class DocumentArchiving { global $default; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->document_archiving_table (document_id, archiving_settings_id) " . - "VALUES ($this->iDocumentID, $this->iArchivingSettingsID)"); - if ($result) { - //set the current primary key - $this->iId = $sql->insert_id(); - return true; + $sTable = $default->document_archiving_table; + $aFieldValues = array( + 'document_id' => $this->iDocumentID, + 'archiving_settings_id' => $this->iArchivingSettingsID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + return true; } return false; } @@ -218,4 +222,4 @@ class DocumentArchiving { } return false; } -} \ No newline at end of file +} diff --git a/lib/archiving/TimePeriod.inc b/lib/archiving/TimePeriod.inc index 52586fb..f3f0019 100644 --- a/lib/archiving/TimePeriod.inc +++ b/lib/archiving/TimePeriod.inc @@ -101,15 +101,19 @@ class TimePeriod { global $default; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->time_period_table (time_unit_id, units) " . - "VALUES ($this->iTimeUnitID, $this->iUnits)"); - if ($result) { - //set the current primary key - $this->iId = $sql->insert_id(); - return true; + $sTable = $default->time_period_table; + $aFieldValues = array( + 'time_unit_id' => $this->iTimeUnitID, + 'units' => $this->iUnits + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + return true; } return false; } @@ -197,4 +201,4 @@ class TimePeriod { } return false; } -} \ No newline at end of file +} diff --git a/lib/archiving/TimeUnit.inc b/lib/archiving/TimeUnit.inc index dac7dbc..0107b31 100644 --- a/lib/archiving/TimeUnit.inc +++ b/lib/archiving/TimeUnit.inc @@ -80,15 +80,18 @@ class TimeUnit { global $default; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->time_unit_lookup_table (name) " . - "VALUES ('$this->sName')"); - if ($result) { - //set the current primary key - $this->iId = $sql->insert_id(); - return true; + $sTable = $default->time_unit_lookup_table; + $aFieldValues = array( + 'name' => $this->sName, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + return true; } return false; } @@ -175,4 +178,4 @@ class TimeUnit { } return false; } -} \ No newline at end of file +} diff --git a/lib/dashboard/DashboardNews.inc b/lib/dashboard/DashboardNews.inc index 4162de4..985fd9d 100644 --- a/lib/dashboard/DashboardNews.inc +++ b/lib/dashboard/DashboardNews.inc @@ -66,7 +66,7 @@ class DashboardNews { /** * Is this news item active */ - var $bActive; + var $bActive = true; /** * Constructs a news item @@ -226,7 +226,7 @@ class DashboardNews { * @param boolean new active status */ function setActive($bNewActive) { - $this->bActive = $bNewActive; + $this->bActive = KTUtil::anyToBool($bNewActive); } /** @@ -304,22 +304,23 @@ class DashboardNews { global $default; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->news_table (synopsis, body, rank, image, image_size, image_mime_type_id, active) " . - "VALUES ('$this->sSynopsis', '$this->sBody', $this->iRank, " . - "'" . addslashes($this->sImage) . "', $this->iImageSize, $this->iImageMimeTypeID, " . ($this->bActive ? "1" : "0") . ")"); - if ($result) { - //set the current news item primary key - $this->iId = $sql->insert_id(); - -// if ($this->bActive) { -// // we're setting this entry to active, so set all the others to inactive -// $sql->query("UPDATE $default->news_table SET active=0 WHERE id <> $this->iId"); -// } - - return true; + $aFieldValues = array( + 'synopsis' => $this->sSynopsis, + 'body' => $this->sBody, + 'rank' => $this->iRank, + 'image' => $this->sImage, + 'image_size' => $this->iImageSize, + 'image_mime_type_id' => $this->iImageMimeTypeID, + 'active' => $this->bActive, + ); + $id =& DBUtil::autoInsert($default->news_table, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + return true; } return false; } diff --git a/lib/discussions/DiscussionComment.inc b/lib/discussions/DiscussionComment.inc index e3df497..98fef5c 100644 --- a/lib/discussions/DiscussionComment.inc +++ b/lib/discussions/DiscussionComment.inc @@ -194,16 +194,23 @@ class DiscussionComment { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { //check to see if comment exists - $sql = $default->db; - - $result = $sql->query("INSERT INTO " . $default->discussion_comments_table . " (thread_id,user_id,subject, body, date, in_reply_to)" . - "VALUES (" . $this->iThreadID . "," . $this->iUserID . ",\"" . $this->sSubject . "\",\"" . $this->sBody . "\", Now(), " . $this->iInReplyTo . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - return false; - + $sTable = $default->discussion_comments_table; + $aFieldValues = array( + 'thread_id' => $this->iThreadID, + 'user_id' => $this->iUserID, + 'subject' => $this->sSubject, + 'body' => $this->sBody, + 'date' => getCurrentDate(), + 'in_reply_to' => $this->iInReplyTo, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } return false; } diff --git a/lib/discussions/DiscussionThread.inc b/lib/discussions/DiscussionThread.inc index 1591361..22bda9a 100644 --- a/lib/discussions/DiscussionThread.inc +++ b/lib/discussions/DiscussionThread.inc @@ -243,17 +243,23 @@ class DiscussionThread { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { //check to see if entry exists - $sql = $default->db; - $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); - - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - return false; + $sTable = $default->discussion_threads_table; + $aFieldValues = array( + 'document_id' => $this->iDocumentID, + 'first_comment_id' => $this->iFirstCommentID, + 'last_comment_id' => $this->iLastCommentID, + 'views' => $this->iNumberOfViews, + 'replies' => $this->iNumberOfReplies, + 'creator_id' => $this->iCreatorID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } return false; @@ -319,4 +325,4 @@ class DiscussionThread { } } -?> \ No newline at end of file +?> diff --git a/lib/dms.inc b/lib/dms.inc index 1000b30..80e3522 100644 --- a/lib/dms.inc +++ b/lib/dms.inc @@ -29,6 +29,7 @@ * Initialises the web application by making current * request parameters global and loading the default language */ + // make request parameters global if (substr(phpversion(),0,5) >= "4.1.0") { // if supported by the installed version of PHP diff --git a/lib/documentmanagement/DependantDocumentInstance.inc b/lib/documentmanagement/DependantDocumentInstance.inc index f3a44bd..d4144be 100644 --- a/lib/documentmanagement/DependantDocumentInstance.inc +++ b/lib/documentmanagement/DependantDocumentInstance.inc @@ -125,14 +125,22 @@ class DependantDocumentInstance { function create() { global $default; //if the object hasn't been created - if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->dependant_document_instance_table (document_title, user_id,template_document_id, parent_document_id) VALUES ('$this->sDocumentTitle', $this->iUserID, " . (isset($this->iTemplateDocumentID) ? "$this->iTemplateDocumentID" : "NULL") . ", " . $this->iParentDocumentID . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - return false; + if ($this->iId < 0) { + $sTable = $default->dependant_document_instance_table; + $aFieldValues = array( + 'document_title' => $this->sDocumentTitle, + 'user_id' => $this->iUserID, + 'template_document_id' => $this->iTemplateDocumentID, + 'parent_document_id' => $this->iParentDocumentID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } return false; } @@ -203,4 +211,4 @@ class DependantDocumentInstance { } } -?> \ No newline at end of file +?> diff --git a/lib/documentmanagement/DependantDocumentTemplate.inc b/lib/documentmanagement/DependantDocumentTemplate.inc index cff8b46..ad60df7 100644 --- a/lib/documentmanagement/DependantDocumentTemplate.inc +++ b/lib/documentmanagement/DependantDocumentTemplate.inc @@ -134,13 +134,21 @@ class DependantDocumentTemplate { global $default; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->dependant_document_template_table (document_title, default_user_id,template_document_id, group_folder_approval_link_id) VALUES ('$this->sDocumentTitle', $this->iDefaultUserID, " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", $this->iGroupFolderApprovalLinkID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - return false; + $sTable = $default->dependant_document_template_table; + $aFieldValues = array( + 'document_title' => $this->sDocumentTitle, + 'default_user_id' => $this->iDefaultUserID, + 'template_document_id' => $this->iTemplateDocumentID, + 'group_folder_approval_link_id' => $this->iGroupFolderApprovalLinkID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } return false; } @@ -238,4 +246,4 @@ class DependantDocumentTemplate { } } -?> \ No newline at end of file +?> diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index 669f8ce..5b045ef 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -224,7 +224,7 @@ class Document { /** set the document check out status */ function setIsCheckedOut($bNewValue) { - $this->bIsCheckedOut = $bNewValue; + $this->bIsCheckedOut = anyToBool($bNewValue); } /** get the user id that has the document checked out **/ @@ -342,34 +342,36 @@ class Document { global $default, $lang_err_doc_exist, $lang_err_database; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; $this->sFullPath = $this->generateFolderPath($this->iFolderID); $this->sParentFolderIDs = $this->generateFolderIDs($this->iFolderID); - $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 (" . quote($this->iDocumentTypeID) . ", " . - quote($this->sName) . ", " . - quote($this->sFileName) . ", " . - quote($this->iSize) . ", " . - quote($this->iCreatorID) . ", " . - quote(getCurrentDateTime()) . ", " . - quote($this->sDescription) . ", " . - quote($this->iMimeTypeID) . ", " . - quote($this->iFolderID) . ", " . - quote($this->iMajorVersion) . ", " . - quote($this->iMinorVersion) . ", " . - quote($this->bIsCheckedOut) . ", " . - quote($this->iCheckedOutUserID) . ", " . - quote($this->sParentFolderIDs) . ", " . - quote($this->sFullPath) . ", " . - quote($this->iStatusID) . ")"); - if ($result) { - //set the current documents primary key - $this->iId = $sql->insert_id(); - // also insert into search permissions table to enable immediate metadata searching (#2681) - $this->insertDocumentPermissions(); - return true; + $sTable = $default->documents_table; + $aFieldValues = array( + 'document_type_id' => $this->iDocumentTypeID, + 'name' => $this->sName, + 'filename' => $this->sFileName, + 'size' => $this->iSize, + 'creator_id' => $this->iCreatorID, + 'modified' => getCurrentDateTime(), + 'description' => $this->sDescription, + 'mime_id' => $this->iMimeTypeID, + 'folder_id' => $this->iFolderID, + 'major_version' => $this->iMajorVersion, + 'minor_version' => $this->iMinorVersion, + 'is_checked_out' => $this->bIsCheckedOut, + 'checked_out_user_id' => $this->iCheckedOutUserID, + 'parent_folder_ids' => $this->sParentFolderIDs, + 'full_path' => $this->sFullPath, + 'status_id' => $this->iStatusID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } - return false; + $this->iId = $id; + $this->insertDocumentPermissions(); + return true; } return false; @@ -882,4 +884,4 @@ class Document { return $result; } } -?> \ No newline at end of file +?> diff --git a/lib/documentmanagement/DocumentField.inc b/lib/documentmanagement/DocumentField.inc index f9a503c..dda9837 100644 --- a/lib/documentmanagement/DocumentField.inc +++ b/lib/documentmanagement/DocumentField.inc @@ -160,14 +160,21 @@ class DocumentField { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->document_fields_table . " (name, data_type,is_generic,has_lookup) VALUES ('" . $this->sName . "', '" . $this->sDataType . "', '" . $this->bIsGeneric . "', '" . $this->bHasLookup ."')"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->document_fields_table; + $aFieldValues = array( + 'name' => $this->sName, + 'data_type' => $this->sDataType, + 'is_generic' => $this->bIsGeneric, + 'has_lookup' => $this->bHasLookup, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields"; return false; @@ -358,4 +365,4 @@ function & documentfieldCreateFromArray($aParameters) { } -?> \ No newline at end of file +?> diff --git a/lib/documentmanagement/DocumentFieldLink.inc b/lib/documentmanagement/DocumentFieldLink.inc index facbf77..76d722b 100644 --- a/lib/documentmanagement/DocumentFieldLink.inc +++ b/lib/documentmanagement/DocumentFieldLink.inc @@ -131,16 +131,20 @@ class DocumentFieldLink { global $default, $lang_err_doc_exist, $lang_err_database; //if the id >= 0, then the object has already been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->document_fields_link_table . " (document_id, document_field_id, value) " . - "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '$this->sValue')"); - if ($result) { - //set the current documents primary key - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->document_fields_link_table; + $aFieldValues = array( + 'document_id' => $this->iDocumentID, + 'document_field_id' => $this->iDocumentFieldID, + 'value' => $this->sValue, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_fields_link_table"; return false; diff --git a/lib/documentmanagement/DocumentLink.inc b/lib/documentmanagement/DocumentLink.inc index dda1f42..ff908be 100644 --- a/lib/documentmanagement/DocumentLink.inc +++ b/lib/documentmanagement/DocumentLink.inc @@ -108,14 +108,19 @@ class DocumentLink { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO $default->document_link_table (parent_document_id, child_document_id) VALUES ($this->iParentDocumentID, $this->iChildDocumentID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->document_link_table; + $aFieldValues = array( + 'parent_document_id' => $this->iParentDocumentID, + 'child_document_id' => $this->iChildDocumentID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." table = document_fields"; return false; @@ -190,4 +195,4 @@ class DocumentLink { return false; } } -?> \ No newline at end of file +?> diff --git a/lib/documentmanagement/DocumentTransaction.inc b/lib/documentmanagement/DocumentTransaction.inc index 0be1713..d7982ec 100644 --- a/lib/documentmanagement/DocumentTransaction.inc +++ b/lib/documentmanagement/DocumentTransaction.inc @@ -104,17 +104,25 @@ class DocumentTransaction { global $default, $lang_err_object_exists; //if the object hasn't been stored yet if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " . - "VALUES ($this->iDocumentID, '$this->sVersion', $this->iUserID, '$this->dDateTime', '$this->sIP', '$this->sFileName', '$this->sComment', $this->iTransactionID)"); - if ($result) { - //object has been stored, set the primary key - $this->iId = $sql->insert_id(); - return true; - } else { - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + $sTable = $default->document_transactions_table; + $aFieldValues = array( + document_id => $this->iDocumentID, + version => $this->sVersion, + user_id => $this->iUserID, + datetime => $this->dDateTime, + ip => $this->sIP, + filename => $this->sFileName, + comment => $this->sComment, + transaction_id => $this->iTransactionID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } else { $_SESSION["errorMessage"] = $lang_err_object_exists; return false; @@ -193,4 +201,4 @@ class DocumentTransaction { return false; } } -?> \ No newline at end of file +?> diff --git a/lib/documentmanagement/DocumentType.inc b/lib/documentmanagement/DocumentType.inc index 6287e59..a5e9c06 100644 --- a/lib/documentmanagement/DocumentType.inc +++ b/lib/documentmanagement/DocumentType.inc @@ -85,27 +85,18 @@ class DocumentType { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - //check to see if name exsits - $sql = $default->db; - $query = "SELECT name FROM ". $default->document_types_table ." WHERE name = '" . $this->sName . "'"; - $sql->query($query); - $rows = $sql->num_rows($sql); - - if ($rows > 0){ - // duplicate username - $_SESSION["errorMessage"] = "DocTypes::The DocumentType name " . $this->sName . " is already in use!"; - return false; - - }else{ - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->document_types_table . " (name) VALUES ('$this->sName')"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + $sTable = $default->document_types_table; + $aFieldValues = array( + 'name' => $this->sName, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_types"; diff --git a/lib/documentmanagement/DocumentTypeFieldLink.inc b/lib/documentmanagement/DocumentTypeFieldLink.inc index 8648dad..7e6599d 100644 --- a/lib/documentmanagement/DocumentTypeFieldLink.inc +++ b/lib/documentmanagement/DocumentTypeFieldLink.inc @@ -135,26 +135,28 @@ class DocumentTypeFieldLink { //check to see if name exsits $sql = $default->db; $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); + $sql->query($query); + $rows = $sql->num_rows($sql); - if ($rows > 0){ - // duplicate username - $_SESSION["errorMessage"] = "DocTypes::The DocumentType name " . $this->sName . " is already in use!"; - return false; - - }else{ - $sql = $default->db; - $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 - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + if ($rows > 0){ + $_SESSION["errorMessage"] = "DocTypes::The DocumentType name " . $this->sName . " is already in use!"; + return false; + } + + $sTable = $default->document_type_fields_table; + $aFieldValues = array( + 'document_type_id' => $this->iDocumentTypeID, + 'field_id' => $this->iFieldID, + 'is_mandatory' => $this->bIsMandatory, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_type_fields_table"; return false; diff --git a/lib/documentmanagement/MetaData.inc b/lib/documentmanagement/MetaData.inc index 8caef47..46a99a1 100644 --- a/lib/documentmanagement/MetaData.inc +++ b/lib/documentmanagement/MetaData.inc @@ -113,24 +113,27 @@ class MetaData { //check to see if name exsits $sql = $default->db; $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); + $sql->query($query); + $rows = $sql->num_rows($sql); - if ($rows > 0){ - // duplicate username - $_SESSION["errorMessage"] = "MetaData::TheMetaData name " . $this->sName . " for the specfic field exists already!"; - return false; - - }else{ - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','$this->sName')"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + if ($rows > 0){ + $_SESSION["errorMessage"] = "MetaData::TheMetaData name " . $this->sName . " for the specfic field exists already!"; + return false; + } + + $sTable = $default->metadata_table; + $aFieldValues = array( + 'document_field_id' => $this->iDocFieldID, + 'name' => $this->sName, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_types"; diff --git a/lib/foldermanagement/Folder.inc b/lib/foldermanagement/Folder.inc index 161fe15..62e0a53 100644 --- a/lib/foldermanagement/Folder.inc +++ b/lib/foldermanagement/Folder.inc @@ -278,22 +278,34 @@ class Folder { * @return boolean true and set $this->iId with new primary key, false otherwise and set $_SESSION["errorMessage"] */ function create() { - global $default, $lang_err_database; $lang_err_object_exists; - //if the object has not already been stored + global $default; + if ($this->iId < 0) { $this->sFullPath = $this->generateFolderPath($this->iParentID); $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID); - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->folders_table . " (name, description, parent_id, creator_id, unit_id, is_public, full_path, parent_folder_ids, inherit_parent_folder_permission) " . - "VALUES ('$this->sName', '$this->sDescription', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'$this->sFullPath','$this->sParentFolderIDs'," . ($this->bInheritParentPermissions ? "1" : "0") . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + + $aFieldValues = array( + 'name' => $this->sName, + 'description' => $this->sDescription, + 'parent_id' => $this->iParentID, + 'creator_id' => $this->iCreatorID, + 'unit_id' => $this->iUnitID, + 'is_public' => $this->bIsPublic, + 'full_path' => $this->sFullPath, + 'parent_folder_ids' => $this->sParentFolderIDs, + 'inherit_parent_folder_permission' => $this->bInheritParentPermissions, + ); + $id =& DBUtil::autoInsert($default->folders_table, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders"; + + $_SESSION["errorMessage"] = "Can't create object that already exists" . "id = " . $this->iId . " table = $default->folders_table"; return false; } @@ -735,4 +747,4 @@ class Folder { } } } -?> \ No newline at end of file +?> diff --git a/lib/foldermanagement/FolderCollaboration.inc b/lib/foldermanagement/FolderCollaboration.inc index 33a4111..5c3206c 100644 --- a/lib/foldermanagement/FolderCollaboration.inc +++ b/lib/foldermanagement/FolderCollaboration.inc @@ -104,14 +104,22 @@ class FolderCollaboration { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->groups_folders_approval_table . " (folder_id, group_id, precedence, role_id, user_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iSequenceNumber, $this->iRoleID, $this->iUserID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->groups_folders_approval_table; + $aFieldValues = array( + 'folder_id' => $this->iFolderID, + 'group_id' => $this->iGroupID, + 'precedence' => $this->iSequenceNumber, + 'role_id' => $this->iRoleID, + 'user_id' => $this->iUserID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_folders_approval_table"; return false; diff --git a/lib/foldermanagement/FolderDocTypeLink.inc b/lib/foldermanagement/FolderDocTypeLink.inc index c1812f1..58fedf1 100644 --- a/lib/foldermanagement/FolderDocTypeLink.inc +++ b/lib/foldermanagement/FolderDocTypeLink.inc @@ -48,15 +48,19 @@ class FolderDocTypeLink { global $default, $lang_err_database; $lang_err_object_exists; //if the object has not already been stored if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->folder_doctypes_table . " (folder_id, document_type_id) " . - "VALUES ($this->iFolderID, $this->iDocumentTypeID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->folder_doctypes_table; + $aFieldValues = array( + 'folder_id' => $this->iFolderID, + 'document_type_id' => $this->iDocumentTypeID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders"; return false; diff --git a/lib/foldermanagement/FolderUserRole.inc b/lib/foldermanagement/FolderUserRole.inc index d3764e1..105de75 100644 --- a/lib/foldermanagement/FolderUserRole.inc +++ b/lib/foldermanagement/FolderUserRole.inc @@ -118,14 +118,24 @@ class FolderUserRole { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->folders_user_roles_table . " (user_id, document_id, group_folder_approval_id, datetime, done, active, dependant_documents_created) VALUES ($this->iUserID, $this->iDocumentID, $this->iGroupFolderApprovalID, '$this->dDateTime', " . ($this->bDone ? "1" : "0") . ", " . ($this->bActive ? "1" : "0") . ", " . (($this->bDependantDocumentsCreated) ? "1" : "0") . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->folders_user_roles_table; + $aFieldValues = array( + 'user_id' => $this->iUserID, + 'document_id' => $this->iDocumentID, + 'group_folder_approval_id' => $this->iGroupFolderApprovalID, + 'datetime' => $this->dDateTime, + 'done' => $this->bDone, + 'active' => $this->bActive, + 'dependant_documents_created' => $this->bDependantDocumentsCreated, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders_users_roles_link"; return false; diff --git a/lib/groups/Group.inc b/lib/groups/Group.inc index e848e21..445fa1c 100644 --- a/lib/groups/Group.inc +++ b/lib/groups/Group.inc @@ -135,25 +135,20 @@ class Group { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - //check to see if name exsits - $sql = $default->db; - $query = "SELECT name FROM ". $default->groups_table ." WHERE name = '" . $this->sName . "'"; - $sql->query($query); - $rows = $sql->num_rows(); - if ($rows > 0) { - // duplicate username - $_SESSION["errorMessage"] = "Group::The Group name " . $this->sName . " is already in use!"; - return false; - } else { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->groups_table . " (name, is_sys_admin, is_unit_admin) VALUES ('$this->sName', " . ($this->bIsSysAdmin ? 1 : 0) . ", " . ($this->bIsUnitAdmin ? 1 : 0) . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + $sTable = $default->groups_table; + $aFieldValues = array( + 'name' => $this->sName, + 'is_sys_admin' => $this->bIsSysAdmin, + 'is_unit_admin' => $this->bIsUnitAdmin, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields"; return false; diff --git a/lib/groups/GroupFolderApprovalLink.inc b/lib/groups/GroupFolderApprovalLink.inc index eadd36c..a742b8f 100644 --- a/lib/groups/GroupFolderApprovalLink.inc +++ b/lib/groups/GroupFolderApprovalLink.inc @@ -148,14 +148,21 @@ class GroupFolderApprovalLink { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->groups_folders_approval_table . " (folder_id, group_id, precedence, role_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iPrecedence, $this->iRoleID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->groups_folders_approval_table; + $aFieldValues = array( + 'folder_id' => $this->iFolderID, + 'group_id' => $this->iGroupID, + 'precedence' => $this->iPrecedence, + 'role_id' => $this->iRoleID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields"; return false; diff --git a/lib/groups/GroupFolderLink.inc b/lib/groups/GroupFolderLink.inc index b82276d..7669afc 100644 --- a/lib/groups/GroupFolderLink.inc +++ b/lib/groups/GroupFolderLink.inc @@ -93,14 +93,21 @@ class GroupFolderLink { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->groups_folders_table . " (folder_id, group_id, can_read, can_write) VALUES ($this->iFolderID, $this->iGroupID, " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->groups_folders_table; + $aFieldValues = array( + 'folder_id' => $this->iFolderID, + 'group_id' => $this->iGroupID, + 'can_read' => $this->bCanRead, + 'can_write' => $this->bCanWrite, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_folders_table"; return false; diff --git a/lib/groups/GroupUnitLink.inc b/lib/groups/GroupUnitLink.inc index aa9a81b..e308b81 100644 --- a/lib/groups/GroupUnitLink.inc +++ b/lib/groups/GroupUnitLink.inc @@ -103,27 +103,28 @@ class GroupUnitLink { { $sql = $default->db; $query = "SELECT unit_id, group_id FROM ". $default->groups_units_table ." WHERE unit_id = '" . $this->iUnitID . "' and group_id = '". $this->iGroupID ."'"; - $sql->query($query); - $rows = $sql->num_rows($sql); + $sql->query($query); + $rows = $sql->num_rows($sql); - if ($rows > 0) - { - // duplicate username - $_SESSION["errorMessage"] = "GroupUnitlink::The id " . $this->iUnitID . " already exists!"; - return false; - } - else - { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->groups_units_table . " (group_id, unit_id) VALUES ($this->iGroupID, $this->iUnitID)"); - if ($result) - { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + if ($rows > 0) + { + $_SESSION["errorMessage"] = "GroupUnitlink::The id " . $this->iUnitID . " already exists!"; + return false; + } + + $sTable = $default->groups_units_table; + $aFieldValues = array( + 'group_id' => $this->iGroupID, + 'unit_id' => this->iUnitID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_units_table"; return false; diff --git a/lib/groups/GroupUserLink.inc b/lib/groups/GroupUserLink.inc index 170ec08..769005d 100644 --- a/lib/groups/GroupUserLink.inc +++ b/lib/groups/GroupUserLink.inc @@ -102,23 +102,28 @@ class GroupUserLink { if ($this->iId < 0) { $sql = $default->db; $query = "SELECT user_id, group_id FROM ". $default->users_groups_table ." WHERE user_id = '" . $this->iUserID . "' and group_id = '". $this->iGroupID ."'"; - $sql->query($query); - $rows = $sql->num_rows($sql); + $sql->query($query); + $rows = $sql->num_rows($sql); - if ($rows > 0){ - // duplicate username - $_SESSION["errorMessage"] = "GroupUserLink::The id " . $this->iUnitID . " already exists!"; - return false; - } else { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->users_groups_table . " (group_id, user_id) VALUES ($this->iGroupID, $this->iUserID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + if ($rows > 0){ + // duplicate username + $_SESSION["errorMessage"] = "GroupUserLink::The id " . $this->iUnitID . " already exists!"; + return false; + } + + $sTable = $default->users_groups_table; + $aFieldValues = array( + 'group_id' => $this->iGroupID, + 'user_id' => $this->iUserID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->users_groups_table"; return false; @@ -300,4 +305,4 @@ class GroupUserLink { $this->iId = $id; } } -?> \ No newline at end of file +?> diff --git a/lib/links/Link.inc b/lib/links/Link.inc index 0a0cae7..b8c8c30 100644 --- a/lib/links/Link.inc +++ b/lib/links/Link.inc @@ -80,35 +80,38 @@ class Link { //check to see if name exsits $sql = $default->db; $query = "SELECT name FROM ". $default->quicklinks_table ." WHERE name = '" . $this->sName . "'"; - $sql->query($query); - $rows = $sql->num_rows($sql); + $sql->query($query); + $rows = $sql->num_rows($sql); - if ($rows > 0){ - // duplicate username - $_SESSION["errorMessage"] = "Link::The Link name " . $this->sName . " is already in use!"; - return false; - - }else{ - $sql = $default->db; - $query = "SELECT rank FROM ". $default->quicklinks_table ." WHERE rank = '" . $this->iRank . "'"; - $sql->query($query); - $rows = $sql->num_rows($sql); + if ($rows > 0){ + $_SESSION["errorMessage"] = "Link::The Link name " . $this->sName . " is already in use!"; + return false; + } + + $sql = $default->db; + $query = "SELECT rank FROM ". $default->quicklinks_table ." WHERE rank = '" . $this->iRank . "'"; + $sql->query($query); + $rows = $sql->num_rows($sql); - if ($rows > 0){ - // duplicate username - $_SESSION["errorMessage"] = "Link::The Rank " . $this->iRank . " is already in use!"; - return false; - - }else{ - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->quicklinks_table . " (name, url, rank) VALUES ('$this->sName', '$this->sUrl', $this->iRank)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + if ($rows > 0){ + $_SESSION["errorMessage"] = "Link::The Rank " . $this->iRank . " is already in use!"; + return false; + } + + $sTable = $default->quicklinks_table; + $aFieldValues = array( + 'name' => $this->sName, + 'url' => $this->sUrl, + 'rank' => $this->iRank, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields"; diff --git a/lib/orgmanagement/Organisation.inc b/lib/orgmanagement/Organisation.inc index da0795e..c5cdb23 100644 --- a/lib/orgmanagement/Organisation.inc +++ b/lib/orgmanagement/Organisation.inc @@ -71,24 +71,18 @@ class Organisation { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - //check to see if name exsits - $sql = $default->db; - $query = "SELECT name FROM ". $default->organisations_table ." WHERE name = '" . $this->sName . "'"; - $sql->query($query); - $rows = $sql->num_rows($sql); - if ($rows > 0) { - // duplicate username - $_SESSION["errorMessage"] = "Organisation::The name " . $this->sName . " is already in use!"; - return false; - } else { - $result = $sql->query("INSERT INTO " . $default->organisations_table . " (name) VALUES ('$this->sName')"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; + $sTable = $default->organisations_table; + $aFieldValues = array( + 'name' => $this->sName, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); return false; } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->organisations_table"; return false; @@ -224,4 +218,4 @@ function & organisationCreateFromArray($aParameters) { $oOrg = & new Organisation($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); return $oOrg; } -?> \ No newline at end of file +?> diff --git a/lib/roles/Role.inc b/lib/roles/Role.inc index d18b677..4529fe7 100644 --- a/lib/roles/Role.inc +++ b/lib/roles/Role.inc @@ -100,26 +100,21 @@ class Role { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - //check to see if name exsits - $sql = $default->db; - $query = "SELECT name FROM ". $default->roles_table ." WHERE name = '" . $this->sName . "'"; - $sql->query($query); - $rows = $sql->num_rows($sql); - - if ($rows > 0){ - // duplicate username - $_SESSION["errorMessage"] = "Role::The Role name " . $this->sName . " is already in use!"; - return false; - }else - { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->roles_table . " (name, active, can_read, can_write) VALUES ('$this->sName', " . ($this->bActive ? 1 : 0) . ", " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->roles_table; + $aFieldValues = array( + 'name' => $this->sName, + 'active' => $this->bActive, + 'can_read' => $this->bCanRead, + 'can_write' => $this->bCanWrite, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields"; diff --git a/lib/roles/RoleFolderLink.inc b/lib/roles/RoleFolderLink.inc index 9331627..2fc2f7d 100644 --- a/lib/roles/RoleFolderLink.inc +++ b/lib/roles/RoleFolderLink.inc @@ -176,14 +176,23 @@ class RoleFolderLink { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->folders_user_roles_table . " (user_id, folder_id, role_type_id, datetime, done, active) VALUES ($this->iUserID, $this->iFolderID, $this->iRoleTypeID, '$this->dDateTime', " . ($this->bDone ? 1 : 0) . "), " . ($this->bActive ? 1 : 0) . ")"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $sTable = $default->folders_user_roles_table; + $aFieldValues = array( + 'user_id' => $this->iUserID, + 'folder_id' => $this->iFolderID, + 'role_type_id' => $this->iRoleTypeID, + 'datetime' => $this->dDateTime, + 'done' => $this->bDone, + 'active' => $this->bActive, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } return false; } diff --git a/lib/session/SiteMap.inc b/lib/session/SiteMap.inc index a2b76b2..55bf51e 100644 --- a/lib/session/SiteMap.inc +++ b/lib/session/SiteMap.inc @@ -656,26 +656,38 @@ class SiteMap { // for each section foreach ($this->aSiteMap as $section => $valArr) { // insert into the section - $sSectionSql = "INSERT INTO $default->site_sections_table (name) VALUES ('$section')"; - $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql"); + $aFieldValue = array( + 'name' => $section, + ); + $id =& DBUtil::autoInsert($default->site_sections_table, $aFieldValues); - if ($sql->query($sSectionSql)) { - $sectionID = $sql->insert_id(); - $default->log->debug("Sitemap::syncWithDB added section $section; $sectionID"); - } else { + // $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql"); + + if (PEAR::isError($id)) { $default->log->error("Sitemap::syncWithDB add section $section failed"); + } else { + $sectionID = $id; + $default->log->debug("Sitemap::syncWithDB added section $section; $sectionID"); } // for each group, page array combination foreach ($valArr as $requiredAccess => $pageArr) { // now loop through all the pages foreach ($pageArr as $action => $page) { - $sSiteMapSql = "INSERT INTO $default->sitemap_table (action, page, section_id, access_id, link_text, is_default, is_enabled) " . - "VALUES ('$action', '" . $page["page"] . "', $sectionID, $requiredAccess, '" . $page["description"] . "', " . $page["default"] . ", " . $page["enabled"] . ")"; - if ($sql->query($sSiteMapSql)) { - $default->log->debug("Sitemap::syncWithDb sitemap insert worked for ($action, " . $page["page"] . ")"); - } else { + $aFieldValues = array( + action => $action, + page => $page["page"], + section_id => $sectionID, + access_id => $requiredAccess, + link_text => $page["description"], + is_default => $page["default"], + is_enabled => $page["enabled"], + ); + $id =& DBUtil::autoInsert($default->sitemap_table, $aFieldValues); + if (PEAR::isError($id)) { $default->log->debug("Sitemap::syncWithDB sitemap insert failed ($sSiteMapSql)"); + } else { + $default->log->debug("Sitemap::syncWithDb sitemap insert worked for ($action, " . $page["page"] . ")"); } } } diff --git a/lib/subscriptions/Subscription.inc b/lib/subscriptions/Subscription.inc index f1f69df..c395d09 100644 --- a/lib/subscriptions/Subscription.inc +++ b/lib/subscriptions/Subscription.inc @@ -206,15 +206,19 @@ class Subscription { $lang_err_object_exists; //if the object has not already been stored if ($this->iID < 0) { - $sql = $default->db; - // TODO: set table name and id_field_name - if ($sql->query("INSERT INTO " . $this->sTableName . " (user_id, $this->sIdFieldName, is_alerted) " . - "VALUES ($this->iUserID, $this->iExternalID, " . (int)$this->bIsAlerted . ")")) { - $this->iID = $sql->insert_id(); - return true; - } else { - $_SESSION["errorMessage"] = $lang_err_database; + $aFieldValues = array( + 'user_id' => $this->iUserID, + $this->sIdFieldName => $this->iExternalID, + 'is_alerted' => $this->bIsAlerted, + ); + $id =& DBUtil::autoInsert($this->sTableName, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; } + $this->iId = $id; + return true; } else { $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iID . " table = $this->sTableName"; } diff --git a/lib/unitmanagement/Unit.inc b/lib/unitmanagement/Unit.inc index 00c94e7..7259f6b 100644 --- a/lib/unitmanagement/Unit.inc +++ b/lib/unitmanagement/Unit.inc @@ -89,35 +89,41 @@ class Unit { $_SESSION["errorMessage"] = "Unit::The name " . $this->sName . " is already in use!"; return false; } else { - $result = $sql->query("INSERT INTO " . $default->units_table . " (name) VALUES ('$this->sName')"); - if ($result) { - $this->iId = $sql->insert_id(); - // create a new unit root folder - // FIXME: lookup the organisation for this unit and use the appropriate folder id for the org root folder - $oFolder = new Folder($this->sName, $this->sName . " Unit Root Folder", 1, $_SESSION["userID"], $this->iId); - if (!$oFolder->exists()) { - if ($oFolder->create()) { - if (PhysicalFolderManagement::createFolder(Folder::getFolderPath($oFolder->getID()))) { - return true; - } else { - return false; - } - } else { - return false; - } + $sTable = $default->units_table; + $aFieldValues = array( + 'name' => $this->sName, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + + // create a new unit root folder + // FIXME: lookup the organisation for this unit and use the appropriate folder id for the org root folder + $oFolder = new Folder($this->sName, $this->sName . " Unit Root Folder", 1, $_SESSION["userID"], $this->iId); + if (!$oFolder->exists()) { + if ($oFolder->create()) { + if (PhysicalFolderManagement::createFolder(Folder::getFolderPath($oFolder->getID()))) { + return true; + } else { + return false; + } } else { - // a unit root folder already exists in the database - // update the description - $aFolders = Folder::getList("name='" . addslashes($this->sName) . "' AND parent_id=1"); - $oFolder = $aFolders[0]; - $oFolder->setDescription($this->sName . " Unit Root Folder"); - $oFolder->setUnitID($this->iId); - $oFolder->update(); - return true; + return false; } + } else { + // a unit root folder already exists in the database + // update the description + $aFolders = Folder::getList("name='" . addslashes($this->sName) . "' AND parent_id=1"); + $oFolder = $aFolders[0]; + $oFolder->setDescription($this->sName . " Unit Root Folder"); + $oFolder->setUnitID($this->iId); + $oFolder->update(); + return true; } - $_SESSION["errorMessage"] = $lang_err_database; - return false; } } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->units_table"; diff --git a/lib/unitmanagement/UnitOrganisationLink.inc b/lib/unitmanagement/UnitOrganisationLink.inc index 18aa6e8..f7e898d 100644 --- a/lib/unitmanagement/UnitOrganisationLink.inc +++ b/lib/unitmanagement/UnitOrganisationLink.inc @@ -113,15 +113,21 @@ class UnitOrganisationLink { // duplicate username $_SESSION["errorMessage"] = "UnitOrganisationlink::The id " . $this->iUnitID . " is already exist!"; return false; - } else{ - $result = $sql->query("INSERT INTO " . $default->units_organisations_table . " (unit_id,organisation_id) VALUES ($this->iUnitID,$this->iOrgID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } + } + + $sTable = $default->units_organisations_table; + $aFieldValues = array( + 'unit_id' => $this->iUnitID, + 'organisation_id' => $this->iOrgID, + ); + $id =& DBUtil::autoInsert($sTable, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } return false; } @@ -264,4 +270,4 @@ class UnitOrganisationLink { } } } -?> \ No newline at end of file +?> diff --git a/lib/users/User.inc b/lib/users/User.inc index cc38714..349c0f4 100644 --- a/lib/users/User.inc +++ b/lib/users/User.inc @@ -311,27 +311,27 @@ class User { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - //check to see if name exsits - $sql = $default->db; - $query = "SELECT username FROM ". $default->users_table ." WHERE username = '" . $this->sUserName . "'"; - $sql->query($query); - $rows = $sql->num_rows($sql); - - if ($rows > 0) { - // duplicate username - $_SESSION["errorMessage"] = "User::The username " . $this->sUserName . " is already in use!"; - return false; - } - else { - $result = $sql->query("INSERT INTO " . $default->users_table . " (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) " . - "VALUES ('$this->sUserName', '$this->sName', '" . md5($this->sPassword) . "', $this->iQuotaMax, 0, '$this->sEmail', '$this->sMobile', " . ($this->bEmailNotification ? 1 : 0) . ", " . ($this->bSmsNotification ? 1 : 0) . ", '$this->sLdapDn', $this->iMaxSessions, $this->iLanguageID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; + $aFieldValues = array( + username => $this->sUserName, + name => $this->sName, + password => md5($this->sPassword), + quota_max => $this->iQuotaMax, + quota_current => 0, + email => $this->sEmail, + mobile => $this->sMobile, + email_notification => $this->bEmailNotification, + sms_notification => $this->bSmsNotification, + ldap_dn => $this->sLdapDn, + max_sessions => $this->iMaxSessions, + language_id => $this->iLanguageID, + ); + $id = DBUtil::autoInsert($default->users_table, $aFieldValues); + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); return false; } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->users_table"; return false; diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index 3f31d34..df3b66d 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -34,6 +34,43 @@ class KTUtil { } } } + + function strToBool ($sString, $null = false, $empty = false) { + $sString = strtoupper($sString); + if ($sString == "Y") { + return true; + } elseif (($sString == "N")) { + return false; + } elseif (($sString == "")) { + return $empty; + } else { + return $null; + } + } + + + function anyToBool ($sString, $null = false) { + if (is_bool($sString)) { + return $sString; + } + + if (is_string($sString)) { + if (strToBool($sString) === true) { + return true; + } + } + + if (is_int($sString)) { + return intToBool($sString); + } + + if (is_null($sString)) { + return $null; + } + + return false; + } + } // }}} diff --git a/lib/web/WebDocument.inc b/lib/web/WebDocument.inc index 0e8763f..7c9fe41 100644 --- a/lib/web/WebDocument.inc +++ b/lib/web/WebDocument.inc @@ -109,14 +109,22 @@ class WebDocument { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->web_documents_table . " (document_id, web_site_id, unit_id, status_id, datetime) VALUES ($this->iDocumentID, $this->iWebSiteID, $this->iUnitID, $this->iStatusID, '$this->dDateTime')"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; + $aFieldValues = array( + document_id => $this->iDocumentID, + web_site_id => $this->iWebSiteID, + unit_id => $this->iUnitID, + status_id => $this->iStatusID, + datetime => $this->dDateTime, + ); + + $id =& DBUtil::autoInsert($default->web_documents_table, $aFieldValues); + + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); + return false; + } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields"; return false; diff --git a/lib/web/WebSite.inc b/lib/web/WebSite.inc index c6656fb..33b7499 100644 --- a/lib/web/WebSite.inc +++ b/lib/web/WebSite.inc @@ -133,27 +133,19 @@ class WebSite { global $default, $lang_err_database, $lang_err_object_exists; //if the object hasn't been created if ($this->iId < 0) { - //check to see if name exsits - $sql = $default->db; - $query = "SELECT web_site_name FROM ". $default->web_sites_table ." WHERE web_site_name = '" . $this->sWebSiteName . "' and web_site_url = '" . $this->sWebSiteURL . "' and web_master_id = '" . $this->iWebMasterID . "'"; - $sql->query($query); - $rows = $sql->num_rows($sql); - if ($rows > 0) { - // duplicate username - $_SESSION["errorMessage"] = "Website::The Wesbite name " . $this->sWebSiteName . " is already in use!"; - return false; - - } else { + $aFieldValues = array( + 'web_site_name' => $this->sWebSiteName, + 'web_site_url' => $this->sWebSiteURL, + 'web_master_id' => $this->iWebMasterID, + ); + $id =& DBUtil::autoInsert($default->web_sites_table, $aFieldValues); - $sql = $default->db; - $result = $sql->query("INSERT INTO " . $default->web_sites_table . " (web_site_name, web_site_url, web_master_id) VALUES ('$this->sWebSiteName', '$this->sWebSiteURL', $this->iWebMasterID)"); - if ($result) { - $this->iId = $sql->insert_id(); - return true; - } - $_SESSION["errorMessage"] = $lang_err_database; + if (PEAR::isError($id)) { + $_SESSION["errorMessage"] = $id->toString(); return false; } + $this->iId = $id; + return true; } $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->web_sites_table"; return false; diff --git a/sql/mysql/install/tables.sql b/sql/mysql/install/tables.sql index 7dba7d0..d2dbaee 100644 --- a/sql/mysql/install/tables.sql +++ b/sql/mysql/install/tables.sql @@ -1,721 +1,2052 @@ --- table definitions -CREATE TABLE active_sessions ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -user_id INTEGER, -session_id CHAR(255), -lastused DATETIME, -ip CHAR(30) -) TYPE = InnoDB; -ALTER TABLE active_sessions ADD INDEX session_id_idx (session_id); +-- phpMyAdmin SQL Dump +-- version 2.6.0-pl3 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Dec 01, 2004 at 03:14 PM +-- Server version: 4.0.22 +-- PHP Version: 4.3.9-1 +-- +-- Database: `pristinedms` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `active_sessions` +-- + +CREATE TABLE active_sessions ( + id int(11) NOT NULL default '0', + user_id int(11) default NULL, + session_id char(255) default NULL, + lastused datetime default NULL, + ip char(30) default NULL, + UNIQUE KEY id (id), + KEY session_id_idx (session_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `archive_restoration_request` +-- CREATE TABLE archive_restoration_request ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_id INTEGER NOT NULL, -request_user_id INTEGER NOT NULL, -admin_user_id INTEGER NOT NULL, -datetime DATETIME NOT NULL -) TYPE = InnoDB; - -CREATE TABLE archiving_type_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) -) TYPE = InnoDB; - -CREATE TABLE archiving_settings ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -archiving_type_id INTEGER NOT NULL, -expiration_date DATE, -document_transaction_id INTEGER, -time_period_id INTEGER -) TYPE = InnoDB; - -CREATE TABLE data_types ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(255) NOT NULL -)TYPE = InnoDB; - -CREATE TABLE dependant_document_instance ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_title TEXT NOT NULL, -user_id INTEGER NOT NULL, -template_document_id INTEGER, -parent_document_id INTEGER -) TYPE = InnoDB; - -CREATE TABLE dependant_document_template ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_title TEXT NOT NULL, -default_user_id INTEGER NOT NULL, -template_document_id INTEGER, -group_folder_approval_link_id INTEGER -) TYPE = InnoDB; - -CREATE TABLE discussion_threads ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_id INTEGER NOT NULL, -first_comment_id INTEGER NOT NULL, -last_comment_id INTEGER NOT NULL, -views INTEGER NOT NULL, -replies INTEGER NOT NULL, -creator_id INTEGER NOT NULL -)TYPE = InnoDB; - -CREATE TABLE discussion_comments ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -thread_id INTEGER NOT NULL, -in_reply_to INTEGER, -user_id INTEGER NOT NULL, -subject TEXT, -body TEXT, -date datetime -)TYPE = InnoDB; - -CREATE TABLE documents ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_type_id INTEGER NOT NULL, -name TEXT NOT NULL, -filename TEXT NOT NULL, -size BIGINT NOT NULL, -creator_id INTEGER NOT NULL, -modified DATETIME NOT NULL, -description CHAR(200) NOT NULL, -security INTEGER NOT NULL, -mime_id INTEGER NOT NULL, -folder_id INTEGER NOT NULL, -major_version INTEGER NOT NULL, -minor_version INTEGER NOT NULL, -is_checked_out BIT NOT NULL, -parent_folder_ids TEXT, -full_path TEXT, -checked_out_user_id INTEGER, -status_id INTEGER -)TYPE = InnoDB; -ALTER TABLE documents ADD INDEX fk_document_type_id (document_type_id); -ALTER TABLE documents ADD INDEX fk_creator_id (creator_id); -ALTER TABLE documents ADD INDEX fk_folder_id (folder_id); -ALTER TABLE documents ADD INDEX fk_checked_out_user_id (checked_out_user_id); -ALTER TABLE documents ADD INDEX fk_status_id (status_id); - -CREATE TABLE document_archiving_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_id INTEGER NOT NULL, -archiving_settings_id INTEGER NOT NULL -) TYPE = InnoDB; - -CREATE TABLE document_fields ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(255) NOT NULL, -data_type CHAR(100) NOT NULL, -is_generic BIT, -has_lookup BIT -)TYPE = InnoDB; - -CREATE TABLE document_fields_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_id INTEGER NOT NULL, -document_field_id INTEGER NOT NULL, -value CHAR(255) NOT NULL -)TYPE = InnoDB; - -CREATE TABLE document_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -parent_document_id INTEGER NOT NULL, -child_document_id INTEGER NOT NULL -) TYPE = InnoDB; - -CREATE TABLE document_subscriptions ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -user_id INTEGER NOT NULL, -document_id INTEGER NOT NULL, -is_alerted BIT -)TYPE = InnoDB; + id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + request_user_id int(11) NOT NULL default '0', + admin_user_id int(11) NOT NULL default '0', + datetime datetime NOT NULL default '0000-00-00 00:00:00', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `archiving_settings` +-- + +CREATE TABLE archiving_settings ( + id int(11) NOT NULL default '0', + archiving_type_id int(11) NOT NULL default '0', + expiration_date date default NULL, + document_transaction_id int(11) default NULL, + time_period_id int(11) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `archiving_type_lookup` +-- + +CREATE TABLE archiving_type_lookup ( + id int(11) NOT NULL default '0', + name char(100) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `data_types` +-- + +CREATE TABLE data_types ( + id int(11) NOT NULL default '0', + name char(255) NOT NULL default '', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dependant_document_instance` +-- + +CREATE TABLE dependant_document_instance ( + id int(11) NOT NULL default '0', + document_title text NOT NULL, + user_id int(11) NOT NULL default '0', + template_document_id int(11) default NULL, + parent_document_id int(11) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dependant_document_template` +-- + +CREATE TABLE dependant_document_template ( + id int(11) NOT NULL default '0', + document_title text NOT NULL, + default_user_id int(11) NOT NULL default '0', + template_document_id int(11) default NULL, + group_folder_approval_link_id int(11) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `discussion_comments` +-- + +CREATE TABLE discussion_comments ( + id int(11) NOT NULL default '0', + thread_id int(11) NOT NULL default '0', + in_reply_to int(11) default NULL, + user_id int(11) NOT NULL default '0', + subject text, + body text, + date datetime default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `discussion_threads` +-- + +CREATE TABLE discussion_threads ( + id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + first_comment_id int(11) NOT NULL default '0', + last_comment_id int(11) NOT NULL default '0', + views int(11) NOT NULL default '0', + replies int(11) NOT NULL default '0', + creator_id int(11) NOT NULL default '0', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_archiving_link` +-- + +CREATE TABLE document_archiving_link ( + id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + archiving_settings_id int(11) NOT NULL default '0', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_fields` +-- + +CREATE TABLE document_fields ( + id int(11) NOT NULL default '0', + name char(255) NOT NULL default '', + data_type char(100) NOT NULL default '', + is_generic tinyint(1) default NULL, + has_lookup tinyint(1) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_fields_link` +-- + +CREATE TABLE document_fields_link ( + id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + document_field_id int(11) NOT NULL default '0', + value char(255) NOT NULL default '', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_link` +-- + +CREATE TABLE document_link ( + id int(11) NOT NULL default '0', + parent_document_id int(11) NOT NULL default '0', + child_document_id int(11) NOT NULL default '0', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_subscriptions` +-- + +CREATE TABLE document_subscriptions ( + id int(11) NOT NULL default '0', + user_id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + is_alerted tinyint(1) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_text` +-- CREATE TABLE document_text ( - id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, - document_id integer, - document_text MEDIUMTEXT, - FULLTEXT (document_text), - KEY document_text_document_id_indx (document_id) -) Type = MyISAM; - -CREATE TABLE document_transactions ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_id INTEGER NOT NULL, -version CHAR(50), -user_id INTEGER NOT NULL, -datetime DATETIME NOT NULL, -ip CHAR(30), -filename CHAR(255) NOT NULL, -comment CHAR(255) NOT NULL, -transaction_id INTEGER -)TYPE = InnoDB; -ALTER TABLE document_transactions ADD INDEX fk_document_id (document_id); -ALTER TABLE document_transactions ADD INDEX fk_user_id (user_id); -ALTER TABLE document_transactions ADD INDEX fk_transaction_id (transaction_id); - -CREATE TABLE document_transaction_types_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) NOT NULL -)TYPE = InnoDB; - -CREATE TABLE document_type_fields_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_type_id INTEGER NOT NULL, -field_id INTEGER NOT NULL, -is_mandatory BIT NOT NULL -)TYPE = InnoDB; - -CREATE TABLE document_types_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) -)TYPE = InnoDB; - -CREATE TABLE folders ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(255), -description CHAR(255), -parent_id INTEGER, -creator_id INTEGER, -unit_id INTEGER, -is_public BIT NOT NULL, -parent_folder_ids TEXT, -full_path TEXT, -inherit_parent_folder_permission INTEGER -)TYPE = InnoDB; -ALTER TABLE folders ADD INDEX fk_parent_id (parent_id); -ALTER TABLE folders ADD INDEX fk_creator_id (creator_id); -ALTER TABLE folders ADD INDEX fk_unit_id (unit_id); - -CREATE TABLE folder_subscriptions ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -user_id INTEGER NOT NULL, -folder_id INTEGER NOT NULL, -is_alerted BIT -)TYPE = InnoDB; - -CREATE TABLE folders_users_roles_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -group_folder_approval_id INTEGER NOT NULL, -user_id INTEGER NOT NULL, -document_id INTEGER NOT NULL, -datetime DATETIME, -done BIT, -active BIT, -dependant_documents_created BIT -)TYPE = InnoDB; + id int(11) NOT NULL default '0', + document_id int(11) default NULL, + document_text mediumtext, + UNIQUE KEY id (id), + KEY document_text_document_id_indx (document_id), + FULLTEXT KEY document_text (document_text) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_transaction_types_lookup` +-- + +CREATE TABLE document_transaction_types_lookup ( + id int(11) NOT NULL default '0', + name char(100) NOT NULL default '', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_transactions` +-- + +CREATE TABLE document_transactions ( + id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + version char(50) default NULL, + user_id int(11) NOT NULL default '0', + datetime datetime NOT NULL default '0000-00-00 00:00:00', + ip char(30) default NULL, + filename char(255) NOT NULL default '', + comment char(255) NOT NULL default '', + transaction_id int(11) default NULL, + UNIQUE KEY id (id), + KEY fk_document_id (document_id), + KEY fk_user_id (user_id), + KEY fk_transaction_id (transaction_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_type_fields_link` +-- + +CREATE TABLE document_type_fields_link ( + id int(11) NOT NULL default '0', + document_type_id int(11) NOT NULL default '0', + field_id int(11) NOT NULL default '0', + is_mandatory tinyint(1) NOT NULL default '0', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `document_types_lookup` +-- + +CREATE TABLE document_types_lookup ( + id int(11) NOT NULL default '0', + name char(100) default NULL, + UNIQUE KEY id (id), + UNIQUE KEY name (name) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `documents` +-- + +CREATE TABLE documents ( + id int(11) NOT NULL default '0', + document_type_id int(11) NOT NULL default '0', + name text NOT NULL, + filename text NOT NULL, + size bigint(20) NOT NULL default '0', + creator_id int(11) NOT NULL default '0', + modified datetime NOT NULL default '0000-00-00 00:00:00', + description varchar(200) NOT NULL default '', + security int(11) NOT NULL default '0', + mime_id int(11) NOT NULL default '0', + folder_id int(11) NOT NULL default '0', + major_version int(11) NOT NULL default '0', + minor_version int(11) NOT NULL default '0', + is_checked_out tinyint(1) NOT NULL default '0', + parent_folder_ids text, + full_path text, + checked_out_user_id int(11) default NULL, + status_id int(11) default NULL, + UNIQUE KEY id (id), + KEY fk_document_type_id (document_type_id), + KEY fk_creator_id (creator_id), + KEY fk_folder_id (folder_id), + KEY fk_checked_out_user_id (checked_out_user_id), + KEY fk_status_id (status_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `folder_doctypes_link` +-- CREATE TABLE folder_doctypes_link ( -id int(11) NOT NULL auto_increment, -folder_id int(11) NOT NULL default '0', -document_type_id int(11) NOT NULL default '0', -UNIQUE KEY id (id) -) TYPE=InnoDB; -ALTER TABLE folder_doctypes_link ADD INDEX fk_folder_id (folder_id); -ALTER TABLE folder_doctypes_link ADD INDEX fk_document_type_id (document_type_id); - -CREATE TABLE groups_folders_approval_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -folder_id INTEGER NOT NULL, -group_id INTEGER NOT NULL, -precedence INTEGER NOT NULL, -role_id INTEGER NOT NULL, -user_id INTEGER NOT NULL -)TYPE = InnoDB; + id int(11) NOT NULL default '0', + folder_id int(11) NOT NULL default '0', + document_type_id int(11) NOT NULL default '0', + UNIQUE KEY id (id), + KEY fk_folder_id (folder_id), + KEY fk_document_type_id (document_type_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `folder_subscriptions` +-- + +CREATE TABLE folder_subscriptions ( + id int(11) NOT NULL default '0', + user_id int(11) NOT NULL default '0', + folder_id int(11) NOT NULL default '0', + is_alerted tinyint(1) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `folders` +-- + +CREATE TABLE folders ( + id int(11) NOT NULL default '0', + name varchar(255) default NULL, + description varchar(255) default NULL, + parent_id int(11) default NULL, + creator_id int(11) default NULL, + unit_id int(11) default NULL, + is_public tinyint(1) NOT NULL default '0', + parent_folder_ids text, + full_path text, + inherit_parent_folder_permission int(11) default NULL, + UNIQUE KEY id (id), + KEY fk_parent_id (parent_id), + KEY fk_creator_id (creator_id), + KEY fk_unit_id (unit_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `folders_users_roles_link` +-- + +CREATE TABLE folders_users_roles_link ( + id int(11) NOT NULL default '0', + group_folder_approval_id int(11) NOT NULL default '0', + user_id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + datetime datetime default NULL, + done tinyint(1) default NULL, + active tinyint(1) default NULL, + dependant_documents_created tinyint(1) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `groups_folders_approval_link` +-- + +CREATE TABLE groups_folders_approval_link ( + id int(11) NOT NULL default '0', + folder_id int(11) NOT NULL default '0', + group_id int(11) NOT NULL default '0', + precedence int(11) NOT NULL default '0', + role_id int(11) NOT NULL default '0', + user_id int(11) NOT NULL default '0', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `groups_folders_link` +-- CREATE TABLE groups_folders_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -group_id INTEGER NOT NULL, -folder_id INTEGER NOT NULL, -can_read BIT NOT NULL, -can_write BIT NOT NULL -)TYPE = InnoDB; -ALTER TABLE groups_folders_link ADD INDEX fk_group_id (group_id); -ALTER TABLE groups_folders_link ADD INDEX fk_folder_id (folder_id); - -CREATE TABLE groups_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) NOT NULL, -is_sys_admin BIT NOT NULL, -is_unit_admin BIT NOT NULL -)TYPE = InnoDB; - -CREATE TABLE groups_units_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -group_id INTEGER NOT NULL, -unit_id INTEGER NOT NULL -)TYPE = InnoDB; -ALTER TABLE groups_units_link ADD INDEX fk_group_id (group_id); -ALTER TABLE groups_units_link ADD INDEX fk_unit_id (unit_id); + id int(11) NOT NULL default '0', + group_id int(11) NOT NULL default '0', + folder_id int(11) NOT NULL default '0', + can_read tinyint(1) NOT NULL default '0', + can_write tinyint(1) NOT NULL default '0', + UNIQUE KEY id (id), + KEY fk_group_id (group_id), + KEY fk_folder_id (folder_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `groups_lookup` +-- + +CREATE TABLE groups_lookup ( + id int(11) NOT NULL default '0', + name char(100) NOT NULL default '', + is_sys_admin tinyint(1) NOT NULL default '0', + is_unit_admin tinyint(1) NOT NULL default '0', + UNIQUE KEY id (id), + UNIQUE KEY name (name) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `groups_units_link` +-- + +CREATE TABLE groups_units_link ( + id int(11) NOT NULL default '0', + group_id int(11) NOT NULL default '0', + unit_id int(11) NOT NULL default '0', + UNIQUE KEY id (id), + KEY fk_group_id (group_id), + KEY fk_unit_id (unit_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `help` +-- CREATE TABLE help ( - id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, + id int(11) NOT NULL default '0', fSection varchar(100) NOT NULL default '', - help_info text NOT NULL -) TYPE=InnoDB; - -CREATE TABLE links ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) NOT NULL, -url CHAR(100) NOT NULL, -rank INTEGER NOT NULL -)TYPE = InnoDB; - -CREATE TABLE metadata_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_field_id INTEGER NOT NULL, -name CHAR(255) -)TYPE = InnoDB; - -CREATE TABLE mime_types ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -filetypes CHAR(100) NOT NULL, -mimetypes CHAR(100) NOT NULL, -icon_path CHAR(255) -)TYPE = InnoDB; - -CREATE TABLE news ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -synopsis VARCHAR(255) NOT NULL, -body TEXT, -rank INTEGER, -image TEXT, -image_size INTEGER, -image_mime_type_id INTEGER, -active BIT -) TYPE = InnoDB; - -CREATE TABLE organisations_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) NOT NULL -)TYPE = InnoDB; - -CREATE TABLE roles ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(255) NOT NULL, -active BIT NOT NULL, -can_read BIT NOT NULL, -can_write BIT NOT NULL -)TYPE = InnoDB; + help_info text NOT NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `links` +-- + +CREATE TABLE links ( + id int(11) NOT NULL default '0', + name char(100) NOT NULL default '', + url char(100) NOT NULL default '', + rank int(11) NOT NULL default '0', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `metadata_lookup` +-- + +CREATE TABLE metadata_lookup ( + id int(11) NOT NULL default '0', + document_field_id int(11) NOT NULL default '0', + name char(255) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mime_types` +-- + +CREATE TABLE mime_types ( + id int(11) NOT NULL default '0', + filetypes char(100) NOT NULL default '', + mimetypes char(100) NOT NULL default '', + icon_path char(255) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `news` +-- + +CREATE TABLE news ( + id int(11) NOT NULL default '0', + synopsis varchar(255) NOT NULL default '', + body text, + rank int(11) default NULL, + image text, + image_size int(11) default NULL, + image_mime_type_id int(11) default NULL, + active tinyint(1) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `organisations_lookup` +-- + +CREATE TABLE organisations_lookup ( + id int(11) NOT NULL default '0', + name char(100) NOT NULL default '', + UNIQUE KEY id (id), + UNIQUE KEY name (name) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `roles` +-- + +CREATE TABLE roles ( + id int(11) NOT NULL default '0', + name char(255) NOT NULL default '', + active tinyint(1) NOT NULL default '0', + can_read tinyint(1) NOT NULL default '0', + can_write tinyint(1) NOT NULL default '0', + UNIQUE KEY id (id), + UNIQUE KEY name (name) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `search_document_user_link` +-- CREATE TABLE search_document_user_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_id INTEGER, -user_id INTEGER -) Type = InnoDB; -ALTER TABLE search_document_user_link ADD INDEX fk_user_id (user_id); -ALTER TABLE search_document_user_link ADD INDEX fk_document_ids (document_id); - -CREATE TABLE status_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(255) -)TYPE = InnoDB; - -CREATE TABLE system_settings ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(255) NOT NULL, -value CHAR(255) NOT NULL -)TYPE = InnoDB; - -CREATE TABLE time_period ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -time_unit_id INTEGER, -units INTEGER -) TYPE = InnoDB; - -CREATE TABLE time_unit_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) -) TYPE = InnoDB; - -CREATE TABLE units_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(100) NOT NULL -)TYPE = InnoDB; - -CREATE TABLE units_organisations_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -unit_id INTEGER NOT NULL, -organisation_id INTEGER NOT NULL -)TYPE = InnoDB; -ALTER TABLE units_organisations_link ADD INDEX fk_unit_id (unit_id); -ALTER TABLE units_organisations_link ADD INDEX fk_organisation_id (organisation_id); + id int(11) NOT NULL default '0', + document_id int(11) default NULL, + user_id int(11) default NULL, + UNIQUE KEY id (id), + KEY fk_user_id (user_id), + KEY fk_document_ids (document_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `status_lookup` +-- + +CREATE TABLE status_lookup ( + id int(11) NOT NULL default '0', + name char(255) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `system_settings` +-- + +CREATE TABLE system_settings ( + id int(11) NOT NULL default '0', + name char(255) NOT NULL default '', + value char(255) NOT NULL default '', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `time_period` +-- + +CREATE TABLE time_period ( + id int(11) NOT NULL default '0', + time_unit_id int(11) default NULL, + units int(11) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `time_unit_lookup` +-- + +CREATE TABLE time_unit_lookup ( + id int(11) NOT NULL default '0', + name char(100) default NULL, + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `units_lookup` +-- + +CREATE TABLE units_lookup ( + id int(11) NOT NULL default '0', + name char(100) NOT NULL default '', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `units_organisations_link` +-- + +CREATE TABLE units_organisations_link ( + id int(11) NOT NULL default '0', + unit_id int(11) NOT NULL default '0', + organisation_id int(11) NOT NULL default '0', + UNIQUE KEY id (id), + KEY fk_unit_id (unit_id), + KEY fk_organisation_id (organisation_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- CREATE TABLE users ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -username CHAR(255) NOT NULL, -name CHAR(255) NOT NULL, -password CHAR(255) NOT NULL, -quota_max INTEGER NOT NULL, -quota_current INTEGER NOT NULL, -email CHAR(255), -mobile CHAR(255), -email_notification BIT NOT NULL, -sms_notification BIT NOT NULL, -ldap_dn CHAR(255), -max_sessions INTEGER, -language_id INTEGER -) TYPE = InnoDB; - -CREATE TABLE users_groups_link ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -user_id INTEGER NOT NULL, -group_id INTEGER NOT NULL -) TYPE = InnoDB; -ALTER TABLE users_groups_link ADD INDEX fk_user_id (user_id); -ALTER TABLE users_groups_link ADD INDEX fk_group_id (group_id); - -CREATE TABLE web_documents ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -document_id INTEGER NOT NULL, -web_site_id INTEGER NOT NULL, -unit_id INTEGER NOT NULL, -status_id INTEGER NOT NULL, -datetime DATETIME NOT NULL -)TYPE = InnoDB; - -CREATE TABLE web_documents_status_lookup ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -name CHAR(50) NOT NULL -)TYPE = InnoDB; - -CREATE TABLE web_sites ( -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT, -web_site_name CHAR(100) NOT NULL, -web_site_url CHAR(50) NOT NULL, -web_master_id INTEGER NOT NULL -)TYPE = InnoDB; - --- mime types -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ai', 'application/postscript', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('aif', 'audio/x-aiff', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('aifc', 'audio/x-aiff', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('aiff', 'audio/x-aiff', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('asc', 'text/plain', 'icons/txt.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('au', 'audio/basic', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('avi', 'video/x-msvideo', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('bcpio', 'application/x-bcpio', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('bin', 'application/octet-stream', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('bmp', 'image/bmp', 'icons/bmp.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('cdf', 'application/x-netcdf', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('class', 'application/octet-stream', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('cpio', 'application/x-cpio', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('cpt', 'application/mac-compactpro', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('csh', 'application/x-csh', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('css', 'text/css', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dcr', 'application/x-director', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dir', 'application/x-director', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dms', 'application/octet-stream', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('doc', 'application/msword', 'icons/word.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dvi', 'application/x-dvi', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dxr', 'application/x-director', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('eps', 'application/postscript', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('etx', 'text/x-setext', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('exe', 'application/octet-stream', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ez', 'application/andrew-inset', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('gif', 'image/gif', 'icons/gif.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('gtar', 'application/x-gtar', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('hdf', 'application/x-hdf', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('hqx', 'application/mac-binhex40', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('htm', 'text/html', 'icons/html.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('html', 'text/html', 'icons/html.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ice', 'x-conference/x-cooltalk', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ief', 'image/ief', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('iges', 'model/iges', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('igs', 'model/iges', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('jpe', 'image/jpeg', 'icons/jpg.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('jpeg', 'image/jpeg', 'icons/jpg.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('jpg', 'image/jpeg', 'icons/jpg.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('js', 'application/x-javascript', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('kar', 'audio/midi', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('latex', 'application/x-latex', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('lha', 'application/octet-stream', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('lzh', 'application/octet-stream', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('man', 'application/x-troff-man', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mdb', 'application/access','icons/access.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mdf', 'application/access','icons/access.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('me', 'application/x-troff-me', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mesh', 'model/mesh', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mid', 'audio/midi', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('midi', 'audio/midi', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mif', 'application/vnd.mif', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mov', 'video/quicktime', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('movie', 'video/x-sgi-movie', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mp2', 'audio/mpeg', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mp3', 'audio/mpeg', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpe', 'video/mpeg', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpeg', 'video/mpeg', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpg', 'video/mpeg', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpga', 'audio/mpeg', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpp', 'application/vnd.ms-project', 'icons/project.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ms', 'application/x-troff-ms', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('msh', 'model/mesh', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('nc', 'application/x-netcdf', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('oda', 'application/oda', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pbm', 'image/x-portable-bitmap', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pdb', 'chemical/x-pdb', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pdf', 'application/pdf', 'icons/pdf.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pgm', 'image/x-portable-graymap', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pgn', 'application/x-chess-pgn', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('png', 'image/png', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pnm', 'image/x-portable-anymap', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ppm', 'image/x-portable-pixmap', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ppt', 'application/vnd.ms-powerpoint', 'icons/powerp.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ps', 'application/postscript', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('qt', 'video/quicktime', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ra', 'audio/x-realaudio', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ram', 'audio/x-pn-realaudio', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ras', 'image/x-cmu-raster', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rgb', 'image/x-rgb', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rm', 'audio/x-pn-realaudio', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('roff', 'application/x-troff', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rpm', 'audio/x-pn-realaudio-plugin', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rtf', 'text/rtf', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rtx', 'text/richtext', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sgm', 'text/sgml', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sgml', 'text/sgml', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sh', 'application/x-sh', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('shar', 'application/x-shar', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('silo', 'model/mesh', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sit', 'application/x-stuffit', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skd', 'application/x-koan', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skm', 'application/x-koan', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skp', 'application/x-koan', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skt', 'application/x-koan', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('smi', 'application/smil', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('smil', 'application/smil', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('snd', 'audio/basic', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('spl', 'application/x-futuresplash', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('src', 'application/x-wais-source', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sv4cpio', 'application/x-sv4cpio', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sv4crc', 'application/x-sv4crc', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('swf', 'application/x-shockwave-flash', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('t', 'application/x-troff', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tar', 'application/x-tar', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tcl', 'application/x-tcl', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tex', 'application/x-tex', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('texi', 'application/x-texinfo', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('texinfo', 'application/x-texinfo', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tif', 'image/tiff', 'icons/tiff.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tiff', 'image/tiff', 'icons/tiff.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tr', 'application/x-troff', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tsv', 'text/tab-separated-values', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('txt', 'text/plain', 'icons/txt.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ustar', 'application/x-ustar', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('vcd', 'application/x-cdlink', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('vrml', 'model/vrml', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('vsd', 'application/vnd.visio', 'icons/visio.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('wav', 'audio/x-wav', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('wrl', 'model/vrml', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xbm', 'image/x-xbitmap', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xls', 'application/vnd.ms-excel', 'icons/excel.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xml', 'text/xml', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xpm', 'image/x-xpixmap', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xwd', 'image/x-xwindowdump', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xyz', 'chemical/x-pdb', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('zip', 'application/zip', 'icons/zip.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('gz', 'application/x-gzip', 'icons/zip.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tgz', 'application/x-gzip', 'icons/zip.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxw', 'application/vnd.sun.xml.writer', 'icons/oowriter.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('stw','application/vnd.sun.xml.writer.template', 'icons/oowriter.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxc','application/vnd.sun.xml.calc', 'icons/oocalc.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('stc','application/vnd.sun.xml.calc.template', 'icons/oocalc.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxd','application/vnd.sun.xml.draw', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('std','application/vnd.sun.xml.draw.template', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxi','application/vnd.sun.xml.impress', 'icons/ooimpress.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sti','application/vnd.sun.xml.impress.template', 'icons/ooimpress.gif'); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxg','application/vnd.sun.xml.writer.global', NULL); -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxm','application/vnd.sun.xml.math', NULL); - --- data_types -insert into data_types (name) values ('STRING'); -insert into data_types (name) values ('CHAR'); -insert into data_types (name) values ('TEXT'); -insert into data_types (name) values ('INT'); -insert into data_types (name) values ('FLOAT'); - --- category field -INSERT INTO document_fields (name, data_type, is_generic) VALUES ("Category", "STRING", 1); - --- system settings -INSERT INTO system_settings (name, value) values ("lastIndexUpdate", "0"); -INSERT INTO system_settings (name, value) values ("knowledgeTreeVersion", "1.2.5"); - --- document statuses -INSERT INTO web_documents_status_lookup (name) VALUES ("Pending"); -INSERT INTO web_documents_status_lookup (name) VALUES ("Published"); -INSERT INTO web_documents_status_lookup (name) VALUES ("Not Published"); - --- document transaction types -INSERT INTO document_transaction_types_lookup (name) VALUES ("Create"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Update"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Delete"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Rename"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Move"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Download"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Check In"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Check Out"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Collaboration Step Rollback"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("View"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Expunge"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Force CheckIn"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Email Link"); -INSERT INTO document_transaction_types_lookup (name) VALUES ("Collaboration Step Approve"); - --- document status -INSERT INTO status_lookup (name) VALUES ("Live"); -INSERT INTO status_lookup (name) VALUES ("Published"); -INSERT INTO status_lookup (name) VALUES ("Deleted"); -INSERT INTO status_lookup (name) VALUES ("Archived"); - --- archiving types lookup -INSERT INTO archiving_type_lookup (name) VALUES ("Date"); -INSERT INTO archiving_type_lookup (name) VALUES ("Utilisation"); - --- time lookups -INSERT INTO time_unit_lookup (name) VALUES ("Years"); -INSERT INTO time_unit_lookup (name) VALUES ("Months"); -INSERT INTO time_unit_lookup (name) VALUES ("Days"); - --- help -INSERT INTO help VALUES (1,'browse','dochelp.html'); -INSERT INTO help VALUES (2,'dashboard','dashboardHelp.html'); -INSERT INTO help VALUES (3,'addFolder','addFolderHelp.html'); -INSERT INTO help VALUES (4,'editFolder','editFolderHelp.html'); -INSERT INTO help VALUES (5,'addFolderCollaboration','addFolderCollaborationHelp.html'); -INSERT INTO help VALUES (6,'modifyFolderCollaboration','addFolderCollaborationHelp.html'); -INSERT INTO help VALUES (7,'addDocument','addDocumentHelp.html'); -INSERT INTO help VALUES (8,'viewDocument','viewDocumentHelp.html'); -INSERT INTO help VALUES (9,'modifyDocument','modifyDocumentHelp.html'); -INSERT INTO help VALUES (10,'modifyDocumentRouting','modifyDocumentRoutingHelp.html'); -INSERT INTO help VALUES (11,'emailDocument','emailDocumentHelp.html'); -INSERT INTO help VALUES (12,'deleteDocument','deleteDocumentHelp.html'); -INSERT INTO help VALUES (13,'administration','administrationHelp.html'); -INSERT INTO help VALUES (14,'addGroup','addGroupHelp.html'); -INSERT INTO help VALUES (15,'editGroup','editGroupHelp.html'); -INSERT INTO help VALUES (16,'removeGroup','removeGroupHelp.html'); -INSERT INTO help VALUES (17,'assignGroupToUnit','assignGroupToUnitHelp.html'); -INSERT INTO help VALUES (18,'removeGroupFromUnit','removeGroupFromUnitHelp.html'); -INSERT INTO help VALUES (19,'addUnit','addUnitHelp.html'); -INSERT INTO help VALUES (20,'editUnit','editUnitHelp.html'); -INSERT INTO help VALUES (21,'removeUnit','removeUnitHelp.html'); -INSERT INTO help VALUES (22,'addOrg','addOrgHelp.html'); -INSERT INTO help VALUES (23,'editOrg','editOrgHelp.html'); -INSERT INTO help VALUES (24,'removeOrg','removeOrgHelp.html'); -INSERT INTO help VALUES (25,'addRole','addRoleHelp.html'); -INSERT INTO help VALUES (26,'editRole','editRoleHelp.html'); -INSERT INTO help VALUES (27,'removeRole','removeRoleHelp.html'); -INSERT INTO help VALUES (28,'addLink','addLinkHelp.html'); -INSERT INTO help VALUES (29,'addLinkSuccess','addLinkHelp.html'); -INSERT INTO help VALUES (30,'editLink','editLinkHelp.html'); -INSERT INTO help VALUES (31,'removeLink','removeLinkHelp.html'); -INSERT INTO help VALUES (32,'systemAdministration','systemAdministrationHelp.html'); -INSERT INTO help VALUES (33,'deleteFolder','deleteFolderHelp.html'); -INSERT INTO help VALUES (34,'editDocType','editDocTypeHelp.html'); -INSERT INTO help VALUES (35,'removeDocType','removeDocTypeHelp.html'); -INSERT INTO help VALUES (36,'addDocType','addDocTypeHelp.html'); -INSERT INTO help VALUES (37,'addDocTypeSuccess','addDocTypeHelp.html'); -INSERT INTO help VALUES (38,'manageSubscriptions','manageSubscriptionsHelp.html'); -INSERT INTO help VALUES (39,'addSubscription','addSubscriptionHelp.html'); -INSERT INTO help VALUES (40,'removeSubscription','removeSubscriptionHelp.html'); -INSERT INTO help VALUES (41,'preferences','preferencesHelp.html'); -INSERT INTO help VALUES (42,'editPrefsSuccess','preferencesHelp.html'); -INSERT INTO help VALUES (43,'modifyDocumentGenericMetaData','modifyDocumentGenericMetaDataHelp.html'); -INSERT INTO help VALUES (44,'viewHistory','viewHistoryHelp.html'); -INSERT INTO help VALUES (45,'checkInDocument','checkInDocumentHelp.html'); -INSERT INTO help VALUES (46,'checkOutDocument','checkOutDocumentHelp.html'); -INSERT INTO help VALUES (47,'advancedSearch','advancedSearchHelp.html'); -INSERT INTO help VALUES (48,'deleteFolderCollaboration','deleteFolderCollaborationHelp.html'); -INSERT INTO help VALUES (49,'addFolderDocType','addFolderDocTypeHelp.html'); -INSERT INTO help VALUES (50,'deleteFolderDocType','deleteFolderDocTypeHelp.html'); -INSERT INTO help VALUES (51,'addGroupFolderLink','addGroupFolderLinkHelp.html'); -INSERT INTO help VALUES (52,'deleteGroupFolderLink','deleteGroupFolderLinkHelp.html'); -INSERT INTO help VALUES (53,'addWebsite','addWebsiteHelp.html'); -INSERT INTO help VALUES (54,'addWebsiteSuccess','addWebsiteHelp.html'); -INSERT INTO help VALUES (55,'editWebsite','editWebsiteHelp.html'); -INSERT INTO help VALUES (56,'removeWebSite','removeWebSiteHelp.html'); -INSERT INTO help VALUES (57,'standardSearch','standardSearchHelp.html'); -INSERT INTO help VALUES (58,'modifyDocumentTypeMetaData','modifyDocumentTypeMetaDataHelp.html'); -INSERT INTO help VALUES (59,'addDocField','addDocFieldHelp.html'); -INSERT INTO help VALUES (60,'editDocField','editDocFieldHelp.html'); -INSERT INTO help VALUES (61,'removeDocField','removeDocFieldHelp.html'); -INSERT INTO help VALUES (62,'addMetaData','addMetaDataHelp.html'); -INSERT INTO help VALUES (63,'editMetaData','editMetaDataHelp.html'); -INSERT INTO help VALUES (64,'removeMetaData','removeMetaDataHelp.html'); -INSERT INTO help VALUES (65,'addUser','addUserHelp.html'); -INSERT INTO help VALUES (66,'editUser','editUserHelp.html'); -INSERT INTO help VALUES (67,'removeUser','removeUserHelp.html'); -INSERT INTO help VALUES (68,'addUserToGroup','addUserToGroupHelp.html'); -INSERT INTO help VALUES (69,'removeUserFromGroup','removeUserFromGroupHelp.html'); -INSERT INTO help VALUES (70,'viewDiscussion','viewDiscussionThread.html'); -INSERT INTO help VALUES (71,'addComment','addDiscussionComment.html'); -INSERT INTO help VALUES (72,'listNews','listDashboardNewsHelp.html'); -INSERT INTO help VALUES (73,'editNews','editDashboardNewsHelp.html'); -INSERT INTO help VALUES (74,'previewNews','previewDashboardNewsHelp.html'); -INSERT INTO help VALUES (75,'addNews','addDashboardNewsHelp.html'); -INSERT INTO help VALUES (76,'modifyDocumentArchiveSettings','modifyDocumentArchiveSettingsHelp.html'); -INSERT INTO help VALUES (77,'addDocumentArchiveSettings','addDocumentArchiveSettingsHelp.html'); -INSERT INTO help VALUES (78,'listDocFields','listDocumentFieldsAdmin.html'); -INSERT INTO help VALUES (79,'editDocFieldLookups','editDocFieldLookups.html'); -INSERT INTO help VALUES (80,'addMetaDataForField','addMetaDataForField.html'); -INSERT INTO help VALUES (81,'editMetaDataForField','editMetaDataForField.html'); -INSERT INTO help VALUES (82,'removeMetaDataFromField','removeMetaDataFromField.html'); -INSERT INTO help VALUES (83,'listDocs','listDocumentsCheckoutHelp.html'); -INSERT INTO help VALUES (84,'editDocCheckout','editDocCheckoutHelp.html'); -INSERT INTO help VALUES (85,'listDocTypes','listDocTypesHelp.html'); -INSERT INTO help VALUES (86,'editDocTypeFields','editDocFieldHelp.html'); -INSERT INTO help VALUES (87,'addDocTypeFieldsLink','addDocTypeFieldHelp.html'); -INSERT INTO help VALUES (88,'listGroups','listGroupsHelp.html'); -INSERT INTO help VALUES (89,'editGroupUnit','editGroupUnitHelp.html'); -INSERT INTO help VALUES (90,'listOrg','listOrgHelp.html'); -INSERT INTO help VALUES (91,'listRole','listRolesHelp.html'); -INSERT INTO help VALUES (92,'listUnits','listUnitHelp.html'); -INSERT INTO help VALUES (93,'editUnitOrg','editUnitOrgHelp.html'); -INSERT INTO help VALUES (94,'removeUnitFromOrg','removeUnitFromOrgHelp.html'); -INSERT INTO help VALUES (95,'addUnitToOrg','addUnitToOrgHelp.html'); -INSERT INTO help VALUES (96,'listUsers','listUsersHelp.html'); -INSERT INTO help VALUES (97,'editUserGroups','editUserGroupsHelp.html'); -INSERT INTO help VALUES (98,'listWebsites','listWebsitesHelp.html'); - --- setup default information --- organisation -INSERT INTO organisations_lookup (name) VALUES ("Default Organisation"); - --- units -INSERT INTO units_lookup (name) VALUES ("Default Unit"); - -INSERT INTO units_organisations_link (unit_id, organisation_id) VALUES (1, 1); - --- setup groups -INSERT INTO groups_lookup (name, is_sys_admin, is_unit_admin) VALUES ("System Administrators", 1, 0); -- id=1 -INSERT INTO groups_lookup (name, is_sys_admin, is_unit_admin) VALUES ("Unit Administrators", 0, 1); -- id=2 -INSERT INTO groups_lookup (name, is_sys_admin, is_unit_admin) VALUES ("Anonymous", 0, 0); -- id=3 - --- unit administrators -INSERT INTO groups_units_link (group_id, unit_id) VALUES (2, 1); - --- system administrator --- passwords are md5'ed -INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) - VALUES ("admin", "Administrator", "21232f297a57a5a743894a0e4a801fc3", "0", "0", "", "", 1, 1, "", 1, 1); -INSERT INTO users_groups_link (group_id, user_id) VALUES (1, 1); - --- unit administrator -INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) - VALUES ("unitAdmin", "Unit Administrator", "21232f297a57a5a743894a0e4a801fc3", "0", "0", "", "", 1, 1, "", 1, 1); -INSERT INTO users_groups_link (group_id, user_id) VALUES (2, 2); - --- guest user -INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id) - VALUES ("guest", "Anonymous", "084e0343a0486ff05530df6c705c8bb4", "0", "0", "", "", 0, 0, "", 19, 1); -INSERT INTO users_groups_link (group_id, user_id) VALUES (3, 3); - --- define folder structure -INSERT INTO folders (name, description, parent_id, creator_id, unit_id, is_public) - VALUES ("Root Folder", "Root Document Folder", 0, 1, 0, 0); -INSERT INTO folders (name, description, parent_id, creator_id, unit_id, is_public, parent_folder_ids, full_path) - VALUES ("Default Unit", "Default Unit Root Folder", 1, 1, 1, 0, "1", "Root Folder"); - --- default document type -INSERT INTO document_types_lookup (name) VALUES ("Default"); --- map folder to document type -INSERT INTO folder_doctypes_link (folder_id, document_type_id) VALUES (2, 1); + id int(11) NOT NULL default '0', + username char(255) NOT NULL default '', + name char(255) NOT NULL default '', + password char(255) NOT NULL default '', + quota_max int(11) NOT NULL default '0', + quota_current int(11) NOT NULL default '0', + email char(255) default NULL, + mobile char(255) default NULL, + email_notification tinyint(1) NOT NULL default '0', + sms_notification tinyint(1) NOT NULL default '0', + ldap_dn char(255) default NULL, + max_sessions int(11) default NULL, + language_id int(11) default NULL, + UNIQUE KEY id (id), + UNIQUE KEY username (username) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users_groups_link` +-- + +CREATE TABLE users_groups_link ( + id int(11) NOT NULL default '0', + user_id int(11) NOT NULL default '0', + group_id int(11) NOT NULL default '0', + UNIQUE KEY id (id), + KEY fk_user_id (user_id), + KEY fk_group_id (group_id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_documents` +-- + +CREATE TABLE web_documents ( + id int(11) NOT NULL default '0', + document_id int(11) NOT NULL default '0', + web_site_id int(11) NOT NULL default '0', + unit_id int(11) NOT NULL default '0', + status_id int(11) NOT NULL default '0', + datetime datetime NOT NULL default '0000-00-00 00:00:00', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_documents_status_lookup` +-- + +CREATE TABLE web_documents_status_lookup ( + id int(11) NOT NULL default '0', + name char(50) NOT NULL default '', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_sites` +-- + +CREATE TABLE web_sites ( + id int(11) NOT NULL default '0', + web_site_name char(100) NOT NULL default '', + web_site_url char(50) NOT NULL default '', + web_master_id int(11) NOT NULL default '0', + UNIQUE KEY id (id) +) TYPE=InnoDB; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_active_sessions` +-- + +CREATE TABLE zseq_active_sessions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_archive_restoration_request` +-- + +CREATE TABLE zseq_archive_restoration_request ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_archiving_settings` +-- + +CREATE TABLE zseq_archiving_settings ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_archiving_type_lookup` +-- + +CREATE TABLE zseq_archiving_type_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_data_types` +-- + +CREATE TABLE zseq_data_types ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_dependant_document_instance` +-- + +CREATE TABLE zseq_dependant_document_instance ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_dependant_document_template` +-- + +CREATE TABLE zseq_dependant_document_template ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_discussion_comments` +-- + +CREATE TABLE zseq_discussion_comments ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_discussion_threads` +-- + +CREATE TABLE zseq_discussion_threads ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_archiving_link` +-- + +CREATE TABLE zseq_document_archiving_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_fields` +-- + +CREATE TABLE zseq_document_fields ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_fields_link` +-- + +CREATE TABLE zseq_document_fields_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_link` +-- + +CREATE TABLE zseq_document_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_subscriptions` +-- + +CREATE TABLE zseq_document_subscriptions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_text` +-- + +CREATE TABLE zseq_document_text ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_transaction_types_lookup` +-- + +CREATE TABLE zseq_document_transaction_types_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_transactions` +-- + +CREATE TABLE zseq_document_transactions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_type_fields_link` +-- + +CREATE TABLE zseq_document_type_fields_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_document_types_lookup` +-- + +CREATE TABLE zseq_document_types_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_documents` +-- + +CREATE TABLE zseq_documents ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_folder_doctypes_link` +-- + +CREATE TABLE zseq_folder_doctypes_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_folder_subscriptions` +-- + +CREATE TABLE zseq_folder_subscriptions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_folders` +-- + +CREATE TABLE zseq_folders ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_folders_users_roles_link` +-- + +CREATE TABLE zseq_folders_users_roles_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_groups_folders_approval_link` +-- + +CREATE TABLE zseq_groups_folders_approval_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_groups_folders_link` +-- + +CREATE TABLE zseq_groups_folders_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_groups_lookup` +-- + +CREATE TABLE zseq_groups_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_groups_units_link` +-- + +CREATE TABLE zseq_groups_units_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_help` +-- + +CREATE TABLE zseq_help ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_links` +-- + +CREATE TABLE zseq_links ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_metadata_lookup` +-- + +CREATE TABLE zseq_metadata_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_mime_types` +-- + +CREATE TABLE zseq_mime_types ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_news` +-- + +CREATE TABLE zseq_news ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_organisations_lookup` +-- + +CREATE TABLE zseq_organisations_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_roles` +-- + +CREATE TABLE zseq_roles ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_search_document_user_link` +-- + +CREATE TABLE zseq_search_document_user_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_status_lookup` +-- + +CREATE TABLE zseq_status_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_system_settings` +-- + +CREATE TABLE zseq_system_settings ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_time_period` +-- + +CREATE TABLE zseq_time_period ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_time_unit_lookup` +-- + +CREATE TABLE zseq_time_unit_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_units_lookup` +-- + +CREATE TABLE zseq_units_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_units_organisations_link` +-- + +CREATE TABLE zseq_units_organisations_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_users` +-- + +CREATE TABLE zseq_users ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_users_groups_link` +-- + +CREATE TABLE zseq_users_groups_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_web_documents` +-- + +CREATE TABLE zseq_web_documents ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_web_documents_status_lookup` +-- + +CREATE TABLE zseq_web_documents_status_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `zseq_web_sites` +-- + +CREATE TABLE zseq_web_sites ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; + +-- +-- Dumping data for table `active_sessions` +-- + + +-- +-- Dumping data for table `archive_restoration_request` +-- + + +-- +-- Dumping data for table `archiving_settings` +-- + + +-- +-- Dumping data for table `archiving_type_lookup` +-- + +INSERT INTO archiving_type_lookup VALUES (1, 'Date'); +INSERT INTO archiving_type_lookup VALUES (2, 'Utilisation'); + +-- +-- Dumping data for table `data_types` +-- + +INSERT INTO data_types VALUES (1, 'STRING'); +INSERT INTO data_types VALUES (2, 'CHAR'); +INSERT INTO data_types VALUES (3, 'TEXT'); +INSERT INTO data_types VALUES (4, 'INT'); +INSERT INTO data_types VALUES (5, 'FLOAT'); + +-- +-- Dumping data for table `dependant_document_instance` +-- + + +-- +-- Dumping data for table `dependant_document_template` +-- + + +-- +-- Dumping data for table `discussion_comments` +-- + + +-- +-- Dumping data for table `discussion_threads` +-- + + +-- +-- Dumping data for table `document_archiving_link` +-- + + +-- +-- Dumping data for table `document_fields` +-- + +INSERT INTO document_fields VALUES (1, 'Category', 'STRING', 1, NULL); + +-- +-- Dumping data for table `document_fields_link` +-- + + +-- +-- Dumping data for table `document_link` +-- + + +-- +-- Dumping data for table `document_subscriptions` +-- + + +-- +-- Dumping data for table `document_text` +-- + + +-- +-- Dumping data for table `document_transaction_types_lookup` +-- + +INSERT INTO document_transaction_types_lookup VALUES (1, 'Create'); +INSERT INTO document_transaction_types_lookup VALUES (2, 'Update'); +INSERT INTO document_transaction_types_lookup VALUES (3, 'Delete'); +INSERT INTO document_transaction_types_lookup VALUES (4, 'Rename'); +INSERT INTO document_transaction_types_lookup VALUES (5, 'Move'); +INSERT INTO document_transaction_types_lookup VALUES (6, 'Download'); +INSERT INTO document_transaction_types_lookup VALUES (7, 'Check In'); +INSERT INTO document_transaction_types_lookup VALUES (8, 'Check Out'); +INSERT INTO document_transaction_types_lookup VALUES (9, 'Collaboration Step Rollback'); +INSERT INTO document_transaction_types_lookup VALUES (10, 'View'); +INSERT INTO document_transaction_types_lookup VALUES (11, 'Expunge'); +INSERT INTO document_transaction_types_lookup VALUES (12, 'Force CheckIn'); +INSERT INTO document_transaction_types_lookup VALUES (13, 'Email Link'); +INSERT INTO document_transaction_types_lookup VALUES (14, 'Collaboration Step Approve'); + +-- +-- Dumping data for table `document_transactions` +-- + + +-- +-- Dumping data for table `document_type_fields_link` +-- + + +-- +-- Dumping data for table `document_types_lookup` +-- + +INSERT INTO document_types_lookup VALUES (1, 'Default'); + +-- +-- Dumping data for table `documents` +-- + + +-- +-- Dumping data for table `folder_doctypes_link` +-- + +INSERT INTO folder_doctypes_link VALUES (1, 2, 1); + +-- +-- Dumping data for table `folder_subscriptions` +-- + + +-- +-- Dumping data for table `folders` +-- + +INSERT INTO folders VALUES (1, 'Root Folder', 'Root Document Folder', 0, 1, 0, 0, NULL, NULL, NULL); +INSERT INTO folders VALUES (2, 'Default Unit', 'Default Unit Root Folder', 1, 1, 1, 0, '1', 'Root Folder', NULL); + +-- +-- Dumping data for table `folders_users_roles_link` +-- + + +-- +-- Dumping data for table `groups_folders_approval_link` +-- + + +-- +-- Dumping data for table `groups_folders_link` +-- + + +-- +-- Dumping data for table `groups_lookup` +-- + +INSERT INTO groups_lookup VALUES (1, 'System Administrators', 1, 0); +INSERT INTO groups_lookup VALUES (2, 'Unit Administrators', 0, 1); +INSERT INTO groups_lookup VALUES (3, 'Anonymous', 0, 0); + +-- +-- Dumping data for table `groups_units_link` +-- + +INSERT INTO groups_units_link VALUES (1, 2, 1); + +-- +-- Dumping data for table `help` +-- + +INSERT INTO help VALUES (1, 'browse', 'dochelp.html'); +INSERT INTO help VALUES (2, 'dashboard', 'dashboardHelp.html'); +INSERT INTO help VALUES (3, 'addFolder', 'addFolderHelp.html'); +INSERT INTO help VALUES (4, 'editFolder', 'editFolderHelp.html'); +INSERT INTO help VALUES (5, 'addFolderCollaboration', 'addFolderCollaborationHelp.html'); +INSERT INTO help VALUES (6, 'modifyFolderCollaboration', 'addFolderCollaborationHelp.html'); +INSERT INTO help VALUES (7, 'addDocument', 'addDocumentHelp.html'); +INSERT INTO help VALUES (8, 'viewDocument', 'viewDocumentHelp.html'); +INSERT INTO help VALUES (9, 'modifyDocument', 'modifyDocumentHelp.html'); +INSERT INTO help VALUES (10, 'modifyDocumentRouting', 'modifyDocumentRoutingHelp.html'); +INSERT INTO help VALUES (11, 'emailDocument', 'emailDocumentHelp.html'); +INSERT INTO help VALUES (12, 'deleteDocument', 'deleteDocumentHelp.html'); +INSERT INTO help VALUES (13, 'administration', 'administrationHelp.html'); +INSERT INTO help VALUES (14, 'addGroup', 'addGroupHelp.html'); +INSERT INTO help VALUES (15, 'editGroup', 'editGroupHelp.html'); +INSERT INTO help VALUES (16, 'removeGroup', 'removeGroupHelp.html'); +INSERT INTO help VALUES (17, 'assignGroupToUnit', 'assignGroupToUnitHelp.html'); +INSERT INTO help VALUES (18, 'removeGroupFromUnit', 'removeGroupFromUnitHelp.html'); +INSERT INTO help VALUES (19, 'addUnit', 'addUnitHelp.html'); +INSERT INTO help VALUES (20, 'editUnit', 'editUnitHelp.html'); +INSERT INTO help VALUES (21, 'removeUnit', 'removeUnitHelp.html'); +INSERT INTO help VALUES (22, 'addOrg', 'addOrgHelp.html'); +INSERT INTO help VALUES (23, 'editOrg', 'editOrgHelp.html'); +INSERT INTO help VALUES (24, 'removeOrg', 'removeOrgHelp.html'); +INSERT INTO help VALUES (25, 'addRole', 'addRoleHelp.html'); +INSERT INTO help VALUES (26, 'editRole', 'editRoleHelp.html'); +INSERT INTO help VALUES (27, 'removeRole', 'removeRoleHelp.html'); +INSERT INTO help VALUES (28, 'addLink', 'addLinkHelp.html'); +INSERT INTO help VALUES (29, 'addLinkSuccess', 'addLinkHelp.html'); +INSERT INTO help VALUES (30, 'editLink', 'editLinkHelp.html'); +INSERT INTO help VALUES (31, 'removeLink', 'removeLinkHelp.html'); +INSERT INTO help VALUES (32, 'systemAdministration', 'systemAdministrationHelp.html'); +INSERT INTO help VALUES (33, 'deleteFolder', 'deleteFolderHelp.html'); +INSERT INTO help VALUES (34, 'editDocType', 'editDocTypeHelp.html'); +INSERT INTO help VALUES (35, 'removeDocType', 'removeDocTypeHelp.html'); +INSERT INTO help VALUES (36, 'addDocType', 'addDocTypeHelp.html'); +INSERT INTO help VALUES (37, 'addDocTypeSuccess', 'addDocTypeHelp.html'); +INSERT INTO help VALUES (38, 'manageSubscriptions', 'manageSubscriptionsHelp.html'); +INSERT INTO help VALUES (39, 'addSubscription', 'addSubscriptionHelp.html'); +INSERT INTO help VALUES (40, 'removeSubscription', 'removeSubscriptionHelp.html'); +INSERT INTO help VALUES (41, 'preferences', 'preferencesHelp.html'); +INSERT INTO help VALUES (42, 'editPrefsSuccess', 'preferencesHelp.html'); +INSERT INTO help VALUES (43, 'modifyDocumentGenericMetaData', 'modifyDocumentGenericMetaDataHelp.html'); +INSERT INTO help VALUES (44, 'viewHistory', 'viewHistoryHelp.html'); +INSERT INTO help VALUES (45, 'checkInDocument', 'checkInDocumentHelp.html'); +INSERT INTO help VALUES (46, 'checkOutDocument', 'checkOutDocumentHelp.html'); +INSERT INTO help VALUES (47, 'advancedSearch', 'advancedSearchHelp.html'); +INSERT INTO help VALUES (48, 'deleteFolderCollaboration', 'deleteFolderCollaborationHelp.html'); +INSERT INTO help VALUES (49, 'addFolderDocType', 'addFolderDocTypeHelp.html'); +INSERT INTO help VALUES (50, 'deleteFolderDocType', 'deleteFolderDocTypeHelp.html'); +INSERT INTO help VALUES (51, 'addGroupFolderLink', 'addGroupFolderLinkHelp.html'); +INSERT INTO help VALUES (52, 'deleteGroupFolderLink', 'deleteGroupFolderLinkHelp.html'); +INSERT INTO help VALUES (53, 'addWebsite', 'addWebsiteHelp.html'); +INSERT INTO help VALUES (54, 'addWebsiteSuccess', 'addWebsiteHelp.html'); +INSERT INTO help VALUES (55, 'editWebsite', 'editWebsiteHelp.html'); +INSERT INTO help VALUES (56, 'removeWebSite', 'removeWebSiteHelp.html'); +INSERT INTO help VALUES (57, 'standardSearch', 'standardSearchHelp.html'); +INSERT INTO help VALUES (58, 'modifyDocumentTypeMetaData', 'modifyDocumentTypeMetaDataHelp.html'); +INSERT INTO help VALUES (59, 'addDocField', 'addDocFieldHelp.html'); +INSERT INTO help VALUES (60, 'editDocField', 'editDocFieldHelp.html'); +INSERT INTO help VALUES (61, 'removeDocField', 'removeDocFieldHelp.html'); +INSERT INTO help VALUES (62, 'addMetaData', 'addMetaDataHelp.html'); +INSERT INTO help VALUES (63, 'editMetaData', 'editMetaDataHelp.html'); +INSERT INTO help VALUES (64, 'removeMetaData', 'removeMetaDataHelp.html'); +INSERT INTO help VALUES (65, 'addUser', 'addUserHelp.html'); +INSERT INTO help VALUES (66, 'editUser', 'editUserHelp.html'); +INSERT INTO help VALUES (67, 'removeUser', 'removeUserHelp.html'); +INSERT INTO help VALUES (68, 'addUserToGroup', 'addUserToGroupHelp.html'); +INSERT INTO help VALUES (69, 'removeUserFromGroup', 'removeUserFromGroupHelp.html'); +INSERT INTO help VALUES (70, 'viewDiscussion', 'viewDiscussionThread.html'); +INSERT INTO help VALUES (71, 'addComment', 'addDiscussionComment.html'); +INSERT INTO help VALUES (72, 'listNews', 'listDashboardNewsHelp.html'); +INSERT INTO help VALUES (73, 'editNews', 'editDashboardNewsHelp.html'); +INSERT INTO help VALUES (74, 'previewNews', 'previewDashboardNewsHelp.html'); +INSERT INTO help VALUES (75, 'addNews', 'addDashboardNewsHelp.html'); +INSERT INTO help VALUES (76, 'modifyDocumentArchiveSettings', 'modifyDocumentArchiveSettingsHelp.html'); +INSERT INTO help VALUES (77, 'addDocumentArchiveSettings', 'addDocumentArchiveSettingsHelp.html'); +INSERT INTO help VALUES (78, 'listDocFields', 'listDocumentFieldsAdmin.html'); +INSERT INTO help VALUES (79, 'editDocFieldLookups', 'editDocFieldLookups.html'); +INSERT INTO help VALUES (80, 'addMetaDataForField', 'addMetaDataForField.html'); +INSERT INTO help VALUES (81, 'editMetaDataForField', 'editMetaDataForField.html'); +INSERT INTO help VALUES (82, 'removeMetaDataFromField', 'removeMetaDataFromField.html'); +INSERT INTO help VALUES (83, 'listDocs', 'listDocumentsCheckoutHelp.html'); +INSERT INTO help VALUES (84, 'editDocCheckout', 'editDocCheckoutHelp.html'); +INSERT INTO help VALUES (85, 'listDocTypes', 'listDocTypesHelp.html'); +INSERT INTO help VALUES (86, 'editDocTypeFields', 'editDocFieldHelp.html'); +INSERT INTO help VALUES (87, 'addDocTypeFieldsLink', 'addDocTypeFieldHelp.html'); +INSERT INTO help VALUES (88, 'listGroups', 'listGroupsHelp.html'); +INSERT INTO help VALUES (89, 'editGroupUnit', 'editGroupUnitHelp.html'); +INSERT INTO help VALUES (90, 'listOrg', 'listOrgHelp.html'); +INSERT INTO help VALUES (91, 'listRole', 'listRolesHelp.html'); +INSERT INTO help VALUES (92, 'listUnits', 'listUnitHelp.html'); +INSERT INTO help VALUES (93, 'editUnitOrg', 'editUnitOrgHelp.html'); +INSERT INTO help VALUES (94, 'removeUnitFromOrg', 'removeUnitFromOrgHelp.html'); +INSERT INTO help VALUES (95, 'addUnitToOrg', 'addUnitToOrgHelp.html'); +INSERT INTO help VALUES (96, 'listUsers', 'listUsersHelp.html'); +INSERT INTO help VALUES (97, 'editUserGroups', 'editUserGroupsHelp.html'); +INSERT INTO help VALUES (98, 'listWebsites', 'listWebsitesHelp.html'); + +-- +-- Dumping data for table `links` +-- + + +-- +-- Dumping data for table `metadata_lookup` +-- + + +-- +-- Dumping data for table `mime_types` +-- + +INSERT INTO mime_types VALUES (1, 'ai', 'application/postscript', NULL); +INSERT INTO mime_types VALUES (2, 'aif', 'audio/x-aiff', NULL); +INSERT INTO mime_types VALUES (3, 'aifc', 'audio/x-aiff', NULL); +INSERT INTO mime_types VALUES (4, 'aiff', 'audio/x-aiff', NULL); +INSERT INTO mime_types VALUES (5, 'asc', 'text/plain', 'icons/txt.gif'); +INSERT INTO mime_types VALUES (6, 'au', 'audio/basic', NULL); +INSERT INTO mime_types VALUES (7, 'avi', 'video/x-msvideo', NULL); +INSERT INTO mime_types VALUES (8, 'bcpio', 'application/x-bcpio', NULL); +INSERT INTO mime_types VALUES (9, 'bin', 'application/octet-stream', NULL); +INSERT INTO mime_types VALUES (10, 'bmp', 'image/bmp', 'icons/bmp.gif'); +INSERT INTO mime_types VALUES (11, 'cdf', 'application/x-netcdf', NULL); +INSERT INTO mime_types VALUES (12, 'class', 'application/octet-stream', NULL); +INSERT INTO mime_types VALUES (13, 'cpio', 'application/x-cpio', NULL); +INSERT INTO mime_types VALUES (14, 'cpt', 'application/mac-compactpro', NULL); +INSERT INTO mime_types VALUES (15, 'csh', 'application/x-csh', NULL); +INSERT INTO mime_types VALUES (16, 'css', 'text/css', NULL); +INSERT INTO mime_types VALUES (17, 'dcr', 'application/x-director', NULL); +INSERT INTO mime_types VALUES (18, 'dir', 'application/x-director', NULL); +INSERT INTO mime_types VALUES (19, 'dms', 'application/octet-stream', NULL); +INSERT INTO mime_types VALUES (20, 'doc', 'application/msword', 'icons/word.gif'); +INSERT INTO mime_types VALUES (21, 'dvi', 'application/x-dvi', NULL); +INSERT INTO mime_types VALUES (22, 'dxr', 'application/x-director', NULL); +INSERT INTO mime_types VALUES (23, 'eps', 'application/postscript', NULL); +INSERT INTO mime_types VALUES (24, 'etx', 'text/x-setext', NULL); +INSERT INTO mime_types VALUES (25, 'exe', 'application/octet-stream', NULL); +INSERT INTO mime_types VALUES (26, 'ez', 'application/andrew-inset', NULL); +INSERT INTO mime_types VALUES (27, 'gif', 'image/gif', 'icons/gif.gif'); +INSERT INTO mime_types VALUES (28, 'gtar', 'application/x-gtar', NULL); +INSERT INTO mime_types VALUES (29, 'hdf', 'application/x-hdf', NULL); +INSERT INTO mime_types VALUES (30, 'hqx', 'application/mac-binhex40', NULL); +INSERT INTO mime_types VALUES (31, 'htm', 'text/html', 'icons/html.gif'); +INSERT INTO mime_types VALUES (32, 'html', 'text/html', 'icons/html.gif'); +INSERT INTO mime_types VALUES (33, 'ice', 'x-conference/x-cooltalk', NULL); +INSERT INTO mime_types VALUES (34, 'ief', 'image/ief', NULL); +INSERT INTO mime_types VALUES (35, 'iges', 'model/iges', NULL); +INSERT INTO mime_types VALUES (36, 'igs', 'model/iges', NULL); +INSERT INTO mime_types VALUES (37, 'jpe', 'image/jpeg', 'icons/jpg.gif'); +INSERT INTO mime_types VALUES (38, 'jpeg', 'image/jpeg', 'icons/jpg.gif'); +INSERT INTO mime_types VALUES (39, 'jpg', 'image/jpeg', 'icons/jpg.gif'); +INSERT INTO mime_types VALUES (40, 'js', 'application/x-javascript', NULL); +INSERT INTO mime_types VALUES (41, 'kar', 'audio/midi', NULL); +INSERT INTO mime_types VALUES (42, 'latex', 'application/x-latex', NULL); +INSERT INTO mime_types VALUES (43, 'lha', 'application/octet-stream', NULL); +INSERT INTO mime_types VALUES (44, 'lzh', 'application/octet-stream', NULL); +INSERT INTO mime_types VALUES (45, 'man', 'application/x-troff-man', NULL); +INSERT INTO mime_types VALUES (46, 'mdb', 'application/access', 'icons/access.gif'); +INSERT INTO mime_types VALUES (47, 'mdf', 'application/access', 'icons/access.gif'); +INSERT INTO mime_types VALUES (48, 'me', 'application/x-troff-me', NULL); +INSERT INTO mime_types VALUES (49, 'mesh', 'model/mesh', NULL); +INSERT INTO mime_types VALUES (50, 'mid', 'audio/midi', NULL); +INSERT INTO mime_types VALUES (51, 'midi', 'audio/midi', NULL); +INSERT INTO mime_types VALUES (52, 'mif', 'application/vnd.mif', NULL); +INSERT INTO mime_types VALUES (53, 'mov', 'video/quicktime', NULL); +INSERT INTO mime_types VALUES (54, 'movie', 'video/x-sgi-movie', NULL); +INSERT INTO mime_types VALUES (55, 'mp2', 'audio/mpeg', NULL); +INSERT INTO mime_types VALUES (56, 'mp3', 'audio/mpeg', NULL); +INSERT INTO mime_types VALUES (57, 'mpe', 'video/mpeg', NULL); +INSERT INTO mime_types VALUES (58, 'mpeg', 'video/mpeg', NULL); +INSERT INTO mime_types VALUES (59, 'mpg', 'video/mpeg', NULL); +INSERT INTO mime_types VALUES (60, 'mpga', 'audio/mpeg', NULL); +INSERT INTO mime_types VALUES (61, 'mpp', 'application/vnd.ms-project', 'icons/project.gif'); +INSERT INTO mime_types VALUES (62, 'ms', 'application/x-troff-ms', NULL); +INSERT INTO mime_types VALUES (63, 'msh', 'model/mesh', NULL); +INSERT INTO mime_types VALUES (64, 'nc', 'application/x-netcdf', NULL); +INSERT INTO mime_types VALUES (65, 'oda', 'application/oda', NULL); +INSERT INTO mime_types VALUES (66, 'pbm', 'image/x-portable-bitmap', NULL); +INSERT INTO mime_types VALUES (67, 'pdb', 'chemical/x-pdb', NULL); +INSERT INTO mime_types VALUES (68, 'pdf', 'application/pdf', 'icons/pdf.gif'); +INSERT INTO mime_types VALUES (69, 'pgm', 'image/x-portable-graymap', NULL); +INSERT INTO mime_types VALUES (70, 'pgn', 'application/x-chess-pgn', NULL); +INSERT INTO mime_types VALUES (71, 'png', 'image/png', NULL); +INSERT INTO mime_types VALUES (72, 'pnm', 'image/x-portable-anymap', NULL); +INSERT INTO mime_types VALUES (73, 'ppm', 'image/x-portable-pixmap', NULL); +INSERT INTO mime_types VALUES (74, 'ppt', 'application/vnd.ms-powerpoint', 'icons/powerp.gif'); +INSERT INTO mime_types VALUES (75, 'ps', 'application/postscript', NULL); +INSERT INTO mime_types VALUES (76, 'qt', 'video/quicktime', NULL); +INSERT INTO mime_types VALUES (77, 'ra', 'audio/x-realaudio', NULL); +INSERT INTO mime_types VALUES (78, 'ram', 'audio/x-pn-realaudio', NULL); +INSERT INTO mime_types VALUES (79, 'ras', 'image/x-cmu-raster', NULL); +INSERT INTO mime_types VALUES (80, 'rgb', 'image/x-rgb', NULL); +INSERT INTO mime_types VALUES (81, 'rm', 'audio/x-pn-realaudio', NULL); +INSERT INTO mime_types VALUES (82, 'roff', 'application/x-troff', NULL); +INSERT INTO mime_types VALUES (83, 'rpm', 'audio/x-pn-realaudio-plugin', NULL); +INSERT INTO mime_types VALUES (84, 'rtf', 'text/rtf', NULL); +INSERT INTO mime_types VALUES (85, 'rtx', 'text/richtext', NULL); +INSERT INTO mime_types VALUES (86, 'sgm', 'text/sgml', NULL); +INSERT INTO mime_types VALUES (87, 'sgml', 'text/sgml', NULL); +INSERT INTO mime_types VALUES (88, 'sh', 'application/x-sh', NULL); +INSERT INTO mime_types VALUES (89, 'shar', 'application/x-shar', NULL); +INSERT INTO mime_types VALUES (90, 'silo', 'model/mesh', NULL); +INSERT INTO mime_types VALUES (91, 'sit', 'application/x-stuffit', NULL); +INSERT INTO mime_types VALUES (92, 'skd', 'application/x-koan', NULL); +INSERT INTO mime_types VALUES (93, 'skm', 'application/x-koan', NULL); +INSERT INTO mime_types VALUES (94, 'skp', 'application/x-koan', NULL); +INSERT INTO mime_types VALUES (95, 'skt', 'application/x-koan', NULL); +INSERT INTO mime_types VALUES (96, 'smi', 'application/smil', NULL); +INSERT INTO mime_types VALUES (97, 'smil', 'application/smil', NULL); +INSERT INTO mime_types VALUES (98, 'snd', 'audio/basic', NULL); +INSERT INTO mime_types VALUES (99, 'spl', 'application/x-futuresplash', NULL); +INSERT INTO mime_types VALUES (100, 'src', 'application/x-wais-source', NULL); +INSERT INTO mime_types VALUES (101, 'sv4cpio', 'application/x-sv4cpio', NULL); +INSERT INTO mime_types VALUES (102, 'sv4crc', 'application/x-sv4crc', NULL); +INSERT INTO mime_types VALUES (103, 'swf', 'application/x-shockwave-flash', NULL); +INSERT INTO mime_types VALUES (104, 't', 'application/x-troff', NULL); +INSERT INTO mime_types VALUES (105, 'tar', 'application/x-tar', NULL); +INSERT INTO mime_types VALUES (106, 'tcl', 'application/x-tcl', NULL); +INSERT INTO mime_types VALUES (107, 'tex', 'application/x-tex', NULL); +INSERT INTO mime_types VALUES (108, 'texi', 'application/x-texinfo', NULL); +INSERT INTO mime_types VALUES (109, 'texinfo', 'application/x-texinfo', NULL); +INSERT INTO mime_types VALUES (110, 'tif', 'image/tiff', 'icons/tiff.gif'); +INSERT INTO mime_types VALUES (111, 'tiff', 'image/tiff', 'icons/tiff.gif'); +INSERT INTO mime_types VALUES (112, 'tr', 'application/x-troff', NULL); +INSERT INTO mime_types VALUES (113, 'tsv', 'text/tab-separated-values', NULL); +INSERT INTO mime_types VALUES (114, 'txt', 'text/plain', 'icons/txt.gif'); +INSERT INTO mime_types VALUES (115, 'ustar', 'application/x-ustar', NULL); +INSERT INTO mime_types VALUES (116, 'vcd', 'application/x-cdlink', NULL); +INSERT INTO mime_types VALUES (117, 'vrml', 'model/vrml', NULL); +INSERT INTO mime_types VALUES (118, 'vsd', 'application/vnd.visio', 'icons/visio.gif'); +INSERT INTO mime_types VALUES (119, 'wav', 'audio/x-wav', NULL); +INSERT INTO mime_types VALUES (120, 'wrl', 'model/vrml', NULL); +INSERT INTO mime_types VALUES (121, 'xbm', 'image/x-xbitmap', NULL); +INSERT INTO mime_types VALUES (122, 'xls', 'application/vnd.ms-excel', 'icons/excel.gif'); +INSERT INTO mime_types VALUES (123, 'xml', 'text/xml', NULL); +INSERT INTO mime_types VALUES (124, 'xpm', 'image/x-xpixmap', NULL); +INSERT INTO mime_types VALUES (125, 'xwd', 'image/x-xwindowdump', NULL); +INSERT INTO mime_types VALUES (126, 'xyz', 'chemical/x-pdb', NULL); +INSERT INTO mime_types VALUES (127, 'zip', 'application/zip', 'icons/zip.gif'); +INSERT INTO mime_types VALUES (128, 'gz', 'application/x-gzip', 'icons/zip.gif'); +INSERT INTO mime_types VALUES (129, 'tgz', 'application/x-gzip', 'icons/zip.gif'); +INSERT INTO mime_types VALUES (130, 'sxw', 'application/vnd.sun.xml.writer', 'icons/oowriter.gif'); +INSERT INTO mime_types VALUES (131, 'stw', 'application/vnd.sun.xml.writer.template', 'icons/oowriter.gif'); +INSERT INTO mime_types VALUES (132, 'sxc', 'application/vnd.sun.xml.calc', 'icons/oocalc.gif'); +INSERT INTO mime_types VALUES (133, 'stc', 'application/vnd.sun.xml.calc.template', 'icons/oocalc.gif'); +INSERT INTO mime_types VALUES (134, 'sxd', 'application/vnd.sun.xml.draw', NULL); +INSERT INTO mime_types VALUES (135, 'std', 'application/vnd.sun.xml.draw.template', NULL); +INSERT INTO mime_types VALUES (136, 'sxi', 'application/vnd.sun.xml.impress', 'icons/ooimpress.gif'); +INSERT INTO mime_types VALUES (137, 'sti', 'application/vnd.sun.xml.impress.template', 'icons/ooimpress.gif'); +INSERT INTO mime_types VALUES (138, 'sxg', 'application/vnd.sun.xml.writer.global', NULL); +INSERT INTO mime_types VALUES (139, 'sxm', 'application/vnd.sun.xml.math', NULL); + +-- +-- Dumping data for table `news` +-- + + +-- +-- Dumping data for table `organisations_lookup` +-- + +INSERT INTO organisations_lookup VALUES (1, 'Default Organisation'); + +-- +-- Dumping data for table `roles` +-- + + +-- +-- Dumping data for table `search_document_user_link` +-- + + +-- +-- Dumping data for table `status_lookup` +-- + +INSERT INTO status_lookup VALUES (1, 'Live'); +INSERT INTO status_lookup VALUES (2, 'Published'); +INSERT INTO status_lookup VALUES (3, 'Deleted'); +INSERT INTO status_lookup VALUES (4, 'Archived'); + +-- +-- Dumping data for table `system_settings` +-- + +INSERT INTO system_settings VALUES (1, 'lastIndexUpdate', '0'); +INSERT INTO system_settings VALUES (2, 'knowledgeTreeVersion', '1.2.5'); + +-- +-- Dumping data for table `time_period` +-- + + +-- +-- Dumping data for table `time_unit_lookup` +-- + +INSERT INTO time_unit_lookup VALUES (1, 'Years'); +INSERT INTO time_unit_lookup VALUES (2, 'Months'); +INSERT INTO time_unit_lookup VALUES (3, 'Days'); + +-- +-- Dumping data for table `units_lookup` +-- + +INSERT INTO units_lookup VALUES (1, 'Default Unit'); + +-- +-- Dumping data for table `units_organisations_link` +-- + +INSERT INTO units_organisations_link VALUES (1, 1, 1); + +-- +-- Dumping data for table `users` +-- + +INSERT INTO users VALUES (1, 'admin', 'Administrator', '21232f297a57a5a743894a0e4a801fc3', 0, 0, '', '', 1, 1, '', 1, 1); +INSERT INTO users VALUES (2, 'unitAdmin', 'Unit Administrator', '21232f297a57a5a743894a0e4a801fc3', 0, 0, '', '', 1, 1, '', 1, 1); +INSERT INTO users VALUES (3, 'guest', 'Anonymous', '084e0343a0486ff05530df6c705c8bb4', 0, 0, '', '', 0, 0, '', 19, 1); + +-- +-- Dumping data for table `users_groups_link` +-- + +INSERT INTO users_groups_link VALUES (1, 1, 1); +INSERT INTO users_groups_link VALUES (2, 2, 2); +INSERT INTO users_groups_link VALUES (3, 3, 3); + +-- +-- Dumping data for table `web_documents` +-- + + +-- +-- Dumping data for table `web_documents_status_lookup` +-- + +INSERT INTO web_documents_status_lookup VALUES (1, 'Pending'); +INSERT INTO web_documents_status_lookup VALUES (2, 'Published'); +INSERT INTO web_documents_status_lookup VALUES (3, 'Not Published'); + +-- +-- Dumping data for table `web_sites` +-- + + +-- +-- Dumping data for table `zseq_active_sessions` +-- + +INSERT INTO zseq_active_sessions VALUES (1); + +-- +-- Dumping data for table `zseq_archive_restoration_request` +-- + +INSERT INTO zseq_archive_restoration_request VALUES (1); + +-- +-- Dumping data for table `zseq_archiving_settings` +-- + +INSERT INTO zseq_archiving_settings VALUES (1); + +-- +-- Dumping data for table `zseq_archiving_type_lookup` +-- + +INSERT INTO zseq_archiving_type_lookup VALUES (2); + +-- +-- Dumping data for table `zseq_data_types` +-- + +INSERT INTO zseq_data_types VALUES (5); + +-- +-- Dumping data for table `zseq_dependant_document_instance` +-- + +INSERT INTO zseq_dependant_document_instance VALUES (1); + +-- +-- Dumping data for table `zseq_dependant_document_template` +-- + +INSERT INTO zseq_dependant_document_template VALUES (1); + +-- +-- Dumping data for table `zseq_discussion_comments` +-- + +INSERT INTO zseq_discussion_comments VALUES (1); + +-- +-- Dumping data for table `zseq_discussion_threads` +-- + +INSERT INTO zseq_discussion_threads VALUES (1); + +-- +-- Dumping data for table `zseq_document_archiving_link` +-- + +INSERT INTO zseq_document_archiving_link VALUES (1); + +-- +-- Dumping data for table `zseq_document_fields` +-- + +INSERT INTO zseq_document_fields VALUES (1); + +-- +-- Dumping data for table `zseq_document_fields_link` +-- + +INSERT INTO zseq_document_fields_link VALUES (1); + +-- +-- Dumping data for table `zseq_document_link` +-- + +INSERT INTO zseq_document_link VALUES (1); + +-- +-- Dumping data for table `zseq_document_subscriptions` +-- + +INSERT INTO zseq_document_subscriptions VALUES (1); + +-- +-- Dumping data for table `zseq_document_text` +-- + +INSERT INTO zseq_document_text VALUES (1); + +-- +-- Dumping data for table `zseq_document_transaction_types_lookup` +-- + +INSERT INTO zseq_document_transaction_types_lookup VALUES (14); + +-- +-- Dumping data for table `zseq_document_transactions` +-- + +INSERT INTO zseq_document_transactions VALUES (1); + +-- +-- Dumping data for table `zseq_document_type_fields_link` +-- + +INSERT INTO zseq_document_type_fields_link VALUES (1); + +-- +-- Dumping data for table `zseq_document_types_lookup` +-- + +INSERT INTO zseq_document_types_lookup VALUES (1); + +-- +-- Dumping data for table `zseq_documents` +-- + +INSERT INTO zseq_documents VALUES (1); + +-- +-- Dumping data for table `zseq_folder_doctypes_link` +-- + +INSERT INTO zseq_folder_doctypes_link VALUES (1); + +-- +-- Dumping data for table `zseq_folder_subscriptions` +-- + +INSERT INTO zseq_folder_subscriptions VALUES (1); + +-- +-- Dumping data for table `zseq_folders` +-- + +INSERT INTO zseq_folders VALUES (2); + +-- +-- Dumping data for table `zseq_folders_users_roles_link` +-- + +INSERT INTO zseq_folders_users_roles_link VALUES (1); + +-- +-- Dumping data for table `zseq_groups_folders_approval_link` +-- + +INSERT INTO zseq_groups_folders_approval_link VALUES (1); + +-- +-- Dumping data for table `zseq_groups_folders_link` +-- + +INSERT INTO zseq_groups_folders_link VALUES (1); + +-- +-- Dumping data for table `zseq_groups_lookup` +-- + +INSERT INTO zseq_groups_lookup VALUES (3); + +-- +-- Dumping data for table `zseq_groups_units_link` +-- + +INSERT INTO zseq_groups_units_link VALUES (1); + +-- +-- Dumping data for table `zseq_help` +-- + +INSERT INTO zseq_help VALUES (98); + +-- +-- Dumping data for table `zseq_links` +-- + +INSERT INTO zseq_links VALUES (1); + +-- +-- Dumping data for table `zseq_metadata_lookup` +-- + +INSERT INTO zseq_metadata_lookup VALUES (1); + +-- +-- Dumping data for table `zseq_mime_types` +-- + +INSERT INTO zseq_mime_types VALUES (139); + +-- +-- Dumping data for table `zseq_news` +-- + +INSERT INTO zseq_news VALUES (1); + +-- +-- Dumping data for table `zseq_organisations_lookup` +-- + +INSERT INTO zseq_organisations_lookup VALUES (1); + +-- +-- Dumping data for table `zseq_roles` +-- + +INSERT INTO zseq_roles VALUES (1); + +-- +-- Dumping data for table `zseq_search_document_user_link` +-- + +INSERT INTO zseq_search_document_user_link VALUES (1); + +-- +-- Dumping data for table `zseq_status_lookup` +-- + +INSERT INTO zseq_status_lookup VALUES (4); + +-- +-- Dumping data for table `zseq_system_settings` +-- + +INSERT INTO zseq_system_settings VALUES (2); + +-- +-- Dumping data for table `zseq_time_period` +-- + +INSERT INTO zseq_time_period VALUES (1); + +-- +-- Dumping data for table `zseq_time_unit_lookup` +-- + +INSERT INTO zseq_time_unit_lookup VALUES (3); + +-- +-- Dumping data for table `zseq_units_lookup` +-- + +INSERT INTO zseq_units_lookup VALUES (1); + +-- +-- Dumping data for table `zseq_units_organisations_link` +-- + +INSERT INTO zseq_units_organisations_link VALUES (1); + +-- +-- Dumping data for table `zseq_users` +-- + +INSERT INTO zseq_users VALUES (3); + +-- +-- Dumping data for table `zseq_users_groups_link` +-- + +INSERT INTO zseq_users_groups_link VALUES (3); + +-- +-- Dumping data for table `zseq_web_documents` +-- + +INSERT INTO zseq_web_documents VALUES (1); + +-- +-- Dumping data for table `zseq_web_documents_status_lookup` +-- + +INSERT INTO zseq_web_documents_status_lookup VALUES (3); + +-- +-- Dumping data for table `zseq_web_sites` +-- + +INSERT INTO zseq_web_sites VALUES (1); diff --git a/sql/mysql/upgrade/1.2.4-to-1.2.5.sql b/sql/mysql/upgrade/1.2.4-to-1.2.5.sql index b74c248..83c7c87 100644 --- a/sql/mysql/upgrade/1.2.4-to-1.2.5.sql +++ b/sql/mysql/upgrade/1.2.4-to-1.2.5.sql @@ -1 +1,394 @@ -UPDATE system_settings SET value="1.2.5" WHERE name="knowledgeTreeVersion"; \ No newline at end of file +UPDATE system_settings SET value="1.2.5" WHERE name="knowledgeTreeVersion"; + +DROP TABLE IF EXISTS zseq_active_sessions; +CREATE TABLE zseq_active_sessions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_active_sessions` SELECT MAX(`id`) FROM `active_sessions`; +ALTER TABLE `active_sessions` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_archive_restoration_request; +CREATE TABLE zseq_archive_restoration_request ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_archive_restoration_request` SELECT MAX(`id`) FROM `archive_restoration_request`; +ALTER TABLE `archive_restoration_request` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_archiving_settings; +CREATE TABLE zseq_archiving_settings ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_archiving_settings` SELECT MAX(`id`) FROM `archiving_settings`; +ALTER TABLE `archiving_settings` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_archiving_type_lookup; +CREATE TABLE zseq_archiving_type_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_archiving_type_lookup` SELECT MAX(`id`) FROM `archiving_type_lookup`; +ALTER TABLE `archiving_type_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_data_types; +CREATE TABLE zseq_data_types ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_data_types` SELECT MAX(`id`) FROM `data_types`; +ALTER TABLE `data_types` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_dependant_document_instance; +CREATE TABLE zseq_dependant_document_instance ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_dependant_document_instance` SELECT MAX(`id`) FROM `dependant_document_instance`; +ALTER TABLE `dependant_document_instance` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_dependant_document_template; +CREATE TABLE zseq_dependant_document_template ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_dependant_document_template` SELECT MAX(`id`) FROM `dependant_document_template`; +ALTER TABLE `dependant_document_template` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_discussion_comments; +CREATE TABLE zseq_discussion_comments ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_discussion_comments` SELECT MAX(`id`) FROM `discussion_comments`; +ALTER TABLE `discussion_comments` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_discussion_threads; +CREATE TABLE zseq_discussion_threads ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_discussion_threads` SELECT MAX(`id`) FROM `discussion_threads`; +ALTER TABLE `discussion_threads` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_archiving_link; +CREATE TABLE zseq_document_archiving_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_archiving_link` SELECT MAX(`id`) FROM `document_archiving_link`; +ALTER TABLE `document_archiving_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_fields; +CREATE TABLE zseq_document_fields ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_fields` SELECT MAX(`id`) FROM `document_fields`; +ALTER TABLE `document_fields` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_fields_link; +CREATE TABLE zseq_document_fields_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_fields_link` SELECT MAX(`id`) FROM `document_fields_link`; +ALTER TABLE `document_fields_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_link; +CREATE TABLE zseq_document_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_link` SELECT MAX(`id`) FROM `document_link`; +ALTER TABLE `document_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_subscriptions; +CREATE TABLE zseq_document_subscriptions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_subscriptions` SELECT MAX(`id`) FROM `document_subscriptions`; +ALTER TABLE `document_subscriptions` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_text; +CREATE TABLE zseq_document_text ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_text` SELECT MAX(`id`) FROM `document_text`; +ALTER TABLE `document_text` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_transaction_types_lookup; +CREATE TABLE zseq_document_transaction_types_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_transaction_types_lookup` SELECT MAX(`id`) FROM `document_transaction_types_lookup`; +ALTER TABLE `document_transaction_types_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_transactions; +CREATE TABLE zseq_document_transactions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_transactions` SELECT MAX(`id`) FROM `document_transactions`; +ALTER TABLE `document_transactions` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_type_fields_link; +CREATE TABLE zseq_document_type_fields_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_type_fields_link` SELECT MAX(`id`) FROM `document_type_fields_link`; +ALTER TABLE `document_type_fields_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_document_types_lookup; +CREATE TABLE zseq_document_types_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_document_types_lookup` SELECT MAX(`id`) FROM `document_types_lookup`; +ALTER TABLE `document_types_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_documents; +CREATE TABLE zseq_documents ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_documents` SELECT MAX(`id`) FROM `documents`; +ALTER TABLE `documents` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_folder_doctypes_link; +CREATE TABLE zseq_folder_doctypes_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_folder_doctypes_link` SELECT MAX(`id`) FROM `folder_doctypes_link`; +ALTER TABLE `folder_doctypes_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_folder_subscriptions; +CREATE TABLE zseq_folder_subscriptions ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_folder_subscriptions` SELECT MAX(`id`) FROM `folder_subscriptions`; +ALTER TABLE `folder_subscriptions` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_folders; +CREATE TABLE zseq_folders ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_folders` SELECT MAX(`id`) FROM `folders`; +ALTER TABLE `folders` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_folders_users_roles_link; +CREATE TABLE zseq_folders_users_roles_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_folders_users_roles_link` SELECT MAX(`id`) FROM `folders_users_roles_link`; +ALTER TABLE `folders_users_roles_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_groups_folders_approval_link; +CREATE TABLE zseq_groups_folders_approval_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_groups_folders_approval_link` SELECT MAX(`id`) FROM `groups_folders_approval_link`; +ALTER TABLE `groups_folders_approval_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_groups_folders_link; +CREATE TABLE zseq_groups_folders_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_groups_folders_link` SELECT MAX(`id`) FROM `groups_folders_link`; +ALTER TABLE `groups_folders_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_groups_lookup; +CREATE TABLE zseq_groups_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_groups_lookup` SELECT MAX(`id`) FROM `groups_lookup`; +ALTER TABLE `groups_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_groups_units_link; +CREATE TABLE zseq_groups_units_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_groups_units_link` SELECT MAX(`id`) FROM `groups_units_link`; +ALTER TABLE `groups_units_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_help; +CREATE TABLE zseq_help ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_help` SELECT MAX(`id`) FROM `help`; +ALTER TABLE `help` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_links; +CREATE TABLE zseq_links ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_links` SELECT MAX(`id`) FROM `links`; +ALTER TABLE `links` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_metadata_lookup; +CREATE TABLE zseq_metadata_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_metadata_lookup` SELECT MAX(`id`) FROM `metadata_lookup`; +ALTER TABLE `metadata_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_mime_types; +CREATE TABLE zseq_mime_types ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_mime_types` SELECT MAX(`id`) FROM `mime_types`; +ALTER TABLE `mime_types` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_news; +CREATE TABLE zseq_news ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_news` SELECT MAX(`id`) FROM `news`; +ALTER TABLE `news` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_organisations_lookup; +CREATE TABLE zseq_organisations_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_organisations_lookup` SELECT MAX(`id`) FROM `organisations_lookup`; +ALTER TABLE `organisations_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_roles; +CREATE TABLE zseq_roles ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_roles` SELECT MAX(`id`) FROM `roles`; +ALTER TABLE `roles` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_search_document_user_link; +CREATE TABLE zseq_search_document_user_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_search_document_user_link` SELECT MAX(`id`) FROM `search_document_user_link`; +ALTER TABLE `search_document_user_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_status_lookup; +CREATE TABLE zseq_status_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_status_lookup` SELECT MAX(`id`) FROM `status_lookup`; +ALTER TABLE `status_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_system_settings; +CREATE TABLE zseq_system_settings ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_system_settings` SELECT MAX(`id`) FROM `system_settings`; +ALTER TABLE `system_settings` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_time_period; +CREATE TABLE zseq_time_period ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_time_period` SELECT MAX(`id`) FROM `time_period`; +ALTER TABLE `time_period` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_time_unit_lookup; +CREATE TABLE zseq_time_unit_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_time_unit_lookup` SELECT MAX(`id`) FROM `time_unit_lookup`; +ALTER TABLE `time_unit_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_units_lookup; +CREATE TABLE zseq_units_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_units_lookup` SELECT MAX(`id`) FROM `units_lookup`; +ALTER TABLE `units_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_units_organisations_link; +CREATE TABLE zseq_units_organisations_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_units_organisations_link` SELECT MAX(`id`) FROM `units_organisations_link`; +ALTER TABLE `units_organisations_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_users; +CREATE TABLE zseq_users ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_users` SELECT MAX(`id`) FROM `users`; +ALTER TABLE `users` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_users_groups_link; +CREATE TABLE zseq_users_groups_link ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_users_groups_link` SELECT MAX(`id`) FROM `users_groups_link`; +ALTER TABLE `users_groups_link` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_web_documents; +CREATE TABLE zseq_web_documents ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_web_documents` SELECT MAX(`id`) FROM `web_documents`; +ALTER TABLE `web_documents` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_web_documents_status_lookup; +CREATE TABLE zseq_web_documents_status_lookup ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_web_documents_status_lookup` SELECT MAX(`id`) FROM `web_documents_status_lookup`; +ALTER TABLE `web_documents_status_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL; + +DROP TABLE IF EXISTS zseq_web_sites; +CREATE TABLE zseq_web_sites ( + id int(10) unsigned NOT NULL auto_increment, + PRIMARY KEY (id) +) TYPE=MyISAM; +INSERT INTO `zseq_web_sites` SELECT MAX(`id`) FROM `web_sites`; +ALTER TABLE `web_sites` CHANGE `id` `id` INT( 11 ) NOT NULL; + + +ALTER TABLE `users` ADD UNIQUE ( + `username` +); +ALTER TABLE `document_types_lookup` ADD UNIQUE ( + `name` +); +ALTER TABLE `groups_lookup` ADD UNIQUE ( + `name` +); +ALTER TABLE `organisations_lookup` ADD UNIQUE ( + `name` +); +ALTER TABLE `roles` ADD UNIQUE ( + `name` +);