예제 #1
0
        private void FindDocumentUrl()
        {
            DropBoxManager manager = new DropBoxManager(AssignmentProperties);

            AssignmentFile[] files = manager.LastSubmittedFiles(true);
            if (files.Length == 0)
            {
                // Intial copy must have failed.
                CopyDocumentToDropBox();
            }
            else if (files.Length > 0)
            {
                assignmentFile = files[0];
            }
        }
예제 #2
0
        /// <summary> Generates the url to view the submitted files. </summary>
        private string GenerateUrlForAssignmentReview()
        {
            DropBoxManager manager = new DropBoxManager(AssignmentProperties);

            AssignmentFile[] assignmentFiles = manager.LastSubmittedFiles(true);

            if (assignmentFiles.Length != 1)
            {
                return(string.Format("{0}{1}SubmittedFiles.aspx?LearnerAssignmentId={2}", SPWeb.Url, Constants.SlkUrlPath, LearnerAssignmentGuidId.ToString()));
            }
            else
            {
                return(assignmentFiles[0].Url);
            }
        }
        /// <summary>
        /// Checks the number of the assignment submitted files.
        /// </summary>
        /// <param name="assignmentProperties">The AssignmentProperties</param>
        /// <returns> If one assignment submitted, returns its URL.
        /// If more than one, returns an empty string.</returns>
        private string PerformFilesNumberChecking(AssignmentProperties assignmentProperties)
        {
            DropBoxManager dropBox = new DropBoxManager(assignmentProperties);

            AssignmentFile[] assignmentFiles = dropBox.LastSubmittedFiles(assignmentProperties.Results[0].User.SPUser, false);

            if (assignmentFiles.Length != 1)
            {
                return(string.Empty);
            }
            else
            {
                return(assignmentFiles[0].Url);
            }
        }
예제 #4
0
        private void LoadLastAssignmentAttempt()
        {
            DropBoxManager dropBoxManager = new DropBoxManager(AssignmentProperties);

            AssignmentFile[] files = dropBoxManager.LastSubmittedFiles(true);

            if (files.Length > 0)
            {
                LiteralControl literal = new LiteralControl(string.Format("<table><tr><th>{0}</th><th>{1}</th></tr>", PageCulture.Resources.IncludeTitle, PageCulture.Resources.CtrlLabelUploadDocumentName));
                pnlOldFiles.Controls.Add(literal);

                foreach (AssignmentFile file in files)
                {
                    pnlOldFiles.Controls.Add(new LiteralControl("<tr><td>"));

                    CheckBox check = new CheckBox();
                    check.ID      = "check" + file.Id.ToString(CultureInfo.InvariantCulture);
                    check.Checked = false;
                    includes.Add(check);
                    pnlOldFiles.Controls.Add(check);

                    pnlOldFiles.Controls.Add(new LiteralControl("</td><td>"));

                    HyperLink fileLink = new HyperLink();
                    fileLink.Text = file.Name;

                    DropBoxEditMode    editMode    = DropBoxEditMode.Edit;
                    DropBoxEditDetails editDetails = dropBoxManager.GenerateDropBoxEditDetails(file, SPWeb, editMode, Page.Request.RawUrl);
                    fileLink.NavigateUrl = editDetails.Url;
                    if (string.IsNullOrEmpty(editDetails.OnClick) == false)
                    {
                        fileLink.Attributes.Add("onclick", editDetails.OnClick + "return false;");
                    }

                    pnlOldFiles.Controls.Add(fileLink);

                    pnlOldFiles.Controls.Add(new LiteralControl("</td></tr>"));
                }

                pnlOldFiles.Controls.Add(new LiteralControl("</table>"));
            }
        }
예제 #5
0
        private void SetUpForFinal()
        {
            slkButtonBegin.Text    = PageCulture.Resources.LobbyReviewAssignmentText;
            slkButtonBegin.ToolTip = PageCulture.Resources.LobbyReviewAssignmentToolTip;

            pageTitle.Text            = PageCulture.Resources.LobbyReviewAssignmentText;
            pageTitleInTitlePage.Text = PageCulture.Resources.LobbyReviewAssignmentText;

            //Check if non-elearning content
            if (AssignmentProperties.RootActivityId == null)
            {
                slkButtonReviewSubmitted.Text     = PageCulture.Resources.LobbyReviewSubmittedText;
                slkButtonReviewSubmitted.ToolTip  = PageCulture.Resources.LobbyReviewSubmittedToolTip;
                slkButtonReviewSubmitted.ImageUrl = Constants.ImagePath + Constants.NewDocumentIcon;
                slkButtonReviewSubmitted.Visible  = true;

                DropBoxManager manager = new DropBoxManager(AssignmentProperties);

                AssignmentFile[] assignmentFiles = manager.LastSubmittedFiles(true);

                if (assignmentFiles.Length != 1)
                {
                    string script = string.Format("openSubmittedFiles('{0}');return false;", LearnerAssignmentGuidId);
                    slkButtonReviewSubmitted.OnClientClick = script;
                    slkButtonBegin.OnClientClick           = script;
                }
                else
                {
                    SetupFileAction(assignmentFiles[0], slkButtonReviewSubmitted, false);
                    SetupFileAction(assignmentFiles[0], slkButtonBegin, false);
                }
            }

            SetUpSubmitButtons(false, false);
            slkButtonSubmit.Visible = false;
            ShowNavigationOptions();
            ShowLearnerComments();
        }
        /// <summary>
        /// Builds the content displayed in the page
        /// </summary>
        protected void BuildPageContent()
        {
            dropBox = new DropBoxManager(AssignmentProperties);

            AssignmentFile[] files = dropBox.LastSubmittedFiles(LearnerAssignmentProperties.User.SPUser, true);

            returnUrl = Request.QueryString["source"];
            if (string.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Page.Request.RawUrl; 
            }
            else
            {
                returnUrl = HttpUtility.UrlDecode(returnUrl);
            }

            int counter = 0;
            foreach (AssignmentFile file in files)
            {
                DisplayFileLink(file, counter);
                counter++;
            }
        }