private void Display_ContentReviews() { Ektron.Cms.ContentReviewData[] aReviews = (Ektron.Cms.ContentReviewData[])Array.CreateInstance(typeof(Ektron.Cms.ContentReviewData), 0); reportstoolbar m_reportsToolBar; System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); DataTable dt = new DataTable(); int iTotalCR = 0; m_reportsToolBar = (reportstoolbar)(LoadControl("controls/reports/reportstoolbar.ascx")); ToolBarHolder.Controls.Add(m_reportsToolBar); m_reportsToolBar.AppImgPath = _AppImgPath; _TitleBarMsg = this._MessageHelper.GetMessage("lbl report reviews"); m_reportsToolBar.PageAction = _PageAction; m_reportsToolBar.FilterType = _FilterType; m_reportsToolBar.TitleBarMsg = _TitleBarMsg; m_reportsToolBar.MultilingualEnabled = _EnableMultilingual; m_reportsToolBar.ContentLang = _ContentApi.ContentLanguage; txtInterval.Visible = false; selInterval.Visible = false; try { if (Page.IsPostBack == true && IsReviewPost() == true) { for (int i = 0; i <= (Request.Form.Count - 1); i++) { if (Request.Form.Keys[i].ToString().IndexOf("cr_a_") == 0) { ContentReviewData crReview = new ContentReviewData(); int iReviewID = 0; string sAction = ""; iReviewID = System.Convert.ToInt32(Strings.Split(Request.Form[i], "_", -1, 0)[2]); sAction = (string)(Strings.Split(Request.Form[i], "_", -1, 0)[1]); if (iReviewID > 0) { crReview = this._ContentApi.EkContentRef.GetContentRating(iReviewID); if (sAction.ToLower() == "app") { crReview.State = Ektron.Cms.Common.EkEnumeration.ContentReviewState.Approved; } else if (sAction.ToLower() == "dec") { crReview.State = Ektron.Cms.Common.EkEnumeration.ContentReviewState.Rejected; } crReview = this._ContentApi.EkContentRef.UpdateContentReview(crReview); } } } this.Response.Redirect("reports.aspx?action=ContentReviews", false); } else { if (_FilterId > 0) { System.Web.UI.WebControls.Literal ltrPath = new System.Web.UI.WebControls.Literal(); ltrPath.Text = (string)(_MessageHelper.GetMessage("lbl folder") + "  " + _ContentApi.EkContentRef.GetFolderPath(_FilterId) + "<br /><br />"); this.phUpdateActivity.Controls.Add(ltrPath); aReviews = this._ContentApi.EkContentRef.GetUserReviewTotals(this._ContentApi.RequestInformationRef.PagingSize, new long[] { _FilterId }, iTotalCR, _PageInfo); } else { _PageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize; _PageInfo.CurrentPage = System.Convert.ToInt32(this.uxPaging.SelectedPage + 1); aReviews = this._ContentApi.EkContentRef.GetUserReviewTotals(this._ContentApi.RequestInformationRef.PagingSize, ref iTotalCR, _PageInfo); if (aReviews != null && _PageInfo.TotalPages > 1) { this.uxPaging.Visible = true; this.uxPaging.TotalPages = _PageInfo.TotalPages; this.uxPaging.CurrentPageIndex = _PageInfo.CurrentPage - 1; } else { this.uxPaging.Visible = false; } } } if (aReviews.Length > 0) { m_reportsToolBar.Data = aReviews; System.Web.UI.WebControls.Literal ltrPath = new System.Web.UI.WebControls.Literal(); ltrPath.Text = "<ul class=\'buttonWrapper buttonWrapperLeft\'><li><a class=\"greenHover button selectAllButton buttonInlineBlock\" href=\"#\" onclick=\"CheckApproveReset(true); return false;\" >" + _MessageHelper.GetMessage("lnk mark all approve") + "</a></li><li><a class=\"redHover button selectNoneButton buttonLeft\" href=\"#\" onclick=\"CheckApproveReset(false);\">" + _MessageHelper.GetMessage("lnk mark all declined") + "</a></li></ul>"; this.phUpdateActivity.Controls.Add(ltrPath); dgReport.DataSource = this.CreateContentReviewSource(aReviews); dgReport.CellPadding = 3; colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "APPROVE"; colBound.HeaderText = _MessageHelper.GetMessage("generic approve title"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "DECLINE"; colBound.HeaderText = _MessageHelper.GetMessage("btn decline"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "TITLE"; colBound.HeaderText = _MessageHelper.GetMessage("generic Title"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "USERNAME"; colBound.HeaderText = _MessageHelper.GetMessage("display name label"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "DATETIME"; colBound.HeaderText = _MessageHelper.GetMessage("generic date no colon"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "RATING"; colBound.HeaderText = _MessageHelper.GetMessage("rating label"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "USER_COMMENTS"; colBound.HeaderText = _MessageHelper.GetMessage("comment text"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.ItemStyle.Wrap = true; dgReport.Columns.Add(colBound); dgReport.DataBind(); } } catch (Exception) { } finally { _ContentApi = null; } }
private ICollection CreateContentReviewSource(ContentReviewData[] ReviewList) { DataTable dt = new DataTable(); DataRow dr; EkDTSelector dtS; dtS = _ContentApi.EkDTSelectorRef; dt.Columns.Add(new DataColumn("APPROVE", typeof(string))); dt.Columns.Add(new DataColumn("DECLINE", typeof(string))); dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("USERNAME", typeof(string))); dt.Columns.Add(new DataColumn("DATETIME", typeof(string))); dt.Columns.Add(new DataColumn("RATING", typeof(string))); dt.Columns.Add(new DataColumn("USER_COMMENTS", typeof(string))); for (int i = 0; i <= (ReviewList.Length - 1); i++) { dr = dt.NewRow(); dr[0] += "<input type=\"radio\" id=\"cr_a_" + ReviewList[i].ID.ToString() + "\" name=\"cr_a_" + ReviewList[i].ID.ToString() + "\" value=\"cr_app_" + ReviewList[i].ID.ToString() + "\" />"; dr[1] += "<input type=\"radio\" id=\"cr_a_" + ReviewList[i].ID.ToString() + "\" name=\"cr_a_" + ReviewList[i].ID.ToString() + "\" value=\"cr_dec_" + ReviewList[i].ID.ToString() + "\" />"; if (ReviewList[i].ContentType == 1) { dr[2] = "<img src=" + _ContentApi.AppPath + "images/ui/icons/contentHtml.png" + "></img> "; } else if (ReviewList[i].ContentType == 2) { dr[2] = "<img src=" + _ContentApi.AppPath + "images/ui/icons/contentForm.png" + "></img> "; } else { dr[2] = "<img src=" + ReviewList[i].AssetData.Icon + "></img> "; } dr[2] += "<a href=\"addeditcontentreview.aspx?action=edit&id=" + ReviewList[i].ID.ToString() + "&cid=" + ReviewList[i].ContentID.ToString() + "\">" + ReviewList[i].ContentTitle + "</a>"; if (ReviewList[i].UserID == 0) { dr[3] = "<font color=\"gray\">" + this._MessageHelper.GetMessage("lbl anon") + "</font>"; } else { dr[3] = ReviewList[i].UserDisplayName; } dr[4] = ReviewList[i].RatingDate.ToShortDateString(); dr[5] = GenerateStars(System.Convert.ToInt32(ReviewList[i].Rating)); dr[6] = EkFunctions.HtmlEncode(Server.UrlDecode(ReviewList[i].UserComments)); dt.Rows.Add(dr); } DataView dv = new DataView(dt); return dv; }
protected void Process_Delete() { aReviews = this.m_refContentApi.EkContentRef.GetContentRating(this.m_iID, 0, 0, -1, "", ""); if (aReviews.Length > 0) { crReview = aReviews[0]; this.m_refContentApi.EkContentRef.DeleteContentReview(crReview); } if (Request.QueryString["page"] == "workarea") { try { if (redirectUrl.Length > 0) { Response.Redirect(redirectUrl, false); } else { // redirect to workarea Response.Write("<script language=\"Javascript\">" + "top.switchDesktopTab();" + "</script>"); } } catch (Exception) { // do nothing } } else { Response.Redirect((string)("ContentStatistics.aspx?page=ContentStatistics.aspx&id=" + this.content_id + "&LangType=" + this.ContentLanguage), false); } }
protected void Process_Edit() { aReviews = this.m_refContentApi.EkContentRef.GetContentRating(this.m_iID, 0, 0, -1, "", ""); if (aReviews.Length > 0) { crReview = aReviews[0]; crReview.UserComments = (string)txt_review.Text; crReview.State = (EkEnumeration.ContentReviewState)Enum.Parse(typeof(EkEnumeration.ContentReviewState), drp_status_data.SelectedValue); crReview.Rating = Convert.ToInt32(Request.Form["irating"]); crReview = this.m_refContentApi.EkContentRef.UpdateContentReview(crReview); } string pagemode = (string)("&page=" + Request.QueryString["page"]); try { if (redirectUrl.Length > 0) { Response.Redirect(redirectUrl, false); } else { Response.Redirect((string)("addeditcontentreview.aspx?action=view&id=" + this.m_iID + "&cid=" + this.content_id + pagemode), false); } } catch (Exception) { // do nothing } }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); try { if (!string.IsNullOrEmpty(Request.QueryString["rid"])) { m_iID = Convert.ToInt64(Request.QueryString["rid"]); } if (!string.IsNullOrEmpty(Request.QueryString["cid"])) { content_id = Convert.ToInt64(Request.QueryString["cid"]); } // the redirectUrl is provided for use by ContentStatistics.aspx specifically // so we can redirect back to that page after editting or deleting reviews or comments. if (!string.IsNullOrEmpty(Request.QueryString["redirectUrl"])) { redirectUrl = Request.QueryString["redirectUrl"]; } CheckPermissions(); if (Page.IsPostBack) { switch (base.m_sPageAction) { default: // "edit" Process_Edit(); break; } } else { aReviews = this.m_refContentApi.EkContentRef.GetContentRating(m_iID, 0, 0, -1, "", ""); if (aReviews.Length > 0) { crReview = aReviews[0]; } RenderJS(); switch (base.m_sPageAction) { case "delete": Process_Delete(); break; case "edit": Display_Edit(); break; default: // "view" Display_View(); break; } SetLabels(); } } catch (Exception ex) { Utilities.ShowError(ex.Message); } }