private void Page_Load(System.Object sender, System.EventArgs e) { string action = "view"; string inFolder = ""; int k = 0; string[] id = null; string folderList = ""; string folderId = ""; long rootFolder = 0; string userNames = "None"; string groupNames = "None"; string userIdList = ""; string groupIdList = ""; string[] userId = null; string[] groupId = null; string userList = ""; Ektron.Cms.UserAPI userAPI = new Ektron.Cms.UserAPI(); int i = 0; bool doesExcludeAll = false; bool isSubmit = true; CommonApi commonApi = new CommonApi(); bool continueSub = false; if ((_ContentApi.EkContentRef).IsAllowed(0, 0, "users", "IsLoggedIn", 0) == false) { Response.Redirect("login.aspx?fromLnkPg=1", false); return; } if (_ContentApi.RequestInformationRef.IsMembershipUser == 1 || _ContentApi.RequestInformationRef.UserId == 0) { Response.Redirect("reterror.aspx?info=Please login as cms user", false); return; } //set language _ContentLanguage = string.IsNullOrEmpty(Request.QueryString["LangType"]) ? Convert.ToInt32(_ContentApi.GetCookieValue("LastValidLanguageID")) : Convert.ToInt32(Request.QueryString["LangType"]); _ContentApi.SetCookieValue("LastValidLanguageID", _ContentLanguage.ToString()); _ContentApi.ContentLanguage = System.Convert.ToInt32(_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED ? Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES : _ContentLanguage); _EnableMultilingual = _ContentApi.EnableMultilingual; //set filter _FilterType = (string)((string.IsNullOrEmpty(Request.QueryString["filterType"])) ? string.Empty : (AntiXss.HtmlEncode(Request.QueryString["filtertype"]))); if (!string.IsNullOrEmpty(Request.QueryString["filterid"]) ) { folderId = Request.QueryString["filterid"]; if (!folderId.Contains(",")) { if (Request.QueryString["filterid"] != null) { _FilterId = long.Parse(Request.QueryString["filterid"]); } } if (_FilterType == "path") { id = folderId.Split(','); for (k = 0; k <= id.Length - 1; k++) { if (!string.IsNullOrEmpty(_FolderName)) { if (_FolderName.Length > 0) { _FolderName = _FolderName + ","; } } _FolderName = _FolderName + _ContentApi.GetFolderById(long.Parse(id[k])).Name; _FilterId = long.Parse(id[k]); // Set limit for listing folder-names: if ((k >= 0) && (k < (id.Length - 1))) { _FolderName += ", ..."; break; } } //FldrName = m_refContentApi.GetFolderById(FilterId).Name & """" _FolderName += "\""; inFolder = " In Folder \""; } } //set page action - throw if contains ampersand _PageAction = (string)((string.IsNullOrEmpty(Request.QueryString["action"])) ? string.Empty : (EkFunctions.HtmlEncode(Convert.ToString(Request.QueryString["action"])).ToLower().Trim())); if (_PageAction.Contains("&")) { Utilities.ShowError(_MessageHelper.GetMessage("invalid querstring")); return; } _PageAction = AntiXss.HtmlEncode(_PageAction); //get querystrings _AppImgPath = _ContentApi.AppImgPath; _Interval = (string)((string.IsNullOrEmpty(Request.QueryString["interval"])) ? string.Empty : (AntiXss.HtmlEncode(Request.QueryString["interval"]))); _OrderBy = (string)((string.IsNullOrEmpty(Request.QueryString["orderby"])) ? string.Empty : (AntiXss.HtmlEncode(Request.QueryString["orderby"]))); if (!string.IsNullOrEmpty(Request.QueryString["rootfolder"])) { rootFolder = long.Parse(Request.QueryString["rootfolder"]); } if (!string.IsNullOrEmpty(Request.QueryString["subfldInclude"])) { _IsSubFolderIncluded = bool.Parse(Request.QueryString["subfldInclude"]); } if ((Request.QueryString["rptFolder"] == null) || (Request.QueryString["rptFolder"] == "")) { _Folder = " Content Folder "; } else if (!(Request.QueryString["filterType"] == null) && Request.QueryString["filterType"] != "") { id = (EkFunctions.HtmlEncode(Request.QueryString["filterid"])).Split(','); for (k = 0; k <= id.Length - 1; k++) { if (_Folder.Length > 0) { _Folder = _Folder + ","; } _Folder = _Folder + _ContentApi.GetFolderById(long.Parse(id[k])).Name; } } else { _Folder = EkFunctions.HtmlEncode(Request.QueryString["rptFolder"]); } if (Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "") { if (Information.IsNumeric(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { _ContentType = Convert.ToInt32(Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]); _ContentTypeSelected = Request.QueryString[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam].ToString(); _ContentApi.SetCookieValue(Ektron.Cms.Common.EkConstants.ContentTypeUrlParam, _ContentTypeSelected); } } else if (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam] != "") { if (Information.IsNumeric(Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam])) { _ContentTypeSelected = (Ektron.Cms.CommonApi.GetEcmCookie()[Ektron.Cms.Common.EkConstants.ContentTypeUrlParam]).ToString(); } } switch (_PageAction) { case "checkinall": Process_CheckInAll(); break; case "submitall": Process_SubmitAll(); break; case "viewallreporttypes": Display_ReportTypes(); break; case "viewasynchlogfile": Display_AsynchLogFile(); break; case "contentreviews": Display_ContentReviews(); break; case "contentflags": Display_ContentFlags(); break; case "viewsearchphrasereport": SearchPhraseReport(); break; case "viewpreapproval": Display_Preapproval(); break; case "viewcheckedout": continueSub = true; _ReportType = "checkedout"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports checked out title") + inFolder + _FolderName); break; case "viewcheckedin": //look at last line in page_load for loading of viewcheckedin control continueSub = true; _ReportType = "checkedin"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports checked in title") + inFolder + _FolderName); break; case "viewsubmitted": continueSub = true; _ReportType = "submitted"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports submitted title") + inFolder + _FolderName); break; case "viewnewcontent": continueSub = true; _ReportType = "newcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports new title") + inFolder + _FolderName); break; case "viewpending": continueSub = true; _ReportType = "pendingcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports pending title") + inFolder + _FolderName); break; case "viewrefreshreport": continueSub = true; _ReportType = "refreshdcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports refresh title") + inFolder + _FolderName); break; case "viewexpired": continueSub = true; _ReportType = "expiredcontent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports expired title") + inFolder + _FolderName); break; case "viewtoexpire": continueSub = true; _ReportType = "expireToContent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("lbl cont expire") + " " + _Interval + " " + _MessageHelper.GetMessage("lbl sync monthly days") + inFolder + _FolderName); break; case "siteupdateactivity": continueSub = true; _ReportType = "updateactivityContent"; _HasData = true; _TitleBarMsg = (string)(_MessageHelper.GetMessage("content reports site activity title") + inFolder + _FolderName); break; default: continueSub = true; _ReportType = ""; _HasData = false; _TitleBarMsg = ""; break; } //set js vars litPageAction.Text = _PageAction; litOrderBy.Text = _OrderBy; litFilterType.Text = _FilterType; litFilterId.Text = _FilterId.ToString(); litInterval.Text = _Interval; if (continueSub == true) { int j; Collection pagedata = null; Collection cUser = null; long[] arUserIds; string sExclUserId = ""; int idx = 0; //Dim sitedata As ContentData() if ((_PageAction == "viewcheckedout") || (_PageAction == "viewnewcontent")) { lblAction.Text = "var actionString = \"reports.aspx?action=CheckinAll&PreviousAction=" + _PageAction + "&filtertype=" + _FilterType + "&filterid=" + _FilterId + "&orderby=" + _OrderBy + "\";"; lblAction.Text += "if (WarnAllCheckin()) { DisplayHoldMsg_Local(true); document.forms.selections.action = actionString; document.forms.selections.submit(); }"; } if (_PageAction == "viewcheckedin") { lblAction.Text += "var actionString = \"reports.aspx?action=SubmitAll&PreviousAction=" + _PageAction + "&filtertype=" + _FilterType + "&filterid=" + _FilterId + "&orderby=" + _OrderBy + "\";"; lblAction.Text += "if (WarnAllSubmit()) { DisplayHoldMsg_Local(true); document.forms.selections.action = actionString; document.forms.selections.submit(); }"; } rptTitle.Value = _TitleBarMsg; top.Visible = false; if (_PageAction == "viewtoexpire") { selInterval.Visible = true; txtInterval.Visible = true; if (0 != _Interval.Length) { txtInterval.Value = _Interval; } selInterval.Items.Clear(); selInterval.Items.Add(new ListItem("Select Interval", "")); selInterval.Items.Add(new ListItem("10", "10")); selInterval.Items.Add(new ListItem("20", "20")); selInterval.Items.Add(new ListItem("30", "30")); selInterval.Items.Add(new ListItem("40", "40")); selInterval.Items.Add(new ListItem("50", "50")); selInterval.Items.Add(new ListItem("60", "60")); selInterval.Items.Add(new ListItem("70", "70")); selInterval.Items.Add(new ListItem("80", "80")); selInterval.Items.Add(new ListItem("90", "90")); if (0 != _Interval.Length) { for (j = 1; j <= 9; j++) { if (_Interval == selInterval.Items[j].Value) { selInterval.Items[j].Selected = true; break; } } } else { selInterval.Items[0].Selected = true; } lblDays.Text = _MessageHelper.GetMessage("lbl sync monthly days"); lblDays.Visible = true; top.Visible = true; IncludeContentToExpireJS(); } else if (_PageAction == "siteupdateactivity") { System.Text.StringBuilder result = new System.Text.StringBuilder(); EditScheduleHtml.Text = ""; if (!(Request.QueryString["ex_users"] == null)) { if (Request.QueryString["ex_users"] != "") { userIdList = EkFunctions.HtmlEncode(Request.QueryString["ex_users"]); } } if (!(Request.QueryString["ex_groups"] == null)) { if (Request.QueryString["ex_groups"] != "") { groupIdList = EkFunctions.HtmlEncode(Request.QueryString["ex_groups"]); } } if (Request.QueryString["btnSubmit"] == null) { isSubmit = false; editSchedule.Visible = true; lblDays.Visible = true; tr_startDate.Visible = true; tr_endDate.Visible = true; lblStartDate.Text = _MessageHelper.GetMessage("generic start date label"); lblEndDate.Text = _MessageHelper.GetMessage("generic end date label"); } else { // User wants Site Activity report isSubmit = true; if (!(Request.Form["excludeAllUsers"] == null)) { doesExcludeAll = Convert.ToBoolean(Request.Form["excludeAllUsers"]); } if (!(Request.Form["start_date"] == null)) { _StartDate = Request.Form["start_date"]; } else if (!(Request.QueryString["startdate"] == null)) { _StartDate = EkFunctions.HtmlEncode(Request.QueryString["startdate"]); _StartDate = _StartDate.Replace("\'", ""); } if (!(Request.Form["end_date"] == null)) { _EndDate = Request.Form["end_date"]; if (!Information.IsDate(_EndDate)) { _EndDate = ""; } } else if (!(Request.QueryString["enddate"] == null)) { _EndDate = EkFunctions.HtmlEncode(Request.QueryString["enddate"]); _EndDate = _EndDate.Replace("\'", ""); if (!Information.IsDate(_EndDate)) { _EndDate = ""; } } } DisplayDateFields(); //EditScheduleHtml.Text = EditScheduleHtml.Text & MakeIFrameArea() result.Append("<input id=\"fId\" type=\"hidden\" name=\"fId\" "); if (Request.QueryString["filterid"] == null) { result.Append("value=\"\">" + "\r\n"); } else { result.Append("value=\"" + EkFunctions.HtmlEncode(Request.QueryString["filterid"]) + "\"/>" + "\r\n"); } result.Append("<input id=\"rptType\" type=\"hidden\" name=\"rptType\"/>" + "\r\n"); result.Append("<input id=\"rptFolderList\" type=\"hidden\" name=\"rptFolderList\"/>" + "\r\n"); result.Append("<input id=\"rootFolder\" type=\"hidden\" name=\"rootFolder\" value=\"" + rootFolder + "\"/>" + "\r\n"); result.Append("<input id=\"rptLink\" type=\"hidden\" name=\"rptLink\"/>" + "\r\n"); result.Append("<input id=\"ContType\" type=\"hidden\" name=\"ContType\" value=\"" + _ContentType + "\"/>" + "\r\n"); result.Append("<input id=\"subfldInclude\" type=\"hidden\" name=\"subfldInclude\" value=\"" + _IsSubFolderIncluded + "\"/>" + "\r\n"); result.Append("<input id=\"LangType\" type=\"hidden\" name=\"LangType\" value=\"" + _ContentLanguage + "\"/>" + "\r\n"); result.Append("<input id=\"excludeUserIds\" type=\"hidden\" name=\"excludeUserIds\" value=\"" + userIdList + "\"/>" + "\r\n"); result.Append("<input id=\"excludeUserGroups\" type=\"hidden\" name=\"excludeUserGroups\" value=\"" + groupIdList + "\"/>" + "\r\n"); result.Append("<input id=\"excludeAllUsers\" type=\"hidden\" name=\"excludeAllUsers\" value=\"" + doesExcludeAll + "\"/>" + "\r\n"); //select folder result.Append("<table id=\"EditText\" width=\"100%\" class=\"ektronGrid\">"); result.Append("<tr><td id=\"lblSelFolder\" class=\"label\">" + _MessageHelper.GetMessage("lbl select folder") + "</td>"); result.Append("<td id=\"selectedFolderList\"><a title=\"" + _MessageHelper.GetMessage("lbl select folder") + "\" href=\"#\" id=\"hselFolder\" onclick=\"LoadFolderChildPage(\'" + _PageAction + "\',\'" + _ContentLanguage + "\');return true;\">"); if ((Request.QueryString["filterid"] == null) || ("" == Request.QueryString["filterid"])) { //result.Append(m_refMsg.GetMessage("lbl Root Folder")) result.Append("\\"); } else { id = (EkFunctions.HtmlEncode(Request.QueryString["filterid"])).Split(','); for (k = 0; k <= id.Length - 1; k++) { if (folderList.Length > 0) { folderList = folderList + ","; } folderList = folderList + _ContentApi.GetFolderById(long.Parse(id[k])).Name; } result.Append(folderList); } result.Append("</a></td></tr>" + "\r\n"); string sShow = "display:none"; if (_IsSubFolderIncluded) { sShow = "display:block"; } result.Append("<tr><td id=\"subfldIncludetxt\" colspan=\"2\" style=\"" + sShow + "\">"); result.Append(_MessageHelper.GetMessage("lbl subfolder included")); result.Append("</td></tr>" + "\r\n"); //report type _ReportDisplay = EkFunctions.HtmlEncode(Request.QueryString["report_display"]); result.Append("<tr><td class=\"label\">" + _MessageHelper.GetMessage("lbl report type") + "</td><td><select id=\"selDisplay\" name=\"selDisplay\">"); result.Append("<option id=\"ev\" value=\"ev\""); if ("ev" == _ReportDisplay) { result.Append(" SELECTED"); } result.Append(">" + _MessageHelper.GetMessage("lbl executive view") + "</option>"); result.Append("<option id=\"dv\" value=\"dv\""); if ("dv" == _ReportDisplay) { result.Append(" selected=\'selected\'"); } result.Append(">" + _MessageHelper.GetMessage("lbl detail view") + "</option>"); result.Append("<option id=\"cv\" value=\"cv\""); if ("cv" == _ReportDisplay) { result.Append(" selected=\'selected\'"); } result.Append(">" + _MessageHelper.GetMessage("lbl combined view") + "</option></select></td></tr>" + "\r\n"); //exclude user result.Append("<tr><td id=\"lblSelUser\" class=\"label\">" + _MessageHelper.GetMessage("lbl exclude users") + "</td>" + "\r\n"); result.Append("<td>"); result.Append("<div id=\"excludeUserList\">"); if (userIdList.Length > 0 || groupIdList.Length > 0) { if (userIdList.Length > 0) { userNames = ""; userId = userIdList.Split(",".ToCharArray()); for (i = 0; i <= userId.Length - 1; i++) { if (userNames.Length > 0) { userNames = userNames + ","; } userNames = userNames + userAPI.UserObject(int.Parse(userId[i])).Username; } if (userNames.Length == 0) { userNames = "None"; } } if (groupIdList.Length > 0) { groupNames = ""; groupId = groupIdList.Split(",".ToCharArray()); for (i = 0; i <= groupId.Length - 1; i++) { if (groupNames.Length > 0) { groupNames = groupNames + ","; } groupNames = groupNames + _ContentApi.EkUserRef.GetActiveUserGroupbyID(Convert.ToInt64(groupId[i])).GroupName; if (groupNames.Length == 0) { groupNames = "None"; } } } userList = "User (" + userNames.Replace(",", ", ") + ")<br />User Group (" + groupNames.Replace(",", ", ") + ")"; result.Append(userList); } result.Append("</div>"); result.Append("<ul class=\'buttonWrapper buttonWrapperLeft\'><li><a title=\"" + _MessageHelper.GetMessage("lbl Select User or Group") + "\" class=\"button buttonInlineBlock greenHover buttonCheckAll\" href=\"javascript://\" id=\"selExclUser\" onclick=\"LoadUserListChildPage(\'" + _PageAction + "_siteRpt\');return true;\">"); result.Append(_MessageHelper.GetMessage("lbl Select User or Group")); result.Append("</a></li></ul></td></tr>" + "\r\n"); //generate report button result.Append("<tr><td class=\'label\'> </td><td><ul class=\'buttonWrapper buttonWrapperLeft\'><li><a class=\"button buttonInlineBlock greenHover buttonGetResult\" id=\"btnResult\" onclick=\"ReportSiteUpdateActivity()\" title=\"" + _MessageHelper.GetMessage("btn get result") + "\">" + _MessageHelper.GetMessage("btn get result") + "</a></li></ul></td></tr>" + "\r\n"); result.Append("</table>"); EditScheduleHtml.Text = EditScheduleHtml.Text + result.ToString(); IncludeSiteUpdateActivityJS(); } _AssetInfoData = _ContentApi.GetAssetSupertypes(); if (Ektron.Cms.Common.EkConstants.CMSContentType_Content == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Content == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Forms == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Library == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_NonImageLibrary == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_PDF == Convert.ToInt32(_ContentTypeSelected)) { _ContentType2 = int.Parse(_ContentTypeSelected); } else if (Ektron.Cms.Common.EkConstants.ManagedAsset_Min <= Convert.ToInt32(_ContentTypeSelected) && Convert.ToInt32(_ContentTypeSelected) <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max) { if (DoesAssetSupertypeExist(_AssetInfoData, int.Parse(_ContentTypeSelected))) { _ContentType2 = int.Parse(_ContentTypeSelected); } } if (_HasData) { if (("viewrefreshreport" == _PageAction | "refreshdcontent" == _PageAction | "viewpending" == _PageAction | "viewcheckedin" == _PageAction) && !_ContentApi.EkContentRef.IsAllowed(_ContentApi.RequestInformationRef.UserId, 0, "users", "IsAdmin")) { _FilterType = "User"; _FilterId = _ContentApi.RequestInformationRef.UserId; } cUser = new Collection(); pagedata = new Collection(); pagedata.Add(_ReportType, "StateWanted", null, null); pagedata.Add(_FilterType, "FilterType", null, null); pagedata.Add(_FilterId, "FilterID", null, null); pagedata.Add(_OrderBy, "OrderBy", null, null); pagedata.Add(_Interval, "Interval", null, null); if (_ContentType2 > 0) { pagedata.Add(_ContentType2, "ContentType", null, null); } if (_PageAction == "viewtoexpire") { _ReportData = _ContentApi.GetExpireContent(pagedata); } else if ("siteupdateactivity" == _PageAction) { pagedata.Add(_StartDate, "StartDate", null, null); pagedata.Add(_EndDate, "EndDate", null, null); pagedata.Add(_IsSubFolderIncluded, "SubFolders", null, null); pagedata.Add(folderId, "FolderId", null, null); pagedata.Add(rootFolder, "RootFolder", null, null); if (groupIdList.Length > 0) { string[] temp = groupIdList.Split(",".ToCharArray()); long[] arrIdList = new long[temp.Length - 1 + 1]; int index; for (index = 0; index <= temp.Length - 1; index++) { arrIdList[index] = Convert.ToInt64(temp[index]); } arUserIds = _ContentApi.EkUserRef.GetAllUsersIdsByGroup(arrIdList, "userid"); if (arUserIds.Length > 0) { for (idx = 0; idx <= arUserIds.Length - 1; idx++) { if (sExclUserId.Length > 0) { sExclUserId = sExclUserId + ","; } sExclUserId = sExclUserId + arUserIds[idx].ToString(); //("UserID") } } } if (userIdList.Length > 0) { if (sExclUserId.Length > 0) { sExclUserId = sExclUserId + ","; } sExclUserId = sExclUserId + userIdList; } if (0 == sExclUserId.Length) { sExclUserId = "EktNone"; } pagedata.Add(sExclUserId, "ExUserIds", null, null); pagedata.Add(doesExcludeAll, "ExAllUsers", null, null); } else { //_ReportData = _ContentApi.GetContentReport(pagedata) _PageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize; _PageInfo.CurrentPage = System.Convert.ToInt32(this.uxPaging.SelectedPage + 1); try { _ReportData = _ContentApi.GetContentReport(pagedata, _PageInfo); } catch { Response.Redirect("reports.aspx?action=ViewPending"); } if (_ReportData != null && _PageInfo.TotalPages > 1) { this.uxPaging.Visible = true; this.uxPaging.TotalPages = _PageInfo.TotalPages; this.uxPaging.CurrentPageIndex = _PageInfo.CurrentPage - 1; } else { this.uxPaging.Visible = false; } } } reportstoolbar m_reportsToolBar; System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); DataTable dt = new DataTable(); DataRow dr; bool bIsChart = false; m_reportsToolBar = (reportstoolbar)(LoadControl("controls/reports/reportstoolbar.ascx")); ToolBarHolder.Controls.Add(m_reportsToolBar); m_reportsToolBar.AppImgPath = _AppImgPath; if (_ReportType.ToLower() == "updateactivitycontent") { m_reportsToolBar.Data = ""; } else { m_reportsToolBar.Data = _ReportData; } m_reportsToolBar.PageAction = _PageAction; m_reportsToolBar.FilterType = _FilterType; m_reportsToolBar.TitleBarMsg = _TitleBarMsg; m_reportsToolBar.MultilingualEnabled = _EnableMultilingual; m_reportsToolBar.ContentLang = _ContentApi.ContentLanguage; m_reportsToolBar.HasData = isSubmit; //DATA DISPLAY // Grid is different for the activity report if (_ReportType.ToLower() != "updateactivitycontent") { chart.Visible = false; lblTbl.Visible = false; colBound.DataField = "TITLE"; if ((_PageAction == "viewcheckedout") || (_PageAction == "viewcheckedin")){ colBound.HeaderText = "<input type=\"checkbox\" name=\"all\" onclick=\"javascript:checkAll(this);\"> "; } colBound.HeaderText += _MessageHelper.GetMessage("generic Title"); colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.HeaderStyle.CssClass = "title-header"; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "ID"; colBound.HeaderText = _MessageHelper.GetMessage("generic ID"); colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "LASTEDITOR"; colBound.HeaderText = _MessageHelper.GetMessage("generic Last Editor"); colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; dgReport.Columns.Add(colBound); string msg = ""; if (_PageAction == "viewpending") { msg = _MessageHelper.GetMessage("generic Go Live"); } else if (_PageAction == "viewexpired") { msg = _MessageHelper.GetMessage("generic End Date"); } else if (_PageAction == "viewtoexpire") { msg = _MessageHelper.GetMessage("generic End Date"); } else { msg = _MessageHelper.GetMessage("generic Date Modified"); } colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "DATE"; colBound.HeaderText = msg; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "PATH"; colBound.HeaderText = _MessageHelper.GetMessage("generic Path"); colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; colBound.HeaderStyle.CssClass = "title-header"; colBound.ItemStyle.Wrap = false; dgReport.Columns.Add(colBound); dgReport.BorderColor = System.Drawing.Color.White; string cLinkArray = ""; string fLinkArray = ""; string lLinkArray = ""; dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(long))); dt.Columns.Add(new DataColumn("LASTEDITOR", typeof(string))); dt.Columns.Add(new DataColumn("DATE", typeof(string))); dt.Columns.Add(new DataColumn("PATH", typeof(string))); if (_PageAction == "viewcheckedout") { action = "ViewStaged"; } if (!(_ReportData == null)) { editSchedule.Visible = false; dgReport.Visible = true; for (i = 0; i <= _ReportData.Length - 1; i++) { if ((_PageAction == "viewcheckedout") || (_PageAction == "viewcheckedin")) { top.Visible = true; } dr = dt.NewRow(); if ((_PageAction == "viewcheckedout") || (_PageAction == "viewcheckedin")) { dr[0] += "<input type=\"checkbox\" name=\"frm_check" + i + "\" onclick=\"document.forms.selections[\'frm_hidden" + i + "\'].value=(this.checked ?" + _ReportData[i].Id + " : 0);\"> "; } else { dr[0] += "<input type=\"hidden\" name=\"frm_check" + i + "\" onclick=\"document.forms.selections[\'frm_hidden" + i + "\'].value=(this.checked ?" + _ReportData[i].Id + ": 0);\"> "; } if (_ReportData[i].ContType == 1) { if (_ReportData[i].SubType == EkEnumeration.CMSContentSubtype.WebEvent) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/calendarViewDay.png" + "></img> "; } else { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/contentHtml.png" + "></img> "; } } else if (_ReportData[i].ContType == 2) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/contentForm.png" + "></img> "; } else if (_ReportData[i].ContType == 3) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/contentHTML.png" + "></img> "; } else if (_ReportData[i].ContType == 1111) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/asteriskOrange.png" + "></img> "; } else if (_ReportData[i].ContType == 3333) { dr[0] += " <img id=\"img\" src=" + _ContentApi.AppPath + "images/ui/icons/brick.png" + "></img> "; } else { dr[0] += " <img id=\"img\" src=" + _ReportData[i].AssetData.Icon + "></img> "; } dr[0] += "<input type=\"hidden\" cid=\"" + _ReportData[i].Id + "\" fid=\"" + _ReportData[i].FolderId + "\" name=\"frm_hidden" + i + "\" value=\"0\"> "; if (_ReportData[i].ContType != 2) { dr[0] += "<a href=\"content.aspx?action=" + action + "&LangType=" + _ReportData[i].LanguageId + "&id=" + _ReportData[i].Id + "&callerpage=" + "reports.aspx" + "&origurl=" + EkFunctions.UrlEncode((string)("action=" + _PageAction + "&filtertype=" + _FilterType + "&filterid=" + _FilterId + "&orderby=" + _OrderBy + "&interval=" + _Interval)) + "\" title=\'" + _MessageHelper.GetMessage("generic View") + " \"" + Strings.Replace(_ReportData[i].Title, "\'", "`", 1, -1, 0) + "\"" + "\'>" + _ReportData[i].Title + "</a>"; } else { //Link to cmsforms.aspx dr[0] += "<a href=\"cmsform.aspx?action=ViewForm" + "&LangType=" + _ReportData[i].LanguageId + "&form_id=" + _ReportData[i].Id + "&folder_id=" + _ReportData[i].FolderId + "\" title=\'" + _MessageHelper.GetMessage("generic view") + " \"" + Strings.Replace(_ReportData[i].Title, "\'", "`", 1, -1, 0) + "\"" + "\'>" + _ReportData[i].Title + "</a>"; } dr[1] = _ReportData[i].Id; dr[2] = "<a href=\"reports.aspx?action=" + _PageAction + "&interval=" + _Interval + "&filtertype=USER&filterId=" + _ReportData[i].UserId + "&orderby=" + _OrderBy + "\" title=\"" + _MessageHelper.GetMessage("click to filter msg") + "\">" + _ReportData[i].EditorLastName + ", " + _ReportData[i].EditorFirstName + "</a>"; string _lnk = MakeLink(_ReportData[i]); if (_lnk != "") { dr[2] = _lnk; } else { dr[2] = "<a href=\"reports.aspx?action=" + _PageAction + "&interval=" + _Interval + "&filtertype=USER&filterId=" + _ReportData[i].UserId + "&orderby=" + _OrderBy + "\" title=\"" + _MessageHelper.GetMessage("click to filter msg") + "\">" + _ReportData[i].EditorLastName + ", " + _ReportData[i].EditorFirstName + "</a>"; } if (_PageAction == "viewpending") { dr[3] = _ReportData[i].DisplayGoLive; } else if ((_PageAction == "viewexpired") || (_PageAction == "viewtoexpire")) { dr[3] = _ReportData[i].DisplayEndDate; } else { dr[3] = _ReportData[i].DisplayLastEditDate; } if (_PageAction == "ViewToExpire") { dr[4] = _ReportData[i].Path; } else { dr[4] = "<a href=\"reports.aspx?action=" + _PageAction + "&interval=" + _Interval + "&filtertype=path&filterId=" + _ReportData[i].FolderId + "&orderby=" + _OrderBy + "\" title=\"" + _MessageHelper.GetMessage("click to filter msg") + "\">" + _ReportData[i].Path + "</a>"; } cLinkArray = cLinkArray + "," + _ReportData[i].Id; fLinkArray = fLinkArray + "," + _ReportData[i].FolderId; lLinkArray = System.Convert.ToString(lLinkArray + "," + _ReportData[i].LanguageId); dt.Rows.Add(dr); } if (cLinkArray.Length > 0) { cLinkArray = Strings.Right(cLinkArray, Strings.Len(cLinkArray) - 1); fLinkArray = Strings.Right(fLinkArray, Strings.Len(fLinkArray) - 1); lLinkArray = Strings.Right(lLinkArray, Strings.Len(lLinkArray) - 1); } litCollectionList.Text = cLinkArray; litFolderList.Text = fLinkArray; litLanguageList.Text = lLinkArray; _DataView = new DataView(dt); dgReport.DataSource = _DataView; dgReport.DataBind(); } else { //Currently there is no data to report. Show such message if (EditScheduleHtml.Text.IndexOf("Currently there is no data") == -1) { System.Text.StringBuilder result = new System.Text.StringBuilder(); result.Append("<table>"); result.Append("<tr><td>").Append(_MessageHelper.GetMessage("msg no data report")).Append("</td></tr>"); result.Append("</table>"); EditScheduleHtml.Text = EditScheduleHtml.Text + result.ToString(); } editSchedule.Visible = true; dgReport.Visible = false; } } else { // If it is not a chart and report for site activity if ((Request.QueryString["btnSubmit"] == "1") && !bIsChart) { chart.Visible = false; lblTbl.Visible = false; _SiteData = _ContentApi.GetSiteActivityReportv2_0(pagedata); if (!(_SiteData == null)) { ShowSiteActivity(); if (!(Request.QueryString["reporttype"] == null) && "export" == Request.QueryString["reporttype"]) { Process_Export(); } } } } } EmailHelper ehelp = new EmailHelper(); EmailArea.Text = ehelp.MakeEmailArea(); switch (this._PageAction.ToLower()) { case "viewcheckedin": Display_CheckedIn(); break; case "viewcheckedout": Display_CheckedOut(); break; case "viewnewcontent": Display_NewContent(); break; } }
private void Login(string username, string password, string domain) { //Hashtable user; ApplicationAPI appAPI = new ApplicationAPI(); // if the username and password are both blank, then return // whether or not the user is currently logged in, and if he // is, return the userid and uniqueid if (username == "" && password == "") { Response.Clear(); Response.Write("loginCallback(" + (appAPI.IsLoggedIn ? "'userid=" + appAPI.UserId + "&uniqueid=" + appAPI.UniqueId + "'" : "'0'") + ");"); //Response.End(); return; } // similarly, if the user is logged in, don't login again! if (appAPI.IsLoggedIn) { Response.Clear(); Response.Write("loginCallback('userid=" + appAPI.UserId + "&uniqueid=" + appAPI.UniqueId + "');"); //Response.End(); return; } // login and create the cookies... Ektron.Cms.CommonApi appUI = new Ektron.Cms.CommonApi(); System.Collections.Hashtable cUser = new Hashtable(); string serverName = Request.ServerVariables.Get("SERVER_NAME"); cUser = appUI.EkUserRef.logInUser(username, password, serverName, "", appUI.AuthProtocol, false, EkEnumeration.AutoAddUserTypes.Author); if (cUser.Count > 0) { //Response.Clear(); HttpCookie cookEcm; /*if (!(Request.Cookies.Get("ecm") == null)) { cookEcm = Request.Cookies.Get("ecm"); cookEcm.Expires = DateTime.Now; Response.Cookies.Add(cookEcm); }*/ cookEcm = new HttpCookie("ecm"); cookEcm.Values.Add("user_id", cUser["UserID"].ToString()); cookEcm.Values.Add("site_id", appUI.SitePath + "," + cUser["LoginNumber"].ToString()); cookEcm.Values.Add("userfullname", cUser["UserName"].ToString()); cookEcm.Values.Add("username", username); cookEcm.Values.Add("new_site", appUI.SitePath.ToString()); cookEcm.Values.Add("unique_id", cUser["LoginNumber"].ToString()); cookEcm.Values.Add("site_preview", "0"); cookEcm.Values.Add("langvalue", ""); System.Configuration.AppSettingsReader objConfigSettings = new System.Configuration.AppSettingsReader(); string i_mLangId = objConfigSettings.GetValue("ek_DefaultContentLanguage", typeof(string)).ToString(); cookEcm.Values.Add("DefaultLangauge", i_mLangId); cookEcm.Values.Add("NavLanguage", i_mLangId); cookEcm.Values.Add("SiteLanguage", i_mLangId); cookEcm.Values.Add("LastValidLanguageID", i_mLangId); cookEcm.Values.Add("UserCulture", i_mLangId); cookEcm.Expires = DateTime.Now.AddYears(1); bool encryptCookie = false; try { encryptCookie = Convert.ToBoolean(objConfigSettings.GetValue("ek_EnableCookieEncryption", typeof(bool))); } catch { } if (encryptCookie) Response.Cookies.Add(SecureCookie.Encode(cookEcm)); else Response.Cookies.Add(cookEcm); System.Web.HttpCookie cookieEktGUID; if (Request.Cookies.Get("EktGUID") == null) { //create GUID if it doesn't exist string strGUID = System.Guid.NewGuid().ToString(); cookieEktGUID = new HttpCookie("EktGUID", strGUID); cookieEktGUID.Path = "/"; cookieEktGUID.Expires = DateTime.Now.AddYears(1); Response.Cookies.Add(cookieEktGUID); Ektron.Cms.UserAPI m_refUserApi = new Ektron.Cms.UserAPI(); m_refUserApi.RequestInformationRef.ClientEktGUID = strGUID; } Response.Write("loginCallback('userid=" + cUser["UserID"].ToString() + "&uniqueid=" + cUser["LoginNumber"].ToString() + "');"); //Response.End(); } else { // if login failed, return 0 Response.Clear(); Response.Write("loginCallback(0)"); //Response.End(); } }