private void DrawProfilesModule()
 {
     if (gadget == null || !om.IsVisible())
     {
         pnlSecurityOptions.Visible = false;
         litGadget.Text             = "This feature is currently turned off on your system";
     }
     else if (gadget.RequiresRegistration() && !data.IsRegistered(uri, appId))
     {
         pnlSecurityOptions.Visible = false;
         litGadget.Text             = gadget.GetUnavailableMessage();
     }
     else
     {
         litGadget.Text = "<div id='" + gadget.GetChromeId() + "' class='gadgets-gadget-parent'></div>";
         om.LoadAssets();
     }
 }
Example #2
0
        private void DrawProfilesModule()
        {
            List <GenericListItem> gli = new List <GenericListItem>();
            bool canedit = false;

            Profile.Utilities.DataIO    data = new Profiles.Profile.Utilities.DataIO();
            List <List <SecurityItem> > si   = new List <List <SecurityItem> >();
            List <SecurityItem>         singlesi;

            this.Dropdown     = new List <GenericListItem>();
            this.PropertyList = data.GetPropertyList(this.BaseData, base.PresentationXML, "", true, true, false);

            this.Subject = Convert.ToInt64(Request.QueryString["subject"]);

            this.SecurityGroups = new XmlDocument();
            this.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);

            litBackLink.Text = "<b>Edit Menu</b>";

            Profiles.ORNG.Utilities.DataIO orngData = new Profiles.ORNG.Utilities.DataIO();

            foreach (XmlNode group in this.PropertyList.SelectNodes("//PropertyList/PropertyGroup"))
            {
                singlesi = new List <SecurityItem>();

                foreach (XmlNode node in group.SelectNodes("Property"))
                {
                    if (node.SelectSingleNode("@EditExisting").Value == "false" &&
                        node.SelectSingleNode("@EditAddExisting").Value == "false" &&
                        node.SelectSingleNode("@EditAddNew").Value == "false" &&
                        node.SelectSingleNode("@EditDelete").Value == "false")
                    {
                        canedit = false;
                    }
                    else
                    {
                        canedit = true;
                    }

                    // treat ORNG items as "special", because they may not be available and they may be turned off
                    if (node.SelectSingleNode("@URI").Value.StartsWith(Profiles.ORNG.Utilities.OpenSocialManager.ORNG_ONTOLOGY_PREFIX))
                    {
                        GadgetSpec spec = OpenSocialManager.GetGadgetByPropertyURI(node.SelectSingleNode("@URI").Value);
                        if (spec != null && spec.RequiresRegitration() && !orngData.IsRegistered(this.Subject, spec.GetAppId()))
                        {
                            singlesi.Add(new SecurityItem(node.ParentNode.SelectSingleNode("@Label").Value, node.SelectSingleNode("@Label").Value,
                                                          node.SelectSingleNode("@URI").Value,
                                                          Convert.ToInt32(node.SelectSingleNode("@NumberOfConnections").Value),
                                                          Convert.ToInt32(node.SelectSingleNode("@ViewSecurityGroup").Value),
                                                          "Unavailable",
                                                          node.SelectSingleNode("@ObjectType").Value, canedit));
                            continue;
                        }
                        else if (spec != null && "0".Equals(node.SelectSingleNode("@NumberOfConnections").Value))
                        {
                            singlesi.Add(new SecurityItem(node.ParentNode.SelectSingleNode("@Label").Value, node.SelectSingleNode("@Label").Value,
                                                          node.SelectSingleNode("@URI").Value,
                                                          Convert.ToInt32(node.SelectSingleNode("@NumberOfConnections").Value),
                                                          Convert.ToInt32(node.SelectSingleNode("@ViewSecurityGroup").Value),
                                                          "Hidden",
                                                          node.SelectSingleNode("@ObjectType").Value, canedit));
                            continue;
                        }
                    }

                    singlesi.Add(new SecurityItem(node.ParentNode.SelectSingleNode("@Label").Value, node.SelectSingleNode("@Label").Value,
                                                  node.SelectSingleNode("@URI").Value,
                                                  Convert.ToInt32(node.SelectSingleNode("@NumberOfConnections").Value),
                                                  Convert.ToInt32(node.SelectSingleNode("@ViewSecurityGroup").Value),
                                                  this.SecurityGroups.SelectSingleNode("SecurityGroupList/SecurityGroup[@ID='" + node.SelectSingleNode("@ViewSecurityGroup").Value + "']/@Label").Value,
                                                  node.SelectSingleNode("@ObjectType").Value, canedit));
                }
                si.Add(singlesi);
            }

            foreach (XmlNode securityitem in this.SecurityGroups.SelectNodes("SecurityGroupList/SecurityGroup"))
            {
                this.Dropdown.Add(new GenericListItem(securityitem.SelectSingleNode("@Label").Value,
                                                      securityitem.SelectSingleNode("@ID").Value));

                gli.Add(new GenericListItem(securityitem.SelectSingleNode("@Label").Value, securityitem.SelectSingleNode("@Description").Value));
            }
            gli.Add(new GenericListItem("Unavailable", "This feature depends on automatically collected data that we do not have for your Profile."));

            repPropertyGroups.DataSource = si;
            repPropertyGroups.DataBind();

            BuildSecurityKey(gli);

            // OpenSocial.  Allows gadget developers to show test gadgets if you have them installed
            string            uri = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value;
            OpenSocialManager om  = OpenSocialManager.GetOpenSocialManager(uri, Page, true);

            if (om.IsVisible())
            {
                litGadget.Visible = true;
                string sandboxDivs = "";
                foreach (PreparedGadget gadget in om.GetSandboxGadgets())
                {
                    sandboxDivs += "<div id='" + gadget.GetChromeId() + "' class='gadgets-gadget-parent'></div>";
                }
                litGadget.Text = sandboxDivs;
                om.LoadAssets();
            }
        }