Esempio n. 1
0
        protected void PublishNextDocument(object sender, EventArgs e)
        {
            WBLogging.Debug("Attempting to publishg the next document " + process.CurrentItemID);

            process = manager.PublishDocument(process);

            WBLogging.Debug("Published the document");

            DocumentPublishingProgress.WBxUpdateTask(process.LastTaskFeedback);

            PublishingProcessJSON.Text = WBUtils.SerializeToCompressedJSONForURI(process);

            WBLogging.Debug("Serialized to: " + PublishingProcessJSON.Text);

            if (process.HasMoreDocumentsToPublish && process.PublishMode == WBPublishingProcess.PUBLISH_MODE__ALL_TOGETHER)
            {
                Image image = (Image)DocumentPublishingProgress.WBxFindNestedControlByID(DocumentPublishingProgress.WBxMakeControlID(process.CurrentItemID, "image"));
                image.ImageUrl = "/_layouts/images/WorkBoxFramework/processing-task-32.gif";

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "TriggerNextStepFunction", "WorkBoxFramework_triggerPublishNextDocument();", true);
            }
            else
            {
                if (process.HasMoreDocumentsToPublish)
                {
                    WBLogging.Debug("Trying to set button text to Publish next doc");
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ChangeDoneButtonTextFunction", "WorkBoxFramework_finishedProcessing('Publish Next Document');", true);
                }
                else
                {
                    WBLogging.Debug("Trying to set button text to done");
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ChangeDoneButtonTextFunction", "WorkBoxFramework_finishedProcessing('Done');", true);
                }
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName);

            if (!IsPostBack)
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(Request.QueryString["PublishingProcessJSON"]);
                process.WorkBox = WorkBox;

                WBLogging.Debug("Created the WBProcessObject");

                PublishingProcessJSON.Text = WBUtils.SerializeToCompressedJSONForURI(process);

                WBLogging.Debug("Serialized the WBProcessObject to hidden field");
            }
            else
            {
                WBLogging.Debug("About to deserialise: " + PublishingProcessJSON.Text);

                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(PublishingProcessJSON.Text);
                process.WorkBox = WorkBox;
            }

            if (process.HasMoreDocumentsToPublish)
            {
                if (process.PublishMode == WBPublishingProcess.PUBLISH_MODE__ALL_TOGETHER)
                {
                    DocumentPublishingProgress.WBxCreateTasksTable(process.ItemIDs, process.MappedFilenames);
                }
                else
                {
                    List <String> oneItem = new List <String>();
                    oneItem.Add(process.CurrentItemID);

                    Dictionary <String, String> oneMapping = new Dictionary <String, String>();
                    oneMapping.Add(process.CurrentItemID, process.CurrentItem.Name);

                    DocumentPublishingProgress.WBxCreateTasksTable(oneItem, oneMapping);
                }

                Image image = (Image)DocumentPublishingProgress.WBxFindNestedControlByID(DocumentPublishingProgress.WBxMakeControlID(process.CurrentItemID, "image"));
                image.ImageUrl = "/_layouts/images/WorkBoxFramework/processing-task-32.gif";
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WBLogging.Debug("In Page_Load");

            WBLogging.Debug("EventArgs type: " + e.GetType().Name);

            WBLogging.Debug("Request[\"__EVENTARGUMENT\"] = " + Request["__EVENTARGUMENT"]);


            manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName);

            if (!IsPostBack)
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(Request.QueryString["PublishingProcessJSON"]);
                process.WorkBox = WorkBox;

                WBLogging.Debug("Created the WBProcessObject");

                newOrReplace   = Request.QueryString["NewOrReplace"];
                archiveOrLeave = Request.QueryString["ArchiveOrLeave"];
                if (newOrReplace == "New")
                {
                    process.ReplaceAction = WBPublishingProcess.REPLACE_ACTION__CREATE_NEW_SERIES;
                }
                else
                {
                    if (archiveOrLeave == "Archive")
                    {
                        process.ReplaceAction = WBPublishingProcess.REPLACE_ACTION__ARCHIVE_FROM_IZZI;
                    }
                    else
                    {
                        process.ReplaceAction = WBPublishingProcess.REPLACE_ACTION__LEAVE_ON_IZZI;
                    }
                }

                WBLogging.Debug("Captured replace action as: " + process.ReplaceAction);

                PublishingProcessJSON.Value = WBUtils.SerializeToCompressedJSONForURI(process);

                WBLogging.Debug("Serialized the WBProcessObject to hidden field");

                SelectedFolderPath.Text = "/";
            }
            else
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(PublishingProcessJSON.Value);
                process.WorkBox = WorkBox;
            }

            LibraryLocations.TreeNodePopulate += new TreeNodeEventHandler(LibraryLocations_TreeNodePopulate);
            //LibraryLocations.SelectedNodeChanged += new EventHandler(LibraryLocations_SelectedNodeChanged);

            LibraryLocations.PopulateNodesFromClient = true;
            LibraryLocations.EnableClientScript      = true;

            String viewMode = process.IsReplaceActionToCreateNewSeries ? "New" : "Replace";

            treeState = new WBLocationTreeState(SPContext.Current.Web, viewMode, process.ProtectiveZone);

            if (!IsPostBack)
            {
                if (viewMode == "New")
                {
                    Description.Text = "Select the folder into which to publish the document";
                }
                else
                {
                    Description.Text = "Select the document to replace";
                }

                WBTermCollection <WBTerm> teamFunctionalAreas = WorkBox.OwningTeam.FunctionalArea(manager.FunctionalAreasTaxonomy);

                manager.PopulateWithFunctionalAreas(treeState, LibraryLocations.Nodes, viewMode, teamFunctionalAreas);
            }
            else
            {
                String selectedPath = manager.GetSelectedPath(Request);
                if (!String.IsNullOrEmpty(selectedPath))
                {
                    ProcessSelection(selectedPath);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SPGroup publishersGroup = WorkBox.OwningTeam.PublishersGroup(SPContext.Current.Site);

            if (publishersGroup != null)
            {
                if (publishersGroup.ContainsCurrentUser)
                {
                    userCanPublishToPublic = true;
                }
            }

            if (!IsPostBack)
            {
                if (Request.QueryString["selectedItemsIDsString"] != null && Request.QueryString["selectedListGUID"] != null)
                {
                    manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName);
                    string   selectedListGUID = Request.QueryString["selectedListGUID"];
                    string[] selectedItemsIDs = Request.QueryString["selectedItemsIDsString"].ToString().Split('|');

                    WBLogging.Debug("Before creating the WBProcessObject");

                    process = new WBPublishingProcess(WorkBox, selectedListGUID, selectedItemsIDs);

                    WBLogging.Debug("Created the WBProcessObject");

                    PublishingProcessJSON.Value = WBUtils.SerializeToCompressedJSONForURI(process);

                    String html = "";

                    WBLogging.Debug("Created the WBProcessObject and serialised " + PublishingProcessJSON.Value);

                    if (process.ItemIDs.Count == 0)
                    {
                        WBLogging.Debug("process.ItemIDs.Count == 0");
                        html += "<i>No documents selected!</i>";
                    }
                    else
                    {
                        html += "<table cellpadding='0px' cellspacing='5px'>";

                        foreach (String itemID in process.ItemIDs)
                        {
                            String filename = process.MappedFilenames[itemID];

                            WBLogging.Debug("list through item with name: " + filename);
                            html += "<tr><td align='center'><img src='" + WBUtils.DocumentIcon16(filename) + "' alt='Icon for file " + filename + "'/></td><td align='left'>" + filename + "</td></tr>\n";

                            String fileType = WBUtils.GetExtension(filename);
                            if (!fileTypes.Contains(fileType))
                            {
                                fileTypes.Add(fileType);
                            }
                        }

                        html += "</table>";

                        List <string> disallowedFileTypes = manager.GetFileTypesDisallowedFromBeingPublishedToPublic(fileTypes);

                        if (String.IsNullOrEmpty(WorkBox.OwningTeam.InformationAssetOwnerLogin))
                        {
                            PublicWebSiteButton.Enabled          = false;
                            PublicNotAllowedMessage.Text         = "You cannot publish to the public website because the owning team of this work box does not have an assigned Information Asset Owner(IAO)";
                            PublicExtranetButton.Enabled         = false;
                            PublicExtranetNotAllowedMessage.Text = "You cannot publish to the public website because the owning team of this work box does not have an assigned Information Asset Owner(IAO)";
                        }
                        else if (!WorkBox.OwningTeam.IsCurrentUserTeamMember())
                        {
                            PublicWebSiteButton.Enabled          = false;
                            PublicNotAllowedMessage.Text         = "You cannot publish to the public website from here because you are not a member of this work box's owning team";
                            PublicExtranetButton.Enabled         = false;
                            PublicExtranetNotAllowedMessage.Text = "You cannot publish to the public website from here because you are not a member of this work box's owning team";
                        }
                        else if (disallowedFileTypes.Count > 0)
                        {
                            PublicWebSiteButton.Enabled          = false;
                            PublicNotAllowedMessage.Text         = "The following file types have not been approved for publishing to a public website: " + String.Join(", ", disallowedFileTypes.ToArray());
                            PublicExtranetButton.Enabled         = false;
                            PublicExtranetNotAllowedMessage.Text = "The following file types have not been approved for publishing to a public website: " + String.Join(", ", disallowedFileTypes.ToArray());
                        }
                    }

                    DocumentsBeingPublished.Text = html;
                }
                else
                {
                    ErrorMessageLabel.Text = "There was an error with the passed through values";
                }
            }
            else
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(PublishingProcessJSON.Value);
                process.WorkBox = WorkBox;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WBLogging.Generic.Verbose("In Page_Load for the self approval dialog");

            manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName);

            // If this is the initial call to the page then we need to load the basic details of the document we're publishing out:
            if (!IsPostBack)
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(Request.QueryString["PublishingProcessJSON"]);
                process.WorkBox = WorkBox;

//                WBLogging.Debug("Created the WBProcessObject");

                PublishingProcessJSON.Value = WBUtils.SerializeToCompressedJSONForURI(process);

                //             WBLogging.Debug("Serialized the WBProcessObject to hidden field");
            }
            else
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(PublishingProcessJSON.Value);
                process.WorkBox = WorkBox;
            }



            // Let's clear out all of the error messages text fields:
            ErrorMessageLabel.Text = "";


            //OK so we have the basic identity information for the document being published out so let's get the document item:

            Guid sourceListGuid            = new Guid(process.ListGUID);
            SPDocumentLibrary sourceDocLib = (SPDocumentLibrary)WorkBox.Web.Lists[sourceListGuid];

            sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(process.CurrentItemID));
            sourceFile      = sourceDocAsItem.File;

            WBDocument sourceDocument = new WBDocument(WorkBox, sourceDocAsItem);

            fileTypeInfo = manager.GetFileTypeInfo(sourceDocument.FileType);

            if (fileTypeInfo != null)
            {
                Dictionary <String, String> checkBoxDetails = manager.GetCheckBoxDetailsForDocumentType(fileTypeInfo.WBxGetAsString(WBColumn.DocumentType));
                foreach (String checkBoxCode in checkBoxDetails.Keys)
                {
                    CheckBoxes.Controls.Add(CreateCheckBoxDiv(checkBoxCode, checkBoxDetails[checkBoxCode]));
                }

                CheckBoxesCodes.Value = String.Join(";", checkBoxDetails.Keys.ToArray <string>());
            }

            if (!IsPostBack)
            {
                DocumentsBeingPublished.Text = process.GetStandardHTMLTableRows();

                String typeText = null;

                if (fileTypeInfo != null)
                {
                    typeText = fileTypeInfo.WBxGetAsString(WBColumn.DocumentType) + " (" + fileTypeInfo.WBxGetAsString(WBColumn.FileTypePrettyName) + ")";
                }
                if (String.IsNullOrEmpty(typeText))
                {
                    typeText = sourceDocument.FileType + " " + sourceDocument.Name;
                }
                DocumentType.Text = typeText;
                WBLogging.Debug("The file type of the record is: " + typeText);

                IAO.Text = "<none found>";
                if (!String.IsNullOrEmpty(process.OwningTeamsIAOAtTimeOfPublishing))
                {
                    SPUser owningTeamIAO = SPContext.Current.Web.WBxEnsureUserOrNull(process.OwningTeamsIAOAtTimeOfPublishing);
                    if (owningTeamIAO != null)
                    {
                        IAO.Text = owningTeamIAO.Name;
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WBLogging.Debug("In Page_Load for the public doc metadata dialog");

            manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName);

            // If this is the initial call to the page then we need to load the basic details of the document we're publishing out:
            if (!IsPostBack)
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(Request.QueryString["PublishingProcessJSON"]);
                process.WorkBox = WorkBox;

                WBLogging.Debug("Created the WBProcessObject");

                PublishingProcessJSON.Value = WBUtils.SerializeToCompressedJSONForURI(process);

                WBLogging.Debug("Serialized the WBProcessObject to hidden field");

                NewRadioButton.Checked = true;
                NewOrReplace.Text      = "New";

                pageRenderingRequired = true;
            }
            else
            {
                process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(PublishingProcessJSON.Value.WBxTrim());
                process.WorkBox = WorkBox;

                CaptureChanges();

                // By default we should not be rendering the page on a post back call
                pageRenderingRequired = false;
            }

            if (errorMessage.Length > 0)
            {
                ErrorMessageLabel.Text = errorMessage;
                return;
            }

            // Let's clear out all of the error messages text fields:
            ErrorMessageLabel.Text         = "";
            ReferenceIDMessage.Text        = "";
            ReferenceDateMessage.Text      = "";
            SeriesTagFieldMessage.Text     = "";
            ScanDateMessage.Text           = "";
            OwningTeamFieldMessage.Text    = "";
            InvolvedTeamsFieldMessage.Text = "";
            PublishingLocationError.Text   = "";
            ShortTitleError.Text           = "";

            if (IsPostBack)
            {
                // If this is a post back - then let's check if the records type has been modified:
                if (!String.IsNullOrEmpty(UpdatedPublishingProcessJSON.Value))
                {
                    WBLogging.Generic.Unexpected("The returned value was: " + UpdatedPublishingProcessJSON.Value);

                    process         = WBUtils.DeserializeFromCompressedJSONInURI <WBPublishingProcess>(UpdatedPublishingProcessJSON.Value.WBxTrim());
                    process.WorkBox = WorkBox;

                    CaptureChanges();

                    // Now set the title and subject tags from the record that is going to be replaced:
                    process.CurrentShortTitle         = process.ToReplaceShortTitle;
                    process.SubjectTagsUIControlValue = process.ToReplaceSubjectTagsUIControlValue;

                    // Now blanking this hidden field so that it doesn't trigger a recapture each time!
                    UpdatedPublishingProcessJSON.Value = "";

                    pageRenderingRequired = true;
                }
                else
                {
                    // Otherwise we are in a normal post back call.
                    pageRenderingRequired = false;
                }
            }


            destinationType = process.ProtectiveZone;

            // Now load up some of the basic details:
            if (String.IsNullOrEmpty(process.RecordsTypeUIControlValue))
            {
                showReferenceID   = false;
                showReferenceDate = false;
                showSubjectTags   = true;
                showSeriesTag     = false;
                showScanDate      = false;
            }
            else
            {
                documentRecordsType = new WBRecordsType(process.RecordsTypeTaxonomy, process.RecordsTypeUIControlValue);

                // Which of the metadata fields are being used in the form (or will need to be processed in any postback) :
                showReferenceID   = documentRecordsType.DocumentReferenceIDRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN;
                showReferenceDate = documentRecordsType.DocumentReferenceDateRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN;
                showSubjectTags   = true; // documentRecordsType.DocumentSubjectTagsRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN;
                showSeriesTag     = documentRecordsType.DocumentSeriesTagRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN;
                showScanDate      = documentRecordsType.DocumentScanDateRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN;
            }

            if (!String.IsNullOrEmpty(process.FunctionalAreaUIControlValue))
            {
                documentFunctionalArea = new WBTerm(process.FunctionalAreasTaxonomy, process.FunctionalAreaUIControlValue);
            }
            else
            {
                documentFunctionalArea = null;
            }


            if (pageRenderingRequired)
            {
                WBLogging.Debug("In Page_Load calling RenderPage()");
                RenderPage();
            }
        }