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) public EstateSettings LoadEstateSettings(int estateID)
{ {
// TODO: Implementation!
return new EstateSettings(); return new EstateSettings();
} }
public List<EstateSettings> LoadEstateSettingsAll()
{
// TODO: Implementation!
return new List<EstateSettings>();
}
public List<int> GetEstates(string search) public List<int> GetEstates(string search)
{ {
// TODO: Implementation!
return new List<int>();
}
public List<int> GetEstatesAll()
{
// TODO: Implementation!
return new List<int>(); return new List<int>();
} }
public bool LinkRegion(UUID regionID, int estateID) public bool LinkRegion(UUID regionID, int estateID)
{ {
// TODO: Implementation!
return false; return false;
} }
public List<UUID> GetRegions(int estateID) public List<UUID> GetRegions(int estateID)
{ {
// TODO: Implementation!
return new List<UUID>(); return new List<UUID>();
} }
public bool DeleteEstate(int estateID) public bool DeleteEstate(int estateID)
{ {
// TODO: Implementation!
return false; return false;
} }
#endregion #endregion

View File

@ -414,6 +414,46 @@ namespace OpenSim.Data.MySQL
} }
} }
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) public List<int> GetEstates(string search)
{ {
List<int> result = new List<int>(); List<int> result = new List<int>();

View File

@ -358,6 +358,17 @@ namespace OpenSim.Data.SQLite
return DoLoad(cmd, UUID.Zero, false); 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) public List<int> GetEstates(string search)
{ {
List<int> result = new List<int>(); List<int> result = new List<int>();
@ -380,6 +391,27 @@ namespace OpenSim.Data.SQLite
return result; 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) public bool LinkRegion(UUID regionID, int estateID)
{ {
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();

View File

@ -101,6 +101,17 @@ namespace OpenSim.Data.SQLiteLegacy
return DoLoad(cmd, regionID, create); 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) private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
{ {
EstateSettings es = new EstateSettings(); EstateSettings es = new EstateSettings();
@ -369,6 +380,28 @@ namespace OpenSim.Data.SQLiteLegacy
return result; 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) public bool LinkRegion(UUID regionID, int estateID)
{ {
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();

View File

@ -828,7 +828,18 @@ namespace OpenSim
} }
else 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") if (response == "None")
continue; continue;

View File

@ -36,8 +36,22 @@ namespace OpenSim.Region.Framework.Interfaces
{ {
EstateSettings LoadEstateSettings(UUID regionID, bool create); EstateSettings LoadEstateSettings(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID); 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); void StoreEstateSettings(EstateSettings es);
List<int> GetEstates(string search); 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); bool LinkRegion(UUID regionID, int estateID);
List<UUID> GetRegions(int estateID); List<UUID> GetRegions(int estateID);
bool DeleteEstate(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(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID); 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); void StoreEstateSettings(EstateSettings es);
List<int> GetEstates(string search); 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); bool LinkRegion(UUID regionID, int estateID);
List<UUID> GetRegions(int estateID); List<UUID> GetRegions(int estateID);
bool DeleteEstate(int estateID); bool DeleteEstate(int estateID);

View File

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