Commit 5be02429572d4629d44231546c77f5896bcdcede

Authored by nbm
1 parent cb47dcbb

Move over to PEAR::DB's autoExecute via DBUtil::autoInsert, which gets

rid of all non-portable insert_id calls and introduces portable
sequences.

You must run the commands in sql/mysql/upgrade/1.2.4-to-1.2.5.sql for
KnowledgeTree to function on your data.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3025 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 44 changed files with 3153 additions and 1233 deletions
lib/DefaultLookup.inc
... ... @@ -81,14 +81,18 @@ class DefaultLookup {
81 81 global $default;
82 82 //don't create the object if it's aready been created
83 83 if ($this->iId < 0) {
84   - $sql = $default->db;
85   - $result = $sql->query("INSERT INTO $this->sTableName (name) VALUES ('$this->sName')");
86   - if ($result) {
87   - //set the primary key;
88   - $this->iId = $sql->insert_id();
89   - return true;
90   - }
91   - return false;
  84 + $sTable = $this->sTableName;
  85 + $aFieldValues = array(
  86 + 'name' => $this->sName,
  87 + );
  88 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  89 +
  90 + if (PEAR::isError($id)) {
  91 + $_SESSION["errorMessage"] = $id->toString();
  92 + return false;
  93 + }
  94 + $this->iId = $id;
  95 + return true;
92 96 }
93 97 return false;
94 98 }
... ...
lib/archiving/ArchiveRestorationRequest.inc
... ... @@ -145,15 +145,21 @@ class ArchiveRestorationRequest {
145 145 global $default;
146 146 //if the id >= 0, then the object has already been created
147 147 if ($this->iId < 0) {
148   - $sql = $default->db;
149   - $result = $sql->query("INSERT INTO $default->archive_restoration_table (document_id, request_user_id, admin_user_id, datetime) " .
150   - "VALUES ($this->iDocumentID, $this->iRequestUserID, $this->iAdminUserID, '$this->dDateTime')");
151   - if ($result) {
152   - //set the current primary key
153   - $this->iId = $sql->insert_id();
154   - return true;
  148 + $sTable = $default->archive_restoration_table;
  149 + $aFieldValues = array(
  150 + 'document_id' => $this->iDocumentID,
  151 + 'request_user_id' => $this->iRequestUserID,
  152 + 'admin_user_id' => $this->iAdminUserID,
  153 + 'datetime' => $this->dDateTime,
  154 + );
  155 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  156 +
  157 + if (PEAR::isError($id)) {
  158 + $_SESSION["errorMessage"] = $id->toString();
  159 + return false;
155 160 }
156   - return false;
  161 + $this->iId = $id;
  162 + return true;
157 163 }
158 164 return false;
159 165 }
... ... @@ -260,4 +266,4 @@ class ArchiveRestorationRequest {
260 266 }
261 267 return false;
262 268 }
263   -}
264 269 \ No newline at end of file
  270 +}
... ...
lib/archiving/ArchivingSettings.inc
... ... @@ -144,17 +144,21 @@ class ArchivingSettings {
144 144 global $default;
145 145 //if the id >= 0, then the object has already been created
146 146 if ($this->iId < 0) {
147   - $sql = $default->db;
148   - $sQuery = "INSERT INTO $default->archiving_settings_table (archiving_type_id, expiration_date, document_transaction_id, time_period_id) " .
149   - "VALUES ($this->iArchivingTypeID, " . $this->addQuotes($this->dExpirationDate) . ", $this->iDocumentTransactionID, $this->iTimePeriodID)";
150   - $result = $sql->query($sQuery);
151   - $default->log->info($sQuery);
152   - if ($result) {
153   - //set the current primary key
154   - $this->iId = $sql->insert_id();
155   - return true;
  147 + $sTable = $default->archiving_settings_table;
  148 + $aFieldValues = array(
  149 + 'archiving_type_id' => $this->iArchivingTypeID,
  150 + 'expiration_date' => $this->dExpirationDate,
  151 + 'document_transaction_id' => $this->iDocumentTransactionID,
  152 + 'time_period_id' => $this->iTimePeriodID,
  153 + );
  154 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  155 +
  156 + if (PEAR::isError($id)) {
  157 + $_SESSION["errorMessage"] = $id->toString();
  158 + return false;
156 159 }
157   - return false;
  160 + $this->iId = $id;
  161 + return true;
158 162 }
159 163 return false;
160 164 }
... ... @@ -255,4 +259,4 @@ class ArchivingSettings {
255 259 return false;
256 260 }
257 261 }
258   -?>
259 262 \ No newline at end of file
  263 +?>
... ...
lib/archiving/ArchivingType.inc
... ... @@ -80,15 +80,18 @@ class ArchivingType {
80 80 global $default;
81 81 //if the id >= 0, then the object has already been created
82 82 if ($this->iId < 0) {
83   - $sql = $default->db;
84   - $result = $sql->query("INSERT INTO $default->archiving_type_lookup_table (name) " .
85   - "VALUES ('$this->sName')");
86   - if ($result) {
87   - //set the current primary key
88   - $this->iId = $sql->insert_id();
89   - return true;
  83 + $sTable = $default->archiving_type_lookup_table;
  84 + $aFieldValues = array(
  85 + 'name' => $this->sName,
  86 + );
  87 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  88 +
  89 + if (PEAR::isError($id)) {
  90 + $_SESSION["errorMessage"] = $id->toString();
  91 + return false;
90 92 }
91   - return false;
  93 + $this->iId = $id;
  94 + return true;
92 95 }
93 96 return false;
94 97 }
... ... @@ -175,4 +178,4 @@ class ArchivingType {
175 178 }
176 179 return false;
177 180 }
178   -}
179 181 \ No newline at end of file
  182 +}
... ...
lib/archiving/DocumentArchiving.inc
... ... @@ -103,15 +103,19 @@ class DocumentArchiving {
103 103 global $default;
104 104 //if the id >= 0, then the object has already been created
105 105 if ($this->iId < 0) {
106   - $sql = $default->db;
107   - $result = $sql->query("INSERT INTO $default->document_archiving_table (document_id, archiving_settings_id) " .
108   - "VALUES ($this->iDocumentID, $this->iArchivingSettingsID)");
109   - if ($result) {
110   - //set the current primary key
111   - $this->iId = $sql->insert_id();
112   - return true;
  106 + $sTable = $default->document_archiving_table;
  107 + $aFieldValues = array(
  108 + 'document_id' => $this->iDocumentID,
  109 + 'archiving_settings_id' => $this->iArchivingSettingsID,
  110 + );
  111 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  112 +
  113 + if (PEAR::isError($id)) {
  114 + $_SESSION["errorMessage"] = $id->toString();
  115 + return false;
113 116 }
114   - return false;
  117 + $this->iId = $id;
  118 + return true;
115 119 }
116 120 return false;
117 121 }
... ... @@ -218,4 +222,4 @@ class DocumentArchiving {
218 222 }
219 223 return false;
220 224 }
221   -}
222 225 \ No newline at end of file
  226 +}
... ...
lib/archiving/TimePeriod.inc
... ... @@ -101,15 +101,19 @@ class TimePeriod {
101 101 global $default;
102 102 //if the id >= 0, then the object has already been created
103 103 if ($this->iId < 0) {
104   - $sql = $default->db;
105   - $result = $sql->query("INSERT INTO $default->time_period_table (time_unit_id, units) " .
106   - "VALUES ($this->iTimeUnitID, $this->iUnits)");
107   - if ($result) {
108   - //set the current primary key
109   - $this->iId = $sql->insert_id();
110   - return true;
  104 + $sTable = $default->time_period_table;
  105 + $aFieldValues = array(
  106 + 'time_unit_id' => $this->iTimeUnitID,
  107 + 'units' => $this->iUnits
  108 + );
  109 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  110 +
  111 + if (PEAR::isError($id)) {
  112 + $_SESSION["errorMessage"] = $id->toString();
  113 + return false;
111 114 }
112   - return false;
  115 + $this->iId = $id;
  116 + return true;
113 117 }
114 118 return false;
115 119 }
... ... @@ -197,4 +201,4 @@ class TimePeriod {
197 201 }
198 202 return false;
199 203 }
200   -}
201 204 \ No newline at end of file
  205 +}
... ...
lib/archiving/TimeUnit.inc
... ... @@ -80,15 +80,18 @@ class TimeUnit {
80 80 global $default;
81 81 //if the id >= 0, then the object has already been created
82 82 if ($this->iId < 0) {
83   - $sql = $default->db;
84   - $result = $sql->query("INSERT INTO $default->time_unit_lookup_table (name) " .
85   - "VALUES ('$this->sName')");
86   - if ($result) {
87   - //set the current primary key
88   - $this->iId = $sql->insert_id();
89   - return true;
  83 + $sTable = $default->time_unit_lookup_table;
  84 + $aFieldValues = array(
  85 + 'name' => $this->sName,
  86 + );
  87 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  88 +
  89 + if (PEAR::isError($id)) {
  90 + $_SESSION["errorMessage"] = $id->toString();
  91 + return false;
90 92 }
91   - return false;
  93 + $this->iId = $id;
  94 + return true;
92 95 }
93 96 return false;
94 97 }
... ... @@ -175,4 +178,4 @@ class TimeUnit {
175 178 }
176 179 return false;
177 180 }
178   -}
179 181 \ No newline at end of file
  182 +}
... ...
lib/dashboard/DashboardNews.inc
... ... @@ -66,7 +66,7 @@ class DashboardNews {
66 66 /**
67 67 * Is this news item active
68 68 */
69   - var $bActive;
  69 + var $bActive = true;
70 70  
71 71 /**
72 72 * Constructs a news item
... ... @@ -226,7 +226,7 @@ class DashboardNews {
226 226 * @param boolean new active status
227 227 */
228 228 function setActive($bNewActive) {
229   - $this->bActive = $bNewActive;
  229 + $this->bActive = KTUtil::anyToBool($bNewActive);
230 230 }
231 231  
232 232 /**
... ... @@ -304,22 +304,23 @@ class DashboardNews {
304 304 global $default;
305 305 //if the id >= 0, then the object has already been created
306 306 if ($this->iId < 0) {
307   - $sql = $default->db;
308   - $result = $sql->query("INSERT INTO $default->news_table (synopsis, body, rank, image, image_size, image_mime_type_id, active) " .
309   - "VALUES ('$this->sSynopsis', '$this->sBody', $this->iRank, " .
310   - "'" . addslashes($this->sImage) . "', $this->iImageSize, $this->iImageMimeTypeID, " . ($this->bActive ? "1" : "0") . ")");
311   - if ($result) {
312   - //set the current news item primary key
313   - $this->iId = $sql->insert_id();
314   -
315   -// if ($this->bActive) {
316   -// // we're setting this entry to active, so set all the others to inactive
317   -// $sql->query("UPDATE $default->news_table SET active=0 WHERE id <> $this->iId");
318   -// }
319   -
320   - return true;
  307 + $aFieldValues = array(
  308 + 'synopsis' => $this->sSynopsis,
  309 + 'body' => $this->sBody,
  310 + 'rank' => $this->iRank,
  311 + 'image' => $this->sImage,
  312 + 'image_size' => $this->iImageSize,
  313 + 'image_mime_type_id' => $this->iImageMimeTypeID,
  314 + 'active' => $this->bActive,
  315 + );
  316 + $id =& DBUtil::autoInsert($default->news_table, $aFieldValues);
  317 +
  318 + if (PEAR::isError($id)) {
  319 + $_SESSION["errorMessage"] = $id->toString();
  320 + return false;
321 321 }
322   - return false;
  322 + $this->iId = $id;
  323 + return true;
323 324 }
324 325 return false;
325 326 }
... ...
lib/discussions/DiscussionComment.inc
... ... @@ -194,16 +194,23 @@ class DiscussionComment {
194 194 global $default, $lang_err_database, $lang_err_object_exists;
195 195 //if the object hasn't been created
196 196 if ($this->iId < 0) { //check to see if comment exists
197   - $sql = $default->db;
198   -
199   - $result = $sql->query("INSERT INTO " . $default->discussion_comments_table . " (thread_id,user_id,subject, body, date, in_reply_to)" .
200   - "VALUES (" . $this->iThreadID . "," . $this->iUserID . ",\"" . $this->sSubject . "\",\"" . $this->sBody . "\", Now(), " . $this->iInReplyTo . ")");
201   - if ($result) {
202   - $this->iId = $sql->insert_id();
203   - return true;
204   - }
205   - return false;
206   -
  197 + $sTable = $default->discussion_comments_table;
  198 + $aFieldValues = array(
  199 + 'thread_id' => $this->iThreadID,
  200 + 'user_id' => $this->iUserID,
  201 + 'subject' => $this->sSubject,
  202 + 'body' => $this->sBody,
  203 + 'date' => getCurrentDate(),
  204 + 'in_reply_to' => $this->iInReplyTo,
  205 + );
  206 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  207 +
  208 + if (PEAR::isError($id)) {
  209 + $_SESSION["errorMessage"] = $id->toString();
  210 + return false;
  211 + }
  212 + $this->iId = $id;
  213 + return true;
207 214 }
208 215 return false;
209 216 }
... ...
lib/discussions/DiscussionThread.inc
... ... @@ -243,17 +243,23 @@ class DiscussionThread {
243 243 global $default, $lang_err_database, $lang_err_object_exists;
244 244 //if the object hasn't been created
245 245 if ($this->iId < 0) { //check to see if entry exists
246   - $sql = $default->db;
247   - $sQuery = "INSERT INTO " . $default->discussion_threads_table .
248   - " (document_id, first_comment_id, last_comment_id, views, replies, creator_id) " .
249   - "VALUES (" . $this->iDocumentID . "," . $this->iFirstCommentID . "," . $this->iLastCommentID . "," . $this->iNumberOfViews . "," . $this->iNumberOfReplies ."," . $this->iCreatorID . ")";
250   - $result = $sql->query($sQuery);
251   -
252   - if ($result) {
253   - $this->iId = $sql->insert_id();
254   - return true;
255   - }
256   - return false;
  246 + $sTable = $default->discussion_threads_table;
  247 + $aFieldValues = array(
  248 + 'document_id' => $this->iDocumentID,
  249 + 'first_comment_id' => $this->iFirstCommentID,
  250 + 'last_comment_id' => $this->iLastCommentID,
  251 + 'views' => $this->iNumberOfViews,
  252 + 'replies' => $this->iNumberOfReplies,
  253 + 'creator_id' => $this->iCreatorID,
  254 + );
  255 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  256 +
  257 + if (PEAR::isError($id)) {
  258 + $_SESSION["errorMessage"] = $id->toString();
  259 + return false;
  260 + }
  261 + $this->iId = $id;
  262 + return true;
257 263 }
258 264  
259 265 return false;
... ... @@ -319,4 +325,4 @@ class DiscussionThread {
319 325 }
320 326 }
321 327  
322   -?>
323 328 \ No newline at end of file
  329 +?>
... ...
lib/dms.inc
... ... @@ -29,6 +29,7 @@
29 29 * Initialises the web application by making current
30 30 * request parameters global and loading the default language
31 31 */
  32 +
32 33 // make request parameters global
33 34 if (substr(phpversion(),0,5) >= "4.1.0") {
34 35 // if supported by the installed version of PHP
... ...
lib/documentmanagement/DependantDocumentInstance.inc
... ... @@ -125,14 +125,22 @@ class DependantDocumentInstance {
125 125 function create() {
126 126 global $default;
127 127 //if the object hasn't been created
128   - if ($this->iId < 0) {
129   - $sql = $default->db;
130   - $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 . ")");
131   - if ($result) {
132   - $this->iId = $sql->insert_id();
133   - return true;
134   - }
135   - return false;
  128 + if ($this->iId < 0) {
  129 + $sTable = $default->dependant_document_instance_table;
  130 + $aFieldValues = array(
  131 + 'document_title' => $this->sDocumentTitle,
  132 + 'user_id' => $this->iUserID,
  133 + 'template_document_id' => $this->iTemplateDocumentID,
  134 + 'parent_document_id' => $this->iParentDocumentID,
  135 + );
  136 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  137 +
  138 + if (PEAR::isError($id)) {
  139 + $_SESSION["errorMessage"] = $id->toString();
  140 + return false;
  141 + }
  142 + $this->iId = $id;
  143 + return true;
136 144 }
137 145 return false;
138 146 }
... ... @@ -203,4 +211,4 @@ class DependantDocumentInstance {
203 211 }
204 212 }
205 213  
206   -?>
207 214 \ No newline at end of file
  215 +?>
... ...
lib/documentmanagement/DependantDocumentTemplate.inc
... ... @@ -134,13 +134,21 @@ class DependantDocumentTemplate {
134 134 global $default;
135 135 //if the object hasn't been created
136 136 if ($this->iId < 0) {
137   - $sql = $default->db;
138   - $result = $sql->query("INSERT INTO $default->dependant_document_template_table (document_title, default_user_id,template_document_id, group_folder_approval_link_id) VALUES ('$this->sDocumentTitle', $this->iDefaultUserID, " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", $this->iGroupFolderApprovalLinkID)");
139   - if ($result) {
140   - $this->iId = $sql->insert_id();
141   - return true;
142   - }
143   - return false;
  137 + $sTable = $default->dependant_document_template_table;
  138 + $aFieldValues = array(
  139 + 'document_title' => $this->sDocumentTitle,
  140 + 'default_user_id' => $this->iDefaultUserID,
  141 + 'template_document_id' => $this->iTemplateDocumentID,
  142 + 'group_folder_approval_link_id' => $this->iGroupFolderApprovalLinkID,
  143 + );
  144 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  145 +
  146 + if (PEAR::isError($id)) {
  147 + $_SESSION["errorMessage"] = $id->toString();
  148 + return false;
  149 + }
  150 + $this->iId = $id;
  151 + return true;
144 152 }
145 153 return false;
146 154 }
... ... @@ -238,4 +246,4 @@ class DependantDocumentTemplate {
238 246 }
239 247 }
240 248  
241   -?>
242 249 \ No newline at end of file
  250 +?>
... ...
lib/documentmanagement/Document.inc
... ... @@ -224,7 +224,7 @@ class Document {
224 224  
225 225 /** set the document check out status */
226 226 function setIsCheckedOut($bNewValue) {
227   - $this->bIsCheckedOut = $bNewValue;
  227 + $this->bIsCheckedOut = anyToBool($bNewValue);
228 228 }
229 229  
230 230 /** get the user id that has the document checked out **/
... ... @@ -342,34 +342,36 @@ class Document {
342 342 global $default, $lang_err_doc_exist, $lang_err_database;
343 343 //if the id >= 0, then the object has already been created
344 344 if ($this->iId < 0) {
345   - $sql = $default->db;
346 345 $this->sFullPath = $this->generateFolderPath($this->iFolderID);
347 346 $this->sParentFolderIDs = $this->generateFolderIDs($this->iFolderID);
348   - $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) " .
349   - "VALUES (" . quote($this->iDocumentTypeID) . ", " .
350   - quote($this->sName) . ", " .
351   - quote($this->sFileName) . ", " .
352   - quote($this->iSize) . ", " .
353   - quote($this->iCreatorID) . ", " .
354   - quote(getCurrentDateTime()) . ", " .
355   - quote($this->sDescription) . ", " .
356   - quote($this->iMimeTypeID) . ", " .
357   - quote($this->iFolderID) . ", " .
358   - quote($this->iMajorVersion) . ", " .
359   - quote($this->iMinorVersion) . ", " .
360   - quote($this->bIsCheckedOut) . ", " .
361   - quote($this->iCheckedOutUserID) . ", " .
362   - quote($this->sParentFolderIDs) . ", " .
363   - quote($this->sFullPath) . ", " .
364   - quote($this->iStatusID) . ")");
365   - if ($result) {
366   - //set the current documents primary key
367   - $this->iId = $sql->insert_id();
368   - // also insert into search permissions table to enable immediate metadata searching (#2681)
369   - $this->insertDocumentPermissions();
370   - return true;
  347 + $sTable = $default->documents_table;
  348 + $aFieldValues = array(
  349 + 'document_type_id' => $this->iDocumentTypeID,
  350 + 'name' => $this->sName,
  351 + 'filename' => $this->sFileName,
  352 + 'size' => $this->iSize,
  353 + 'creator_id' => $this->iCreatorID,
  354 + 'modified' => getCurrentDateTime(),
  355 + 'description' => $this->sDescription,
  356 + 'mime_id' => $this->iMimeTypeID,
  357 + 'folder_id' => $this->iFolderID,
  358 + 'major_version' => $this->iMajorVersion,
  359 + 'minor_version' => $this->iMinorVersion,
  360 + 'is_checked_out' => $this->bIsCheckedOut,
  361 + 'checked_out_user_id' => $this->iCheckedOutUserID,
  362 + 'parent_folder_ids' => $this->sParentFolderIDs,
  363 + 'full_path' => $this->sFullPath,
  364 + 'status_id' => $this->iStatusID,
  365 + );
  366 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  367 +
  368 + if (PEAR::isError($id)) {
  369 + $_SESSION["errorMessage"] = $id->toString();
  370 + return false;
371 371 }
372   - return false;
  372 + $this->iId = $id;
  373 + $this->insertDocumentPermissions();
  374 + return true;
373 375 }
374 376 return false;
375 377  
... ... @@ -882,4 +884,4 @@ class Document {
882 884 return $result;
883 885 }
884 886 }
885   -?>
886 887 \ No newline at end of file
  888 +?>
... ...
lib/documentmanagement/DocumentField.inc
... ... @@ -160,14 +160,21 @@ class DocumentField {
160 160 global $default, $lang_err_database, $lang_err_object_exists;
161 161 //if the object hasn't been created
162 162 if ($this->iId < 0) {
163   - $sql = $default->db;
164   - $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 ."')");
165   - if ($result) {
166   - $this->iId = $sql->insert_id();
167   - return true;
168   - }
169   - $_SESSION["errorMessage"] = $lang_err_database;
170   - return false;
  163 + $sTable = $default->document_fields_table;
  164 + $aFieldValues = array(
  165 + 'name' => $this->sName,
  166 + 'data_type' => $this->sDataType,
  167 + 'is_generic' => $this->bIsGeneric,
  168 + 'has_lookup' => $this->bHasLookup,
  169 + );
  170 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  171 +
  172 + if (PEAR::isError($id)) {
  173 + $_SESSION["errorMessage"] = $id->toString();
  174 + return false;
  175 + }
  176 + $this->iId = $id;
  177 + return true;
171 178 }
172 179 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields";
173 180 return false;
... ... @@ -358,4 +365,4 @@ function &amp; documentfieldCreateFromArray($aParameters) {
358 365 }
359 366  
360 367  
361   -?>
362 368 \ No newline at end of file
  369 +?>
... ...
lib/documentmanagement/DocumentFieldLink.inc
... ... @@ -131,16 +131,20 @@ class DocumentFieldLink {
131 131 global $default, $lang_err_doc_exist, $lang_err_database;
132 132 //if the id >= 0, then the object has already been created
133 133 if ($this->iId < 0) {
134   - $sql = $default->db;
135   - $result = $sql->query("INSERT INTO " . $default->document_fields_link_table . " (document_id, document_field_id, value) " .
136   - "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '$this->sValue')");
137   - if ($result) {
138   - //set the current documents primary key
139   - $this->iId = $sql->insert_id();
140   - return true;
141   - }
142   - $_SESSION["errorMessage"] = $lang_err_database;
143   - return false;
  134 + $sTable = $default->document_fields_link_table;
  135 + $aFieldValues = array(
  136 + 'document_id' => $this->iDocumentID,
  137 + 'document_field_id' => $this->iDocumentFieldID,
  138 + 'value' => $this->sValue,
  139 + );
  140 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  141 +
  142 + if (PEAR::isError($id)) {
  143 + $_SESSION["errorMessage"] = $id->toString();
  144 + return false;
  145 + }
  146 + $this->iId = $id;
  147 + return true;
144 148 }
145 149 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_fields_link_table";
146 150 return false;
... ...
lib/documentmanagement/DocumentLink.inc
... ... @@ -108,14 +108,19 @@ class DocumentLink {
108 108 global $default, $lang_err_database, $lang_err_object_exists;
109 109 //if the object hasn't been created
110 110 if ($this->iId < 0) {
111   - $sql = $default->db;
112   - $result = $sql->query("INSERT INTO $default->document_link_table (parent_document_id, child_document_id) VALUES ($this->iParentDocumentID, $this->iChildDocumentID)");
113   - if ($result) {
114   - $this->iId = $sql->insert_id();
115   - return true;
116   - }
117   - $_SESSION["errorMessage"] = $lang_err_database;
118   - return false;
  111 + $sTable = $default->document_link_table;
  112 + $aFieldValues = array(
  113 + 'parent_document_id' => $this->iParentDocumentID,
  114 + 'child_document_id' => $this->iChildDocumentID,
  115 + );
  116 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  117 +
  118 + if (PEAR::isError($id)) {
  119 + $_SESSION["errorMessage"] = $id->toString();
  120 + return false;
  121 + }
  122 + $this->iId = $id;
  123 + return true;
119 124 }
120 125 $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." table = document_fields";
121 126 return false;
... ... @@ -190,4 +195,4 @@ class DocumentLink {
190 195 return false;
191 196 }
192 197 }
193   -?>
194 198 \ No newline at end of file
  199 +?>
... ...
lib/documentmanagement/DocumentTransaction.inc
... ... @@ -104,17 +104,25 @@ class DocumentTransaction {
104 104 global $default, $lang_err_object_exists;
105 105 //if the object hasn't been stored yet
106 106 if ($this->iId < 0) {
107   - $sql = $default->db;
108   - $result = $sql->query("INSERT INTO " . $default->document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " .
109   - "VALUES ($this->iDocumentID, '$this->sVersion', $this->iUserID, '$this->dDateTime', '$this->sIP', '$this->sFileName', '$this->sComment', $this->iTransactionID)");
110   - if ($result) {
111   - //object has been stored, set the primary key
112   - $this->iId = $sql->insert_id();
113   - return true;
114   - } else {
115   - $_SESSION["errorMessage"] = $lang_err_database;
116   - return false;
117   - }
  107 + $sTable = $default->document_transactions_table;
  108 + $aFieldValues = array(
  109 + document_id => $this->iDocumentID,
  110 + version => $this->sVersion,
  111 + user_id => $this->iUserID,
  112 + datetime => $this->dDateTime,
  113 + ip => $this->sIP,
  114 + filename => $this->sFileName,
  115 + comment => $this->sComment,
  116 + transaction_id => $this->iTransactionID,
  117 + );
  118 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  119 +
  120 + if (PEAR::isError($id)) {
  121 + $_SESSION["errorMessage"] = $id->toString();
  122 + return false;
  123 + }
  124 + $this->iId = $id;
  125 + return true;
118 126 } else {
119 127 $_SESSION["errorMessage"] = $lang_err_object_exists;
120 128 return false;
... ... @@ -193,4 +201,4 @@ class DocumentTransaction {
193 201 return false;
194 202 }
195 203 }
196   -?>
197 204 \ No newline at end of file
  205 +?>
... ...
lib/documentmanagement/DocumentType.inc
... ... @@ -85,27 +85,18 @@ class DocumentType {
85 85 global $default, $lang_err_database, $lang_err_object_exists;
86 86 //if the object hasn't been created
87 87 if ($this->iId < 0) {
88   - //check to see if name exsits
89   - $sql = $default->db;
90   - $query = "SELECT name FROM ". $default->document_types_table ." WHERE name = '" . $this->sName . "'";
91   - $sql->query($query);
92   - $rows = $sql->num_rows($sql);
93   -
94   - if ($rows > 0){
95   - // duplicate username
96   - $_SESSION["errorMessage"] = "DocTypes::The DocumentType name " . $this->sName . " is already in use!";
97   - return false;
98   -
99   - }else{
100   - $sql = $default->db;
101   - $result = $sql->query("INSERT INTO " . $default->document_types_table . " (name) VALUES ('$this->sName')");
102   - if ($result) {
103   - $this->iId = $sql->insert_id();
104   - return true;
105   - }
106   - $_SESSION["errorMessage"] = $lang_err_database;
107   - return false;
108   - }
  88 + $sTable = $default->document_types_table;
  89 + $aFieldValues = array(
  90 + 'name' => $this->sName,
  91 + );
  92 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  93 +
  94 + if (PEAR::isError($id)) {
  95 + $_SESSION["errorMessage"] = $id->toString();
  96 + return false;
  97 + }
  98 + $this->iId = $id;
  99 + return true;
109 100 }
110 101  
111 102 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_types";
... ...
lib/documentmanagement/DocumentTypeFieldLink.inc
... ... @@ -135,26 +135,28 @@ class DocumentTypeFieldLink {
135 135 //check to see if name exsits
136 136 $sql = $default->db;
137 137 $query = "SELECT id FROM ". $default->document_type_fields_table ." WHERE document_type_id = '" . $this->iDocumentTypeID . "' and field_id = '". $this->iFieldID . "'";
138   - $sql->query($query);
139   - $rows = $sql->num_rows($sql);
  138 + $sql->query($query);
  139 + $rows = $sql->num_rows($sql);
140 140  
141   - if ($rows > 0){
142   - // duplicate username
143   - $_SESSION["errorMessage"] = "DocTypes::The DocumentType name " . $this->sName . " is already in use!";
144   - return false;
145   -
146   - }else{
147   - $sql = $default->db;
148   - $result = $sql->query("INSERT INTO " . $default->document_type_fields_table . " (document_type_id, field_id, is_mandatory) " .
149   - "VALUES ($this->iDocumentTypeID, $this->iFieldID, '" . $this->bIsMandatory . "')");
150   - if ($result) {
151   - //set the current documents primary key
152   - $this->iId = $sql->insert_id();
153   - return true;
154   - }
155   - $_SESSION["errorMessage"] = $lang_err_database;
156   - return false;
157   - }
  141 + if ($rows > 0){
  142 + $_SESSION["errorMessage"] = "DocTypes::The DocumentType name " . $this->sName . " is already in use!";
  143 + return false;
  144 + }
  145 +
  146 + $sTable = $default->document_type_fields_table;
  147 + $aFieldValues = array(
  148 + 'document_type_id' => $this->iDocumentTypeID,
  149 + 'field_id' => $this->iFieldID,
  150 + 'is_mandatory' => $this->bIsMandatory,
  151 + );
  152 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  153 +
  154 + if (PEAR::isError($id)) {
  155 + $_SESSION["errorMessage"] = $id->toString();
  156 + return false;
  157 + }
  158 + $this->iId = $id;
  159 + return true;
158 160 }
159 161 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_type_fields_table";
160 162 return false;
... ...
lib/documentmanagement/MetaData.inc
... ... @@ -113,24 +113,27 @@ class MetaData {
113 113 //check to see if name exsits
114 114 $sql = $default->db;
115 115 $query = "SELECT name FROM ". $default->metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'";
116   - $sql->query($query);
117   - $rows = $sql->num_rows($sql);
  116 + $sql->query($query);
  117 + $rows = $sql->num_rows($sql);
118 118  
119   - if ($rows > 0){
120   - // duplicate username
121   - $_SESSION["errorMessage"] = "MetaData::TheMetaData name " . $this->sName . " for the specfic field exists already!";
122   - return false;
123   -
124   - }else{
125   - $sql = $default->db;
126   - $result = $sql->query("INSERT INTO " . $default->metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','$this->sName')");
127   - if ($result) {
128   - $this->iId = $sql->insert_id();
129   - return true;
130   - }
131   - $_SESSION["errorMessage"] = $lang_err_database;
132   - return false;
133   - }
  119 + if ($rows > 0){
  120 + $_SESSION["errorMessage"] = "MetaData::TheMetaData name " . $this->sName . " for the specfic field exists already!";
  121 + return false;
  122 + }
  123 +
  124 + $sTable = $default->metadata_table;
  125 + $aFieldValues = array(
  126 + 'document_field_id' => $this->iDocFieldID,
  127 + 'name' => $this->sName,
  128 + );
  129 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  130 +
  131 + if (PEAR::isError($id)) {
  132 + $_SESSION["errorMessage"] = $id->toString();
  133 + return false;
  134 + }
  135 + $this->iId = $id;
  136 + return true;
134 137 }
135 138  
136 139 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_types";
... ...
lib/foldermanagement/Folder.inc
... ... @@ -278,22 +278,34 @@ class Folder {
278 278 * @return boolean true and set $this->iId with new primary key, false otherwise and set $_SESSION["errorMessage"]
279 279 */
280 280 function create() {
281   - global $default, $lang_err_database; $lang_err_object_exists;
282   - //if the object has not already been stored
  281 + global $default;
  282 +
283 283 if ($this->iId < 0) {
284 284 $this->sFullPath = $this->generateFolderPath($this->iParentID);
285 285 $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID);
286   - $sql = $default->db;
287   - $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) " .
288   - "VALUES ('$this->sName', '$this->sDescription', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'$this->sFullPath','$this->sParentFolderIDs'," . ($this->bInheritParentPermissions ? "1" : "0") . ")");
289   - if ($result) {
290   - $this->iId = $sql->insert_id();
291   - return true;
292   - }
293   - $_SESSION["errorMessage"] = $lang_err_database;
294   - return false;
  286 +
  287 + $aFieldValues = array(
  288 + 'name' => $this->sName,
  289 + 'description' => $this->sDescription,
  290 + 'parent_id' => $this->iParentID,
  291 + 'creator_id' => $this->iCreatorID,
  292 + 'unit_id' => $this->iUnitID,
  293 + 'is_public' => $this->bIsPublic,
  294 + 'full_path' => $this->sFullPath,
  295 + 'parent_folder_ids' => $this->sParentFolderIDs,
  296 + 'inherit_parent_folder_permission' => $this->bInheritParentPermissions,
  297 + );
  298 + $id =& DBUtil::autoInsert($default->folders_table, $aFieldValues);
  299 +
  300 + if (PEAR::isError($id)) {
  301 + $_SESSION["errorMessage"] = $id->toString();
  302 + return false;
  303 + }
  304 + $this->iId = $id;
  305 + return true;
295 306 }
296   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders";
  307 +
  308 + $_SESSION["errorMessage"] = "Can't create object that already exists" . "id = " . $this->iId . " table = $default->folders_table";
297 309 return false;
298 310 }
299 311  
... ... @@ -735,4 +747,4 @@ class Folder {
735 747 }
736 748 }
737 749 }
738   -?>
739 750 \ No newline at end of file
  751 +?>
... ...
lib/foldermanagement/FolderCollaboration.inc
... ... @@ -104,14 +104,22 @@ class FolderCollaboration {
104 104 global $default, $lang_err_database, $lang_err_object_exists;
105 105 //if the object hasn't been created
106 106 if ($this->iId < 0) {
107   - $sql = $default->db;
108   - $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)");
109   - if ($result) {
110   - $this->iId = $sql->insert_id();
111   - return true;
112   - }
113   - $_SESSION["errorMessage"] = $lang_err_database;
114   - return false;
  107 + $sTable = $default->groups_folders_approval_table;
  108 + $aFieldValues = array(
  109 + 'folder_id' => $this->iFolderID,
  110 + 'group_id' => $this->iGroupID,
  111 + 'precedence' => $this->iSequenceNumber,
  112 + 'role_id' => $this->iRoleID,
  113 + 'user_id' => $this->iUserID,
  114 + );
  115 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  116 +
  117 + if (PEAR::isError($id)) {
  118 + $_SESSION["errorMessage"] = $id->toString();
  119 + return false;
  120 + }
  121 + $this->iId = $id;
  122 + return true;
115 123 }
116 124 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_folders_approval_table";
117 125 return false;
... ...
lib/foldermanagement/FolderDocTypeLink.inc
... ... @@ -48,15 +48,19 @@ class FolderDocTypeLink {
48 48 global $default, $lang_err_database; $lang_err_object_exists;
49 49 //if the object has not already been stored
50 50 if ($this->iId < 0) {
51   - $sql = $default->db;
52   - $result = $sql->query("INSERT INTO " . $default->folder_doctypes_table . " (folder_id, document_type_id) " .
53   - "VALUES ($this->iFolderID, $this->iDocumentTypeID)");
54   - if ($result) {
55   - $this->iId = $sql->insert_id();
56   - return true;
57   - }
58   - $_SESSION["errorMessage"] = $lang_err_database;
59   - return false;
  51 + $sTable = $default->folder_doctypes_table;
  52 + $aFieldValues = array(
  53 + 'folder_id' => $this->iFolderID,
  54 + 'document_type_id' => $this->iDocumentTypeID,
  55 + );
  56 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  57 +
  58 + if (PEAR::isError($id)) {
  59 + $_SESSION["errorMessage"] = $id->toString();
  60 + return false;
  61 + }
  62 + $this->iId = $id;
  63 + return true;
60 64 }
61 65 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders";
62 66 return false;
... ...
lib/foldermanagement/FolderUserRole.inc
... ... @@ -118,14 +118,24 @@ class FolderUserRole {
118 118 global $default, $lang_err_database, $lang_err_object_exists;
119 119 //if the object hasn't been created
120 120 if ($this->iId < 0) {
121   - $sql = $default->db;
122   - $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") . ")");
123   - if ($result) {
124   - $this->iId = $sql->insert_id();
125   - return true;
126   - }
127   - $_SESSION["errorMessage"] = $lang_err_database;
128   - return false;
  121 + $sTable = $default->folders_user_roles_table;
  122 + $aFieldValues = array(
  123 + 'user_id' => $this->iUserID,
  124 + 'document_id' => $this->iDocumentID,
  125 + 'group_folder_approval_id' => $this->iGroupFolderApprovalID,
  126 + 'datetime' => $this->dDateTime,
  127 + 'done' => $this->bDone,
  128 + 'active' => $this->bActive,
  129 + 'dependant_documents_created' => $this->bDependantDocumentsCreated,
  130 + );
  131 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  132 +
  133 + if (PEAR::isError($id)) {
  134 + $_SESSION["errorMessage"] = $id->toString();
  135 + return false;
  136 + }
  137 + $this->iId = $id;
  138 + return true;
129 139 }
130 140 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders_users_roles_link";
131 141 return false;
... ...
lib/groups/Group.inc
... ... @@ -135,25 +135,20 @@ class Group {
135 135 global $default, $lang_err_database, $lang_err_object_exists;
136 136 //if the object hasn't been created
137 137 if ($this->iId < 0) {
138   - //check to see if name exsits
139   - $sql = $default->db;
140   - $query = "SELECT name FROM ". $default->groups_table ." WHERE name = '" . $this->sName . "'";
141   - $sql->query($query);
142   - $rows = $sql->num_rows();
143   - if ($rows > 0) {
144   - // duplicate username
145   - $_SESSION["errorMessage"] = "Group::The Group name " . $this->sName . " is already in use!";
146   - return false;
147   - } else {
148   - $sql = $default->db;
149   - $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) . ")");
150   - if ($result) {
151   - $this->iId = $sql->insert_id();
152   - return true;
153   - }
154   - $_SESSION["errorMessage"] = $lang_err_database;
155   - return false;
156   - }
  138 + $sTable = $default->groups_table;
  139 + $aFieldValues = array(
  140 + 'name' => $this->sName,
  141 + 'is_sys_admin' => $this->bIsSysAdmin,
  142 + 'is_unit_admin' => $this->bIsUnitAdmin,
  143 + );
  144 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  145 +
  146 + if (PEAR::isError($id)) {
  147 + $_SESSION["errorMessage"] = $id->toString();
  148 + return false;
  149 + }
  150 + $this->iId = $id;
  151 + return true;
157 152 }
158 153 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields";
159 154 return false;
... ...
lib/groups/GroupFolderApprovalLink.inc
... ... @@ -148,14 +148,21 @@ class GroupFolderApprovalLink {
148 148 global $default, $lang_err_database, $lang_err_object_exists;
149 149 //if the object hasn't been created
150 150 if ($this->iId < 0) {
151   - $sql = $default->db;
152   - $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)");
153   - if ($result) {
154   - $this->iId = $sql->insert_id();
155   - return true;
156   - }
157   - $_SESSION["errorMessage"] = $lang_err_database;
158   - return false;
  151 + $sTable = $default->groups_folders_approval_table;
  152 + $aFieldValues = array(
  153 + 'folder_id' => $this->iFolderID,
  154 + 'group_id' => $this->iGroupID,
  155 + 'precedence' => $this->iPrecedence,
  156 + 'role_id' => $this->iRoleID,
  157 + );
  158 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  159 +
  160 + if (PEAR::isError($id)) {
  161 + $_SESSION["errorMessage"] = $id->toString();
  162 + return false;
  163 + }
  164 + $this->iId = $id;
  165 + return true;
159 166 }
160 167 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields";
161 168 return false;
... ...
lib/groups/GroupFolderLink.inc
... ... @@ -93,14 +93,21 @@ class GroupFolderLink {
93 93 global $default, $lang_err_database, $lang_err_object_exists;
94 94 //if the object hasn't been created
95 95 if ($this->iId < 0) {
96   - $sql = $default->db;
97   - $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) . ")");
98   - if ($result) {
99   - $this->iId = $sql->insert_id();
100   - return true;
101   - }
102   - $_SESSION["errorMessage"] = $lang_err_database;
103   - return false;
  96 + $sTable = $default->groups_folders_table;
  97 + $aFieldValues = array(
  98 + 'folder_id' => $this->iFolderID,
  99 + 'group_id' => $this->iGroupID,
  100 + 'can_read' => $this->bCanRead,
  101 + 'can_write' => $this->bCanWrite,
  102 + );
  103 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  104 +
  105 + if (PEAR::isError($id)) {
  106 + $_SESSION["errorMessage"] = $id->toString();
  107 + return false;
  108 + }
  109 + $this->iId = $id;
  110 + return true;
104 111 }
105 112 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_folders_table";
106 113 return false;
... ...
lib/groups/GroupUnitLink.inc
... ... @@ -103,27 +103,28 @@ class GroupUnitLink {
103 103 {
104 104 $sql = $default->db;
105 105 $query = "SELECT unit_id, group_id FROM ". $default->groups_units_table ." WHERE unit_id = '" . $this->iUnitID . "' and group_id = '". $this->iGroupID ."'";
106   - $sql->query($query);
107   - $rows = $sql->num_rows($sql);
  106 + $sql->query($query);
  107 + $rows = $sql->num_rows($sql);
108 108  
109   - if ($rows > 0)
110   - {
111   - // duplicate username
112   - $_SESSION["errorMessage"] = "GroupUnitlink::The id " . $this->iUnitID . " already exists!";
113   - return false;
114   - }
115   - else
116   - {
117   - $sql = $default->db;
118   - $result = $sql->query("INSERT INTO " . $default->groups_units_table . " (group_id, unit_id) VALUES ($this->iGroupID, $this->iUnitID)");
119   - if ($result)
120   - {
121   - $this->iId = $sql->insert_id();
122   - return true;
123   - }
124   - $_SESSION["errorMessage"] = $lang_err_database;
125   - return false;
126   - }
  109 + if ($rows > 0)
  110 + {
  111 + $_SESSION["errorMessage"] = "GroupUnitlink::The id " . $this->iUnitID . " already exists!";
  112 + return false;
  113 + }
  114 +
  115 + $sTable = $default->groups_units_table;
  116 + $aFieldValues = array(
  117 + 'group_id' => $this->iGroupID,
  118 + 'unit_id' => this->iUnitID,
  119 + );
  120 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  121 +
  122 + if (PEAR::isError($id)) {
  123 + $_SESSION["errorMessage"] = $id->toString();
  124 + return false;
  125 + }
  126 + $this->iId = $id;
  127 + return true;
127 128 }
128 129 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_units_table";
129 130 return false;
... ...
lib/groups/GroupUserLink.inc
... ... @@ -102,23 +102,28 @@ class GroupUserLink {
102 102 if ($this->iId < 0) {
103 103 $sql = $default->db;
104 104 $query = "SELECT user_id, group_id FROM ". $default->users_groups_table ." WHERE user_id = '" . $this->iUserID . "' and group_id = '". $this->iGroupID ."'";
105   - $sql->query($query);
106   - $rows = $sql->num_rows($sql);
  105 + $sql->query($query);
  106 + $rows = $sql->num_rows($sql);
107 107  
108   - if ($rows > 0){
109   - // duplicate username
110   - $_SESSION["errorMessage"] = "GroupUserLink::The id " . $this->iUnitID . " already exists!";
111   - return false;
112   - } else {
113   - $sql = $default->db;
114   - $result = $sql->query("INSERT INTO " . $default->users_groups_table . " (group_id, user_id) VALUES ($this->iGroupID, $this->iUserID)");
115   - if ($result) {
116   - $this->iId = $sql->insert_id();
117   - return true;
118   - }
119   - $_SESSION["errorMessage"] = $lang_err_database;
120   - return false;
121   - }
  108 + if ($rows > 0){
  109 + // duplicate username
  110 + $_SESSION["errorMessage"] = "GroupUserLink::The id " . $this->iUnitID . " already exists!";
  111 + return false;
  112 + }
  113 +
  114 + $sTable = $default->users_groups_table;
  115 + $aFieldValues = array(
  116 + 'group_id' => $this->iGroupID,
  117 + 'user_id' => $this->iUserID,
  118 + );
  119 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  120 +
  121 + if (PEAR::isError($id)) {
  122 + $_SESSION["errorMessage"] = $id->toString();
  123 + return false;
  124 + }
  125 + $this->iId = $id;
  126 + return true;
122 127 }
123 128 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->users_groups_table";
124 129 return false;
... ... @@ -300,4 +305,4 @@ class GroupUserLink {
300 305 $this->iId = $id;
301 306 }
302 307 }
303   -?>
304 308 \ No newline at end of file
  309 +?>
... ...
lib/links/Link.inc
... ... @@ -80,35 +80,38 @@ class Link {
80 80 //check to see if name exsits
81 81 $sql = $default->db;
82 82 $query = "SELECT name FROM ". $default->quicklinks_table ." WHERE name = '" . $this->sName . "'";
83   - $sql->query($query);
84   - $rows = $sql->num_rows($sql);
  83 + $sql->query($query);
  84 + $rows = $sql->num_rows($sql);
85 85  
86   - if ($rows > 0){
87   - // duplicate username
88   - $_SESSION["errorMessage"] = "Link::The Link name " . $this->sName . " is already in use!";
89   - return false;
90   -
91   - }else{
92   - $sql = $default->db;
93   - $query = "SELECT rank FROM ". $default->quicklinks_table ." WHERE rank = '" . $this->iRank . "'";
94   - $sql->query($query);
95   - $rows = $sql->num_rows($sql);
  86 + if ($rows > 0){
  87 + $_SESSION["errorMessage"] = "Link::The Link name " . $this->sName . " is already in use!";
  88 + return false;
  89 + }
  90 +
  91 + $sql = $default->db;
  92 + $query = "SELECT rank FROM ". $default->quicklinks_table ." WHERE rank = '" . $this->iRank . "'";
  93 + $sql->query($query);
  94 + $rows = $sql->num_rows($sql);
96 95  
97   - if ($rows > 0){
98   - // duplicate username
99   - $_SESSION["errorMessage"] = "Link::The Rank " . $this->iRank . " is already in use!";
100   - return false;
101   -
102   - }else{
103   - $sql = $default->db;
104   - $result = $sql->query("INSERT INTO " . $default->quicklinks_table . " (name, url, rank) VALUES ('$this->sName', '$this->sUrl', $this->iRank)");
105   - if ($result) {
106   - $this->iId = $sql->insert_id();
107   - return true;
108   - }
109   - $_SESSION["errorMessage"] = $lang_err_database;
110   - return false;
111   - }
  96 + if ($rows > 0){
  97 + $_SESSION["errorMessage"] = "Link::The Rank " . $this->iRank . " is already in use!";
  98 + return false;
  99 + }
  100 +
  101 + $sTable = $default->quicklinks_table;
  102 + $aFieldValues = array(
  103 + 'name' => $this->sName,
  104 + 'url' => $this->sUrl,
  105 + 'rank' => $this->iRank,
  106 + );
  107 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  108 +
  109 + if (PEAR::isError($id)) {
  110 + $_SESSION["errorMessage"] = $id->toString();
  111 + return false;
  112 + }
  113 + $this->iId = $id;
  114 + return true;
112 115 }
113 116 }
114 117 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields";
... ...
lib/orgmanagement/Organisation.inc
... ... @@ -71,24 +71,18 @@ class Organisation {
71 71 global $default, $lang_err_database, $lang_err_object_exists;
72 72 //if the object hasn't been created
73 73 if ($this->iId < 0) {
74   - //check to see if name exsits
75   - $sql = $default->db;
76   - $query = "SELECT name FROM ". $default->organisations_table ." WHERE name = '" . $this->sName . "'";
77   - $sql->query($query);
78   - $rows = $sql->num_rows($sql);
79   - if ($rows > 0) {
80   - // duplicate username
81   - $_SESSION["errorMessage"] = "Organisation::The name " . $this->sName . " is already in use!";
82   - return false;
83   - } else {
84   - $result = $sql->query("INSERT INTO " . $default->organisations_table . " (name) VALUES ('$this->sName')");
85   - if ($result) {
86   - $this->iId = $sql->insert_id();
87   - return true;
88   - }
89   - $_SESSION["errorMessage"] = $lang_err_database;
  74 + $sTable = $default->organisations_table;
  75 + $aFieldValues = array(
  76 + 'name' => $this->sName,
  77 + );
  78 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  79 +
  80 + if (PEAR::isError($id)) {
  81 + $_SESSION["errorMessage"] = $id->toString();
90 82 return false;
91 83 }
  84 + $this->iId = $id;
  85 + return true;
92 86 }
93 87 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->organisations_table";
94 88 return false;
... ... @@ -224,4 +218,4 @@ function &amp; organisationCreateFromArray($aParameters) {
224 218 $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]);
225 219 return $oOrg;
226 220 }
227   -?>
228 221 \ No newline at end of file
  222 +?>
... ...
lib/roles/Role.inc
... ... @@ -100,26 +100,21 @@ class Role {
100 100 global $default, $lang_err_database, $lang_err_object_exists;
101 101 //if the object hasn't been created
102 102 if ($this->iId < 0) {
103   - //check to see if name exsits
104   - $sql = $default->db;
105   - $query = "SELECT name FROM ". $default->roles_table ." WHERE name = '" . $this->sName . "'";
106   - $sql->query($query);
107   - $rows = $sql->num_rows($sql);
108   -
109   - if ($rows > 0){
110   - // duplicate username
111   - $_SESSION["errorMessage"] = "Role::The Role name " . $this->sName . " is already in use!";
112   - return false;
113   - }else
114   - {
115   - $sql = $default->db;
116   - $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) . ")");
117   - if ($result) {
118   - $this->iId = $sql->insert_id();
119   - return true;
120   - }
121   - $_SESSION["errorMessage"] = $lang_err_database;
122   - return false;
  103 + $sTable = $default->roles_table;
  104 + $aFieldValues = array(
  105 + 'name' => $this->sName,
  106 + 'active' => $this->bActive,
  107 + 'can_read' => $this->bCanRead,
  108 + 'can_write' => $this->bCanWrite,
  109 + );
  110 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  111 +
  112 + if (PEAR::isError($id)) {
  113 + $_SESSION["errorMessage"] = $id->toString();
  114 + return false;
  115 + }
  116 + $this->iId = $id;
  117 + return true;
123 118 }
124 119 }
125 120 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields";
... ...
lib/roles/RoleFolderLink.inc
... ... @@ -176,14 +176,23 @@ class RoleFolderLink {
176 176 global $default, $lang_err_database, $lang_err_object_exists;
177 177 //if the object hasn't been created
178 178 if ($this->iId < 0) {
179   - $sql = $default->db;
180   - $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) . ")");
181   - if ($result) {
182   - $this->iId = $sql->insert_id();
183   - return true;
184   - }
185   - $_SESSION["errorMessage"] = $lang_err_database;
186   - return false;
  179 + $sTable = $default->folders_user_roles_table;
  180 + $aFieldValues = array(
  181 + 'user_id' => $this->iUserID,
  182 + 'folder_id' => $this->iFolderID,
  183 + 'role_type_id' => $this->iRoleTypeID,
  184 + 'datetime' => $this->dDateTime,
  185 + 'done' => $this->bDone,
  186 + 'active' => $this->bActive,
  187 + );
  188 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  189 +
  190 + if (PEAR::isError($id)) {
  191 + $_SESSION["errorMessage"] = $id->toString();
  192 + return false;
  193 + }
  194 + $this->iId = $id;
  195 + return true;
187 196 }
188 197 return false;
189 198 }
... ...
lib/session/SiteMap.inc
... ... @@ -656,26 +656,38 @@ class SiteMap {
656 656 // for each section
657 657 foreach ($this->aSiteMap as $section => $valArr) {
658 658 // insert into the section
659   - $sSectionSql = "INSERT INTO $default->site_sections_table (name) VALUES ('$section')";
660   - $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql");
  659 + $aFieldValue = array(
  660 + 'name' => $section,
  661 + );
  662 + $id =& DBUtil::autoInsert($default->site_sections_table, $aFieldValues);
661 663  
662   - if ($sql->query($sSectionSql)) {
663   - $sectionID = $sql->insert_id();
664   - $default->log->debug("Sitemap::syncWithDB added section $section; $sectionID");
665   - } else {
  664 + // $default->log->debug("Sitemap::syncWithDB insert=$sSectionSql");
  665 +
  666 + if (PEAR::isError($id)) {
666 667 $default->log->error("Sitemap::syncWithDB add section $section failed");
  668 + } else {
  669 + $sectionID = $id;
  670 + $default->log->debug("Sitemap::syncWithDB added section $section; $sectionID");
667 671 }
668 672  
669 673 // for each group, page array combination
670 674 foreach ($valArr as $requiredAccess => $pageArr) {
671 675 // now loop through all the pages
672 676 foreach ($pageArr as $action => $page) {
673   - $sSiteMapSql = "INSERT INTO $default->sitemap_table (action, page, section_id, access_id, link_text, is_default, is_enabled) " .
674   - "VALUES ('$action', '" . $page["page"] . "', $sectionID, $requiredAccess, '" . $page["description"] . "', " . $page["default"] . ", " . $page["enabled"] . ")";
675   - if ($sql->query($sSiteMapSql)) {
676   - $default->log->debug("Sitemap::syncWithDb sitemap insert worked for ($action, " . $page["page"] . ")");
677   - } else {
  677 + $aFieldValues = array(
  678 + action => $action,
  679 + page => $page["page"],
  680 + section_id => $sectionID,
  681 + access_id => $requiredAccess,
  682 + link_text => $page["description"],
  683 + is_default => $page["default"],
  684 + is_enabled => $page["enabled"],
  685 + );
  686 + $id =& DBUtil::autoInsert($default->sitemap_table, $aFieldValues);
  687 + if (PEAR::isError($id)) {
678 688 $default->log->debug("Sitemap::syncWithDB sitemap insert failed ($sSiteMapSql)");
  689 + } else {
  690 + $default->log->debug("Sitemap::syncWithDb sitemap insert worked for ($action, " . $page["page"] . ")");
679 691 }
680 692 }
681 693 }
... ...
lib/subscriptions/Subscription.inc
... ... @@ -206,15 +206,19 @@ class Subscription {
206 206 $lang_err_object_exists;
207 207 //if the object has not already been stored
208 208 if ($this->iID < 0) {
209   - $sql = $default->db;
210   - // TODO: set table name and id_field_name
211   - if ($sql->query("INSERT INTO " . $this->sTableName . " (user_id, $this->sIdFieldName, is_alerted) " .
212   - "VALUES ($this->iUserID, $this->iExternalID, " . (int)$this->bIsAlerted . ")")) {
213   - $this->iID = $sql->insert_id();
214   - return true;
215   - } else {
216   - $_SESSION["errorMessage"] = $lang_err_database;
  209 + $aFieldValues = array(
  210 + 'user_id' => $this->iUserID,
  211 + $this->sIdFieldName => $this->iExternalID,
  212 + 'is_alerted' => $this->bIsAlerted,
  213 + );
  214 + $id =& DBUtil::autoInsert($this->sTableName, $aFieldValues);
  215 +
  216 + if (PEAR::isError($id)) {
  217 + $_SESSION["errorMessage"] = $id->toString();
  218 + return false;
217 219 }
  220 + $this->iId = $id;
  221 + return true;
218 222 } else {
219 223 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iID . " table = $this->sTableName";
220 224 }
... ...
lib/unitmanagement/Unit.inc
... ... @@ -89,35 +89,41 @@ class Unit {
89 89 $_SESSION["errorMessage"] = "Unit::The name " . $this->sName . " is already in use!";
90 90 return false;
91 91 } else {
92   - $result = $sql->query("INSERT INTO " . $default->units_table . " (name) VALUES ('$this->sName')");
93   - if ($result) {
94   - $this->iId = $sql->insert_id();
95   - // create a new unit root folder
96   - // FIXME: lookup the organisation for this unit and use the appropriate folder id for the org root folder
97   - $oFolder = new Folder($this->sName, $this->sName . " Unit Root Folder", 1, $_SESSION["userID"], $this->iId);
98   - if (!$oFolder->exists()) {
99   - if ($oFolder->create()) {
100   - if (PhysicalFolderManagement::createFolder(Folder::getFolderPath($oFolder->getID()))) {
101   - return true;
102   - } else {
103   - return false;
104   - }
105   - } else {
106   - return false;
107   - }
  92 + $sTable = $default->units_table;
  93 + $aFieldValues = array(
  94 + 'name' => $this->sName,
  95 + );
  96 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  97 +
  98 + if (PEAR::isError($id)) {
  99 + $_SESSION["errorMessage"] = $id->toString();
  100 + return false;
  101 + }
  102 + $this->iId = $id;
  103 +
  104 + // create a new unit root folder
  105 + // FIXME: lookup the organisation for this unit and use the appropriate folder id for the org root folder
  106 + $oFolder = new Folder($this->sName, $this->sName . " Unit Root Folder", 1, $_SESSION["userID"], $this->iId);
  107 + if (!$oFolder->exists()) {
  108 + if ($oFolder->create()) {
  109 + if (PhysicalFolderManagement::createFolder(Folder::getFolderPath($oFolder->getID()))) {
  110 + return true;
  111 + } else {
  112 + return false;
  113 + }
108 114 } else {
109   - // a unit root folder already exists in the database
110   - // update the description
111   - $aFolders = Folder::getList("name='" . addslashes($this->sName) . "' AND parent_id=1");
112   - $oFolder = $aFolders[0];
113   - $oFolder->setDescription($this->sName . " Unit Root Folder");
114   - $oFolder->setUnitID($this->iId);
115   - $oFolder->update();
116   - return true;
  115 + return false;
117 116 }
  117 + } else {
  118 + // a unit root folder already exists in the database
  119 + // update the description
  120 + $aFolders = Folder::getList("name='" . addslashes($this->sName) . "' AND parent_id=1");
  121 + $oFolder = $aFolders[0];
  122 + $oFolder->setDescription($this->sName . " Unit Root Folder");
  123 + $oFolder->setUnitID($this->iId);
  124 + $oFolder->update();
  125 + return true;
118 126 }
119   - $_SESSION["errorMessage"] = $lang_err_database;
120   - return false;
121 127 }
122 128 }
123 129 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->units_table";
... ...
lib/unitmanagement/UnitOrganisationLink.inc
... ... @@ -113,15 +113,21 @@ class UnitOrganisationLink {
113 113 // duplicate username
114 114 $_SESSION["errorMessage"] = "UnitOrganisationlink::The id " . $this->iUnitID . " is already exist!";
115 115 return false;
116   - } else{
117   - $result = $sql->query("INSERT INTO " . $default->units_organisations_table . " (unit_id,organisation_id) VALUES ($this->iUnitID,$this->iOrgID)");
118   - if ($result) {
119   - $this->iId = $sql->insert_id();
120   - return true;
121   - }
122   - $_SESSION["errorMessage"] = $lang_err_database;
123   - return false;
124   - }
  116 + }
  117 +
  118 + $sTable = $default->units_organisations_table;
  119 + $aFieldValues = array(
  120 + 'unit_id' => $this->iUnitID,
  121 + 'organisation_id' => $this->iOrgID,
  122 + );
  123 + $id =& DBUtil::autoInsert($sTable, $aFieldValues);
  124 +
  125 + if (PEAR::isError($id)) {
  126 + $_SESSION["errorMessage"] = $id->toString();
  127 + return false;
  128 + }
  129 + $this->iId = $id;
  130 + return true;
125 131 }
126 132 return false;
127 133 }
... ... @@ -264,4 +270,4 @@ class UnitOrganisationLink {
264 270 }
265 271 }
266 272 }
267   -?>
268 273 \ No newline at end of file
  274 +?>
... ...
lib/users/User.inc
... ... @@ -311,27 +311,27 @@ class User {
311 311 global $default, $lang_err_database, $lang_err_object_exists;
312 312 //if the object hasn't been created
313 313 if ($this->iId < 0) {
314   - //check to see if name exsits
315   - $sql = $default->db;
316   - $query = "SELECT username FROM ". $default->users_table ." WHERE username = '" . $this->sUserName . "'";
317   - $sql->query($query);
318   - $rows = $sql->num_rows($sql);
319   -
320   - if ($rows > 0) {
321   - // duplicate username
322   - $_SESSION["errorMessage"] = "User::The username " . $this->sUserName . " is already in use!";
323   - return false;
324   - }
325   - else {
326   - $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) " .
327   - "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)");
328   - if ($result) {
329   - $this->iId = $sql->insert_id();
330   - return true;
331   - }
332   - $_SESSION["errorMessage"] = $lang_err_database;
  314 + $aFieldValues = array(
  315 + username => $this->sUserName,
  316 + name => $this->sName,
  317 + password => md5($this->sPassword),
  318 + quota_max => $this->iQuotaMax,
  319 + quota_current => 0,
  320 + email => $this->sEmail,
  321 + mobile => $this->sMobile,
  322 + email_notification => $this->bEmailNotification,
  323 + sms_notification => $this->bSmsNotification,
  324 + ldap_dn => $this->sLdapDn,
  325 + max_sessions => $this->iMaxSessions,
  326 + language_id => $this->iLanguageID,
  327 + );
  328 + $id = DBUtil::autoInsert($default->users_table, $aFieldValues);
  329 + if (PEAR::isError($id)) {
  330 + $_SESSION["errorMessage"] = $id->toString();
333 331 return false;
334 332 }
  333 + $this->iId = $id;
  334 + return true;
335 335 }
336 336 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->users_table";
337 337 return false;
... ...
lib/util/ktutil.inc
... ... @@ -34,6 +34,43 @@ class KTUtil {
34 34 }
35 35 }
36 36 }
  37 +
  38 + function strToBool ($sString, $null = false, $empty = false) {
  39 + $sString = strtoupper($sString);
  40 + if ($sString == "Y") {
  41 + return true;
  42 + } elseif (($sString == "N")) {
  43 + return false;
  44 + } elseif (($sString == "")) {
  45 + return $empty;
  46 + } else {
  47 + return $null;
  48 + }
  49 + }
  50 +
  51 +
  52 + function anyToBool ($sString, $null = false) {
  53 + if (is_bool($sString)) {
  54 + return $sString;
  55 + }
  56 +
  57 + if (is_string($sString)) {
  58 + if (strToBool($sString) === true) {
  59 + return true;
  60 + }
  61 + }
  62 +
  63 + if (is_int($sString)) {
  64 + return intToBool($sString);
  65 + }
  66 +
  67 + if (is_null($sString)) {
  68 + return $null;
  69 + }
  70 +
  71 + return false;
  72 + }
  73 +
37 74  
38 75 }
39 76 // }}}
... ...
lib/web/WebDocument.inc
... ... @@ -109,14 +109,22 @@ class WebDocument {
109 109 global $default, $lang_err_database, $lang_err_object_exists;
110 110 //if the object hasn't been created
111 111 if ($this->iId < 0) {
112   - $sql = $default->db;
113   - $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')");
114   - if ($result) {
115   - $this->iId = $sql->insert_id();
116   - return true;
117   - }
118   - $_SESSION["errorMessage"] = $lang_err_database;
119   - return false;
  112 + $aFieldValues = array(
  113 + document_id => $this->iDocumentID,
  114 + web_site_id => $this->iWebSiteID,
  115 + unit_id => $this->iUnitID,
  116 + status_id => $this->iStatusID,
  117 + datetime => $this->dDateTime,
  118 + );
  119 +
  120 + $id =& DBUtil::autoInsert($default->web_documents_table, $aFieldValues);
  121 +
  122 + if (PEAR::isError($id)) {
  123 + $_SESSION["errorMessage"] = $id->toString();
  124 + return false;
  125 + }
  126 + $this->iId = $id;
  127 + return true;
120 128 }
121 129 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_fields";
122 130 return false;
... ...
lib/web/WebSite.inc
... ... @@ -133,27 +133,19 @@ class WebSite {
133 133 global $default, $lang_err_database, $lang_err_object_exists;
134 134 //if the object hasn't been created
135 135 if ($this->iId < 0) {
136   - //check to see if name exsits
137   - $sql = $default->db;
138   - $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 . "'";
139   - $sql->query($query);
140   - $rows = $sql->num_rows($sql);
141   - if ($rows > 0) {
142   - // duplicate username
143   - $_SESSION["errorMessage"] = "Website::The Wesbite name " . $this->sWebSiteName . " is already in use!";
144   - return false;
145   -
146   - } else {
  136 + $aFieldValues = array(
  137 + 'web_site_name' => $this->sWebSiteName,
  138 + 'web_site_url' => $this->sWebSiteURL,
  139 + 'web_master_id' => $this->iWebMasterID,
  140 + );
  141 + $id =& DBUtil::autoInsert($default->web_sites_table, $aFieldValues);
147 142  
148   - $sql = $default->db;
149   - $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)");
150   - if ($result) {
151   - $this->iId = $sql->insert_id();
152   - return true;
153   - }
154   - $_SESSION["errorMessage"] = $lang_err_database;
  143 + if (PEAR::isError($id)) {
  144 + $_SESSION["errorMessage"] = $id->toString();
155 145 return false;
156 146 }
  147 + $this->iId = $id;
  148 + return true;
157 149 }
158 150 $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->web_sites_table";
159 151 return false;
... ...
sql/mysql/install/tables.sql
1   --- table definitions
2   -CREATE TABLE active_sessions (
3   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
4   -user_id INTEGER,
5   -session_id CHAR(255),
6   -lastused DATETIME,
7   -ip CHAR(30)
8   -) TYPE = InnoDB;
9   -ALTER TABLE active_sessions ADD INDEX session_id_idx (session_id);
  1 +-- phpMyAdmin SQL Dump
  2 +-- version 2.6.0-pl3
  3 +-- http://www.phpmyadmin.net
  4 +--
  5 +-- Host: localhost
  6 +-- Generation Time: Dec 01, 2004 at 03:14 PM
  7 +-- Server version: 4.0.22
  8 +-- PHP Version: 4.3.9-1
  9 +--
  10 +-- Database: `pristinedms`
  11 +--
  12 +
  13 +-- --------------------------------------------------------
  14 +
  15 +--
  16 +-- Table structure for table `active_sessions`
  17 +--
  18 +
  19 +CREATE TABLE active_sessions (
  20 + id int(11) NOT NULL default '0',
  21 + user_id int(11) default NULL,
  22 + session_id char(255) default NULL,
  23 + lastused datetime default NULL,
  24 + ip char(30) default NULL,
  25 + UNIQUE KEY id (id),
  26 + KEY session_id_idx (session_id)
  27 +) TYPE=InnoDB;
  28 +
  29 +-- --------------------------------------------------------
  30 +
  31 +--
  32 +-- Table structure for table `archive_restoration_request`
  33 +--
10 34  
11 35 CREATE TABLE archive_restoration_request (
12   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
13   -document_id INTEGER NOT NULL,
14   -request_user_id INTEGER NOT NULL,
15   -admin_user_id INTEGER NOT NULL,
16   -datetime DATETIME NOT NULL
17   -) TYPE = InnoDB;
18   -
19   -CREATE TABLE archiving_type_lookup (
20   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
21   -name CHAR(100)
22   -) TYPE = InnoDB;
23   -
24   -CREATE TABLE archiving_settings (
25   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
26   -archiving_type_id INTEGER NOT NULL,
27   -expiration_date DATE,
28   -document_transaction_id INTEGER,
29   -time_period_id INTEGER
30   -) TYPE = InnoDB;
31   -
32   -CREATE TABLE data_types (
33   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
34   -name CHAR(255) NOT NULL
35   -)TYPE = InnoDB;
36   -
37   -CREATE TABLE dependant_document_instance (
38   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
39   -document_title TEXT NOT NULL,
40   -user_id INTEGER NOT NULL,
41   -template_document_id INTEGER,
42   -parent_document_id INTEGER
43   -) TYPE = InnoDB;
44   -
45   -CREATE TABLE dependant_document_template (
46   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
47   -document_title TEXT NOT NULL,
48   -default_user_id INTEGER NOT NULL,
49   -template_document_id INTEGER,
50   -group_folder_approval_link_id INTEGER
51   -) TYPE = InnoDB;
52   -
53   -CREATE TABLE discussion_threads (
54   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
55   -document_id INTEGER NOT NULL,
56   -first_comment_id INTEGER NOT NULL,
57   -last_comment_id INTEGER NOT NULL,
58   -views INTEGER NOT NULL,
59   -replies INTEGER NOT NULL,
60   -creator_id INTEGER NOT NULL
61   -)TYPE = InnoDB;
62   -
63   -CREATE TABLE discussion_comments (
64   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
65   -thread_id INTEGER NOT NULL,
66   -in_reply_to INTEGER,
67   -user_id INTEGER NOT NULL,
68   -subject TEXT,
69   -body TEXT,
70   -date datetime
71   -)TYPE = InnoDB;
72   -
73   -CREATE TABLE documents (
74   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
75   -document_type_id INTEGER NOT NULL,
76   -name TEXT NOT NULL,
77   -filename TEXT NOT NULL,
78   -size BIGINT NOT NULL,
79   -creator_id INTEGER NOT NULL,
80   -modified DATETIME NOT NULL,
81   -description CHAR(200) NOT NULL,
82   -security INTEGER NOT NULL,
83   -mime_id INTEGER NOT NULL,
84   -folder_id INTEGER NOT NULL,
85   -major_version INTEGER NOT NULL,
86   -minor_version INTEGER NOT NULL,
87   -is_checked_out BIT NOT NULL,
88   -parent_folder_ids TEXT,
89   -full_path TEXT,
90   -checked_out_user_id INTEGER,
91   -status_id INTEGER
92   -)TYPE = InnoDB;
93   -ALTER TABLE documents ADD INDEX fk_document_type_id (document_type_id);
94   -ALTER TABLE documents ADD INDEX fk_creator_id (creator_id);
95   -ALTER TABLE documents ADD INDEX fk_folder_id (folder_id);
96   -ALTER TABLE documents ADD INDEX fk_checked_out_user_id (checked_out_user_id);
97   -ALTER TABLE documents ADD INDEX fk_status_id (status_id);
98   -
99   -CREATE TABLE document_archiving_link (
100   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
101   -document_id INTEGER NOT NULL,
102   -archiving_settings_id INTEGER NOT NULL
103   -) TYPE = InnoDB;
104   -
105   -CREATE TABLE document_fields (
106   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
107   -name CHAR(255) NOT NULL,
108   -data_type CHAR(100) NOT NULL,
109   -is_generic BIT,
110   -has_lookup BIT
111   -)TYPE = InnoDB;
112   -
113   -CREATE TABLE document_fields_link (
114   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
115   -document_id INTEGER NOT NULL,
116   -document_field_id INTEGER NOT NULL,
117   -value CHAR(255) NOT NULL
118   -)TYPE = InnoDB;
119   -
120   -CREATE TABLE document_link (
121   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
122   -parent_document_id INTEGER NOT NULL,
123   -child_document_id INTEGER NOT NULL
124   -) TYPE = InnoDB;
125   -
126   -CREATE TABLE document_subscriptions (
127   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
128   -user_id INTEGER NOT NULL,
129   -document_id INTEGER NOT NULL,
130   -is_alerted BIT
131   -)TYPE = InnoDB;
  36 + id int(11) NOT NULL default '0',
  37 + document_id int(11) NOT NULL default '0',
  38 + request_user_id int(11) NOT NULL default '0',
  39 + admin_user_id int(11) NOT NULL default '0',
  40 + datetime datetime NOT NULL default '0000-00-00 00:00:00',
  41 + UNIQUE KEY id (id)
  42 +) TYPE=InnoDB;
  43 +
  44 +-- --------------------------------------------------------
  45 +
  46 +--
  47 +-- Table structure for table `archiving_settings`
  48 +--
  49 +
  50 +CREATE TABLE archiving_settings (
  51 + id int(11) NOT NULL default '0',
  52 + archiving_type_id int(11) NOT NULL default '0',
  53 + expiration_date date default NULL,
  54 + document_transaction_id int(11) default NULL,
  55 + time_period_id int(11) default NULL,
  56 + UNIQUE KEY id (id)
  57 +) TYPE=InnoDB;
  58 +
  59 +-- --------------------------------------------------------
  60 +
  61 +--
  62 +-- Table structure for table `archiving_type_lookup`
  63 +--
  64 +
  65 +CREATE TABLE archiving_type_lookup (
  66 + id int(11) NOT NULL default '0',
  67 + name char(100) default NULL,
  68 + UNIQUE KEY id (id)
  69 +) TYPE=InnoDB;
  70 +
  71 +-- --------------------------------------------------------
  72 +
  73 +--
  74 +-- Table structure for table `data_types`
  75 +--
  76 +
  77 +CREATE TABLE data_types (
  78 + id int(11) NOT NULL default '0',
  79 + name char(255) NOT NULL default '',
  80 + UNIQUE KEY id (id)
  81 +) TYPE=InnoDB;
  82 +
  83 +-- --------------------------------------------------------
  84 +
  85 +--
  86 +-- Table structure for table `dependant_document_instance`
  87 +--
  88 +
  89 +CREATE TABLE dependant_document_instance (
  90 + id int(11) NOT NULL default '0',
  91 + document_title text NOT NULL,
  92 + user_id int(11) NOT NULL default '0',
  93 + template_document_id int(11) default NULL,
  94 + parent_document_id int(11) default NULL,
  95 + UNIQUE KEY id (id)
  96 +) TYPE=InnoDB;
  97 +
  98 +-- --------------------------------------------------------
  99 +
  100 +--
  101 +-- Table structure for table `dependant_document_template`
  102 +--
  103 +
  104 +CREATE TABLE dependant_document_template (
  105 + id int(11) NOT NULL default '0',
  106 + document_title text NOT NULL,
  107 + default_user_id int(11) NOT NULL default '0',
  108 + template_document_id int(11) default NULL,
  109 + group_folder_approval_link_id int(11) default NULL,
  110 + UNIQUE KEY id (id)
  111 +) TYPE=InnoDB;
  112 +
  113 +-- --------------------------------------------------------
  114 +
  115 +--
  116 +-- Table structure for table `discussion_comments`
  117 +--
  118 +
  119 +CREATE TABLE discussion_comments (
  120 + id int(11) NOT NULL default '0',
  121 + thread_id int(11) NOT NULL default '0',
  122 + in_reply_to int(11) default NULL,
  123 + user_id int(11) NOT NULL default '0',
  124 + subject text,
  125 + body text,
  126 + date datetime default NULL,
  127 + UNIQUE KEY id (id)
  128 +) TYPE=InnoDB;
  129 +
  130 +-- --------------------------------------------------------
  131 +
  132 +--
  133 +-- Table structure for table `discussion_threads`
  134 +--
  135 +
  136 +CREATE TABLE discussion_threads (
  137 + id int(11) NOT NULL default '0',
  138 + document_id int(11) NOT NULL default '0',
  139 + first_comment_id int(11) NOT NULL default '0',
  140 + last_comment_id int(11) NOT NULL default '0',
  141 + views int(11) NOT NULL default '0',
  142 + replies int(11) NOT NULL default '0',
  143 + creator_id int(11) NOT NULL default '0',
  144 + UNIQUE KEY id (id)
  145 +) TYPE=InnoDB;
  146 +
  147 +-- --------------------------------------------------------
  148 +
  149 +--
  150 +-- Table structure for table `document_archiving_link`
  151 +--
  152 +
  153 +CREATE TABLE document_archiving_link (
  154 + id int(11) NOT NULL default '0',
  155 + document_id int(11) NOT NULL default '0',
  156 + archiving_settings_id int(11) NOT NULL default '0',
  157 + UNIQUE KEY id (id)
  158 +) TYPE=InnoDB;
  159 +
  160 +-- --------------------------------------------------------
  161 +
  162 +--
  163 +-- Table structure for table `document_fields`
  164 +--
  165 +
  166 +CREATE TABLE document_fields (
  167 + id int(11) NOT NULL default '0',
  168 + name char(255) NOT NULL default '',
  169 + data_type char(100) NOT NULL default '',
  170 + is_generic tinyint(1) default NULL,
  171 + has_lookup tinyint(1) default NULL,
  172 + UNIQUE KEY id (id)
  173 +) TYPE=InnoDB;
  174 +
  175 +-- --------------------------------------------------------
  176 +
  177 +--
  178 +-- Table structure for table `document_fields_link`
  179 +--
  180 +
  181 +CREATE TABLE document_fields_link (
  182 + id int(11) NOT NULL default '0',
  183 + document_id int(11) NOT NULL default '0',
  184 + document_field_id int(11) NOT NULL default '0',
  185 + value char(255) NOT NULL default '',
  186 + UNIQUE KEY id (id)
  187 +) TYPE=InnoDB;
  188 +
  189 +-- --------------------------------------------------------
  190 +
  191 +--
  192 +-- Table structure for table `document_link`
  193 +--
  194 +
  195 +CREATE TABLE document_link (
  196 + id int(11) NOT NULL default '0',
  197 + parent_document_id int(11) NOT NULL default '0',
  198 + child_document_id int(11) NOT NULL default '0',
  199 + UNIQUE KEY id (id)
  200 +) TYPE=InnoDB;
  201 +
  202 +-- --------------------------------------------------------
  203 +
  204 +--
  205 +-- Table structure for table `document_subscriptions`
  206 +--
  207 +
  208 +CREATE TABLE document_subscriptions (
  209 + id int(11) NOT NULL default '0',
  210 + user_id int(11) NOT NULL default '0',
  211 + document_id int(11) NOT NULL default '0',
  212 + is_alerted tinyint(1) default NULL,
  213 + UNIQUE KEY id (id)
  214 +) TYPE=InnoDB;
  215 +
  216 +-- --------------------------------------------------------
  217 +
  218 +--
  219 +-- Table structure for table `document_text`
  220 +--
132 221  
133 222 CREATE TABLE document_text (
134   - id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
135   - document_id integer,
136   - document_text MEDIUMTEXT,
137   - FULLTEXT (document_text),
138   - KEY document_text_document_id_indx (document_id)
139   -) Type = MyISAM;
140   -
141   -CREATE TABLE document_transactions (
142   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
143   -document_id INTEGER NOT NULL,
144   -version CHAR(50),
145   -user_id INTEGER NOT NULL,
146   -datetime DATETIME NOT NULL,
147   -ip CHAR(30),
148   -filename CHAR(255) NOT NULL,
149   -comment CHAR(255) NOT NULL,
150   -transaction_id INTEGER
151   -)TYPE = InnoDB;
152   -ALTER TABLE document_transactions ADD INDEX fk_document_id (document_id);
153   -ALTER TABLE document_transactions ADD INDEX fk_user_id (user_id);
154   -ALTER TABLE document_transactions ADD INDEX fk_transaction_id (transaction_id);
155   -
156   -CREATE TABLE document_transaction_types_lookup (
157   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
158   -name CHAR(100) NOT NULL
159   -)TYPE = InnoDB;
160   -
161   -CREATE TABLE document_type_fields_link (
162   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
163   -document_type_id INTEGER NOT NULL,
164   -field_id INTEGER NOT NULL,
165   -is_mandatory BIT NOT NULL
166   -)TYPE = InnoDB;
167   -
168   -CREATE TABLE document_types_lookup (
169   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
170   -name CHAR(100)
171   -)TYPE = InnoDB;
172   -
173   -CREATE TABLE folders (
174   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
175   -name CHAR(255),
176   -description CHAR(255),
177   -parent_id INTEGER,
178   -creator_id INTEGER,
179   -unit_id INTEGER,
180   -is_public BIT NOT NULL,
181   -parent_folder_ids TEXT,
182   -full_path TEXT,
183   -inherit_parent_folder_permission INTEGER
184   -)TYPE = InnoDB;
185   -ALTER TABLE folders ADD INDEX fk_parent_id (parent_id);
186   -ALTER TABLE folders ADD INDEX fk_creator_id (creator_id);
187   -ALTER TABLE folders ADD INDEX fk_unit_id (unit_id);
188   -
189   -CREATE TABLE folder_subscriptions (
190   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
191   -user_id INTEGER NOT NULL,
192   -folder_id INTEGER NOT NULL,
193   -is_alerted BIT
194   -)TYPE = InnoDB;
195   -
196   -CREATE TABLE folders_users_roles_link (
197   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
198   -group_folder_approval_id INTEGER NOT NULL,
199   -user_id INTEGER NOT NULL,
200   -document_id INTEGER NOT NULL,
201   -datetime DATETIME,
202   -done BIT,
203   -active BIT,
204   -dependant_documents_created BIT
205   -)TYPE = InnoDB;
  223 + id int(11) NOT NULL default '0',
  224 + document_id int(11) default NULL,
  225 + document_text mediumtext,
  226 + UNIQUE KEY id (id),
  227 + KEY document_text_document_id_indx (document_id),
  228 + FULLTEXT KEY document_text (document_text)
  229 +) TYPE=MyISAM;
  230 +
  231 +-- --------------------------------------------------------
  232 +
  233 +--
  234 +-- Table structure for table `document_transaction_types_lookup`
  235 +--
  236 +
  237 +CREATE TABLE document_transaction_types_lookup (
  238 + id int(11) NOT NULL default '0',
  239 + name char(100) NOT NULL default '',
  240 + UNIQUE KEY id (id)
  241 +) TYPE=InnoDB;
  242 +
  243 +-- --------------------------------------------------------
  244 +
  245 +--
  246 +-- Table structure for table `document_transactions`
  247 +--
  248 +
  249 +CREATE TABLE document_transactions (
  250 + id int(11) NOT NULL default '0',
  251 + document_id int(11) NOT NULL default '0',
  252 + version char(50) default NULL,
  253 + user_id int(11) NOT NULL default '0',
  254 + datetime datetime NOT NULL default '0000-00-00 00:00:00',
  255 + ip char(30) default NULL,
  256 + filename char(255) NOT NULL default '',
  257 + comment char(255) NOT NULL default '',
  258 + transaction_id int(11) default NULL,
  259 + UNIQUE KEY id (id),
  260 + KEY fk_document_id (document_id),
  261 + KEY fk_user_id (user_id),
  262 + KEY fk_transaction_id (transaction_id)
  263 +) TYPE=InnoDB;
  264 +
  265 +-- --------------------------------------------------------
  266 +
  267 +--
  268 +-- Table structure for table `document_type_fields_link`
  269 +--
  270 +
  271 +CREATE TABLE document_type_fields_link (
  272 + id int(11) NOT NULL default '0',
  273 + document_type_id int(11) NOT NULL default '0',
  274 + field_id int(11) NOT NULL default '0',
  275 + is_mandatory tinyint(1) NOT NULL default '0',
  276 + UNIQUE KEY id (id)
  277 +) TYPE=InnoDB;
  278 +
  279 +-- --------------------------------------------------------
  280 +
  281 +--
  282 +-- Table structure for table `document_types_lookup`
  283 +--
  284 +
  285 +CREATE TABLE document_types_lookup (
  286 + id int(11) NOT NULL default '0',
  287 + name char(100) default NULL,
  288 + UNIQUE KEY id (id),
  289 + UNIQUE KEY name (name)
  290 +) TYPE=InnoDB;
  291 +
  292 +-- --------------------------------------------------------
  293 +
  294 +--
  295 +-- Table structure for table `documents`
  296 +--
  297 +
  298 +CREATE TABLE documents (
  299 + id int(11) NOT NULL default '0',
  300 + document_type_id int(11) NOT NULL default '0',
  301 + name text NOT NULL,
  302 + filename text NOT NULL,
  303 + size bigint(20) NOT NULL default '0',
  304 + creator_id int(11) NOT NULL default '0',
  305 + modified datetime NOT NULL default '0000-00-00 00:00:00',
  306 + description varchar(200) NOT NULL default '',
  307 + security int(11) NOT NULL default '0',
  308 + mime_id int(11) NOT NULL default '0',
  309 + folder_id int(11) NOT NULL default '0',
  310 + major_version int(11) NOT NULL default '0',
  311 + minor_version int(11) NOT NULL default '0',
  312 + is_checked_out tinyint(1) NOT NULL default '0',
  313 + parent_folder_ids text,
  314 + full_path text,
  315 + checked_out_user_id int(11) default NULL,
  316 + status_id int(11) default NULL,
  317 + UNIQUE KEY id (id),
  318 + KEY fk_document_type_id (document_type_id),
  319 + KEY fk_creator_id (creator_id),
  320 + KEY fk_folder_id (folder_id),
  321 + KEY fk_checked_out_user_id (checked_out_user_id),
  322 + KEY fk_status_id (status_id)
  323 +) TYPE=InnoDB;
  324 +
  325 +-- --------------------------------------------------------
  326 +
  327 +--
  328 +-- Table structure for table `folder_doctypes_link`
  329 +--
206 330  
207 331 CREATE TABLE folder_doctypes_link (
208   -id int(11) NOT NULL auto_increment,
209   -folder_id int(11) NOT NULL default '0',
210   -document_type_id int(11) NOT NULL default '0',
211   -UNIQUE KEY id (id)
212   -) TYPE=InnoDB;
213   -ALTER TABLE folder_doctypes_link ADD INDEX fk_folder_id (folder_id);
214   -ALTER TABLE folder_doctypes_link ADD INDEX fk_document_type_id (document_type_id);
215   -
216   -CREATE TABLE groups_folders_approval_link (
217   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
218   -folder_id INTEGER NOT NULL,
219   -group_id INTEGER NOT NULL,
220   -precedence INTEGER NOT NULL,
221   -role_id INTEGER NOT NULL,
222   -user_id INTEGER NOT NULL
223   -)TYPE = InnoDB;
  332 + id int(11) NOT NULL default '0',
  333 + folder_id int(11) NOT NULL default '0',
  334 + document_type_id int(11) NOT NULL default '0',
  335 + UNIQUE KEY id (id),
  336 + KEY fk_folder_id (folder_id),
  337 + KEY fk_document_type_id (document_type_id)
  338 +) TYPE=InnoDB;
  339 +
  340 +-- --------------------------------------------------------
  341 +
  342 +--
  343 +-- Table structure for table `folder_subscriptions`
  344 +--
  345 +
  346 +CREATE TABLE folder_subscriptions (
  347 + id int(11) NOT NULL default '0',
  348 + user_id int(11) NOT NULL default '0',
  349 + folder_id int(11) NOT NULL default '0',
  350 + is_alerted tinyint(1) default NULL,
  351 + UNIQUE KEY id (id)
  352 +) TYPE=InnoDB;
  353 +
  354 +-- --------------------------------------------------------
  355 +
  356 +--
  357 +-- Table structure for table `folders`
  358 +--
  359 +
  360 +CREATE TABLE folders (
  361 + id int(11) NOT NULL default '0',
  362 + name varchar(255) default NULL,
  363 + description varchar(255) default NULL,
  364 + parent_id int(11) default NULL,
  365 + creator_id int(11) default NULL,
  366 + unit_id int(11) default NULL,
  367 + is_public tinyint(1) NOT NULL default '0',
  368 + parent_folder_ids text,
  369 + full_path text,
  370 + inherit_parent_folder_permission int(11) default NULL,
  371 + UNIQUE KEY id (id),
  372 + KEY fk_parent_id (parent_id),
  373 + KEY fk_creator_id (creator_id),
  374 + KEY fk_unit_id (unit_id)
  375 +) TYPE=InnoDB;
  376 +
  377 +-- --------------------------------------------------------
  378 +
  379 +--
  380 +-- Table structure for table `folders_users_roles_link`
  381 +--
  382 +
  383 +CREATE TABLE folders_users_roles_link (
  384 + id int(11) NOT NULL default '0',
  385 + group_folder_approval_id int(11) NOT NULL default '0',
  386 + user_id int(11) NOT NULL default '0',
  387 + document_id int(11) NOT NULL default '0',
  388 + datetime datetime default NULL,
  389 + done tinyint(1) default NULL,
  390 + active tinyint(1) default NULL,
  391 + dependant_documents_created tinyint(1) default NULL,
  392 + UNIQUE KEY id (id)
  393 +) TYPE=InnoDB;
  394 +
  395 +-- --------------------------------------------------------
  396 +
  397 +--
  398 +-- Table structure for table `groups_folders_approval_link`
  399 +--
  400 +
  401 +CREATE TABLE groups_folders_approval_link (
  402 + id int(11) NOT NULL default '0',
  403 + folder_id int(11) NOT NULL default '0',
  404 + group_id int(11) NOT NULL default '0',
  405 + precedence int(11) NOT NULL default '0',
  406 + role_id int(11) NOT NULL default '0',
  407 + user_id int(11) NOT NULL default '0',
  408 + UNIQUE KEY id (id)
  409 +) TYPE=InnoDB;
  410 +
  411 +-- --------------------------------------------------------
  412 +
  413 +--
  414 +-- Table structure for table `groups_folders_link`
  415 +--
224 416  
225 417 CREATE TABLE groups_folders_link (
226   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
227   -group_id INTEGER NOT NULL,
228   -folder_id INTEGER NOT NULL,
229   -can_read BIT NOT NULL,
230   -can_write BIT NOT NULL
231   -)TYPE = InnoDB;
232   -ALTER TABLE groups_folders_link ADD INDEX fk_group_id (group_id);
233   -ALTER TABLE groups_folders_link ADD INDEX fk_folder_id (folder_id);
234   -
235   -CREATE TABLE groups_lookup (
236   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
237   -name CHAR(100) NOT NULL,
238   -is_sys_admin BIT NOT NULL,
239   -is_unit_admin BIT NOT NULL
240   -)TYPE = InnoDB;
241   -
242   -CREATE TABLE groups_units_link (
243   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
244   -group_id INTEGER NOT NULL,
245   -unit_id INTEGER NOT NULL
246   -)TYPE = InnoDB;
247   -ALTER TABLE groups_units_link ADD INDEX fk_group_id (group_id);
248   -ALTER TABLE groups_units_link ADD INDEX fk_unit_id (unit_id);
  418 + id int(11) NOT NULL default '0',
  419 + group_id int(11) NOT NULL default '0',
  420 + folder_id int(11) NOT NULL default '0',
  421 + can_read tinyint(1) NOT NULL default '0',
  422 + can_write tinyint(1) NOT NULL default '0',
  423 + UNIQUE KEY id (id),
  424 + KEY fk_group_id (group_id),
  425 + KEY fk_folder_id (folder_id)
  426 +) TYPE=InnoDB;
  427 +
  428 +-- --------------------------------------------------------
  429 +
  430 +--
  431 +-- Table structure for table `groups_lookup`
  432 +--
  433 +
  434 +CREATE TABLE groups_lookup (
  435 + id int(11) NOT NULL default '0',
  436 + name char(100) NOT NULL default '',
  437 + is_sys_admin tinyint(1) NOT NULL default '0',
  438 + is_unit_admin tinyint(1) NOT NULL default '0',
  439 + UNIQUE KEY id (id),
  440 + UNIQUE KEY name (name)
  441 +) TYPE=InnoDB;
  442 +
  443 +-- --------------------------------------------------------
  444 +
  445 +--
  446 +-- Table structure for table `groups_units_link`
  447 +--
  448 +
  449 +CREATE TABLE groups_units_link (
  450 + id int(11) NOT NULL default '0',
  451 + group_id int(11) NOT NULL default '0',
  452 + unit_id int(11) NOT NULL default '0',
  453 + UNIQUE KEY id (id),
  454 + KEY fk_group_id (group_id),
  455 + KEY fk_unit_id (unit_id)
  456 +) TYPE=InnoDB;
  457 +
  458 +-- --------------------------------------------------------
  459 +
  460 +--
  461 +-- Table structure for table `help`
  462 +--
249 463  
250 464 CREATE TABLE help (
251   - id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
  465 + id int(11) NOT NULL default '0',
252 466 fSection varchar(100) NOT NULL default '',
253   - help_info text NOT NULL
254   -) TYPE=InnoDB;
255   -
256   -CREATE TABLE links (
257   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
258   -name CHAR(100) NOT NULL,
259   -url CHAR(100) NOT NULL,
260   -rank INTEGER NOT NULL
261   -)TYPE = InnoDB;
262   -
263   -CREATE TABLE metadata_lookup (
264   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
265   -document_field_id INTEGER NOT NULL,
266   -name CHAR(255)
267   -)TYPE = InnoDB;
268   -
269   -CREATE TABLE mime_types (
270   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
271   -filetypes CHAR(100) NOT NULL,
272   -mimetypes CHAR(100) NOT NULL,
273   -icon_path CHAR(255)
274   -)TYPE = InnoDB;
275   -
276   -CREATE TABLE news (
277   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
278   -synopsis VARCHAR(255) NOT NULL,
279   -body TEXT,
280   -rank INTEGER,
281   -image TEXT,
282   -image_size INTEGER,
283   -image_mime_type_id INTEGER,
284   -active BIT
285   -) TYPE = InnoDB;
286   -
287   -CREATE TABLE organisations_lookup (
288   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
289   -name CHAR(100) NOT NULL
290   -)TYPE = InnoDB;
291   -
292   -CREATE TABLE roles (
293   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
294   -name CHAR(255) NOT NULL,
295   -active BIT NOT NULL,
296   -can_read BIT NOT NULL,
297   -can_write BIT NOT NULL
298   -)TYPE = InnoDB;
  467 + help_info text NOT NULL,
  468 + UNIQUE KEY id (id)
  469 +) TYPE=InnoDB;
  470 +
  471 +-- --------------------------------------------------------
  472 +
  473 +--
  474 +-- Table structure for table `links`
  475 +--
  476 +
  477 +CREATE TABLE links (
  478 + id int(11) NOT NULL default '0',
  479 + name char(100) NOT NULL default '',
  480 + url char(100) NOT NULL default '',
  481 + rank int(11) NOT NULL default '0',
  482 + UNIQUE KEY id (id)
  483 +) TYPE=InnoDB;
  484 +
  485 +-- --------------------------------------------------------
  486 +
  487 +--
  488 +-- Table structure for table `metadata_lookup`
  489 +--
  490 +
  491 +CREATE TABLE metadata_lookup (
  492 + id int(11) NOT NULL default '0',
  493 + document_field_id int(11) NOT NULL default '0',
  494 + name char(255) default NULL,
  495 + UNIQUE KEY id (id)
  496 +) TYPE=InnoDB;
  497 +
  498 +-- --------------------------------------------------------
  499 +
  500 +--
  501 +-- Table structure for table `mime_types`
  502 +--
  503 +
  504 +CREATE TABLE mime_types (
  505 + id int(11) NOT NULL default '0',
  506 + filetypes char(100) NOT NULL default '',
  507 + mimetypes char(100) NOT NULL default '',
  508 + icon_path char(255) default NULL,
  509 + UNIQUE KEY id (id)
  510 +) TYPE=InnoDB;
  511 +
  512 +-- --------------------------------------------------------
  513 +
  514 +--
  515 +-- Table structure for table `news`
  516 +--
  517 +
  518 +CREATE TABLE news (
  519 + id int(11) NOT NULL default '0',
  520 + synopsis varchar(255) NOT NULL default '',
  521 + body text,
  522 + rank int(11) default NULL,
  523 + image text,
  524 + image_size int(11) default NULL,
  525 + image_mime_type_id int(11) default NULL,
  526 + active tinyint(1) default NULL,
  527 + UNIQUE KEY id (id)
  528 +) TYPE=InnoDB;
  529 +
  530 +-- --------------------------------------------------------
  531 +
  532 +--
  533 +-- Table structure for table `organisations_lookup`
  534 +--
  535 +
  536 +CREATE TABLE organisations_lookup (
  537 + id int(11) NOT NULL default '0',
  538 + name char(100) NOT NULL default '',
  539 + UNIQUE KEY id (id),
  540 + UNIQUE KEY name (name)
  541 +) TYPE=InnoDB;
  542 +
  543 +-- --------------------------------------------------------
  544 +
  545 +--
  546 +-- Table structure for table `roles`
  547 +--
  548 +
  549 +CREATE TABLE roles (
  550 + id int(11) NOT NULL default '0',
  551 + name char(255) NOT NULL default '',
  552 + active tinyint(1) NOT NULL default '0',
  553 + can_read tinyint(1) NOT NULL default '0',
  554 + can_write tinyint(1) NOT NULL default '0',
  555 + UNIQUE KEY id (id),
  556 + UNIQUE KEY name (name)
  557 +) TYPE=InnoDB;
  558 +
  559 +-- --------------------------------------------------------
  560 +
  561 +--
  562 +-- Table structure for table `search_document_user_link`
  563 +--
299 564  
300 565 CREATE TABLE search_document_user_link (
301   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
302   -document_id INTEGER,
303   -user_id INTEGER
304   -) Type = InnoDB;
305   -ALTER TABLE search_document_user_link ADD INDEX fk_user_id (user_id);
306   -ALTER TABLE search_document_user_link ADD INDEX fk_document_ids (document_id);
307   -
308   -CREATE TABLE status_lookup (
309   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
310   -name CHAR(255)
311   -)TYPE = InnoDB;
312   -
313   -CREATE TABLE system_settings (
314   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
315   -name CHAR(255) NOT NULL,
316   -value CHAR(255) NOT NULL
317   -)TYPE = InnoDB;
318   -
319   -CREATE TABLE time_period (
320   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
321   -time_unit_id INTEGER,
322   -units INTEGER
323   -) TYPE = InnoDB;
324   -
325   -CREATE TABLE time_unit_lookup (
326   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
327   -name CHAR(100)
328   -) TYPE = InnoDB;
329   -
330   -CREATE TABLE units_lookup (
331   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
332   -name CHAR(100) NOT NULL
333   -)TYPE = InnoDB;
334   -
335   -CREATE TABLE units_organisations_link (
336   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
337   -unit_id INTEGER NOT NULL,
338   -organisation_id INTEGER NOT NULL
339   -)TYPE = InnoDB;
340   -ALTER TABLE units_organisations_link ADD INDEX fk_unit_id (unit_id);
341   -ALTER TABLE units_organisations_link ADD INDEX fk_organisation_id (organisation_id);
  566 + id int(11) NOT NULL default '0',
  567 + document_id int(11) default NULL,
  568 + user_id int(11) default NULL,
  569 + UNIQUE KEY id (id),
  570 + KEY fk_user_id (user_id),
  571 + KEY fk_document_ids (document_id)
  572 +) TYPE=InnoDB;
  573 +
  574 +-- --------------------------------------------------------
  575 +
  576 +--
  577 +-- Table structure for table `status_lookup`
  578 +--
  579 +
  580 +CREATE TABLE status_lookup (
  581 + id int(11) NOT NULL default '0',
  582 + name char(255) default NULL,
  583 + UNIQUE KEY id (id)
  584 +) TYPE=InnoDB;
  585 +
  586 +-- --------------------------------------------------------
  587 +
  588 +--
  589 +-- Table structure for table `system_settings`
  590 +--
  591 +
  592 +CREATE TABLE system_settings (
  593 + id int(11) NOT NULL default '0',
  594 + name char(255) NOT NULL default '',
  595 + value char(255) NOT NULL default '',
  596 + UNIQUE KEY id (id)
  597 +) TYPE=InnoDB;
  598 +
  599 +-- --------------------------------------------------------
  600 +
  601 +--
  602 +-- Table structure for table `time_period`
  603 +--
  604 +
  605 +CREATE TABLE time_period (
  606 + id int(11) NOT NULL default '0',
  607 + time_unit_id int(11) default NULL,
  608 + units int(11) default NULL,
  609 + UNIQUE KEY id (id)
  610 +) TYPE=InnoDB;
  611 +
  612 +-- --------------------------------------------------------
  613 +
  614 +--
  615 +-- Table structure for table `time_unit_lookup`
  616 +--
  617 +
  618 +CREATE TABLE time_unit_lookup (
  619 + id int(11) NOT NULL default '0',
  620 + name char(100) default NULL,
  621 + UNIQUE KEY id (id)
  622 +) TYPE=InnoDB;
  623 +
  624 +-- --------------------------------------------------------
  625 +
  626 +--
  627 +-- Table structure for table `units_lookup`
  628 +--
  629 +
  630 +CREATE TABLE units_lookup (
  631 + id int(11) NOT NULL default '0',
  632 + name char(100) NOT NULL default '',
  633 + UNIQUE KEY id (id)
  634 +) TYPE=InnoDB;
  635 +
  636 +-- --------------------------------------------------------
  637 +
  638 +--
  639 +-- Table structure for table `units_organisations_link`
  640 +--
  641 +
  642 +CREATE TABLE units_organisations_link (
  643 + id int(11) NOT NULL default '0',
  644 + unit_id int(11) NOT NULL default '0',
  645 + organisation_id int(11) NOT NULL default '0',
  646 + UNIQUE KEY id (id),
  647 + KEY fk_unit_id (unit_id),
  648 + KEY fk_organisation_id (organisation_id)
  649 +) TYPE=InnoDB;
  650 +
  651 +-- --------------------------------------------------------
  652 +
  653 +--
  654 +-- Table structure for table `users`
  655 +--
342 656  
343 657 CREATE TABLE users (
344   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
345   -username CHAR(255) NOT NULL,
346   -name CHAR(255) NOT NULL,
347   -password CHAR(255) NOT NULL,
348   -quota_max INTEGER NOT NULL,
349   -quota_current INTEGER NOT NULL,
350   -email CHAR(255),
351   -mobile CHAR(255),
352   -email_notification BIT NOT NULL,
353   -sms_notification BIT NOT NULL,
354   -ldap_dn CHAR(255),
355   -max_sessions INTEGER,
356   -language_id INTEGER
357   -) TYPE = InnoDB;
358   -
359   -CREATE TABLE users_groups_link (
360   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
361   -user_id INTEGER NOT NULL,
362   -group_id INTEGER NOT NULL
363   -) TYPE = InnoDB;
364   -ALTER TABLE users_groups_link ADD INDEX fk_user_id (user_id);
365   -ALTER TABLE users_groups_link ADD INDEX fk_group_id (group_id);
366   -
367   -CREATE TABLE web_documents (
368   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
369   -document_id INTEGER NOT NULL,
370   -web_site_id INTEGER NOT NULL,
371   -unit_id INTEGER NOT NULL,
372   -status_id INTEGER NOT NULL,
373   -datetime DATETIME NOT NULL
374   -)TYPE = InnoDB;
375   -
376   -CREATE TABLE web_documents_status_lookup (
377   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
378   -name CHAR(50) NOT NULL
379   -)TYPE = InnoDB;
380   -
381   -CREATE TABLE web_sites (
382   -id INTEGER NOT NULL UNIQUE AUTO_INCREMENT,
383   -web_site_name CHAR(100) NOT NULL,
384   -web_site_url CHAR(50) NOT NULL,
385   -web_master_id INTEGER NOT NULL
386   -)TYPE = InnoDB;
387   -
388   --- mime types
389   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ai', 'application/postscript', NULL);
390   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('aif', 'audio/x-aiff', NULL);
391   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('aifc', 'audio/x-aiff', NULL);
392   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('aiff', 'audio/x-aiff', NULL);
393   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('asc', 'text/plain', 'icons/txt.gif');
394   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('au', 'audio/basic', NULL);
395   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('avi', 'video/x-msvideo', NULL);
396   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('bcpio', 'application/x-bcpio', NULL);
397   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('bin', 'application/octet-stream', NULL);
398   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('bmp', 'image/bmp', 'icons/bmp.gif');
399   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('cdf', 'application/x-netcdf', NULL);
400   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('class', 'application/octet-stream', NULL);
401   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('cpio', 'application/x-cpio', NULL);
402   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('cpt', 'application/mac-compactpro', NULL);
403   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('csh', 'application/x-csh', NULL);
404   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('css', 'text/css', NULL);
405   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dcr', 'application/x-director', NULL);
406   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dir', 'application/x-director', NULL);
407   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dms', 'application/octet-stream', NULL);
408   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('doc', 'application/msword', 'icons/word.gif');
409   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dvi', 'application/x-dvi', NULL);
410   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('dxr', 'application/x-director', NULL);
411   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('eps', 'application/postscript', NULL);
412   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('etx', 'text/x-setext', NULL);
413   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('exe', 'application/octet-stream', NULL);
414   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ez', 'application/andrew-inset', NULL);
415   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('gif', 'image/gif', 'icons/gif.gif');
416   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('gtar', 'application/x-gtar', NULL);
417   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('hdf', 'application/x-hdf', NULL);
418   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('hqx', 'application/mac-binhex40', NULL);
419   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('htm', 'text/html', 'icons/html.gif');
420   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('html', 'text/html', 'icons/html.gif');
421   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ice', 'x-conference/x-cooltalk', NULL);
422   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ief', 'image/ief', NULL);
423   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('iges', 'model/iges', NULL);
424   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('igs', 'model/iges', NULL);
425   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('jpe', 'image/jpeg', 'icons/jpg.gif');
426   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('jpeg', 'image/jpeg', 'icons/jpg.gif');
427   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('jpg', 'image/jpeg', 'icons/jpg.gif');
428   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('js', 'application/x-javascript', NULL);
429   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('kar', 'audio/midi', NULL);
430   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('latex', 'application/x-latex', NULL);
431   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('lha', 'application/octet-stream', NULL);
432   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('lzh', 'application/octet-stream', NULL);
433   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('man', 'application/x-troff-man', NULL);
434   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mdb', 'application/access','icons/access.gif');
435   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mdf', 'application/access','icons/access.gif');
436   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('me', 'application/x-troff-me', NULL);
437   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mesh', 'model/mesh', NULL);
438   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mid', 'audio/midi', NULL);
439   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('midi', 'audio/midi', NULL);
440   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mif', 'application/vnd.mif', NULL);
441   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mov', 'video/quicktime', NULL);
442   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('movie', 'video/x-sgi-movie', NULL);
443   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mp2', 'audio/mpeg', NULL);
444   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mp3', 'audio/mpeg', NULL);
445   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpe', 'video/mpeg', NULL);
446   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpeg', 'video/mpeg', NULL);
447   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpg', 'video/mpeg', NULL);
448   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpga', 'audio/mpeg', NULL);
449   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('mpp', 'application/vnd.ms-project', 'icons/project.gif');
450   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ms', 'application/x-troff-ms', NULL);
451   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('msh', 'model/mesh', NULL);
452   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('nc', 'application/x-netcdf', NULL);
453   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('oda', 'application/oda', NULL);
454   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pbm', 'image/x-portable-bitmap', NULL);
455   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pdb', 'chemical/x-pdb', NULL);
456   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pdf', 'application/pdf', 'icons/pdf.gif');
457   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pgm', 'image/x-portable-graymap', NULL);
458   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pgn', 'application/x-chess-pgn', NULL);
459   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('png', 'image/png', NULL);
460   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('pnm', 'image/x-portable-anymap', NULL);
461   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ppm', 'image/x-portable-pixmap', NULL);
462   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ppt', 'application/vnd.ms-powerpoint', 'icons/powerp.gif');
463   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ps', 'application/postscript', NULL);
464   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('qt', 'video/quicktime', NULL);
465   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ra', 'audio/x-realaudio', NULL);
466   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ram', 'audio/x-pn-realaudio', NULL);
467   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ras', 'image/x-cmu-raster', NULL);
468   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rgb', 'image/x-rgb', NULL);
469   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rm', 'audio/x-pn-realaudio', NULL);
470   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('roff', 'application/x-troff', NULL);
471   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rpm', 'audio/x-pn-realaudio-plugin', NULL);
472   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rtf', 'text/rtf', NULL);
473   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('rtx', 'text/richtext', NULL);
474   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sgm', 'text/sgml', NULL);
475   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sgml', 'text/sgml', NULL);
476   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sh', 'application/x-sh', NULL);
477   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('shar', 'application/x-shar', NULL);
478   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('silo', 'model/mesh', NULL);
479   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sit', 'application/x-stuffit', NULL);
480   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skd', 'application/x-koan', NULL);
481   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skm', 'application/x-koan', NULL);
482   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skp', 'application/x-koan', NULL);
483   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('skt', 'application/x-koan', NULL);
484   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('smi', 'application/smil', NULL);
485   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('smil', 'application/smil', NULL);
486   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('snd', 'audio/basic', NULL);
487   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('spl', 'application/x-futuresplash', NULL);
488   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('src', 'application/x-wais-source', NULL);
489   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sv4cpio', 'application/x-sv4cpio', NULL);
490   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sv4crc', 'application/x-sv4crc', NULL);
491   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('swf', 'application/x-shockwave-flash', NULL);
492   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('t', 'application/x-troff', NULL);
493   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tar', 'application/x-tar', NULL);
494   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tcl', 'application/x-tcl', NULL);
495   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tex', 'application/x-tex', NULL);
496   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('texi', 'application/x-texinfo', NULL);
497   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('texinfo', 'application/x-texinfo', NULL);
498   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tif', 'image/tiff', 'icons/tiff.gif');
499   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tiff', 'image/tiff', 'icons/tiff.gif');
500   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tr', 'application/x-troff', NULL);
501   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tsv', 'text/tab-separated-values', NULL);
502   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('txt', 'text/plain', 'icons/txt.gif');
503   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('ustar', 'application/x-ustar', NULL);
504   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('vcd', 'application/x-cdlink', NULL);
505   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('vrml', 'model/vrml', NULL);
506   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('vsd', 'application/vnd.visio', 'icons/visio.gif');
507   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('wav', 'audio/x-wav', NULL);
508   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('wrl', 'model/vrml', NULL);
509   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xbm', 'image/x-xbitmap', NULL);
510   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xls', 'application/vnd.ms-excel', 'icons/excel.gif');
511   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xml', 'text/xml', NULL);
512   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xpm', 'image/x-xpixmap', NULL);
513   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xwd', 'image/x-xwindowdump', NULL);
514   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('xyz', 'chemical/x-pdb', NULL);
515   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('zip', 'application/zip', 'icons/zip.gif');
516   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('gz', 'application/x-gzip', 'icons/zip.gif');
517   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('tgz', 'application/x-gzip', 'icons/zip.gif');
518   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxw', 'application/vnd.sun.xml.writer', 'icons/oowriter.gif');
519   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('stw','application/vnd.sun.xml.writer.template', 'icons/oowriter.gif');
520   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxc','application/vnd.sun.xml.calc', 'icons/oocalc.gif');
521   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('stc','application/vnd.sun.xml.calc.template', 'icons/oocalc.gif');
522   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxd','application/vnd.sun.xml.draw', NULL);
523   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('std','application/vnd.sun.xml.draw.template', NULL);
524   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxi','application/vnd.sun.xml.impress', 'icons/ooimpress.gif');
525   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sti','application/vnd.sun.xml.impress.template', 'icons/ooimpress.gif');
526   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxg','application/vnd.sun.xml.writer.global', NULL);
527   -INSERT INTO mime_types (filetypes, mimetypes, icon_path) VALUES ('sxm','application/vnd.sun.xml.math', NULL);
528   -
529   --- data_types
530   -insert into data_types (name) values ('STRING');
531   -insert into data_types (name) values ('CHAR');
532   -insert into data_types (name) values ('TEXT');
533   -insert into data_types (name) values ('INT');
534   -insert into data_types (name) values ('FLOAT');
535   -
536   --- category field
537   -INSERT INTO document_fields (name, data_type, is_generic) VALUES ("Category", "STRING", 1);
538   -
539   --- system settings
540   -INSERT INTO system_settings (name, value) values ("lastIndexUpdate", "0");
541   -INSERT INTO system_settings (name, value) values ("knowledgeTreeVersion", "1.2.5");
542   -
543   --- document statuses
544   -INSERT INTO web_documents_status_lookup (name) VALUES ("Pending");
545   -INSERT INTO web_documents_status_lookup (name) VALUES ("Published");
546   -INSERT INTO web_documents_status_lookup (name) VALUES ("Not Published");
547   -
548   --- document transaction types
549   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Create");
550   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Update");
551   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Delete");
552   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Rename");
553   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Move");
554   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Download");
555   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Check In");
556   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Check Out");
557   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Collaboration Step Rollback");
558   -INSERT INTO document_transaction_types_lookup (name) VALUES ("View");
559   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Expunge");
560   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Force CheckIn");
561   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Email Link");
562   -INSERT INTO document_transaction_types_lookup (name) VALUES ("Collaboration Step Approve");
563   -
564   --- document status
565   -INSERT INTO status_lookup (name) VALUES ("Live");
566   -INSERT INTO status_lookup (name) VALUES ("Published");
567   -INSERT INTO status_lookup (name) VALUES ("Deleted");
568   -INSERT INTO status_lookup (name) VALUES ("Archived");
569   -
570   -INSERT INTO archiving_type_lookup (name) VALUES ("Date");
571   -INSERT INTO archiving_type_lookup (name) VALUES ("Utilisation");
572   -
573   --- time lookups
574   -INSERT INTO time_unit_lookup (name) VALUES ("Years");
575   -INSERT INTO time_unit_lookup (name) VALUES ("Months");
576   -INSERT INTO time_unit_lookup (name) VALUES ("Days");
577   -
578   --- help
579   -INSERT INTO help VALUES (1,'browse','dochelp.html');
580   -INSERT INTO help VALUES (2,'dashboard','dashboardHelp.html');
581   -INSERT INTO help VALUES (3,'addFolder','addFolderHelp.html');
582   -INSERT INTO help VALUES (4,'editFolder','editFolderHelp.html');
583   -INSERT INTO help VALUES (5,'addFolderCollaboration','addFolderCollaborationHelp.html');
584   -INSERT INTO help VALUES (6,'modifyFolderCollaboration','addFolderCollaborationHelp.html');
585   -INSERT INTO help VALUES (7,'addDocument','addDocumentHelp.html');
586   -INSERT INTO help VALUES (8,'viewDocument','viewDocumentHelp.html');
587   -INSERT INTO help VALUES (9,'modifyDocument','modifyDocumentHelp.html');
588   -INSERT INTO help VALUES (10,'modifyDocumentRouting','modifyDocumentRoutingHelp.html');
589   -INSERT INTO help VALUES (11,'emailDocument','emailDocumentHelp.html');
590   -INSERT INTO help VALUES (12,'deleteDocument','deleteDocumentHelp.html');
591   -INSERT INTO help VALUES (13,'administration','administrationHelp.html');
592   -INSERT INTO help VALUES (14,'addGroup','addGroupHelp.html');
593   -INSERT INTO help VALUES (15,'editGroup','editGroupHelp.html');
594   -INSERT INTO help VALUES (16,'removeGroup','removeGroupHelp.html');
595   -INSERT INTO help VALUES (17,'assignGroupToUnit','assignGroupToUnitHelp.html');
596   -INSERT INTO help VALUES (18,'removeGroupFromUnit','removeGroupFromUnitHelp.html');
597   -INSERT INTO help VALUES (19,'addUnit','addUnitHelp.html');
598   -INSERT INTO help VALUES (20,'editUnit','editUnitHelp.html');
599   -INSERT INTO help VALUES (21,'removeUnit','removeUnitHelp.html');
600   -INSERT INTO help VALUES (22,'addOrg','addOrgHelp.html');
601   -INSERT INTO help VALUES (23,'editOrg','editOrgHelp.html');
602   -INSERT INTO help VALUES (24,'removeOrg','removeOrgHelp.html');
603   -INSERT INTO help VALUES (25,'addRole','addRoleHelp.html');
604   -INSERT INTO help VALUES (26,'editRole','editRoleHelp.html');
605   -INSERT INTO help VALUES (27,'removeRole','removeRoleHelp.html');
606   -INSERT INTO help VALUES (28,'addLink','addLinkHelp.html');
607   -INSERT INTO help VALUES (29,'addLinkSuccess','addLinkHelp.html');
608   -INSERT INTO help VALUES (30,'editLink','editLinkHelp.html');
609   -INSERT INTO help VALUES (31,'removeLink','removeLinkHelp.html');
610   -INSERT INTO help VALUES (32,'systemAdministration','systemAdministrationHelp.html');
611   -INSERT INTO help VALUES (33,'deleteFolder','deleteFolderHelp.html');
612   -INSERT INTO help VALUES (34,'editDocType','editDocTypeHelp.html');
613   -INSERT INTO help VALUES (35,'removeDocType','removeDocTypeHelp.html');
614   -INSERT INTO help VALUES (36,'addDocType','addDocTypeHelp.html');
615   -INSERT INTO help VALUES (37,'addDocTypeSuccess','addDocTypeHelp.html');
616   -INSERT INTO help VALUES (38,'manageSubscriptions','manageSubscriptionsHelp.html');
617   -INSERT INTO help VALUES (39,'addSubscription','addSubscriptionHelp.html');
618   -INSERT INTO help VALUES (40,'removeSubscription','removeSubscriptionHelp.html');
619   -INSERT INTO help VALUES (41,'preferences','preferencesHelp.html');
620   -INSERT INTO help VALUES (42,'editPrefsSuccess','preferencesHelp.html');
621   -INSERT INTO help VALUES (43,'modifyDocumentGenericMetaData','modifyDocumentGenericMetaDataHelp.html');
622   -INSERT INTO help VALUES (44,'viewHistory','viewHistoryHelp.html');
623   -INSERT INTO help VALUES (45,'checkInDocument','checkInDocumentHelp.html');
624   -INSERT INTO help VALUES (46,'checkOutDocument','checkOutDocumentHelp.html');
625   -INSERT INTO help VALUES (47,'advancedSearch','advancedSearchHelp.html');
626   -INSERT INTO help VALUES (48,'deleteFolderCollaboration','deleteFolderCollaborationHelp.html');
627   -INSERT INTO help VALUES (49,'addFolderDocType','addFolderDocTypeHelp.html');
628   -INSERT INTO help VALUES (50,'deleteFolderDocType','deleteFolderDocTypeHelp.html');
629   -INSERT INTO help VALUES (51,'addGroupFolderLink','addGroupFolderLinkHelp.html');
630   -INSERT INTO help VALUES (52,'deleteGroupFolderLink','deleteGroupFolderLinkHelp.html');
631   -INSERT INTO help VALUES (53,'addWebsite','addWebsiteHelp.html');
632   -INSERT INTO help VALUES (54,'addWebsiteSuccess','addWebsiteHelp.html');
633   -INSERT INTO help VALUES (55,'editWebsite','editWebsiteHelp.html');
634   -INSERT INTO help VALUES (56,'removeWebSite','removeWebSiteHelp.html');
635   -INSERT INTO help VALUES (57,'standardSearch','standardSearchHelp.html');
636   -INSERT INTO help VALUES (58,'modifyDocumentTypeMetaData','modifyDocumentTypeMetaDataHelp.html');
637   -INSERT INTO help VALUES (59,'addDocField','addDocFieldHelp.html');
638   -INSERT INTO help VALUES (60,'editDocField','editDocFieldHelp.html');
639   -INSERT INTO help VALUES (61,'removeDocField','removeDocFieldHelp.html');
640   -INSERT INTO help VALUES (62,'addMetaData','addMetaDataHelp.html');
641   -INSERT INTO help VALUES (63,'editMetaData','editMetaDataHelp.html');
642   -INSERT INTO help VALUES (64,'removeMetaData','removeMetaDataHelp.html');
643   -INSERT INTO help VALUES (65,'addUser','addUserHelp.html');
644   -INSERT INTO help VALUES (66,'editUser','editUserHelp.html');
645   -INSERT INTO help VALUES (67,'removeUser','removeUserHelp.html');
646   -INSERT INTO help VALUES (68,'addUserToGroup','addUserToGroupHelp.html');
647   -INSERT INTO help VALUES (69,'removeUserFromGroup','removeUserFromGroupHelp.html');
648   -INSERT INTO help VALUES (70,'viewDiscussion','viewDiscussionThread.html');
649   -INSERT INTO help VALUES (71,'addComment','addDiscussionComment.html');
650   -INSERT INTO help VALUES (72,'listNews','listDashboardNewsHelp.html');
651   -INSERT INTO help VALUES (73,'editNews','editDashboardNewsHelp.html');
652   -INSERT INTO help VALUES (74,'previewNews','previewDashboardNewsHelp.html');
653   -INSERT INTO help VALUES (75,'addNews','addDashboardNewsHelp.html');
654   -INSERT INTO help VALUES (76,'modifyDocumentArchiveSettings','modifyDocumentArchiveSettingsHelp.html');
655   -INSERT INTO help VALUES (77,'addDocumentArchiveSettings','addDocumentArchiveSettingsHelp.html');
656   -INSERT INTO help VALUES (78,'listDocFields','listDocumentFieldsAdmin.html');
657   -INSERT INTO help VALUES (79,'editDocFieldLookups','editDocFieldLookups.html');
658   -INSERT INTO help VALUES (80,'addMetaDataForField','addMetaDataForField.html');
659   -INSERT INTO help VALUES (81,'editMetaDataForField','editMetaDataForField.html');
660   -INSERT INTO help VALUES (82,'removeMetaDataFromField','removeMetaDataFromField.html');
661   -INSERT INTO help VALUES (83,'listDocs','listDocumentsCheckoutHelp.html');
662   -INSERT INTO help VALUES (84,'editDocCheckout','editDocCheckoutHelp.html');
663   -INSERT INTO help VALUES (85,'listDocTypes','listDocTypesHelp.html');
664   -INSERT INTO help VALUES (86,'editDocTypeFields','editDocFieldHelp.html');
665   -INSERT INTO help VALUES (87,'addDocTypeFieldsLink','addDocTypeFieldHelp.html');
666   -INSERT INTO help VALUES (88,'listGroups','listGroupsHelp.html');
667   -INSERT INTO help VALUES (89,'editGroupUnit','editGroupUnitHelp.html');
668   -INSERT INTO help VALUES (90,'listOrg','listOrgHelp.html');
669   -INSERT INTO help VALUES (91,'listRole','listRolesHelp.html');
670   -INSERT INTO help VALUES (92,'listUnits','listUnitHelp.html');
671   -INSERT INTO help VALUES (93,'editUnitOrg','editUnitOrgHelp.html');
672   -INSERT INTO help VALUES (94,'removeUnitFromOrg','removeUnitFromOrgHelp.html');
673   -INSERT INTO help VALUES (95,'addUnitToOrg','addUnitToOrgHelp.html');
674   -INSERT INTO help VALUES (96,'listUsers','listUsersHelp.html');
675   -INSERT INTO help VALUES (97,'editUserGroups','editUserGroupsHelp.html');
676   -INSERT INTO help VALUES (98,'listWebsites','listWebsitesHelp.html');
677   -
678   --- setup default information
679   --- organisation
680   -INSERT INTO organisations_lookup (name) VALUES ("Default Organisation");
681   -
682   --- units
683   -INSERT INTO units_lookup (name) VALUES ("Default Unit");
684   -
685   -INSERT INTO units_organisations_link (unit_id, organisation_id) VALUES (1, 1);
686   -
687   --- setup groups
688   -INSERT INTO groups_lookup (name, is_sys_admin, is_unit_admin) VALUES ("System Administrators", 1, 0); -- id=1
689   -INSERT INTO groups_lookup (name, is_sys_admin, is_unit_admin) VALUES ("Unit Administrators", 0, 1); -- id=2
690   -INSERT INTO groups_lookup (name, is_sys_admin, is_unit_admin) VALUES ("Anonymous", 0, 0); -- id=3
691   -
692   --- unit administrators
693   -INSERT INTO groups_units_link (group_id, unit_id) VALUES (2, 1);
694   -
695   --- system administrator
696   --- passwords are md5'ed
697   -INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id)
698   - VALUES ("admin", "Administrator", "21232f297a57a5a743894a0e4a801fc3", "0", "0", "", "", 1, 1, "", 1, 1);
699   -INSERT INTO users_groups_link (group_id, user_id) VALUES (1, 1);
700   -
701   --- unit administrator
702   -INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id)
703   - VALUES ("unitAdmin", "Unit Administrator", "21232f297a57a5a743894a0e4a801fc3", "0", "0", "", "", 1, 1, "", 1, 1);
704   -INSERT INTO users_groups_link (group_id, user_id) VALUES (2, 2);
705   -
706   --- guest user
707   -INSERT INTO users (username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, ldap_dn, max_sessions, language_id)
708   - VALUES ("guest", "Anonymous", "084e0343a0486ff05530df6c705c8bb4", "0", "0", "", "", 0, 0, "", 19, 1);
709   -INSERT INTO users_groups_link (group_id, user_id) VALUES (3, 3);
710   -
711   --- define folder structure
712   -INSERT INTO folders (name, description, parent_id, creator_id, unit_id, is_public)
713   - VALUES ("Root Folder", "Root Document Folder", 0, 1, 0, 0);
714   -INSERT INTO folders (name, description, parent_id, creator_id, unit_id, is_public, parent_folder_ids, full_path)
715   - VALUES ("Default Unit", "Default Unit Root Folder", 1, 1, 1, 0, "1", "Root Folder");
716   -
717   --- default document type
718   -INSERT INTO document_types_lookup (name) VALUES ("Default");
719   --- map folder to document type
720   -INSERT INTO folder_doctypes_link (folder_id, document_type_id) VALUES (2, 1);
  658 + id int(11) NOT NULL default '0',
  659 + username char(255) NOT NULL default '',
  660 + name char(255) NOT NULL default '',
  661 + password char(255) NOT NULL default '',
  662 + quota_max int(11) NOT NULL default '0',
  663 + quota_current int(11) NOT NULL default '0',
  664 + email char(255) default NULL,
  665 + mobile char(255) default NULL,
  666 + email_notification tinyint(1) NOT NULL default '0',
  667 + sms_notification tinyint(1) NOT NULL default '0',
  668 + ldap_dn char(255) default NULL,
  669 + max_sessions int(11) default NULL,
  670 + language_id int(11) default NULL,
  671 + UNIQUE KEY id (id),
  672 + UNIQUE KEY username (username)
  673 +) TYPE=InnoDB;
  674 +
  675 +-- --------------------------------------------------------
  676 +
  677 +--
  678 +-- Table structure for table `users_groups_link`
  679 +--
  680 +
  681 +CREATE TABLE users_groups_link (
  682 + id int(11) NOT NULL default '0',
  683 + user_id int(11) NOT NULL default '0',
  684 + group_id int(11) NOT NULL default '0',
  685 + UNIQUE KEY id (id),
  686 + KEY fk_user_id (user_id),
  687 + KEY fk_group_id (group_id)
  688 +) TYPE=InnoDB;
  689 +
  690 +-- --------------------------------------------------------
  691 +
  692 +--
  693 +-- Table structure for table `web_documents`
  694 +--
  695 +
  696 +CREATE TABLE web_documents (
  697 + id int(11) NOT NULL default '0',
  698 + document_id int(11) NOT NULL default '0',
  699 + web_site_id int(11) NOT NULL default '0',
  700 + unit_id int(11) NOT NULL default '0',
  701 + status_id int(11) NOT NULL default '0',
  702 + datetime datetime NOT NULL default '0000-00-00 00:00:00',
  703 + UNIQUE KEY id (id)
  704 +) TYPE=InnoDB;
  705 +
  706 +-- --------------------------------------------------------
  707 +
  708 +--
  709 +-- Table structure for table `web_documents_status_lookup`
  710 +--
  711 +
  712 +CREATE TABLE web_documents_status_lookup (
  713 + id int(11) NOT NULL default '0',
  714 + name char(50) NOT NULL default '',
  715 + UNIQUE KEY id (id)
  716 +) TYPE=InnoDB;
  717 +
  718 +-- --------------------------------------------------------
  719 +
  720 +--
  721 +-- Table structure for table `web_sites`
  722 +--
  723 +
  724 +CREATE TABLE web_sites (
  725 + id int(11) NOT NULL default '0',
  726 + web_site_name char(100) NOT NULL default '',
  727 + web_site_url char(50) NOT NULL default '',
  728 + web_master_id int(11) NOT NULL default '0',
  729 + UNIQUE KEY id (id)
  730 +) TYPE=InnoDB;
  731 +
  732 +-- --------------------------------------------------------
  733 +
  734 +--
  735 +-- Table structure for table `zseq_active_sessions`
  736 +--
  737 +
  738 +CREATE TABLE zseq_active_sessions (
  739 + id int(10) unsigned NOT NULL auto_increment,
  740 + PRIMARY KEY (id)
  741 +) TYPE=MyISAM;
  742 +
  743 +-- --------------------------------------------------------
  744 +
  745 +--
  746 +-- Table structure for table `zseq_archive_restoration_request`
  747 +--
  748 +
  749 +CREATE TABLE zseq_archive_restoration_request (
  750 + id int(10) unsigned NOT NULL auto_increment,
  751 + PRIMARY KEY (id)
  752 +) TYPE=MyISAM;
  753 +
  754 +-- --------------------------------------------------------
  755 +
  756 +--
  757 +-- Table structure for table `zseq_archiving_settings`
  758 +--
  759 +
  760 +CREATE TABLE zseq_archiving_settings (
  761 + id int(10) unsigned NOT NULL auto_increment,
  762 + PRIMARY KEY (id)
  763 +) TYPE=MyISAM;
  764 +
  765 +-- --------------------------------------------------------
  766 +
  767 +--
  768 +-- Table structure for table `zseq_archiving_type_lookup`
  769 +--
  770 +
  771 +CREATE TABLE zseq_archiving_type_lookup (
  772 + id int(10) unsigned NOT NULL auto_increment,
  773 + PRIMARY KEY (id)
  774 +) TYPE=MyISAM;
  775 +
  776 +-- --------------------------------------------------------
  777 +
  778 +--
  779 +-- Table structure for table `zseq_data_types`
  780 +--
  781 +
  782 +CREATE TABLE zseq_data_types (
  783 + id int(10) unsigned NOT NULL auto_increment,
  784 + PRIMARY KEY (id)
  785 +) TYPE=MyISAM;
  786 +
  787 +-- --------------------------------------------------------
  788 +
  789 +--
  790 +-- Table structure for table `zseq_dependant_document_instance`
  791 +--
  792 +
  793 +CREATE TABLE zseq_dependant_document_instance (
  794 + id int(10) unsigned NOT NULL auto_increment,
  795 + PRIMARY KEY (id)
  796 +) TYPE=MyISAM;
  797 +
  798 +-- --------------------------------------------------------
  799 +
  800 +--
  801 +-- Table structure for table `zseq_dependant_document_template`
  802 +--
  803 +
  804 +CREATE TABLE zseq_dependant_document_template (
  805 + id int(10) unsigned NOT NULL auto_increment,
  806 + PRIMARY KEY (id)
  807 +) TYPE=MyISAM;
  808 +
  809 +-- --------------------------------------------------------
  810 +
  811 +--
  812 +-- Table structure for table `zseq_discussion_comments`
  813 +--
  814 +
  815 +CREATE TABLE zseq_discussion_comments (
  816 + id int(10) unsigned NOT NULL auto_increment,
  817 + PRIMARY KEY (id)
  818 +) TYPE=MyISAM;
  819 +
  820 +-- --------------------------------------------------------
  821 +
  822 +--
  823 +-- Table structure for table `zseq_discussion_threads`
  824 +--
  825 +
  826 +CREATE TABLE zseq_discussion_threads (
  827 + id int(10) unsigned NOT NULL auto_increment,
  828 + PRIMARY KEY (id)
  829 +) TYPE=MyISAM;
  830 +
  831 +-- --------------------------------------------------------
  832 +
  833 +--
  834 +-- Table structure for table `zseq_document_archiving_link`
  835 +--
  836 +
  837 +CREATE TABLE zseq_document_archiving_link (
  838 + id int(10) unsigned NOT NULL auto_increment,
  839 + PRIMARY KEY (id)
  840 +) TYPE=MyISAM;
  841 +
  842 +-- --------------------------------------------------------
  843 +
  844 +--
  845 +-- Table structure for table `zseq_document_fields`
  846 +--
  847 +
  848 +CREATE TABLE zseq_document_fields (
  849 + id int(10) unsigned NOT NULL auto_increment,
  850 + PRIMARY KEY (id)
  851 +) TYPE=MyISAM;
  852 +
  853 +-- --------------------------------------------------------
  854 +
  855 +--
  856 +-- Table structure for table `zseq_document_fields_link`
  857 +--
  858 +
  859 +CREATE TABLE zseq_document_fields_link (
  860 + id int(10) unsigned NOT NULL auto_increment,
  861 + PRIMARY KEY (id)
  862 +) TYPE=MyISAM;
  863 +
  864 +-- --------------------------------------------------------
  865 +
  866 +--
  867 +-- Table structure for table `zseq_document_link`
  868 +--
  869 +
  870 +CREATE TABLE zseq_document_link (
  871 + id int(10) unsigned NOT NULL auto_increment,
  872 + PRIMARY KEY (id)
  873 +) TYPE=MyISAM;
  874 +
  875 +-- --------------------------------------------------------
  876 +
  877 +--
  878 +-- Table structure for table `zseq_document_subscriptions`
  879 +--
  880 +
  881 +CREATE TABLE zseq_document_subscriptions (
  882 + id int(10) unsigned NOT NULL auto_increment,
  883 + PRIMARY KEY (id)
  884 +) TYPE=MyISAM;
  885 +
  886 +-- --------------------------------------------------------
  887 +
  888 +--
  889 +-- Table structure for table `zseq_document_text`
  890 +--
  891 +
  892 +CREATE TABLE zseq_document_text (
  893 + id int(10) unsigned NOT NULL auto_increment,
  894 + PRIMARY KEY (id)
  895 +) TYPE=MyISAM;
  896 +
  897 +-- --------------------------------------------------------
  898 +
  899 +--
  900 +-- Table structure for table `zseq_document_transaction_types_lookup`
  901 +--
  902 +
  903 +CREATE TABLE zseq_document_transaction_types_lookup (
  904 + id int(10) unsigned NOT NULL auto_increment,
  905 + PRIMARY KEY (id)
  906 +) TYPE=MyISAM;
  907 +
  908 +-- --------------------------------------------------------
  909 +
  910 +--
  911 +-- Table structure for table `zseq_document_transactions`
  912 +--
  913 +
  914 +CREATE TABLE zseq_document_transactions (
  915 + id int(10) unsigned NOT NULL auto_increment,
  916 + PRIMARY KEY (id)
  917 +) TYPE=MyISAM;
  918 +
  919 +-- --------------------------------------------------------
  920 +
  921 +--
  922 +-- Table structure for table `zseq_document_type_fields_link`
  923 +--
  924 +
  925 +CREATE TABLE zseq_document_type_fields_link (
  926 + id int(10) unsigned NOT NULL auto_increment,
  927 + PRIMARY KEY (id)
  928 +) TYPE=MyISAM;
  929 +
  930 +-- --------------------------------------------------------
  931 +
  932 +--
  933 +-- Table structure for table `zseq_document_types_lookup`
  934 +--
  935 +
  936 +CREATE TABLE zseq_document_types_lookup (
  937 + id int(10) unsigned NOT NULL auto_increment,
  938 + PRIMARY KEY (id)
  939 +) TYPE=MyISAM;
  940 +
  941 +-- --------------------------------------------------------
  942 +
  943 +--
  944 +-- Table structure for table `zseq_documents`
  945 +--
  946 +
  947 +CREATE TABLE zseq_documents (
  948 + id int(10) unsigned NOT NULL auto_increment,
  949 + PRIMARY KEY (id)
  950 +) TYPE=MyISAM;
  951 +
  952 +-- --------------------------------------------------------
  953 +
  954 +--
  955 +-- Table structure for table `zseq_folder_doctypes_link`
  956 +--
  957 +
  958 +CREATE TABLE zseq_folder_doctypes_link (
  959 + id int(10) unsigned NOT NULL auto_increment,
  960 + PRIMARY KEY (id)
  961 +) TYPE=MyISAM;
  962 +
  963 +-- --------------------------------------------------------
  964 +
  965 +--
  966 +-- Table structure for table `zseq_folder_subscriptions`
  967 +--
  968 +
  969 +CREATE TABLE zseq_folder_subscriptions (
  970 + id int(10) unsigned NOT NULL auto_increment,
  971 + PRIMARY KEY (id)
  972 +) TYPE=MyISAM;
  973 +
  974 +-- --------------------------------------------------------
  975 +
  976 +--
  977 +-- Table structure for table `zseq_folders`
  978 +--
  979 +
  980 +CREATE TABLE zseq_folders (
  981 + id int(10) unsigned NOT NULL auto_increment,
  982 + PRIMARY KEY (id)
  983 +) TYPE=MyISAM;
  984 +
  985 +-- --------------------------------------------------------
  986 +
  987 +--
  988 +-- Table structure for table `zseq_folders_users_roles_link`
  989 +--
  990 +
  991 +CREATE TABLE zseq_folders_users_roles_link (
  992 + id int(10) unsigned NOT NULL auto_increment,
  993 + PRIMARY KEY (id)
  994 +) TYPE=MyISAM;
  995 +
  996 +-- --------------------------------------------------------
  997 +
  998 +--
  999 +-- Table structure for table `zseq_groups_folders_approval_link`
  1000 +--
  1001 +
  1002 +CREATE TABLE zseq_groups_folders_approval_link (
  1003 + id int(10) unsigned NOT NULL auto_increment,
  1004 + PRIMARY KEY (id)
  1005 +) TYPE=MyISAM;
  1006 +
  1007 +-- --------------------------------------------------------
  1008 +
  1009 +--
  1010 +-- Table structure for table `zseq_groups_folders_link`
  1011 +--
  1012 +
  1013 +CREATE TABLE zseq_groups_folders_link (
  1014 + id int(10) unsigned NOT NULL auto_increment,
  1015 + PRIMARY KEY (id)
  1016 +) TYPE=MyISAM;
  1017 +
  1018 +-- --------------------------------------------------------
  1019 +
  1020 +--
  1021 +-- Table structure for table `zseq_groups_lookup`
  1022 +--
  1023 +
  1024 +CREATE TABLE zseq_groups_lookup (
  1025 + id int(10) unsigned NOT NULL auto_increment,
  1026 + PRIMARY KEY (id)
  1027 +) TYPE=MyISAM;
  1028 +
  1029 +-- --------------------------------------------------------
  1030 +
  1031 +--
  1032 +-- Table structure for table `zseq_groups_units_link`
  1033 +--
  1034 +
  1035 +CREATE TABLE zseq_groups_units_link (
  1036 + id int(10) unsigned NOT NULL auto_increment,
  1037 + PRIMARY KEY (id)
  1038 +) TYPE=MyISAM;
  1039 +
  1040 +-- --------------------------------------------------------
  1041 +
  1042 +--
  1043 +-- Table structure for table `zseq_help`
  1044 +--
  1045 +
  1046 +CREATE TABLE zseq_help (
  1047 + id int(10) unsigned NOT NULL auto_increment,
  1048 + PRIMARY KEY (id)
  1049 +) TYPE=MyISAM;
  1050 +
  1051 +-- --------------------------------------------------------
  1052 +
  1053 +--
  1054 +-- Table structure for table `zseq_links`
  1055 +--
  1056 +
  1057 +CREATE TABLE zseq_links (
  1058 + id int(10) unsigned NOT NULL auto_increment,
  1059 + PRIMARY KEY (id)
  1060 +) TYPE=MyISAM;
  1061 +
  1062 +-- --------------------------------------------------------
  1063 +
  1064 +--
  1065 +-- Table structure for table `zseq_metadata_lookup`
  1066 +--
  1067 +
  1068 +CREATE TABLE zseq_metadata_lookup (
  1069 + id int(10) unsigned NOT NULL auto_increment,
  1070 + PRIMARY KEY (id)
  1071 +) TYPE=MyISAM;
  1072 +
  1073 +-- --------------------------------------------------------
  1074 +
  1075 +--
  1076 +-- Table structure for table `zseq_mime_types`
  1077 +--
  1078 +
  1079 +CREATE TABLE zseq_mime_types (
  1080 + id int(10) unsigned NOT NULL auto_increment,
  1081 + PRIMARY KEY (id)
  1082 +) TYPE=MyISAM;
  1083 +
  1084 +-- --------------------------------------------------------
  1085 +
  1086 +--
  1087 +-- Table structure for table `zseq_news`
  1088 +--
  1089 +
  1090 +CREATE TABLE zseq_news (
  1091 + id int(10) unsigned NOT NULL auto_increment,
  1092 + PRIMARY KEY (id)
  1093 +) TYPE=MyISAM;
  1094 +
  1095 +-- --------------------------------------------------------
  1096 +
  1097 +--
  1098 +-- Table structure for table `zseq_organisations_lookup`
  1099 +--
  1100 +
  1101 +CREATE TABLE zseq_organisations_lookup (
  1102 + id int(10) unsigned NOT NULL auto_increment,
  1103 + PRIMARY KEY (id)
  1104 +) TYPE=MyISAM;
  1105 +
  1106 +-- --------------------------------------------------------
  1107 +
  1108 +--
  1109 +-- Table structure for table `zseq_roles`
  1110 +--
  1111 +
  1112 +CREATE TABLE zseq_roles (
  1113 + id int(10) unsigned NOT NULL auto_increment,
  1114 + PRIMARY KEY (id)
  1115 +) TYPE=MyISAM;
  1116 +
  1117 +-- --------------------------------------------------------
  1118 +
  1119 +--
  1120 +-- Table structure for table `zseq_search_document_user_link`
  1121 +--
  1122 +
  1123 +CREATE TABLE zseq_search_document_user_link (
  1124 + id int(10) unsigned NOT NULL auto_increment,
  1125 + PRIMARY KEY (id)
  1126 +) TYPE=MyISAM;
  1127 +
  1128 +-- --------------------------------------------------------
  1129 +
  1130 +--
  1131 +-- Table structure for table `zseq_status_lookup`
  1132 +--
  1133 +
  1134 +CREATE TABLE zseq_status_lookup (
  1135 + id int(10) unsigned NOT NULL auto_increment,
  1136 + PRIMARY KEY (id)
  1137 +) TYPE=MyISAM;
  1138 +
  1139 +-- --------------------------------------------------------
  1140 +
  1141 +--
  1142 +-- Table structure for table `zseq_system_settings`
  1143 +--
  1144 +
  1145 +CREATE TABLE zseq_system_settings (
  1146 + id int(10) unsigned NOT NULL auto_increment,
  1147 + PRIMARY KEY (id)
  1148 +) TYPE=MyISAM;
  1149 +
  1150 +-- --------------------------------------------------------
  1151 +
  1152 +--
  1153 +-- Table structure for table `zseq_time_period`
  1154 +--
  1155 +
  1156 +CREATE TABLE zseq_time_period (
  1157 + id int(10) unsigned NOT NULL auto_increment,
  1158 + PRIMARY KEY (id)
  1159 +) TYPE=MyISAM;
  1160 +
  1161 +-- --------------------------------------------------------
  1162 +
  1163 +--
  1164 +-- Table structure for table `zseq_time_unit_lookup`
  1165 +--
  1166 +
  1167 +CREATE TABLE zseq_time_unit_lookup (
  1168 + id int(10) unsigned NOT NULL auto_increment,
  1169 + PRIMARY KEY (id)
  1170 +) TYPE=MyISAM;
  1171 +
  1172 +-- --------------------------------------------------------
  1173 +
  1174 +--
  1175 +-- Table structure for table `zseq_units_lookup`
  1176 +--
  1177 +
  1178 +CREATE TABLE zseq_units_lookup (
  1179 + id int(10) unsigned NOT NULL auto_increment,
  1180 + PRIMARY KEY (id)
  1181 +) TYPE=MyISAM;
  1182 +
  1183 +-- --------------------------------------------------------
  1184 +
  1185 +--
  1186 +-- Table structure for table `zseq_units_organisations_link`
  1187 +--
  1188 +
  1189 +CREATE TABLE zseq_units_organisations_link (
  1190 + id int(10) unsigned NOT NULL auto_increment,
  1191 + PRIMARY KEY (id)
  1192 +) TYPE=MyISAM;
  1193 +
  1194 +-- --------------------------------------------------------
  1195 +
  1196 +--
  1197 +-- Table structure for table `zseq_users`
  1198 +--
  1199 +
  1200 +CREATE TABLE zseq_users (
  1201 + id int(10) unsigned NOT NULL auto_increment,
  1202 + PRIMARY KEY (id)
  1203 +) TYPE=MyISAM;
  1204 +
  1205 +-- --------------------------------------------------------
  1206 +
  1207 +--
  1208 +-- Table structure for table `zseq_users_groups_link`
  1209 +--
  1210 +
  1211 +CREATE TABLE zseq_users_groups_link (
  1212 + id int(10) unsigned NOT NULL auto_increment,
  1213 + PRIMARY KEY (id)
  1214 +) TYPE=MyISAM;
  1215 +
  1216 +-- --------------------------------------------------------
  1217 +
  1218 +--
  1219 +-- Table structure for table `zseq_web_documents`
  1220 +--
  1221 +
  1222 +CREATE TABLE zseq_web_documents (
  1223 + id int(10) unsigned NOT NULL auto_increment,
  1224 + PRIMARY KEY (id)
  1225 +) TYPE=MyISAM;
  1226 +
  1227 +-- --------------------------------------------------------
  1228 +
  1229 +--
  1230 +-- Table structure for table `zseq_web_documents_status_lookup`
  1231 +--
  1232 +
  1233 +CREATE TABLE zseq_web_documents_status_lookup (
  1234 + id int(10) unsigned NOT NULL auto_increment,
  1235 + PRIMARY KEY (id)
  1236 +) TYPE=MyISAM;
  1237 +
  1238 +-- --------------------------------------------------------
  1239 +
  1240 +--
  1241 +-- Table structure for table `zseq_web_sites`
  1242 +--
  1243 +
  1244 +CREATE TABLE zseq_web_sites (
  1245 + id int(10) unsigned NOT NULL auto_increment,
  1246 + PRIMARY KEY (id)
  1247 +) TYPE=MyISAM;
  1248 +
  1249 +--
  1250 +-- Dumping data for table `active_sessions`
  1251 +--
  1252 +
  1253 +
  1254 +--
  1255 +-- Dumping data for table `archive_restoration_request`
  1256 +--
  1257 +
  1258 +
  1259 +--
  1260 +-- Dumping data for table `archiving_settings`
  1261 +--
  1262 +
  1263 +
  1264 +--
  1265 +-- Dumping data for table `archiving_type_lookup`
  1266 +--
  1267 +
  1268 +INSERT INTO archiving_type_lookup VALUES (1, 'Date');
  1269 +INSERT INTO archiving_type_lookup VALUES (2, 'Utilisation');
  1270 +
  1271 +--
  1272 +-- Dumping data for table `data_types`
  1273 +--
  1274 +
  1275 +INSERT INTO data_types VALUES (1, 'STRING');
  1276 +INSERT INTO data_types VALUES (2, 'CHAR');
  1277 +INSERT INTO data_types VALUES (3, 'TEXT');
  1278 +INSERT INTO data_types VALUES (4, 'INT');
  1279 +INSERT INTO data_types VALUES (5, 'FLOAT');
  1280 +
  1281 +--
  1282 +-- Dumping data for table `dependant_document_instance`
  1283 +--
  1284 +
  1285 +
  1286 +--
  1287 +-- Dumping data for table `dependant_document_template`
  1288 +--
  1289 +
  1290 +
  1291 +--
  1292 +-- Dumping data for table `discussion_comments`
  1293 +--
  1294 +
  1295 +
  1296 +--
  1297 +-- Dumping data for table `discussion_threads`
  1298 +--
  1299 +
  1300 +
  1301 +--
  1302 +-- Dumping data for table `document_archiving_link`
  1303 +--
  1304 +
  1305 +
  1306 +--
  1307 +-- Dumping data for table `document_fields`
  1308 +--
  1309 +
  1310 +INSERT INTO document_fields VALUES (1, 'Category', 'STRING', 1, NULL);
  1311 +
  1312 +--
  1313 +-- Dumping data for table `document_fields_link`
  1314 +--
  1315 +
  1316 +
  1317 +--
  1318 +-- Dumping data for table `document_link`
  1319 +--
  1320 +
  1321 +
  1322 +--
  1323 +-- Dumping data for table `document_subscriptions`
  1324 +--
  1325 +
  1326 +
  1327 +--
  1328 +-- Dumping data for table `document_text`
  1329 +--
  1330 +
  1331 +
  1332 +--
  1333 +-- Dumping data for table `document_transaction_types_lookup`
  1334 +--
  1335 +
  1336 +INSERT INTO document_transaction_types_lookup VALUES (1, 'Create');
  1337 +INSERT INTO document_transaction_types_lookup VALUES (2, 'Update');
  1338 +INSERT INTO document_transaction_types_lookup VALUES (3, 'Delete');
  1339 +INSERT INTO document_transaction_types_lookup VALUES (4, 'Rename');
  1340 +INSERT INTO document_transaction_types_lookup VALUES (5, 'Move');
  1341 +INSERT INTO document_transaction_types_lookup VALUES (6, 'Download');
  1342 +INSERT INTO document_transaction_types_lookup VALUES (7, 'Check In');
  1343 +INSERT INTO document_transaction_types_lookup VALUES (8, 'Check Out');
  1344 +INSERT INTO document_transaction_types_lookup VALUES (9, 'Collaboration Step Rollback');
  1345 +INSERT INTO document_transaction_types_lookup VALUES (10, 'View');
  1346 +INSERT INTO document_transaction_types_lookup VALUES (11, 'Expunge');
  1347 +INSERT INTO document_transaction_types_lookup VALUES (12, 'Force CheckIn');
  1348 +INSERT INTO document_transaction_types_lookup VALUES (13, 'Email Link');
  1349 +INSERT INTO document_transaction_types_lookup VALUES (14, 'Collaboration Step Approve');
  1350 +
  1351 +--
  1352 +-- Dumping data for table `document_transactions`
  1353 +--
  1354 +
  1355 +
  1356 +--
  1357 +-- Dumping data for table `document_type_fields_link`
  1358 +--
  1359 +
  1360 +
  1361 +--
  1362 +-- Dumping data for table `document_types_lookup`
  1363 +--
  1364 +
  1365 +INSERT INTO document_types_lookup VALUES (1, 'Default');
  1366 +
  1367 +--
  1368 +-- Dumping data for table `documents`
  1369 +--
  1370 +
  1371 +
  1372 +--
  1373 +-- Dumping data for table `folder_doctypes_link`
  1374 +--
  1375 +
  1376 +INSERT INTO folder_doctypes_link VALUES (1, 2, 1);
  1377 +
  1378 +--
  1379 +-- Dumping data for table `folder_subscriptions`
  1380 +--
  1381 +
  1382 +
  1383 +--
  1384 +-- Dumping data for table `folders`
  1385 +--
  1386 +
  1387 +INSERT INTO folders VALUES (1, 'Root Folder', 'Root Document Folder', 0, 1, 0, 0, NULL, NULL, NULL);
  1388 +INSERT INTO folders VALUES (2, 'Default Unit', 'Default Unit Root Folder', 1, 1, 1, 0, '1', 'Root Folder', NULL);
  1389 +
  1390 +--
  1391 +-- Dumping data for table `folders_users_roles_link`
  1392 +--
  1393 +
  1394 +
  1395 +--
  1396 +-- Dumping data for table `groups_folders_approval_link`
  1397 +--
  1398 +
  1399 +
  1400 +--
  1401 +-- Dumping data for table `groups_folders_link`
  1402 +--
  1403 +
  1404 +
  1405 +--
  1406 +-- Dumping data for table `groups_lookup`
  1407 +--
  1408 +
  1409 +INSERT INTO groups_lookup VALUES (1, 'System Administrators', 1, 0);
  1410 +INSERT INTO groups_lookup VALUES (2, 'Unit Administrators', 0, 1);
  1411 +INSERT INTO groups_lookup VALUES (3, 'Anonymous', 0, 0);
  1412 +
  1413 +--
  1414 +-- Dumping data for table `groups_units_link`
  1415 +--
  1416 +
  1417 +INSERT INTO groups_units_link VALUES (1, 2, 1);
  1418 +
  1419 +--
  1420 +-- Dumping data for table `help`
  1421 +--
  1422 +
  1423 +INSERT INTO help VALUES (1, 'browse', 'dochelp.html');
  1424 +INSERT INTO help VALUES (2, 'dashboard', 'dashboardHelp.html');
  1425 +INSERT INTO help VALUES (3, 'addFolder', 'addFolderHelp.html');
  1426 +INSERT INTO help VALUES (4, 'editFolder', 'editFolderHelp.html');
  1427 +INSERT INTO help VALUES (5, 'addFolderCollaboration', 'addFolderCollaborationHelp.html');
  1428 +INSERT INTO help VALUES (6, 'modifyFolderCollaboration', 'addFolderCollaborationHelp.html');
  1429 +INSERT INTO help VALUES (7, 'addDocument', 'addDocumentHelp.html');
  1430 +INSERT INTO help VALUES (8, 'viewDocument', 'viewDocumentHelp.html');
  1431 +INSERT INTO help VALUES (9, 'modifyDocument', 'modifyDocumentHelp.html');
  1432 +INSERT INTO help VALUES (10, 'modifyDocumentRouting', 'modifyDocumentRoutingHelp.html');
  1433 +INSERT INTO help VALUES (11, 'emailDocument', 'emailDocumentHelp.html');
  1434 +INSERT INTO help VALUES (12, 'deleteDocument', 'deleteDocumentHelp.html');
  1435 +INSERT INTO help VALUES (13, 'administration', 'administrationHelp.html');
  1436 +INSERT INTO help VALUES (14, 'addGroup', 'addGroupHelp.html');
  1437 +INSERT INTO help VALUES (15, 'editGroup', 'editGroupHelp.html');
  1438 +INSERT INTO help VALUES (16, 'removeGroup', 'removeGroupHelp.html');
  1439 +INSERT INTO help VALUES (17, 'assignGroupToUnit', 'assignGroupToUnitHelp.html');
  1440 +INSERT INTO help VALUES (18, 'removeGroupFromUnit', 'removeGroupFromUnitHelp.html');
  1441 +INSERT INTO help VALUES (19, 'addUnit', 'addUnitHelp.html');
  1442 +INSERT INTO help VALUES (20, 'editUnit', 'editUnitHelp.html');
  1443 +INSERT INTO help VALUES (21, 'removeUnit', 'removeUnitHelp.html');
  1444 +INSERT INTO help VALUES (22, 'addOrg', 'addOrgHelp.html');
  1445 +INSERT INTO help VALUES (23, 'editOrg', 'editOrgHelp.html');
  1446 +INSERT INTO help VALUES (24, 'removeOrg', 'removeOrgHelp.html');
  1447 +INSERT INTO help VALUES (25, 'addRole', 'addRoleHelp.html');
  1448 +INSERT INTO help VALUES (26, 'editRole', 'editRoleHelp.html');
  1449 +INSERT INTO help VALUES (27, 'removeRole', 'removeRoleHelp.html');
  1450 +INSERT INTO help VALUES (28, 'addLink', 'addLinkHelp.html');
  1451 +INSERT INTO help VALUES (29, 'addLinkSuccess', 'addLinkHelp.html');
  1452 +INSERT INTO help VALUES (30, 'editLink', 'editLinkHelp.html');
  1453 +INSERT INTO help VALUES (31, 'removeLink', 'removeLinkHelp.html');
  1454 +INSERT INTO help VALUES (32, 'systemAdministration', 'systemAdministrationHelp.html');
  1455 +INSERT INTO help VALUES (33, 'deleteFolder', 'deleteFolderHelp.html');
  1456 +INSERT INTO help VALUES (34, 'editDocType', 'editDocTypeHelp.html');
  1457 +INSERT INTO help VALUES (35, 'removeDocType', 'removeDocTypeHelp.html');
  1458 +INSERT INTO help VALUES (36, 'addDocType', 'addDocTypeHelp.html');
  1459 +INSERT INTO help VALUES (37, 'addDocTypeSuccess', 'addDocTypeHelp.html');
  1460 +INSERT INTO help VALUES (38, 'manageSubscriptions', 'manageSubscriptionsHelp.html');
  1461 +INSERT INTO help VALUES (39, 'addSubscription', 'addSubscriptionHelp.html');
  1462 +INSERT INTO help VALUES (40, 'removeSubscription', 'removeSubscriptionHelp.html');
  1463 +INSERT INTO help VALUES (41, 'preferences', 'preferencesHelp.html');
  1464 +INSERT INTO help VALUES (42, 'editPrefsSuccess', 'preferencesHelp.html');
  1465 +INSERT INTO help VALUES (43, 'modifyDocumentGenericMetaData', 'modifyDocumentGenericMetaDataHelp.html');
  1466 +INSERT INTO help VALUES (44, 'viewHistory', 'viewHistoryHelp.html');
  1467 +INSERT INTO help VALUES (45, 'checkInDocument', 'checkInDocumentHelp.html');
  1468 +INSERT INTO help VALUES (46, 'checkOutDocument', 'checkOutDocumentHelp.html');
  1469 +INSERT INTO help VALUES (47, 'advancedSearch', 'advancedSearchHelp.html');
  1470 +INSERT INTO help VALUES (48, 'deleteFolderCollaboration', 'deleteFolderCollaborationHelp.html');
  1471 +INSERT INTO help VALUES (49, 'addFolderDocType', 'addFolderDocTypeHelp.html');
  1472 +INSERT INTO help VALUES (50, 'deleteFolderDocType', 'deleteFolderDocTypeHelp.html');
  1473 +INSERT INTO help VALUES (51, 'addGroupFolderLink', 'addGroupFolderLinkHelp.html');
  1474 +INSERT INTO help VALUES (52, 'deleteGroupFolderLink', 'deleteGroupFolderLinkHelp.html');
  1475 +INSERT INTO help VALUES (53, 'addWebsite', 'addWebsiteHelp.html');
  1476 +INSERT INTO help VALUES (54, 'addWebsiteSuccess', 'addWebsiteHelp.html');
  1477 +INSERT INTO help VALUES (55, 'editWebsite', 'editWebsiteHelp.html');
  1478 +INSERT INTO help VALUES (56, 'removeWebSite', 'removeWebSiteHelp.html');
  1479 +INSERT INTO help VALUES (57, 'standardSearch', 'standardSearchHelp.html');
  1480 +INSERT INTO help VALUES (58, 'modifyDocumentTypeMetaData', 'modifyDocumentTypeMetaDataHelp.html');
  1481 +INSERT INTO help VALUES (59, 'addDocField', 'addDocFieldHelp.html');
  1482 +INSERT INTO help VALUES (60, 'editDocField', 'editDocFieldHelp.html');
  1483 +INSERT INTO help VALUES (61, 'removeDocField', 'removeDocFieldHelp.html');
  1484 +INSERT INTO help VALUES (62, 'addMetaData', 'addMetaDataHelp.html');
  1485 +INSERT INTO help VALUES (63, 'editMetaData', 'editMetaDataHelp.html');
  1486 +INSERT INTO help VALUES (64, 'removeMetaData', 'removeMetaDataHelp.html');
  1487 +INSERT INTO help VALUES (65, 'addUser', 'addUserHelp.html');
  1488 +INSERT INTO help VALUES (66, 'editUser', 'editUserHelp.html');
  1489 +INSERT INTO help VALUES (67, 'removeUser', 'removeUserHelp.html');
  1490 +INSERT INTO help VALUES (68, 'addUserToGroup', 'addUserToGroupHelp.html');
  1491 +INSERT INTO help VALUES (69, 'removeUserFromGroup', 'removeUserFromGroupHelp.html');
  1492 +INSERT INTO help VALUES (70, 'viewDiscussion', 'viewDiscussionThread.html');
  1493 +INSERT INTO help VALUES (71, 'addComment', 'addDiscussionComment.html');
  1494 +INSERT INTO help VALUES (72, 'listNews', 'listDashboardNewsHelp.html');
  1495 +INSERT INTO help VALUES (73, 'editNews', 'editDashboardNewsHelp.html');
  1496 +INSERT INTO help VALUES (74, 'previewNews', 'previewDashboardNewsHelp.html');
  1497 +INSERT INTO help VALUES (75, 'addNews', 'addDashboardNewsHelp.html');
  1498 +INSERT INTO help VALUES (76, 'modifyDocumentArchiveSettings', 'modifyDocumentArchiveSettingsHelp.html');
  1499 +INSERT INTO help VALUES (77, 'addDocumentArchiveSettings', 'addDocumentArchiveSettingsHelp.html');
  1500 +INSERT INTO help VALUES (78, 'listDocFields', 'listDocumentFieldsAdmin.html');
  1501 +INSERT INTO help VALUES (79, 'editDocFieldLookups', 'editDocFieldLookups.html');
  1502 +INSERT INTO help VALUES (80, 'addMetaDataForField', 'addMetaDataForField.html');
  1503 +INSERT INTO help VALUES (81, 'editMetaDataForField', 'editMetaDataForField.html');
  1504 +INSERT INTO help VALUES (82, 'removeMetaDataFromField', 'removeMetaDataFromField.html');
  1505 +INSERT INTO help VALUES (83, 'listDocs', 'listDocumentsCheckoutHelp.html');
  1506 +INSERT INTO help VALUES (84, 'editDocCheckout', 'editDocCheckoutHelp.html');
  1507 +INSERT INTO help VALUES (85, 'listDocTypes', 'listDocTypesHelp.html');
  1508 +INSERT INTO help VALUES (86, 'editDocTypeFields', 'editDocFieldHelp.html');
  1509 +INSERT INTO help VALUES (87, 'addDocTypeFieldsLink', 'addDocTypeFieldHelp.html');
  1510 +INSERT INTO help VALUES (88, 'listGroups', 'listGroupsHelp.html');
  1511 +INSERT INTO help VALUES (89, 'editGroupUnit', 'editGroupUnitHelp.html');
  1512 +INSERT INTO help VALUES (90, 'listOrg', 'listOrgHelp.html');
  1513 +INSERT INTO help VALUES (91, 'listRole', 'listRolesHelp.html');
  1514 +INSERT INTO help VALUES (92, 'listUnits', 'listUnitHelp.html');
  1515 +INSERT INTO help VALUES (93, 'editUnitOrg', 'editUnitOrgHelp.html');
  1516 +INSERT INTO help VALUES (94, 'removeUnitFromOrg', 'removeUnitFromOrgHelp.html');
  1517 +INSERT INTO help VALUES (95, 'addUnitToOrg', 'addUnitToOrgHelp.html');
  1518 +INSERT INTO help VALUES (96, 'listUsers', 'listUsersHelp.html');
  1519 +INSERT INTO help VALUES (97, 'editUserGroups', 'editUserGroupsHelp.html');
  1520 +INSERT INTO help VALUES (98, 'listWebsites', 'listWebsitesHelp.html');
  1521 +
  1522 +--
  1523 +-- Dumping data for table `links`
  1524 +--
  1525 +
  1526 +
  1527 +--
  1528 +-- Dumping data for table `metadata_lookup`
  1529 +--
  1530 +
  1531 +
  1532 +--
  1533 +-- Dumping data for table `mime_types`
  1534 +--
  1535 +
  1536 +INSERT INTO mime_types VALUES (1, 'ai', 'application/postscript', NULL);
  1537 +INSERT INTO mime_types VALUES (2, 'aif', 'audio/x-aiff', NULL);
  1538 +INSERT INTO mime_types VALUES (3, 'aifc', 'audio/x-aiff', NULL);
  1539 +INSERT INTO mime_types VALUES (4, 'aiff', 'audio/x-aiff', NULL);
  1540 +INSERT INTO mime_types VALUES (5, 'asc', 'text/plain', 'icons/txt.gif');
  1541 +INSERT INTO mime_types VALUES (6, 'au', 'audio/basic', NULL);
  1542 +INSERT INTO mime_types VALUES (7, 'avi', 'video/x-msvideo', NULL);
  1543 +INSERT INTO mime_types VALUES (8, 'bcpio', 'application/x-bcpio', NULL);
  1544 +INSERT INTO mime_types VALUES (9, 'bin', 'application/octet-stream', NULL);
  1545 +INSERT INTO mime_types VALUES (10, 'bmp', 'image/bmp', 'icons/bmp.gif');
  1546 +INSERT INTO mime_types VALUES (11, 'cdf', 'application/x-netcdf', NULL);
  1547 +INSERT INTO mime_types VALUES (12, 'class', 'application/octet-stream', NULL);
  1548 +INSERT INTO mime_types VALUES (13, 'cpio', 'application/x-cpio', NULL);
  1549 +INSERT INTO mime_types VALUES (14, 'cpt', 'application/mac-compactpro', NULL);
  1550 +INSERT INTO mime_types VALUES (15, 'csh', 'application/x-csh', NULL);
  1551 +INSERT INTO mime_types VALUES (16, 'css', 'text/css', NULL);
  1552 +INSERT INTO mime_types VALUES (17, 'dcr', 'application/x-director', NULL);
  1553 +INSERT INTO mime_types VALUES (18, 'dir', 'application/x-director', NULL);
  1554 +INSERT INTO mime_types VALUES (19, 'dms', 'application/octet-stream', NULL);
  1555 +INSERT INTO mime_types VALUES (20, 'doc', 'application/msword', 'icons/word.gif');
  1556 +INSERT INTO mime_types VALUES (21, 'dvi', 'application/x-dvi', NULL);
  1557 +INSERT INTO mime_types VALUES (22, 'dxr', 'application/x-director', NULL);
  1558 +INSERT INTO mime_types VALUES (23, 'eps', 'application/postscript', NULL);
  1559 +INSERT INTO mime_types VALUES (24, 'etx', 'text/x-setext', NULL);
  1560 +INSERT INTO mime_types VALUES (25, 'exe', 'application/octet-stream', NULL);
  1561 +INSERT INTO mime_types VALUES (26, 'ez', 'application/andrew-inset', NULL);
  1562 +INSERT INTO mime_types VALUES (27, 'gif', 'image/gif', 'icons/gif.gif');
  1563 +INSERT INTO mime_types VALUES (28, 'gtar', 'application/x-gtar', NULL);
  1564 +INSERT INTO mime_types VALUES (29, 'hdf', 'application/x-hdf', NULL);
  1565 +INSERT INTO mime_types VALUES (30, 'hqx', 'application/mac-binhex40', NULL);
  1566 +INSERT INTO mime_types VALUES (31, 'htm', 'text/html', 'icons/html.gif');
  1567 +INSERT INTO mime_types VALUES (32, 'html', 'text/html', 'icons/html.gif');
  1568 +INSERT INTO mime_types VALUES (33, 'ice', 'x-conference/x-cooltalk', NULL);
  1569 +INSERT INTO mime_types VALUES (34, 'ief', 'image/ief', NULL);
  1570 +INSERT INTO mime_types VALUES (35, 'iges', 'model/iges', NULL);
  1571 +INSERT INTO mime_types VALUES (36, 'igs', 'model/iges', NULL);
  1572 +INSERT INTO mime_types VALUES (37, 'jpe', 'image/jpeg', 'icons/jpg.gif');
  1573 +INSERT INTO mime_types VALUES (38, 'jpeg', 'image/jpeg', 'icons/jpg.gif');
  1574 +INSERT INTO mime_types VALUES (39, 'jpg', 'image/jpeg', 'icons/jpg.gif');
  1575 +INSERT INTO mime_types VALUES (40, 'js', 'application/x-javascript', NULL);
  1576 +INSERT INTO mime_types VALUES (41, 'kar', 'audio/midi', NULL);
  1577 +INSERT INTO mime_types VALUES (42, 'latex', 'application/x-latex', NULL);
  1578 +INSERT INTO mime_types VALUES (43, 'lha', 'application/octet-stream', NULL);
  1579 +INSERT INTO mime_types VALUES (44, 'lzh', 'application/octet-stream', NULL);
  1580 +INSERT INTO mime_types VALUES (45, 'man', 'application/x-troff-man', NULL);
  1581 +INSERT INTO mime_types VALUES (46, 'mdb', 'application/access', 'icons/access.gif');
  1582 +INSERT INTO mime_types VALUES (47, 'mdf', 'application/access', 'icons/access.gif');
  1583 +INSERT INTO mime_types VALUES (48, 'me', 'application/x-troff-me', NULL);
  1584 +INSERT INTO mime_types VALUES (49, 'mesh', 'model/mesh', NULL);
  1585 +INSERT INTO mime_types VALUES (50, 'mid', 'audio/midi', NULL);
  1586 +INSERT INTO mime_types VALUES (51, 'midi', 'audio/midi', NULL);
  1587 +INSERT INTO mime_types VALUES (52, 'mif', 'application/vnd.mif', NULL);
  1588 +INSERT INTO mime_types VALUES (53, 'mov', 'video/quicktime', NULL);
  1589 +INSERT INTO mime_types VALUES (54, 'movie', 'video/x-sgi-movie', NULL);
  1590 +INSERT INTO mime_types VALUES (55, 'mp2', 'audio/mpeg', NULL);
  1591 +INSERT INTO mime_types VALUES (56, 'mp3', 'audio/mpeg', NULL);
  1592 +INSERT INTO mime_types VALUES (57, 'mpe', 'video/mpeg', NULL);
  1593 +INSERT INTO mime_types VALUES (58, 'mpeg', 'video/mpeg', NULL);
  1594 +INSERT INTO mime_types VALUES (59, 'mpg', 'video/mpeg', NULL);
  1595 +INSERT INTO mime_types VALUES (60, 'mpga', 'audio/mpeg', NULL);
  1596 +INSERT INTO mime_types VALUES (61, 'mpp', 'application/vnd.ms-project', 'icons/project.gif');
  1597 +INSERT INTO mime_types VALUES (62, 'ms', 'application/x-troff-ms', NULL);
  1598 +INSERT INTO mime_types VALUES (63, 'msh', 'model/mesh', NULL);
  1599 +INSERT INTO mime_types VALUES (64, 'nc', 'application/x-netcdf', NULL);
  1600 +INSERT INTO mime_types VALUES (65, 'oda', 'application/oda', NULL);
  1601 +INSERT INTO mime_types VALUES (66, 'pbm', 'image/x-portable-bitmap', NULL);
  1602 +INSERT INTO mime_types VALUES (67, 'pdb', 'chemical/x-pdb', NULL);
  1603 +INSERT INTO mime_types VALUES (68, 'pdf', 'application/pdf', 'icons/pdf.gif');
  1604 +INSERT INTO mime_types VALUES (69, 'pgm', 'image/x-portable-graymap', NULL);
  1605 +INSERT INTO mime_types VALUES (70, 'pgn', 'application/x-chess-pgn', NULL);
  1606 +INSERT INTO mime_types VALUES (71, 'png', 'image/png', NULL);
  1607 +INSERT INTO mime_types VALUES (72, 'pnm', 'image/x-portable-anymap', NULL);
  1608 +INSERT INTO mime_types VALUES (73, 'ppm', 'image/x-portable-pixmap', NULL);
  1609 +INSERT INTO mime_types VALUES (74, 'ppt', 'application/vnd.ms-powerpoint', 'icons/powerp.gif');
  1610 +INSERT INTO mime_types VALUES (75, 'ps', 'application/postscript', NULL);
  1611 +INSERT INTO mime_types VALUES (76, 'qt', 'video/quicktime', NULL);
  1612 +INSERT INTO mime_types VALUES (77, 'ra', 'audio/x-realaudio', NULL);
  1613 +INSERT INTO mime_types VALUES (78, 'ram', 'audio/x-pn-realaudio', NULL);
  1614 +INSERT INTO mime_types VALUES (79, 'ras', 'image/x-cmu-raster', NULL);
  1615 +INSERT INTO mime_types VALUES (80, 'rgb', 'image/x-rgb', NULL);
  1616 +INSERT INTO mime_types VALUES (81, 'rm', 'audio/x-pn-realaudio', NULL);
  1617 +INSERT INTO mime_types VALUES (82, 'roff', 'application/x-troff', NULL);
  1618 +INSERT INTO mime_types VALUES (83, 'rpm', 'audio/x-pn-realaudio-plugin', NULL);
  1619 +INSERT INTO mime_types VALUES (84, 'rtf', 'text/rtf', NULL);
  1620 +INSERT INTO mime_types VALUES (85, 'rtx', 'text/richtext', NULL);
  1621 +INSERT INTO mime_types VALUES (86, 'sgm', 'text/sgml', NULL);
  1622 +INSERT INTO mime_types VALUES (87, 'sgml', 'text/sgml', NULL);
  1623 +INSERT INTO mime_types VALUES (88, 'sh', 'application/x-sh', NULL);
  1624 +INSERT INTO mime_types VALUES (89, 'shar', 'application/x-shar', NULL);
  1625 +INSERT INTO mime_types VALUES (90, 'silo', 'model/mesh', NULL);
  1626 +INSERT INTO mime_types VALUES (91, 'sit', 'application/x-stuffit', NULL);
  1627 +INSERT INTO mime_types VALUES (92, 'skd', 'application/x-koan', NULL);
  1628 +INSERT INTO mime_types VALUES (93, 'skm', 'application/x-koan', NULL);
  1629 +INSERT INTO mime_types VALUES (94, 'skp', 'application/x-koan', NULL);
  1630 +INSERT INTO mime_types VALUES (95, 'skt', 'application/x-koan', NULL);
  1631 +INSERT INTO mime_types VALUES (96, 'smi', 'application/smil', NULL);
  1632 +INSERT INTO mime_types VALUES (97, 'smil', 'application/smil', NULL);
  1633 +INSERT INTO mime_types VALUES (98, 'snd', 'audio/basic', NULL);
  1634 +INSERT INTO mime_types VALUES (99, 'spl', 'application/x-futuresplash', NULL);
  1635 +INSERT INTO mime_types VALUES (100, 'src', 'application/x-wais-source', NULL);
  1636 +INSERT INTO mime_types VALUES (101, 'sv4cpio', 'application/x-sv4cpio', NULL);
  1637 +INSERT INTO mime_types VALUES (102, 'sv4crc', 'application/x-sv4crc', NULL);
  1638 +INSERT INTO mime_types VALUES (103, 'swf', 'application/x-shockwave-flash', NULL);
  1639 +INSERT INTO mime_types VALUES (104, 't', 'application/x-troff', NULL);
  1640 +INSERT INTO mime_types VALUES (105, 'tar', 'application/x-tar', NULL);
  1641 +INSERT INTO mime_types VALUES (106, 'tcl', 'application/x-tcl', NULL);
  1642 +INSERT INTO mime_types VALUES (107, 'tex', 'application/x-tex', NULL);
  1643 +INSERT INTO mime_types VALUES (108, 'texi', 'application/x-texinfo', NULL);
  1644 +INSERT INTO mime_types VALUES (109, 'texinfo', 'application/x-texinfo', NULL);
  1645 +INSERT INTO mime_types VALUES (110, 'tif', 'image/tiff', 'icons/tiff.gif');
  1646 +INSERT INTO mime_types VALUES (111, 'tiff', 'image/tiff', 'icons/tiff.gif');
  1647 +INSERT INTO mime_types VALUES (112, 'tr', 'application/x-troff', NULL);
  1648 +INSERT INTO mime_types VALUES (113, 'tsv', 'text/tab-separated-values', NULL);
  1649 +INSERT INTO mime_types VALUES (114, 'txt', 'text/plain', 'icons/txt.gif');
  1650 +INSERT INTO mime_types VALUES (115, 'ustar', 'application/x-ustar', NULL);
  1651 +INSERT INTO mime_types VALUES (116, 'vcd', 'application/x-cdlink', NULL);
  1652 +INSERT INTO mime_types VALUES (117, 'vrml', 'model/vrml', NULL);
  1653 +INSERT INTO mime_types VALUES (118, 'vsd', 'application/vnd.visio', 'icons/visio.gif');
  1654 +INSERT INTO mime_types VALUES (119, 'wav', 'audio/x-wav', NULL);
  1655 +INSERT INTO mime_types VALUES (120, 'wrl', 'model/vrml', NULL);
  1656 +INSERT INTO mime_types VALUES (121, 'xbm', 'image/x-xbitmap', NULL);
  1657 +INSERT INTO mime_types VALUES (122, 'xls', 'application/vnd.ms-excel', 'icons/excel.gif');
  1658 +INSERT INTO mime_types VALUES (123, 'xml', 'text/xml', NULL);
  1659 +INSERT INTO mime_types VALUES (124, 'xpm', 'image/x-xpixmap', NULL);
  1660 +INSERT INTO mime_types VALUES (125, 'xwd', 'image/x-xwindowdump', NULL);
  1661 +INSERT INTO mime_types VALUES (126, 'xyz', 'chemical/x-pdb', NULL);
  1662 +INSERT INTO mime_types VALUES (127, 'zip', 'application/zip', 'icons/zip.gif');
  1663 +INSERT INTO mime_types VALUES (128, 'gz', 'application/x-gzip', 'icons/zip.gif');
  1664 +INSERT INTO mime_types VALUES (129, 'tgz', 'application/x-gzip', 'icons/zip.gif');
  1665 +INSERT INTO mime_types VALUES (130, 'sxw', 'application/vnd.sun.xml.writer', 'icons/oowriter.gif');
  1666 +INSERT INTO mime_types VALUES (131, 'stw', 'application/vnd.sun.xml.writer.template', 'icons/oowriter.gif');
  1667 +INSERT INTO mime_types VALUES (132, 'sxc', 'application/vnd.sun.xml.calc', 'icons/oocalc.gif');
  1668 +INSERT INTO mime_types VALUES (133, 'stc', 'application/vnd.sun.xml.calc.template', 'icons/oocalc.gif');
  1669 +INSERT INTO mime_types VALUES (134, 'sxd', 'application/vnd.sun.xml.draw', NULL);
  1670 +INSERT INTO mime_types VALUES (135, 'std', 'application/vnd.sun.xml.draw.template', NULL);
  1671 +INSERT INTO mime_types VALUES (136, 'sxi', 'application/vnd.sun.xml.impress', 'icons/ooimpress.gif');
  1672 +INSERT INTO mime_types VALUES (137, 'sti', 'application/vnd.sun.xml.impress.template', 'icons/ooimpress.gif');
  1673 +INSERT INTO mime_types VALUES (138, 'sxg', 'application/vnd.sun.xml.writer.global', NULL);
  1674 +INSERT INTO mime_types VALUES (139, 'sxm', 'application/vnd.sun.xml.math', NULL);
  1675 +
  1676 +--
  1677 +-- Dumping data for table `news`
  1678 +--
  1679 +
  1680 +
  1681 +--
  1682 +-- Dumping data for table `organisations_lookup`
  1683 +--
  1684 +
  1685 +INSERT INTO organisations_lookup VALUES (1, 'Default Organisation');
  1686 +
  1687 +--
  1688 +-- Dumping data for table `roles`
  1689 +--
  1690 +
  1691 +
  1692 +--
  1693 +-- Dumping data for table `search_document_user_link`
  1694 +--
  1695 +
  1696 +
  1697 +--
  1698 +-- Dumping data for table `status_lookup`
  1699 +--
  1700 +
  1701 +INSERT INTO status_lookup VALUES (1, 'Live');
  1702 +INSERT INTO status_lookup VALUES (2, 'Published');
  1703 +INSERT INTO status_lookup VALUES (3, 'Deleted');
  1704 +INSERT INTO status_lookup VALUES (4, 'Archived');
  1705 +
  1706 +--
  1707 +-- Dumping data for table `system_settings`
  1708 +--
  1709 +
  1710 +INSERT INTO system_settings VALUES (1, 'lastIndexUpdate', '0');
  1711 +INSERT INTO system_settings VALUES (2, 'knowledgeTreeVersion', '1.2.5');
  1712 +
  1713 +--
  1714 +-- Dumping data for table `time_period`
  1715 +--
  1716 +
  1717 +
  1718 +--
  1719 +-- Dumping data for table `time_unit_lookup`
  1720 +--
  1721 +
  1722 +INSERT INTO time_unit_lookup VALUES (1, 'Years');
  1723 +INSERT INTO time_unit_lookup VALUES (2, 'Months');
  1724 +INSERT INTO time_unit_lookup VALUES (3, 'Days');
  1725 +
  1726 +--
  1727 +-- Dumping data for table `units_lookup`
  1728 +--
  1729 +
  1730 +INSERT INTO units_lookup VALUES (1, 'Default Unit');
  1731 +
  1732 +--
  1733 +-- Dumping data for table `units_organisations_link`
  1734 +--
  1735 +
  1736 +INSERT INTO units_organisations_link VALUES (1, 1, 1);
  1737 +
  1738 +--
  1739 +-- Dumping data for table `users`
  1740 +--
  1741 +
  1742 +INSERT INTO users VALUES (1, 'admin', 'Administrator', '21232f297a57a5a743894a0e4a801fc3', 0, 0, '', '', 1, 1, '', 1, 1);
  1743 +INSERT INTO users VALUES (2, 'unitAdmin', 'Unit Administrator', '21232f297a57a5a743894a0e4a801fc3', 0, 0, '', '', 1, 1, '', 1, 1);
  1744 +INSERT INTO users VALUES (3, 'guest', 'Anonymous', '084e0343a0486ff05530df6c705c8bb4', 0, 0, '', '', 0, 0, '', 19, 1);
  1745 +
  1746 +--
  1747 +-- Dumping data for table `users_groups_link`
  1748 +--
  1749 +
  1750 +INSERT INTO users_groups_link VALUES (1, 1, 1);
  1751 +INSERT INTO users_groups_link VALUES (2, 2, 2);
  1752 +INSERT INTO users_groups_link VALUES (3, 3, 3);
  1753 +
  1754 +--
  1755 +-- Dumping data for table `web_documents`
  1756 +--
  1757 +
  1758 +
  1759 +--
  1760 +-- Dumping data for table `web_documents_status_lookup`
  1761 +--
  1762 +
  1763 +INSERT INTO web_documents_status_lookup VALUES (1, 'Pending');
  1764 +INSERT INTO web_documents_status_lookup VALUES (2, 'Published');
  1765 +INSERT INTO web_documents_status_lookup VALUES (3, 'Not Published');
  1766 +
  1767 +--
  1768 +-- Dumping data for table `web_sites`
  1769 +--
  1770 +
  1771 +
  1772 +--
  1773 +-- Dumping data for table `zseq_active_sessions`
  1774 +--
  1775 +
  1776 +INSERT INTO zseq_active_sessions VALUES (1);
  1777 +
  1778 +--
  1779 +-- Dumping data for table `zseq_archive_restoration_request`
  1780 +--
  1781 +
  1782 +INSERT INTO zseq_archive_restoration_request VALUES (1);
  1783 +
  1784 +--
  1785 +-- Dumping data for table `zseq_archiving_settings`
  1786 +--
  1787 +
  1788 +INSERT INTO zseq_archiving_settings VALUES (1);
  1789 +
  1790 +--
  1791 +-- Dumping data for table `zseq_archiving_type_lookup`
  1792 +--
  1793 +
  1794 +INSERT INTO zseq_archiving_type_lookup VALUES (2);
  1795 +
  1796 +--
  1797 +-- Dumping data for table `zseq_data_types`
  1798 +--
  1799 +
  1800 +INSERT INTO zseq_data_types VALUES (5);
  1801 +
  1802 +--
  1803 +-- Dumping data for table `zseq_dependant_document_instance`
  1804 +--
  1805 +
  1806 +INSERT INTO zseq_dependant_document_instance VALUES (1);
  1807 +
  1808 +--
  1809 +-- Dumping data for table `zseq_dependant_document_template`
  1810 +--
  1811 +
  1812 +INSERT INTO zseq_dependant_document_template VALUES (1);
  1813 +
  1814 +--
  1815 +-- Dumping data for table `zseq_discussion_comments`
  1816 +--
  1817 +
  1818 +INSERT INTO zseq_discussion_comments VALUES (1);
  1819 +
  1820 +--
  1821 +-- Dumping data for table `zseq_discussion_threads`
  1822 +--
  1823 +
  1824 +INSERT INTO zseq_discussion_threads VALUES (1);
  1825 +
  1826 +--
  1827 +-- Dumping data for table `zseq_document_archiving_link`
  1828 +--
  1829 +
  1830 +INSERT INTO zseq_document_archiving_link VALUES (1);
  1831 +
  1832 +--
  1833 +-- Dumping data for table `zseq_document_fields`
  1834 +--
  1835 +
  1836 +INSERT INTO zseq_document_fields VALUES (1);
  1837 +
  1838 +--
  1839 +-- Dumping data for table `zseq_document_fields_link`
  1840 +--
  1841 +
  1842 +INSERT INTO zseq_document_fields_link VALUES (1);
  1843 +
  1844 +--
  1845 +-- Dumping data for table `zseq_document_link`
  1846 +--
  1847 +
  1848 +INSERT INTO zseq_document_link VALUES (1);
  1849 +
  1850 +--
  1851 +-- Dumping data for table `zseq_document_subscriptions`
  1852 +--
  1853 +
  1854 +INSERT INTO zseq_document_subscriptions VALUES (1);
  1855 +
  1856 +--
  1857 +-- Dumping data for table `zseq_document_text`
  1858 +--
  1859 +
  1860 +INSERT INTO zseq_document_text VALUES (1);
  1861 +
  1862 +--
  1863 +-- Dumping data for table `zseq_document_transaction_types_lookup`
  1864 +--
  1865 +
  1866 +INSERT INTO zseq_document_transaction_types_lookup VALUES (14);
  1867 +
  1868 +--
  1869 +-- Dumping data for table `zseq_document_transactions`
  1870 +--
  1871 +
  1872 +INSERT INTO zseq_document_transactions VALUES (1);
  1873 +
  1874 +--
  1875 +-- Dumping data for table `zseq_document_type_fields_link`
  1876 +--
  1877 +
  1878 +INSERT INTO zseq_document_type_fields_link VALUES (1);
  1879 +
  1880 +--
  1881 +-- Dumping data for table `zseq_document_types_lookup`
  1882 +--
  1883 +
  1884 +INSERT INTO zseq_document_types_lookup VALUES (1);
  1885 +
  1886 +--
  1887 +-- Dumping data for table `zseq_documents`
  1888 +--
  1889 +
  1890 +INSERT INTO zseq_documents VALUES (1);
  1891 +
  1892 +--
  1893 +-- Dumping data for table `zseq_folder_doctypes_link`
  1894 +--
  1895 +
  1896 +INSERT INTO zseq_folder_doctypes_link VALUES (1);
  1897 +
  1898 +--
  1899 +-- Dumping data for table `zseq_folder_subscriptions`
  1900 +--
  1901 +
  1902 +INSERT INTO zseq_folder_subscriptions VALUES (1);
  1903 +
  1904 +--
  1905 +-- Dumping data for table `zseq_folders`
  1906 +--
  1907 +
  1908 +INSERT INTO zseq_folders VALUES (2);
  1909 +
  1910 +--
  1911 +-- Dumping data for table `zseq_folders_users_roles_link`
  1912 +--
  1913 +
  1914 +INSERT INTO zseq_folders_users_roles_link VALUES (1);
  1915 +
  1916 +--
  1917 +-- Dumping data for table `zseq_groups_folders_approval_link`
  1918 +--
  1919 +
  1920 +INSERT INTO zseq_groups_folders_approval_link VALUES (1);
  1921 +
  1922 +--
  1923 +-- Dumping data for table `zseq_groups_folders_link`
  1924 +--
  1925 +
  1926 +INSERT INTO zseq_groups_folders_link VALUES (1);
  1927 +
  1928 +--
  1929 +-- Dumping data for table `zseq_groups_lookup`
  1930 +--
  1931 +
  1932 +INSERT INTO zseq_groups_lookup VALUES (3);
  1933 +
  1934 +--
  1935 +-- Dumping data for table `zseq_groups_units_link`
  1936 +--
  1937 +
  1938 +INSERT INTO zseq_groups_units_link VALUES (1);
  1939 +
  1940 +--
  1941 +-- Dumping data for table `zseq_help`
  1942 +--
  1943 +
  1944 +INSERT INTO zseq_help VALUES (98);
  1945 +
  1946 +--
  1947 +-- Dumping data for table `zseq_links`
  1948 +--
  1949 +
  1950 +INSERT INTO zseq_links VALUES (1);
  1951 +
  1952 +--
  1953 +-- Dumping data for table `zseq_metadata_lookup`
  1954 +--
  1955 +
  1956 +INSERT INTO zseq_metadata_lookup VALUES (1);
  1957 +
  1958 +--
  1959 +-- Dumping data for table `zseq_mime_types`
  1960 +--
  1961 +
  1962 +INSERT INTO zseq_mime_types VALUES (139);
  1963 +
  1964 +--
  1965 +-- Dumping data for table `zseq_news`
  1966 +--
  1967 +
  1968 +INSERT INTO zseq_news VALUES (1);
  1969 +
  1970 +--
  1971 +-- Dumping data for table `zseq_organisations_lookup`
  1972 +--
  1973 +
  1974 +INSERT INTO zseq_organisations_lookup VALUES (1);
  1975 +
  1976 +--
  1977 +-- Dumping data for table `zseq_roles`
  1978 +--
  1979 +
  1980 +INSERT INTO zseq_roles VALUES (1);
  1981 +
  1982 +--
  1983 +-- Dumping data for table `zseq_search_document_user_link`
  1984 +--
  1985 +
  1986 +INSERT INTO zseq_search_document_user_link VALUES (1);
  1987 +
  1988 +--
  1989 +-- Dumping data for table `zseq_status_lookup`
  1990 +--
  1991 +
  1992 +INSERT INTO zseq_status_lookup VALUES (4);
  1993 +
  1994 +--
  1995 +-- Dumping data for table `zseq_system_settings`
  1996 +--
  1997 +
  1998 +INSERT INTO zseq_system_settings VALUES (2);
  1999 +
  2000 +--
  2001 +-- Dumping data for table `zseq_time_period`
  2002 +--
  2003 +
  2004 +INSERT INTO zseq_time_period VALUES (1);
  2005 +
  2006 +--
  2007 +-- Dumping data for table `zseq_time_unit_lookup`
  2008 +--
  2009 +
  2010 +INSERT INTO zseq_time_unit_lookup VALUES (3);
  2011 +
  2012 +--
  2013 +-- Dumping data for table `zseq_units_lookup`
  2014 +--
  2015 +
  2016 +INSERT INTO zseq_units_lookup VALUES (1);
  2017 +
  2018 +--
  2019 +-- Dumping data for table `zseq_units_organisations_link`
  2020 +--
  2021 +
  2022 +INSERT INTO zseq_units_organisations_link VALUES (1);
  2023 +
  2024 +--
  2025 +-- Dumping data for table `zseq_users`
  2026 +--
  2027 +
  2028 +INSERT INTO zseq_users VALUES (3);
  2029 +
  2030 +--
  2031 +-- Dumping data for table `zseq_users_groups_link`
  2032 +--
  2033 +
  2034 +INSERT INTO zseq_users_groups_link VALUES (3);
  2035 +
  2036 +--
  2037 +-- Dumping data for table `zseq_web_documents`
  2038 +--
  2039 +
  2040 +INSERT INTO zseq_web_documents VALUES (1);
  2041 +
  2042 +--
  2043 +-- Dumping data for table `zseq_web_documents_status_lookup`
  2044 +--
  2045 +
  2046 +INSERT INTO zseq_web_documents_status_lookup VALUES (3);
  2047 +
  2048 +--
  2049 +-- Dumping data for table `zseq_web_sites`
  2050 +--
  2051 +
  2052 +INSERT INTO zseq_web_sites VALUES (1);
... ...
sql/mysql/upgrade/1.2.4-to-1.2.5.sql
1   -UPDATE system_settings SET value="1.2.5" WHERE name="knowledgeTreeVersion";
2 1 \ No newline at end of file
  2 +UPDATE system_settings SET value="1.2.5" WHERE name="knowledgeTreeVersion";
  3 +
  4 +DROP TABLE IF EXISTS zseq_active_sessions;
  5 +CREATE TABLE zseq_active_sessions (
  6 + id int(10) unsigned NOT NULL auto_increment,
  7 + PRIMARY KEY (id)
  8 +) TYPE=MyISAM;
  9 +INSERT INTO `zseq_active_sessions` SELECT MAX(`id`) FROM `active_sessions`;
  10 +ALTER TABLE `active_sessions` CHANGE `id` `id` INT( 11 ) NOT NULL;
  11 +
  12 +DROP TABLE IF EXISTS zseq_archive_restoration_request;
  13 +CREATE TABLE zseq_archive_restoration_request (
  14 + id int(10) unsigned NOT NULL auto_increment,
  15 + PRIMARY KEY (id)
  16 +) TYPE=MyISAM;
  17 +INSERT INTO `zseq_archive_restoration_request` SELECT MAX(`id`) FROM `archive_restoration_request`;
  18 +ALTER TABLE `archive_restoration_request` CHANGE `id` `id` INT( 11 ) NOT NULL;
  19 +
  20 +DROP TABLE IF EXISTS zseq_archiving_settings;
  21 +CREATE TABLE zseq_archiving_settings (
  22 + id int(10) unsigned NOT NULL auto_increment,
  23 + PRIMARY KEY (id)
  24 +) TYPE=MyISAM;
  25 +INSERT INTO `zseq_archiving_settings` SELECT MAX(`id`) FROM `archiving_settings`;
  26 +ALTER TABLE `archiving_settings` CHANGE `id` `id` INT( 11 ) NOT NULL;
  27 +
  28 +DROP TABLE IF EXISTS zseq_archiving_type_lookup;
  29 +CREATE TABLE zseq_archiving_type_lookup (
  30 + id int(10) unsigned NOT NULL auto_increment,
  31 + PRIMARY KEY (id)
  32 +) TYPE=MyISAM;
  33 +INSERT INTO `zseq_archiving_type_lookup` SELECT MAX(`id`) FROM `archiving_type_lookup`;
  34 +ALTER TABLE `archiving_type_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  35 +
  36 +DROP TABLE IF EXISTS zseq_data_types;
  37 +CREATE TABLE zseq_data_types (
  38 + id int(10) unsigned NOT NULL auto_increment,
  39 + PRIMARY KEY (id)
  40 +) TYPE=MyISAM;
  41 +INSERT INTO `zseq_data_types` SELECT MAX(`id`) FROM `data_types`;
  42 +ALTER TABLE `data_types` CHANGE `id` `id` INT( 11 ) NOT NULL;
  43 +
  44 +DROP TABLE IF EXISTS zseq_dependant_document_instance;
  45 +CREATE TABLE zseq_dependant_document_instance (
  46 + id int(10) unsigned NOT NULL auto_increment,
  47 + PRIMARY KEY (id)
  48 +) TYPE=MyISAM;
  49 +INSERT INTO `zseq_dependant_document_instance` SELECT MAX(`id`) FROM `dependant_document_instance`;
  50 +ALTER TABLE `dependant_document_instance` CHANGE `id` `id` INT( 11 ) NOT NULL;
  51 +
  52 +DROP TABLE IF EXISTS zseq_dependant_document_template;
  53 +CREATE TABLE zseq_dependant_document_template (
  54 + id int(10) unsigned NOT NULL auto_increment,
  55 + PRIMARY KEY (id)
  56 +) TYPE=MyISAM;
  57 +INSERT INTO `zseq_dependant_document_template` SELECT MAX(`id`) FROM `dependant_document_template`;
  58 +ALTER TABLE `dependant_document_template` CHANGE `id` `id` INT( 11 ) NOT NULL;
  59 +
  60 +DROP TABLE IF EXISTS zseq_discussion_comments;
  61 +CREATE TABLE zseq_discussion_comments (
  62 + id int(10) unsigned NOT NULL auto_increment,
  63 + PRIMARY KEY (id)
  64 +) TYPE=MyISAM;
  65 +INSERT INTO `zseq_discussion_comments` SELECT MAX(`id`) FROM `discussion_comments`;
  66 +ALTER TABLE `discussion_comments` CHANGE `id` `id` INT( 11 ) NOT NULL;
  67 +
  68 +DROP TABLE IF EXISTS zseq_discussion_threads;
  69 +CREATE TABLE zseq_discussion_threads (
  70 + id int(10) unsigned NOT NULL auto_increment,
  71 + PRIMARY KEY (id)
  72 +) TYPE=MyISAM;
  73 +INSERT INTO `zseq_discussion_threads` SELECT MAX(`id`) FROM `discussion_threads`;
  74 +ALTER TABLE `discussion_threads` CHANGE `id` `id` INT( 11 ) NOT NULL;
  75 +
  76 +DROP TABLE IF EXISTS zseq_document_archiving_link;
  77 +CREATE TABLE zseq_document_archiving_link (
  78 + id int(10) unsigned NOT NULL auto_increment,
  79 + PRIMARY KEY (id)
  80 +) TYPE=MyISAM;
  81 +INSERT INTO `zseq_document_archiving_link` SELECT MAX(`id`) FROM `document_archiving_link`;
  82 +ALTER TABLE `document_archiving_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  83 +
  84 +DROP TABLE IF EXISTS zseq_document_fields;
  85 +CREATE TABLE zseq_document_fields (
  86 + id int(10) unsigned NOT NULL auto_increment,
  87 + PRIMARY KEY (id)
  88 +) TYPE=MyISAM;
  89 +INSERT INTO `zseq_document_fields` SELECT MAX(`id`) FROM `document_fields`;
  90 +ALTER TABLE `document_fields` CHANGE `id` `id` INT( 11 ) NOT NULL;
  91 +
  92 +DROP TABLE IF EXISTS zseq_document_fields_link;
  93 +CREATE TABLE zseq_document_fields_link (
  94 + id int(10) unsigned NOT NULL auto_increment,
  95 + PRIMARY KEY (id)
  96 +) TYPE=MyISAM;
  97 +INSERT INTO `zseq_document_fields_link` SELECT MAX(`id`) FROM `document_fields_link`;
  98 +ALTER TABLE `document_fields_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  99 +
  100 +DROP TABLE IF EXISTS zseq_document_link;
  101 +CREATE TABLE zseq_document_link (
  102 + id int(10) unsigned NOT NULL auto_increment,
  103 + PRIMARY KEY (id)
  104 +) TYPE=MyISAM;
  105 +INSERT INTO `zseq_document_link` SELECT MAX(`id`) FROM `document_link`;
  106 +ALTER TABLE `document_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  107 +
  108 +DROP TABLE IF EXISTS zseq_document_subscriptions;
  109 +CREATE TABLE zseq_document_subscriptions (
  110 + id int(10) unsigned NOT NULL auto_increment,
  111 + PRIMARY KEY (id)
  112 +) TYPE=MyISAM;
  113 +INSERT INTO `zseq_document_subscriptions` SELECT MAX(`id`) FROM `document_subscriptions`;
  114 +ALTER TABLE `document_subscriptions` CHANGE `id` `id` INT( 11 ) NOT NULL;
  115 +
  116 +DROP TABLE IF EXISTS zseq_document_text;
  117 +CREATE TABLE zseq_document_text (
  118 + id int(10) unsigned NOT NULL auto_increment,
  119 + PRIMARY KEY (id)
  120 +) TYPE=MyISAM;
  121 +INSERT INTO `zseq_document_text` SELECT MAX(`id`) FROM `document_text`;
  122 +ALTER TABLE `document_text` CHANGE `id` `id` INT( 11 ) NOT NULL;
  123 +
  124 +DROP TABLE IF EXISTS zseq_document_transaction_types_lookup;
  125 +CREATE TABLE zseq_document_transaction_types_lookup (
  126 + id int(10) unsigned NOT NULL auto_increment,
  127 + PRIMARY KEY (id)
  128 +) TYPE=MyISAM;
  129 +INSERT INTO `zseq_document_transaction_types_lookup` SELECT MAX(`id`) FROM `document_transaction_types_lookup`;
  130 +ALTER TABLE `document_transaction_types_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  131 +
  132 +DROP TABLE IF EXISTS zseq_document_transactions;
  133 +CREATE TABLE zseq_document_transactions (
  134 + id int(10) unsigned NOT NULL auto_increment,
  135 + PRIMARY KEY (id)
  136 +) TYPE=MyISAM;
  137 +INSERT INTO `zseq_document_transactions` SELECT MAX(`id`) FROM `document_transactions`;
  138 +ALTER TABLE `document_transactions` CHANGE `id` `id` INT( 11 ) NOT NULL;
  139 +
  140 +DROP TABLE IF EXISTS zseq_document_type_fields_link;
  141 +CREATE TABLE zseq_document_type_fields_link (
  142 + id int(10) unsigned NOT NULL auto_increment,
  143 + PRIMARY KEY (id)
  144 +) TYPE=MyISAM;
  145 +INSERT INTO `zseq_document_type_fields_link` SELECT MAX(`id`) FROM `document_type_fields_link`;
  146 +ALTER TABLE `document_type_fields_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  147 +
  148 +DROP TABLE IF EXISTS zseq_document_types_lookup;
  149 +CREATE TABLE zseq_document_types_lookup (
  150 + id int(10) unsigned NOT NULL auto_increment,
  151 + PRIMARY KEY (id)
  152 +) TYPE=MyISAM;
  153 +INSERT INTO `zseq_document_types_lookup` SELECT MAX(`id`) FROM `document_types_lookup`;
  154 +ALTER TABLE `document_types_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  155 +
  156 +DROP TABLE IF EXISTS zseq_documents;
  157 +CREATE TABLE zseq_documents (
  158 + id int(10) unsigned NOT NULL auto_increment,
  159 + PRIMARY KEY (id)
  160 +) TYPE=MyISAM;
  161 +INSERT INTO `zseq_documents` SELECT MAX(`id`) FROM `documents`;
  162 +ALTER TABLE `documents` CHANGE `id` `id` INT( 11 ) NOT NULL;
  163 +
  164 +DROP TABLE IF EXISTS zseq_folder_doctypes_link;
  165 +CREATE TABLE zseq_folder_doctypes_link (
  166 + id int(10) unsigned NOT NULL auto_increment,
  167 + PRIMARY KEY (id)
  168 +) TYPE=MyISAM;
  169 +INSERT INTO `zseq_folder_doctypes_link` SELECT MAX(`id`) FROM `folder_doctypes_link`;
  170 +ALTER TABLE `folder_doctypes_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  171 +
  172 +DROP TABLE IF EXISTS zseq_folder_subscriptions;
  173 +CREATE TABLE zseq_folder_subscriptions (
  174 + id int(10) unsigned NOT NULL auto_increment,
  175 + PRIMARY KEY (id)
  176 +) TYPE=MyISAM;
  177 +INSERT INTO `zseq_folder_subscriptions` SELECT MAX(`id`) FROM `folder_subscriptions`;
  178 +ALTER TABLE `folder_subscriptions` CHANGE `id` `id` INT( 11 ) NOT NULL;
  179 +
  180 +DROP TABLE IF EXISTS zseq_folders;
  181 +CREATE TABLE zseq_folders (
  182 + id int(10) unsigned NOT NULL auto_increment,
  183 + PRIMARY KEY (id)
  184 +) TYPE=MyISAM;
  185 +INSERT INTO `zseq_folders` SELECT MAX(`id`) FROM `folders`;
  186 +ALTER TABLE `folders` CHANGE `id` `id` INT( 11 ) NOT NULL;
  187 +
  188 +DROP TABLE IF EXISTS zseq_folders_users_roles_link;
  189 +CREATE TABLE zseq_folders_users_roles_link (
  190 + id int(10) unsigned NOT NULL auto_increment,
  191 + PRIMARY KEY (id)
  192 +) TYPE=MyISAM;
  193 +INSERT INTO `zseq_folders_users_roles_link` SELECT MAX(`id`) FROM `folders_users_roles_link`;
  194 +ALTER TABLE `folders_users_roles_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  195 +
  196 +DROP TABLE IF EXISTS zseq_groups_folders_approval_link;
  197 +CREATE TABLE zseq_groups_folders_approval_link (
  198 + id int(10) unsigned NOT NULL auto_increment,
  199 + PRIMARY KEY (id)
  200 +) TYPE=MyISAM;
  201 +INSERT INTO `zseq_groups_folders_approval_link` SELECT MAX(`id`) FROM `groups_folders_approval_link`;
  202 +ALTER TABLE `groups_folders_approval_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  203 +
  204 +DROP TABLE IF EXISTS zseq_groups_folders_link;
  205 +CREATE TABLE zseq_groups_folders_link (
  206 + id int(10) unsigned NOT NULL auto_increment,
  207 + PRIMARY KEY (id)
  208 +) TYPE=MyISAM;
  209 +INSERT INTO `zseq_groups_folders_link` SELECT MAX(`id`) FROM `groups_folders_link`;
  210 +ALTER TABLE `groups_folders_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  211 +
  212 +DROP TABLE IF EXISTS zseq_groups_lookup;
  213 +CREATE TABLE zseq_groups_lookup (
  214 + id int(10) unsigned NOT NULL auto_increment,
  215 + PRIMARY KEY (id)
  216 +) TYPE=MyISAM;
  217 +INSERT INTO `zseq_groups_lookup` SELECT MAX(`id`) FROM `groups_lookup`;
  218 +ALTER TABLE `groups_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  219 +
  220 +DROP TABLE IF EXISTS zseq_groups_units_link;
  221 +CREATE TABLE zseq_groups_units_link (
  222 + id int(10) unsigned NOT NULL auto_increment,
  223 + PRIMARY KEY (id)
  224 +) TYPE=MyISAM;
  225 +INSERT INTO `zseq_groups_units_link` SELECT MAX(`id`) FROM `groups_units_link`;
  226 +ALTER TABLE `groups_units_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  227 +
  228 +DROP TABLE IF EXISTS zseq_help;
  229 +CREATE TABLE zseq_help (
  230 + id int(10) unsigned NOT NULL auto_increment,
  231 + PRIMARY KEY (id)
  232 +) TYPE=MyISAM;
  233 +INSERT INTO `zseq_help` SELECT MAX(`id`) FROM `help`;
  234 +ALTER TABLE `help` CHANGE `id` `id` INT( 11 ) NOT NULL;
  235 +
  236 +DROP TABLE IF EXISTS zseq_links;
  237 +CREATE TABLE zseq_links (
  238 + id int(10) unsigned NOT NULL auto_increment,
  239 + PRIMARY KEY (id)
  240 +) TYPE=MyISAM;
  241 +INSERT INTO `zseq_links` SELECT MAX(`id`) FROM `links`;
  242 +ALTER TABLE `links` CHANGE `id` `id` INT( 11 ) NOT NULL;
  243 +
  244 +DROP TABLE IF EXISTS zseq_metadata_lookup;
  245 +CREATE TABLE zseq_metadata_lookup (
  246 + id int(10) unsigned NOT NULL auto_increment,
  247 + PRIMARY KEY (id)
  248 +) TYPE=MyISAM;
  249 +INSERT INTO `zseq_metadata_lookup` SELECT MAX(`id`) FROM `metadata_lookup`;
  250 +ALTER TABLE `metadata_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  251 +
  252 +DROP TABLE IF EXISTS zseq_mime_types;
  253 +CREATE TABLE zseq_mime_types (
  254 + id int(10) unsigned NOT NULL auto_increment,
  255 + PRIMARY KEY (id)
  256 +) TYPE=MyISAM;
  257 +INSERT INTO `zseq_mime_types` SELECT MAX(`id`) FROM `mime_types`;
  258 +ALTER TABLE `mime_types` CHANGE `id` `id` INT( 11 ) NOT NULL;
  259 +
  260 +DROP TABLE IF EXISTS zseq_news;
  261 +CREATE TABLE zseq_news (
  262 + id int(10) unsigned NOT NULL auto_increment,
  263 + PRIMARY KEY (id)
  264 +) TYPE=MyISAM;
  265 +INSERT INTO `zseq_news` SELECT MAX(`id`) FROM `news`;
  266 +ALTER TABLE `news` CHANGE `id` `id` INT( 11 ) NOT NULL;
  267 +
  268 +DROP TABLE IF EXISTS zseq_organisations_lookup;
  269 +CREATE TABLE zseq_organisations_lookup (
  270 + id int(10) unsigned NOT NULL auto_increment,
  271 + PRIMARY KEY (id)
  272 +) TYPE=MyISAM;
  273 +INSERT INTO `zseq_organisations_lookup` SELECT MAX(`id`) FROM `organisations_lookup`;
  274 +ALTER TABLE `organisations_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  275 +
  276 +DROP TABLE IF EXISTS zseq_roles;
  277 +CREATE TABLE zseq_roles (
  278 + id int(10) unsigned NOT NULL auto_increment,
  279 + PRIMARY KEY (id)
  280 +) TYPE=MyISAM;
  281 +INSERT INTO `zseq_roles` SELECT MAX(`id`) FROM `roles`;
  282 +ALTER TABLE `roles` CHANGE `id` `id` INT( 11 ) NOT NULL;
  283 +
  284 +DROP TABLE IF EXISTS zseq_search_document_user_link;
  285 +CREATE TABLE zseq_search_document_user_link (
  286 + id int(10) unsigned NOT NULL auto_increment,
  287 + PRIMARY KEY (id)
  288 +) TYPE=MyISAM;
  289 +INSERT INTO `zseq_search_document_user_link` SELECT MAX(`id`) FROM `search_document_user_link`;
  290 +ALTER TABLE `search_document_user_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  291 +
  292 +DROP TABLE IF EXISTS zseq_status_lookup;
  293 +CREATE TABLE zseq_status_lookup (
  294 + id int(10) unsigned NOT NULL auto_increment,
  295 + PRIMARY KEY (id)
  296 +) TYPE=MyISAM;
  297 +INSERT INTO `zseq_status_lookup` SELECT MAX(`id`) FROM `status_lookup`;
  298 +ALTER TABLE `status_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  299 +
  300 +DROP TABLE IF EXISTS zseq_system_settings;
  301 +CREATE TABLE zseq_system_settings (
  302 + id int(10) unsigned NOT NULL auto_increment,
  303 + PRIMARY KEY (id)
  304 +) TYPE=MyISAM;
  305 +INSERT INTO `zseq_system_settings` SELECT MAX(`id`) FROM `system_settings`;
  306 +ALTER TABLE `system_settings` CHANGE `id` `id` INT( 11 ) NOT NULL;
  307 +
  308 +DROP TABLE IF EXISTS zseq_time_period;
  309 +CREATE TABLE zseq_time_period (
  310 + id int(10) unsigned NOT NULL auto_increment,
  311 + PRIMARY KEY (id)
  312 +) TYPE=MyISAM;
  313 +INSERT INTO `zseq_time_period` SELECT MAX(`id`) FROM `time_period`;
  314 +ALTER TABLE `time_period` CHANGE `id` `id` INT( 11 ) NOT NULL;
  315 +
  316 +DROP TABLE IF EXISTS zseq_time_unit_lookup;
  317 +CREATE TABLE zseq_time_unit_lookup (
  318 + id int(10) unsigned NOT NULL auto_increment,
  319 + PRIMARY KEY (id)
  320 +) TYPE=MyISAM;
  321 +INSERT INTO `zseq_time_unit_lookup` SELECT MAX(`id`) FROM `time_unit_lookup`;
  322 +ALTER TABLE `time_unit_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  323 +
  324 +DROP TABLE IF EXISTS zseq_units_lookup;
  325 +CREATE TABLE zseq_units_lookup (
  326 + id int(10) unsigned NOT NULL auto_increment,
  327 + PRIMARY KEY (id)
  328 +) TYPE=MyISAM;
  329 +INSERT INTO `zseq_units_lookup` SELECT MAX(`id`) FROM `units_lookup`;
  330 +ALTER TABLE `units_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  331 +
  332 +DROP TABLE IF EXISTS zseq_units_organisations_link;
  333 +CREATE TABLE zseq_units_organisations_link (
  334 + id int(10) unsigned NOT NULL auto_increment,
  335 + PRIMARY KEY (id)
  336 +) TYPE=MyISAM;
  337 +INSERT INTO `zseq_units_organisations_link` SELECT MAX(`id`) FROM `units_organisations_link`;
  338 +ALTER TABLE `units_organisations_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  339 +
  340 +DROP TABLE IF EXISTS zseq_users;
  341 +CREATE TABLE zseq_users (
  342 + id int(10) unsigned NOT NULL auto_increment,
  343 + PRIMARY KEY (id)
  344 +) TYPE=MyISAM;
  345 +INSERT INTO `zseq_users` SELECT MAX(`id`) FROM `users`;
  346 +ALTER TABLE `users` CHANGE `id` `id` INT( 11 ) NOT NULL;
  347 +
  348 +DROP TABLE IF EXISTS zseq_users_groups_link;
  349 +CREATE TABLE zseq_users_groups_link (
  350 + id int(10) unsigned NOT NULL auto_increment,
  351 + PRIMARY KEY (id)
  352 +) TYPE=MyISAM;
  353 +INSERT INTO `zseq_users_groups_link` SELECT MAX(`id`) FROM `users_groups_link`;
  354 +ALTER TABLE `users_groups_link` CHANGE `id` `id` INT( 11 ) NOT NULL;
  355 +
  356 +DROP TABLE IF EXISTS zseq_web_documents;
  357 +CREATE TABLE zseq_web_documents (
  358 + id int(10) unsigned NOT NULL auto_increment,
  359 + PRIMARY KEY (id)
  360 +) TYPE=MyISAM;
  361 +INSERT INTO `zseq_web_documents` SELECT MAX(`id`) FROM `web_documents`;
  362 +ALTER TABLE `web_documents` CHANGE `id` `id` INT( 11 ) NOT NULL;
  363 +
  364 +DROP TABLE IF EXISTS zseq_web_documents_status_lookup;
  365 +CREATE TABLE zseq_web_documents_status_lookup (
  366 + id int(10) unsigned NOT NULL auto_increment,
  367 + PRIMARY KEY (id)
  368 +) TYPE=MyISAM;
  369 +INSERT INTO `zseq_web_documents_status_lookup` SELECT MAX(`id`) FROM `web_documents_status_lookup`;
  370 +ALTER TABLE `web_documents_status_lookup` CHANGE `id` `id` INT( 11 ) NOT NULL;
  371 +
  372 +DROP TABLE IF EXISTS zseq_web_sites;
  373 +CREATE TABLE zseq_web_sites (
  374 + id int(10) unsigned NOT NULL auto_increment,
  375 + PRIMARY KEY (id)
  376 +) TYPE=MyISAM;
  377 +INSERT INTO `zseq_web_sites` SELECT MAX(`id`) FROM `web_sites`;
  378 +ALTER TABLE `web_sites` CHANGE `id` `id` INT( 11 ) NOT NULL;
  379 +
  380 +
  381 +ALTER TABLE `users` ADD UNIQUE (
  382 + `username`
  383 +);
  384 +ALTER TABLE `document_types_lookup` ADD UNIQUE (
  385 + `name`
  386 +);
  387 +ALTER TABLE `groups_lookup` ADD UNIQUE (
  388 + `name`
  389 +);
  390 +ALTER TABLE `organisations_lookup` ADD UNIQUE (
  391 + `name`
  392 +);
  393 +ALTER TABLE `roles` ADD UNIQUE (
  394 + `name`
  395 +);
... ...