本文整理汇总了C#中Kooboo.CMS.Sites.Models.Page类的典型用法代码示例。如果您正苦于以下问题:C# Page类的具体用法?C# Page怎么用?C# Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Page类属于Kooboo.CMS.Sites.Models命名空间,在下文中一共展示了Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteResult
public override void ExecuteResult(ControllerContext context)
{
string siteName = context.HttpContext.Request.QueryString["cms_siteName"];
string pageName = context.HttpContext.Request.QueryString["cms_pageName"];
if (string.IsNullOrEmpty(siteName) || string.IsNullOrEmpty(pageName))
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var site = new Site(siteName).AsActual();
if (site == null)
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var page = new Page(site, pageName).AsActual();
if (page == null || page.PagePositions == null)
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var proxyPosition = page.PagePositions.OfType<ProxyPosition>().FirstOrDefault();
if (proxyPosition == null)
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var remoteUrl = context.HttpContext.Request.RawUrl;
var content = _proxyRender.Render(new ProxyRenderContext(context, null, proxyPosition, remoteUrl));
if (content != null && !string.IsNullOrEmpty(content.ToString()))
{
context.HttpContext.Response.Write(content.ToString());
}
}
示例2: PageMenuItem
public PageMenuItem(Page page)
{
base.Action = "Index";
base.Controller = "Page";
base.Area = "Sites";
base.Text = page.Name;
if (page.Navigation != null && !string.IsNullOrEmpty(page.Navigation.DisplayText))
{
base.Text = page.Navigation.DisplayText;
}
base.Tips = page.Name;
base.Visible = true;
RouteValues = new System.Web.Routing.RouteValueDictionary();
RouteValues.Add("parentPage", page.FullName);
HtmlAttributes = new System.Web.Routing.RouteValueDictionary();
if (page.IsDefault)
{
HtmlAttributes.Add("class", "home");
}
//this.Page = page;
Initializer = new PageMenuItemInitializer();
}
示例3: GetModulePositionIdForUrl
public string GetModulePositionIdForUrl(ModulePosition modulePosition, RouteValueDictionary routeValues, out Page page)
{
page = this.PageRequestContext.Page;
string modulePositionId = modulePosition.PagePositionId;
if (!string.IsNullOrEmpty(modulePosition.Entry.LinkToEntryName))
{
foreach (var item in Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.All(this.PageRequestContext.Site, null))
{
foreach (var position in item.PagePositions.OfType<ModulePosition>())
{
if (position.Entry != null && !string.IsNullOrEmpty(position.Entry.Name)
&& position.Entry.Name.EqualsOrNullEmpty(modulePosition.Entry.LinkToEntryName, StringComparison.OrdinalIgnoreCase))
{
page = item;
modulePositionId = position.PagePositionId;
}
}
}
}
else
{
modulePositionId = GetModulePositionIdForUrl(modulePosition.ModuleName, modulePosition.PagePositionId, routeValues);
}
return modulePositionId;
}
示例4: AddCaching
public virtual void AddCaching(HttpContextBase httpContext, Page page, string html)
{
var filePath = GetFilePath(page, httpContext.Request.Path);
if (!File.Exists(filePath))
{
IOUtility.SaveStringToFile(filePath, html);
}
}
示例5: GetAbsolutePageUrl
public static string GetAbsolutePageUrl(Site site, Page page, object values)
{
UrlHelper urlHelper = MvcUtility.GetUrlHelper();
FrontRequestChannel requestChannel = site.FrontRequestChannel();
string pageUrl = FrontUrlHelper.GeneratePageUrl(urlHelper, site, page, values, requestChannel).ToString();
string host = GetHost(site);
return HttpContext.Current.Request.ToAbsoluteUrl(host, pageUrl);
}
示例6: CreateSelectItemTreeNode
protected override void CreateSelectItemTreeNode(RequestContext requestContext, Page page, List<System.Web.Mvc.SelectListItem> list)
{
string uuid = requestContext.GetRequestValue("UUID");
if (uuid.ToLower() != page.UUID.ToLower())
{
base.CreateSelectItemTreeNode(requestContext,page, list);
}
}
示例7: GetPageItems
private void GetPageItems(Page page, List<SelectListItem> items)
{
items.Add(new SelectListItem() { Text = page.FriendlyName, Value = page.FriendlyName });
foreach (var child in Kooboo.CMS.Sites.Persistence.Providers.PageProvider.ChildPages(page))
{
GetPageItems(child, items);
}
}
示例8: GetFilePath
protected virtual string GetFilePath(Page page, string requestPath)
{
requestPath = requestPath.TrimEnd('/');
var extension = Path.GetExtension(requestPath);
if (string.IsNullOrEmpty(extension))
{
requestPath = requestPath + "/default.html";
}
return Path.Combine(GetPageCachingPath(page), requestPath.TrimStart('/'));
}
示例9: EnsurePagePublished
protected virtual void EnsurePagePublished(Controller controller, Page page)
{
if (page.Published.Value == false)
{
if (!HttpContext.Current.User.Identity.IsAuthenticated)
{
throw new HttpException(0x194, string.Format(SR.GetString("Path_not_found"), new object[] { controller.Request.Path }));
}
}
}
示例10: GetCaching
public virtual string GetCaching(HttpContextBase httpContext, Page page)
{
string html = null;
var filePath = GetFilePath(page, httpContext.Request.Path);
if (File.Exists(filePath))
{
html = IOUtility.ReadAsString(filePath);
}
return html;
}
示例11: TestPhysicalPath
public void TestPhysicalPath()
{
string pageName = "page1";
var site = new Site("Site1");
var page = new Page(site, new string[] { pageName });
string expected1 = Path.Combine(site.PhysicalPath, "pages", pageName);
Assert.AreEqual(expected1, page.PhysicalPath, true);
}
示例12: TestParseFromPhysicalPath
public void TestParseFromPhysicalPath()
{
string siteName = "site1";
string pageName = "page1";
string physicalPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sites", siteName, "pages", pageName);
var page = new Page(physicalPath);
Assert.AreEqual(pageName, page.Name);
Assert.IsTrue(page.IsDummy);
}
示例13: GenerateList
private void GenerateList(Site site, Page page, ref IEnumerable<Page> pageList)
{
var children = Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.ChildPages(site, page.FullName, null);
pageList = pageList.Concat(children);
foreach (var s in children)
{
this.GenerateList(site, s, ref pageList);
}
}
示例14: UpdatePage
public string UpdatePage(string repositoryId, string pageId, Page properties)
{
var site = ModelHelper.GetSite(repositoryId);
var page = new Page(site, pageId);
MapProperties(properties, page);
_incomeDataManager.UpdatePage(site, page, ContextHelper.GetVendor());
return page.FullName;
}
示例15: TestChildVirtualPath
public void TestChildVirtualPath()
{
string parentPageName = "page1";
var site = new Site("Site1");
var parent = new Page(site, new string[] { parentPageName });
string childPageName = "childPage";
var child = new Page(parent, childPageName);
string expected1 = "page1/childPage";// Kooboo.Web.Url.UrlUtility.Combine(site.VirtualPath, "pages", parentPageName, childPageName);
Assert.AreEqual(expected1, child.VirtualPath, true);
}