using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.GlobalHelper;
using CMS.SiteProvider;
using CMS.UIControls;
public partial class CMSModules_AbuseReport_Controls_AbuseReportListAndEdit : CMSAdminControl
{
#region "Properties"
///
/// Where condition for grid.
///
public string WhereCondition
{
get
{
return ucAbuseReportList.WhereCondition;
}
set
{
ucAbuseReportList.WhereCondition = value;
}
}
///
/// Items per page for grid.
///
public string ItemsPerPage
{
get
{
return ucAbuseReportList.ItemsPerPage;
}
set
{
ucAbuseReportList.ItemsPerPage = value;
}
}
///
/// Site name filter.
///
public string SiteName
{
get
{
return ucAbuseReportList.SiteName;
}
set
{
ucAbuseReportList.SiteName = value;
}
}
///
/// Status of abuse report.
///
public int Status
{
get
{
return ucAbuseReportList.Status;
}
set
{
ucAbuseReportList.Status = value;
}
}
///
/// Order by for uni grid.
///
public string OrderBy
{
get
{
return ucAbuseReportList.OrderBy;
}
set
{
ucAbuseReportList.OrderBy = value;
}
}
///
/// Returns true if the control processing should be stopped.
///
public override bool StopProcessing
{
get
{
return base.StopProcessing;
}
set
{
base.StopProcessing = value;
ucAbuseEdit.StopProcessing = value;
ucAbuseReportList.StopProcessing = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (StopProcessing)
{
return;
}
ucAbuseReportList.UseEditOnPostback = true;
if (!String.IsNullOrEmpty(hfEditReport.Value))
{
ucAbuseEdit.ReportID = ValidationHelper.GetInteger(hfEditReport.Value, 0);
}
// Edit control must have stop processing true if list (first edit will be executed in prerender) to handle ItemEdit properly
if (ucAbuseEdit.ReportID == 0)
{
ucAbuseEdit.StopProcessing = true;
}
lnkEditBack.Click += new EventHandler(lnkEditBack_Click);
ucAbuseReportList.OnCheckPermissions += new CheckPermissionsEventHandler(ucAbuseReportList_OnCheckPermissions);
ucAbuseEdit.OnCheckPermissions += new CheckPermissionsEventHandler(ucAbuseReportList_OnCheckPermissions);
}
///
/// Check permissions.
///
/// Permission type
/// Sender
private void ucAbuseReportList_OnCheckPermissions(string permissionType, CMSAdminControl sender)
{
RaiseOnCheckPermissions(permissionType, sender);
}
protected override void OnPreRender(EventArgs e)
{
if ((ucAbuseReportList.EditReportID != 0) || (!String.IsNullOrEmpty(hfEditReport.Value)))
{
ucAbuseEdit.Visible = true;
ucAbuseReportList.Visible = false;
ucAbuseReportList.StopProcessing = true;
ucAbuseEdit.StopProcessing = false;
int reportID = 0;
ucAbuseEdit.ReportID = ucAbuseReportList.EditReportID;
bool editForceLoad = false;
if (ucAbuseEdit.ReportID != 0)
{
hfEditReport.Value = ucAbuseEdit.ReportID.ToString();
reportID = ucAbuseEdit.ReportID;
editForceLoad = true;
}
ucAbuseEdit.ReloadData(editForceLoad);
//Breadcrumbs
lblEditBack.Text = " ";
lnkEditBack.Text = GetString("abuse.reports");
if (!String.IsNullOrEmpty(hfEditReport.Value))
{
reportID = ValidationHelper.GetInteger(hfEditReport.Value, 0);
}
AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(reportID);
if (ari != null)
{
lblEditNew.Text = HTMLHelper.HTMLEncode(ari.ReportTitle);
}
pnlHeader.Visible = true;
}
base.OnPreRender(e);
}
private void lnkEditBack_Click(object sender, EventArgs e)
{
hfEditReport.Value = String.Empty;
ucAbuseEdit.Visible = false;
ucAbuseReportList.Visible = true;
pnlHeader.Visible = false;
}
}