diff options
author | MW | 2007-10-06 08:23:51 +0000 |
---|---|---|
committer | MW | 2007-10-06 08:23:51 +0000 |
commit | 4e6b68df137ca46a0a7a7efd7ba2b245abb9cea3 (patch) | |
tree | 0f0bf6546adb7e5af65474ff1e9a7da25f658596 | |
parent | this ode.dll should fix problems with windows server 2003, and perhaps other ... (diff) | |
download | opensim-SC-4e6b68df137ca46a0a7a7efd7ba2b245abb9cea3.zip opensim-SC-4e6b68df137ca46a0a7a7efd7ba2b245abb9cea3.tar.gz opensim-SC-4e6b68df137ca46a0a7a7efd7ba2b245abb9cea3.tar.bz2 opensim-SC-4e6b68df137ca46a0a7a7efd7ba2b245abb9cea3.tar.xz |
Applied Patch 473, Inventory Patch from Tleiades (many thanks).
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs | 88 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/InventoryItemBase.cs | 7 |
3 files changed, 90 insertions, 14 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index f773da4..478e8b5 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | |||
@@ -349,5 +349,14 @@ namespace OpenSim.Framework.Data.MySQL | |||
349 | { | 349 | { |
350 | addInventoryFolder(folder); | 350 | addInventoryFolder(folder); |
351 | } | 351 | } |
352 | |||
353 | |||
354 | /// <summary> | ||
355 | /// Delete an inventory folder | ||
356 | /// </summary> | ||
357 | /// <param name="folderId">Id of folder to delete</param> | ||
358 | public void deleteInventoryFolder(LLUUID folderID) | ||
359 | { | ||
360 | } | ||
352 | } | 361 | } |
353 | } | 362 | } |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index d664e98..4c9c467 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs | |||
@@ -195,7 +195,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
195 | /// <returns>A list of folder objects</returns> | 195 | /// <returns>A list of folder objects</returns> |
196 | public List<InventoryFolderBase> getUserRootFolders(LLUUID user) | 196 | public List<InventoryFolderBase> getUserRootFolders(LLUUID user) |
197 | { | 197 | { |
198 | return null; | 198 | return new List<InventoryFolderBase>(); |
199 | } | 199 | } |
200 | 200 | ||
201 | /// <summary> | 201 | /// <summary> |
@@ -235,21 +235,46 @@ namespace OpenSim.Framework.Data.SQLite | |||
235 | } | 235 | } |
236 | 236 | ||
237 | /// <summary> | 237 | /// <summary> |
238 | /// Returns a list of inventory folders contained in the folder 'parentID' | 238 | /// Append a list of all the child folders of a parent folder |
239 | /// </summary> | 239 | /// </summary> |
240 | /// <param name="parentID">The folder to get subfolders for</param> | 240 | /// <param name="folders">list where folders will be appended</param> |
241 | /// <returns>A list of inventory folders</returns> | 241 | /// <param name="parentID">ID of parent</param> |
242 | public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) | 242 | protected void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID) |
243 | { | 243 | { |
244 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
245 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | 244 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; |
246 | string selectExp = "parentID = '" + parentID.ToString() + "'"; | 245 | string selectExp = "parentID = '" + parentID.ToString() + "'"; |
247 | DataRow[] rows = inventoryFolderTable.Select(selectExp); | 246 | DataRow[] rows = inventoryFolderTable.Select(selectExp); |
248 | foreach (DataRow row in rows) | 247 | foreach (DataRow row in rows) |
249 | { | 248 | { |
250 | folders.Add(this.buildFolder(row)); | 249 | folders.Add(buildFolder(row)); |
251 | } | 250 | } |
252 | // System.Console.WriteLine("found " + folders.Count + " inventory folders"); | 251 | } |
252 | |||
253 | /// <summary> | ||
254 | /// Returns a list of inventory folders contained in the folder 'parentID' | ||
255 | /// </summary> | ||
256 | /// <param name="parentID">The folder to get subfolders for</param> | ||
257 | /// <returns>A list of inventory folders</returns> | ||
258 | public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) | ||
259 | { | ||
260 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
261 | getInventoryFolders(ref folders, parentID); | ||
262 | return folders; | ||
263 | } | ||
264 | |||
265 | /// <summary> | ||
266 | /// Returns all child folders in the hierarchy from the parent folder and down | ||
267 | /// </summary> | ||
268 | /// <param name="parentID">The folder to get subfolders for</param> | ||
269 | /// <returns>A list of inventory folders</returns> | ||
270 | protected List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) | ||
271 | { | ||
272 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
273 | getInventoryFolders(ref folders, parentID); | ||
274 | |||
275 | for(int i=0; i<folders.Count; i++) | ||
276 | getInventoryFolders(ref folders, folders[i].folderID); | ||
277 | |||
253 | return folders; | 278 | return folders; |
254 | } | 279 | } |
255 | 280 | ||
@@ -282,12 +307,12 @@ namespace OpenSim.Framework.Data.SQLite | |||
282 | // that you don't get to see system textures why creating | 307 | // that you don't get to see system textures why creating |
283 | // clothes and the like. :( | 308 | // clothes and the like. :( |
284 | 309 | ||
285 | // DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); | 310 | DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); |
286 | // if (row != null) { | 311 | if (row != null) { |
287 | // return buildFolder(row); | 312 | return buildFolder(row); |
288 | // } else { | 313 | } else { |
289 | return null; | 314 | return null; |
290 | // } | 315 | } |
291 | } | 316 | } |
292 | 317 | ||
293 | /// <summary> | 318 | /// <summary> |
@@ -344,6 +369,40 @@ namespace OpenSim.Framework.Data.SQLite | |||
344 | } | 369 | } |
345 | 370 | ||
346 | 371 | ||
372 | /// <summary> | ||
373 | /// Delete a folder | ||
374 | /// </summary> | ||
375 | /// <remarks> | ||
376 | /// This will clean-up any child folders and child items as well | ||
377 | /// </remarks> | ||
378 | /// <param name="item"></param> | ||
379 | public void deleteInventoryFolder(LLUUID folderID) | ||
380 | { | ||
381 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); | ||
382 | |||
383 | DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; | ||
384 | DataRow inventoryRow; | ||
385 | |||
386 | //Delete all sub-folders | ||
387 | foreach (InventoryFolderBase f in subFolders) | ||
388 | { | ||
389 | inventoryRow = inventoryFolderTable.Rows.Find(f.folderID); | ||
390 | if (inventoryRow != null) | ||
391 | { | ||
392 | inventoryRow.Delete(); | ||
393 | } | ||
394 | } | ||
395 | |||
396 | //Delete the actual row | ||
397 | inventoryRow = inventoryFolderTable.Rows.Find(folderID); | ||
398 | if (inventoryRow != null) | ||
399 | { | ||
400 | inventoryRow.Delete(); | ||
401 | } | ||
402 | |||
403 | this.invFoldersDa.Update(ds, "inventoryfolders"); | ||
404 | } | ||
405 | |||
347 | /*********************************************************************** | 406 | /*********************************************************************** |
348 | * | 407 | * |
349 | * Data Table definitions | 408 | * Data Table definitions |
@@ -494,3 +553,4 @@ namespace OpenSim.Framework.Data.SQLite | |||
494 | } | 553 | } |
495 | } | 554 | } |
496 | 555 | ||
556 | |||
diff --git a/OpenSim/Framework/General/Types/InventoryItemBase.cs b/OpenSim/Framework/General/Types/InventoryItemBase.cs index e3dbe71..7f59bcc 100644 --- a/OpenSim/Framework/General/Types/InventoryItemBase.cs +++ b/OpenSim/Framework/General/Types/InventoryItemBase.cs | |||
@@ -218,5 +218,12 @@ namespace OpenSim.Framework.Types | |||
218 | /// </summary> | 218 | /// </summary> |
219 | /// <param name="folder">The inventory folder</param> | 219 | /// <param name="folder">The inventory folder</param> |
220 | void updateInventoryFolder(InventoryFolderBase folder); | 220 | void updateInventoryFolder(InventoryFolderBase folder); |
221 | |||
222 | /// <summary> | ||
223 | /// Deletes a folder based on its ID with folder | ||
224 | /// </summary> | ||
225 | /// <param name="folder">The id of the folder</param> | ||
226 | void deleteInventoryFolder(LLUUID folder); | ||
227 | |||
221 | } | 228 | } |
222 | } \ No newline at end of file | 229 | } \ No newline at end of file |