Esempio n. 1
0
        /// <summary>
        /// Create a auto result.
        /// </summary>
        public bool CreateAuto(int evalID, string grader, int subID, string result)
        {
            //Check permission
            Submissions subac = new Submissions(m_ident);
            Components.Submission sub = subac.GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "createauto", asst.ID, null);

            AutoResult res = new AutoResult();
            res.EvalID = evalID; res.Grader = grader;
            res.SubmissionID = subID; res.XmlResult = result;

            //Clear out all results for this evaluation
            Submission.SubmissionList subs =
                new Principals(m_ident).GetSubmissions(sub.PrincipalID, sub.AsstID);

            //Delete all old results
            foreach (Submission s in subs) {
                Result.ResultList ress = subac.GetResults(s.ID);
                foreach (Result r in ress) {
                    if (r.Type == Result.AUTO_TYPE) {
                        AutoResult ar = r as AutoResult;
                        if (ar.EvalID == evalID)
                            Delete(ar.ID);
                    }
                }
            }

            return m_dp.CreateAutoResult(res);
        }
Esempio n. 2
0
        private void dgTests_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            Label lblSub, lblEval, lblQueue;
            System.Web.UI.WebControls.Image imgStatus;
            if (null != (lblSub = (Label) e.Item.FindControl("lblSub"))) {
                lblEval = (Label) e.Item.FindControl("lblEval");
                lblQueue = (Label) e.Item.FindControl("lblQueue");
                imgStatus = (System.Web.UI.WebControls.Image) e.Item.FindControl("imgStatus");

                AutoJobTest test = (AutoJobTest) e.Item.DataItem;
                lblEval.Text = test.AutoEval.Name;

                Components.Submission sub =
                    new Submissions(Globals.CurrentIdentity).GetInfo(test.SubmissionID);
                lblSub.Text = new FileSystem(Globals.CurrentIdentity).GetFile(sub.LocationID).Alias;

                if (test.Status == AutoJobTest.DONE)
                    imgStatus.ImageUrl = "../../attributes/subgrade.gif";
                else
                    imgStatus.ImageUrl = "../../attributes/sub.gif";

                AutoJobs autojobda = new AutoJobs(Globals.CurrentIdentity);
                lblQueue.Text = String.Format("{0} out of {1}",
                    autojobda.GetQueuePosition(test), autojobda.GetAllTests().Count);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Create a test for a job
        /// </summary>
        public bool CreateTest(int jobID, int subID, int evalID, bool onsubmit)
        {
            Components.Submission sub = new Submissions(m_ident).GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Evaluation eval = new Evaluations(m_ident).GetInfo(evalID);
            //		Authorize(asst.CourseID, "createjob", asst.ID, null);

            //Log that the student is being auto run
            new Activities(m_ident).Create(m_ident.Name, Activity.SUBMISSION, subID,
                "Started auto-evaluation: " + eval.Name);

            return m_dp.CreateAutoJobTest(jobID, evalID, subID, onsubmit);
        }
Esempio n. 4
0
        /// <summary>
        /// Delete a group ID
        /// </summary>
        public bool Delete(int groupID, int asstID)
        {
            //Get subs
            Submissions subda = new Submissions(m_ident);
            Components.Submission.SubmissionList subs =
                new Principals(m_ident).GetSubmissions(groupID, asstID);

            //Take the subs
            foreach (Components.Submission sub in subs)
                subda.Delete(sub.ID);

            //Take the group
            return m_dp.DeleteGroup(groupID);
        }
Esempio n. 5
0
        /// <summary>
        /// Create a subjective result
        /// </summary>
        public bool CreateSubj(int subID, int rubricID, string comment, int fileid, int line, 
            double points, ArrayList lines, int type)
        {
            //Check permission
            Components.Submission sub =
                new Submissions(m_ident).GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "createsubj", asst.ID, null);

            SubjResult res = new SubjResult();
            res.SubjType = type; res.RubricID = rubricID;
            res.Comment = comment; res.FileID = fileid; res.Line = line;
            res.Grader = m_ident.Name; res.SubmissionID = subID;
            res.Points = points;

            //Create result
            m_dp.CreateSubjResult(res);

            //Attach lines
            foreach (int l in lines)
                m_dp.CreateSubjLineAffect(res.ID, l);

            return true;
        }
Esempio n. 6
0
        private void BindFileLink()
        {
            Components.Submission sub = new Submissions(Globals.CurrentIdentity).GetInfo(GetSubID());
            if (sub == null) return;

            string roots = sub.LocationID.ToString();
            lnkFiles.Attributes.Clear();
            if (!IsStudent())
                lnkFiles.Attributes.Add("onClick",
                    @"window.open('filebrowser.aspx?SubID=" + GetSubID()+"&Roots=" + roots +
                    @"', '"+8+@"', 'width=730, height=630')");
            else
                lnkFiles.Attributes.Add("onClick",
                    @"window.open('filebrowser.aspx?Roots=" + roots +
                    @"', '"+8+@"', 'width=730, height=630')");
        }
Esempio n. 7
0
        private void BindData()
        {
            Components.Submission sub =
                new Submissions(Globals.CurrentIdentity).GetInfo(GetSubID());

            //Set up top controls
            if (!IsStudent()) {
                lnkComplete.Visible = true;
                imgComplete.Visible = true;
                lblMarkInst.Visible = true;
                lnkDefunct.Visible = true;
                imgDefunct.Visible = true;
                if (sub.Status == Components.Submission.GRADED) {
                    lnkComplete.Text = "Mark as Incomplete";
                    imgComplete.ImageUrl = "../../attributes/sub.gif";
                } else {
                    lnkComplete.Text = "Mark as Completed";
                    imgComplete.ImageUrl = "../../attributes/subgrade.gif";
                }

                if (sub.Status == Components.Submission.DEFUNCT)
                    lnkDefunct.Text = "Mark as Non-Defunct";
                else
                    lnkDefunct.Text = "Mark as Defunct";

            } else {
                lnkComplete.Visible = false;
                imgComplete.Visible = false;
                lnkDefunct.Visible = false;
                imgDefunct.Visible = false;
                lblMarkInst.Visible = false;
            }

            //Set up sub time label
            string latestr;
            Assignment asst = new Assignments(Globals.CurrentIdentity).GetInfo(sub.AsstID);
            if (sub.Creation <= asst.DueDate)
                latestr = "<font color=\"#4768A3\"><b>ON TIME</b></font>";
            else
                latestr = "<font color=\"#ff0000\"><b>LATE</b></font>";
            lblSubTime.Text = String.Format("<b>Time:</b> {0} <b>Status:</b> {1}", sub.Creation.ToString(),
                latestr);

            //Set up rubric view
            Rubric arub = new Assignments(Globals.CurrentIdentity).GetRubric(sub.AsstID);
            ucRubric.ExpandSubj = false;
            ucRubric.InitRubric(arub, GetSubID(), "");

            //Set up view files link
            BindFileLink();

            if (!IsStudent())
                mpViews.SelectedIndex = 1;
            else
                mpViews.SelectedIndex = 4;
        }
Esempio n. 8
0
 private void BindActivity()
 {
     Activity.ActivityList acts = new Submissions(Globals.CurrentIdentity).GetActivity(GetSubID());
     dgActivity.DataSource = acts;
     dgActivity.DataBind();
 }
Esempio n. 9
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string sfiles = Request.Params["FileIDs"];
            CFile.FileList files = GetFiles(sfiles);
            FileWindow window = new FileWindow();
            int i, oldtsindex;

            imgLock.Visible = false;
            lblError.Visible = lblCommentError.Visible = false;

            // Setup events
            ucRubric.RubricSelect += new RubricViewSelectEventHandler(this.ucRubric_RubricSelect);
            ucRubric.ResultSelect += new RubricViewSelectResultEventHandler(ucRubric_ResultSelect);

            //Setup initial window
            //if (!IsPostBack) {
                window.Low = 0; window.High = Math.Min(MAXFILES, files.Count);
                window.FileIDs = new int[files.Count];
                window.FilePaths = new string[files.Count];
                for (i = 0; i < window.High; i++) {
                    window.FileIDs[i] = files[i].ID;
                    window.FilePaths[i] = files[i].FullPath;
                }
                ViewState["window"] = window;
            //}

            oldtsindex = tsFiles.SelectedIndex;
            SetupFileWindow(window);
            tsFiles.SelectedIndex = oldtsindex;

            ucRubric.RubricSelect += new RubricViewSelectEventHandler(ucRubric_RubricSelect);
            if (!IsPostBack && Request.Params["SubID"] != null) {
                int subID = Convert.ToInt32(Request.Params["SubID"]);
                ViewState["SubID"] = Convert.ToInt32(Request.Params["SubID"]);

                mpFiles.Height = Unit.Pixel(325);
                divGrade.Style["TOP"] = "395px";
                divGrade.Visible = true;

                Components.Submission sub =
                    new Submissions(Globals.CurrentIdentity).GetInfo(subID);

                Rubric rub = new Assignments(Globals.CurrentIdentity).GetRubric(sub.AsstID);
                ucRubric.RepressAutos = true;
                ucRubric.InitRubric(rub, subID, "../../");
                ucRubric.Width = "53%";
                ucRubric.Height = "180px";
            } else if (!IsPostBack)
                divGrade.Visible = false;

            if (!IsPostBack)
                BindData(window);
        }
Esempio n. 10
0
        public void Activate(ActivateParams ap)
        {
            Components.Submission sub;

            sub = new Submissions(Globals.CurrentIdentity).GetInfo(ap.ID);

            ViewState["subID"] = sub.ID;
            ViewState["stumode"] = ap.StudentMode;
            tsUsers.SelectedIndex = 0;
            divGrading.Visible = true;
            divActivity.Visible = false;
            BindData();
        }
Esempio n. 11
0
        protected bool PostResult(AutoJobTest job, string xmloutput)
        {
            Results resda = new Results(m_ident);
            if (job.AutoEval.ResultType == Result.AUTO_TYPE) {
                new Activities(m_ident).Create(job.JobCreator, Activity.SUBMISSION, job.SubmissionID,
                    "Result posted for evaluation: " + job.AutoEval.Name);
                if (!job.OnSubmit) {
                    return resda.CreateAuto(
                        job.AutoEval.ID, job.JobCreator, job.SubmissionID, xmloutput);
                }
                else {
                    Components.Submission sub = new Submissions(m_ident).GetInfo(job.SubmissionID);
                    new EmailWizard(m_ident).SendByPrincipal(sub.PrincipalID,
                        "FrontDesk Submission Results: " + job.AutoEval.Name,
                        ConvertXmlToText(xmloutput, job.AutoEval.CourseID, job.AutoEval.AsstID));
                    m_logger.Log("Result emailed to submitter");
                    if (job.AutoEval.Competitive) {
                        m_logger.Log("Competitive pre-test result stored");
                        return resda.CreateAuto(
                            job.AutoEval.ID, job.JobCreator, job.SubmissionID, xmloutput);
                    }
                    else
                        return true;
                }
            } else {
                SubjResult.SubjResultList ress =
                    ParseSubjXmlResults(xmloutput, new Submissions(m_ident).GetInfo(job.SubmissionID));
                Rubric rub = new Evaluations(m_ident).GetRubric(job.AutoEval.ID);
                new Rubrics(m_ident).ClearResults(rub.ID, job.SubmissionID);
                foreach (SubjResult res in ress)
                    resda.CreateSubj(job.SubmissionID, rub.ID, res.Comment,
                        res.FileID, res.Line, res.Points, new ArrayList(), res.SubjType);

                return true;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Main worker thread for the testing center
        /// </summary>
        public void TestWorker()
        {
            AutoJobTest job;
            bool bsuc;
            Evaluations evals = new Evaluations(m_ident);
            AutoJobs jobs = new AutoJobs(m_ident);
            ZoneService testsvc = new ZoneService("auto", m_ident, m_logger);
            ZoneService stusvc = new ZoneService("stu", m_ident, m_logger);
            Submissions subs = new Submissions(m_ident);

            while (!m_shutdown) {

                //Get job
                try {
                    job = jobs.Claim(m_ipaddress, m_desc);
                    if (job != null) {

                        m_status = Status.RUNNING;

                        Submission sub = subs.GetInfo(job.SubmissionID);
                        m_logger.Log(String.Format("Claimed job: JOB: {0} EVAL: {1} SUB: {2}",
                            job.JobName, job.AutoEval.Name, new Principals(m_ident).GetInfo(sub.PrincipalID).Name));

                        m_logger.Log("Synchronizing eval and student zones");
                        //Sync test zone
                        Zone tzone = testsvc.Synchronize(job.AutoEval);

                        //Sync stu zone
                        Zone szone = stusvc.Synchronize(sub);

                        //Copy stu zone into test zone
                        testsvc.CopyZone(tzone, szone);

                        //Create dep graph and run deps
                        m_logger.Log("Beginning dependency running");
                        Evaluations.DependencyGraph dg =
                            new Evaluations.DependencyGraph(job.AutoEval, m_ident);
                        string faildep, xmloutput="";
                        if (null != (faildep = RunDependencies(tzone, testsvc, dg))) {
                            xmloutput = FormErrorXml(AutoResult.DEPFAIL,
                                "Test unable to run, dependency: " +
                                faildep + " failed to complete successfully!",
                                job.AutoEval.Points);
                            m_logger.Log("Dependency fail (" + faildep + "), not running main test",
                                TestLogger.LogType.WARNING);
                        } else {
                            //Run test and gather result
                            m_logger.Log("Starting run of test");
                            if (job.AutoEval.IsBuild)
                                xmloutput = RunBuildTest(tzone, job.AutoEval, out bsuc);
                            else
                                xmloutput = RunTest(tzone, job.AutoEval);
                        }

                        //Post result
                        xmloutput = Globals.PurifyZeroes(xmloutput);
                        if (!PostResult(job, xmloutput))
                            m_logger.Log("Error logging result", TestLogger.LogType.ERROR);
                        else
                            m_logger.Log("Test completed, result stored");

                        //Clear the job out
                        jobs.FinishTest(job);
                    }
                } catch (Exception er) {
                    m_logger.Log("Unexpected and fatal error during testing: MESSAGE: " + er.Message, TestLogger.LogType.ERROR);
                }

                m_status = Status.QUEUED;
                Thread.Sleep(TimeSpan.FromSeconds(5));
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Delete the assignment
        /// </summary>
        public bool Delete(int asstID)
        {
            FileSystem fs = new FileSystem(m_ident);
            Submissions subda = new Submissions(m_ident);
            Evaluations evalda = new Evaluations(m_ident);
            Results resultda = new Results(m_ident);
            Groups groupda = new Groups(m_ident);
            AutoJobs jobda = new AutoJobs(m_ident);

            Assignment asst = GetInfo(asstID);

            //Check permission
            Authorize(asst.CourseID, "delete", asstID, null);

            //Take auto jobs
            IProviderTransaction tran = m_dp.BeginTransaction();
            AutoJob.AutoJobList jobs = GetAutoJobs(asstID, tran);
            foreach (AutoJob job in jobs)
                jobda.Finish(job.ID, tran);
            m_dp.CommitTransaction(tran);

            //Take submissions and results
            Components.Submission.SubmissionList allsubs = GetSubmissions(asstID);
            foreach (Components.Submission sub in allsubs)
                subda.Delete(sub.ID);

            //Take rubric
            Rubric rub = GetRubric(asstID);
            new Rubrics(m_ident).Delete(rub.ID);

            //Take evaluations
            Evaluation.EvaluationList allevals = GetEvals(asstID);
            foreach (Evaluation eval in allevals)
                evalda.Delete(eval.ID);

            //Take groups
            Group.GroupList groups = GetGroups(asstID);
            foreach (Group group in groups)
                groupda.Delete(group.PrincipalID, asstID);

            //Take assignment
            m_dp.DeleteAssignment(asstID);

            //Take content
            CFile content = fs.GetFile(asst.ContentID);
            fs.DeleteFile(content);

            //Log
            Log("Deleted assignment: " + asst.Description, asst.ID);

            return true;
        }
Esempio n. 14
0
        /// <summary>
        /// Delete the assignment
        /// </summary>
        public bool Delete(int asstID)
        {
            FileSystem  fs       = new FileSystem(m_ident);
            Submissions subda    = new Submissions(m_ident);
            Evaluations evalda   = new Evaluations(m_ident);
            Results     resultda = new Results(m_ident);
            Groups      groupda  = new Groups(m_ident);
            AutoJobs    jobda    = new AutoJobs(m_ident);

            Assignment asst = GetInfo(asstID);

            //Check permission
            Authorize(asst.CourseID, "delete", asstID, null);

            //Take auto jobs
            IProviderTransaction tran = m_dp.BeginTransaction();

            AutoJob.AutoJobList jobs = GetAutoJobs(asstID, tran);
            foreach (AutoJob job in jobs)
            {
                jobda.Finish(job.ID, tran);
            }
            m_dp.CommitTransaction(tran);

            //Take submissions and results
            Components.Submission.SubmissionList allsubs = GetSubmissions(asstID);
            foreach (Components.Submission sub in allsubs)
            {
                subda.Delete(sub.ID);
            }

            //Take rubric
            Rubric rub = GetRubric(asstID);

            new Rubrics(m_ident).Delete(rub.ID);

            //Take evaluations
            Evaluation.EvaluationList allevals = GetEvals(asstID);
            foreach (Evaluation eval in allevals)
            {
                evalda.Delete(eval.ID);
            }

            //Take groups
            Group.GroupList groups = GetGroups(asstID);
            foreach (Group group in groups)
            {
                groupda.Delete(group.PrincipalID, asstID);
            }

            //Take assignment
            m_dp.DeleteAssignment(asstID);

            //Take content
            CFile content = fs.GetFile(asst.ContentID);

            fs.DeleteFile(content);

            //Log
            Log("Deleted assignment: " + asst.Description, asst.ID);

            return(true);
        }
Esempio n. 15
0
        /// <summary>
        /// Delete a result
        /// </summary>
        public bool Delete(int resID)
        {
            //Check permission
            Result res = GetInfo(resID);
            Components.Submission sub = new Submissions(m_ident).GetInfo(res.SubmissionID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "deletesubj", asst.ID, null);

            return m_dp.DeleteResult(resID);
        }
Esempio n. 16
0
        private void lnkDefunct_Click(object sender, EventArgs e)
        {
            Submissions subda = new Submissions(Globals.CurrentIdentity);
            Components.Submission sub = subda.GetInfo(GetSubID());

            //Change status
            if (sub.Status != Components.Submission.DEFUNCT)
                sub.Status = Components.Submission.DEFUNCT;
            else
                sub.Status = Components.Submission.UNGRADED;

            try {
                subda.Update(sub, new EmptySource());
            } catch (DataAccessException er) {
                PageError(er.Message);
            } catch (FileOperationException er) {
                PageError(er.Message);
            }

            BindData();
            Refresh(this, new RefreshEventArgs("", true, false));
        }
Esempio n. 17
0
        private void lnkRunTest_Click(object sender, EventArgs e)
        {
            AutoJobs ajobda = new AutoJobs(Globals.CurrentIdentity);

            Components.Submission sub =
                new Submissions(Globals.CurrentIdentity).GetInfo(GetSubID());

            Evaluation eval =
                new Evaluations(Globals.CurrentIdentity).GetInfo(Convert.ToInt32(lblEvalID.Text));
            string name = new FileSystem(Globals.CurrentIdentity).GetFile(sub.LocationID).Alias +
                " (" + eval.Name + ")";
            try {
                AutoJob job =
                    ajobda.Create(name, sub.AsstID);
                ajobda.CreateTest(job.ID, sub.ID, eval.ID, false);
            } catch (DataAccessException er) {
                PageRunError(er.Message);
                return;
            }

            PageRunError("Automatic job created successfully!");
        }
Esempio n. 18
0
 public SubmitCommand(string cvsroot, string module, string password, 
     int asstID, int prinID, Submissions subda)
 {
     m_cvsroot=cvsroot; m_module=module;
     m_password = password;
     m_asstID=asstID; m_prinID=prinID;
     m_subda = subda;
 }
Esempio n. 19
0
        /// <summary>
        /// Remove a user from a course
        /// </summary>
        public bool RemoveUser(string user, int courseID)
        {
            //Kill all submissions
            Submissions subda = new Submissions(m_ident);
            Components.Submission.SubmissionList subs = new Users(m_ident).GetCourseSubmissions(user, courseID);

            foreach (Components.Submission sub in subs)
                subda.Delete(sub.ID);

            return m_dp.DeleteCourseMember(user, courseID);
        }
Esempio n. 20
0
            public void Execute()
            {
                IExternalSource extsrc;
                ICommandEventArgs args = new ICommandEventArgs();

                //Run CVS to get the files
                CVSTool cvs = new CVSTool();
                try {
                    extsrc = cvs.Checkout(m_cvsroot, m_module, m_password, out m_target);
                } catch (Exception er) {
                    args.Exception = er;
                    Finish(args); return;
                }

                //Sanity check on CVS
                if (extsrc == null) {
                    args.Exception = new ToolExecutionException("Failure during execution of CVS");
                    Finish(args); return;
                }

                //Create the submission
                Submissions subda = new Submissions(Globals.CurrentIdentity);
                Components.Submission sub = null;
                try {
                    sub = m_subda.Create(m_asstID, m_prinID, extsrc);
                } catch (Exception er) {
                    args.Exception = er;
                    Finish(args); return;
                }

                //Finish up
                args.ReturnValue = sub;
                Finish(args);
            }
Esempio n. 21
0
 public SubmitCommand(Submissions subda, HttpPostedFile upfile, int asstID, int prinID)
 {
     m_upfile=upfile; m_asstID=asstID; m_prinID=prinID; m_subda = subda;
 }
Esempio n. 22
0
        /// <summary>
        /// Update a subjective result
        /// </summary>
        public bool UpdateSubj(SubjResult res)
        {
            //Check permission
            Components.Submission sub =
                new Submissions(m_ident).GetInfo(res.SubmissionID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "updatesubj", asst.ID, null);

            return m_dp.UpdateSubjResult(res);
        }