Show hyperlinks

0.7.0.1-release
Diva Canto 2010-07-31 16:44:02 -07:00
parent 692e684ced
commit 63dd24a651
4 changed files with 102 additions and 102 deletions

View File

@ -306,37 +306,37 @@ namespace OpenSim.Data.MSSQL
return true; return true;
} }
return false; return false;
} }
public List<RegionData> GetDefaultRegions(UUID scopeID) public List<RegionData> GetDefaultRegions(UUID scopeID)
{ {
return Get((int)RegionFlags.DefaultRegion, scopeID); return Get((int)RegionFlags.DefaultRegion, scopeID);
} }
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
{ {
// TODO: distance-sort results // TODO: distance-sort results
return Get((int)RegionFlags.FallbackRegion, scopeID); return Get((int)RegionFlags.FallbackRegion, scopeID);
} }
public List<RegionData> GetHyperlinks(UUID scopeID) public List<RegionData> GetHyperlinks(UUID scopeID)
{ {
return Get((int)RegionFlags.Hyperlink, scopeID); return Get((int)RegionFlags.Hyperlink, scopeID);
} }
private List<RegionData> Get(int regionFlags, UUID scopeID) private List<RegionData> Get(int regionFlags, UUID scopeID)
{ {
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0"; string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
sql += " AND ScopeID = @scopeID"; sql += " AND ScopeID = @scopeID";
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
conn.Open(); conn.Open();
return RunCommand(cmd); return RunCommand(cmd);
} }
} }
} }
} }

View File

@ -280,35 +280,35 @@ namespace OpenSim.Data.MySQL
} }
return false; return false;
} }
public List<RegionData> GetDefaultRegions(UUID scopeID) public List<RegionData> GetDefaultRegions(UUID scopeID)
{ {
return Get((int)RegionFlags.DefaultRegion, scopeID); return Get((int)RegionFlags.DefaultRegion, scopeID);
} }
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
{ {
// TODO: distance-sort results // TODO: distance-sort results
return Get((int)RegionFlags.FallbackRegion, scopeID); return Get((int)RegionFlags.FallbackRegion, scopeID);
} }
public List<RegionData> GetHyperlinks(UUID scopeID) public List<RegionData> GetHyperlinks(UUID scopeID)
{ {
return Get((int)RegionFlags.Hyperlink, scopeID); return Get((int)RegionFlags.Hyperlink, scopeID);
} }
private List<RegionData> Get(int regionFlags, UUID scopeID) private List<RegionData> Get(int regionFlags, UUID scopeID)
{ {
string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0"; string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
if (scopeID != UUID.Zero) if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID"; command += " and ScopeID = ?scopeID";
MySqlCommand cmd = new MySqlCommand(command); MySqlCommand cmd = new MySqlCommand(command);
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd); return RunCommand(cmd);
} }
} }
} }

View File

@ -49,8 +49,8 @@ namespace OpenSim.Data.Null
if (Instance == null) if (Instance == null)
Instance = this; Instance = this;
//Console.WriteLine("[XXX] NullRegionData constructor"); //Console.WriteLine("[XXX] NullRegionData constructor");
} }
public List<RegionData> Get(string regionName, UUID scopeID) public List<RegionData> Get(string regionName, UUID scopeID)
{ {
if (Instance != this) if (Instance != this)
@ -160,37 +160,37 @@ namespace OpenSim.Data.Null
m_regionData.Remove(regionID); m_regionData.Remove(regionID);
return true; return true;
} }
public List<RegionData> GetDefaultRegions(UUID scopeID) public List<RegionData> GetDefaultRegions(UUID scopeID)
{ {
return Get((int)RegionFlags.DefaultRegion, scopeID); return Get((int)RegionFlags.DefaultRegion, scopeID);
} }
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
{ {
return Get((int)RegionFlags.FallbackRegion, scopeID); return Get((int)RegionFlags.FallbackRegion, scopeID);
} }
public List<RegionData> GetHyperlinks(UUID scopeID) public List<RegionData> GetHyperlinks(UUID scopeID)
{ {
return Get((int)RegionFlags.Hyperlink, scopeID); return Get((int)RegionFlags.Hyperlink, scopeID);
} }
private List<RegionData> Get(int regionFlags, UUID scopeID) private List<RegionData> Get(int regionFlags, UUID scopeID)
{ {
if (Instance != this) if (Instance != this)
return Instance.Get(regionFlags, scopeID); return Instance.Get(regionFlags, scopeID);
List<RegionData> ret = new List<RegionData>(); List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values) foreach (RegionData r in m_regionData.Values)
{ {
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0) if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
ret.Add(r); ret.Add(r);
} }
return ret; return ret;
} }
} }
} }

View File

@ -378,28 +378,28 @@ namespace OpenSim.Services.GridService
public void HandleShow(string module, string[] cmd) public void HandleShow(string module, string[] cmd)
{ {
if (cmd.Length != 2) if (cmd.Length != 2)
{ {
MainConsole.Instance.Output("Syntax: show hyperlinks"); MainConsole.Instance.Output("Syntax: show hyperlinks");
return; return;
}
List<RegionData> regions = m_Database.GetHyperlinks(UUID.Zero);
if (regions == null || regions.Count < 1)
{
MainConsole.Instance.Output("No hyperlinks");
return;
}
MainConsole.Instance.Output("Region Name Region UUID");
MainConsole.Instance.Output("Location URI");
MainConsole.Instance.Output("-------------------------------------------------------------------------------");
foreach (RegionData r in regions)
{
MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
r.RegionName, r.RegionID,
String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
"http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
} }
List<RegionData> regions = m_Database.GetHyperlinks(UUID.Zero);
if (regions == null || regions.Count < 1)
{
MainConsole.Instance.Output("No hyperlinks");
return;
}
MainConsole.Instance.Output("Region Name Region UUID");
MainConsole.Instance.Output("Location URI");
MainConsole.Instance.Output("-------------------------------------------------------------------------------");
foreach (RegionData r in regions)
{
MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
r.RegionName, r.RegionID,
String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
"http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
}
return; return;
} }