private void Page_Load(object sender, System.EventArgs e) { SetPageTitle(L10n.Term(".moduleList." + m_sMODULE)); // 06/04/2006 Paul. Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load. // 01/01/2008 Paul. Only an admin can create forums. this.Visible = SplendidCRM.Security.IS_ADMIN; if (!this.Visible) { return; } try { gID = Sql.ToGuid(Request["ID"]); if (!IsPostBack) { ERR_NO_TOPICS.Text = L10n.Term("Forums.ERR_NO_TOPICS"); ERR_NO_TOPICS.Visible = SplendidCache.ForumTopics().Rows.Count == 0; Guid gDuplicateID = Sql.ToGuid(Request["DuplicateID"]); if (!Sql.IsEmptyGuid(gID) || !Sql.IsEmptyGuid(gDuplicateID)) { DbProviderFactory dbf = DbProviderFactories.GetFactory(); using (IDbConnection con = dbf.CreateConnection()) { string sSQL; sSQL = "select * " + ControlChars.CrLf + " from vwFORUMS_Edit" + ControlChars.CrLf; using (IDbCommand cmd = con.CreateCommand()) { cmd.CommandText = sSQL; // 11/24/2006 Paul. Use new Security.Filter() function to apply Team and ACL security rules. Security.Filter(cmd, m_sMODULE, "edit"); if (!Sql.IsEmptyGuid(gDuplicateID)) { Sql.AppendParameter(cmd, gDuplicateID, "ID", false); gID = Guid.Empty; } else { Sql.AppendParameter(cmd, gID, "ID", false); } con.Open(); if (bDebug) { RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd)); } using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (rdr.Read()) { ctlModuleHeader.Title = Sql.ToString(rdr["TITLE"]); SetPageTitle(L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title); Utils.UpdateTracker(Page, m_sMODULE, gID, ctlModuleHeader.Title); ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title; this.AppendEditViewFields(m_sMODULE + ".EditView", tblMain, rdr); } else { // 11/25/2006 Paul. If item is not visible, then don't allow save ctlEditButtons.DisableAll(); ctlEditButtons.ErrorText = L10n.Term("ACL.LBL_NO_ACCESS"); } } } } } else { this.AppendEditViewFields(m_sMODULE + ".EditView", tblMain, null); } } else { // 12/02/2005 Paul. When validation fails, the header title does not retain its value. Update manually. ctlModuleHeader.Title = Sql.ToString(ViewState["ctlModuleHeader.Title"]); SetPageTitle(L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title); } } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); ctlEditButtons.ErrorText = ex.Message; } }