void AccountPagesDrafts_Show(object sender, EventArgs e)
        {
            SetTemplate("account_pages_manage");

            Pages myPages = new Pages(core, Owner);

            List<Page> pages = myPages.GetPages(true);

            long i = 0;
            foreach (Page page in pages)
            {
                VariableCollection pagesVariableCollection = template.CreateChild("page_list");

                int level = 0;
                level = page.FullPath.Split('/').Length - 1;
                string levelString = "";
                for (int j = 0; j < level; j++)
                {
                    levelString += "— ";
                }

                pagesVariableCollection.Parse("TITLE", levelString + page.Title);
                pagesVariableCollection.Parse("UPDATED", tz.DateTimeToString(page.GetModifiedDate(tz)));
                pagesVariableCollection.Parse("U_VIEW", page.Uri);
                pagesVariableCollection.Parse("U_EDIT", BuildUri("write", "edit", page.Id));
                pagesVariableCollection.Parse("U_DELETE", BuildUri("write", "delete", page.Id));

                if (i % 2 == 0)
                {
                    pagesVariableCollection.Parse("INDEX_EVEN", "TRUE");
                }
                i++;
            }
        }
        void AccountNavigationTabs_Add(object sender, ModuleModeEventArgs e)
        {
            SetTemplate("account_navigation_tab_add");

            Pages myPages = new Pages(core, Owner);
            List<Page> pagesList = myPages.GetPages(false, true);

            Dictionary<string, string> pages = new Dictionary<string, string>();
            List<string> disabledItems = new List<string>();

            foreach (Page page in pagesList)
            {
                pages.Add(page.Id.ToString(), page.FullPath);
            }

            ParseSelectBox("S_PAGE_LIST", "page-id", pages, "");
        }
        void AccountPagesManage_Show(object sender, EventArgs e)
        {
            SetTemplate("account_pages_manage");

            template.Parse("U_NEW_PAGE", BuildUri("write"));

            Pages myPages = new Pages(core, Owner);

            List<Page> pages = myPages.GetPages(false);

            long i = 0;
            foreach (Page page in pages)
            {
                VariableCollection pagesVariableCollection = template.CreateChild("page_list");

                int level = 0;
                level = page.FullPath.Split('/').Length - 1;
                string levelString = "";
                for (int j = 0; j < level; j++)
                {
                    levelString += "— ";
                }

                pagesVariableCollection.Parse("TITLE", levelString + page.Title);
                pagesVariableCollection.Parse("UPDATED", tz.DateTimeToString(page.GetModifiedDate(tz)));
                pagesVariableCollection.Parse("VIEWS", page.Info.ViewedTimes.ToString());

                pagesVariableCollection.Parse("U_VIEW", page.Uri);
                pagesVariableCollection.Parse("U_EDIT", BuildUri("write", "edit", page.Id));
                pagesVariableCollection.Parse("U_PERMS", Access.BuildAclUri(core, page));
                pagesVariableCollection.Parse("U_STATISTICS", core.Hyperlink.AppendAbsoluteSid(string.Format("/api/statistics?mode=item&id={0}&type={1}", page.Id, ItemType.GetTypeId(core, typeof(Page))), true));
                pagesVariableCollection.Parse("U_DELETE", BuildUri("write", "delete", page.Id));

                if (i % 2 == 0)
                {
                    pagesVariableCollection.Parse("INDEX_EVEN", "TRUE");
                }
                i++;
            }
        }
        void AccountPagesWrite_Show(object sender, EventArgs e)
        {
            SetTemplate("account_write");

            VariableCollection javaScriptVariableCollection = core.Template.CreateChild("javascript_list");
            javaScriptVariableCollection.Parse("URI", @"/scripts/jquery.sceditor.bbcode.min.js");

            VariableCollection styleSheetVariableCollection = core.Template.CreateChild("style_sheet_list");
            styleSheetVariableCollection.Parse("URI", @"/styles/jquery.sceditor.theme.default.min.css");

            core.Template.Parse("OWNER_STUB", Owner.UriStubAbsolute);

            long pageId = 0;
            long pageParentId = 0;
            byte licenseId = 0;
            ushort pagePermissions = 4369;
            string pageTitle = (core.Http.Form["title"] != null) ? core.Http.Form["title"] : "";
            string pageSlug = (core.Http.Form["slug"] != null) ? core.Http.Form["slug"] : "";
            string pageText = (core.Http.Form["post"] != null) ? core.Http.Form["post"] : "";
            string pagePath = "";
            Classifications pageClassification = Classifications.Everyone;

            try
            {
                if (core.Http.Form["license"] != null)
                {
                    licenseId = core.Functions.GetLicenseId();
                }
                if (core.Http.Form["id"] != null)
                {
                    pageId = long.Parse(core.Http.Form["id"]);
                }
                if (core.Http.Form["page-parent"] != null)
                {
                    pageParentId = long.Parse(core.Http.Form["page-parent"]);
                }
            }
            catch
            {
            }

            if (core.Http.Query["id"] != null)
            {
                try
                {
                    pageId = long.Parse(core.Http.Query["id"]);
                }
                catch
                {
                }
            }

            if (pageId > 0)
            {
                if (core.Http.Query["mode"] == "edit")
                {
                    try
                    {
                        Page page = new Page(core, Owner, pageId);

                        pageParentId = page.ParentId;
                        pageTitle = page.Title;
                        pageSlug = page.Slug;
                        //pagePermissions = page.Permissions;
                        licenseId = page.LicenseId;
                        pageText = page.Body;
                        pagePath = page.FullPath;
                        pageClassification = page.Classification;
                    }
                    catch (PageNotFoundException)
                    {
                        DisplayGenericError();
                    }
                }
            }

            Pages myPages = new Pages(core, Owner);
            List<Page> pagesList = myPages.GetPages(false, true);

            SelectBox pagesSelectBox = new SelectBox("page-parent");
            pagesSelectBox.Add(new SelectBoxItem("0", "/"));

            foreach (Page page in pagesList)
            {
                SelectBoxItem item = new SelectBoxItem(page.Id.ToString(), page.FullPath);
                pagesSelectBox.Add(item);

                if (pageId > 0)
                {
                    if (page.FullPath.StartsWith(pagePath, StringComparison.Ordinal))
                    {
                        item.Selectable = false;
                    }
                }
            }

            List<string> permissions = new List<string>();
            permissions.Add("Can Read");

            if (pageId > 0 && pagesSelectBox.ContainsKey(pageId.ToString()))
            {
                pagesSelectBox[pageId.ToString()].Selectable = false;
            }

            pagesSelectBox.SelectedKey = pageParentId.ToString();

            core.Display.ParseLicensingBox(template, "S_PAGE_LICENSE", licenseId);
            core.Display.ParseClassification(template, "S_PAGE_CLASSIFICATION", pageClassification);
            template.Parse("S_PAGE_PARENT", pagesSelectBox);

            //core.Display.ParsePermissionsBox(template, "S_PAGE_PERMS", pagePermissions, permissions);

            template.Parse("S_TITLE", pageTitle);
            template.Parse("S_SLUG", pageSlug);
            template.Parse("S_PAGE_TEXT", pageText);
            template.Parse("S_ID", pageId.ToString());

            Save(new EventHandler(AccountPagesWrite_Save));
            if (core.Http.Form["publish"] != null)
            {
                AccountPagesWrite_Save(this, new EventArgs());
            }
        }