本文整理汇总了C#中Carrotware.CMS.Core.ContentPage类的典型用法代码示例。如果您正苦于以下问题:C# ContentPage类的具体用法?C# ContentPage怎么用?C# ContentPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentPage类属于Carrotware.CMS.Core命名空间,在下文中一共展示了ContentPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContentPageExport
public ContentPageExport() {
CarrotCakeVersion = SiteData.CarrotCakeCMSVersion;
ExportDate = DateTime.UtcNow;
ThePage = new ContentPage();
ThePageWidgets = new List<Widget>();
}
示例2: GetContent
public static PagePayload GetContent(ContentPage cp) {
PagePayload page = new PagePayload();
page.ThePage = cp;
page.Load();
return page;
}
示例3: GetHtml
public override string GetHtml() {
string sFieldValue = string.Empty;
if (this.ContentPage == null) {
this.ContentPage = SiteData.GetCurrentPage();
}
SiteNav navNext = new SiteNav();
if (this.NavigationDirection != NavDirection.Unknown) {
using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
if (NavigationDirection == NavDirection.Prev) {
navNext = navHelper.GetPrevPost(SiteData.CurrentSiteID, this.ContentPage.Root_ContentID, !SecurityData.IsAuthEditor);
}
if (NavigationDirection == NavDirection.Next) {
navNext = navHelper.GetNextPost(SiteData.CurrentSiteID, this.ContentPage.Root_ContentID, !SecurityData.IsAuthEditor);
}
if (navNext != null) {
if (this.UseDefaultText) {
string sField = this.CaptionDataField.ToString();
object objData = ReflectionUtilities.GetPropertyValue(navNext, sField);
if (objData != null) {
sFieldValue = String.Format("{0}", objData);
}
this.NavigateText = sFieldValue;
}
this.NavigateUrl = navNext.FileName;
} else {
this.NavigateUrl = String.Empty;
}
}
} else {
this.NavigateUrl = String.Empty;
}
if (!String.IsNullOrEmpty(this.NavigateUrl)) {
var lnkBuilder = new TagBuilder("a");
lnkBuilder.MergeAttribute("href", this.NavigateUrl);
lnkBuilder.InnerHtml = this.NavigateUrl;
if (!String.IsNullOrEmpty(this.NavigateText)) {
lnkBuilder.InnerHtml = this.NavigateText;
}
var lnkAttribs = (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(linkAttributes);
lnkBuilder.MergeAttributes(lnkAttribs);
return lnkBuilder.ToString(TagRenderMode.Normal);
} else {
return String.Empty;
}
}
示例4: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
pageContents = new ContentPage(SiteID, ContentPageType.PageType.ContentEntry);
DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);
int iOrder = pageHelper.GetMaxNavOrder(SiteID) + 1;
Guid? parentContentID = ParentPagePicker.SelectedPage;
pageContents.Parent_ContentID = parentContentID;
pageContents.TitleBar = txtTitle.Text;
pageContents.NavMenuText = txtNav.Text;
pageContents.PageHead = txtHead.Text;
pageContents.FileName = txtFileName.Text;
pageContents.MetaDescription = txtDescription.Text;
pageContents.MetaKeyword = txtKey.Text;
pageContents.Heartbeat_UserId = SecurityData.CurrentUserGuid;
pageContents.EditHeartbeat = dtSite.AddMinutes(5);
pageContents.EditUserId = SecurityData.CurrentUserGuid;
pageContents.IsLatestVersion = true;
pageContents.EditDate = SiteData.CurrentSite.Now;
pageContents.NavOrder = iOrder;
pageContents.PageActive = false;
pageContents.ShowInSiteMap = true;
pageContents.ShowInSiteNav = true;
pageContents.ContentType = ContentPageType.PageType.ContentEntry;
pageContents.GoLiveDate = dtSite;
pageContents.RetireDate = dtSite.AddYears(200);
pageContents.SavePageEdit();
pnlAdd.Visible = false;
pnlSaved.Visible = true;
litPageName.Text = pageContents.FileName;
lnkNew.NavigateUrl = pageContents.FileName;
if (pageContents.FileName.ToLowerInvariant().EndsWith(SiteData.DefaultDirectoryFilename)) {
VirtualDirectory.RegisterRoutes(true);
}
Master.ShowSave();
}
示例5: GetEmptyHome
public static ContentPage GetEmptyHome()
{
ContentPage navData = new ContentPage();
navData.ContentID = Guid.Empty;
navData.Root_ContentID = Guid.Empty;
navData.SiteID = SiteData.CurrentSiteID;
navData.TemplateFile = "_EmptyHome";
navData.FileName = SiteData.DefaultDirectoryFilename;
navData.NavMenuText = "NONE";
navData.PageHead = "NONE";
navData.TitleBar = "NONE";
navData.PageActive = false;
navData.PageText = "<p>NO PAGE CONTENT</p>";
navData.EditDate = DateTime.Now.Date.AddDays(-1);
navData.CreateDate = DateTime.Now.Date.AddDays(-10);
navData.GoLiveDate = DateTime.Now.Date.AddDays(1);
navData.RetireDate = DateTime.Now.Date.AddDays(90);
navData.ContentType = ContentPageType.PageType.ContentEntry;
return navData;
}
示例6: GetLatestContentByURL
public ContentPage GetLatestContentByURL(Guid siteID, bool bActiveOnly, string sPage)
{
ContentPage content = null;
vw_carrot_Content cont = CompiledQueries.GetLatestContentByURL(db, siteID, bActiveOnly, sPage);
if (cont != null) {
content = new ContentPage(cont);
}
return content;
}
示例7: FindHome
public ContentPage FindHome(Guid siteID, bool bActiveOnly)
{
ContentPage content = null;
vw_carrot_Content cont = CompiledQueries.FindHome(db, siteID, bActiveOnly);
if (cont != null) {
content = new ContentPage(cont);
}
return content;
}
示例8: FindContentByID
public ContentPage FindContentByID(Guid siteID, Guid rootContentID)
{
ContentPage content = null;
vw_carrot_Content cont = CompiledQueries.GetLatestContentByID(db, siteID, false, rootContentID);
if (cont != null) {
content = new ContentPage(cont);
}
return content;
}
示例9: FindByPageSlug
public ContentPage FindByPageSlug(Guid siteID, DateTime datePublished, string urlPageSlug)
{
ContentPage content = null;
vw_carrot_Content cont = CompiledQueries.cqGetLatestContentBySlug(db, siteID, datePublished, urlPageSlug);
if (cont != null) {
content = new ContentPage(cont);
}
return content;
}
示例10: FindByFilename
public ContentPage FindByFilename(Guid siteID, string urlFileName)
{
ContentPage content = null;
vw_carrot_Content cont = CompiledQueries.GetLatestContentByURL(db, siteID, false, urlFileName);
if (cont != null) {
content = new ContentPage(cont);
}
return content;
}
示例11: GetSamplerView
public static ContentPage GetSamplerView()
{
string sFile1 = String.Empty;
string sFile2 = String.Empty;
try {
Assembly _assembly = Assembly.GetExecutingAssembly();
using (StreamReader oTextStream = new StreamReader(_assembly.GetManifestResourceStream("Carrotware.CMS.Core.SiteContent.Mock.SampleContent1.txt"))) {
sFile1 = oTextStream.ReadToEnd();
}
using (StreamReader oTextStream = new StreamReader(_assembly.GetManifestResourceStream("Carrotware.CMS.Core.SiteContent.Mock.SampleContent2.txt"))) {
sFile2 = oTextStream.ReadToEnd();
}
List<string> imageNames = (from i in _assembly.GetManifestResourceNames()
where i.Contains("SiteContent.Mock.sample")
&& i.EndsWith(".png")
select i).ToList();
foreach (string img in imageNames) {
var imgURL = CMSConfigHelper.GetWebResourceUrl(typeof(ContentPage), img);
sFile1 = sFile1.Replace(img, imgURL);
sFile2 = sFile2.Replace(img, imgURL);
}
} catch { }
ContentPage pageNew = new ContentPage();
pageNew.Root_ContentID = SiteData.CurrentSiteID;
pageNew.ContentID = pageNew.Root_ContentID;
pageNew.SiteID = SiteData.CurrentSiteID;
pageNew.Parent_ContentID = null;
pageNew.PageText = "<h2>Content CENTER</h2>\r\n" + sFile1;
pageNew.LeftPageText = "<h2>Content LEFT</h2>\r\n" + sFile2;
pageNew.RightPageText = "<h2>Content RIGHT</h2>\r\n" + sFile2;
pageNew.IsLatestVersion = true;
pageNew.NavOrder = -1;
pageNew.TitleBar = "Template Preview - TITLE";
pageNew.NavMenuText = "Template PV - NAV"; ;
pageNew.PageHead = "Template Preview - HEAD";
pageNew.PageActive = true;
pageNew.ShowInSiteNav = true;
pageNew.ShowInSiteMap = true;
pageNew.EditUserId = SecurityData.CurrentUserGuid;
pageNew.EditDate = DateTime.Now.Date.AddHours(-8);
pageNew.CreateDate = DateTime.Now.Date.AddHours(-38);
pageNew.GoLiveDate = pageNew.EditDate.AddHours(-5);
pageNew.RetireDate = pageNew.CreateDate.AddYears(5);
pageNew.TemplateFile = SiteData.PreviewTemplateFile;
pageNew.FileName = SiteData.PreviewTemplateFilePage;
pageNew.MetaDescription = "Meta Description";
pageNew.MetaKeyword = "Meta Keyword";
pageNew.ContentType = ContentPageType.PageType.BlogEntry;
pageNew.PageSlug = "sampler-page-view";
List<ContentCategory> lstK = new List<ContentCategory>();
List<ContentTag> lstT = new List<ContentTag>();
for (int i = 0; i < 5; i++) {
ContentCategory k = new ContentCategory {
ContentCategoryID = Guid.NewGuid(),
CategoryText = "Keyword Text " + i.ToString(),
CategorySlug = "keyword-slug-" + i.ToString()
};
ContentTag t = new ContentTag {
ContentTagID = Guid.NewGuid(),
TagText = "Tag Text " + i.ToString(),
TagSlug = "tag-slug-" + i.ToString()
};
lstK.Add(k);
lstT.Add(t);
}
pageNew.ContentCategories = lstK;
pageNew.ContentTags = lstT;
return pageNew;
}
示例12: CreateEmptyHome
private void CreateEmptyHome() {
DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);
ContentPage pageContents = new ContentPage {
SiteID = SiteID,
Root_ContentID = Guid.NewGuid(),
ContentID = Guid.NewGuid(),
EditDate = SiteData.CurrentSite.Now,
CreateUserId = SecurityData.CurrentUserGuid,
CreateDate = SiteData.CurrentSite.Now,
GoLiveDate = dtSite.AddMinutes(-5),
RetireDate = dtSite.AddYears(200),
TitleBar = "Home",
NavMenuText = "Home",
PageHead = "Home",
FileName = "/home",
PageText = SiteData.StarterHomePageSample,
LeftPageText = String.Empty,
RightPageText = String.Empty,
NavOrder = 0,
IsLatestVersion = true,
PageActive = true,
ShowInSiteNav = true,
ShowInSiteMap = true,
BlockIndex = false,
EditUserId = SecurityData.CurrentUserGuid,
ContentType = ContentPageType.PageType.ContentEntry,
TemplateFile = SiteData.DefaultTemplateFilename
};
pageContents.SavePageEdit();
}
示例13: OverrideKey
public void OverrideKey(string sPageName)
{
filePage = null;
using (ContentPageHelper pageHelper = new ContentPageHelper()) {
filePage = pageHelper.FindByFilename(SiteData.CurrentSiteID, sPageName);
}
}
示例14: LoadGuids
private void LoadGuids() {
using (ContentPageHelper pageHelper = new ContentPageHelper()) {
if (!String.IsNullOrEmpty(CurrentEditPage)) {
filePage = pageHelper.FindByFilename(SiteData.CurrentSite.SiteID, CurrentEditPage);
if (filePage != null) {
CurrentPageGuid = filePage.Root_ContentID;
}
} else {
if (CurrentPageGuid != Guid.Empty) {
filePage = pageHelper.FindContentByID(SiteData.CurrentSite.SiteID, CurrentPageGuid);
if (filePage != null) {
CurrentEditPage = filePage.FileName;
}
} else {
filePage = new ContentPage();
}
}
}
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e) {
Master.UsesSaved = true;
Master.HideSave();
guidContentID = GetGuidPageIDFromQuery();
guidWidgetID = GetGuidParameterFromQuery("widgetid");
sFieldName = GetStringParameterFromQuery("field").ToLower();
sMode = GetStringParameterFromQuery("mode").ToLower();
cmsHelper.OverrideKey(guidContentID);
if (cmsHelper.cmsAdminContent != null) {
pageContents = cmsHelper.cmsAdminContent;
if (sMode == "plain") {
divCenter.Visible = false;
reBody.CssClass = "mcePlainText";
pnlPlain.Visible = true;
} else {
pnlRichEdit.Visible = true;
}
if (!IsPostBack) {
if (guidWidgetID != Guid.Empty) {
Widget pageWidget = (from w in cmsHelper.cmsAdminWidget
where w.Root_WidgetID == guidWidgetID
select w).FirstOrDefault();
reBody.Text = pageWidget.ControlProperties;
} else {
switch (sFieldName) {
case "c":
reBody.Text = pageContents.PageText;
break;
case "l":
reBody.Text = pageContents.LeftPageText;
break;
case "r":
reBody.Text = pageContents.RightPageText;
break;
}
}
}
}
}