protected string RenderPageContent() { Page page; if (_pageName == null) { _pageName = string.Empty; } if (Version > 0) { page = Wiki.GetPage(_pageName, Version); } else { page = Wiki.GetPage(_pageName); } if (page == null) { return(RenderEmptyPage()); } RiseWikiPageLoaded(page); RisePublishVersionInfo(page); return(HtmlWikiUtil.WikiToHtml(page.PageName, page.Body, Page.ResolveUrl(Request.AppRelativeCurrentExecutionFilePath), Wiki.GetPagesAndFiles(page.Body), Page.ResolveUrl(ImageHandlerUrlFormat), TenantId, CanEditPage && Version == 0 ? ConvertType.Editable : ConvertType.NotEditable)); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } Wiki_FCKEditor.BasePath = VirtualPathUtility.ToAbsolute(BaseFCKRelPath); Wiki_FCKEditor.ToolbarSet = "WikiPanel"; if (PageName != null && Visible) { var page = Wiki.GetPage(PageNameUtil.Decode(PageName)); var isPageNew = (page == null || IsNew); RiseWikiPageLoaded(isPageNew, page); if (!isPageNew) { txtPageName.Value = page.PageName; if (PageSection < 0) { SetWikiFCKEditorValue(page.PageName, page.Body); } else { SetWikiFCKEditorValue(page.PageName, HtmlWikiUtil.GetWikiSectionBySectionNumber(page.Body, PageSection)); txtPageName.Attributes["readonly"] = "readonly"; txtPageName.Value += string.Format(WikiUCResource.wikiPageEditSectionCaptionFormat, HtmlWikiUtil.GetWikiSectionNameBySectionNumber(page.Body, PageSection)); } //Check for 'help' and 'main' page if (IsStandartName(page)) { txtPageName.Attributes["readonly"] = "readonly"; } PageVersion = page.Version; //if (page.PageName.Equals(string.Empty)) //txtPageName.ReadOnly = true; //We need to disable any changes for the one time saved page. RisePublishVersionInfo(page); } else if (!string.IsNullOrEmpty(PageName)) { txtPageName.Value = PageNameUtil.Decode(PageName); if (IsSpecialName) { txtPageName.Attributes["readonly"] = "readonly"; } } phPageName.Visible = txtPageName.Attributes["readonly"] == null; } hfFCKLastState.Value = (!IsWysiwygDefault).ToString().ToLower(); //txtPageName.Focus(); }
public static string CreateImageFromWiki(string pageName, string value, string appRelativeCurrentExecutionFilePath, string imageHandlerUrl, int tenantId) { return(HtmlWikiUtil.CreateImageFromWiki(pageName, value, appRelativeCurrentExecutionFilePath, imageHandlerUrl, tenantId)); }
public static string ConvertWikiToHtmlWysiwyg(string pageName, string value, string appRelativeCurrentExecutionFilePath, string imageHandlerUrl, int tenantId) { return(HtmlWikiUtil.WikiToHtml(pageName, value, appRelativeCurrentExecutionFilePath, new WikiEngine().GetPagesAndFiles(value), imageHandlerUrl, tenantId, ConvertType.Wysiwyg)); }
public SaveResult Save(Guid userId, out string pageName) { try { if (SetNewFCKMode != null) { bool isSource; bool.TryParse(hfFCKLastState.Value, out isSource); SetNewFCKMode(!isSource); IsWysiwygDefault = !isSource; //We need to update the variable if SetNewFCKMode is used only!!! } Page page; string currentPageName = txtPageName.Text.Trim(); if (currentPageName.Length > 240) { currentPageName = currentPageName.Substring(0, 240).Trim(); } currentPageName = PageNameUtil.Clean(currentPageName); if (pageSection >= 0) { currentPageName = PageNameUtil.Decode(PageName); } pageName = currentPageName; bool isPageRename = pageName != PageNameUtil.Decode(PageName) && !string.IsNullOrEmpty(PageName); string oldPageName = PageName; if (currentPageName.Equals(string.Empty) && !txtPageName.ReadOnly) { SetWikiFCKEditorValue(currentPageName, Wiki_FCKEditor.Value); return(SaveResult.PageNameIsEmpty); } if (!IsSpecialName && IsNameReserved(currentPageName)) { SetWikiFCKEditorValue(currentPageName, Wiki_FCKEditor.Value); return(SaveResult.PageNameIsIncorrect); } if (userId.Equals(Guid.Empty)) { SetWikiFCKEditorValue(currentPageName, Wiki_FCKEditor.Value); return(SaveResult.UserIdIsEmpty); } if (!PageNameUtil.Decode(PageName).Equals(currentPageName, StringComparison.InvariantCulture)) { page = Wiki.GetPage(currentPageName); if (page != null) { SetWikiFCKEditorValue(currentPageName, Wiki_FCKEditor.Value); return(SaveResult.SamePageExists); } page = new Page(); } else { page = Wiki.GetPage(currentPageName); if (page == null) { page = new Page(); } } page.PageName = currentPageName; string PageResult; if (pageSection < 0) { PageResult = Wiki_FCKEditor.Value; } else { PageResult = HtmlWikiUtil.SetWikiSectionBySectionNumber(page.Body, pageSection, Wiki_FCKEditor.Value); } if (PageResult.Equals(page.Body)) { SetWikiFCKEditorValue(page.PageName, Wiki_FCKEditor.Value); return(SaveResult.NoChanges); } page.Body = PageResult; if (pageVersion > 0 && pageVersion < Wiki.GetPageMaxVersion(page.PageName)) { SetWikiFCKEditorValue(page.PageName, Wiki_FCKEditor.Value); return(SaveResult.OldVersion); } page.Date = TenantUtil.DateTimeNow(); page.UserID = userId; page.Version++; Wiki.SavePage(page); var newCats = Wiki.UpdateCategoriesByPageContent(page); if (newCats.Count > 0 && SaveNewCategoriesAdded != null) { SaveNewCategoriesAdded(this, newCats, page.PageName); } pageVersion = page.Version; RisePublishVersionInfo(page); SetWikiFCKEditorValue(page.PageName, Wiki_FCKEditor.Value); if (pageSection >= 0) { return(SaveResult.SectionUpdate); } if (isPageRename) { //create dumb page var oldpage = Wiki.GetPage(PageNameUtil.Decode(oldPageName)); if (oldpage != null) { oldpage.Date = TenantUtil.DateTimeNow(); oldpage.UserID = userId; oldpage.Body = string.Format(WikiUCResource.wikiPageMoved, pageName); //Dummy oldpage.Version++; Wiki.SavePage(oldpage); return(SaveResult.OkPageRename); } else { return(SaveResult.SamePageExists); } } return(SaveResult.Ok); } catch (Exception) { pageName = txtPageName.Text.Trim(); return(SaveResult.Error); } }
private string RenderPageContent(string pageName, string wiki) { return(HtmlWikiUtil.WikiToHtml(pageName, wiki, Page.ResolveUrl(Request.AppRelativeCurrentExecutionFilePath), Wiki.GetPagesAndFiles(wiki), Page.ResolveUrl(ImageHandlerUrlFormat), TenantId, ConvertType.Wysiwyg)); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } _mobileVer = MobileDetector.IsMobile; //fix for IE 10 var browser = HttpContext.Current.Request.Browser.Browser; var userAgent = Context.Request.Headers["User-Agent"]; var regExp = new Regex("MSIE 10.0", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline); var regExpIe11 = new Regex("(?=.*Trident.*rv:11.0).+", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline); if (browser == "IE" && regExp.Match(userAgent).Success || regExpIe11.Match(userAgent).Success) { _mobileVer = true; } Wiki_FCKEditor.BasePath = VirtualPathUtility.ToAbsolute(BaseFCKRelPath); Wiki_FCKEditor.ToolbarSet = "WikiPanel"; if (PageName != null && Visible) { var page = Wiki.GetPage(PageNameUtil.Decode(PageName)); var isPageNew = (page == null || IsNew); RiseWikiPageLoaded(isPageNew, page); if (!isPageNew) { txtPageName.Text = page.PageName; if (PageSection < 0) { SetWikiFCKEditorValue(page.PageName, page.Body); } else { SetWikiFCKEditorValue(page.PageName, HtmlWikiUtil.GetWikiSectionBySectionNumber(page.Body, PageSection)); txtPageName.ReadOnly = true; txtPageName.Text += string.Format(WikiUCResource.wikiPageEditSectionCaptionFormat, HtmlWikiUtil.GetWikiSectionNameBySectionNumber(page.Body, PageSection)); } //Check for 'help' and 'main' page if (IsStandartName(page)) { txtPageName.ReadOnly = true; } PageVersion = page.Version; //if (page.PageName.Equals(string.Empty)) //txtPageName.ReadOnly = true; //We need to disable any changes for the one time saved page. RisePublishVersionInfo(page); } else if (!string.IsNullOrEmpty(PageName)) { txtPageName.Text = PageNameUtil.Decode(PageName); if (IsSpecialName) { txtPageName.ReadOnly = true; } } phPageName.Visible = !txtPageName.ReadOnly; } hfFCKLastState.Value = (!IsWysiwygDefault).ToString().ToLower(); }