예제 #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("");
        }
예제 #2
0
        public string Rollback(int pageId, string guid)
        {
            var currentMemberId = Members.GetCurrentMember().Id;
            var olddoc          = new Document(pageId, new Guid(guid));
            var wikiPage        = new WikiPage(pageId);

            if (olddoc != null && wikiPage.Exists && !wikiPage.Locked && currentMemberId > 0 && wikiPage.Version.ToString() != guid)
            {
                wikiPage.Body   = olddoc.getProperty("bodyText").Value.ToString();
                wikiPage.Title  = olddoc.Text;
                wikiPage.Author = currentMemberId;
                wikiPage.Save();

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

            return("");
        }
예제 #3
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 "";
        }
예제 #4
0
        public string Rollback(int pageId, string guid)
        {
            var currentMemberId = Members.GetCurrentMember().Id;
            var olddoc = new Document(pageId, new Guid(guid));
            var wikiPage = new WikiPage(pageId);

            if (olddoc != null && wikiPage.Exists && !wikiPage.Locked && currentMemberId > 0 && wikiPage.Version.ToString() != guid)
            {

                wikiPage.Body = olddoc.getProperty("bodyText").Value.ToString();
                wikiPage.Title = olddoc.Text;
                wikiPage.Author = currentMemberId;
                wikiPage.Save();

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

            return "";
        }