protected void updateButton_OnClick(object sender, EventArgs e)
        {
            bool digestOK = SPContext.Current.Web.ValidateFormDigest();

            String callingUserLogin = SPContext.Current.Web.CurrentUser.LoginName;

            if (digestOK)
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (WBRecordsManager manager = new WBRecordsManager(callingUserLogin))
                    {
                        WBRecord record = manager.Libraries.GetRecordByID(RecordID.Text);

                        record.LiveOrArchived            = LiveOrArchived.SelectedValue;
                        record.ProtectiveZone            = ProtectiveZone.SelectedValue;
                        record.SubjectTagsUIControlValue = SubjectTags.Text;

                        record.Update(callingUserLogin, ReasonForChange.Text);
                    }
                });

                CloseDialogAndRefresh();
            }
            else
            {
                returnFromDialogError("The security digest for the request was not OK");
            }

            libraryWeb.Dispose();
            librarySite.Dispose();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName);
            masterLibraryHasVersions = manager.Libraries.ProtectedMasterLibrary.List.EnableVersioning;

            if (WorkBox.IsWebAWorkBox(SPContext.Current.Web))
            {
                workBox = new WorkBox(SPContext.Current);
                team    = workBox.OwningTeam;
            }
            else
            {
                team = WBTeam.GetFromTeamSite(SPContext.Current);
            }

            if (!IsPostBack && team != null)
            {
                WBQuery query = manager.GetQueryForTeamsPublicRecordsToReview(team);

                WBLogging.Debug("The query is: " + query.JustCAMLQuery(manager.Libraries.ProtectedMasterLibrary.Site));

                SPListItemCollection items = manager.Libraries.ProtectedMasterLibrary.List.WBxGetItems(manager.Libraries.ProtectedMasterLibrary.Site, query);
                RenderFoundRecords(items);
            }
        }
Esempio n. 3
0
 protected void Page_Unload(object sender, EventArgs e)
 {
     if (manager != null)
     {
         manager.Dispose();
         manager = null;
     }
 }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (WBRecordsManager manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName))
                {
                    AllRecordIDsToArchive.Value  = Request.QueryString["AllRecordIDsToArchive"];
                    ReasonToArchiveRecords.Value = Request.QueryString["ReasonToArchiveRecords"];

                    recordIDs = AllRecordIDsToArchive.Value.Split(',');
                    foreach (String recordID in recordIDs)
                    {
                        WBDocument record = manager.Libraries.ProtectedMasterLibrary.GetDocumentByID(recordID);
                        allFilenamesToArchive.Add(record.Name);
                    }

                    AllRecordFilenamesToArchive.Value = String.Join(",", allFilenamesToArchive.ToArray());

                    WBLogging.Debug("AllRecordIDsToArchive.Value = " + AllRecordIDsToArchive.Value);
                    WBLogging.Debug("AllRecordFilenamesToArchive.Value = " + AllRecordFilenamesToArchive.Value);

                    indexOfNextRecordToArchive = 0;
                    NextRecordToArchive.Text   = "" + indexOfNextRecordToArchive;
                }
            }
            else
            {
                indexOfNextRecordToArchive = NextRecordToArchive.Text.WBxToInt();
                recordIDs = AllRecordIDsToArchive.Value.Split(',');
            }

            WBLogging.Debug("recordIDs.Length = " + recordIDs.Length);

            if (indexOfNextRecordToArchive < recordIDs.Length)
            {
                String[] filenames = AllRecordFilenamesToArchive.Value.Split(',');

                WBLogging.Debug("filenames.Length = " + filenames.Length);

                for (int i = 0; i < recordIDs.Length && i < filenames.Length; i++)
                {
                    mappedFilenames.Add(i.ToString(), filenames[i]);
                }

                RecordArchivingProgress.WBxCreateTasksTable(mappedFilenames.Keys, mappedFilenames);

                Image image = (Image)RecordArchivingProgress.WBxFindNestedControlByID(RecordArchivingProgress.WBxMakeControlID(indexOfNextRecordToArchive.ToString(), "image"));
                if (image != null)
                {
                    image.ImageUrl = "/_layouts/images/WorkBoxFramework/processing-task-32.gif";
                }

                WBLogging.Debug("Finished");
            }
        }
Esempio n. 5
0
        protected void KeepNextDocument(object sender, EventArgs e)
        {
            WBLogging.Debug("Attempting to keep the next document with index: " + indexOfNextRecordToKeep + " and filename: " + mappedFilenames[indexOfNextRecordToKeep.ToString()]);

            String         callingUserLogin = SPContext.Current.Web.CurrentUser.LoginName;
            WBTaskFeedback feedback         = new WBTaskFeedback(indexOfNextRecordToKeep.ToString());

            try
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (WBRecordsManager elevatedManager = new WBRecordsManager(callingUserLogin))
                    {
                        WBRecord record             = elevatedManager.Libraries.GetRecordByID(recordIDs[indexOfNextRecordToKeep]);
                        record[WBColumn.ReviewDate] = DateTime.Now.AddYears(2);
                        record.Update(callingUserLogin, ReasonToKeepRecords.Value);

                        feedback.Success("Kept successfully");
                    }
                });
            }
            catch (Exception exception)
            {
                feedback.Failed("Keeping failed", exception);
            }

            WBLogging.Debug("Kept the document");

            RecordKeepingProgress.WBxUpdateTask(feedback);

            indexOfNextRecordToKeep++;

            NextRecordToKeep.Text = "" + indexOfNextRecordToKeep;

            if (indexOfNextRecordToKeep < recordIDs.Length)
            {
                Image image = (Image)RecordKeepingProgress.WBxFindNestedControlByID(RecordKeepingProgress.WBxMakeControlID(indexOfNextRecordToKeep.ToString(), "image"));
                image.ImageUrl = "/_layouts/images/WorkBoxFramework/processing-task-32.gif";

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "TriggerNextStepFunction", "WorkBoxFramework_triggerKeepNextDocument();", true);
            }
            else
            {
                WBLogging.Debug("Trying to set button text to done");
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ChangeDoneButtonTextFunction", "WorkBoxFramework_finishedProcessing('Done');", true);
            }
        }
Esempio n. 6
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";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WBLogging.Generic.Verbose("In Page_Load for the archival of selected records");

            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)
            {
                selectedRecordsString = Request.QueryString["SelectedRecords"];

                SelectedRecords.Value = selectedRecordsString;

                RenderRecordsToArchive();
            }
            else
            {
                selectedRecordsString = SelectedRecords.Value;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            manager = new WBRecordsManager();
            workBox = new WorkBox(SPContext.Current);

            if (!IsPostBack)
            {
                WBQuery query = new WBQuery();

                query.AddFilter(WBColumn.RecordID, WBQueryClause.Comparators.GreaterThan, 100);

                query.AddEqualsFilter(WBColumn.OwningTeam, workBox.OwningTeam);
                query.AddEqualsFilter(WBColumn.LiveOrArchived, WBColumn.LIVE_OR_ARCHIVED__LIVE);
                query.AddEqualsFilter(WBColumn.ProtectiveZone, WBRecordsType.PROTECTIVE_ZONE__PUBLIC);
                //query.AddFilter(WBColumn.ReviewDate, WBQueryClause.Comparators.LessThan, DateTime.Now);

                query.RecursiveAll = true;

                WBLogging.Debug("The query is: " + query.JustCAMLQuery(manager.Libraries.ProtectedMasterLibrary.Site));

                SPListItemCollection items = manager.Libraries.ProtectedMasterLibrary.List.WBxGetItems(manager.Libraries.ProtectedMasterLibrary.Site, query);
                RenderFoundRecords(items);
            }
        }
Esempio n. 9
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;
            }
        }
Esempio n. 11
0
        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;
                    }
                }
            }
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                String currentUserLoginName = SPContext.Current.Web.CurrentUser.LoginName;

                WBTaxonomy teams           = WBTaxonomy.GetTeams(SPContext.Current.Site);
                WBTaxonomy functionalAreas = WBTaxonomy.GetFunctionalAreas(teams);
                WBTeam     team            = WBTeam.GetFromTeamSite(teams, SPContext.Current.Web);
                if (team == null)
                {
                    WorkBox workBox = WorkBox.GetIfWorkBox(SPContext.Current);
                    if (workBox != null)
                    {
                        team = workBox.OwningTeam;
                    }
                }

                // Check if this user has permission - checking basic team membership:
                if (team == null || !team.IsCurrentUserTeamMember())
                {
                    AccessDeniedPanel.Visible          = true;
                    UpdateRecordsMetadataPanel.Visible = false;
                    AccessDeniedReason.Text            = "You are not a member of this team";
                    return;
                }

                RecordID.Text = Request.QueryString["RecordID"];
                WBLogging.Debug("Record ID is found to be: " + RecordID.Text);

                using (WBRecordsManager manager = new WBRecordsManager(currentUserLoginName))
                {
                    WBRecord record = manager.Libraries.GetRecordByID(RecordID.Text);

                    record.CheckMetadata();

                    Filename.Text    = record.Name;
                    RecordTitle.Text = record.Title;

                    String location = "<unknown>";
                    if (record.FunctionalArea != null && record.FunctionalArea.Count > 0)
                    {
                        WBLogging.Debug("Found functional area = " + record.FunctionalArea);
                        WBTerm functionalArea = record.FunctionalArea[0];
                        location = functionalArea.FullPath;
                        WBLogging.Debug("location = " + location);

                        WBTermCollection <WBTerm> teamsFunctionalAreas = team.FunctionalArea(functionalAreas);

                        if (!teamsFunctionalAreas.Contains(functionalArea))
                        {
                            WBLogging.Debug("Team functional areas UIControlValue: " + teamsFunctionalAreas.UIControlValue);
                            WBLogging.Debug("Record's functional area UIControlValue: " + functionalArea);

                            AccessDeniedPanel.Visible          = true;
                            UpdateRecordsMetadataPanel.Visible = false;
                            AccessDeniedReason.Text            = "The team " + team.Name + " does not have permission to edit this functional area: " + functionalArea.Name;
                            return;
                        }
                    }
                    location += "/" + record.RecordsType.FullPath;

                    String folders = record.ProtectedMasterRecord.LibraryRelativePath.Replace(record.Name, "").Replace(location, "");

                    RecordsLocation.Text = "<b>" + location + "</b> " + folders;

                    String status = record.RecordSeriesStatus;
                    RecordSeriesStatus.Text = status;

                    String explainStatus = "";
                    if (status == "Latest")
                    {
                        if (record.ProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PUBLIC)
                        {
                            explainStatus = "(live on the public website)";
                        }
                        else if (record.ProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PUBLIC_EXTRANET)
                        {
                            explainStatus = "(live on a public extranet website)";
                        }
                        else
                        {
                            explainStatus = "(live on izzi intranet)";
                        }
                    }
                    else if (status == "Retired")
                    {
                        explainStatus = "(visible on izzi intranet searches)";
                    }
                    else if (status == "Archived")
                    {
                        explainStatus = "(archived in the protected, master records library)";
                    }
                    ExplainStatus.Text = explainStatus;

                    RecordSeriesStatusChange.DataSource = new String[] { "", "Retire", "Archive" };
                    RecordSeriesStatusChange.DataBind();
                    RecordSeriesStatusChange.SelectedValue = "";

                    ProtectiveZone.DataSource = new String[] { WBRecordsType.PROTECTIVE_ZONE__PROTECTED, WBRecordsType.PROTECTIVE_ZONE__PUBLIC };
                    ProtectiveZone.DataBind();
                    ProtectiveZone.SelectedValue = record.ProtectiveZone;

                    manager.SubjectTagsTaxonomy.InitialiseTaxonomyControl(SubjectTags, WBColumn.SubjectTags.DisplayName, true);
                    SubjectTags.Text = record.SubjectTagsUIControlValue;

                    manager.TeamsTaxonomy.InitialiseTaxonomyControl(OwningTeam, WBColumn.OwningTeam.DisplayName, false);
                    OwningTeam.Text = record.OwningTeam.UIControlValue;

                    manager.TeamsTaxonomy.InitialiseTaxonomyControl(InvolvedTeams, WBColumn.InvolvedTeams.DisplayName, true);
                    InvolvedTeams.Text = record.InvolvedTeamsWithoutOwningTeamAsUIControlValue;
                }
            }
        }
        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();
            }
        }
Esempio n. 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String html = "<table class='wbf-record-series-details'>\n";

            html += "<tr>"
                    + "<th class='wbf-record-series-odd'>Version</th>"
                    + "<th class='wbf-record-series-even'>Filename</th>"
                    + "<th class='wbf-record-series-odd'>Published</th>"
                    + "<th class='wbf-record-series-even'>Published By</th>"
                    + "<th class='wbf-record-series-odd'>Modified</th>"
                    + "<th class='wbf-record-series-even'>Status</th>"
                    + "<th class='wbf-record-series-odd'>File Size</th>"
                    + "<th class='wbf-record-series-odd'></th>"
                    + "</tr>\n";



            String recordSeriesID = Request.QueryString["RecordSeriesID"];
            String recordID       = Request.QueryString["RecordID"];

            using (WBRecordsManager manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName))
            {
                WBRecordsLibrary masterLibrary     = manager.Libraries.ProtectedMasterLibrary;
                SPList           masterLibraryList = masterLibrary.List;
                WBQuery          query             = new WBQuery();
                if (String.IsNullOrEmpty(recordSeriesID) || recordSeriesID == recordID)
                {
                    query.AddEqualsFilter(WBColumn.RecordID, recordID);
                }
                else
                {
                    query.AddEqualsFilter(WBColumn.RecordSeriesID, recordSeriesID);
                    query.OrderBy(WBColumn.RecordSeriesIssue, false);
                }

                SPListItemCollection items = masterLibraryList.WBxGetItems(SPContext.Current.Site, query);

                /*
                 * List<WBDocument> versions = new List<WBDocument>();
                 * foreach (SPListItem item in items)
                 * {
                 *
                 *  bool notInserted = true;
                 *  for (int i = 0; i < versions.Count && notInserted; i++)
                 *  {
                 *
                 *
                 *      if (document.RecordSeriesIssue.WBxToInt() > versions[i].RecordSeriesIssue.WBxToInt())
                 *  }
                 *
                 * }
                 * */

                Dictionary <String, String> checklistTextMap = manager.GetChecklistTextMap();

                if (masterLibrary.List.EnableVersioning)
                {
                    foreach (SPListItem item in items)
                    {
                        SPListItemVersionCollection versionCollection = item.Versions;

                        int versionCount = item.Versions.Count;

                        WBLogging.Debug("Item versions count | File versions count: " + versionCount + " | " + item.File.Versions.Count);

                        for (int i = 0; i < versionCount; i++)
                        {
                            SPListItemVersion version  = versionCollection[i];
                            WBDocument        document = new WBDocument(masterLibrary, version);
                            // We're going to render the minor version numbers counting up - even though lower index values are for more recent versions:
                            html += RenderHTMLForOneDocumentVersion(checklistTextMap, document, document.RecordSeriesIssue, (versionCount - 1 - i).ToString(), i);
                        }
                    }
                }
                else
                {
                    foreach (SPListItem item in items)
                    {
                        WBDocument document = new WBDocument(masterLibrary, item);
                        html += RenderHTMLForOneDocumentVersion(checklistTextMap, document, document.RecordSeriesIssue, null, -1);
                    }
                }
            }

            html += "</table>";

            ViewRecordSeriesTable.Text = html;
        }
        protected void publishButton_OnClick(object sender, EventArgs e)
        {
            WBLogging.Debug("In publishButton_OnClick()");

            Hashtable metadataProblems = checkMetadataState();

            string protectiveZone = "";


            if (metadataProblems.Count > 0)
            {
                RecordsTypeFieldMessage.Text = metadataProblems[WorkBox.COLUMN_NAME__RECORDS_TYPE].WBxToString();

                FunctionalAreaFieldMessage.Text = metadataProblems[WorkBox.COLUMN_NAME__FUNCTIONAL_AREA].WBxToString();
                ProtectiveZoneMessage.Text      = metadataProblems[WorkBox.COLUMN_NAME__PROTECTIVE_ZONE].WBxToString();

                //               SubjectTagsMessage.Text = metadataProblems[WorkBox.COLUMN_NAME__SUBJECT_TAGS].WBxToString();
                ReferenceIDMessage.Text    = metadataProblems[WorkBox.COLUMN_NAME__REFERENCE_ID].WBxToString();;
                ReferenceDateMessage.Text  = metadataProblems[WorkBox.COLUMN_NAME__REFERENCE_DATE].WBxToString();;
                SeriesTagFieldMessage.Text = metadataProblems[WorkBox.COLUMN_NAME__SERIES_TAG].WBxToString();
                ScanDateMessage.Text       = metadataProblems[WorkBox.COLUMN_NAME__SCAN_DATE].WBxToString();

                OwningTeamFieldMessage.Text    = metadataProblems[WorkBox.COLUMN_NAME__OWNING_TEAM].WBxToString();
                InvolvedTeamsFieldMessage.Text = metadataProblems[WorkBox.COLUMN_NAME__INVOLVED_TEAMS].WBxToString();

                pageRenderingRequired = true;
            }
            else
            {
                pageRenderingRequired = false;
            }

            if (pageRenderingRequired)
            {
                WBLogging.Debug("In publishButton_OnClick(): Page render required - not publishing at this point");
                renderPage();
            }
            else
            {
                WBLogging.Debug("In publishButton_OnClick(): No page render required - so moving to publish");

                // The event should only be processed if there is no other need to render the page again

                // First let's update the item with the new metadata values submitted:
                SPDocumentLibrary sourceDocLib    = (SPDocumentLibrary)SPContext.Current.Web.Lists[new Guid(ListGUID.Value)];
                SPListItem        sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(ItemID.Value));

                WBDocument document = CaptureAsDocument(sourceDocAsItem, documentRecordsType);

                document.Update();

                /*
                 *
                 *   OK So now we actually publish out the document:
                 *
                 */


                SPFile sourceFile   = sourceDocAsItem.File;
                string errorMessage = "";

                string successMessage = "<h3>Successfully Published Out</h3> <table cellpadding='5'>";
                if (TheDestinationType.Value.Equals(WorkBox.PUBLISHING_OUT_DESTINATION_TYPE__WORK_BOX))
                {
                    using (WorkBox workBox = new WorkBox(DestinationURL.Value))
                    {
                        string selectedFolderPath = Request.QueryString["SelectedFolderPath"];
                        if (string.IsNullOrEmpty(selectedFolderPath))
                        {
                            selectedFolderPath = "/";
                        }

                        string destinationRootFolderUrl = DestinationURL.Value + "/" + workBox.DocumentLibrary.RootFolder.Url + selectedFolderPath;

                        errorMessage = sourceFile.WBxCopyTo(destinationRootFolderUrl, new List <String>());

                        if (errorMessage == "")
                        {
                            successMessage += "<tr><td>Filename</td><td><b>" + sourceFile.Name + "</b></td></tr><tr><td>Published out to:</td><td><a href=\"" + destinationRootFolderUrl + "\"><b>" + destinationRootFolderUrl + "</b></a></td></tr>";
                        }
                    }
                }
                else
                {
                    // WBRecordsType recordsType = new WBRecordsType(recordsTypeTaxonomy, document[WBColumn.RecordsType].WBxToString());

                    using (WBRecordsManager manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName))
                    {
                        try
                        {
                            WBLogging.Debug("In publishButton_OnClick(): About to try to publish");

                            manager.PublishDocument(WorkBox, document);

                            WBLogging.Debug("In publishButton_OnClick(): Should have finished the publishing");

                            //recordsType.PublishDocument(document, sourceFile.OpenBinaryStream());

                            string fullClassPath = "Just a test"; //  WBUtils.NormalisePath(document.FunctionalArea.Names() + "/" + recordsType.FullPath);

                            successMessage += "<tr><td>Published out to location:</td><td>" + fullClassPath + "</td></tr>\n";


                            if (document.ProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PUBLIC)
                            {
                                successMessage += "<tr><td>To public records library</td><td><a href=\"http://stagingweb/publicrecords\">Our public library</a></td></tr>\n";
                            }

                            if (document.ProtectiveZone == WBRecordsType.PROTECTIVE_ZONE__PUBLIC_EXTRANET)
                            {
                                successMessage += "<tr><td>To public extranet records library</td><td><a href=\"http://stagingextranets/records\">Our public extranet library</a></td></tr>\n";
                            }

                            successMessage += "<tr><td>To internal records library</td><td><a href=\"http://sp.izzi/library/Pages/ViewByFunctionThenType.aspx\">Our internal library</a></td></tr>\n";
                        }
                        catch (Exception exception)
                        {
                            errorMessage = "An error occurred when trying to publish: " + exception.Message;
                            WBLogging.Generic.Unexpected(exception);
                        }
                    }
                }

/*
 *              WBFarm farm = WBFarm.Local;
 *              string destinationRootFolderUrl = farm.ProtectedRecordsLibraryUrl;
 *              List<String> filingPath = null;
 *
 *
 *              filingPath = documentRecordsType.FilingPathForItem(sourceDocAsItem);
 *
 *              string filingPathString = string.Join("/", filingPath.ToArray());
 *
 *              WBLogging.Generic.Verbose("The file is: " + sourceFile.Url);
 *              WBLogging.Generic.Verbose("The destination is: " + destinationRootFolderUrl);
 *              WBLogging.Generic.Verbose("The destination filing path is: " + filingPathString);
 *
 *
 *              string errorMessage = sourceFile.WBxCopyTo(destinationRootFolderUrl, filingPath);
 *
 *              if (errorMessage == "")
 *              {
 *                  successMessage += "<tr><td>Filename</td><td><b>" + sourceFile.Name + "</b></td></tr><tr><td>Published out to:</td><td><a href=\"" + destinationRootFolderUrl + "\"><b>" + destinationRootFolderUrl + "</b></a></td></tr><tr><td>Filing path:</td><td><a href=\"" + destinationRootFolderUrl + "/" + filingPathString + "\"><b>" + filingPathString + "</b></td></tr>";
 *              }
 *
 *              WBLogging.Generic.Verbose("Protective zone was set to be: " + protectiveZone);
 *
 *
 *              if (!TheDestinationType.Value.Equals(WorkBox.PUBLISHING_OUT_DESTINATION_TYPE__WORK_BOX)
 *                  && protectiveZone.Equals(WBRecordsType.PROTECTIVE_ZONE__PUBLIC))
 *              {
 *                  // OK so we're going to copy this to the public library as well:
 *              WBLogging.Generic.Verbose("The file is: " + sourceFile.Url);
 *              WBLogging.Generic.Verbose("The destination is: " + farm.PublicRecordsLibraryUrl);
 *              WBLogging.Generic.Verbose("The destination filing path is: " + filingPathString);
 *
 *                  string errorMessagePublic = sourceFile.WBxCopyTo(farm.PublicRecordsLibraryUrl, filingPath);
 *
 *                  if (errorMessagePublic == "")
 *                  {
 *                      successMessage += "<tr><td colspan='2'><b>And also published to the public library.</b></td></tr>";
 *                  }
 *              }
 *
 *              if (!TheDestinationType.Value.Equals(WorkBox.PUBLISHING_OUT_DESTINATION_TYPE__WORK_BOX)
 *                  && protectiveZone.Equals(WBRecordsType.PROTECTIVE_ZONE__PUBLIC_EXTRANET))
 *              {
 *                  // OK so we're going to copy this to the public extranet library as well:
 *                  WBLogging.Generic.Verbose("The file is: " + sourceFile.Url);
 *                  WBLogging.Generic.Verbose("The destination is: " + farm.PublicExtranetRecordsLibraryUrl);
 *                  WBLogging.Generic.Verbose("The destination filing path is: " + filingPathString);
 *
 *                  string errorMessagePublicExtranet = sourceFile.WBxCopyTo(farm.PublicExtranetRecordsLibraryUrl, filingPath);
 *
 *                  if (errorMessagePublicExtranet == "")
 *                  {
 *                      successMessage += "<tr><td colspan='2'><b>And also published to the public extranet library.</b></td></tr>";
 *                  }
 *              }
 */
                successMessage += "</table>";

                if (errorMessage == "")
                {
                    //returnFromDialogOKAndRefresh();
                    GoToGenericOKPage("Publishing Out Success", successMessage);
                }
                else
                {
                    GoToGenericOKPage("Publishing Out Error", errorMessage);

                    //returnFromDialogOK("An error occurred during publishing: " + errorMessage);
                }
            }
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            manager = new WBRecordsManager(SPContext.Current.Web.CurrentUser.LoginName);

            if (WorkBox.IsWebAWorkBox(SPContext.Current.Web))
            {
                workBox = new WorkBox(SPContext.Current);
                team    = workBox.OwningTeam;
                functionalAreasTaxonomy = workBox.FunctionalAreasTaxonomy;
            }
            else
            {
                team = WBTeam.GetFromTeamSite(SPContext.Current);
                if (team != null)
                {
                    teamsTaxonomy           = team.Taxonomy;
                    functionalAreasTaxonomy = WBTaxonomy.GetFunctionalAreas(teamsTaxonomy);
                }
            }

            if (team == null)
            {
                WBLogging.Debug("Couldn't find a suitable team !!");
                return;
            }

            masterLibraryHasVersions = manager.Libraries.ProtectedMasterLibrary.List.EnableVersioning;

            RecordsLibraryFolders.TreeNodePopulate += new TreeNodeEventHandler(RecordsLibraryFolders_TreeNodePopulate);
            // RecordsLibraryFolders.SelectedNodeChanged += new EventHandler(RecordsLibraryFolders_SelectedNodeChanged);

            RecordsLibraryFolders.PopulateNodesFromClient = true;
            RecordsLibraryFolders.EnableClientScript      = true;

            treeState = new WBLocationTreeState(SPContext.Current.Web, WBRecordsManager.VIEW_MODE__BROWSE_FOLDERS, WBRecordsType.PROTECTIVE_ZONE__PUBLIC);

            if (!IsPostBack)
            {
                WBTermCollection <WBTerm> functionalAreas = team.FunctionalArea(functionalAreasTaxonomy);

                ViewState["SortColumn"]    = WBColumn.DatePublished.InternalName;
                ViewState["SortDirection"] = "Descending";

                /*
                 * TreeViewLocationCollection collection = new TreeViewLocationCollection(manager, , "", functionalAreas);
                 *
                 * RecordsLibraryFolders.DataSource = collection;
                 * RecordsLibraryFolders.DataBind();
                 */

                manager.PopulateWithFunctionalAreas(treeState, RecordsLibraryFolders.Nodes, WBRecordsManager.VIEW_MODE__BROWSE_FOLDERS, functionalAreas);
            }
            else
            {
                SetSelectedPath();
                if (!String.IsNullOrEmpty(selectedPath))
                {
                    ProcessSelection(selectedPath);
                }
            }
        }
Esempio n. 17
0
        protected void updateButton_OnClick(object sender, EventArgs e)
        {
            /* Something here appears to be causing an authentication error
             * if (team == null || !team.IsCurrentUserTeamMember())
             * {
             *  return;
             * }
             * WBTermCollection<WBTerm> teamsFunctionalAreas = team.FunctionalArea(teams);
             */

            String callingUserLogin = SPContext.Current.Web.CurrentUser.LoginName;

            if (true)
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (WBRecordsManager elevatedManager = new WBRecordsManager(callingUserLogin))
                    {
                        WBRecord record = elevatedManager.Libraries.GetRecordByID(RecordID.Text);

                        // Just making sure that any old records have any missing metadata filled in before the update is applied:
                        record.CheckMetadata();

                        /* Something here appears to be causing an authentication error
                         * // Let's just double check the permissions to edit:
                         * WBTermCollection<WBTerm> recordsFunctionalAreas = record.FunctionalArea;
                         * if (recordsFunctionalAreas != null && recordsFunctionalAreas.Count > 0)
                         * {
                         *  WBTerm functionalArea = record.FunctionalArea[0];
                         *  if (!teamsFunctionalAreas.Contains(functionalArea))
                         *  {
                         *      throw new Exception("You are trying to edit a record (" + record.RecordID + ") which has a functional area (" + functionalArea.Name + ") that your team (" + team.Name + ") doesn't have permission to edit!");
                         *  }
                         * }
                         */

                        if (RecordSeriesStatusChange.SelectedValue == "Retire")
                        {
                            if (record.RecordSeriesStatus == "Latest")
                            {
                                record.RecordSeriesStatus = "Retired";
                            }
                        }
                        if (RecordSeriesStatusChange.SelectedValue == "Archive")
                        {
                            record.RecordSeriesStatus = "Archived";
                            record.LiveOrArchived     = "Archived";
                        }

                        record.Title                     = RecordTitle.Text;
                        record.ProtectiveZone            = ProtectiveZone.SelectedValue;
                        record.SubjectTagsUIControlValue = SubjectTags.Text;
                        record.OwningTeamUIControlValue  = OwningTeam.Text;
                        record.InvolvedTeamsWithoutOwningTeamAsUIControlValue = InvolvedTeams.Text;

                        if (record.ProtectiveZone != WBRecordsType.PROTECTIVE_ZONE__PROTECTED && record.Metadata.IsNullOrEmpty(WBColumn.ReviewDate))
                        {
                            record[WBColumn.ReviewDate] = DateTime.Now.AddYears(2);
                        }

                        WBLogging.Debug("About to udpate with callingUser = "******"The security digest for the request was not OK");
            }
        }