コード例 #1
0
ファイル: LayoutPage.cs プロジェクト: goldenface1001/PMaster
        /// <summary>
        /// Initializes the layout page.
        /// </summary>
        protected override void InitializePage()
        {
            // Get the current site page model
            Model = Models.PageModel.GetBySite(Config.SiteTreeId);

            base.InitializePage();
        }
コード例 #2
0
ファイル: LayoutPage.cs プロジェクト: 284247028/Piranha
		/// <summary>
		/// Initializes the layout page.
		/// </summary>
		protected override void InitializePage() {
			// Get the current site page model
			if (Page.Current != null) {
				Model = Models.PageModel.GetBySite(Page.Current.SiteTreeId);
			} else Model = Models.PageModel.GetBySite(Config.SiteTreeId);

			base.InitializePage();
		}
コード例 #3
0
        /// <summary>
        /// Triggered before an action is executed on the controller
        /// </summary>
        /// <param name="filterContext">The context</param>
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            string permalink = Request["permalink"];
            bool   draft     = false;
            bool   cached    = false;

            // Check if we want to see the draft
            if (User.HasAccess("ADMIN_PAGE"))
            {
                if (!String.IsNullOrEmpty(Request["draft"]))
                {
                    try {
                        draft = Convert.ToBoolean(Request["draft"]);
                    } catch {}
                }
            }

            // Load the current page
            if (!String.IsNullOrEmpty(permalink))
            {
                page = Models.Page.GetByPermalink(permalink, draft);
            }
            else
            {
                page = Models.Page.GetStartpage(draft);
            }

            // Check permissions
            if (page.GroupId != Guid.Empty)
            {
                if (!User.IsMember(page.GroupId))
                {
                    SysParam param = SysParam.GetByName("LOGIN_PAGE");
                    if (param != null)
                    {
                        Response.Redirect(param.Value);
                    }
                    else
                    {
                        Response.Redirect("~/");
                    }
                }
                Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            }
            else
            {
                // Only cache public pages
                DateTime mod = GetLastModified();
                cached = false;                 // ClientCache.HandleClientCache(HttpContext.Current, page.Id.ToString(), mod) ;
            }
            // Load the model if the page wasn't cached
            if (!cached)
            {
                model = PageModel.Get(page);
            }
            base.OnActionExecuting(filterContext);
        }
コード例 #4
0
        /// <summary>
        /// Initializes the layout page.
        /// </summary>
        protected override void InitializePage()
        {
            // Get the current site page model
            if (Page.Current != null)
            {
                Model = Models.PageModel.GetBySite(Page.Current.SiteTreeId);
            }
            else
            {
                Model = Models.PageModel.GetBySite(Config.SiteTreeId);
            }

            base.InitializePage();
        }
コード例 #5
0
ファイル: PageController.cs プロジェクト: roboxito/Sirloin
 //
 // GET: /Page/
 public ActionResult Show(string pageid)
 {
     Page result;
     using (var session = DomainAccess.Instance.CurrentSession.OpenSession())
     {
         if (!string.IsNullOrEmpty(pageid))
         {
             result = session.Query<Page>().FirstOrDefault<Page>(x => x.ShortID == pageid);
         }
         else
         {
             result = session.Query<Page>().FirstOrDefault();
         }
     }
     Sirloin.Models.PageModel modelo = new Models.PageModel(result);
     return View(modelo);
 }
コード例 #6
0
ファイル: PageController.cs プロジェクト: majimenezp/Sirloin
        //
        // GET: /Page/

        public ActionResult Show(string pageid)
        {
            Page result;
            using (var session = DomainAccess.Instance.CurrentSession.OpenSession())
            {
                if (!string.IsNullOrEmpty(pageid))
                {
                    result = session.Query<Page>().FirstOrDefault<Page>(x => x.ShortID == pageid);
                }
                else
                {
                    result = session.Query<Page>().FirstOrDefault();
                }
            }
            Sirloin.Models.PageModel modelo = new Models.PageModel(result);
            return View(modelo);
        }
コード例 #7
0
        public ActionResult Index(string friendlyURL, string previewPageData)
        {
            friendlyURL = string.IsNullOrWhiteSpace(friendlyURL) ? "Index" : friendlyURL;

            if (friendlyURL.ToUpper().Equals("ADMIN"))
            {
                return(RedirectToRoute("Admin_Default"));
            }

            Models.PageModel PageModel = new Models.PageModel();

            if (!string.IsNullOrWhiteSpace(previewPageData))
            {
                ViewBag.PreviewPageData = previewPageData;
                PageModel.InEditMode    = true;
            }
            else
            {
                PageModel = new Models.PageModel(friendlyURL, Request);
            }

            if (!string.IsNullOrWhiteSpace(PageModel.Page.Id) || PageModel.InEditMode)
            {
                ViewBag.PageModel = PageModel;

                return(View("Index", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName)));
            }

            //if we got this far this is a 404

            SettingGroup SettingGroup = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.TEMPLATE_CUSTOM_SETTINGS);

            ViewBag.ViewType = SettingGroup.GetSettingVal("PageNotFoundPage");

            return(View("PageNotFound", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName)));
        }
コード例 #8
0
        public ActionResult Index(string friendlyURL, string previewPageData)
        {
            friendlyURL = string.IsNullOrWhiteSpace(friendlyURL) ? "Index" : friendlyURL;

            if (friendlyURL.ToUpper().Equals("ADMIN"))
            {
                return RedirectToRoute("Admin_Default");
            }

            Models.PageModel PageModel = new Models.PageModel();

            if (!string.IsNullOrWhiteSpace(previewPageData))
            {
                ViewBag.PreviewPageData = previewPageData;
                PageModel.InEditMode = true;
            }
            else
            {
                PageModel = new Models.PageModel(friendlyURL, Request);
            }

            if (!string.IsNullOrWhiteSpace(PageModel.Page.Id) || PageModel.InEditMode)
            {
                ViewBag.PageModel = PageModel;

                return View("Index", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName));
            }

            //if we got this far this is a 404

            SettingGroup SettingGroup = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.TEMPLATE_CUSTOM_SETTINGS);

            ViewBag.ViewType = SettingGroup.GetSettingVal("PageNotFoundPage");

            return View("PageNotFound", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName));
        }
コード例 #9
0
 public JsonResult SuccessResultList <T>(List <T> list, Models.PageModel page, string msg = "成功")
 {
     return(Json(new { Success = true, Code = 1, Message = msg, PageIndex = page.PageIndex, PageSize = page.PageSize, TotalCount = page.TotalCount, TotalPage = page.ToTalPage, Content = list }));
 }
コード例 #10
0
ファイル: PageService.cs プロジェクト: yonofate/vaobong
        /// <summary>
        /// Gets the page specified by the given id.
        /// </summary>
        /// <param name="id">The page id</param>
        /// <returns>The page.</returns>
        internal Page GetInternal(string id)
        {
            try {
                Models.PageModel pm = Models.PageModel.GetById(new Guid(id));

                if (pm != null && (pm.Page.GroupId == Guid.Empty || HttpContext.Current.User.IsMember(pm.Page.GroupId)))
                {
                    // Page data
                    Page page = new Page()
                    {
                        Id              = pm.Page.Id,
                        ParentId        = ((Piranha.Models.Page)pm.Page).ParentId,
                        Seqno           = ((Piranha.Models.Page)pm.Page).Seqno,
                        TemplateName    = pm.Page.TemplateName,
                        Title           = pm.Page.Title,
                        NavigationTitle = pm.Page.NavigationTitle,
                        Permalink       = pm.Page.Permalink,
                        IsHidden        = ((Piranha.Models.Page)pm.Page).IsHidden,
                        Created         = pm.Page.Created.ToString(),
                        Updated         = pm.Page.Updated.ToString(),
                        Published       = pm.Page.Published.ToString(),
                        LastPublished   = pm.Page.LastPublished.ToString()
                    };

                    // Regions
                    foreach (var key in ((IDictionary <string, object>)pm.Regions).Keys)
                    {
                        if (((IDictionary <string, object>)pm.Regions)[key] is HtmlString)
                        {
                            page.Regions.Add(new Region()
                            {
                                Name = key, Body =
                                    ((HtmlString)((IDictionary <string, object>)pm.Regions)[key]).ToHtmlString()
                            });
                        }
                        else
                        {
                            page.Regions.Add(new Region()
                            {
                                Name = key, Body =
                                    ((IDictionary <string, object>)pm.Regions)[key]
                            });
                        }
                    }

                    // Properties
                    foreach (var key in ((IDictionary <string, object>)pm.Properties).Keys)
                    {
                        page.Properties.Add(new Property()
                        {
                            Name = key, Value = (string)
                                                ((string)((IDictionary <string, object>)pm.Properties)[key])
                        });
                    }

                    // Attachments
                    foreach (var content in pm.Attachments)
                    {
                        page.Attachments.Add(new Attachment()
                        {
                            Id = content.Id, IsImage = content.IsImage
                        });
                    }

                    // Extensions
                    page.ExpandedExtensions = pm.Extensions;
                    foreach (var key in ((IDictionary <string, object>)pm.Extensions).Keys)
                    {
                        if (((IDictionary <string, object>)pm.Extensions)[key] is HtmlString)
                        {
                            page.Extensions.Add(new Extension()
                            {
                                Name = key, Body =
                                    ((HtmlString)((IDictionary <string, object>)pm.Extensions)[key]).ToHtmlString()
                            });
                        }
                        else
                        {
                            page.Extensions.Add(new Extension()
                            {
                                Name = key, Body =
                                    ((IDictionary <string, object>)pm.Extensions)[key]
                            });
                        }
                    }
                    return(page);
                }
            } catch { }
            return(null);
        }