/// <summary> /// Load Item from query string /// </summary> private void LoadItem() { _sItemID = "" + Request.QueryString["xID"]; _sQuestionType = "" + Request.QueryString["qType"]; ItemID = Cryptography.GetDecryptedID(SessionObject.LoggedInUser.CipherKey); _iAssessmentID = Cryptography.GetDecryptedID(SessionObject.LoggedInUser.CipherKey, "AssessmentID"); lbl_TestCategory.Value = Request.QueryString["TestCategory"]; lbl_TestType.Value = Request.QueryString["TestType"]; if (_sItemID == null) { SessionObject.RedirectMessage = "No entity ID provided in URL."; Response.Redirect("~/PortalSelection.aspx", true); } else { if (_sQuestionType.Equals("TestQuestion")) { // Remove the copy item button if we are coming from the item editor. btnCopyItem.Visible = false; if (ItemID == 0 && _iAssessmentID > 0 && !String.IsNullOrEmpty(_sItemID)) { _itemTestQuestion = TestQuestion.GetTestQuestionByID(DataIntegrity.ConvertToInt(_sItemID), false); ItemID = _itemTestQuestion.ID; if (_itemTestQuestion.TestID != _iAssessmentID) { SessionObject.RedirectMessage = "Invalid entity ID provided in URL."; Response.Redirect("~/PortalSelection.aspx", true); } } else { _itemTestQuestion = TestQuestion.GetTestQuestionByID(ItemID, false); } UseTq = true; } else { _itemBankQuestion = BankQuestion.GetQuestionByID(ItemID); _itemBankQuestion.LoadAddendum(); UseTq = false; } LoadAddendums(); LoadStandards(); LoadItemText(); _itemReservation = "No"; if (UserHasPermission(Permission.Access_ItemReservation)) _itemReservation = "Yes"; else reservationDropDown.Enabled = false; string qType = UseTq ? "TestQuestion" : ""; ScriptManager.RegisterStartupScript(this, typeof(string), "SetQType", "setQuestionType('"+qType+"');", true); } if (Request.QueryString["isCopy"] == "true") ScriptManager.RegisterStartupScript(this, typeof(string), "AlertForCopiedItem", "AlertForCopiedItem();", true); }
private void LoadData() { HtmlTableRow oRow; HtmlTableCell oCell; HtmlGenericControl oDiv; if (Tile.TileParms.GetParm("item") == null) return; _questionType = Tile.TileParms.GetParm("item").GetType(); if (_questionType.Name == "BankQuestion") { _oBankQuestion = (BankQuestion)Tile.TileParms.GetParm("item"); _oQuestionBase = (QuestionBase)_oBankQuestion; } else { _oTestQuestion = (TestQuestion)Tile.TileParms.GetParm("item"); _oQuestionBase = (QuestionBase)_oTestQuestion; } /******************************************************************************* * Although for any given version of the Elements application there is only one * type of rigor (either Webb, Marzano, or RBT), and this is determined by the * value of DOK in the Parms table in the database, a bank question may have * all three rigors in its full rigor string. Its just that only one of the * three rigors is used. If displaying a bank question, we intend to display * all the rigors listed in the full rigor string. The full rigor string looks * something like: * Webb=3|RBT=4|Marzano=4| * We get to parse out the different rigors and then use the numeric code of * each and fetch from the database the actual text or description for the code. * * We expect each rigor to be divided by vertical bar '|', and each rigor to be * be of a format: {rigor name}={numeric code} (e.g. RBT=2). * * If displaying a test question, then we will only display the single rigor de- * fined at the district. * *****************************************************************************/ var rgxRigorFormat = new Regex(@"[a-zA-Z]+=\d+"); //this regex pattern should match above format for rigor. /*list of rigors and codes to pass to the database in order to look up code's text*/ dtGeneric_String_Int dtListOfRigors = new dtGeneric_String_Int(); if (_questionType.Name == "BankQuestion") { /*array of strings from full string rigor, each holding a rigor=value pattern, we hope.*/ string[] aRigors = _oQuestionBase.Rigor.FullRigorString.Split('|'); /*loop through array of strings and collect a set of legit rigor/code values in dtListOfRigors*/ foreach (var sRigor in aRigors) { if (rgxRigorFormat.IsMatch(sRigor)) { dtListOfRigors.Add(sRigor.Substring(0, sRigor.IndexOf('=')), DataIntegrity.ConvertToInt(sRigor.Substring(sRigor.IndexOf('=') + 1))); } } /*Pass dtListOfRigors via SP to database in order to look up each rigor's code's text value.*/ var dt = ThinkgateDataAccess.FetchDataTable("E3_RIGOR_GetDescriptionsFromListOfCodes", new object[] { dtListOfRigors.ToSql() }); /* Loop through our result set and build into our tableItemAdvanced html table for displaying */ DataRow drRigor; for (int i = 0; i < dt.Rows.Count; i++) { drRigor = dt.Rows[i]; oRow = new HtmlTableRow(); oCell = new HtmlTableCell(); oCell.Attributes.Add("class", "fieldLabel"); oCell.Attributes.Add("style", "width:130px"); oCell.InnerText = drRigor["Field"].ToString() + ":"; oRow.Cells.Add(oCell); oCell = new HtmlTableCell(); oCell.InnerText = drRigor["Text"].ToString(); oRow.Cells.Add(oCell); tblItemAdvanced.Rows.Insert(i, oRow); } } else { var distParms = DistrictParms.LoadDistrictParms(); oRow = new HtmlTableRow(); oCell = new HtmlTableCell(); oCell.Attributes.Add("class", "fieldLabel"); oCell.Attributes.Add("style", "width:130px"); oCell.InnerText = distParms.DOK; oRow.Cells.Add(oCell); oCell = new HtmlTableCell(); oCell.InnerText = _oQuestionBase.Rigor.ToString(); oRow.Cells.Add(oCell); tblItemAdvanced.Rows.Insert(0, oRow); } lblItemDifficulty.Text = string.Format("{0:#.00##}", _oQuestionBase.ItemDifficulty); lblDifficultyIndex.Text = _oQuestionBase.DifficultyIndex.ToString(); /****************************************************** * The number of Distractor Rationale values vary, so * we need to build the HTML to represent these. * ***************************************************/ foreach (var sDistractorRationale in _oQuestionBase.DistractorRationale) { oDiv = new HtmlGenericControl(); oDiv.InnerHtml = sDistractorRationale; oCell = new HtmlTableCell(); oCell.ColSpan = 2; oCell.Controls.Add(oDiv); oRow = new HtmlTableRow(); oRow.Cells.Add(oCell); tblItemAdvanced.Rows.Add(oRow); } }
private void LoadData() { if (Tile.TileParms.GetParm("item") == null) return; _questionType = Tile.TileParms.GetParm("item").GetType(); if (_questionType.Name == "BankQuestion") { _oBankQuestion = (BankQuestion)Tile.TileParms.GetParm("item"); _oQuestionBase = (QuestionBase)_oBankQuestion; } else { _oTestQuestion = (TestQuestion)Tile.TileParms.GetParm("item"); _oQuestionBase = (QuestionBase)_oTestQuestion; } var dparms = DistrictParms.LoadDistrictParms(); ItemContentTile_lbl_OTCUrl.Value = AppSettings.OTCUrl + dparms.ClientID; ItemContentTile_itemID.Value = _oQuestionBase.ID.ToString(); ItemContentTile_itemType.Value = _questionType.Name.ToString(); /* set up our image element to point * to the item's thumbnail image */ var imgFilePath = AppSettings.ItemThumbnailWebPath_Content + _oQuestionBase.ThumbnailName; if (!System.IO.File.Exists(Server.MapPath(imgFilePath))) imgFilePath = "~/Images/thumb_none.png"; ItemContentTile_imgThumbnail.Src = imgFilePath; /* determine size of image. If it is smaller * than the space we allow, then increase its * height or width. If it is larger than the * space we allow, then use max-width and max * height to shrink it. */ System.Drawing.Image imgThumbNail = System.Drawing.Image.FromFile(Server.MapPath(imgFilePath)); var fImgHeight = imgThumbNail.PhysicalDimension.Height; var fImgWidth = imgThumbNail.PhysicalDimension.Width; var lImgTagMaxHeight = DataIntegrity.ConvertToNullableFloat(ItemContentTile_imgThumbnail.Style["max-height"].ToString().Replace("px","").Replace("%","")); var lImgTagMaxWidth = DataIntegrity.ConvertToNullableFloat(ItemContentTile_imgThumbnail.Style["max-width"].ToString().Replace("px", "").Replace("%", "")); if (fImgHeight < lImgTagMaxHeight && fImgWidth < lImgTagMaxWidth) { if (fImgHeight > fImgWidth) ItemContentTile_imgThumbnail.Height = DataIntegrity.ConvertToInt(lImgTagMaxHeight); else ItemContentTile_imgThumbnail.Width = DataIntegrity.ConvertToInt(lImgTagMaxWidth); } /* Set up our online preview link's onClick * event with the item's ID. */ ItemContentTile_hdnThumbnailURL.Value = @"display.asp?formatoption=search results&key=9120&retrievemode=searchpage&ahaveSkipped=normal&??Question=" + _oQuestionBase.ID.ToString() + @"&??TestID=0&qreview=y"; imgPreviewIcon.Src = ResolveUrl("../../Images/preview_small.png"); /* Set up our Print Preview hidden text box * to hold the encrypted ID of the item */ ItemContentTile_hdnPrintPreviewInfo.Value = ResolveUrl("../../Record/RenderItemAsPDF.aspx?xID=") + Encryption.EncryptString(_oQuestionBase.ID.ToString()) + "&TestQuestion=" + Encryption.EncryptString((_questionType.Name=="BankQuestion") ? "false" : "true"); imgPrintPreviewIcon.Src = ResolveUrl("../../Images/mag_glass.png"); /* See if the item has an addendum. If so then * set up and display link to pop up Addendum. * Otherwise make sure it doesn't display.*/ if (_oQuestionBase.AddendumID == 0) { divDisplayAddendum.Style["visibility"] = "hidden"; } else { if (_questionType.Name == "BankQuestion") _oBankQuestion.LoadAddendum(); //_oQuestionBase.LoadAddendum(); hlLaunchAddendumPage.InnerText = _oQuestionBase.Addendum.Addendum_Name; hlLaunchAddendumPage.Attributes["onClick"] = "window.open('" + ResolveUrl("../../Record/AddendumPage.aspx?xID=") + Encryption.EncryptString(_oQuestionBase.AddendumID.ToString()) + "'); return false;"; divAddendumContent.InnerHtml = _oQuestionBase.Addendum.Addendum_Text; hlDisplayAddendum.Attributes["onClick"] = "displayAddendumClick();"; HtmlImage imgAddendumIcon = new HtmlImage(); imgAddendumIcon.ID = "imgAddendumIcon"; imgAddendumIcon.Src = ResolveUrl("../../Images/Addendum_small.png"); imgAddendumIcon.Height = 20; hlDisplayAddendum.Controls.Add(imgAddendumIcon); Label lblAddendum_Name = new Label(); lblAddendum_Name.Text = _oQuestionBase.Addendum.Addendum_Name; hlDisplayAddendum.Controls.Add(lblAddendum_Name); //hlDisplayAddendum.InnerText = oItem.Addendum.Addendum_Name; divDisplayAddendum.Style["visibility"] = "visible"; } }
private void LoadItem() { _sItemID = "" + Request.QueryString["xID"]; _sQuestionType = "" + Request.QueryString["qType"]; _iItemID = Cryptography.GetDecryptedID(SessionObject.LoggedInUser.CipherKey); _iAssessmentID = Cryptography.GetDecryptedID(SessionObject.LoggedInUser.CipherKey, "AssessmentID"); lbl_TestCategory.Value = Request.QueryString["TestCategory"]; if (_sItemID == null) { SessionObject.RedirectMessage = "No entity ID provided in URL."; Response.Redirect("~/PortalSelection.aspx", true); } else { if (_sQuestionType.Equals("TestQuestion")) { // Remove the copy item button if we are coming from the item editor. if (_iItemID == 0 && _iAssessmentID > 0 && !String.IsNullOrEmpty(_sItemID)) { _itemTestQuestion = TestQuestion.GetTestQuestionByID(DataIntegrity.ConvertToInt(_sItemID), false); _iItemID = _itemTestQuestion.ID; if (_itemTestQuestion.TestID != _iAssessmentID) { SessionObject.RedirectMessage = "Invalid entity ID provided in URL."; Response.Redirect("~/PortalSelection.aspx", true); } } else { _itemTestQuestion = TestQuestion.GetTestQuestionByID(_iItemID, false); } useTestQuestion = true; //_itemTestQuestion.LoadItemAndScoreTypes(); //_itemTestQuestion.LoadRubric(); } else { _itemBankQUestion = BankQuestion.GetQuestionByID(_iItemID); _itemBankQUestion.LoadAddendum(); useTestQuestion = false; } LoadStandards(); LoadItemText(); } }
private void SetQuestion(object item) { Debug.Assert(item != null); Debug.Assert(_questionType != null); Debug.Assert(!string.IsNullOrWhiteSpace(_questionType.Name)); if (_questionType.Name == BankQuestionTypeName) { _oBankQuestion = item as BankQuestion; _oTestQuestion = null; Debug.Assert(_oBankQuestion != null); } else { _oTestQuestion = item as TestQuestion; _oBankQuestion = null; Debug.Assert(_oTestQuestion != null); } }
private void LoadItem() { if (IsQueryStringMissingParameter(X_ID)) { RedirectToPortalSelectionScreen(); } else { ItemId = GetDecryptedEntityId(X_ID); ItemIdEncrypted = EntityIdEncrypted; if (!RecordExistsInCache(Key)) { SelectedItem = BankQuestion.GetQuestionByID(ItemId); if (SelectedItem != null) Base.Classes.Cache.Insert(Key, SelectedItem); else { SessionObject.RedirectMessage = "Could not find the item."; Response.Redirect("~/PortalSelection.aspx", true); } } else SelectedItem = (BankQuestion)Cache[Key]; // Set the page title text. if (SelectedItem != null) _itemTitle = ("Item ID: " + SelectedItem.ID); } }
private void LoadData() { if (Tile.TileParms.GetParm("item") == null) return; _questionType = Tile.TileParms.GetParm("item").GetType(); if (_questionType.Name == "BankQuestion") { _oBankQuestion = (BankQuestion) Tile.TileParms.GetParm("item"); _oQuestionBase = (QuestionBase) _oBankQuestion; } else { _oTestQuestion = (TestQuestion) Tile.TileParms.GetParm("item"); _oQuestionBase = (QuestionBase) _oTestQuestion; } lblGrade.Text = _oQuestionBase.Grade; lblSubject.Text = _oQuestionBase.Subject; lblItemBanks.Text = ItemBankMasterList.Filtered_ItemBank_Labels(_oQuestionBase.ItemBankList, SessionObject.LoggedInUser); lblStatus.Text = _oQuestionBase.Status; lblReservation.Text = _oQuestionBase.Reservation; lblAnchorItem.Text = _oQuestionBase.IsAnchorItem ? "Yes" : "No"; switch (_oQuestionBase.QuestionType) { case QuestionTypes.E: lblType.Text = "Essay"; break; case QuestionTypes.MC3: lblType.Text = "Multiple Choice (3 Distractors)"; break; case QuestionTypes.MC4: lblType.Text = "Multiple Choice (4 Distractors)"; break; case QuestionTypes.MC5: lblType.Text = "Multiple Choice (5 Distractors)"; break; case QuestionTypes.S: lblType.Text = "Short Answer"; break; case QuestionTypes.T: lblType.Text = "True/False"; break; default: lblType.Text = "Unknown"; break; } lblScoreType.Text = _oQuestionBase.ScoreType; lblKeywords.Text = _oQuestionBase.Keywords; lblCopyright.Text = String.IsNullOrEmpty(_oQuestionBase.Copyright) ? "No" : _oQuestionBase.Copyright; lblCopyRightExpiryDate.Text = _oQuestionBase.CopyRightExpiryDate == null ? "Not defined" : _oQuestionBase.CopyRightExpiryDate.GetValueOrDefault().Date.ToString("MM/dd/yyyy"); lblSource.Text = _oQuestionBase.Source; lblCredit.Text = _oQuestionBase.Credit; /* Figure out contextually how to display rubric info. If the question's scoretype is not rubric then there is no need to display the "rubric type", "Rubric Scoring" or Rubric Name. * If the question's scoretype is rubric, display rubric type, display rubric scoring, then consider whether it is a "Basic", "holistic", or "analytical" rubric: * If "Basic", then * Also make rubric scoring a hyperlink - when clicked provide pop-up window of rubric's criteria. * don't display rubric name since it is basic (and there isn't any name). * * If "Holistic", then * display rubric name. * Also make rubric name a hyperlink - when clicked provide pop-up window of rubric's criteria. * in popup, provide a link to take user to rubric object page. * * If "Analytical", then * Make rubric scoring a hyperlink - when clicked provide pop-up window of rubric's criteria. * In popup, provide a link to take user to the rubric object page. * Don't display rubric name since it is Analytical. * */ if (_oQuestionBase.ScoreType == "Rubric") { lblRubricType.Text = _oQuestionBase.Rubric.TypeDesc; rowRubricType.Style["display"] = "block"; lblRubricScoring.Text = _oQuestionBase.Rubric.Scoring; rowRubricScoring.Style["display"] = "block"; ItemIDTile_hdnRubricName.Value = _oQuestionBase.Rubric.Name; ItemIDTile_hdnRubricContent.Value = _oQuestionBase.Rubric.Content; switch (_oQuestionBase.Rubric.TypeDesc) { case "Basic": hlRubricScoring.Attributes.Add("onClick", "displayRubricCriteria();"); rowRubricName.Style["display"] = "none"; break; case "Analytical": ItemIDTile_hdnRubricPageUrl.Value = "../../Record/RubricPage.aspx?xID=" + _oQuestionBase.Rubric.ID_Encrypted; hlRubricScoring.Attributes.Add("onClick", "displayRubricCriteria();"); rowRubricName.Style["display"] = "none"; break; case "Holistic": lblRubricName.Text = _oQuestionBase.Rubric.Name; ItemIDTile_hdnRubricPageUrl.Value = "../../Record/RubricPage.aspx?xID=" + _oQuestionBase.Rubric.ID_Encrypted; hlRubricName.Attributes.Add("onClick", "displayRubricCriteria();"); hlRubricScoring.HRef = ""; rowRubricName.Style["display"] = "block"; break; } } }