private void Display_ViewTasks() { ltrPageBasePath.Text = "tasks.aspx?action=ViewTasks&ty=" + actiontype + "&page={0}"; ltrFormAction.Text = "tasks.aspx?Action=UpdateStatePurge" + closeOnFinish + callBackPage; pnlViewTasks.Visible = true; StringBuilder sbViewTasks = new StringBuilder(); Collection cTemplates = new Collection(); Ektron.Cms.Content.EkTask brObj = AppUI.EkTaskRef; PageRequestData pgrdata = new PageRequestData(); string backButtonUrl = string.Empty; long selectedUser = 0; long selectedUserType = 0; long userValue = 0; HttpCookie httpCookie = Ektron.Cms.CommonApi.GetEcmCookie(); if (IsAdmin) { TaskItemType = 8; } else { TaskItemType = 14; } pgrdata.CurrentPage = CurrentPage; pgrdata.PageSize = AppUI.RequestInformationRef.PagingSize; backButtonUrl = "callbackpage=tasks.aspx&parm1=action&value1=ViewTasks&parm2=ty&value2=" + actiontype + "&parm3=orderby&value3=" + Request.QueryString["orderby"]; switch (actiontype) { case "all": TaskItemType = 12; sTitleBar = MsgHelper.GetMessage("lbl View All Open Tasks In The System"); break; case "both": TaskItemType = 9; State = -1; sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned By and To") + " " + httpCookie["userfullname"]; break; case "to": TaskItemType = 3; sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned To") + " " + httpCookie["userfullname"]; break; case "touser": TaskItemType = 3; sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned To Selected User") + " " + httpCookie["userfullname"]; break; case "by": TaskItemType = 7; State = -1; sTitleBar = MsgHelper.GetMessage("lbl View Tasks Assigned By") + " " + httpCookie["userfullname"]; break; case "created": TaskItemType = 18; sTitleBar = MsgHelper.GetMessage("lbl View Tasks Created By") + " " + httpCookie["userfullname"]; break; case "notstarted": State = 1; sTitleBar = MsgHelper.GetMessage("lbl view task in nonstarted state"); break; case "active": State = 2; sTitleBar = MsgHelper.GetMessage("lbl view task in active state"); break; case "awaitingdata": State = 3; sTitleBar = MsgHelper.GetMessage("lbl view task in awaiting data state"); break; case "onhold": State = 4; sTitleBar = MsgHelper.GetMessage("lbl View Tasks In Hold State"); break; case "pending": State = 5; sTitleBar = MsgHelper.GetMessage("lbl view task in pending state"); break; case "reopened": State = 6; sTitleBar = MsgHelper.GetMessage("lbl view task in reopened state"); break; case "completed": State = 7; sTitleBar = MsgHelper.GetMessage("lbl view task in completed state"); break; case "archived": State = 8; sTitleBar = MsgHelper.GetMessage("lbl view task in archived state"); break; case "deleted": State = 9; sTitleBar = MsgHelper.GetMessage("lbl view task in deleted state"); break; } if ((actiontype == "touser")) { if (!string.IsNullOrEmpty(Request.QueryString["user"])) { selectedUser = Convert.ToInt64(Server.HtmlEncode(Request.QueryString["user"])); } if (selectedUser < 0) { selectedUser = currentUserID; selectedUserType = 1; } else { if (!string.IsNullOrEmpty(Request.QueryString["usertype"])) { selectedUserType = Convert.ToInt64(Server.HtmlEncode(Request.QueryString["usertype"])); } } if (selectedUserType == 1) { cTasks = brObj.GetTasks(-1, selectedUser, State, TaskItemType, OrderBy, 0, ref pgrdata, ""); } else { cTasks = brObj.GetTasks(-1, selectedUser, State, 19, OrderBy, 0, ref pgrdata, ""); } } else if ((IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "to" & actiontype != "by" & actiontype != "created" & actiontype != "touser"))) { cTasks = brObj.GetTasks(-1, State, -1, TaskItemType, OrderBy, 0, ref pgrdata, ""); } else { cTasks = objTask.GetTasks(-1, currentUserID, State, TaskItemType, OrderBy, 0, ref pgrdata, ""); } if ((string.IsNullOrEmpty(ErrorString) & (actiontype == "to" | actiontype == "by" | actiontype == "touser"))) { cTemplates = objTask.GetUsersForTask(currentUserID, -1); } if (ErrorString != string.Empty) { Response.Redirect("reterror.aspx?info=" + ErrorString, false); } sbViewTasks.Append("<table width=\"100%\" class=\"ektronGrid\">"); sbViewTasks.Append(" <tr>"); if (actiontype == "touser") { sbViewTasks.Append("<td>"); sbViewTasks.Append(" <table>"); sbViewTasks.Append(" <tr>"); sbViewTasks.Append(" <td class=\"label\" title=\"Assign to User\">" + MsgHelper.GetMessage("lbl Assign to User") + "</td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <select name=\"selectusergroup\" id=\"selectusergroup\">"); sbViewTasks.Append(" <optgroup label=\"Users\">"); for (int i = 1; i < cTemplates.Count; i++) { Collection coll = (Collection)cTemplates[i]; if (coll.Contains("DisplayUserName")) { if (!string.IsNullOrEmpty(coll["UserID"].ToString())) { long c = Convert.ToInt64(coll["UserID"].ToString()); if (c > 0) { userValue = Convert.ToInt64(coll["UserID"]); } } sbViewTasks.Append("<option value=\"" + userValue + ",1\""); if ((userValue == selectedUser) & selectedUserType == 1) { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + coll["DisplayUserName"] + "</option>"); } } sbViewTasks.Append(" </optgroup>"); sbViewTasks.Append(" <optgroup label=\"Groups\">"); for (int j = 1; j < cTemplates.Count; j++) { Collection coll = (Collection)cTemplates[j]; if (coll.Contains("DisplayUserGroupName")) { if(!string.IsNullOrEmpty(coll["UserGroupID"].ToString())) { long c = Convert.ToInt64(coll["UserGroupID"]); if (c > 0) { userValue = Convert.ToInt64(coll["UserGroupID"]); } } sbViewTasks.Append("<option value=\"" + userValue + ",2\""); if ((userValue == selectedUser) & selectedUserType == 2) { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + coll["DisplayUserGroupName"] + "</option>"); } } sbViewTasks.Append(" </optgroup>"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a class=\"button buttonInline blueHover minHeight buttonViewTask\" type=\"button\" name=\"getusergrouptasks\" id=\"getusergrouptasks\" title=\"" + MsgHelper.GetMessage("btn view tasks") + "\" value=\" " + MsgHelper.GetMessage("btn view tasks") + " \" onclick=\"getTaskForUser()\">" + MsgHelper.GetMessage("generic view") + "</a>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" </tr>"); sbViewTasks.Append(" </table>"); sbViewTasks.Append(" </td>"); } else if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "to" & actiontype != "by" & actiontype != "created")) { sbViewTasks.Append("<td>"); sbViewTasks.Append(" <table>"); sbViewTasks.Append(" <tr>"); sbViewTasks.Append(" <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change to state") + "</td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <select name=\"state\" id=\"state\">"); sbViewTasks.Append(" <option title=\"Not Started\" value=\"1\""); if (actiontype == "notstarted") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl not started") + "</option>"); sbViewTasks.Append("<option title=\"Active\" value=\"2\""); if (actiontype == "active") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl active") + "</option>"); sbViewTasks.Append("<option title=\"Awaiting Data\" value=\"3\""); if (actiontype == "awaitingdata") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl awaiting data") + "</option>"); sbViewTasks.Append("<option title=\"On Hold\" value=\"4\""); if (actiontype == "onhold") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl on hold") + "</option>"); sbViewTasks.Append("<option title=\"Pending\" value=\"5\""); if (actiontype == "pending") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl pending") + "</option>"); sbViewTasks.Append("<option title=\"Reopened\" value=\"6\""); if (actiontype == "reopened") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl reopened") + "</option>"); sbViewTasks.Append("<option title=\"Completed\" value=\"7\""); if (actiontype == "completed") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl completed") + "</option>"); sbViewTasks.Append("<option title=\"Archived\" value=\"8\""); if (actiontype == "archived") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl archived") + "</option>"); sbViewTasks.Append("<option title=\"Deleted\" value=\"9\""); if (actiontype == "deleted") { sbViewTasks.Append(" selected"); } sbViewTasks.Append(">" + this.MsgHelper.GetMessage("lbl deleted") + "</option>"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" class=\"button buttonInline blueHover minHeight buttonSet\" type=\"button\" name=\"setstate\" id=\"setstate\" value=\" " + MsgHelper.GetMessage("btn set") + " \" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + " </a>"); sbViewTasks.Append(" </td>"); if (IsAdmin & actiontype == "deleted") { sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a title=\"Purge\" class=\"button buttonInline redHover minHeight buttonDelete\" type=\"button\" name=\"purgeButton\" id=\"purgeButton\" value=\" " + MsgHelper.GetMessage("btn Purge") + " \" onclick=\"setTaskStateForSelTasks(1)\" >" + MsgHelper.GetMessage("btn Purge") + "</a>"); sbViewTasks.Append(" </td>"); } sbViewTasks.Append(" </tr>"); sbViewTasks.Append(" </table>"); sbViewTasks.Append("</td>"); } else if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "created")) { sbViewTasks.Append("<td>"); sbViewTasks.Append(" <table>"); sbViewTasks.Append(" <tr>"); sbViewTasks.Append(" <td class=\"label\" title=\"Assign to User\">" + MsgHelper.GetMessage("lbl Assign to User") + "</td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <select name=\"selectusergroup\" id=\"selectusergroup\">"); sbViewTasks.Append(" <optgroup label=\"Users\">"); for (int i = 1; i < cTemplates.Count; i++) { Collection coll = (Collection)cTemplates[i]; if (coll.Contains("DisplayUserName")) { if (!string.IsNullOrEmpty(coll["UserID"].ToString())) { long c = Convert.ToInt64(coll["UserID"]); if (c > 0) { userValue = c; } } sbViewTasks.Append("<option value=\"" + userValue + ",1\""); sbViewTasks.Append(">" + coll["DisplayUserName"] + "</option>"); } } sbViewTasks.Append(" </optgroup>"); sbViewTasks.Append(" <optgroup label=\"Groups\">"); for (int j = 1; j < cTemplates.Count; j++) { Collection coll = (Collection)cTemplates[j]; if (coll.Contains("DisplayUserGroupName")) { if(!string.IsNullOrEmpty(coll["UserGroupID"].ToString())) { long c = Convert.ToInt64(coll["UserGroupID"]); if (c > 0) { userValue = c; } } sbViewTasks.Append("<option value=\"" + userValue + ",2\""); sbViewTasks.Append(">" + coll["DisplayUserGroupName"] + "</option>"); } } sbViewTasks.Append(" </optgroup>"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a title=\"Set User Group\" class=\"button buttonInline blueHover minHeight buttonSet\" type=\"button\" name=\"setusergroup\" id=\"setusergroup\" value=\" " + MsgHelper.GetMessage("btn set") + " \" onclick=\"setTaskStateForSelTasks(2)\" >" + MsgHelper.GetMessage("btn set") + "</a>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" </tr>"); sbViewTasks.Append(" </table>"); sbViewTasks.Append(" </td>"); } else if (actiontype == "notstarted" | actiontype == "active") { sbViewTasks.Append("<td>"); sbViewTasks.Append(" <table>"); sbViewTasks.Append(" <tr>"); sbViewTasks.Append(" <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <select name=\"state\" id=\"state\">"); sbViewTasks.Append(" <option title=\"Awaiting Data\" value=\"3\" selected>Awaiting Data</option>"); sbViewTasks.Append(" <option title=\"On Hold\" value=\"4\">On Hold</option>"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\" " + MsgHelper.GetMessage("btn set") + " \" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" </tr>"); sbViewTasks.Append(" </table>"); sbViewTasks.Append("</td>"); } else if (actiontype == "awaitingdata") { sbViewTasks.Append("<td>"); sbViewTasks.Append(" <table>"); sbViewTasks.Append(" <tr>"); sbViewTasks.Append(" <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <select name=\"state\" id=\"state\">"); sbViewTasks.Append(" <option title=\"Active\" value=\"2\" selected>Active</option>"); sbViewTasks.Append(" <option title=\"On Hold\" value=\"4\">On Hold</option>"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\" " + MsgHelper.GetMessage("btn set") + " \" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" </tr>"); sbViewTasks.Append(" </table>"); sbViewTasks.Append("</td>"); } else if (actiontype == "onhold") { sbViewTasks.Append("<td>"); sbViewTasks.Append(" <table id=\"Table35\">"); sbViewTasks.Append(" <tr>"); sbViewTasks.Append(" <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <select name=\"state\" id=\"state\">"); sbViewTasks.Append(" <option title=\"Active\" value=\"2\" selected>Active</option>"); sbViewTasks.Append(" <option title=\"Awaiting Data\" value=\"3\">Awaiting Data</option>"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a title=\""+MsgHelper.GetMessage("lbl Set State")+"\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\" " + MsgHelper.GetMessage("btn set") + " \" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" </tr>"); sbViewTasks.Append(" </table>"); sbViewTasks.Append("</td>"); } else if (actiontype == "completed") { sbViewTasks.Append("<td>"); sbViewTasks.Append(" <table>"); sbViewTasks.Append(" <tr>"); sbViewTasks.Append(" <td class=\"label\" title=\"" + MsgHelper.GetMessage("lbl changestate") + "\">" + MsgHelper.GetMessage("lbl Change To State") + "</td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <select name=\"state\" id=\"state\">"); sbViewTasks.Append(" <option title=\"Archived\" value=\"8\" selected>Archived</option>"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" <td>"); sbViewTasks.Append(" <a title=\"" + MsgHelper.GetMessage("lbl Set State") + "\" type=\"button\" class=\"button buttonInline blueHover minHeight buttonSet\" name=\"setstate\" id=\"setstate\" value=\" " + MsgHelper.GetMessage("btn set") + " \" onclick=\"setTaskStateForSelTasks(0)\" >" + MsgHelper.GetMessage("btn set") + "</a>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" </tr>"); sbViewTasks.Append(" </table>"); sbViewTasks.Append("</td>"); } sbViewTasks.Append(" <td class=\"label\" align=\"right\" title=\"" + MsgHelper.GetMessage("lbl show tasktype") + "\">" + MsgHelper.GetMessage("lbl show task type")); sbViewTasks.Append(" <select name=\"show_task_type\" id=\"show_task_type\" onchange=\"RefreshTasksWithTaskType();\">"); sbViewTasks.Append(" </select>"); sbViewTasks.Append(" </td>"); sbViewTasks.Append(" </tr>"); sbViewTasks.Append("</table>"); sbViewTasks.Append("<div class=\"\">"); if (cTasks.Count == 0) { this.uxPaging.Visible = false; sbViewTasks.Append("<p title=\"Currently there is no data to report\">" + MsgHelper.GetMessage("msg no data report") + "</p>"); } else { if (pgrdata.TotalPages > 1) { this.uxPaging.ClientFunction = "GoToPage(this); return false;"; this.uxPaging.Visible = true; this.uxPaging.TotalPages = pgrdata.TotalPages; this.uxPaging.CurrentPageIndex = pgrdata.CurrentPage - 1; } else { this.uxPaging.Visible = false; } sbViewTasks.Append(" <table class=\"ektronGrid\" style=\"width:100%;\">"); sbViewTasks.Append(" <tr class=\"title-header\">"); if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "touser")) { sbViewTasks.Append("<td width=\"1\">"); sbViewTasks.Append(" <input title=\"Check All\" type=\"checkbox\" name=\"all\" onclick=\"checkAll(document.forms.viewtasks.all.checked);\" id=\"Checkbox3\" />"); sbViewTasks.Append("</td>"); } else if (actiontype == "notstarted" | actiontype == "active" | actiontype == "completed" | actiontype == "awaitingdata" | actiontype == "onhold") { sbViewTasks.Append("<td width=\"1\">"); sbViewTasks.Append(" <input title=\"Check All\" type=\"checkbox\" name=\"all\" onclick=\"checkAll(document.forms.viewtasks.all.checked);\" id=\"Checkbox6\" />"); sbViewTasks.Append("</td>"); } sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=title&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("generic Title") + "</a></td>"); sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=content_id&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl CID") + "</a></td>"); sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=state&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl state") + "</a></td>"); sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=priority&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl priority") + "</a></td>"); sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=duedate&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl Due Date") + "</a></td>"); sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=assignedto&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl Assigned To") + "</a></td>"); sbViewTasks.Append("<td><a href=\"tasks.aspx?action=ViewTasks&orderby=assignedby&ty=" + actiontype + "&user="******"user"] + "&usertype=" + Request.QueryString["usertype"] + "\" alt=\"" + MsgHelper.GetMessage("click to sort msg") + "\" title=\"" + MsgHelper.GetMessage("click to sort msg") + "\">" + MsgHelper.GetMessage("lbl Assigned By") + "</a></td>"); sbViewTasks.Append("<td>" + MsgHelper.GetMessage("lbl Last Added comments") + "</td>"); sbViewTasks.Append("<td>" + MsgHelper.GetMessage("lbl Create Date") + "</td>"); sbViewTasks.Append("</tr>"); bool bHasTask = false; for (int counter = 1; counter < cTasks.Count + 1; counter++) { EkTask cTask = cTasks.get_Item(counter); if (!(cTask.TaskTypeID == Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.TaskType.BlogPostComment) | cTask.TaskTypeID == Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.TaskType.TopicReply))) { bHasTask = true; sbViewTasks.Append("<tr id=\"task_" + cTask.TaskID + "_" + counter + "_"); if (cTask.TaskTypeID <= 0) { sbViewTasks.Append("NotS\">"); } else { sbViewTasks.Append(cTask.TaskTypeID + "\" >"); } sbViewTasks.Append("<script type=\"text/javascript\">"); sbViewTasks.Append("AddShownTaskID('task_" + cTask.TaskID + "_" + counter + "_"); if (cTask.TaskTypeID <= 0) { sbViewTasks.Append("NotS')"); } else { sbViewTasks.Append(cTask.TaskTypeID + "')"); } sbViewTasks.Append("</script>"); if (IsAdmin & (actiontype != "all" & actiontype != "both" & actiontype != "touser")) { sbViewTasks.Append("<td nowrap width=\"1\">"); sbViewTasks.Append("<input title=\"Task Type\" type=\"checkbox\" onclick=\"checkAllFalse();\" name=\"" + cTask.TaskID + "\" value=\"" + cTask.TaskID + "\" id=\"_" + cTask.TaskID + "_" + counter + "_"); if (cTask.TaskTypeID <= 0) { sbViewTasks.Append("NotS\">"); } else { sbViewTasks.Append(cTask.TaskTypeID + "\" >"); } sbViewTasks.Append("</td>"); } else if (actiontype == "notstarted" | actiontype == "active" | actiontype == "completed" | actiontype == "awaitingdata" | actiontype == "onhold") { sbViewTasks.Append("<td nowrap width=\"1\">"); sbViewTasks.Append("<input title=\"Task ID\" type=\"checkbox\" onclick=\"checkAllFalse();\" name=\"" + cTask.TaskID + "\" value=\"" + cTask.TaskID + "\" id=\"_" + cTask.TaskID + "_" + counter + "_"); if (cTask.TaskTypeID <= 0) { sbViewTasks.Append("NotS\">"); } else { sbViewTasks.Append(cTask.TaskTypeID + "\" >"); } sbViewTasks.Append("</td>"); } sbViewTasks.Append("<td nowrap=\"nowrap\">"); sbViewTasks.Append(" <a href=\"tasks.aspx?action=ViewTask&tid=" + cTask.TaskID + "&ty=" + actiontype + "&" + backButtonUrl + "\">" + cTask.TaskTitle + "</a>"); sbViewTasks.Append("</td>"); if (cTask.ContentID != -1) { if (Convert.ToInt32(cTask.ContentType) == 2 | Convert.ToInt32(cTask.ContentType) == 4) { sbViewTasks.Append("<td nowrap=\"nowrap\"><a href=\"cmsform.aspx?action=ViewForm&form_id=" + cTask.ContentID + "&LangType=" + cTask.LanguageID + "&callerpage=tasks.aspx&origurl=" + Server.UrlEncode(Request.ServerVariables["QUERY_STRING"]) + "\" title=\"" + MsgHelper.GetMessage("generic View") + " " + cTask.ContentTitle.Replace("'", "`") + "\">" + cTask.ContentID + "</a></td>"); } else { sbViewTasks.Append("<td nowrap=\"nowrap\"><a href=\"content.aspx?action=View&id=" + cTask.ContentID + "&LangType=" + cTask.LanguageID + "&callerpage=tasks.aspx&origurl=" + Server.UrlEncode(Request.ServerVariables["QUERY_STRING"]) + "\" title=\"" + MsgHelper.GetMessage("generic View") + " " + cTask.ContentTitle.Replace("'", "`") + "\">" + cTask.ContentID + "</a></td>"); } } else { sbViewTasks.Append("<td> </td>"); } switch (cTask.State) { case "1": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl not started")+"</td>"); break; case "2": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl active")+"</td>"); break; case "3": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl awaiting data")+"</td>"); break; case "4": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl on hold")+"</td>"); break; case "5": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl pending")+"</td>"); break; case "6": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl reopened")+"</td>"); break; case "7": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl completed")+"</td>"); break; case "8": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl archived")+"</td>"); break; case "9": sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl deleted")+"</td>"); break; } switch (Convert.ToInt32(cTask.Priority)) { case 1: sbViewTasks.Append("<td nowrap=\"true\">" + this.MsgHelper.GetMessage("lbl low") + "</td>"); break; case 2: sbViewTasks.Append("<td nowrap=\"true\">" + this.MsgHelper.GetMessage("lbl normal") + "</td>"); break; case 3: sbViewTasks.Append("<td nowrap=\"true\">"+this.MsgHelper.GetMessage("lbl high")+"</td>"); break; case 0: sbViewTasks.Append("<td nowrap=\"true\">[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>"); break; } if ((!string.IsNullOrEmpty(cTask.DueDate))) { if ((Convert.ToDateTime(cTask.DueDate) < DateTime.Today)) { sbViewTasks.Append("<td nowrap=\"true\" class=\"important\">" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>"); } else { sbViewTasks.Append("<td nowrap=\"true\">" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>"); } } else { sbViewTasks.Append("<td nowrap=\"true\">[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>"); } if (cTask.AssignToUserGroupID == 0) { if (cTask.ContentID != -1) { sbViewTasks.Append("<td nowrap=\"true\">All Authors of (" + cTask.ContentID + ")</td>"); } else { sbViewTasks.Append("<td nowrap=\"true\">All Authors</td>"); } } else if (cTask.AssignedToUser != "") { sbViewTasks.Append("<td nowrap=\"nowrap\">"); sbViewTasks.Append("<img src=\"" + AppPath + "images/UI/Icons/user.png\" alt=\"\" align=\"absbottom\"/>"); sbViewTasks.Append(m_refEmail.MakeUserTaskEmailLink(cTask, false)); sbViewTasks.Append("</td>"); } else if (cTask.AssignToUserGroupID != 0) { sbViewTasks.Append("<td nowrap=\"nowrap\">"); sbViewTasks.Append("<img src=\"" + AppPath + "images/UI/Icons/user.png\" alt=\"\" align=\"absbottom\"/>"); sbViewTasks.Append(m_refEmail.MakeUserGroupTaskEmailLink(cTask)); sbViewTasks.Append("</td>"); } else { sbViewTasks.Append("<td> </td>"); } sbViewTasks.Append("<td nowrap=\"nowrap\">"); sbViewTasks.Append(m_refEmail.MakeByUserTaskEmailLink(cTask, false)); sbViewTasks.Append("</td>"); if (cTask.LastComment == "") { sbViewTasks.Append("<td >[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>"); } else { sbViewTasks.Append("<td ><div class=\"comment-block\">" + cTask.LastComment + "</div></td>"); } sbViewTasks.Append("<td>" + AppUI.GetInternationalDateOnly(cTask.DateCreated) + "</td>"); sbViewTasks.Append("</tr>"); } } sbViewTasks.Append("</table>"); if (!bHasTask) { sbViewTasks.Append("<p>" + MsgHelper.GetMessage("msg no data report") + "</p>"); } } sbViewTasks.Append("<input type=\"hidden\" name=\"taskids\" value=\"\" id=\"taskids\"/>"); sbViewTasks.Append("<input type=\"hidden\" name=\"purge\" value=\"\" id=\"purge\"/>"); sbViewTasks.Append("<input type=\"hidden\" name=\"actiontype\" value=\"" + actiontype + "\" id=\"actiontype\"/>"); sbViewTasks.Append("<input type=\"hidden\" name=\"rptHtml\" value=\"\" id=\"rptHtml\"/>"); sbViewTasks.Append("<input type=\"hidden\" name=\"rptTitle\" value=\"\" id=\"rptTitle\"/>"); sbViewTasks.Append("</div>"); ltrViewTasks.Text = sbViewTasks.ToString(); }
private void Display_DeleteAllTasks() { ValidateCanDeleteTask(); pnlDeleteAllTasks.Visible = true; string taskIDs = string.Empty; objTask = AppUI.EkTaskRef; if ((actiontype == "all")) { TaskItemType = 12; } else if ((actiontype == "both")) { TaskItemType = 9; } else if ((actiontype == "to")) { TaskItemType = 3; } else if ((actiontype == "by")) { TaskItemType = 7; } PageRequestData pgdata = new PageRequestData(); cTasks = objTask.GetTasks(-1, currentUserID, -1, TaskItemType, OrderBy, -1, ref pgdata, ""); HttpCookie cookie = Ektron.Cms.CommonApi.GetEcmCookie(); if ((actiontype == "all")) { sTitleBar = "Delete All Tasks In The System"; } else if ((actiontype == "to")) { sTitleBar = "Delete Tasks Assigned To " + cookie["userfullname"]; } else if ((actiontype == "by")) { sTitleBar = "Delete Tasks Assigned By " + cookie["userfullname"]; } else if ((actiontype == "both")) { sTitleBar = "Delete Tasks Assigned By and To " + cookie["userfullname"]; } StringBuilder sb = new StringBuilder(); for (int i = 1; i < cTasks.Count + 1; i++) { EkTask cTask = cTasks.get_Item(i); taskIDs = taskIDs + cTask.TaskID + ","; sb.Append("<tr id=\"task_" + cTask.TaskID + "_" + i + "_"); if (cTask.TaskTypeID <= 0) { sb.Append("NotS\">"); } else { sb.Append(cTask.TaskTypeID + "\">"); } sb.Append(" <script type=\"text/javascript\">"); sb.Append(" AddShownTaskID('task_" + cTask.TaskID + "_" + i + "_"); if (cTask.TaskTypeID <= 0) { sb.Append("NotS');"); } else { sb.Append(cTask.TaskTypeID + "');"); } sb.Append("</script>"); sb.Append(" <td nowrap=\"nowrap\" width=\"1\">"); sb.Append(" <input title=\"Task ID\" type=\"checkbox\" onclick=\"checkAllFalse();\" name=\"id_" + cTask.TaskID +"\" id=\"_" + cTask.TaskID + "_" + i + "_"); if (cTask.TaskTypeID <= 0) { sb.Append("NotS\"/>"); } else { sb.Append(cTask.TaskTypeID + "\"/>"); } sb.Append(" </td>"); sb.Append("<td><a href=\"tasks.aspx?action=ViewTask&tid=" + cTask.TaskID + "\" title=\"" + cTask.TaskTitle + "\">" + cTask.TaskTitle + "</a></td>"); sb.Append("<td title=\"" + cTask.TaskID + "\">" + cTask.TaskID + "</td>"); if ((actiontype == "by") | (actiontype == "all") | (actiontype == "both")) { if (cTask.AssignToUserGroupID == 0) { sb.Append("<td>All Authors</td>"); } else if (cTask.AssignedToUser != "") { sb.Append("<td>"); sb.Append("<img src=\"" + AppPath + "images/UI/Icons/user.png\" alt=\"\" align=\"absbottom\"/>"); sb.Append(m_refEmail.MakeUserTaskEmailLink(cTask, false)); sb.Append("</td>"); } else if (cTask.AssignedToUserGroup != "") { sb.Append("<td>"); sb.Append("<img src=\"" + AppPath + "images/UI/Icons/users.png\" alt=\"\" align=\"absbottom\"/>"); sb.Append(m_refEmail.MakeUserGroupTaskEmailLink(cTask)); sb.Append("</td>"); } } if ((actiontype == "to") | (actiontype == "all") | (actiontype == "both")) { sb.Append("<td>"); sb.Append(m_refEmail.MakeByUserTaskEmailLink(cTask, false)); sb.Append("</td>"); } if ((!string.IsNullOrEmpty(cTask.DueDate))) { if ((Convert.ToDateTime(cTask.DueDate) < DateTime.Today)) { sb.Append("<td class=\"important\">" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>"); } else { sb.Append("<td>" + AppUI.GetInternationalDateOnly(cTask.DueDate) + "</td>"); } } else { sb.Append("<td>[" + this.MsgHelper.GetMessage("dd not specified") + "]</td>"); } switch (cTask.State) { case "1": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl not started")+"</td>"); break; case "2": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl active")+"</td>"); break; case "3": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl awaiting data")+"</td>"); break; case "4": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl on hold")+"</td>"); break; case "5": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl pending")+"</td>"); break; case "6": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl reopened")+"</td>"); break; case "7": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl completed")+"</td>"); break; case "8": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl archived")+"</td>"); break; case "9": sb.Append("<td>"+this.MsgHelper.GetMessage("lbl deleted")+"</td>"); break; } switch (cTask.Priority) { case EkEnumeration.TaskPriority.Low: sb.Append("<td>" + this.MsgHelper.GetMessage("lbl low") + "</td>"); break; case EkEnumeration.TaskPriority.Normal: sb.Append("<td>" + this.MsgHelper.GetMessage("lbl normal") + "</td>"); break; case EkEnumeration.TaskPriority.High: sb.Append("<td>" + this.MsgHelper.GetMessage("lbl high") + "</td>"); break; } sb.Append("</tr>"); } if (taskIDs != string.Empty) { taskIDs = taskIDs.Remove(taskIDs.Length - 1, 1); } ltrDeleteAllTasks.Text = sb.ToString(); ltrTaskIds.Text = "<input type=\"hidden\" name=\"taskids\" value=\"" + taskIDs + "\" id=\"taskids\"/>"; }