public String GetView() { GadgetViewRequirements reqs = GetGadgetViewRequirements(); if (reqs != null) { return(reqs.GetView()); } // default behavior that will get invoked when there is no reqs. Useful for sandbox gadgets else if (openSocialManager.GetPageName().Equals("edit/default.aspx")) { return("home"); } else if (openSocialManager.GetPageName().Equals("profile/display.aspx")) { return("profile"); } else if (openSocialManager.GetPageName().Equals("orng/gadgetdetails.aspx")) { return("canvas"); } else if (gadgetSpec.GetGadgetURL().Contains("Tool")) { return("small"); } else { return(null); } }
// tool gadgets public PreparedGadget(GadgetSpec gadgetSpec, OpenSocialManager openSocialManager) { this.gadgetSpec = gadgetSpec; this.openSocialManager = openSocialManager; this.securityToken = SocketSendReceive(openSocialManager.GetViewerURI(), openSocialManager.GetOwnerURI(), gadgetSpec.GetGadgetURL()); // look at the view requirements and what page we are on to set some things GadgetViewRequirements viewReqs = GetGadgetViewRequirements(); if (viewReqs != null) { this.view = viewReqs.GetView(); this.chromeId = viewReqs.GetChromeId(); this.optParams = viewReqs.GetOptParams(); } else // must be a sandbox gadget { this.view = ""; this.chromeId = "gadgets-test-" + gadgetSpec.GetAppId(); this.optParams = "{}"; } }
// tool gadgets public PreparedGadget(GadgetSpec gadgetSpec, OpenSocialManager openSocialManager) { this.gadgetSpec = gadgetSpec; this.openSocialManager = openSocialManager; this.securityToken = openSocialManager.GetSecurityToken(gadgetSpec.GetGadgetURL()); // look at the view requirements and what page we are on to set some things GadgetViewRequirements viewReqs = GetGadgetViewRequirements(); if (viewReqs != null) { this.view = viewReqs.GetView(); this.chromeId = viewReqs.GetChromeIdBase() + "-" + GetAppId(); this.optParams = viewReqs.GetOptParams(); } else // must be a sandbox gadget { this.view = "sandbox"; this.chromeId = "gadgets-sandbox-" + GetAppId(); this.optParams = "{}"; } }