Esempio n. 1
0
        public void Handle(CreateCustomPage message)
        {
            var item = new CustomPage(message.PageId, message.Id, message.ParentId, message.LanguageIsoCode,
                                      message.Title, message.LongTitle, message.Description, message.PageContent,
                                      message.Keywords, message.IsPublished, message.IsFrontPage, message.ShowInList,
                                      message.OrderInList, message.IsExternal, message.ExternalUrl);

            _eventRepository.Save(item, -1);

            // TODO
            //var dto = Mapper.Map<CreateCustomPage, Model.CustomPage>(message);

            var dto = new Model.CustomPage
            {
                EntityId           = item.Id,
                Description        = message.Description,
                IsFrontPage        = message.IsFrontPage,
                IsPublished        = message.IsPublished,
                Keywords           = message.Keywords,
                CultureCode        = message.LanguageIsoCode,
                LongTitle          = message.LongTitle,
                OrderInList        = message.OrderInList,
                PageContent        = message.PageContent,
                ParentCustomPageId = message.ParentId,
                ShowInList         = message.ShowInList,
                Title = message.Title
            };

            _repository.Add(dto);
            _repository.Save();
        }
        public int CreateCustomTemplate(string tempName)
        {
            CustomPage page = new CustomPage();

            if (string.IsNullOrEmpty(tempName))
            {
                return(0);
            }
            page = new CustomPage
            {
                Name          = "页面名称",
                CreateTime    = DateTime.Now,
                Status        = 1,
                TempIndexName = (tempName == "none") ? "" : tempName,
                PageUrl       = page.CreateTime.ToString("yyyyMMddHHmmss"),
                Details       = "自定义页面",
                IsShowMenu    = true,
                DraftDetails  = "自定义页面",
                DraftName     = "页面名称",
                DraftPageUrl  = page.PageUrl,
                PV            = 0,
                DraftJson     = (tempName == "none") ? this.GetCustomTempDefaultJson() : this.GetIndexTempJsonByName(tempName),
                FormalJson    = (tempName == "none") ? this.GetCustomTempDefaultJson() : this.GetIndexTempJsonByName(tempName)
            };
            return(CustomPageHelp.Create(page));
        }
    //Saves any changes to the Pages Table
    protected void saveButton_Click(object sender, EventArgs e)
    {
        PagesTable pagesTable = new PagesTable(new DatabaseConnection());

        pageTable.saveContentChanges();
        pages.Pages = pageTable.getContent();

        //Foreach tableRow do the applicable database command (update/insert/delete) to mirror what the user has done in the table.
        int deleted = 0;

        foreach (ObjectTableRow objRow in pageTable.ObjectRows)
        {
            CustomPage page = (CustomPage)objRow.Obj;

            if (page.MarkedForDeletion == true) //delete page from database AND file structure
            {
                pagesTable.deleteCustomPage(page.PageID);
                File.Delete(Server.MapPath("~/") + page.PageURL);
                pages.Pages.Remove(page.SortIndex);
                deleted++;
            }
            else
            {
                page.SortIndex -= deleted;
                pagesTable.updateCustomPage(page); //update page
            }
        }

        //Remove Content
        Session.Remove("savedContent");
        Session["message"] = new Message("Pages Saved!", System.Drawing.Color.Green);

        //Reload page to clear any nonsense before loading
        Response.Redirect("CustomPageTool");
    }
Esempio n. 4
0
        public async Task CloseModal(bool animation = false)
        {
            await Device.InvokeOnMainThreadAsync(async() =>
            {
                try
                {
                    Debug.WriteLine($"CloseModal(animation={animation})");

                    Page page = null;
                    if (Device.RuntimePlatform == Device.Android)
                    {
                        page = await _navigation.Navigation.PopModalAsync(false);
                    }
                    else
                    {
                        page = await _navigation.Navigation.PopModalAsync(animation);
                    }

                    if (page != null)
                    {
                        var pageKey = _pagesByKey.First(p => p.Value == page.GetType()).Key;
                        Debug.WriteLine($"CloseModal():PageKey({pageKey})");
                    }

                    CurrentPage = new CustomPage(_navigation.CurrentPage, Data.Models.Enums.ePageType.CloseModal);

                    AppStateController.PopViewState();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            });
        }
        public string GetTemplateJson(System.Web.HttpContext context, int id)
        {
            string result;

            try
            {
                CustomPage customPageByID = CustomPageHelp.GetCustomPageByID(id);
                if (customPageByID == null)
                {
                    result = "";
                }
                else if (customPageByID.Status == 0)
                {
                    result = customPageByID.FormalJson.Replace("\r\n", "").Replace("\n", "");
                }
                else
                {
                    result = customPageByID.DraftJson.Replace("\r\n", "").Replace("\n", "");
                }
            }
            catch
            {
                result = "";
            }
            return(result);
        }
Esempio n. 6
0
        // Build text using recognized layout
        public RecognizedText(FREngine.IFRPage frPage, int pageIndex)
        {
            Text  = new List <Character>();
            words = new List <Word>();

            FREngine.ILayoutBlocks blocks = frPage.Layout.Blocks;

            lineAll   = new List <CustomLine>();
            listWords = new List <CustomWord>();
            Page      = new CustomPage();


            Page.Index = pageIndex;
            tableIndex = 0;
            for (int iBlock = 0; iBlock < blocks.Count; iBlock++)
            {
                FREngine.IBlock block = blocks[iBlock];

                CustomBlock csBlock = buildTextFromBlock(block, iBlock);

                if (csBlock != null)
                {
                    csBlock.ParentIndex = pageIndex;
                    Page.BlockItems.Add(csBlock);
                }
            }


            ProcessLine();
        }
Esempio n. 7
0
        public override void DataBind()
        {
            if (_bound)
            {
                return;
            }
            _bound = true;

            _page = this.Page as CustomPage;

            if (TypeDetails == null)
            {
                //If the type is not found or it's status is set to no display
                //this.Page.Response.StatusCode = 404;
                //this.Page.Response.StatusDescription = "404 Not Found";

                return;
            }

            DataItem = TypeDetails;

            if (OverridePageTitle)
            {
                Config cfg = new Config();

                _page.Title = string.Format("{0} - {1}",
                                            StringUtils.StripOutHtmlTags(TypeDetails["Name"].ToString()),
                                            cfg.GetKey("SiteName"));
            }

            base.DataBind();
        }
Esempio n. 8
0
        public IHttpActionResult PutCustomPage(int id, CustomPage customPage)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customPage.PageId)
            {
                return(BadRequest());
            }

            db.Entry(customPage).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomPageExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 9
0
        protected virtual CustomPageModel PreparePageModel(CustomPage page)
        {
            if (page == null)
            {
                throw new ArgumentNullException("custompage");
            }

            var model = new CustomPageModel
            {
                Id                     = page.Id,
                SystemName             = page.GetSystemName(),
                Name                   = page.Name,
                BodyHtml               = page.Template.BodyHtml,
                MetaKeywords           = page.MetaKeywords,
                MetaDescription        = page.MetaDescription,
                MetaTitle              = page.MetaTitle,
                TemplateId             = page.TemplateId,
                IncludeInTopMenu       = page.IncludeInTopMenu,
                IncludeInFooterColumn1 = page.IncludeInFooterColumn1,
                IncludeInFooterColumn2 = page.IncludeInFooterColumn2,
                IncludeInFooterColumn3 = page.IncludeInFooterColumn3,
                IncludeInFooterMenu    = page.IncludeInFooterMenu,
                IsSystemDefined        = page.IsSystemDefined,
                IsActive               = page.IsActive,
                PermissionOriented     = page.PermissionOriented
            };

            return(model);
        }
Esempio n. 10
0
        public ActionResult ChangePageState(int id = 0, int state = -2)
        {
            if (id == 0 || (state != -1 && state != 0 && state != 1))
            {
                return(ApiResult(false, "非法参数"));
            }
            CustomPage pageModel = CustomPageBLL.SingleModel.GetModel(id);

            if (pageModel == null)
            {
                return(ApiResult(false, "页面不存在"));
            }
            pageModel.state = state;
            if (CustomPageBLL.SingleModel.Update(pageModel, "state"))
            {
                switch (state)
                {
                case -1:
                    return(ApiResult(true, "删除成功"));

                case 0:
                    return(ApiResult(true, "保存成功"));

                case 1:
                    return(ApiResult(true, "发布成功"));

                default:
                    return(ApiResult(false, "操作失败"));
                }
            }
            else
            {
                return(ApiResult(false, "操作失败"));
            }
        }
Esempio n. 11
0
        public ActionResult GetShareQRCode(int id = 0)
        {
            CustomPage pageModel = CustomPageBLL.SingleModel.GetModel(id);

            if (pageModel == null)
            {
                return(ApiResult(false, "页面不存在"));
            }
            if (!string.IsNullOrEmpty(pageModel.qrcode))
            {
                return(ApiResult(true, pageModel.qrcode));
            }

            string scene    = $"{id}";
            string postData = JsonConvert.SerializeObject(new {
                scene      = scene,
                page       = "pages/index/pagePreview",
                width      = 210,
                auto_color = true,
                line_color = new { r = "0", g = "0", b = "0" }
            });
            string appid        = WebConfigurationManager.AppSettings["xiaowei_appid"];
            string appsecret    = WebConfigurationManager.AppSettings["xiaowei_appsecret"];
            string access_token = WxHelper.GetToken(appid, appsecret, false);
            string errorMessage = "";
            string qrCode       = CommondHelper.HttpPostSaveImg("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + access_token, postData, ref errorMessage);

            if (string.IsNullOrEmpty(qrCode))
            {
                return(ApiResult(false, $"获取二维码失败!{errorMessage}"));
            }
            pageModel.qrcode = qrCode;
            CustomPageBLL.SingleModel.Update(pageModel, "qrcode");
            return(ApiResult(true, qrCode));
        }
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        Page.Validate("PageGrp");
        if (!Page.IsValid)
        {
            return;
        }

        using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
        {
            try
            {
                cp.Status     = (PostStatusType)Enum.Parse(typeof(PostStatusType), StatusDropDown.SelectedValue);
                cp.Body       = BodyTextBox.Text.Trim();
                cp.Name       = Utility.Slugify(NameTextBox.Text.Trim());
                cp.Title      = TitleTextBox.Text.Trim();
                cp.Head       = HeadTextBox.Text.Trim();
                cp.NoTemplate = NoTemplateCheckBox.Checked;
                cp.PageMeta   = PageMetaTextBox.Text.Trim();
                if (Mode == "edit")
                {
                    cp.DateModified   = DateTime.Now;
                    cp.ModifiedByName = CurrentUser.MemberName;
                    cp.ModifiedBy     = CurrentUser.ID;

                    CustomPage p = (from u in dc.CustomPages where u.ID == ID select u).SingleOrDefault();
                    p.DateModified = cp.DateModified;
                    p.ModifiedBy   = cp.ModifiedBy;
                    p.Name         = cp.Name;
                    p.Status       = (byte)cp.Status;
                    dc.SubmitChanges();
                }
                else
                {
                    cp.DateCreated   = DateTime.Now;
                    cp.CreatedByName = CurrentUser.MemberName;
                    cp.CreatedBy     = CurrentUser.ID;

                    CustomPage p = new CustomPage();
                    p.DateCreated = cp.DateCreated;
                    p.CreatedBy   = cp.CreatedBy;
                    p.Name        = cp.Name;
                    p.Status      = (byte)cp.Status;
                    dc.CustomPages.InsertOnSubmit(p);
                    dc.SubmitChanges();
                    cp.ID = p.ID;
                }

                string str = Utility.Serialize <CPage>(cp);
                System.IO.File.WriteAllText(Server.MapPath(string.Format("{1}/cpagexml-{0}.txt", cp.ID, Utility.CustomPageFolder)), str);
                Response.Redirect("custompagelist.aspx");
            }
            catch (Exception ex)
            {
                Trace.Write("Unable to save page details.");
                Trace.Write(ex.Message);
                Trace.Write(ex.StackTrace);
            }
        }
    }
Esempio n. 13
0
        public override void DataBind()
        {
            if (bound)
            {
                return;
            }
            bound = true;

            this.Visible = false;

            try
            {
                object obj = DataBinder.Eval(this.NamingContainer, "DataItem.ItemId");
                if (obj != null)
                {
                    ItemId = (int)obj;
                }

                options = DataBinder.Eval(this.NamingContainer, "DataItem.OptionsKey").ToString();
                obj     = DataBinder.Eval(this.NamingContainer, "DataItem.Quantity");
                if (obj != null)
                {
                    this.Value = obj.ToString();
                }

                this.Visible = true;
            }
            catch (Exception Ex)
            {
                CustomPage page = this.Page as CustomPage;
            }
            base.DataBind();
        }
Esempio n. 14
0
        public override void DataBind()
        {
            CustomPage page = this.Page as CustomPage;

            closeId = string.Format("{0}-close", this.ClientID);

            if (Closable)
            {
                if (page != null)
                {
                    page.RegisterLoadScript(closeId,
                                            string.Format("$('#{0}').click(function(){{lw.close('{1}', '{2}');}});",
                                                          closeId, ClientID, CloseEffect));
                }
            }
            if (AutoHide)
            {            /*
                          *     page.RegisterLoadScript(ClientID,
                          *                     string.Format(@"window.setTimeout(function(){{
                          * try{{lw.AutoHide('{0}', '{1}');}}catch(e){{}}
                          * }}, {2});", ClientID, CloseEffect, HideAfter));
                          * */
            }

            base.DataBind();
        }
        public IHttpActionResult GetCustomPage(int id)
        {
            if (id == 0)
            {
                return(Ok(new CustomPageDTO()));
            }
            CustomPage m = db.CustomPages.Find(id);

            if (m == null)
            {
                return(NotFound());
            }
            //CustomPageDTO result = new CustomPageDTO()
            //{
            //    ID = m.ID,
            //    Body = m.Body,
            //    CreatedBy = (m.CreatedBy == null) ? 0 : m.CreatedBy.ID,
            //    Title = m.Title,
            //    Status = m.Status,
            //    CreatedByName = (m.CreatedBy == null) ? "" : m.CreatedBy.FirstName,
            //    DateCreated = m.DateCreated,
            //    DateModified = m.DateModified,
            //    Head = m.Head,
            //    ModifiedBy = (m.ModifiedBy == null) ? 0 : m.ModifiedBy.ID,
            //    Name = m.Name,
            //    NoTemplate = m.NoTemplate,
            //    PageMeta = m.PageMeta,
            //    Sitemap = m.Sitemap,
            //    ModifiedByName = (m.ModifiedBy == null) ? "" : m.ModifiedBy.FirstName
            //};


            return(Ok(m));
        }
Esempio n. 16
0
        public async Task PopToRootAsync()
        {
            await Device.InvokeOnMainThreadAsync(async() =>
            {
                try
                {
                    Debug.WriteLine($"PopToRootAsync()");

                    while (_navigation.Navigation.ModalStack.Any())
                    {
                        await _navigation.Navigation.PopModalAsync(false);
                    }

                    await _navigation.Navigation.PopToRootAsync(false);

                    CurrentPage = new CustomPage(_navigation.CurrentPage, Data.Models.Enums.ePageType.PopPopup);

                    AppStateController.ClearNavigationMetaStack();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            });
        }
        public IHttpActionResult PostCustomPage(CustomPage customPage)
        {
            SubPageByClientUrlService subPageByClientUrlService = new SubPageByClientUrlService();

            subPageByClientUrlService.UpsertSubPage(customPage, db);

            return(CreatedAtRoute("DefaultApi", new { id = customPage.PageId }, customPage));
        }
        public IHttpActionResult PostCustomPage(CustomPage customPage)
        {
            CustomPageService customPageService = new CustomPageService();

            customPageService.UpsertCustomPage(customPage, db);

            return(CreatedAtRoute("DefaultApi", new { id = customPage.PageId }, customPage));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string path = (this.Page.RouteData.Values["custpath"] != null) ? this.Page.RouteData.Values["custpath"].ToString() : "notfound";

            this.H_Page.CustomPagePath = path;
            CustomPage customDraftPageByPath = CustomPageHelp.GetCustomDraftPageByPath(path);

            if (customDraftPageByPath == null)
            {
                base.Response.Redirect("/default.aspx");
            }
            this.DraftIsShowMenu = customDraftPageByPath.DraftIsShowMenu;
            string text1 = base.Request.QueryString["ReferralId"];

            this.cssSrc        = this.cssSrc + customDraftPageByPath.TempIndexName + "/css/head.css";
            this.siteSettings  = SettingsManager.GetMasterSettings(true);
            this.htmlTitleName = customDraftPageByPath.DraftName;
            this.Desc          = customDraftPageByPath.DraftDetails;
            string userAgent = this.Page.Request.UserAgent;

            this.EnabeHomePageBottomLink       = this.siteSettings.EnabeHomePageBottomLink;
            this.EnableHomePageBottomCopyright = this.siteSettings.EnableHomePageBottomCopyright;
            this.EnableGuidePageSet            = this.siteSettings.EnableGuidePageSet;
            this.IsAutoGuide          = this.siteSettings.IsAutoGuide;
            this.IsMustConcern        = this.siteSettings.IsMustConcern;
            this.DistributionLinkName = this.siteSettings.DistributionLinkName;
            this.DistributionLink     = string.IsNullOrEmpty(this.siteSettings.DistributionLink) ? "javascript:void(0);" : this.siteSettings.DistributionLink;
            this.CopyrightLinkName    = this.siteSettings.CopyrightLinkName;
            this.CopyrightLink        = string.IsNullOrEmpty(this.siteSettings.CopyrightLink) ? "javascript:void(0);" : this.siteSettings.CopyrightLink;
            if (this.siteSettings.EnableAliPayFuwuGuidePageSet)
            {
                this.AlinfollowUrl = this.siteSettings.AliPayFuwuGuidePageSet;
            }
            if (this.siteSettings.EnableGuidePageSet)
            {
                this.WeixinfollowUrl = this.siteSettings.GuidePageSet;
            }
            if (!base.IsPostBack)
            {
                HiAffiliation.LoadPage();
                string getCurrentWXOpenId = Globals.GetCurrentWXOpenId;
                int    num = Globals.RequestQueryNum("go");
                if ((userAgent.ToLower().Contains("micromessenger") && string.IsNullOrEmpty(getCurrentWXOpenId)) && (this.siteSettings.IsValidationService && (num != 1)))
                {
                    this.Page.Response.Redirect("Follow.aspx?ReferralId=" + Globals.GetCurrentDistributorId());
                    this.Page.Response.End();
                }
                if (((Globals.GetCurrentMemberUserId(false) == 0) && this.siteSettings.IsAutoToLogin) && userAgent.ToLower().Contains("micromessenger"))
                {
                    Uri    url         = HttpContext.Current.Request.Url;
                    string urlToEncode = Globals.GetWebUrlStart() + "/default.aspx?ReferralId=" + Globals.RequestQueryNum("ReferralId").ToString();
                    base.Response.Redirect("/UserLogining.aspx?returnUrl=" + Globals.UrlEncode(urlToEncode));
                    base.Response.End();
                }
                this.showMenu = this.siteSettings.EnableShopMenu;
                this.BindWXInfo();
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 更新布局,获取最新资讯
        /// </summary>
        /// <param name="page">频道数据</param>
        /// <returns></returns>
        public async Task UpdateLayout(CustomPage page, bool isForceRefresh = false)
        {
            AllFeeds.Clear();
            LoadingRing.IsActive              = true;
            JustNoReadSwitch.IsEnabled        = false;
            AllReadButton.Visibility          = Visibility.Collapsed;
            LastCacheTimeContainer.Visibility = Visibility.Collapsed;
            NoDataTipContainer.Visibility     = Visibility.Collapsed;
            AllReadTipContainer.Visibility    = Visibility.Collapsed;
            _sourceData            = page;
            PageNameTextBlock.Text = _sourceData.Name;
            FeedCollection.Clear();
            var feed = new List <RssSchema>();

            if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable)
            {
                var schema = await IOTools.GetSchemaFromPage(_sourceData);

                foreach (var item in schema)
                {
                    feed.Add(item);
                }
                bool isAutoCache = Convert.ToBoolean(AppTools.GetLocalSetting(AppSettings.AutoCacheWhenOpenChannel, "False"));
                if (isAutoCache && feed.Count > 0)
                {
                    await IOTools.AddCachePage(null, page);
                }
            }
            else
            {
                if (MainPage.Current._isCacheAlert)
                {
                    new PopupToast(AppTools.GetReswLanguage("Tip_WatchingCache")).ShowPopup();
                    MainPage.Current._isCacheAlert = false;
                }
                var data = await IOTools.GetLocalCache(page);

                feed           = data.Item1;
                _lastCacheTime = data.Item2;
                if (_lastCacheTime > 0)
                {
                    LastCacheTimeContainer.Visibility = Visibility.Visible;
                    LastCacheTimeBlock.Text           = AppTools.TimeStampToDate(_lastCacheTime).ToString("HH:mm");
                }
            }
            if (feed != null && feed.Count > 0)
            {
                AllFeeds = feed;
                await FeedInit();
            }
            else
            {
                NoDataTipContainer.Visibility = Visibility.Visible;
            }
            JustNoReadSwitch.IsEnabled = true;
            LoadingRing.IsActive       = false;
        }
Esempio n. 21
0
        // GET: CustomPage/Edit/5
        public ActionResult Edit(int id = 0)
        {
            if (id == 0)
            {
                return(RedirectToAction("Index", "Admin"));
            }
            CustomPage CustomPage = (new ApplicationDbContext()).CustomPage.First(x => x.Id == id);

            return(View(CustomPage));
        }
Esempio n. 22
0
        public ActionResult Details(int id)
        {
            CustomPage p = ReadModelFacade.GetById(id);

            if (p.IsFrontPage)
            {
                return(RedirectToAction("Index"));
            }
            return(View(p));
        }
        /// <summary>
        /// Binds the object to its datasource
        /// </summary>
        public override void DataBind()
        {
            CustomPage page = this.Page as CustomPage;

            page.RegisterScriptFile(lw.CTE.Files.CkEditor, lw.CTE.Files.CkEditorFile);


            this.Attributes.Add("class", "ckeditor");
            base.DataBind();
        }
Esempio n. 24
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage.Current._isChannelAbout = true;
            AllList.Clear();
            IconCollection.Clear();
            RuleCollection.Clear();
            foreach (var item in MainPage.Current.Categories)
            {
                AllList.Add(new GroupChannelList(item.Channels)
                {
                    Key = item.Name
                });
            }
            var iconList = AppTools.GetIcons();

            foreach (var item in iconList)
            {
                IconCollection.Add(item);
            }
            var rules = FilterRule.GetRules();

            foreach (var item in rules)
            {
                RuleCollection.Add(item);
            }

            if (e.Parameter != null)
            {
                if (e.Parameter is CustomPage)
                {
                    _sourcePage          = e.Parameter as CustomPage;
                    IconTextBlock.Text   = _sourcePage.Icon;
                    PageNameTextBox.Text = _sourcePage.Name;
                    FilterCollection.Clear();
                    foreach (var item in _sourcePage.Rules)
                    {
                        FilterCollection.Add(item);
                    }
                    foreach (var item in AllList)
                    {
                        item.RemoveAll(p => _sourcePage.Channels.Any(i => i.Id == p.Id));
                    }
                    AllList.Insert(0, new GroupChannelList(_sourcePage.Channels)
                    {
                        Key = AppTools.GetReswLanguage("Tip_Selected")
                    });
                    SourceChannelCollection = new ObservableCollection <GroupChannelList>(AllList);
                }
            }
            else
            {
                IconTextBlock.Text      = IconCollection.First();
                SourceChannelCollection = new ObservableCollection <GroupChannelList>(AllList);
            }
        }
Esempio n. 25
0
        private void loadCustomPage(string url)
        {
            CustomPageBL customPageBL = new CustomPageBL();
            CustomPage   customPage   = customPageBL.GetCustomPage(url);

            Page.Title = customPage.Title;
            ViewState.Add("pageTitle", customPage.Title);
            lblHeading.Text            = customPage.Heading;
            divContent.InnerHtml       = customPage.Content;
            ViewState["customPageUrl"] = customPage.Url;
        }
Esempio n. 26
0
        private PartialViewResult ViewDeleteCustomPage(CustomPage customPage, ConfirmDialogFormViewModel viewModel)
        {
            var canDelete      = true;
            var confirmMessage = canDelete
                ? $"Are you sure you want to delete the Custom Page '{customPage.CustomPageDisplayName}'?"
                : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage("Custom Page", SitkaRoute <CustomPageController> .BuildLinkFromExpression(x => x.About(customPage.CustomPageVanityUrl), "here"));

            var viewData = new ConfirmDialogFormViewData(confirmMessage, canDelete);

            return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel));
        }
Esempio n. 27
0
    public void addRow(CustomPage page)
    {
        names.Add(page.PageName);
        ObjectTableRow objectRow = new ObjectTableRow(page, Color.White);

        //Make the individual cells for this object, using the provided parameter Names to obtain the desired values.
        TableCell indexCell  = new TableCell();
        Label     indexLabel = new Label();

        indexLabel.Text = page.SortIndex.ToString();
        indexCell.Controls.Add(indexLabel);
        objectRow.Controls.Add(indexCell);

        ObjectTableCell pageNameCell = new ObjectTableCell(objectRow, "PageName", false);
        TextBox         nameTextBox  = new TextBox();

        nameTextBox.Text = page.PageName;
        pageNameCell.Controls.Add(nameTextBox);
        objectRow.ObjectCells.Add(pageNameCell);
        objectRow.Controls.Add(pageNameCell);

        TableCell upCell   = new TableCell();
        Button    upButton = new Button();

        upButton.Text   = "+";
        upButton.Click += new EventHandler(upButton_Click);
        upCell.Controls.Add(upButton);
        objectRow.Cells.Add(upCell);

        TableCell downCell   = new TableCell();
        Button    downButton = new Button();

        downButton.Text   = "-";
        downButton.Click += new EventHandler(downButton_Click);
        downCell.Controls.Add(downButton);
        objectRow.Cells.Add(downCell);

        TableCell deleteCell   = new TableCell();
        Button    deleteButton = new Button();

        deleteButton.Text   = "Delete";
        deleteButton.Click += new EventHandler(deleteButton_Click);
        deleteCell.Controls.Add(deleteButton);
        objectRow.Cells.Add(deleteCell);


        //Add to table
        this.Rows.Add(objectRow);
        objectRows.Add(objectRow);
        if (objectRow.Color == Color.Empty)
        {
            objectRow.Visible = false;
        }
    }
        public IHttpActionResult GetCustomPage(int id)
        {
            CustomPage customPage = db.CustomPages.Find(id);

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

            return(Ok(customPage));
        }
Esempio n. 29
0
    //Updates the provided custom page in the DB.
    public void updateCustomPage(CustomPage page)
    {
        string query = "spUpdateCustomPage";

        SqlParameter[] parameters = new SqlParameter[3];
        parameters[0] = new SqlParameter("pageName", page.PageName);
        parameters[1] = new SqlParameter("sortIndex", page.SortIndex);
        parameters[2] = new SqlParameter("pageID", page.PageID);

        database.uploadCommand(query, parameters);
    }
Esempio n. 30
0
        public override void DataBind()
        {
            if (_bound)
            {
                return;
            }
            _bound = true;

            CustomPage thisPage = this.Page as CustomPage;

            if (thisPage == null)
            {
                thisPage = new CustomPage();
            }

            ContentManager pagesMgr = new ContentManager();

            PagesDS.PagesRow page = pagesMgr.GetPage(PageName, thisPage.Language);

            if (page == null && CreatePage)
            {
                pagesMgr.AddPage(pageName, pageName, "", false, ContentManager.Content(pageName), thisPage.Language);
                page = pagesMgr.GetPage(pageName, thisPage.Language);
            }
            if (page == null)
            {
                return;
            }

            string str = page.Content;

            str = str.Replace("<sup>&amp;reg;</sup>", "®");
            str = str.Replace("<sup>®</sup>", "®");
            str = str.Replace("&amp;reg;", "&reg;");
            str = str.Replace("&reg;", "<sup>&reg;</sup>");
            str = str.Replace("®", "<sup>&reg;</sup>");


            this.Text = str;

            if (OverridePageProperties)
            {
                if (thisPage != null)
                {
                    Config cfg = new Config();
                    thisPage.Title = page.Title;
                    thisPage.AddDescription(page.Description);
                    thisPage.AddKeywords(page.Keywords);
                }
            }

            base.DataBind();
        }