From 4e6b68df137ca46a0a7a7efd7ba2b245abb9cea3 Mon Sep 17 00:00:00 2001
From: MW
Date: Sat, 6 Oct 2007 08:23:51 +0000
Subject: Applied Patch 473, Inventory Patch from Tleiades (many thanks).
---
OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 9 +++
.../Framework/Data.SQLite/SQLiteInventoryStore.cs | 88 ++++++++++++++++++----
.../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
{
addInventoryFolder(folder);
}
+
+
+ ///
+ /// Delete an inventory folder
+ ///
+ /// Id of folder to delete
+ public void deleteInventoryFolder(LLUUID folderID)
+ {
+ }
}
}
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
/// A list of folder objects
public List getUserRootFolders(LLUUID user)
{
- return null;
+ return new List();
}
///
@@ -235,21 +235,46 @@ namespace OpenSim.Framework.Data.SQLite
}
///
- /// Returns a list of inventory folders contained in the folder 'parentID'
+ /// Append a list of all the child folders of a parent folder
///
- /// The folder to get subfolders for
- /// A list of inventory folders
- public List getInventoryFolders(LLUUID parentID)
+ /// list where folders will be appended
+ /// ID of parent
+ protected void getInventoryFolders(ref List folders, LLUUID parentID)
{
- List folders = new List();
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
string selectExp = "parentID = '" + parentID.ToString() + "'";
DataRow[] rows = inventoryFolderTable.Select(selectExp);
foreach (DataRow row in rows)
{
- folders.Add(this.buildFolder(row));
+ folders.Add(buildFolder(row));
}
- // System.Console.WriteLine("found " + folders.Count + " inventory folders");
+ }
+
+ ///
+ /// Returns a list of inventory folders contained in the folder 'parentID'
+ ///
+ /// The folder to get subfolders for
+ /// A list of inventory folders
+ public List getInventoryFolders(LLUUID parentID)
+ {
+ List folders = new List();
+ getInventoryFolders(ref folders, parentID);
+ return folders;
+ }
+
+ ///
+ /// Returns all child folders in the hierarchy from the parent folder and down
+ ///
+ /// The folder to get subfolders for
+ /// A list of inventory folders
+ protected List getFolderHierarchy(LLUUID parentID)
+ {
+ List folders = new List();
+ getInventoryFolders(ref folders, parentID);
+
+ for(int i=0; i
@@ -344,6 +369,40 @@ namespace OpenSim.Framework.Data.SQLite
}
+ ///
+ /// Delete a folder
+ ///
+ ///
+ /// This will clean-up any child folders and child items as well
+ ///
+ ///
+ public void deleteInventoryFolder(LLUUID folderID)
+ {
+ List subFolders = getFolderHierarchy(folderID);
+
+ DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
+ DataRow inventoryRow;
+
+ //Delete all sub-folders
+ foreach (InventoryFolderBase f in subFolders)
+ {
+ inventoryRow = inventoryFolderTable.Rows.Find(f.folderID);
+ if (inventoryRow != null)
+ {
+ inventoryRow.Delete();
+ }
+ }
+
+ //Delete the actual row
+ inventoryRow = inventoryFolderTable.Rows.Find(folderID);
+ if (inventoryRow != null)
+ {
+ inventoryRow.Delete();
+ }
+
+ this.invFoldersDa.Update(ds, "inventoryfolders");
+ }
+
/***********************************************************************
*
* Data Table definitions
@@ -494,3 +553,4 @@ namespace OpenSim.Framework.Data.SQLite
}
}
+
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
///
/// The inventory folder
void updateInventoryFolder(InventoryFolderBase folder);
+
+ ///
+ /// Deletes a folder based on its ID with folder
+ ///
+ /// The id of the folder
+ void deleteInventoryFolder(LLUUID folder);
+
}
}
\ No newline at end of file
--
cgit v1.1