Ejemplo n.º 1
0
        public BlogInfo[] GetUsersBlogs(String key, String emailAddress, String password)
        {
            if (this.Reporter.Initialized)
            {
                this.Reporter.SendSingle(new Object[] { key, emailAddress, password }, "XmlRpcApi::GetUsersBlogs", false);
            }
            //+
            List <BlogMetaData> blogList = BlogAgent.GetBlogListForAssociatedAuthor(emailAddress, password);

            //+
            Themelia.Map webDomainPathMap = new Themelia.Map();
            foreach (WebDomainData webDomainData in WebDomainDataList.AllWebDomainData)
            {
                ComponentData data = webDomainData.ComponentDataList[Info.MinimaKey];
                if (data != null)
                {
                    ParameterData parameterData = data.ParameterDataList[Info.BlogGuid];
                    if (parameterData != null)
                    {
                        String blogGuid = parameterData.Value;
                        if (!webDomainPathMap.ContainsKey(blogGuid))
                        {
                            webDomainPathMap.Add(blogGuid, webDomainData.Path);
                        }
                        else
                        {
                            throw new InvalidOperationException("Only one MinimaComponent may use a particular blog guid on a web site.  Minima web controls in other web domains may reference the web domain for a particular blog guid in order to access that blog.  Also, make sure that only the MinimaComponent component is using the \"Minima\" Key.");
                        }
                    }
                }
            }
            List <String> registeredBlogGuidList = webDomainPathMap.GetKeyList();

            //+
            BlogInfo[] netBlogList = (from b in blogList
                                      where registeredBlogGuidList.Contains(b.Guid)
                                      select new BlogInfo
            {
                blogid = b.Guid,
                blogName = b.Title,
                url = Themelia.Web.WebDomain.GetUrl(webDomainPathMap[b.Guid])
            }).ToArray();
            //+
            return(netBlogList);
        }