Exemple #1
0
        public Blogger.Category[] blogger_getCategories(string blogid, string username, string password)
        {
            VerifyAccess(username, password);

            var arrayList  = new List <Blogger.Category>();
            var categories = dataService.GetCategories();

            if (categories.Count == 0)
            {
                var bcat = new Blogger.Category();
                bcat.categoryid  = "Front Page";
                bcat.description = "Front Page";
                bcat.htmlUrl     = dasBlogSettings.GetCategoryViewUrl(bcat.categoryid);
                bcat.rssUrl      = dasBlogSettings.GetCategoryViewUrl(bcat.categoryid);
                bcat.title       = NoNull(bcat.description);
                arrayList.Add(bcat);
            }
            else
            {
                foreach (CategoryCacheEntry cat in categories)
                {
                    var bcat = new Blogger.Category();
                    bcat.categoryid  = NoNull(cat.Name);
                    bcat.description = NoNull(cat.Name);
                    bcat.htmlUrl     = dasBlogSettings.GetCategoryViewUrl(cat.Name);
                    bcat.rssUrl      = dasBlogSettings.GetCategoryViewUrl(cat.Name);                 //Should this be GetRssCategoryUrl()
                    bcat.title       = NoNull(cat.Name);
                    arrayList.Add(bcat);
                }
            }
            return(arrayList.ToArray());
        }
Exemple #2
0
        public Blogger.Category[] blogger_getCategories(string blogid, string username, string password)
        {
            if (!dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }

            if (!VerifyLogin(username, password))
            {
                throw new SecurityException();
            }

            var arrayList  = new List <Blogger.Category>();
            var categories = dataService.GetCategories();

            if (categories.Count == 0)
            {
                var bcat = new Blogger.Category();
                bcat.categoryid  = "Front Page";
                bcat.description = "Front Page";
                bcat.htmlUrl     = dasBlogSettings.GetCategoryViewUrl(bcat.categoryid);
                bcat.rssUrl      = dasBlogSettings.GetCategoryViewUrl(bcat.categoryid);
                bcat.title       = NoNull(bcat.description);
                arrayList.Add(bcat);
            }
            else
            {
                foreach (CategoryCacheEntry cat in categories)
                {
                    var bcat = new Blogger.Category();
                    bcat.categoryid  = NoNull(cat.Name);
                    bcat.description = NoNull(cat.Name);
                    bcat.htmlUrl     = dasBlogSettings.GetCategoryViewUrl(cat.Name);
                    bcat.rssUrl      = dasBlogSettings.GetCategoryViewUrl(cat.Name);                 //Should this be GetRssCategoryUrl()
                    bcat.title       = NoNull(cat.Name);
                    arrayList.Add(bcat);
                }
            }
            return(arrayList.ToArray());
        }