private void ShowWiki(string SpectrumSEQ) { WikiPage wikiPage = WikiOperations.GetWikiPage(SpectrumSEQ.Trim()); if (wikiPage == null) //{ // SetPageContent(wikiPage); // } // else { wikiPage = new WikiPage(); wikiPage.PageName = SpectrumSEQ.Trim(); wikiPage.PageContent = "There no wiki page create for this spectrum, You are welcome to creat it."; wikiPage.ModifiedBy = User.Identity.IsAuthenticated ? User.Identity.Name : "Anonymous"; wikiPage.LastModified = DateTime.Now; wikiPage.Created = DateTime.Now; wikiPage.IsPrivate = User.Identity.IsAuthenticated ? true : false; wikiPage.AllowAnonEdit = User.Identity.IsAuthenticated ? false : true; // if (WikiOperations.CreateWikiPage(wikiPage) == 1) // { // SetPageContent(wikiPage); // } // else // { // litContent.Text = "Error creating page"; //} } SetPageContent(wikiPage); }
private void ShowWiki(string SpectrumSEQ) { WikiPage wikiPage = WikiOperations.GetWikiPage(SpectrumSEQ.Trim()); /*if (wikiPage != null) * { * SetPageContent(wikiPage); * } * else*/ if (wikiPage == null) { wikiPage = new WikiPage(); wikiPage.PageName = SpectrumSEQ.Trim(); wikiPage.PageContent = "There is no Wiki page on record for this spectrum, please feel free to create one."; wikiPage.ModifiedBy = User.Identity.IsAuthenticated ? User.Identity.Name : "Anonymous"; wikiPage.LastModified = DateTime.Now; wikiPage.Created = DateTime.Now; wikiPage.IsPrivate = User.Identity.IsAuthenticated ? true : false; wikiPage.AllowAnonEdit = User.Identity.IsAuthenticated ? false : true; /*if (WikiOperations.CreateWikiPage(wikiPage) == 1) * { * SetPageContent(wikiPage); * } * else * { * litContent.Text = "Error creating page"; * }*/ } SetPageContent(wikiPage); }
protected void btnSave_Click(object sender, EventArgs e) { /*string UserData = ftbEdit.Text; * if (!UserData.Contains("free to create")) * {*/ nameEdit.Text = nameEdit.Text.Trim(); if (nameEdit.Text == "") { prompt.Text = @"<div class=""alert alert-error""><strong>Note:</strong> Please enter a name.</div>"; } else { WikiPage wikiPage = instantiateWikiPage(); wikiPage.Created = null; if (WikiOperations.UpdatePage(wikiPage) != 1) { wikiPage.Created = DateTime.Now; if (WikiOperations.CreateWikiPage(wikiPage) != 1) { throw new Exception("Error Updating: " + m_PageName + " page"); } } Response.Redirect(prevPage); } /*} * else * { * Response.Redirect(prevPage); * }*/ //if (m_PageName.StartsWith("IPI") || m_PageName.StartsWith("CoPro") ) //{ // Response.Redirect("ProteinInfo.aspx?QType=Protein ID&QValue=" + m_PageName); //} //else if (m_PageName.StartsWith("CoPep")) //{ // Response.Redirect("PeptideInfo.aspx?QType=Peptide ID&QValue=" + m_PageName); //} //else //{ // Response.Redirect ("SpectrumInfo.aspx?QValue=" + m_PageName); //} }
private void ShowWiki(string copaPID) { WikiPage wikiPage = WikiOperations.GetWikiPage(copaPID.Trim()); if (wikiPage == null) { wikiPage = new WikiPage(); wikiPage.PageName = copaPID.Trim(); wikiPage.PageContent = "There is no Wiki page on record for this protein, please feel free to create one."; wikiPage.ModifiedBy = User.Identity.IsAuthenticated ? User.Identity.Name : "Anonymous"; wikiPage.LastModified = DateTime.Now; wikiPage.Created = DateTime.Now; wikiPage.IsPrivate = User.Identity.IsAuthenticated ? true : false; wikiPage.AllowAnonEdit = User.Identity.IsAuthenticated ? false : true; } SetPageContent(wikiPage); }
protected void LoadPage() { WikiPage wikiPage = WikiOperations.GetWikiPage(m_PageName); // begin add if (wikiPage == null) { wikiPage = instantiateWikiPage(); ftbEdit.Text = string.Format(default_string, m_PageName); } else { ftbEdit.Text = wikiPage.PageContent; } // end add m_PageName = wikiPage.PageName; //chkPrivate.Checked = wikiPage.IsPrivate; //chkAnonEdit.Checked = wikiPage.AllowAnonEdit; ViewState.Add("PageName", m_PageName); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { prevPage = Request.UrlReferrer.ToString(); bool UseAuthentication = false;// Convert.ToBoolean(ConfigurationManager.AppSettings["UseAuthentication"]); m_PageName = Request.QueryString["PageName"]; Page.Title = "COPaKB Wiki Edit: " + m_PageName; lbPageName.Text = m_PageName; if (UseAuthentication && ((WikiOperations.IsPagePrivate(m_PageName) && !User.IsInRole("Super User")) || (!User.Identity.IsAuthenticated && !WikiOperations.AllowAnonymousEdit(m_PageName)))) { //They don't have rights to view this page Response.Redirect("~/Login.aspx"); } LoadPage(); } else { m_PageName = (string)ViewState["PageName"]; Page.Title = "Edit: " + m_PageName; bool UseAuthentication = false;// Convert.ToBoolean(ConfigurationManager.AppSettings["UseAuthentication"]); if (UseAuthentication && WikiOperations.IsPagePrivate(m_PageName) && !User.IsInRole("Super User")) { //They don't have rights to view this page Response.Redirect("~/Login.aspx"); } } }
private WikiPage GetWikiPage() { return(WikiOperations.GetWikiPage(m_PageName)); }
protected void Page_Load(object sender, EventArgs e) { GetWikiPageName(); if (m_PageName == "") { lbPageName.Text = "COPaKB Wiki Home"; m_PageName = "COPaKB Wiki Home"; //lbEdit.Visible = false; //lbViewHistory.Visible = false; WikiPage wikiPage = GetWikiPage(); if (wikiPage != null) { SetPageContent(wikiPage); } LoadNewPages(); } else { Page.Title = "COPaKB Wiki:" + m_PageName; lbPageName.Text = m_PageName; pNewPages.Visible = false; bool UseAuthentication = Convert.ToBoolean(ConfigurationManager.AppSettings["UseAuthentication"]); if (UseAuthentication && WikiOperations.IsPagePrivate(m_PageName) && !User.IsInRole("Super User")) { //They don't have rights to view this page Response.Redirect("~/Login.aspx"); } WikiPage wikiPage = GetWikiPage(); if (wikiPage != null) { SetPageContent(wikiPage); } else { bool AllowAnonCreate = Convert.ToBoolean(ConfigurationManager.AppSettings["AllowAnonymousPageCreation"]); if (UseAuthentication && !AllowAnonCreate && !User.Identity.IsAuthenticated) { Response.Redirect("~/Login.aspx"); } wikiPage = new WikiPage(); wikiPage.PageName = m_PageName; wikiPage.PageContent = string.Format("There is no Wiki page on record for '{0}', please feel free to create one.", m_PageName); wikiPage.ModifiedBy = User.Identity.IsAuthenticated ? User.Identity.Name : "Anonymous"; wikiPage.LastModified = DateTime.Now; wikiPage.Created = DateTime.Now; wikiPage.IsPrivate = User.Identity.IsAuthenticated ? true : false; wikiPage.AllowAnonEdit = User.Identity.IsAuthenticated ? false : true; /*if (WikiOperations.CreateWikiPage(wikiPage) == 1) * { * SetPageContent(wikiPage); * } * else * { * litContent.Text = "Error creating page"; * }*/ SetPageContent(wikiPage); } } }