private MoveableType.Category InternalGetFrontPageCategory() { MoveableType.Category mcat = new MoveableType.Category(); mcat.categoryId = "Front Page"; mcat.categoryName = "Front Page"; //mcat.isPrimary = true; return(mcat); }
public MoveableType.Category[] mt_getPostCategories(string postid, string username, string password) { if (!_dasBlogSettings.SiteConfiguration.EnableBloggerApi) { throw new ServiceDisabledException(); } UserToken token = _siteSecurity.Login(username, password); if (token == null) { throw new SecurityException(); } MoveableType.Category[] mcats = InternalGetCategoryList(); Entry entry = _dataService.GetEntry(postid); if (entry != null) { List <MoveableType.Category> acats = new List <MoveableType.Category>(); string[] cats = entry.GetSplitCategories(); if (cats.Length > 0) { foreach (string cat in cats) { foreach (MoveableType.Category mcat in mcats) { if (cat == mcat.categoryId) { MoveableType.Category cpcat = mcat; cpcat.isPrimary = (acats.Count == 0); acats.Add(cpcat); break; } } } } if (acats.Count == 0) { acats.Add(InternalGetFrontPageCategory()); } return(acats.ToArray()); } else { return(null); } }
public MoveableType.Category[] InternalGetCategoryList() { List <MoveableType.Category> arrayList = new List <MoveableType.Category>(); CategoryCacheEntryCollection categories = _dataService.GetCategories(); if (categories.Count == 0) { arrayList.Add(InternalGetFrontPageCategory()); } else { foreach (CategoryCacheEntry catEntry in categories) { MoveableType.Category category = new MoveableType.Category(); category.categoryId = NoNull(catEntry.Name); category.categoryName = NoNull(catEntry.Name); //category.isPrimary=false; arrayList.Add(category); } } return(arrayList.ToArray()); }