private List<GadgetSpec> GetGadgetSpecifications()
{
DebugLogging.Log("OpenSocialManager GetAllDBGadgets " + !noCache);
Dictionary<string, GadgetSpec> allDBGadgets = GetAllDBGadgets(!noCache);
List<GadgetSpec> gadgetSpecs = new List<GadgetSpec>();
// if someone used the sandbox to log in, grab those gadgets, and only those gadget.
// if a gadget with the same file name is in the DB, merge it in so that we can inherit it's configuruation
if (page.Session != null && (string)page.Session[ORNG_GADGETS] != null)
{
// Add sandbox gadgets if there are any
// Note that this block of code only gets executed after someone logs in with GadgetSandbox.aspx!
String openSocialGadgetURLS = (string)page.Session[ORNG_GADGETS];
String[] urls = openSocialGadgetURLS.Split(Environment.NewLine.ToCharArray());
for (int i = 0; i < urls.Length; i++)
{
String openSocialGadgetURL = urls[i];
if (openSocialGadgetURL.Length == 0)
continue;
GadgetSpec sandboxGadget = new GadgetSpec(openSocialGadgetURL);
// see if we have a gadget with the same file name in the DB, if so use its configuration
if (allDBGadgets.ContainsKey(sandboxGadget.GetFileName()))
{
GadgetSpec gadget = allDBGadgets[sandboxGadget.GetFileName()];
gadget.MergeWithUnrecognizedGadget(sandboxGadget);
gadgetSpecs.Add(gadget);
}
else
{
gadgetSpecs.Add(sandboxGadget);
}
}
}
else
{
// the normal use case
// just add in the db gadgets
gadgetSpecs.AddRange(allDBGadgets.Values);
}
return gadgetSpecs;
}