/// <summary> /// Renders the File Submission column cell /// </summary> /// <param name="renderedCell">The value to render, from the query results.</param> /// <param name="webNameRenderedCell"></param> /// <param name="learnerAssignmentGUID">The GUID of the current assignment</param> /// <param name="hw">The HtmlTextWriter to write to.</param> void RenderFileSubmissionCell(RenderedCell renderedCell, WebNameRenderedCell webNameRenderedCell, Guid learnerAssignmentGUID, HtmlTextWriter hw) { // This is a bit of a hack since the query returns an unlocalized string. Next time the schema is changed would be best // to change to return integer values representing these. No point making a sql change just for this though. if (renderedCell.ToString() == "Submit File(s)") { string baseUrl = "{0}{1}FilesUploadPage.aspx?LearnerAssignmentId={2}&Source={3}"; // Creating a format string from a format string baseUrl = string.Format(CultureInfo.InvariantCulture, baseUrl, "{0}", Constants.SlkUrlPath, "{1}", RawSourceUrl); RenderFileSubmissionCellAsSubmitLink(baseUrl, webNameRenderedCell.SPWebUrl, learnerAssignmentGUID, PageCulture.Format(PageCulture.Resources.AlwpFileSubmissionSubmitText), hw); } else if (renderedCell.ToString() == "Submitted LINK") { RenderFileSubmissionCellAsSubmittedLink( "{0}" + Constants.SlkUrlPath + "SubmittedFiles.aspx?LearnerAssignmentId={1}", webNameRenderedCell, learnerAssignmentGUID, PageCulture.Format(PageCulture.Resources.LearnerAssignmentStatusCompleted), hw); } else if (renderedCell.ToString() == "Submitted") { hw.WriteEncodedText(PageCulture.Format(PageCulture.Resources.LearnerAssignmentStatusCompleted)); } else if (renderedCell.ToString() == "Not Available") { hw.WriteEncodedText(PageCulture.Format(PageCulture.Resources.GradingFileSubmissionNA)); } else { hw.WriteEncodedText(renderedCell.ToString()); } }
/// <summary> /// Renders a column cell, i.e. one column of one row in the query results. /// </summary> /// <param name="renderedCell">The value to render, from the query results.</param> /// <param name="webNameRenderedCell">If the row containing this cell also contains a cell /// of type <c>WebNameRenderedCell</c>, i.e. a cell referring to a SharePoint Web site, /// this parameter refers to that cell. Otherwise, this parameter is <c>null</c>. /// </param> /// <param name="hw">The <c>HtmlTextWriter</c> to write to.</param> /// <param name="slkStore">The SlkStore to use to get assignment information from.</param> void RenderColumnCell(RenderedCell renderedCell, WebNameRenderedCell webNameRenderedCell, HtmlTextWriter hw, SlkStore slkStore) { // render the cell contents inside a "<span>" (not sure why SharePoint uses a "<span>" // here, but I'm copying what they do) if (renderedCell.ToolTip != null) { hw.AddAttribute(HtmlTextWriterAttribute.Title, renderedCell.ToolTip); } using (new HtmlBlock(HtmlTextWriterTag.Span, 0, hw)) { if (webNameRenderedCell == renderedCell && webNameRenderedCell.RenderAsLink) { RenderCellWithLink(webNameRenderedCell, hw, renderedCell.ToString(), "#", "_parent"); } else if (renderedCell.Id != null) { if (renderedCell.Id.ItemTypeName == Schema.AssignmentItem.ItemTypeName) { // render a link to the Instructor Assignment Properties page string url = "Grading.aspx?AssignmentId={0}"; RenderCellWithLink(webNameRenderedCell, hw, renderedCell.ToString(), url, "_parent", renderedCell.Id.GetKey().ToString(CultureInfo.InvariantCulture)); } else if (renderedCell.Id.ItemTypeName == Schema.LearnerAssignmentItem.ItemTypeName) { Guid learnerAssignmentGuidId = slkStore.GetLearnerAssignmentGuidId(renderedCell.Id); if (IsObserver) { // Display this cell as an url and clicking this url will launch frameset in StudentReview mode string url = "Frameset/Frameset.aspx?SlkView=StudentReview&{0}={1}"; RenderCellWithLink(webNameRenderedCell, hw, renderedCell.ToString(), url, "_blank", FramesetQueryParameter.LearnerAssignmentId, learnerAssignmentGuidId.ToString()); } else { // render a link to the Learner Assignment Properties page string url = "Lobby.aspx?{0}={1}&{2}={3}"; RenderCellWithLink(webNameRenderedCell, hw, renderedCell.ToString(), url, "_parent", FramesetQueryParameter.LearnerAssignmentId, learnerAssignmentGuidId.ToString(), QueryStringKeys.Source, RawSourceUrl); } } else { hw.WriteEncodedText(renderedCell.ToString()); } } else { hw.WriteEncodedText(renderedCell.ToString()); } } }