Exemple #1
0
        public void VersionShow(int id)
        {
            PageHistory ph = pageService.GetHistory(id);

            if (ph == null)
            {
                echo(lang("exDataNotFound"));
                return;
            }

            Page page = pageService.GetPostById(ph.PageId, ctx.owner.obj);

            if (page == null)
            {
                echo(lang("exDataNotFound"));
                return;
            }

            set("postTitle", page.Title);
            set("editorUrl", toUser(ph.EditUser));
            set("pageLink", to(Show, page.Id));

            bind("post", ph);
            bindSidebar(page);
        }
Exemple #2
0
        private static void saveHistory(Page p)
        {
            PageHistory ph = new PageHistory();

            ph.PageId     = p.Id;
            ph.EditReason = p.EditReason;
            ph.EditUser   = p.EditUser;
            ph.Content    = p.Content;
            ph.insert();
        }
 public void goBack()
 {
     if (CurrentPageID > 1)
     {
         Page prevPage;
         PageHistory.TryGetValue(--CurrentPageID, out prevPage);
         CurrentPage = prevPage;
         Navigate(CurrentPage);
     }
 }
Exemple #4
0
        public virtual DataPage <PageHistory> GetHistoryPage(long pageId, IMember owner, int pageSize)
        {
            Page p = GetPostById(pageId, owner);

            if (p == null)
            {
                return(DataPage <PageHistory> .GetEmpty());
            }
            return(PageHistory.findPage("PageId=" + pageId, pageSize));
        }
Exemple #5
0
        // POST: odata/PageHistories
        public async Task <IHttpActionResult> Post(PageHistory pageHistory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PageHistories.Add(pageHistory);
            await db.SaveChangesAsync();

            return(Created(pageHistory));
        }
Exemple #6
0
        // DELETE: odata/PageHistories(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] short key)
        {
            PageHistory pageHistory = await db.PageHistories.FindAsync(key);

            if (pageHistory == null)
            {
                return(NotFound());
            }

            db.PageHistories.Remove(pageHistory);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #7
0
        /// <summary>
        /// Asyncronously instantiate a PageContent object, replaces constructor
        /// </summary>
        /// <param name="url">The URL of the first page to open on instantiation</param>
        /// <param name="singletonHistory">Reference to the history object to manage updating the list</param>
        /// <returns></returns>
        public static async Task <PageContent> AsyncCreate(string url, History singletonHistory, Favourites singletonFavourites)
        {
            PageContent pc = new PageContent(url);

            pc.SingletonHistory    = singletonHistory;
            pc.SingletonFavourites = singletonFavourites;
            await pc.GetPage();

            // init LocalHistory
            PageHistory FirstPage = new PageHistory(pc.Url, pc.Title);

            pc.LocalHistory = FirstPage;

            return(pc);
        }
Exemple #8
0
        public virtual List <long> GetEditorIds(long pageId)
        {
            List <PageHistory> list = PageHistory.find("PageId=" + pageId).list();

            List <long> users = new List <long>();

            foreach (PageHistory ph in list)
            {
                if (users.Contains(ph.EditUser.Id))
                {
                    continue;
                }
                users.Add(ph.EditUser.Id);
            }

            return(users);
        }
Exemple #9
0
        public virtual Result Update(Page p)
        {
            p.Updated = DateTime.Now;
            Result result = p.update();

            if (result.HasErrors)
            {
                return(result);
            }

            saveHistory(p);

            int count = PageHistory.count("PageId=" + p.Id);

            p.EditCount = count;
            p.update();

            return(result);
        }
Exemple #10
0
    // Start is called before the first frame update
    void Awake()
    {
        header.onBackClicked.AddListener(OnBack);
        header.onMenuClicked.AddListener(OnMenu);
        header.onSaveClicked.AddListener(OnSave);

        foreach (var pat in pages)
        {
            pat.page.gameObject.SetActive(false);
            if (pat.button != null)
            {
                pat.button.onClick.AddListener(() => GoToRoot(pat.page));
                pat.button.SetCurrent(false);
            }
        }

        // Start the page navigation history
        history = new PageHistory();
        history.onPageEntered += onHistoryPageEntered;
        history.onLeavingPage += onHistoryLeavingPage;

        // Go to the home page
        history.GoToRoot(pages[0].page);
    }
Exemple #11
0
        // PUT: odata/PageHistories(5)
        public async Task <IHttpActionResult> Put([FromODataUri] short key, Delta <PageHistory> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            PageHistory pageHistory = await db.PageHistories.FindAsync(key);

            if (pageHistory == null)
            {
                return(NotFound());
            }

            patch.Put(pageHistory);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PageHistoryExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(pageHistory));
        }
Exemple #12
0
 public virtual void Delete(Page p)
 {
     PageHistory.deleteBatch("PageId=" + p.Id);
     p.delete();
 }
Exemple #13
0
        public virtual PageHistory GetHistory(long id)
        {
            PageHistory ph = PageHistory.findById(id);

            return(ph);
        }
Exemple #14
0
 private static void saveHistory( Page p )
 {
     PageHistory ph = new PageHistory();
     ph.PageId = p.Id;
     ph.EditReason = p.EditReason;
     ph.EditUser = p.EditUser;
     ph.Content = p.Content;
     ph.insert();
 }