On initial region registration, if the user chooses the option to make the region part of an existing estate, then list the existing region names.

0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-21 21:37:06 +00:00
parent f4a30f3a23
commit d3a20a1e92
8 changed files with 172 additions and 1 deletions

View File

@ -350,26 +350,43 @@ namespace OpenSim.Data.MSSQL
public EstateSettings LoadEstateSettings(int estateID)
{
// TODO: Implementation!
return new EstateSettings();
}
public List<EstateSettings> LoadEstateSettingsAll()
{
// TODO: Implementation!
return new List<EstateSettings>();
}
public List<int> GetEstates(string search)
{
// TODO: Implementation!
return new List<int>();
}
public List<int> GetEstatesAll()
{
// TODO: Implementation!
return new List<int>();
}
public bool LinkRegion(UUID regionID, int estateID)
{
// TODO: Implementation!
return false;
}
public List<UUID> GetRegions(int estateID)
{
// TODO: Implementation!
return new List<UUID>();
}
public bool DeleteEstate(int estateID)
{
// TODO: Implementation!
return false;
}
#endregion

View File

@ -413,6 +413,46 @@ namespace OpenSim.Data.MySQL
return DoLoad(cmd, UUID.Zero, false);
}
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<int> allEstateIds = GetEstatesAll();
foreach (int estateId in allEstateIds)
allEstateSettings.Add(LoadEstateSettings(estateId));
return allEstateSettings;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select estateID from estate_settings";
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
result.Add(Convert.ToInt32(reader["EstateID"]));
}
reader.Close();
}
}
dbcon.Close();
}
return result;
}
public List<int> GetEstates(string search)
{

View File

@ -357,6 +357,17 @@ namespace OpenSim.Data.SQLite
return DoLoad(cmd, UUID.Zero, false);
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> estateSettings = new List<EstateSettings>();
List<int> estateIds = GetEstatesAll();
foreach (int estateId in estateIds)
estateSettings.Add(LoadEstateSettings(estateId));
return estateSettings;
}
public List<int> GetEstates(string search)
{
@ -379,6 +390,27 @@ namespace OpenSim.Data.SQLite
return result;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
string sql = "select EstateID from estate_settings";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
IDataReader r = cmd.ExecuteReader();
while (r.Read())
{
result.Add(Convert.ToInt32(r["EstateID"]));
}
r.Close();
return result;
}
public bool LinkRegion(UUID regionID, int estateID)
{

View File

@ -100,6 +100,17 @@ namespace OpenSim.Data.SQLiteLegacy
return DoLoad(cmd, regionID, create);
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> estateSettings = new List<EstateSettings>();
List<int> estateIds = GetEstatesAll();
foreach (int estateId in estateIds)
estateSettings.Add(LoadEstateSettings(estateId));
return estateSettings;
}
private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
{
@ -369,6 +380,28 @@ namespace OpenSim.Data.SQLiteLegacy
return result;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
string sql = "select EstateID from estate_settings";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
IDataReader r = cmd.ExecuteReader();
while (r.Read())
{
result.Add(Convert.ToInt32(r["EstateID"]));
}
r.Close();
return result;
}
public bool LinkRegion(UUID regionID, int estateID)
{
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();

View File

@ -828,7 +828,18 @@ namespace OpenSim
}
else
{
response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
List<EstateSettings> estates = estateDataService.LoadEstateSettingsAll();
List<string> estateNames = new List<string>();
foreach (EstateSettings estate in estates)
estateNames.Add(estate.EstateName);
response
= MainConsole.Instance.CmdPrompt(
string.Format(
"Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())),
"None");
if (response == "None")
continue;

View File

@ -36,8 +36,22 @@ namespace OpenSim.Region.Framework.Interfaces
{
EstateSettings LoadEstateSettings(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID);
/// <summary>
/// Load/Get all estate settings.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<EstateSettings> LoadEstateSettingsAll();
void StoreEstateSettings(EstateSettings es);
List<int> GetEstates(string search);
/// <summary>
/// Get the IDs of all estates.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<int> GetEstatesAll();
bool LinkRegion(UUID regionID, int estateID);
List<UUID> GetRegions(int estateID);
bool DeleteEstate(int estateID);

View File

@ -37,8 +37,22 @@ namespace OpenSim.Region.Framework.Interfaces
EstateSettings LoadEstateSettings(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID);
/// <summary>
/// Load/Get all estate settings.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<EstateSettings> LoadEstateSettingsAll();
void StoreEstateSettings(EstateSettings es);
List<int> GetEstates(string search);
/// <summary>
/// Get the IDs of all estates.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<int> GetEstatesAll();
bool LinkRegion(UUID regionID, int estateID);
List<UUID> GetRegions(int estateID);
bool DeleteEstate(int estateID);

View File

@ -90,6 +90,11 @@ namespace OpenSim.Services.Connectors
{
return m_database.LoadEstateSettings(estateID);
}
public List<EstateSettings> LoadEstateSettingsAll()
{
return m_database.LoadEstateSettingsAll();
}
public void StoreEstateSettings(EstateSettings es)
{
@ -100,6 +105,11 @@ namespace OpenSim.Services.Connectors
{
return m_database.GetEstates(search);
}
public List<int> GetEstatesAll()
{
return m_database.GetEstatesAll();
}
public bool LinkRegion(UUID regionID, int estateID)
{