Example #1
0
        public string Update(int pageId, string body, string title, string keywords)
        {
            var currentMemberId = Members.GetCurrentMember().Id;
            var isAdmin         = (Xslt.IsInGroup("admin") || Xslt.IsInGroup("wiki editor"));

            if (pageId > 0 && currentMemberId > 0 && body.Trim() != "" && title.Trim() != "")
            {
                var wikiPage = new WikiPage(pageId);

                if (wikiPage.Exists && (isAdmin || wikiPage.Locked == false))
                {
                    wikiPage.Title    = title;
                    wikiPage.Author   = currentMemberId;
                    wikiPage.Body     = body;
                    wikiPage.Keywords = keywords;
                    wikiPage.Save();

                    return(umbraco.library.NiceUrl(wikiPage.NodeId));
                }

                return("not allowed " + isAdmin + " " + wikiPage.Locked + " " + wikiPage.Exists);
            }

            return("");
        }
Example #2
0
        public string Create(int parentId, string body, string title, string keywords)
        {
            var currentMemberId = Members.GetCurrentMember().Id;

            if (parentId > 0 && currentMemberId > 0)
            {
                var isAdmin  = (Xslt.IsInGroup("admin") || Xslt.IsInGroup("wiki editor"));
                var doc      = new Document(parentId);
                var isLocked = (doc.getProperty("umbracoNoEdit").Value.ToString() == "1");

                if ((isAdmin || isLocked == false) && doc.ContentType.Alias == "WikiPage")
                {
                    var wikiPage = WikiPage.Create(parentId, currentMemberId, body, title, keywords);
                    return(umbraco.library.NiceUrl(wikiPage.NodeId));
                }
            }

            return("");
        }