Exemplo n.º 1
0
 public ORNGRPCService(string uri, Page page, bool editMode)
 {
     this.om = OpenSocialManager.GetOpenSocialManager(uri, page, false);
     // Add to Session so that it does not get prematurely garbage collected
     HttpContext.Current.Session[KEY_PREFIX + ":" + om.GetGuid().ToString()] = this;
     managers.Add(new WeakReference(this));
 }
Exemplo n.º 2
0
 public ORNGRPCService(string uri, Page page, bool editMode)
 {
     this.om = OpenSocialManager.GetOpenSocialManager(uri, page, false);
     // Add to Session so that it does not get prematurely garbage collected
     HttpContext.Current.Session[KEY_PREFIX + ":" + om.GetGuid().ToString()] = this;
     managers.Add(new WeakReference(this));
 }
Exemplo n.º 3
0
 public PreparedGadget(GadgetSpec gadgetSpec, OpenSocialManager openSocialManager, int moduleId, string securityToken)
 {
     this.gadgetSpec        = gadgetSpec;
     this.openSocialManager = openSocialManager;
     this.moduleId          = moduleId;
     this.securityToken     = securityToken;
 }
Exemplo n.º 4
0
 public ORNGCallbackResponder(string uri, Page page, bool editMode, string request)
 {
     this.om = OpenSocialManager.GetOpenSocialManager(uri, page, editMode, false);
     this.requestToRespondTo = request;
     // Add to Session so that it does not get prematurely garbage collected
     HttpContext.Current.Session[KEY_PREFIX + requestToRespondTo + ":" + om.GetGuid().ToString()] = this;
     managers.Add(new WeakReference(this));
 }
 public ORNGCallbackResponder(string uri, Page page, bool editMode, string request)
 {
     this.om = OpenSocialManager.GetOpenSocialManager(uri, page, editMode, false);
     this.requestToRespondTo = request;
     // Add to Session so that it does not get prematurely garbage collected
     HttpContext.Current.Session[KEY_PREFIX + requestToRespondTo + ":" + om.GetGuid().ToString()] = this;
     managers.Add(new WeakReference(this));
 }
Exemplo n.º 6
0
 // OntologyGadgets
 public PreparedGadget(GadgetSpec gadgetSpec, OpenSocialManager openSocialManager, string view, string optParams, string chromeId)
 {
     this.gadgetSpec        = gadgetSpec;
     this.openSocialManager = openSocialManager;
     this.securityToken     = SocketSendReceive(openSocialManager.GetViewerURI(), openSocialManager.GetOwnerURI(), gadgetSpec.GetGadgetURL());
     this.view      = view;
     this.chromeId  = chromeId;
     this.optParams = optParams == null || optParams.Trim() == string.Empty ? "{}" : optParams;
 }
Exemplo n.º 7
0
 // OntologyGadgets
 public PreparedGadget(GadgetSpec gadgetSpec, OpenSocialManager openSocialManager, string view, string optParams)
 {
     this.gadgetSpec        = gadgetSpec;
     this.openSocialManager = openSocialManager;
     this.securityToken     = openSocialManager.GetSecurityToken(gadgetSpec.GetGadgetURL());
     this.view      = view;
     this.chromeId  = "gadgets-ontology-" + GetAppId();
     this.optParams = optParams == null || optParams.Trim() == string.Empty ? "{}" : optParams;
 }
Exemplo n.º 8
0
 public ORNGRPCService(string uri, Page page, bool editMode, string[] chnls)
 {
     this.om = OpenSocialManager.GetOpenSocialManager(uri, page, false);
     this.channels.AddRange(chnls);
     // Add to Session so that it does not get prematurely garbage collected
     HttpContext.Current.Session[KEY_PREFIX + ":" + om.GetGuid().ToString()] = this;
     managers.Add(new WeakReference(this));
     DebugLogging.Log("ORNGRPCService created :" + om.GetGuid().ToString() + " channels " + this.channels.ToString());
 }
Exemplo n.º 9
0
        public void RemovePersonalGadget(long Subject, string propertyURI)
        {
            GadgetSpec spec = OpenSocialManager.GetGadgetByPropertyURI(propertyURI);

            if (spec != null)
            {
                RemovePersonalGadget(Subject, spec.GetAppId());
            }
        }
Exemplo n.º 10
0
 public ORNGRPCService(string uri, Page page, bool editMode, string[] chnls)
 {
     this.om = OpenSocialManager.GetOpenSocialManager(uri, page, false);
     this.channels.AddRange(chnls);
     // Add to Session so that it does not get prematurely garbage collected
     HttpContext.Current.Session[KEY_PREFIX + ":" + om.GetGuid().ToString()] = this;
     managers.Add(new WeakReference(this));
     DebugLogging.Log("ORNGRPCService created :" + om.GetGuid().ToString() + " channels " + this.channels.ToString());
 }
 public ViewPersonalGadget(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
     : base(pagedata, moduleparams, pagenamespaces)
 {
     // code to convert from numeric node ID to URI
     if (base.Namespaces.HasNamespace("rdf"))
     {
         XmlNode node = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces);
         uri = node != null ? node.Value : null;
     }
     om = OpenSocialManager.GetOpenSocialManager(uri, Page);
     gadget = om.AddGadget(Convert.ToInt32(base.GetModuleParamString("AppId")), base.GetModuleParamString("View"), base.GetModuleParamString("OptParams"));
 }
Exemplo n.º 12
0
 public Gadgets(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
     : base(pagedata, moduleparams, pagenamespaces)
 {
     string uri = null;
     // code to convert from numeric node ID to URI
     if (base.Namespaces.HasNamespace("rdf"))
     {
         XmlNode node = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces);
         uri = node != null ? node.Value : null;
     }
     om = OpenSocialManager.GetOpenSocialManager(uri, Page, false, true);
 }
 public Gadgets(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
     : base(pagedata, moduleparams, pagenamespaces)
 {
     string uri = "";// null;
     // code to convert from numeric node ID to URI
     if (base.Namespaces.HasNamespace("rdf"))
     {
         XmlNode node = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces);
         uri = node != null ? node.Value : null;
         // we know the structure of the URI and need to take advantage of that
         if (uri != null && uri.StartsWith(Root.Domain + "/profile/"))
         {
             string suffix = uri.Substring((Root.Domain + "/profile/").Length);
             uri = Root.Domain + "/profile/" + suffix.Split('/')[0];
         }
     }
     om = OpenSocialManager.GetOpenSocialManager(uri, Page);
 }
Exemplo n.º 14
0
        // 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 = "{}";
            }
        }
Exemplo n.º 15
0
        // 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 = "{}";
            }
        }
Exemplo n.º 16
0
        // OK to cache as long as dependency is working!
        public string GetRegistryDefinedVisiblity(string ownerUri)
        {
            if (ownerUri == null || ownerUri.Trim().Length == 0)
            {
                return(null);
            }

            Dictionary <int, string> registeredApps = (Dictionary <int, string>)Framework.Utilities.Cache.FetchObject(REGISTERED_APPS_CACHE_PREFIX + ownerUri);

            if (registeredApps == null)
            {
                registeredApps = new Dictionary <int, string>();
                Profiles.ORNG.Utilities.DataIO data = new Profiles.ORNG.Utilities.DataIO();

                using (SqlDataReader dr = data.GetRegisteredApps(ownerUri))
                {
                    while (dr.Read())
                    {
                        registeredApps[dr.GetInt32(0)] = dr.GetString(1);
                    }
                }

                Framework.Utilities.Cache.Set(REGISTERED_APPS_CACHE_PREFIX + ownerUri, registeredApps, OpenSocialManager.GetNodeID(ownerUri), null);
            }

            return(registeredApps.ContainsKey(GetAppId()) ? registeredApps[GetAppId()] : null);
        }
 public ViewPersonalGadget(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
     : base(pagedata, moduleparams, pagenamespaces)
 {
     // code to convert from numeric node ID to URI
     if (base.Namespaces.HasNamespace("rdf"))
     {
         XmlNode node = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces);
         uri = node != null ? node.Value : null;
     }
     om = OpenSocialManager.GetOpenSocialManager(uri, Page);
     gadget = om.AddGadget(Convert.ToInt32(base.GetModuleParamString("AppId")), base.GetModuleParamString("View"), base.GetModuleParamString("OptParams"));
     // for some reason doing this in DrawProfilesModule (remove that???) fails!
     new ORNGProfileRPCService(Page, this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/foaf:firstName", base.Namespaces).InnerText, uri);
 }
 public string getCallbackResponse(OpenSocialManager om, string channel)
 {
     return OpenSocialManager.BuildJSONPersonIds(uri, "one person");
 }
Exemplo n.º 19
0
 public SearchGadgets(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
     : base(pagedata, moduleparams, pagenamespaces)
 {
     om = OpenSocialManager.GetOpenSocialManager(null, Page);
 }
            public string getCallbackResponse(OpenSocialManager om, string channel)
            {
                try
                {
                    searchRequest.SelectSingleNode("/SearchOptions/OutputOptions/Limit").InnerText = "500";
                    XmlDocument searchData = new Profiles.Search.Utilities.DataIO().Search(searchRequest, false, false);

                    List<string> peopleURIs = new List<string>();
                    XmlNodeList people = searchData.GetElementsByTagName("rdf:object");
                    for (int i = 0; i < people.Count; i++)
                    {
                        peopleURIs.Add(people[i].Attributes["rdf:resource"].Value);
                    }
                    if (peopleURIs.Count > 0)
                    {
                        return OpenSocialManager.BuildJSONPersonIds(peopleURIs, "" + peopleURIs.Count + " people found");
                    }
                }
                catch (Exception e)
                {
                    DebugLogging.Log(e.Message);
                }

                return null;
            }
Exemplo n.º 21
0
        // OK to cache as long as dependency is working!
        // think about this, as this is now only set manually via DB
        public bool IsRegistered(string ownerUri)
        {
            if (ownerUri == null || ownerUri.Trim().Length == 0)
            {
                return(false);
            }

            HashSet <int> registeredApps = (HashSet <int>)Framework.Utilities.Cache.FetchObject(REGISTERED_APPS_CACHE_PREFIX + ownerUri);

            if (registeredApps == null)
            {
                registeredApps = new HashSet <int>();
                Profiles.ORNG.Utilities.DataIO data = new Profiles.ORNG.Utilities.DataIO();

                using (SqlDataReader dr = data.GetRegisteredApps(ownerUri))
                {
                    while (dr.Read())
                    {
                        registeredApps.Add(dr.GetInt32(0));
                    }
                }

                Framework.Utilities.Cache.Set(REGISTERED_APPS_CACHE_PREFIX + ownerUri, registeredApps, OpenSocialManager.GetNodeID(ownerUri), null);
            }

            return(registeredApps.Contains(GetAppId()));
        }
        public EditPersonalGadget(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            SessionManagement sm = new SessionManagement();
            base.BaseData = pagedata;

            data = new Profiles.ORNG.Utilities.DataIO();
            Profiles.Edit.Utilities.DataIO editdata = new Profiles.Edit.Utilities.DataIO();
            Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO();

            if (Request.QueryString["subject"] != null)
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            else if (base.GetRawQueryStringItem("subject") != null)
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            else
                Response.Redirect("~/search");

            this.PredicateURI = Request.QueryString["predicateuri"].Replace("!", "#");
            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, this.PredicateURI, false, true, false);
            litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> &gt; <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>";

            //create a new network triple request.
            base.RDFTriple = new RDFTriple(this.SubjectID, editdata.GetStoreNode(this.PredicateURI));

            base.RDFTriple.Expand = true;
            base.RDFTriple.ShowDetails = true;
            base.GetDataByURI();//This will reset the data to a Network.

            // Profiles OpenSocial Extension by UCSF
            uri = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value;
            uri = uri.Substring(0, uri.IndexOf(Convert.ToString(this.SubjectID)) + Convert.ToString(this.SubjectID).Length);
            appId = Convert.ToInt32(base.GetModuleParamString("AppId"));
            om = OpenSocialManager.GetOpenSocialManager(uri, Page, true);
            gadget = om.AddGadget(appId, base.GetModuleParamString("View"), base.GetModuleParamString("OptParams"));

            securityOptions.Subject = this.SubjectID;
            securityOptions.PredicateURI = this.PredicateURI;
            securityOptions.PrivacyCode = "0".Equals(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/@NumberOfConnections").Value) ?
                0 : Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDataDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);
        }