Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            recordsTypesTaxonomy   = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);
            teamsTaxonomy          = WBTaxonomy.GetTeams(recordsTypesTaxonomy);
            functionalAreaTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypesTaxonomy);
            subjectTagsTaxonomy    = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy);


            SelectedView = VIEW_BY_FUNCTION_THEN_TYPE;

            if (!IsPostBack)
            {
            }

            RefreshBrowsableTreeView();

            ShowResults.AllowSorting = true;
            ShowResults.Sorting     += new GridViewSortEventHandler(ShowResults_Sorting);

            ShowResults.AllowPaging                   = true;
            ShowResults.PageIndexChanging            += new GridViewPageEventHandler(ShowResults_PageIndexChanging);
            ShowResults.PagerSettings.Mode            = PagerButtons.Numeric;
            ShowResults.PagerSettings.Position        = PagerPosition.Bottom;
            ShowResults.PagerSettings.PageButtonCount = 50;
            ShowResults.PagerSettings.Visible         = true;
            ShowResults.PageSize = 50;

            // this odd statement is required in order to get the pagination to work with an SPGridView!
            ShowResults.PagerTemplate = null;
        }
        //protected String popupMessage = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            SPSite site = SPContext.Current.Site;

            recordsTypes    = WBTaxonomy.GetRecordsTypes(site);
            seriesTags      = WBTaxonomy.GetSeriesTags(recordsTypes);
            functionalAreas = WBTaxonomy.GetFunctionalAreas(recordsTypes);

            WBUtils.logMessage("Records Types object has been recreated");

            functionalAreas.InitialiseTaxonomyControl(DefaultFunctionalArea, "Select Default Functional Area", false, false, this);

            recordsTypes.InitialiseTaxonomyControl(DefaultRecordsType, "Select Default Publishing Out Records Type", false, false, this);

            seriesTags.InitialiseTaxonomyControl(DocumentSeriesTagParentTerm, "Select the Series Tag Parent", false, true, this);
            seriesTags.InitialiseTaxonomyControl(WorkBoxSeriesTagParentTerm, "Select the Series Tag Parent", false, true, this);

            if (!IsPostBack)
            {
                TreeViewTermCollection collection = new TreeViewTermCollection(recordsTypes.TermSet);

                // Bind the data source to your collection
                AllRecordsTypesTreeView.DataSource = collection;
                AllRecordsTypesTreeView.DataBind();
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WBRecordsType recordsType = WorkBox.RecordsType;

            if (recordsType.WorkBoxReferenceIDRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN)
            {
                showReferenceID = true;
            }

            if (recordsType.WorkBoxReferenceDateRequirement != WBRecordsType.METADATA_REQUIREMENT__HIDDEN)
            {
                showReferenceDate = true;
            }

            if (!IsPostBack)
            {
                WorkBoxTitle.Text       = WorkBox.Title;
                OwningTeam.Text         = WorkBox.OwningTeam.Name;
                FunctionalArea.Text     = WorkBox.FunctionalArea(WBTaxonomy.GetFunctionalAreas(WorkBox.RecordsTypes)).Names();
                RecordsType.Text        = recordsType.FullPath;
                WorkBoxTemplate.Text    = WorkBox.Template.Title;
                WorkBoxStatus.Text      = WorkBox.Status;
                WorkBoxURL.Text         = WorkBox.Url;
                WorkBoxShortTitle.Text  = WorkBox.ShortTitle;
                WorkBoxPrettyTitle.Text = WorkBox.Web.Title;

                if (showReferenceID)
                {
                    ReferenceID.Text = WorkBox.ReferenceID;
                }

                if (showReferenceDate)
                {
                    if (WorkBox.ReferenceDateHasValue)
                    {
                        ReferenceDate.Text = WorkBox.ReferenceDate.ToShortDateString();
                    }
                }

                WBAction editAction = WorkBox.GetAction(WBAction.ACTION_KEY__EDIT_PROPERTIES);
                EditButton.Enabled = editAction.IsEnabled;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WBRecordsType recordsType = WorkBox.RecordsType;

            if (recordsType.WorkBoxReferenceIDRequirement == WBRecordsType.METADATA_REQUIREMENT__HIDDEN)
            {
                showReferenceID = false;
            }

            if (recordsType.WorkBoxReferenceDateRequirement == WBRecordsType.METADATA_REQUIREMENT__HIDDEN)
            {
                showReferenceDate = false;
            }

            if (!IsPostBack)
            {
                WorkBoxTitle.Text       = WorkBox.Title;
                OwningTeam.Text         = WorkBox.OwningTeam.Name;
                FunctionalArea.Text     = WorkBox.FunctionalArea(WBTaxonomy.GetFunctionalAreas(WorkBox.RecordsTypes)).Names();
                RecordsType.Text        = recordsType.FullPath;
                WorkBoxTemplate.Text    = WorkBox.Template.Title;
                WorkBoxStatus.Text      = WorkBox.Status;
                WorkBoxURL.Text         = WorkBox.Url;
                WorkBoxShortTitle.Text  = WorkBox.ShortTitle;
                WorkBoxPrettyTitle.Text = WorkBox.Web.Title;

                WorkBoxShortTitle.Focus();

                if (showReferenceID)
                {
                    ReferenceID.Text = WorkBox.ReferenceID;
                }

                if (showReferenceDate)
                {
                    if (WorkBox.ReferenceDateHasValue)
                    {
                        ReferenceDate.SelectedDate = WorkBox.ReferenceDate;
                    }
                }
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as ViewTeamsPublishedDocuments;

            recordsTypesTaxonomy   = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);
            teamsTaxonomy          = WBTaxonomy.GetTeams(recordsTypesTaxonomy);
            functionalAreaTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypesTaxonomy);
            subjectTagsTaxonomy    = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy);

            //RefreshBrowsableTreeView();

            ShowResults.AllowSorting = true;
            ShowResults.Sorting     += new GridViewSortEventHandler(ShowResults_Sorting);

            ShowResults.AllowPaging                   = true;
            ShowResults.PageIndexChanging            += new GridViewPageEventHandler(ShowResults_PageIndexChanging);
            ShowResults.PagerSettings.Mode            = PagerButtons.Numeric;
            ShowResults.PagerSettings.Position        = PagerPosition.Bottom;
            ShowResults.PagerSettings.PageButtonCount = 50;
            ShowResults.PagerSettings.Visible         = true;
            ShowResults.PageSize = 50;

            // this odd statement is required in order to get the pagination to work with an SPGridView!
            ShowResults.PagerTemplate = null;


            if (!IsPostBack)
            {
                //                ViewSelector.DataSource = LibraryViews;
                //              ViewSelector.DataBind();

                //ProtectiveZoneFilterOptions = WBRecordsType.getProtectiveZones();
                // ProtectiveZoneFilterOptions.Insert(0, "");

                // FilterByProtectiveZone.DataSource = ProtectiveZoneFilterOptions;
                // FilterByProtectiveZone.DataBind();

                SelectedView = VIEW_BY_FUNCTION_THEN_TYPE;

                RefreshBoundData();
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SPSite site = SPContext.Current.Site;

            teams           = WBTaxonomy.GetTeams(site);
            functionalAreas = WBTaxonomy.GetFunctionalAreas(teams);

            functionalAreas.InitialiseTaxonomyControl(TeamFunctionalAreas, "Select Functional Area(s)", true, false, this);


            if (!IsPostBack)
            {
                TreeViewTermCollection collection = new TreeViewTermCollection();
                collection.Add(new TreeViewTerm(teams.TermSet));

                // Bind the data source to your collection
                AllTeamsTreeView.DataSource = collection;
                AllTeamsTreeView.DataBind();
            }
        }
Esempio n. 7
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);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WBLogging.Generic.Verbose("In Page_Load for the public doc metadata dialog");

            // Creating the taxonomy objects for later use:
            recordsTypeTaxonomy     = WBTaxonomy.GetRecordsTypes(WorkBox.Site);
            teamsTaxonomy           = WBTaxonomy.GetTeams(recordsTypeTaxonomy);
            seriesTagsTaxonomy      = WBTaxonomy.GetSeriesTags(recordsTypeTaxonomy);
            subjectTagsTaxonomy     = WBTaxonomy.GetSubjectTags(recordsTypeTaxonomy);
            functionalAreasTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypeTaxonomy);

            // 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)
            {
                ListGUID.Value = Request.QueryString["ListGUID"];
                ItemID.Value   = Request.QueryString["ItemID"];

                // The following variable has its name due to a strange compliation error with the name 'DestinationType'
                TheDestinationType.Value = Request.QueryString["DestinationType"];
                DestinationURL.Value     = Request.QueryString["DestinationURL"];
                DestinationTitle.Text    = Request.QueryString["DestinationTitle"] + " (" + Request.QueryString["DestinationType"] + ")";

                WBLogging.Generic.Verbose("DestinationType = " + TheDestinationType.Value);
                WBLogging.Generic.Verbose("DestinationURL = " + DestinationURL.Value);
            }

            // Now do a check that we do at this stage have the basic details of the document:
            if (ListGUID.Value == null || ListGUID.Value == "")
            {
                errorMessage += "ListGUID hasn't been set. ";
            }

            if (ItemID.Value == null || ItemID.Value == "")
            {
                errorMessage += "ItemID hasn't been set. ";
            }

            if (TheDestinationType.Value == null || TheDestinationType.Value == "")
            {
                errorMessage += "DestinationType hasn't been set. ";
            }

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

            // Let's clear out all of the error messages text fields:
            ErrorMessageLabel.Text          = "";
            RecordsTypeFieldMessage.Text    = "";
            FunctionalAreaFieldMessage.Text = "";
            ProtectiveZoneMessage.Text      = "";
            ReferenceIDMessage.Text         = "";
            ReferenceDateMessage.Text       = "";
            SeriesTagFieldMessage.Text      = "";
            ScanDateMessage.Text            = "";
            OwningTeamFieldMessage.Text     = "";
            InvolvedTeamsFieldMessage.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(ListGUID.Value);
            SPDocumentLibrary sourceDocLib = (SPDocumentLibrary)WorkBox.Web.Lists[sourceListGuid];

            sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(ItemID.Value));
            sourceFile      = sourceDocAsItem.File;

            generatingFilename = WorkBox.RecordsType.GeneratePublishOutFilenames;

            // Now, if this is the first time we might need to load up the default metadata values for the document:
            if (!IsPostBack)
            {
                WorkBox.Web.AllowUnsafeUpdates = true;
                WorkBox.ApplyPublishOutDefaults(sourceDocAsItem);
                WorkBox.Web.AllowUnsafeUpdates = false;

                // Let's now re-load the item as it's name may have changed:
                sourceDocAsItem       = null;
                sourceDocAsItem       = sourceDocLib.GetItemById(int.Parse(ItemID.Value));
                sourceFile            = sourceDocAsItem.File;
                pageRenderingRequired = true;
            }
            else
            {
                WBLogging.Debug("Setting the subject tags: " + SubjectTagsField.Text);
                sourceDocAsItem.WBxSetMultiTermColumn(WorkBox.COLUMN_NAME__SUBJECT_TAGS, SubjectTagsField.Text);


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

                    WBRecordsType oldRecordsType = sourceDocAsItem.WBxGetSingleTermColumn <WBRecordsType>(recordsTypeTaxonomy, WorkBox.COLUMN_NAME__RECORDS_TYPE);
                    WBRecordsType newRecordsType = new WBRecordsType(recordsTypeTaxonomy, NewRecordsTypeUIControlValue.Value);

                    RecordsTypeUIControlValue.Value = NewRecordsTypeUIControlValue.Value;
                    RecordsType.Text      = newRecordsType.Name;
                    pageRenderingRequired = true;

                    // These are now being done in CaptureAsDocument()
                    // sourceDocAsItem.WBxSetSingleTermColumn(WorkBox.COLUMN_NAME__RECORDS_TYPE, NewRecordsTypeUIControlValue.Value);
                    // sourceDocAsItem.WBxSet(WBColumn.Title, this.TitleField.Text);

                    // This is now being done in CaptureAsDocument()
                    // WorkBox.GenerateFilename(newRecordsType, sourceDocAsItem);

                    // If either the old or new records type have an uneditable functional area, then we'll update it to the new default area.
                    if (!oldRecordsType.IsFunctionalAreaEditable || !newRecordsType.IsFunctionalAreaEditable)
                    {
                        WBLogging.Debug("Setting the functional area as it's not editable: " + newRecordsType.DefaultFunctionalAreaUIControlValue);
                        this.FunctionalAreaField.Text = newRecordsType.DefaultFunctionalAreaUIControlValue;
                        sourceDocAsItem.WBxSetMultiTermColumn(WorkBox.COLUMN_NAME__FUNCTIONAL_AREA, newRecordsType.DefaultFunctionalAreaUIControlValue);
                    }

/* This is now being done in CaptureAsDocument()
 *                  else
 *                  {
 *                      WBLogging.Debug("Saving the current functional area selection: " + this.FunctionalAreaField.Text);
 *                      sourceDocAsItem.WBxSetMultiTermColumn(WorkBox.COLUMN_NAME__FUNCTIONAL_AREA, this.FunctionalAreaField.Text);
 *                  }
 */

                    WBDocument document = CaptureAsDocument(sourceDocAsItem, newRecordsType);
                    document.Update();

                    // Let's now re-load the item as it's name may have changed:
                    sourceDocAsItem = null;
                    sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(ItemID.Value));
                    sourceFile      = sourceDocAsItem.File;
                }
                else
                {
                    // Otherwise we are in a normal post back call.
                    pageRenderingRequired = false;
                }
            }



            // Now load up some of the basic details:
            documentRecordsType = sourceDocAsItem.WBxGetSingleTermColumn <WBRecordsType>(recordsTypeTaxonomy, WorkBox.COLUMN_NAME__RECORDS_TYPE);

            destinationType = TheDestinationType.Value;

            // 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 (pageRenderingRequired)
            {
                renderPage();
            }
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SPSite site = SPContext.Current.Site;
                SPWeb  web  = SPContext.Current.Web;

                WBTaxonomy teams           = WBTaxonomy.GetTeams(site);
                WBTaxonomy functionalAreas = WBTaxonomy.GetFunctionalAreas(teams);

                teams.InitialiseTaxonomyControl(TeamTerm, "Select Team Term", false);
                teams.InitialiseTaxonomyControl(ParentTeamTerm, "Select the Parent Team Term", false);
                functionalAreas.InitialiseTaxonomyControl(TeamFunctionalAreas, "Select the functional area", true);

                TeamName.Text = web.Title;

                WBTeam team = WBTeam.GetFromTeamSite(teams, web);
                if (team != null)
                {
                    TeamTerm.Text    = team.UIControlValue;
                    TeamAcronym.Text = team.Acronym;

                    TeamFunctionalAreas.Text      = team.FunctionalAreaUIControlValue;
                    UseAllFunctionalAreas.Checked = team.UseAllFunctionalAreas;

                    if (TeamFunctionalAreas.Text == "")
                    {
                        InheritedFunctionalAreas.Text = team.FunctionalArea(functionalAreas).Names();
                    }
                    else
                    {
                        InheritedFunctionalAreas.Text = "";
                    }

                    InformationAssetOwner.WBxInitialise(team.InformationAssetOwner(web));
                    TeamManager.WBxInitialise(team.Manager(web));

                    TeamOwnersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.OwnersGroupName));
                    TeamMembersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.MembersGroupName));
                    TeamPublishersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(team.PublishersGroupName));

                    TeamTerm.Enabled       = false;
                    ParentTeamTerm.Enabled = false;
                    TeamOwnersSharePointUserGroup.Enabled  = false;
                    TeamMembersSharePointUserGroup.Enabled = false;
                    RecordsTypesListUrl.Text = team.RecordsTypesListUrl;
                }
                else
                {
                    TeamTerm.Text = "";

                    SPWeb  parentWeb  = web.ParentWeb;
                    WBTeam parentTeam = WBTeam.GetFromTeamSite(teams, parentWeb);

                    if (parentTeam != null)
                    {
                        ParentTeamTerm.Text = parentTeam.UIControlValue;

                        InheritedFunctionalAreas.Text = parentTeam.FunctionalArea(functionalAreas).Names();

                        RecordsTypesListUrl.Text = parentTeam.RecordsTypesListUrl;
                    }

                    TeamOwnersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(web.Title + " - Owners"));
                    TeamMembersSharePointUserGroup.UpdateEntities(WBUtils.CreateEntitiesArrayList(web.Title + " - Members"));
                }
            }
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as ViewRecordsLibraryWebPart;

            recordsTypesTaxonomy   = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);
            teamsTaxonomy          = WBTaxonomy.GetTeams(recordsTypesTaxonomy);
            functionalAreaTaxonomy = WBTaxonomy.GetFunctionalAreas(recordsTypesTaxonomy);
            subjectTagsTaxonomy    = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy);


            if (!IsPostBack)
            {
//                ViewSelector.DataSource = LibraryViews;
//              ViewSelector.DataBind();

                ProtectiveZoneFilterOptions = WBRecordsType.getProtectiveZones();
                ProtectiveZoneFilterOptions.Insert(0, "");

                FilterByProtectiveZone.DataSource = ProtectiveZoneFilterOptions;
                FilterByProtectiveZone.DataBind();

                string selectedView = webPart.RecordsLibraryView;

                if (!String.IsNullOrEmpty(Request.QueryString["FolderPath"]))
                {
                    selectedView     = VIEW_BY_FOLDER_PATH;
                    SelectedNodePath = Request.QueryString["FolderPath"];
                }


                if (String.IsNullOrEmpty(selectedView))
                {
                    selectedView = VIEW_BY_RECORDS_TYPE;
                }

                SelectedViewTitle.Text = selectedView;
                SelectedView           = selectedView;
            }


            RefreshBrowsableTreeView();

            ShowResults.AllowSorting = true;
            ShowResults.Sorting     += new GridViewSortEventHandler(ShowResults_Sorting);

            ShowResults.AllowPaging                   = true;
            ShowResults.PageIndexChanging            += new GridViewPageEventHandler(ShowResults_PageIndexChanging);
            ShowResults.PagerSettings.Mode            = PagerButtons.Numeric;
            ShowResults.PagerSettings.Position        = PagerPosition.Bottom;
            ShowResults.PagerSettings.PageButtonCount = 50;
            ShowResults.PagerSettings.Visible         = true;
            ShowResults.PageSize = 50;

            // this odd statement is required in order to get the pagination to work with an SPGridView!
            ShowResults.PagerTemplate = null;

            if (SelectedView == VIEW_BY_FOLDER_PATH)
            {
                RefreshBoundData();
            }
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string relatedWorkBoxUrl     = "";
            string recordsTypeGUIDString = "";

            // Set the reference date control to match the locally set locale:
            ReferenceDate.LocaleId = SPContext.Current.Web.Locale.LCID;

            recordsTypes    = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);
            teams           = WBTaxonomy.GetTeams(recordsTypes);
            seriesTags      = WBTaxonomy.GetSeriesTags(recordsTypes);
            functionalAreas = WBTaxonomy.GetFunctionalAreas(recordsTypes);

            if (!IsPostBack)
            {
                WorkBoxCollectionUrl.Value = Request.QueryString["workBoxCollectionUrl"];
                pageRenderingRequired      = true;

                recordsTypeGUIDString = Request.QueryString["recordsTypeGUID"];
                RecordsTypeGUID.Value = recordsTypeGUIDString;

                if (recordsTypeGUIDString != "")
                {
                    workBoxRecordsType = recordsTypes.GetRecordsType(new Guid(recordsTypeGUIDString));
                }
                else
                {
                    WBLogging.Generic.Unexpected("The records type GUID appears to be blank in initial call to page!");
                }


                // Now to setup some default intiail values:

                ReferenceDate.SelectedDate = DateTime.Now;

                functionalAreaFieldIsEditable = workBoxRecordsType.IsFunctionalAreaEditable;

                string owningTeamGuidString = Request.QueryString["owningTeamGUID"];
                WBTeam owningTeam           = null;

                if (owningTeamGuidString != null && !owningTeamGuidString.Equals(""))
                {
                    owningTeam = teams.GetTeam(new Guid(owningTeamGuidString));

                    OwningTeamField.Text           = owningTeam.Name; //  UIControlValue;
                    OwningTeamUIControlValue.Value = owningTeam.UIControlValue;

                    InvolvedTeamsField.Text = owningTeam.UIControlValue;
                }

                relatedWorkBoxUrl       = Request.QueryString["relatedWorkBoxURL"];
                RelatedWorkBoxUrl.Value = relatedWorkBoxUrl;
                RelationType.Value      = Request.QueryString["relationType"];
                if (relatedWorkBoxUrl != null && relatedWorkBoxUrl != "")
                {
                    relatedWorkBox = new WorkBox(relatedWorkBoxUrl);

                    ReferenceID.Text = relatedWorkBox.ReferenceID;

                    WBTerm seriesTag = relatedWorkBox.SeriesTag(seriesTags);
                    if (seriesTag != null)
                    {
                        seriesTagInitialValue = seriesTag.UIControlValue;
                    }

                    owningTeam                     = relatedWorkBox.OwningTeam;
                    OwningTeamField.Text           = owningTeam.Name; //  UIControlValue;
                    OwningTeamUIControlValue.Value = owningTeam.UIControlValue;
                    InvolvedTeamsField.Text        = relatedWorkBox.InvolvedTeams.UIControlValue;
                }


                // Now let's setup the initial value for the functional area:
                if (functionalAreaFieldIsEditable)
                {
                    functionalAreaInitialValue = workBoxRecordsType.DefaultFunctionalAreaUIControlValue;

                    if (functionalAreaInitialValue == null || functionalAreaInitialValue == "")
                    {
                        if (owningTeam != null)
                        {
                            functionalAreaInitialValue = owningTeam.FunctionalArea(functionalAreas).UIControlValue;
                        }
                    }
                }
                else
                {
                    functionalAreaInitialValue = workBoxRecordsType.DefaultFunctionalAreaUIControlValue;
                }
            }
            else
            {
                WBUtils.logMessage("In the postback with workBoxCollectionUrl = " + WorkBoxCollectionUrl.Value);
                pageRenderingRequired = false;

                relatedWorkBoxUrl = RelatedWorkBoxUrl.Value;

                recordsTypeGUIDString = RecordsTypeGUID.Value;

                if (recordsTypeGUIDString != "")
                {
                    workBoxRecordsType = recordsTypes.GetRecordsType(new Guid(recordsTypeGUIDString));
                }
                else
                {
                    WBLogging.Generic.Unexpected("The records type GUID appears to be blank in postback!");
                }
            }



            if (pageRenderingRequired)
            {
                renderPage();
            }
        }
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;
                }
            }
        }