protected void Page_Load(object sender, System.EventArgs e) { try { // standard error label this.lblErrorEncountered.Text = SharedSupport.GetLocalizedString("ErrorPage_ErrorEncountered"); // localize token on querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); string errorDetail = func.ValidateStringQueryStringParameter(this.Request, "ErrorDetail"); if (!errorDetail.Equals(null) && !errorDetail.Equals(String.Empty)) { this.lblErrorDetail.Text = SharedSupport.GetLocalizedString(errorDetail); } else { this.lblErrorDetail.Text = String.Empty; } // link to Core Tools this.hlCoreTools.Text = SharedSupport.GetLocalizedString("ErrorPage_BackToStartPage"); this.hlCoreTools.NavigateUrl = AssignmentManager.Common.constants.BACK_TO_CORETOOLS_LINK; // log off ...otherwise, after returning to core tools, previous identity persists System.Web.Security.FormsAuthentication.SignOut(); } catch (System.Exception ex) { this.lblErrorDetail.Text = ex.Message; } }
public void btnSave_Click(object sender, System.EventArgs e) { try { if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_ADD)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } btnCancel.Enabled = true; btnSave.Enabled = true; btnSave.Visible = true; Nav1.Feedback.Text = String.Empty; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); string importID = func.ValidateStringQueryStringParameter(this.Request, "ImportID"); if (ImportUsers.CommitImport(importID)) { // Records saved successfully redirect to Users page. Response.Redirect("Users.aspx?CourseID=" + Request.QueryString.Get("CourseID").ToString(), false); } else { throw new ApplicationException(); } } catch { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AdminResults_UpdateFailed"); btnCancel.Enabled = true; btnSave.Enabled = false; btnSave.Visible = false; } }
protected void Page_Load(object sender, System.EventArgs e) { try { // Initialize labels initializeLabels(); // set the baseUrl variable baseUrl = AssignmentManager.SharedSupport.BaseUrl.ToString(); // set logoff link dynamically based on if server is using SSL if (Convert.ToBoolean(SharedSupport.UsingSsl) == true) { rootURL = "https://" + baseUrl + @"/"; } else { rootURL = "http://" + baseUrl + @"/"; } // logs user off if actionLogoff hidden input tag = "logoff" (e.g. click on Logoff link) if (Page.Request["actionLogoff"] == "logoff") { // Note that Redirect ends page execution. Response.Redirect(rootURL + "logoff.aspx"); } // Put user code to initialize the page here userId = SharedSupport.GetUserIdentity(); AssignmentManager.Common.Functions fun = new AssignmentManager.Common.Functions(); CourseId = fun.ValidateNumericQueryStringParameter(Request, "CourseID"); } catch (Exception ex) { Feedback.Text = ex.Message; } }
private void btnCancel_Click(object sender, System.EventArgs e) { AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); int courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); int userId = func.ValidateNumericQueryStringParameter(this.Request, "UserID"); Response.Redirect(@"AddEditUser.aspx?UserID=" + userId + "&CourseID=" + courseId, false); }
protected void Page_Load(object sender, EventArgs e) { try { Response.Cache.SetNoStore(); Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager"); GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_left = "400px"; GoBack1.GoBack_top = "-5px"; GoBack1.GoBack_BackURL = "Assignments.aspx?" + Request.QueryString.ToString(); AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); // grab CourseID parameter from the querystring courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId <= 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } // grab assignmentID from querystring assignmentId = func.ValidateNumericQueryStringParameter(this.Request, "AssignmentID"); //Check Security Permissions if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USERASSIGNMENT_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } Nav1.Feedback.Text = String.Empty; if (!IsPostBack) { // // Evals true first time browser hits the page // //Get localization string for all text displayed on the page LocalizeLabels(); // refresh user assignments datalist userAssignmentsRefresh(); } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message; } }
protected void Page_Load(object sender, System.EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_CHANGE_PASSWORD; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_CHANGE_PASSWORD; Nav1.Title = SharedSupport.GetLocalizedString("ChangePassword_Title1"); Nav1.SubTitle = SharedSupport.GetLocalizedString("ChangePassword_SubTitle1"); Nav1.relativeURL = @"../"; //GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskChangingYourUserPassword"); GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskChangingYourUserPasswordForAssignmentManager"); GoBack1.GoBack_left = "275px"; GoBack1.GoBack_top = "-15px"; GoBack1.GoBackIncludeBack = false; if (courseId <= 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } // if using SSL and the page isn't using a secure connection, redirect to https if (SharedSupport.UsingSsl == true && Request.IsSecureConnection == false) { // Note that Redirect ends page execution. Response.Redirect("https://" + SharedSupport.BaseUrl + "/faculty/ChangePassword.aspx?CourseID=" + courseId.ToString()); } if (!IsPostBack) { // Evals true first time browser hits the page LocalizeLabels(); } Response.Cache.SetNoStore(); if (user.IsValid) { this.lblUserName.Text = Server.HtmlEncode(user.FirstName + " " + user.LastName); } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { // Do not cache this page Response.Cache.SetNoStore(); Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager"); GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_BackURL = "Submissions.aspx?" + "CourseID=" + Request.QueryString["CourseID"].ToString() + "&" + "AssignmentID=" + Request.QueryString["AssignmentID"].ToString(); // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId.Equals(null)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_MissingParameter"); } // get UserAssignmentID, AssignmentID querystring param studentID = func.ValidateNumericQueryStringParameter(this.Request, "UserID"); assignmentId = func.ValidateNumericQueryStringParameter(this.Request, "AssignmentID"); if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USERASSIGNMENT_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (studentID == 0) { //If userassignmentId missing then doesn't make sense to show page at all? throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } LocalizeLabels(); if (!Page.IsPostBack) { // load the details userAssignmentDetailRefresh(); } } catch (System.Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_SERVER_ADMIN; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_SERVER_SETTINGS; Nav1.Title = SharedSupport.GetLocalizedString("Settings_Title1"); Nav1.SubTitle = SharedSupport.GetLocalizedString("Settings_SubTitle1"); Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vsurfServerAdministrationSettings"); GoBack1.GoBackIncludeBack = false; GoBack1.GoBack_left = "400px"; GoBack1.GoBack_top = "-15px"; // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId.Equals(null)) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } //Check Security Permissions if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.SETTING_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (!IsPostBack) { // // Evals true first time browser hits the page // //Get localization string for all text displayed on the page LocalizeLabels(); initializeFields(); } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { //display nav bar Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_USERS; Nav1.Title = " "; Nav1.SubTitle = SharedSupport.GetLocalizedString("ImportForm_SubTitle"); Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAddingCourseUsers"); GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_BackURL = "Users.aspx?" + Request.QueryString.ToString(); GoBack1.GoBack_left = "400px"; GoBack1.GoBack_top = "-15px"; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId <= 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_ADD)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (!IsPostBack) { // Populate the DropDownList with the available delimiters. cboDelimitingCharacter.Items.Clear(); cboDelimitingCharacter.Items.Add(","); cboDelimitingCharacter.Items.Add(";"); cboDelimitingCharacter.Items.Add(SharedSupport.GetLocalizedString("AdminImport_Tab")); } LocalizeLabels(); } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
public void btnCancel_Click(object sender, System.EventArgs e) { try { btnCancel.Enabled = true; btnSave.Enabled = true; btnSave.Visible = true; //Delete all imported users with status of pending and userid = loggedin user Nav1.Feedback.Text = String.Empty; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); string importID = func.ValidateStringQueryStringParameter(this.Request, "ImportID"); ImportUsers.AbortImport(importID); Response.Redirect("Users.aspx?CourseID=" + Request.QueryString.Get("CourseID").ToString(), false); } catch { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AdminResults_CancelFailed"); btnCancel.Enabled = true; btnSave.Enabled = false; btnSave.Visible = false; } }
protected void Page_Load(object sender, System.EventArgs e) { try { Nav1.relativeURL = "../"; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); int vsversion = func.ValidateNumericQueryStringParameter(Request, "VSVersion"); if (vsversion < 7.1) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_WrongVSVersion", false); } //Check Security Permissions if (!IsPostBack) { if (Request["CourseID"] != null && Request["CourseID"] != String.Empty) { System.Guid courseGuid = new System.Guid(Request.QueryString.Get("CourseID").ToString()); CourseM course = CourseM.Load(courseGuid); if (course.IsValid) { Response.Redirect("Assignments.aspx?CourseID=" + course.CourseID, false); } } else { //Throw error, there was no CourseID on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_MissingParameter", false); } } } catch { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized", false); } }
protected void Page_Load(object sender, EventArgs e) { try { //display nav bar Nav1.Feedback.Text = " "; //Add non-breakable space as placeholder for Feedback label(prevents table from shifting as messages appear/disappear). Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_USERS; Nav1.Title = SharedSupport.GetLocalizedString("Results_Title"); //"User Bulk Import Results"; Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager"); GoBack1.GoBack_left = "400px"; GoBack1.GoBack_top = "15px"; GoBack1.GoBackIncludeBack = false; GoBack1.GoBack_BackURL = "ImportForm.aspx?" + Request.QueryString.ToString(); AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId == 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_ADD)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } btnCancel.Enabled = true; btnSave.Enabled = true; btnSave.Visible = true; if (!IsPostBack) { // // Evals true first time browser hits the page // LocalizeLabels(); lblNumberFailed.Text = func.ValidateNumericQueryStringParameter(this.Request, "Errors").ToString(); lblNumberSuccessful.Text = func.ValidateNumericQueryStringParameter(this.Request, "Success").ToString(); lblTotalRecords.Text = func.ValidateNumericQueryStringParameter(this.Request, "Expected").ToString(); if (Convert.ToBoolean(SharedSupport.UsingSmtp)) { lblUserInfo.Text = SharedSupport.GetLocalizedString("AdminResults_UsersInsertedEmailSent"); //"A random password was generated and sent in e-mail to the user." } else { lblUserInfo.Text = SharedSupport.GetLocalizedString("AdminResults_UsersInsertedPasswordIsName"); //"The user's password is their user name." } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); btnCancel.Enabled = true; btnSave.Enabled = false; btnSave.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions f = new AssignmentManager.Common.Functions(); int courseId = f.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } //Cleanup temporary files after project downloads. Page does not need to load. if (Request.QueryString.Get("Action").ToLower() == "cleanupdirectory") { CleanupTempDirectory(); } Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_COURSE; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; //GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAddingAssignment"); GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskSubmittingAssignmentUsingAssignmentManager"); GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_top = "24px"; //GoBack1.GoBack_left = "-10px"; switch (Request.QueryString.Get("Action").ToLower()) { case "uploadsubmission": Nav1.Title = SharedSupport.GetLocalizedString("UploadDownload_StudentUploadTitle"); break; case "downloadstarter": Nav1.Title = SharedSupport.GetLocalizedString("UploadDownload_StudentDownloadTitle"); break; default: throw new ApplicationException(SharedSupport.GetLocalizedString("UploadDownload_StudentTitleError")); } int assignmentId = f.ValidateNumericQueryStringParameter(this.Request, "AssignmentID"); if (!IsPostBack) { // // Evals true first time browser hits the page // //Give the client the upload and download locations if (SharedSupport.UsingSsl) { txtUploadLocation.Value = "https://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_UPLOAD_DIRECTORY; txtDownloadFolderLocation.Value = "https://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_DOWNLOAD_DIRECTORY; } else { txtUploadLocation.Value = "http://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_UPLOAD_DIRECTORY; txtDownloadFolderLocation.Value = "http://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_DOWNLOAD_DIRECTORY; } txtMaxUploadSize.Value = SharedSupport.GetSetting(AssignmentManager.Constants.MAX_PROJECT_SETTING).ToString(); btnDownload.Value = UploadDownload_Download_Text; lblSelectProject.Text = UploadDownload_SelectProject; lblAssignmentName.Text = UploadDownload_AssignmentName; lblUploadSubTitle.Text = SharedSupport.GetLocalizedString("UploadDownload_StudentUploadTitle"); lblUploadDescription.Text = UploadDownload_UploadDescription; lblDownloadStudentTitle.Text = UploadDownload_Download_Student_Title; lblDownloadLocationForFiles.Text = UploadDownload_Location_For_Download_Files_Text; if (!assignmentId.Equals(0)) { AssignmentM assign = AssignmentM.Load(assignmentId); if (assign.IsValid) { txtAssignmentName.Enabled = false; txtAssignmentName.Text = assign.ShortName; } } txtNewGUID.Value = System.Guid.NewGuid().ToString(); txtCancel.Value = "0"; txtDirSize.Value = SharedSupport.GetSetting(Constants.MAX_PROJECT_SETTING); //Download assignment starter project if (Request.QueryString.Get("Action").ToLower() == "downloadstarter") { //Check to make sure that you got an AssignmentID and a CourseID if (!courseId.Equals(null) && !assignmentId.Equals(null)) { //Call browse starter to get all files to appropriate location AssignmentM assign = AssignmentM.Load(assignmentId); if (assign.IsValid) { if (assign.AssignmentURL.Trim() != String.Empty) { UploadDownload_DownloadRedirectUrl = Server.HtmlEncode(assign.AssignmentURL); } else { UploadDownload_DownloadRedirectUrl = "AssignmentGrade.aspx?AssignmentID=" + assignmentId.ToString() + "&CourseID=" + courseId.ToString() + "&Exp=1"; } System.Guid guid = System.Guid.NewGuid(); txtSolutionName.Value = assign.ShortName; txtDownloadFilesXML.Value = assign.StarterFilesXML(guid); txtNewGUID.Value = guid.ToString(); } else { throw new ApplicationException(SharedSupport.GetLocalizedString("UploadDownload_AssignmentError")); } } else { throw new ApplicationException(SharedSupport.GetLocalizedString("UploadDownload_AssignmentIDCourseIDError")); } } } else { //If this is coming back from the client see what the action //is on the query string and perform accordingly //make sure that the we or the user didn't cancel the upload if (txtCancel.Value != "1") { //Student Submitting an assignment if (Request.QueryString.Get("Action").ToLower() == "uploadsubmission") { StudentAssignmentM sa = new StudentAssignmentM(); string xmlFiles = txtFilesUploadedXML.Value.ToString(); string pathGUID = txtNewGUID.Value.ToString(); sa.Submit(assignmentId, courseId, xmlFiles, pathGUID); Response.Redirect("Assignments.aspx?" + Request.QueryString.ToString(), false); } //Cleanup temporary files after project downloads. if (Request.QueryString.Get("Action").ToLower() == "cleanupdirectory") { // Grab the querystring parameters. string tempGUID = Request.QueryString.Get("GUID"); bool addQuerystring = Convert.ToBoolean(Request.QueryString.Get("AddQS")); string targetUrl = Request.QueryString.Get("TargetURL"); // Test whether the GUID that identifies the directory to be deleted exists. if (tempGUID == "" || tempGUID == string.Empty) { // The GUID is missing, try and continue the redirect without deleting the directory. } else { // Delete the temporary download directory from the AMWeb virtual directory. string downloadRoot = Request.MapPath(Request.ApplicationPath.ToString()); //string downloadRoot = Request.MapPath(Constants.ASSIGNMENTMANAGER_DOWNLOAD_DIRECTORY); DeleteTempDirectory(tempGUID); } if (addQuerystring == true) { // Remove the QueryString parameters used for this action then pass the leftovers on the redirect. string tempQuerystring = Request.Url.Query.ToString(); tempQuerystring = tempQuerystring.Substring(0, tempQuerystring.IndexOf("&GUID")); Response.Redirect(targetUrl + tempQuerystring); } else { Response.Redirect(targetUrl); } } } else { //reset the cancel flag so the user can fix the problem and resubmit txtCancel.Value = "0"; } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } // Do not cache this page Response.Cache.SetNoStore(); Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_COURSE; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; //GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskCheckingAssignmentStatus"); GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskUsingAssignmentManagerToCheckAssignmentStatus"); GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_BackURL = "Assignments.aspx?" + Request.QueryString.ToString(); GoBack1.GoBack_left = "-105px"; if (Request.QueryString.Get("Exp") == "1") { txtDescription.CssClass = "infoTextDisabled"; } else { txtDescription.CssClass = "invisible"; } if (courseId > 0) { //returns the course name to be displayed in the Nav bar title CourseM course = CourseM.Load(courseId); Nav1.Title = Server.HtmlEncode(course.Name); } else { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Global_MissingParameter"); } // grab assignmentId from querystring assignmentId = func.ValidateNumericQueryStringParameter(this.Request, "assignmentId"); if (!IsPostBack) { // // Evals true first time browser hits the page // } int userID = SharedSupport.GetUserIdentity(); LocalizeLabels(); //checks that assignmentId is not empty then loops through if (assignmentId.Equals(null)) { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("GradeDetail_InvalidassignmentIdError"); } else { AssignmentM assign = AssignmentM.Load(assignmentId); if (assign.IsValid) { txtDescription.Text = assign.Description; lblAssignment.Text = Server.HtmlEncode(assign.ShortName); lblDueDateValue.Text = assign.DueDate.ToShortDateString(); hlAssignmentWebPage.NavigateUrl = assign.AssignmentURL; hlAssignmentWebPage.Text = Server.HtmlEncode(assign.AssignmentURL); } StudentAssignmentM stuAssign = StudentAssignmentM.Load(userID, assignmentId); if (stuAssign == null) { this.lblAssignment.Text = SharedSupport.GetLocalizedString("GradeDetail_NoDetailsAvailable"); } else { //if data is returned, regardless of the Detail Type the LocalizeGeneralLabels //generates text for the header labels. LocalizeGeneralLabels(stuAssign); LocalizeAutoBuildLabels(stuAssign); LocalizeAutoGradeLabels(stuAssign); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { // Do not cache this page Response.Cache.SetNoStore(); AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); // Look for UserId parameter in the query string. userId = func.ValidateNumericQueryStringParameter(this.Request, "UserID"); if (userId == -1 || userId == SharedSupport.GetUserIdentity()) { //Editing self Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_SERVER_ADMIN; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_SERVER_MYACCOUNT; Nav1.Title = " "; Nav1.SubTitle = SharedSupport.GetLocalizedString("MyAccountEdit_SubTitle"); Nav1.relativeURL = @"../"; lblUserDetails.Visible = false; lblDescription.Visible = false; lblPasswordText.Visible = false; lblFindInstructions.Visible = false; btnFind.Enabled = false; btnFind.Visible = false; } else { Nav1.Feedback.Text = " "; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_USERS; Nav1.relativeURL = @"../"; } GoBack1.GoBack_left = "400px"; GoBack1.GoBack_top = "-2px"; if (userId == 0) { // Set help link to AddUser help topic. GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAddingCourseUsers"); } else if (userId == -1) { userId = SharedSupport.GetUserIdentity(); GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAccessingYourAccount"); } else { // Set help link to EditUser help topic. GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAccessingYourAccount"); } GoBack1.GoBackIncludeBack = true; if (Request.UrlReferrer != null && Request.UrlReferrer.ToString() != "") { if (Request.UrlReferrer.ToString().IndexOf("UserRoles") > 0) { GoBack1.GoBack_BackURL = "Users.aspx?" + Request.QueryString.ToString(); } else { GoBack1.GoBack_BackURL = Request.UrlReferrer.ToString(); } } else { GoBack1.GoBack_BackURL = "Users.aspx?" + Request.QueryString.ToString(); } // grab CourseID parameter from the querystring courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (userId == 0) { if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_ADD)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } } else { if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_EDIT)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } } //Check Security to see if we should disable roles if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.SECURITY_EDIT)) { UserRolesList.Enabled = false; } //Check Security to see if we should hide roles if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.SECURITY_VIEW)) { lblUserRoles.Visible = false; UserRolesList.Visible = false; } showLinks(); if (!IsPostBack) { // // Evals true first time browser hits the page // LocalizeLabels(); SetupRoleButtons(); btnUpdate.Visible = true; Nav1.Feedback.Text = String.Empty; // was userId passed in on querystring? if (userId != 0) { this.lblDescription.Visible = false; this.lblPasswordText.Visible = false; //Load existing User UserM user = UserM.Load(userId); if (user.IsValid) { // is user a member of the course? change button to 'add' if not if (user.IsInCourse(courseId)) { //User is already added to the course, so show delete button this.btnDelete.Visible = true; btnUpdate.Text = SharedSupport.GetLocalizedString("AddEditUser_Update"); } else { btnUpdate.Text = SharedSupport.GetLocalizedString("AddEditUser_Insert"); } populateFields(user); this.lblUserDetails.Text = SharedSupport.GetLocalizedString("AddEditUser_UserDetails"); } else { clearFields(); } } else { // Insert //Prep for inserting a new user btnUpdate.Text = SharedSupport.GetLocalizedString("AddEditUser_Insert"); this.lblUserDetails.Text = SharedSupport.GetLocalizedString("AddEditUser_AddLookUpUsers"); } } else { if (txtAction.Value == "DeleteUser") { if (SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_EDIT)) { UserM.RemoveFromCourse(userId, courseId); Response.Redirect("Users.aspx?UserID=" + userId.ToString() + "&" + Request.QueryString.ToString(), false); } else { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Global_Unauthorized"); } } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); btnUpdate.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { try { // Do not cache this page Response.Cache.SetNoStore(); Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_USERS; Nav1.SubTitle = subTitle; Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAddingCourseUsers"); GoBack1.GoBackIncludeBack = false; GoBack1.GoBack_top = "-5px"; GoBack1.GoBack_left = "10px"; // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId <= 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } //Check Security Permissions if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (!IsPostBack) { // // Evals true first time browser hits the page // LocalizeLabels(); this.hlAddUser.Text = SharedSupport.GetLocalizedString("FacultyUsers_AddUser"); //"Add User"; this.hlImportUsers.Text = SharedSupport.GetLocalizedString("AddEditUser_ImportUsers"); //bulk import users this.hlAddUser.NavigateUrl = "AddEditUser.aspx?CourseID=" + courseId.ToString(); this.hlImportUsers.NavigateUrl = "ImportForm.aspx?CourseID=" + courseId.ToString(); UserList userlist = UserList.GetListFromCourse(courseId); DataView dv = userlist.GetDataView(Server); if (dv != null) { dlUsers.DataSource = dv; dlUsers.DataBind(); dlUsers.Visible = true; } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { // set the baseUrl variable baseUrl = AssignmentManager.SharedSupport.BaseUrl.ToString(); // set logoff link dynamically based on if server is using SSL if (Convert.ToBoolean(SharedSupport.UsingSsl) == true) { rootURL = "https://" + baseUrl + @"/"; } else { rootURL = "http://" + baseUrl + @"/"; } // logs user off if actionLogoff hidden input tag = "logoff" (e.g. click on Logoff link) if (Page.Request["actionLogoff"] == "logoff") { // Note that Redirect ends page execution. Response.Redirect(rootURL + "Logoff.aspx"); } // Put user code to initialize the page here userId = SharedSupport.GetUserIdentity(); //Verify that CourseID is present AssignmentManager.Common.Functions fun = new AssignmentManager.Common.Functions(); CourseId = fun.ValidateNumericQueryStringParameter(Request, "CourseID"); //If the title is not already set, set it to the course if (Title == String.Empty || Title == "") { CourseM course = CourseM.Load(CourseId); if (course.IsValid) { Title = course.Name.Trim(); if (Title.Length > 30) { lblTitle.Text = Title = Title.Substring(0, 30) + UserControl_Faculty_DotDotDot; } lblTitle.Text = Server.HtmlEncode(Title); } } else { this.lblTitle.Text = Server.HtmlEncode(this.Title); } //If the subtitle is not already set, set it to the course if (SubTitle == String.Empty || SubTitle == "") { CourseM course = CourseM.Load(CourseId); if (course.IsValid) { this.lblSubTitle.Text = Server.HtmlEncode(SharedSupport.GetLocalizedString("NavBar_SubTitle1") + course.Name); } } else { this.lblSubTitle.Text = Server.HtmlEncode(this.SubTitle); } } catch (Exception ex) { Feedback.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { try { Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; GoBack1.GoBack_left = "575px"; GoBack1.GoBack_top = "-5px"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager"); GoBack1.GoBackIncludeBack = false; // grab CourseID parameter AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.ASSIGNMENT_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.ASSIGNMENT_ADD)) { hlAddAssignment.Enabled = false; hlAddAssignment.Visible = false; } else { hlAddAssignment.Enabled = true; hlAddAssignment.Visible = true; } // get the courseId based on courseOfferingId CourseM course = CourseM.Load(courseId); if (course.IsValid) { Nav1.SubTitle = SharedSupport.GetLocalizedString("Assignments_Subtitle") + " " + course.Name; } if (!IsPostBack) { // // Evals true first time browser hits the page // //Get localization string for all text displayed on the page LocalizeLabels(); //Initialize the feedback label to nothing. Nav1.Feedback.Text = String.Empty; //Populate the "Add Assignment" link with the courseID from the query string hlAddAssignment.NavigateUrl += "?CourseID=" + course.CourseID; //Grab the assignment information for the given CourseOffering AssignmentList assignList = course.AssignmentList; //If there was at least one assignment, build the table. if (assignList.Count > 0) { dlAssignments.DataSource = assignList.GetDefaultView(Server); dlAssignments.DataBind(); dlAssignments.Visible = true; } else { //The assignment for the given SectionID did not exist. this.hlAddAssignment.Visible = true; throw new Exception(INVALID_SECTION_ID_ERROR); } } } catch (Exception ex) { //catch and add all exception errors to the lblFeedback label and display. Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); // grab CourseID parameter from the querystring int UserID = func.ValidateNumericQueryStringParameter(this.Request, "UserID"); if (UserID == SharedSupport.GetUserIdentity()) { Nav1.Feedback.Text = String.Empty; Nav1.relativeURL = @"../"; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_SERVER_ADMIN; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_SERVER_MYACCOUNT; Nav1.Title = SharedSupport.GetLocalizedString("MyAccountChangePassword_Title"); Nav1.SubTitle = SharedSupport.GetLocalizedString("MyAccountChangePassword_SubTitle"); } else { Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_USERS; Nav1.relativeURL = @"../"; Nav1.Title = " "; Nav1.SubTitle = SharedSupport.GetLocalizedString("ChangePassword_SubTitle2"); } GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAccessingYourAccount"); GoBack1.GoBack_BackURL = "AddEditUser.aspx?" + Request.QueryString.ToString(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId <= 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_EDIT)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } // if using SSL and the page isn't using a secure connection, redirect to https if (SharedSupport.UsingSsl == true && Request.IsSecureConnection == false) { // Note that Redirect ends page execution. Response.Redirect("https://" + SharedSupport.BaseUrl + "/faculty/ChangePassword.aspx?CourseID=" + courseId.ToString()); } //get Course Short Name to display as title of page CourseM course = CourseM.Load(courseId); if (course.IsValid) { Nav1.Title = course.Name; } if (!IsPostBack) { // Evals true first time browser hits the page LocalizeLabels(); } Response.Cache.SetNoStore(); if (!UserID.Equals(null)) { UserM user = UserM.Load(UserID); if (user.IsValid) { this.lblUserName.Text = Server.HtmlEncode(user.FirstName + " " + user.LastName); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message; } }
protected void Page_Load(object sender, System.EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } //display nav bar Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_COURSE; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_COURSE_INFO; Nav1.relativeURL = @"../"; GoBack1.GoBack_left = "450px"; GoBack1.GoBack_top = "5px"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskViewingCourseInformationWithAssignmentManager"); GoBack1.GoBackIncludeBack = false; if (courseId.Equals(null)) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } CourseM course = CourseM.Load(courseId); if (course.IsValid) { Nav1.SubTitle = SharedSupport.GetLocalizedString("Assignments_Subtitle") + " " + Server.HtmlEncode(course.Name); } if (!IsPostBack) { // // Evals true first time browser hits the page // LocalizeLabels(); if (course.IsValid) { this.txtDescriptionText.Text = course.Description; this.lblShortNameValue.Text = Server.HtmlEncode(course.Name); if (course.HomepageURL.Trim() != "") { this.linkHomePageURLText.Text = Server.HtmlEncode(course.HomepageURL); this.linkHomePageURLText.NavigateUrl = course.HomepageURL; } else { this.lblHomePageURL.Text = ""; } string title = course.Name.Trim(); if (title.Length > 45) { title = title.Substring(0, 45) + SharedSupport.GetLocalizedString("UserControl_Faculty_DotDotDot"); } Nav1.Title = Server.HtmlEncode(title); CourseResources(course); } else { // throw error - can't use this page without CourseID int passed in Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AddEditCourse_MissingCourseID"); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { // grab CourseID parameter from the querystring AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); UserM user = UserM.Load(SharedSupport.GetUserIdentity()); if (!user.IsInCourse(courseId)) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_COURSE; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_STUDENT_COURSE_ASSIGNMENTS; Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskCheckingAssignmentStatus"); GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("tskUsingAssignmentManagerToCheckAssignmentStatus"); GoBack1.GoBack_top = "-5px"; GoBack1.GoBack_left = "60px"; GoBack1.GoBackIncludeBack = false; if (courseId <= 0) { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Global_MissingParameter"); } CourseM course = CourseM.Load(courseId); string title = course.Name.Trim(); if (title.Length > 45) { title = title.Substring(0, 45) + SharedSupport.GetLocalizedString("UserControl_Faculty_DotDotDot"); } Nav1.Title = Server.HtmlEncode(title); if (course.IsValid) { Nav1.SubTitle = Server.HtmlEncode(SharedSupport.GetLocalizedString("Assignments_Subtitle") + " " + course.Name); } if (!IsPostBack) { // Evals true first time browser hits the page } Response.Cache.SetNoStore(); int userID = SharedSupport.GetUserIdentity(); //throws an error if either the courseID or userID are empty if (courseId.Equals(null) || userID.Equals(null)) { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Assignments_CourseIDError"); } else { try { //calls a function to return all the assignments for the course BrowseAssignments(course); } catch (System.Exception ex) { Nav1.Feedback.Text = ex.Message; } } localizeLabels(); } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { try { //display nav bar Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_USERS; Nav1.Title = SharedSupport.GetLocalizedString("AdminImport_Title"); Nav1.SubTitle = SharedSupport.GetLocalizedString("ImportForm_SubTitle"); Nav1.relativeURL = @"../"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskAddingCourseUsers"); GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_left = "400px"; GoBack1.GoBack_top = "-15px"; GoBack1.GoBack_BackURL = "ImportForm.aspx?CourseID=" + Request.QueryString.Get("CourseID"); AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (courseId <= 0) { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_ADD)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (!IsPostBack) { //clear combos cboEmailAddress.Items.Clear(); cboFirstName.Items.Clear(); cboLastName.Items.Clear(); cboMiddleName.Items.Clear(); cboUniversityID.Items.Clear(); cboUserName.Items.Clear(); } //Localize all items localizeLabels(); //grab items off of the querystring - DECODE them uploadedFilePath = SharedSupport.AddBackSlashToDirectory(Server.MapPath(Constants.ASSIGNMENTMANAGER_UPLOAD_DIRECTORY)) + Server.UrlDecode(Request.QueryString.Get("File")); delimitingCharacter = Server.UrlDecode(Request.QueryString.Get("Char")); //Create an instance of the dataset System.Data.DataSet ds = new System.Data.DataSet(); //populate the combo boxes with items from the delimited file if (delimitingCharacter != "" && delimitingCharacter.Length < 2) { //Parse first line of file into dataset using delimiting character specified. ds = SharedSupport.ParseDelimitedFile(uploadedFilePath, delimitingCharacter, 1); //throw new System.IO.FileNotFoundException(SharedSupport.GetLocalizedString("User_UploadFileNotFound")); } else { throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter"))); } System.Data.DataSet dsNew = new System.Data.DataSet(); System.Data.DataTable dtNew = dsNew.Tables.Add(); dtNew.Columns.Add(); for (int i = 0; i < ds.Tables[0].Columns.Count; i++) { System.Data.DataRow drNew = dtNew.NewRow(); drNew[0] = ds.Tables[0].Rows[0][i].ToString(); dtNew.Rows.Add(drNew); } //populate combos if (!Page.IsPostBack) { for (int i = 0; i < dsNew.Tables[0].Rows.Count; i++) { int dropdownIndex = i + 1; ListItem newListItem = new ListItem(dsNew.Tables[0].Rows[i][0].ToString(), dropdownIndex.ToString()); cboEmailAddress.Items.Add(newListItem); cboFirstName.Items.Add(newListItem); cboLastName.Items.Add(newListItem); cboMiddleName.Items.Add(newListItem); cboUniversityID.Items.Add(newListItem); cboUserName.Items.Add(newListItem); } } txtImportedFileLocation.Text = uploadedFilePath; } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_INFO; Nav1.SubTitle = " "; Nav1.Title = " "; Nav1.relativeURL = @"../"; PermissionsID maxUserPermission; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); if (!SharedSupport.SecurityIsAllowed(SecurityAction.COURSE_ADD, out maxUserPermission)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } int vsversion = func.ValidateNumericQueryStringParameter(Request, "VSVersion"); if (vsversion < 7.1) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_WrongVSVersion", false); } if (!IsPostBack) { // // Evals true first time browser hits the page // if (Request["CourseID"] != null && Request["CourseID"] != String.Empty) { if (Request["CourseName"] != null && Request["CourseName"] != String.Empty) { // Load by GUID string CourseID = Request.QueryString.Get("CourseID").ToString(); courseGuid = new System.Guid(CourseID); txtCourseGUID.Value = courseGuid.ToString(); CourseM course = CourseM.Load(courseGuid); if (course.IsValid) { // course already exists courseExists(course); return; } else { // check the short name for uniqueness string courseShortName = Request.QueryString.Get("CourseName").ToString().Trim(); if (courseShortName == null || courseShortName == String.Empty) { Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_MissingCourseShortName", false); return; } else { course = CourseM.Load(courseShortName); if (course.IsValid) { // course short name already exists; prompt: work with? copy? courseExists(course); return; } } // insert bare min. course information course = new CourseM(); course.Name = courseShortName; course.CourseGuid = courseGuid; course.SendEmailRemindersFlag = false; course.LastUpdatedUserID = SharedSupport.GetUserIdentity(); course.StartDate = DateTime.Now.AddMonths(1); course.EndDate = DateTime.Now.AddMonths(1); string fileDir = SharedSupport.RemoveIllegalFilePathCharacters(course.Name).Replace(" ", String.Empty); fileDir = SharedSupport.AddBackSlashToDirectory(Constants.DEFAULT_COURSE_OFFERINGS_ROOT_STORAGE_PATH) + SharedSupport.AddBackSlashToDirectory(fileDir); if (!System.IO.Directory.Exists(fileDir)) { //create directory System.IO.Directory.CreateDirectory(fileDir); } course.RootStoragePath = SharedSupport.AddBackSlashToDirectory(Constants.DEFAULT_COURSE_OFFERINGS_ROOT_STORAGE_PATH) + SharedSupport.AddBackSlashToDirectory(SharedSupport.RemoveIllegalFilePathCharacters(course.Name).Replace(" ", String.Empty)); course.Add(); if (!Directory.Exists(course.RootStoragePath)) { Directory.CreateDirectory(course.RootStoragePath); } UserM user = UserM.Load(SharedSupport.GetUserIdentity()); user.AddToCourse(course.CourseID, maxUserPermission); // redirect for additional maintenance Response.Redirect("AddEditCourse.aspx?CourseID=" + course.CourseID, false); } } else { //Throw error, there was no ShortName on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_MissingCourseShortName", false); } } else { //Throw error, there was no CourseID on the query string Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddCourse_MissingCourseID", false); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
private void btnSave_Click(object sender, System.EventArgs e) { try { AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); if (this.txtConfirmPwd.Text == "") { throw new Exception(SharedSupport.GetLocalizedString("ChangePassword_ConfirmPassword_RequiredField")); } else if (this.txtNewPwd.Text == "") { throw new Exception(SharedSupport.GetLocalizedString("ChangePassword_NewPassword_RequiredField")); } else if ((this.txtNewPwd.Text.Trim().Length < 4) || (this.txtNewPwd.Text.Trim().Length > 50)) { throw new Exception(SharedSupport.GetLocalizedString("ChangePassword_PwdLengthError")); } if (this.txtNewPwd.Text != this.txtConfirmPwd.Text) { this.txtNewPwd.Text = ""; this.txtConfirmPwd.Text = ""; throw new Exception(SharedSupport.GetLocalizedString("ChangePassword_ConfirmationError")); } int UserID = func.ValidateNumericQueryStringParameter(this.Request, "UserID"); int courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (UserID != 0) { int currentUserID = SharedSupport.GetUserIdentity(); if (currentUserID == 0) { throw new Exception(SharedSupport.GetLocalizedString("Global_Unauthorized")); } if (currentUserID == UserID) { // you are always allowed to change your own password. setNewPassword(currentUserID); } else { if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USER_EDIT)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } try { RoleM currentUsersRole = RoleM.GetUsersRoleInCourse(currentUserID, courseId); RoleM targetUsersRole = RoleM.GetUsersRoleInCourse(UserID, courseId); //Lower ID = more permissions if (currentUsersRole.ID <= targetUsersRole.ID) { setNewPassword(UserID); } else { throw new Exception(); } } catch (Exception) { throw new Exception(SharedSupport.GetLocalizedString("Global_Unauthorized")); } } Response.Redirect(@"AddEditUser.aspx?UserID=" + UserID + "&CourseID=" + courseId); } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { try { AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); int courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.ASSIGNMENT_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } //Cleanup temporary files after project downloads. Page does not need to load. if (Request.QueryString.Get("Action").ToLower() == "cleanupdirectory") { CleanupTempDirectory(); } Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_ASSIGNMENTS; if (Request.QueryString.Get("Action").ToLower() == "uploadstarter") { Nav1.Title = SharedSupport.GetLocalizedString("UploadDownload_Upload_Starter_Title");//"Upload Starter"; } if (Request.QueryString.Get("Action").ToLower() == "downloadsubmission") { Nav1.Title = SharedSupport.GetLocalizedString("UploadDownload_Download_Faculty_Title");//"Download Student Submission"; } Nav1.relativeURL = @"../"; if (Request.QueryString.Get("Action").ToLower() == "uploadstarter") { GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskUpdatingStarterProject"); } else { GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager"); } GoBack1.GoBackIncludeBack = true; GoBack1.GoBack_left = "295px"; GoBack1.GoBack_top = "22px"; if (Request.UrlReferrer.ToString() != "") { GoBack1.GoBack_BackURL = Request.UrlReferrer.ToString(); } else { GoBack1.GoBack_BackURL = "Assignments.aspx?" + Request.QueryString.ToString(); } //Give the client the upload and download locations if (SharedSupport.UsingSsl) { txtUploadLocation.Value = "https://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_UPLOAD_DIRECTORY; txtDownloadFolderLocation.Value = "https://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_DOWNLOAD_DIRECTORY; } else { txtUploadLocation.Value = "http://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_UPLOAD_DIRECTORY; txtDownloadFolderLocation.Value = "http://" + Request.ServerVariables.Get("HTTP_HOST") + Constants.ASSIGNMENTMANAGER_DOWNLOAD_DIRECTORY; } txtMaxUploadSize.Value = SharedSupport.GetSetting(AssignmentManager.Constants.MAX_PROJECT_SETTING).ToString(); btnDownload.Value = UploadDownload_Download_Text; string dir = SharedSupport.AddBackSlashToDirectory(System.Web.HttpContext.Current.Request.MapPath(String.Empty, Constants.ASSIGNMENTMANAGER_DOWNLOAD_DIRECTORY, true)); if (Directory.Exists(dir)) { txtDirSize.Value = SharedSupport.GetSetting(AssignmentManager.Constants.MAX_PROJECT_SETTING).ToString(); } int studentID = func.ValidateNumericQueryStringParameter(this.Request, "StudentID"); int assignmentId = func.ValidateNumericQueryStringParameter(this.Request, "AssignmentID"); if (!IsPostBack) { // // Evals true first time browser hits the page // if (Request.QueryString.Get("Action").ToLower() == "uploadstarter") { chkRemoveStudentCode.Visible = true; lblRemoveCode.Visible = true; } else { chkRemoveStudentCode.Visible = false; lblRemoveCode.Visible = false; } txtExistingStarterProject.Value = ""; lblRemoveCode.Text = UploadDownload_RemoveCode_Text; lblSelectProject.Text = UploadDownload_SelectProject; lblAssignmentName.Text = UploadDownload_AssignmentName; lblUploadSubTitle.Text = UploadDownload_UploadSubTitle; lblUploadDescription.Text = UploadDownload_UploadDescription; lblDownloadFacultyTitle.Text = UploadDownload_Download_Faculty_Title; lblDownloadLocationForFiles.Text = UploadDownload_Location_For_Download_Files_Text; lblStudentName.Text = UploadDownload_StudentName; lblAssignmentNameDownload.Text = UploadDownload_AssignmentName; if (!assignmentId.Equals(0)) { AssignmentM assign = AssignmentM.Load(assignmentId); if (assign.IsValid) { if (assign.StarterProjectFlag) { txtExistingStarterProject.Value = "1"; } txtAssignmentName.ReadOnly = true; txtAssignmentName.Enabled = false; txtAssignmentName.Text = assign.ShortName; } } //Download of student Submission if (Request.QueryString.Get("Action").ToLower() == "downloadsubmission") { AssignmentM assignment = AssignmentM.Load(assignmentId); if (assignment.IsValid) { if (assignment.StarterProjectFlag) { txtExistingStarterProject.Value = "1"; } txtAssignmentName.ReadOnly = true; txtAssignmentName.Enabled = false; txtAssignmentName.Text = assignment.ShortName; txtAssignmentNameDownload.ReadOnly = true; txtAssignmentNameDownload.Enabled = false; txtAssignmentNameDownload.Text = assignment.ShortName; } UserM user = UserM.Load(studentID); if (user.IsValid) { txtStudentName.ReadOnly = true; txtStudentName.Text = Server.HtmlEncode(user.LastName.Trim() + SharedSupport.GetLocalizedString("UploadDownload_comma") + " " + user.FirstName.Trim() + " " + user.MiddleName.Trim()); } txtSolutionName.Value = SharedSupport.AddBackSlashToDirectory(assignment.ShortName); System.Guid guid = System.Guid.NewGuid(); StudentAssignmentM studentAssign = StudentAssignmentM.Load(studentID, assignmentId); txtDownloadFilesXML.Value = studentAssign.AssignmentFilesXML(guid.ToString(), assignment); txtNewGUID.Value = guid.ToString(); } else { txtNewGUID.Value = System.Guid.NewGuid().ToString(); } } else { //If this is coming back from the client see what the action //is on the query string and perform accordingly //Faculty Submitting Starter Project if (Request.QueryString.Get("Action").ToLower() == "uploadstarter") { string xmlFileList = txtFilesUploadedXML.Value.ToString(); AssignmentM assign = AssignmentM.Load(assignmentId); assign.SubmitStarter(xmlFileList, txtNewGUID.Value.ToString()); Response.Redirect("Assignments.aspx?CourseID=" + Request.QueryString.Get("CourseID"), false); } } } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { //display nav bar Nav1.Feedback.Text = String.Empty; Nav1.SideTabId = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT; Nav1.TopTabId = AssignmentManager.Common.constants.TOP_NAV_COURSE_INFO; Nav1.relativeURL = @"../"; GoBack1.GoBack_left = "325px"; GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskModifyingCourseInformation"); GoBack1.GoBackIncludeBack = false; Nav1.Feedback.Text = String.Empty; AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions(); // grab CourseID parameter from the querystring courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID"); if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.COURSE_VIEW)) { // Note that Redirect ends page execution. Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized"); } if (Request.QueryString.Get("Action") == "Update") { Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AddEditCourse_UpdateSuccessful"); //"This course has been updated successfully."; } CourseM course = CourseM.Load(courseId); if (!IsPostBack) { // // Evals true first time browser hits the page // LocalizeLabels(); if (course.IsValid) { populateControls(course); } else { // throw error - can't use this page without CourseID int passed in // Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AddEditCourse_MissingCourseID"); Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddEditCourse_MissingCourseID&" + Request.QueryString.ToString(), false); } } else { //Check the value of txtCourseResourceID. if (txtCourseResourceID.Value != "" && this.txtDelete.Text == "1") { course.DeleteResource(Convert.ToInt32(txtCourseResourceID.Value)); refreshGrid(course.ResourceList); } //Take care of Course Resource Additions from the "pop-up" form. if (this.txtResourceName.Text != String.Empty && this.txtResourceValue.Text != String.Empty) { string name = txtResourceName.Text; string resourceValue = txtResourceValue.Text; course.AddResource(name, resourceValue); txtResourceName.Text = String.Empty; txtResourceValue.Text = String.Empty; } } //Populate div tag with resources refreshGrid(course.ResourceList); } catch (Exception ex) { Nav1.Feedback.Text = ex.Message.ToString(); } }