Exemplo n.º 1
0
        private void BindAuto(Rubric rub)
        {
            Result.ResultList ress =
                new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID, GetCurrentSub());

            if (ress.Count == 0) {
                divAuto.InnerHtml = "<i>There are no results for this evaluation item</i>";
                return;
            }

            AutoResult res = ress[0] as AutoResult;
            MemoryStream xmlstr = new MemoryStream(Encoding.ASCII.GetBytes(res.XmlResult));

            XslTransform xslt = new XslTransform();

            XPathDocument xpathdoc = new XPathDocument(xmlstr);
            XPathNavigator nav = xpathdoc.CreateNavigator();

            XPathDocument xsldoc = new XPathDocument(
                Path.Combine(Globals.WWWDirectory, "Xml/reshtml.xslt"));

            StringBuilder strb = new StringBuilder();
            xslt.Load(xsldoc, null, null);
            xslt.Transform(xpathdoc, null, new XmlTextWriter(new StringWriter(strb)) , (XmlResolver)null);

            divAuto.InnerHtml = strb.ToString();
        }
Exemplo n.º 2
0
        private void BindSubj(Rubric rub)
        {
            Result.ResultList ress =
                new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID, GetCurrentSub());

            dgSubj.DataSource = ress;
            dgSubj.DataBind();
        }
Exemplo n.º 3
0
 public RubricViewSelectEventArgs(Rubric rub)
 {
     SelectedRubric = rub;
 }
Exemplo n.º 4
0
        public void InitRubric(Rubric rub, int subID, string imgPrefix)
        {
            tvRubric.Nodes.Clear();

            ViewState["subID"] = subID;

            TreeNode root = AddRubricNode(tvRubric.Nodes, rub, imgPrefix);
            LoadTreeView(root, imgPrefix);
        }
Exemplo n.º 5
0
        private TreeNode AddRubricNode(TreeNodeCollection par, Rubric rub, string imgPrefix)
        {
            string img, expimage, text;
            bool expand;

            if (new Rubrics(Globals.CurrentIdentity).IsHeading(rub)) {
                if (rub.ParentID < 0)
                    text = String.Format("Total - {0}/{1} Points",
                        new Submissions(Globals.CurrentIdentity).GetPoints(GetSubID()),
                        rub.Points);
                else
                    text = rub.Name;
                img = imgPrefix + "attributes/folder.gif";
                expimage = imgPrefix + "attributes/folderopen.gif";
                expand = true;
            }
            else {
                text = GetResultPoints(rub);
                if (rub.EvalID < 0) {
                    img = imgPrefix + "attributes/book.gif";
                    expimage = imgPrefix + "attributes/book.gif";
                    expand = ExpandSubj;
                }
                else {
                    img = imgPrefix + "attributes/cyl.gif";
                    expimage = imgPrefix + "attributes/cyl.gif";
                    expand = false;
                }
            }

            return AddNode(par, text, img, expimage, "Rubric " + rub.ID.ToString(), expand);
        }
Exemplo n.º 6
0
        private string GetResultPoints(Rubric rub)
        {
            Result.ResultList ress =
                new Rubrics(Globals.CurrentIdentity).GetResults(rub.ID, GetSubID());
            if (ress.Count == 0 && rub.EvalID >= 0)
                return String.Format("{0} (Ungraded, {1} points)", rub.Name, rub.Points);

            return String.Format("{0} ({1}/{2} points)", rub.Name,
                new Rubrics(Globals.CurrentIdentity).GetPoints(rub.ID, GetSubID()), rub.Points);
        }
Exemplo n.º 7
0
        private void BindAuto(Rubric rub)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Result.ResultList ress = rubda.GetResults(rub.ID, GetSubID());

            lblEvalID.Text = rub.EvalID.ToString();
            if (ress.Count == 0)
                if (!IsStudent())
                    mpViews.SelectedIndex = 2;
                else
                    mpViews.SelectedIndex = 5;
            else {
                AutoResult res = ress[0] as AutoResult;

                XmlWizard xmlwiz = new XmlWizard();
                xmlwiz.DisplayDivXslt(res.XmlResult, Path.Combine(Globals.WWWDirectory, "Xml/reshtml.xslt"), divAuto);

                mpViews.SelectedIndex = 3;
            }
        }
Exemplo n.º 8
0
        private void BindSubj(Rubric rub)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Result.ResultList ress = rubda.GetResults(rub.ID, GetSubID());

            //Update the rubric
            ucRubric.UpdateRubric();

            //Reset to 0 if page index greater than numpages
            if (dgResults.CurrentPageIndex >= dgResults.PageCount)
                dgResults.CurrentPageIndex = 0;

            dgResults.DataSource = ress;
            dgResults.DataBind();

            if (!IsStudent()) {

                ddlCanned.Visible = true;
                lnkCreate.Visible = true;
                dgResults.Columns[0].Visible = true;
                dgResults.Columns[6].Visible = true;

                dgResults.Style["TOP"] = "58px";

                CannedResponse.CannedResponseList cans = rubda.GetCannedResponses(rub.ID);
                ddlCanned.Items.Clear();

                foreach (CannedResponse can in cans) {
                    string canstr = can.Comment.Substring(0, Math.Min(80, can.Comment.Length));
                    if (canstr.Length == 80)
                        canstr += " ...";
                    ListItem item = new ListItem(canstr, can.ID.ToString());

                    ddlCanned.Items.Add(item);
                }
                ddlCanned.Items.Add(new ListItem("Custom", "-1"));
            } else {
                ddlCanned.Visible = false;
                lnkCreate.Visible = false;
                dgResults.Columns[0].Visible = false;
                dgResults.Columns[6].Visible = false;

                lnkRefresh.Style["TOP"] = "0px";
                imgRefresh.Style["TOP"] = "0px";
                dgResults.Style["TOP"] = "20px";
            }

            lblRubID.Text = rub.ID.ToString();
            mpViews.SelectedIndex = 0;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Sort in somewhat topological order
        /// </summary>
        private void FlattenRubric(Rubric.RubricList rublist, Rubric rub)
        {
            Rubric.RubricList children = GetChildren(rub.ID);
            foreach (Rubric child in children)
                FlattenRubric(rublist, child);

            if (!IsHeading(rub))
                rublist.Add(rub);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Retally the points
        /// </summary>
        private double RetallyPoints(Rubric rub)
        {
            double points=0.0;

            if (rub.Points >= 0.0 && rub.ParentID >= 0)
                points += rub.Points;

            Rubric.RubricList chil = GetChildren(rub.ID);
            foreach (Rubric crub in chil)
                points += RetallyPoints(crub);

            return points;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Update a rubric entry
        /// </summary>
        public bool Update(Rubric rub)
        {
            //check permission
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);
            Authorize(asst.CourseID, "updaterubric", asst.ID, null);

            //Rename zone on entry rename
            if (rub.EvalID >= 0) {
                FileSystem fs = new FileSystem(m_ident);
                int zoneID =
                    (new Evaluations(m_ident).GetInfo(rub.EvalID) as AutoEvaluation).ZoneID;
                CFile zdir = fs.GetFile(zoneID);
                zdir.Alias = rub.Name;
                fs.UpdateFileInfo(zdir, false);
            }

            //Update entry
            m_dp.UpdateRubricEntry(rub);

            //Retally points and update root entry
            Rubric root = new Assignments(m_ident).GetRubric(rub.AsstID);
            root.Points = RetallyPoints(root);
            m_dp.UpdateRubricEntry(root);

            //Log
            Log("Updated rubric entry: " + rub.Name, rub.AsstID);

            return true;
        }
Exemplo n.º 12
0
 /// <summary>
 /// Return is the rubric entry is a heading
 /// </summary>
 public bool IsHeading(Rubric rub)
 {
     return (rub.Points < 0 || rub.ParentID == -1);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Return an asst rubric in the form of a list
 /// </summary>
 public Rubric.RubricList Flatten(Rubric rub)
 {
     Rubric.RubricList rublist = new Rubric.RubricList();
     FlattenRubric(rublist, rub);
     return rublist;
 }
Exemplo n.º 14
0
 private string GetRubricPoints(Rubric rub, int subID)
 {
     Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
     Result.ResultList ress = rubda.GetResults(rub.ID, subID);
     if (ress.Count == 0 && rub.EvalID >= 0)
         return "??";
     else
         return rubda.GetPoints(rub.ID, subID).ToString();
 }
Exemplo n.º 15
0
        private TreeNode AddRubricNode(TreeNodeCollection par, Rubric rub)
        {
            string img, expimage, text;
            bool expand;

            if (new Rubrics(Globals.CurrentIdentity).IsHeading(rub)) {
                if (rub.ParentID < 0)
                    text = String.Format("Rubric - {0} Points", rub.Points);
                else
                    text = rub.Name;
                img = "attributes/folder.gif";
                expimage = "attributes/folderopen.gif";
                expand = true;
            }
            else {
                text = String.Format("{0} ({1} points)", rub.Name, rub.Points);

                if (rub.EvalID < 0) {
                    img = "attributes/book.gif";
                    expimage = "attributes/book.gif";
                }
                else {
                    Evaluation eval = new Evaluations(Globals.CurrentIdentity).GetInfo(rub.EvalID);
                    if (eval.Manager == Evaluation.JUNIT_MANAGER) {
                        img = "attributes/cylj.gif";
                        expimage = "attributes/cylj.gif";
                    }
                    else if (eval.Manager == Evaluation.CHECKSTYLE_MANAGER) {
                        img = "attributes/bookcs.gif";
                        expimage = "attributes/bookcs.gif";
                    } else {
                        img = "attributes/cyl.gif";
                        expimage = "attributes/cyl.gif";
                    }
                }
                expand = false;
            }

            return AddNode(par, text, img, expimage, "Rubric " + rub.ID.ToString(), expand);
        }