Esempio n. 1
0
 static OpenSocialManager()
 {
     if (ORNGSettings.getSettings().Enabled)
     {
         shindigURL = ORNGSettings.getSettings().ShindigURL;
         features   = ORNGSettings.getSettings().Features;
         PreparedGadget.Init();
     }
 }
Esempio n. 2
0
        internal static void Init()
        {
            string[] tokenService = ORNGSettings.getSettings().TokenService.Split(':');
            int      min          = ORNGSettings.getSettings().SocketPoolMin;
            int      max          = ORNGSettings.getSettings().SocketPoolMax;
            int      expire       = ORNGSettings.getSettings().SocketPoolExpire;
            int      timeout      = ORNGSettings.getSettings().SocketReceiveTimeout;

            sockets = new SocketConnectionPool(tokenService[0], Int32.Parse(tokenService[1]), min, max, expire, timeout);
        }
        static OpenSocialManager()
        {
            if (ORNGSettings.getSettings().Enabled)
            {
                shindigURL = ORNGSettings.getSettings().ShindigURL;
                features = ORNGSettings.getSettings().Features;

                string[] tokenService = ORNGSettings.getSettings().TokenService.Split(':');
                int min = ORNGSettings.getSettings().SocketPoolMin;
                int max = ORNGSettings.getSettings().SocketPoolMax;
                int expire = ORNGSettings.getSettings().SocketPoolExpire;
                int timeout = ORNGSettings.getSettings().SocketReceiveTimeout;

                sockets = new SocketConnectionPool(tokenService[0], Int32.Parse(tokenService[1]), min, max, expire, timeout);
            }
        }
        private OpenSocialManager(string ownerUri, Page page, bool editMode)
        {
            if (!ORNGSettings.getSettings().Enabled)
            {
                // do nothing
                return;
            }
            this.guid = Guid.NewGuid();
            this.isDebug = page.Session != null && page.Session[ORNG_DEBUG] != null && (bool)page.Session[ORNG_DEBUG];
            this.noCache = page.Session != null && page.Session[ORNG_NOCACHE] != null && (bool)page.Session[ORNG_NOCACHE];
            this.page = page;
            this.pageName = page.AppRelativeVirtualPath.Substring(2).ToLower();
            this.ownerUri = ownerUri;

            DebugLogging.Log("Creating OpenSocialManager " + this.guid.ToString() + " for " + ownerUri + ", " + pageName);

    		// in editMode we need to set the viewer to be the same as the owner
	    	// otherwise, the gadget will not be able to save appData correctly            
            if (editMode)
            {
                viewerUri = ownerUri;
            }
            else
            {
                Profiles.Framework.Utilities.SessionManagement sm = new Profiles.Framework.Utilities.SessionManagement();
                // if they have a Profile, use the Profile URI otherwise use the User URI.  This allows admins and other folks without profile pages to use gadgets
                if (sm.Session().PersonURI != null && sm.Session().PersonURI.Trim().Length > 0)
                {
                    viewerUri = sm.Session().PersonURI;
                }
                else 
                {
                    viewerUri = sm.Session().UserURI;
                }
                if (viewerUri != null && viewerUri.Trim().Length == 0)
                {
                    viewerUri = null;
                }
            }
            containerSecurityToken = SocketSendReceive(viewerUri, ownerUri, null);

            string requestAppId = page.Request.QueryString["appId"];
            foreach (GadgetSpec gadgetSpec in GetGadgetSpecifications())
            {
                // only add ones that are visible in this context!
                if (((requestAppId == null && gadgetSpec.IsEnabled()) || gadgetSpec.GetAppId() == Convert.ToInt32(requestAppId)) && gadgetSpec.Show(viewerUri, ownerUri, GetPageName()))
                {
                    gadgets.Add(new PreparedGadget(gadgetSpec, this));
                }
            }

            // if we are in edit mode, clear the cache
            if (editMode)
            {
                ClearOwnerCache();
            }

            // sort the gadgets
            DebugLogging.Log("Visible Gadget Count : " + gadgets.Count);
            gadgets.Sort();
        }