public void TopMostNodeIds_ReturnsUniqueIdsOfRootNodes()
        {
            // Lacks testing of sorting

            // Root
            Assert.IsTrue(
                new[] { new Guid("916724A5-173D-4619-B97E-B9DE133DD6F5") }
                .SequenceEqual(CMSNode.TopMostNodeIds(new Guid(RootObjectTypeId)))
                );

            // Content
            EnsureTestDocumentTypes();
            var nodes = CreateContent();

            try
            {
                Assert.IsTrue(
                    new[] { nodes[0].UniqueId }
                    .SequenceEqual(CMSNode.TopMostNodeIds(Document._objectType))
                    );
            }
            finally
            {
                for (var i = nodes.Count - 1; i >= 0; i--)
                {
                    nodes[i].delete();
                }
                DeleteContent();
            }
        }
예제 #2
0
        public static Template[] getAll()
        {
            Guid[] ids = CMSNode.TopMostNodeIds(_objectType);

            SortedList initRetVal = new SortedList();

            for (int i = 0; i < ids.Length; i++)
            {
                Template t = new Template(ids[i]);
                initRetVal.Add(t.Text + t.UniqueId, t);
            }

            Template[] retVal = new Template[ids.Length];

            IDictionaryEnumerator ide = initRetVal.GetEnumerator();

            int count = 0;

            while (ide.MoveNext())
            {
                retVal[count] = (Template)ide.Value;
                count++;
            }

            return(retVal);
        }
예제 #3
0
 public static StyleSheet[] GetAll()
 {
     Guid[]       topNodeIds = CMSNode.TopMostNodeIds(moduleObjectType);
     StyleSheet[] retval     = new StyleSheet[topNodeIds.Length];
     for (int i = 0; i < topNodeIds.Length; i++)
     {
         retval[i] = new StyleSheet(topNodeIds[i]);
     }
     return(retval);
 }
예제 #4
0
파일: Media.cs 프로젝트: KerwinMa/justEdit-
        /// <summary>
        /// Retrieve a list of all toplevel medias and folders
        /// </summary>
        /// <returns></returns>
        public static Media[] GetRootMedias()
        {
            Guid[] topNodeIds = CMSNode.TopMostNodeIds(_objectType);

            Media[] retval = new Media[topNodeIds.Length];
            for (int i = 0; i < topNodeIds.Length; i++)
            {
                Media d = new Media(topNodeIds[i]);
                retval[i] = d;
            }
            return(retval);
        }
예제 #5
0
        public static List <Template> GetAllAsList()
        {
            Guid[]          ids    = CMSNode.TopMostNodeIds(_objectType);
            List <Template> retVal = new List <Template>();

            foreach (Guid id in ids)
            {
                retVal.Add(new Template(id));
            }
            retVal.Sort(delegate(Template t1, Template t2) { return(t1.Text.CompareTo(t2.Text)); });
            return(retVal);
        }
예제 #6
0
        public static StyleSheet[] GetAll()
        {
            var dbStylesheets = new ArrayList();

            var topNodeIds = CMSNode.TopMostNodeIds(ModuleObjectType);

            //StyleSheet[] retval = new StyleSheet[topNodeIds.Length];
            for (int i = 0; i < topNodeIds.Length; i++)
            {
                //retval[i] = new StyleSheet(topNodeIds[i]);
                dbStylesheets.Add(new StyleSheet(topNodeIds[i]).Text.ToLower());
            }

            var fileStylesheets = new ArrayList();
            var fileListing     = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Css + "/"));

            foreach (var file in fileListing.GetFiles("*.css"))
            {
                if (!dbStylesheets.Contains(file.Name.Replace(file.Extension, "").ToLower()))
                {
                    fileStylesheets.Add(file.Name.Replace(file.Extension, ""));
                }
            }

            var retval = new StyleSheet[dbStylesheets.Count + fileStylesheets.Count];

            for (int i = 0; i < topNodeIds.Length; i++)
            {
                retval[i] = new StyleSheet(topNodeIds[i]);
            }

            for (int i = 0; i < fileStylesheets.Count; i++)
            {
                string content = string.Empty;

                using (StreamReader re = File.OpenText(IOHelper.MapPath(string.Format("{0}/{1}.css", SystemDirectories.Css, fileStylesheets[i]))))
                {
                    content = re.ReadToEnd();
                }

                retval[dbStylesheets.Count + i] = StyleSheet.MakeNew(new umbraco.BusinessLogic.User(0), fileStylesheets[i].ToString(), fileStylesheets[i].ToString(), content);
            }


            Array.Sort(retval, 0, retval.Length, new StyleSheetComparer());

            return(retval);
        }