protected void Page_Load(object sender, EventArgs e)
        {
            subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(SPContext.Current.Site);
            subjectTagsTaxonomy.InitialiseTaxonomyControl(SubjectTag, "Subject Tag", false);

            farm     = WBFarm.Local;
            routings = farm.SubjectTagsRecordsRoutings(subjectTagsTaxonomy);

            if (!IsPostBack)
            {
                RouteIndex.Value = Request.QueryString["RouteIndex"];

                int index;
                if (Int32.TryParse(RouteIndex.Value, out index))
                {
                    WBSubjectTagRecordsRoutings routing = routings[index];

                    if (routing != null)
                    {
                        SubjectTag.Text               = routing.SubjectTag.UIControlValue;
                        PublicDocumentsLibrary.Text   = routing.PublicDocumentsLibrary;
                        ExtranetDocumentsLibrary.Text = routing.ExtranetDocumentsLibrary;
                    }
                }
            }
        }
示例#2
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 void Page_Load(object sender, EventArgs e)
        {
            WBFarm     farm = WBFarm.Local;
            WBTaxonomy subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(SPContext.Current.Site);

            WBSubjectTagsRecordsRoutings routings = farm.SubjectTagsRecordsRoutings(subjectTagsTaxonomy);

            if (!String.IsNullOrEmpty(Request.QueryString["RemoveIndex"]))
            {
                int index;
                if (Int32.TryParse(Request.QueryString["RemoveIndex"], out index))
                {
                    routings.RemoveAtIndex(index);

                    // Now save the new routing information:

                    SPContext.Current.Web.AllowUnsafeUpdates = true;
                    farm.SubjectTagsRecordsRoutingsString    = routings.ToString();
                    farm.Update();
                    SPContext.Current.Web.AllowUnsafeUpdates = false;

                    SPUtility.Redirect("/_admin/WorkBoxFramework/RecordsManagementAdmin.aspx", SPRedirectFlags.Static, Context);
                    return;
                }
            }

            if (!IsPostBack)
            {
                PublicDocumentEmailAlertsTo.Text = farm.PublicDocumentEmailAlertsTo;
                PublicWebsiteTeamEmail.Text      = farm.PublicWebsiteTeamEmail;
            }

            String html = "<table cellpadding='6'>\n";

            html += "<tr><th>Subject Tag</th><th>Public Library</th><th>Extranet Library</th></tr>\n\n";
            if (routings.Count > 0)
            {
                int index = 0;
                foreach (WBSubjectTagRecordsRoutings routing in routings)
                {
                    html += "<tr><td>" + routing.SubjectTag.FullPath + "</td><td>"
                            + routing.PublicDocumentsLibrary + "</td><td>"
                            + routing.ExtranetDocumentsLibrary + "</td><td>"
                            + "<a href='#' onclick='WorkBoxFramework_callDialog(\"/_admin/WorkBoxFramework/EditSubjectTagRouting.aspx?RouteIndex=" + index + "\");'>edit</a></td><td>"
                            + "<a href='#' onclick='if (window.confirm(\"Are you sure you want to remove routing?\")) { location.href = \"/_admin/WorkBoxFramework/RecordsManagementAdmin.aspx?RemoveIndex=" + index + "\"; }'>remove</a></td></tr>\n\n";
                    index++;
                }
            }
            else
            {
                html += "<tr><td colspan='5'><i>No subject tag routings</i></td></tr>\n\n";
            }

            html += "<tr><td colspan='5'><a href='#' onclick='WorkBoxFramework_callDialog(\"/_admin/WorkBoxFramework/EditSubjectTagRouting.aspx\");'>Add another subject tag routing rule</a></td></tr>\n\n";
            SubjectTagsRecordsRoutings.Text = html;
        }
示例#4
0
        /// <summary>
        /// Updates and existing subject tag
        /// </summary>
        void UpdateTag()
        {
            // It appears that a TaxonomySession will always run as the current user, even if elevated.
            // See: http://scle.me/1skLGCY

            var currentSiteGuid = SPContext.Current.Site.ID;
            var oldContext      = HttpContext.Current;

            HttpContext.Current = null;

            SPSecurity.RunWithElevatedPrivileges(() =>
            {
                using (SPSite elevatedSite = new SPSite(currentSiteGuid))
                {
                    WBTaxonomy wbTax = WBTaxonomy.GetSubjectTags(elevatedSite);

                    Term rootSubjectTagTerm = wbTax.GetSelectedTermByPath(_path);
                    WBSubjectTag subjectTag = null;

                    if (rootSubjectTagTerm != null)
                    {
                        subjectTag = new WBSubjectTag(wbTax, rootSubjectTagTerm);
                        if (subjectTag == null)
                        {
                            return;
                        }
                    }

                    // Page content
                    subjectTag.PageContent = htmlDescription.Html;

                    // Internal Contact
                    SPUser pickedUser = ppInternalContact.WBxGetSingleResolvedUser(elevatedSite.RootWeb);
                    if (pickedUser != null)
                    {
                        subjectTag.InternalContactLoginName = pickedUser.LoginName;
                    }
                    else
                    {
                        subjectTag.InternalContactLoginName = string.Empty;
                    }

                    // External Contact
                    subjectTag.ExternalContact = htmlExternalContact.Html;

                    // Tag Name
                    subjectTag.Name = txtEdit_CurrentTagName.Text;
                    subjectTag.Update();
                }
            });

            HttpContext.Current = oldContext;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //SPSite site = SPContext.Current.Site;
            _subjectTags = WBTaxonomy.GetSubjectTags(SPContext.Current.Site);

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

                // Bind the data source to your collection
                tvAllSubjectTags.DataSource = collection;
                tvAllSubjectTags.DataBind();

                var teamsTax = WBTaxonomy.GetTeams(SPContext.Current.Site);

                teamsTax.InitialiseTaxonomyControl(taxTeams, "Select team with permissions to edit this term and create children", true, false, this);
            }
        }
示例#6
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();
            }
        }
示例#7
0
        /// <summary>
        /// Creates a new Subject Tag
        /// </summary>
        void CreateNewTag()
        {
            // It appears that a TaxonomySession will always run as the current user, even if elevated.
            // See: http://scle.me/1skLGCY

            var currentSiteGuid = SPContext.Current.Site.ID;
            var oldContext      = HttpContext.Current;

            HttpContext.Current = null;

            SPSecurity.RunWithElevatedPrivileges(() =>
            {
                using (SPSite elevatedSite = new SPSite(currentSiteGuid))
                {
                    WBTaxonomy wbTax = WBTaxonomy.GetSubjectTags(elevatedSite);

                    _path = String.Concat(_path, "/", txtTagName.Text);

                    Term rootSubjectTagTerm = wbTax.GetSelectedTermByPath(_path); // Try and get the tag, but don't auto create
                    WBSubjectTag subjectTag = null;

                    if (rootSubjectTagTerm != null)
                    {
                        lblValidationMessage.Text = "The term you are trying to create already exists";
                    }
                    else
                    {
                        rootSubjectTagTerm = wbTax.GetSelectedTermByPath(_path, true); // Now create
                    }

                    if (rootSubjectTagTerm != null)
                    {
                        subjectTag = new WBSubjectTag(wbTax, rootSubjectTagTerm);

                        if (subjectTag == null)
                        {
                            return;
                        }

                        subjectTag.PageContent = htmlDescription.Html;
                        if (htmlExternalContact.Html.ToLower() != "<div>&#160;</div>")
                        {
                            subjectTag.ExternalContact = htmlExternalContact.Html;
                        }

                        SPUser pickedUser = ppInternalContact.WBxGetSingleResolvedUser(elevatedSite.RootWeb);
                        if (pickedUser != null)
                        {
                            subjectTag.InternalContactLoginName = pickedUser.LoginName;
                        }

                        /*if (ppInternalContact.Entities != null && ppInternalContact.Entities.Count > 0)
                         * {
                         *  PickerEntity pe = (PickerEntity)ppInternalContact.Entities[0];
                         *  subjectTag.InternalContactLoginName = pe.DisplayText;
                         * }*/
                        wbTax.CommitAll();
                    }
                    else
                    {
                        lblValidationMessage.Text = "Your new tag could not be created, please contact support";
                    }
                }
            });
            HttpContext.Current = oldContext;
        }
        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();
            }
        }
示例#9
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();
            }
        }
示例#10
0
        private Dictionary <String, String> FindRecordsTypesToList()
        {
            WBFarm farm = WBFarm.Local;

            Dictionary <String, String> typesToList = new Dictionary <String, String>();

            using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl))
            {
                WBTaxonomy subjectTags          = WBTaxonomy.GetSubjectTags(site);
                WBTaxonomy teamsTaxonomy        = WBTaxonomy.GetTeams(subjectTags);
                WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(teamsTaxonomy);

                Term   pageSeriesTagTerm   = subjectTags.GetSelectedTermByPath(FullSubjectTagPath);
                WBTerm localPageSubjectTag = null;
                if (pageSeriesTagTerm != null)
                {
                    localPageSubjectTag = new WBTerm(subjectTags, pageSeriesTagTerm);
                }

                if (localPageSubjectTag != null)
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        WBQuery query = new WBQuery();

                        WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, localPageSubjectTag);
                        subjectTagClause.UseDescendants = false;
                        query.AddClause(subjectTagClause);

                        if (webPart.OnlyLiveRecords)
                        {
                            WBQueryClause isLiveClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__LIVE);
                            query.AddClause(isLiveClause);
                        }

                        /*
                         * else
                         * {
                         * string statusFilter = SelectedLiveOrArchivedStatusFilter;
                         * if (statusFilter == null || statusFilter == "") statusFilter = WBColumn.LIVE_OR_ARCHIVED__LIVE;
                         * if (statusFilter != "All")
                         * {
                         *  query.AddEqualsFilter(WBColumn.LiveOrArchived, statusFilter);
                         * }
                         * }
                         */

                        WBTeam team = null;
                        if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam))
                        {
                            team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam);

                            if (team != null)
                            {
                                query.AddEqualsFilter(WBColumn.OwningTeam, team);
                            }
                        }

                        query.AddViewColumn(WBColumn.Name);
                        query.AddViewColumn(WBColumn.Title);
                        query.AddViewColumn(WBColumn.RecordsType);

                        if (sortColumn == null)
                        {
                            sortColumn = WBColumn.ReferenceDate;
                            ascending  = false;
                        }

                        if (sortColumn != null)
                        {
                            query.OrderBy(sortColumn, ascending);
                        }

                        SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName];

                        SPListItemCollection listOfFoundDocuments = recordsLibrary.WBxGetItems(site, query);

                        foreach (SPListItem item in listOfFoundDocuments)
                        {
                            WBRecordsType recordsType     = item.WBxGetSingleTermColumn <WBRecordsType>(recordsTypesTaxonomy, WBColumn.RecordsType);
                            String        justRecordsType = GetJustRecordsTypeName(recordsType.Name);

                            if (!typesToList.ContainsKey(justRecordsType))
                            {
                                typesToList.Add(justRecordsType, recordsType.FullPath);
                            }
                        }
                    }
                }
                else
                {
                    WBLogging.Debug("pageSubjectTag was null");
                }
            }

            return(typesToList);
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as ViewSubjectPages;

            DocumentsForSubject.AllowSorting = true;
            DocumentsForSubject.Sorting     += new GridViewSortEventHandler(DocumentsForSubject_Sorting);

            DocumentsForSubject.AllowPaging                   = true;
            DocumentsForSubject.PageIndexChanging            += new GridViewPageEventHandler(DocumentsForSubject_PageIndexChanging);
            DocumentsForSubject.PagerSettings.Mode            = PagerButtons.Numeric;
            DocumentsForSubject.PagerSettings.Position        = PagerPosition.Bottom;
            DocumentsForSubject.PagerSettings.PageButtonCount = 20;
            DocumentsForSubject.PagerSettings.Visible         = true;
            DocumentsForSubject.PageSize = 20;

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


            showAtoZ    = webPart.ShowAToZ;
            showFilters = false;

            string additionalPath = "";

            if (String.IsNullOrEmpty(webPart.RootSubjectTag))
            {
                PageName.Text = "<i>(Web part not yet configured)</i>";
                return;
            }

            // Let's capture the information about what we should be looking at:
            pickedLetter = Request.QueryString["Letter"];
            if (!String.IsNullOrEmpty(pickedLetter))
            {
                viewingALetter = true;
            }

            additionalPath = Request.QueryString["AdditionalPath"];
            if (additionalPath == null)
            {
                additionalPath = "";
            }

            recordsTypeFullPath = Request.QueryString["RecordsType"];
            if (String.IsNullOrEmpty(recordsTypeFullPath))
            {
                recordsTypeFullPath = NO_RECORDS_TYPE_SELECTED;
            }

            if (webPart.ShowRecordTypes)
            {
                WBLogging.Debug("ViewSubjectPages: Using records types. Currently set as: " + recordsTypeFullPath);
            }
            else
            {
                WBLogging.Debug("ViewSubjectPages: Not using records types");
            }

            FullSubjectTagPath = webPart.RootSubjectTag + additionalPath;
            WBLogging.Debug("FullSubjectTagPath = " + FullSubjectTagPath);

            WBTaxonomy subjectTags = WBTaxonomy.GetSubjectTags(SPContext.Current.Site);

            Term   rootSubjectTagTerm = subjectTags.GetSelectedTermByPath(webPart.RootSubjectTag);
            WBTerm rootSubjectTag     = null;

            if (rootSubjectTagTerm != null)
            {
                rootSubjectTag = new WBTerm(subjectTags, rootSubjectTagTerm);
            }

            if (rootSubjectTag == null)
            {
                PageName.Text = "<i>(Could not find the root subject tag with path: " + webPart.RootSubjectTag + ")</i>";
                return;
            }


            Term pageSubjectTagTerm = subjectTags.GetSelectedTermByPath(FullSubjectTagPath);
            //SC: WBTerm pageSubjectTag = null;
            WBSubjectTag pageSubjectTag = null;

            if (pageSubjectTagTerm != null)
            {
                //SC: pageSubjectTag = new WBTerm(subjectTags, pageSubjectTagTerm);
                pageSubjectTag = new WBSubjectTag(subjectTags, pageSubjectTagTerm);
            }

            if (pageSubjectTag == null)
            {
                PageName.Text = "<i>(Could not find the page subject tag with path: " + FullSubjectTagPath + ")</i>";
                return;
            }

            string html = "";

            string recordsTypeParameter = "";

            if (webPart.ShowRecordTypes)
            {
                recordsTypeParameter = "&RecordsType=" + recordsTypeFullPath;
            }

            //webPart.OnlyTermsWithDocuments = false;

            if (webPart.OnlyTermsWithDocuments)
            {
                BuildListOfAllowedTerms();
            }

            if (viewingALetter)
            {
                PageName.Text = "<a href='?'>" + webPart.RootSubjectTag + "</a> - " + pickedLetter;
                PageSubjectTagDescription.Text = "You are viewing a list of all of the subjects with the letter '" + pickedLetter + "'.";

                Dictionary <String, String> allTermPaths = new Dictionary <string, string>();
                AddAllTermsThatMatch(pickedLetter, "", rootSubjectTagTerm, allTermPaths);

                if (allTermPaths.Count > 0)
                {
                    List <String> terms = new List <String>(allTermPaths.Keys);
                    terms.Sort();

                    List <String> termsWithLetterFirst = new List <String>();
                    List <String> remainingTerms       = new List <String>();

                    foreach (String term in terms)
                    {
                        if (term.IndexOf(pickedLetter) == 0)
                        {
                            termsWithLetterFirst.Add(term);
                        }
                        else
                        {
                            remainingTerms.Add(term);
                        }
                    }

                    foreach (String term in termsWithLetterFirst)
                    {
                        html += "<div class='lbi-a-to-z-child-subject'><a href='?AdditionalPath=" + allTermPaths[term] + recordsTypeParameter + "'>" + term + "</a></div>\n";
                    }

                    if (remainingTerms.Count > 0)
                    {
                        html += "<div>&nbsp;</div>\n";
                        foreach (String term in remainingTerms)
                        {
                            html += "<div class='lbi-a-to-z-child-subject'><a href='?AdditionalPath=" + allTermPaths[term] + recordsTypeParameter + "'>" + term + "</a></div>\n";
                        }
                    }
                }
                else
                {
                    html += "<p>There were no terms found for the letter '" + pickedLetter + "'.</p>";
                }
            }
            else
            {
                List <String> names = new List <String>(FullSubjectTagPath.Split('/'));
                List <String> path  = new List <String>(names);
                path.RemoveAt(0);


                String justRecordsType = "";
                if (!String.IsNullOrEmpty(recordsTypeFullPath) && recordsTypeFullPath != NO_RECORDS_TYPE_SELECTED)
                {
                    justRecordsType = GetJustRecordsTypeName(recordsTypeFullPath);
                }

                PageName.Text = BuildPageNamePath(names, path, justRecordsType);

                //SC: PageSubjectTagDescription.Text = pageSubjectTag.Description;
                if (String.IsNullOrEmpty(pageSubjectTag.PageContent))
                {
                    PageSubjectTagDescription.Text = pageSubjectTag.Description;
                }
                else
                {
                    PageSubjectTagDescription.Text = pageSubjectTag.PageContent;
                }

                // Contacts
                if (!String.IsNullOrEmpty(pageSubjectTag.InternalContactLoginName))
                {
                    panInternalContact.Visible = true;
                    var user = pageSubjectTag.InternalContact(SPContext.Current.Web);
                    if (user != null)
                    {
                        // Bind user to control for presentation
                        ((WBFUser)wbfInternalContact).User = user;
                    }
                }
                else
                {
                    panInternalContact.Visible = false;
                }
                if (!pageSubjectTag.ExternalContact.WBxIsHtmlFieldEmpty())
                {
                    panExternalContact.Visible = true;
                    litExternalContact.Text    = pageSubjectTag.ExternalContact;
                }
                else
                {
                    panExternalContact.Visible = false;
                }


                foundChildSubjectTags = false;

                onRootOfAtoZ = (webPart.ShowAToZ && pageSubjectTag.Name == webPart.RootSubjectTag);

                bool showDocuments = true;

                if (!onRootOfAtoZ)
                {
                    // OK so now we need to find the sub terms and put them in order.
                    List <String> termLabels = new List <String>();
                    foreach (Term child in pageSubjectTag.Term.Terms)
                    {
                        if (child.IsAvailableForTagging && CheckTermIsAllowed(child))
                        {
                            termLabels.Add(child.Name);
                            foundChildSubjectTags = true;
                        }
                    }

                    if (termLabels.Count > 0)
                    {
                        if (webPart.OnlyShowDocumentsOnLeafPages)
                        {
                            showDocuments = false;
                        }

                        termLabels.Sort();

                        foreach (String label in termLabels)
                        {
                            html += "<div class='lbi-a-to-z-child-subject'><a href='?AdditionalPath=" + additionalPath + "/" + label + recordsTypeParameter + "'>" + label + "</a></div>\n";
                        }
                    }
                    else
                    {
                        // OK so there are no further subject tags, but should we be presenting records types:
                        if (webPart.ShowRecordTypes)
                        {
                            if (recordsTypeFullPath == NO_RECORDS_TYPE_SELECTED)
                            {
                                Dictionary <String, String> recordsTypesToList = FindRecordsTypesToList();
                                if (recordsTypesToList.Count > 0)
                                {
                                    if (webPart.OnlyShowDocumentsOnLeafPages)
                                    {
                                        showDocuments = false;
                                    }

                                    List <String> justRecordsTypes = new List <String>(recordsTypesToList.Keys);
                                    justRecordsTypes.Sort();

                                    foreach (String recordsType in justRecordsTypes)
                                    {
                                        String recordsTypePath = recordsTypesToList[recordsType];

                                        html += "<div class='lbi-a-to-z-child-subject'><a href='?AdditionalPath=" + additionalPath + "&RecordsType=" + recordsTypePath + "'>" + recordsType + "</a></div>\n";
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (webPart.ShowDocumentsOnAtoZRootPage)
                    {
                        showDocuments = true;
                    }
                    else
                    {
                        showDocuments = false;
                    }
                }

                if (showDocuments)
                {
                    RefreshBoundDocumentsList();
                }
            }

            if (!String.IsNullOrEmpty(html))
            {
                //TableOfChildSubjects.Text = String.Concat("<h3 class='wbf-subject-tag-section-head'>Child Subject Tags</h3>", html);
                TableOfChildSubjects.Text = html;
            }

            // Added by Steve Clements
            SetupAddEditButtons(pageSubjectTag);
        }
示例#12
0
        private void RefreshBoundDocumentsList()
        {
            WBFarm farm = WBFarm.Local;

            // SC
            if (String.IsNullOrEmpty(farm.ProtectedRecordsLibraryUrl))
            {
                return;
            }

            bool foundDocuments = false;

            using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl))
            {
                WBTaxonomy subjectTags          = WBTaxonomy.GetSubjectTags(site);
                WBTaxonomy teamsTaxonomy        = WBTaxonomy.GetTeams(subjectTags);
                WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(teamsTaxonomy);

                Term   pageSeriesTagTerm   = subjectTags.GetSelectedTermByPath(FullSubjectTagPath);
                WBTerm localPageSubjectTag = null;
                if (pageSeriesTagTerm != null)
                {
                    localPageSubjectTag = new WBTerm(subjectTags, pageSeriesTagTerm);
                }

                if (localPageSubjectTag != null)
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        WBQuery query = new WBQuery();

                        WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, localPageSubjectTag);
                        subjectTagClause.UseDescendants = false;
                        query.AddClause(subjectTagClause);

                        if (webPart.OnlyLiveRecords)
                        {
                            WBQueryClause isLiveClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__LIVE);
                            query.AddClause(isLiveClause);
                        }
                        else
                        {
                            string statusFilter = SelectedLiveOrArchivedStatusFilter;
                            if (statusFilter == null || statusFilter == "")
                            {
                                statusFilter = WBColumn.LIVE_OR_ARCHIVED__LIVE;
                            }
                            if (statusFilter != "All")
                            {
                                query.AddEqualsFilter(WBColumn.LiveOrArchived, statusFilter);
                            }

                            FilterLiveStatus.CssClass     = "wbf-unselected-filter";
                            FilterArchivedStatus.CssClass = "wbf-unselected-filter";
                            FilterAllStatus.CssClass      = "wbf-unselected-filter";

                            if (statusFilter == WBColumn.LIVE_OR_ARCHIVED__LIVE)
                            {
                                FilterLiveStatus.CssClass = "wbf-selected-filter";
                            }
                            if (statusFilter == WBColumn.LIVE_OR_ARCHIVED__ARCHIVED)
                            {
                                FilterArchivedStatus.CssClass = "wbf-selected-filter";
                            }
                            if (statusFilter == "All")
                            {
                                FilterAllStatus.CssClass = "wbf-selected-filter";
                            }
                        }

                        WBTeam team = null;
                        if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam))
                        {
                            team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam);

                            if (team != null)
                            {
                                query.AddEqualsFilter(WBColumn.OwningTeam, team);
                            }
                        }


                        if (webPart.ShowRecordTypes && !String.IsNullOrEmpty(recordsTypeFullPath) && recordsTypeFullPath != NO_RECORDS_TYPE_SELECTED)
                        {
                            WBRecordsType recordsTypeToFilterBy = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypeFullPath);

                            if (recordsTypeToFilterBy != null)
                            {
                                query.AddEqualsFilter(WBColumn.RecordsType, recordsTypeToFilterBy);
                            }
                        }

                        /*
                         * string protectiveZoneFilter = "Public"; // Request.QueryString["ProtectiveZone"];
                         * if (protectiveZoneFilter != null && protectiveZoneFilter != "")
                         * {
                         *  query.AddEqualsFilter(WBColumn.ProtectiveZone, protectiveZoneFilter);
                         * }
                         * */

                        query.AddViewColumn(WBColumn.Name);
                        query.AddViewColumn(WBColumn.Title);
                        query.AddViewColumn(WBColumn.TitleOrName);
                        query.AddViewColumn(WBColumn.FileSize);
                        query.AddViewColumn(WBColumn.FileTypeIcon);
                        query.AddViewColumn(WBColumn.FileType);
                        query.AddViewColumn(WBColumn.DisplayFileSize);
                        query.AddViewColumn(WBColumn.EncodedAbsoluteURL);
                        query.AddViewColumn(WBColumn.LiveOrArchived);
                        query.AddViewColumn(WBColumn.RecordID);

//                        query.AddViewColumn(WBColumn.OwningTeam);
                        query.AddViewColumn(WBColumn.ReferenceDate);
                        //                     query.AddViewColumn(WBColumn.ReferenceID);
                        //                      query.AddViewColumn(WBColumn.SeriesTag);
//                        query.AddViewColumn(WBColumn.ProtectiveZone);
                        //query.AddViewColumn(WBColumn.DeclaredRecord);
                        //                    query.AddViewColumn(WBColumn.SubjectTags);

                        if (sortColumn == null)
                        {
                            sortColumn = WBColumn.ReferenceDate;
                            ascending  = false;
                        }

                        if (sortColumn != null)
                        {
                            query.OrderBy(sortColumn, ascending);
                        }

                        SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName];

                        DataTable dataTable = recordsLibrary.WBxGetDataTable(site, query);

                        if (dataTable.Rows.Count > 0)
                        {
                            foundDocuments = true;
                        }

                        DocumentsForSubject.DataSource = dataTable;

                        DocumentsForSubject.Columns.Clear();
                        DocumentsForSubject.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL));
                        DocumentsForSubject.Columns.Add(WBUtils.HyperLinkField(WBColumn.TitleOrName, WBColumn.EncodedAbsoluteURL, sortColumn, ascending));
                        DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.FileType, sortColumn, ascending));
                        DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.DisplayFileSize, sortColumn, ascending));
                        if (!webPart.OnlyLiveRecords)
                        {
                            DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.LiveOrArchived, sortColumn, ascending));
                        }
                        DocumentsForSubject.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending));


                        SPGroup rmManagersGroup = SPContext.Current.Web.WBxGetGroupOrNull(WBFarm.Local.RecordsManagersGroupName);

                        if (rmManagersGroup != null)
                        {
                            if (rmManagersGroup.ContainsCurrentUser)
                            {
                                List <WBColumn> valueColumns = new List <WBColumn>();
                                valueColumns.Add(WBColumn.RecordID);

                                String formatString = SPContext.Current.Web.Url + "/_layouts/WorkBoxFramework/UpdateRecordsMetadata.aspx?RecordID={0}";

                                formatString = "<a href=\"javascript: WorkBoxFramework_commandAction('" + formatString + "', 800, 600); \">(edit metadata)</a>";

                                DocumentsForSubject.Columns.Add(WBUtils.FormatStringTemplateField(formatString, valueColumns));
                            }
                        }


                        DocumentsForSubject.DataBind();
                    }
                }
                else
                {
                    WBUtils.logMessage("pageSubjectTag was null");
                }
            }


            if (foundDocuments && !webPart.OnlyLiveRecords)
            {
                showFilters = true;
            }

            if (!foundDocuments && !foundChildSubjectTags && !(onRootOfAtoZ))
            {
                int archivedDocs = 0;

                if (!webPart.OnlyLiveRecords)
                {
                    if (SelectedLiveOrArchivedStatusFilter == WBColumn.LIVE_OR_ARCHIVED__LIVE)
                    {
                        archivedDocs = this.CountArchivedDocsOfThisSelection();
                    }

                    showFilters = true;
                }

                if (archivedDocs > 0)
                {
                    DynamicNoDocumentsMessage.Text = "(No live documents have been found. There are " + archivedDocs + " archived documents of this type.)";
                }
                else
                {
                    DynamicNoDocumentsMessage.Text = "(No documents have been found)";
                }
            }
            else
            {
                DynamicNoDocumentsMessage.Text = "";
            }

            // Show Related docs header if docs or message being displayed
            if (DocumentsForSubject.Rows.Count > 0 || !String.IsNullOrEmpty(DynamicNoDocumentsMessage.Text))
            {
                h3RelatedDocs.Style.Add(HtmlTextWriterStyle.Display, "block");
            }
        }
示例#13
0
        /*
         * private string createTableRowForChildSubjectTag(WBTaxonomy seriesTags, String additionalPath, Term child)
         * {
         *  string currentURL = Request.Url.ToString();
         *  int startIndex = currentURL.IndexOf("?");
         *  if (startIndex > 0)
         *  {
         *      currentURL = currentURL.Substring(0, startIndex);
         *  }
         *
         *  string childURL = currentURL + "?AdditionalPath=" + additionalPath + "/" + child.Name;
         *
         *  if (!webPart.OnlyLiveRecords)
         *  {
         *      childURL += "&LiveOrArchived=" + SelectedLiveOrArchivedStatusFilter;
         *  }
         *
         *
         *  string html = "<tr class=\"subjectTags\"><td class=\"subjectTags\"><a href=\"" + childURL + "\">" + child.Name + "</a></td></tr>";
         *
         *  return html;
         * }
         */


        private int CountArchivedDocsOfThisSelection()
        {
            WBFarm farm = WBFarm.Local;

            int foundDocuments = 0;

            using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl))
            {
                WBTaxonomy subjectTags          = WBTaxonomy.GetSubjectTags(site);
                WBTaxonomy teamsTaxonomy        = WBTaxonomy.GetTeams(subjectTags);
                WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(teamsTaxonomy);

                Term   pageSeriesTagTerm   = subjectTags.GetSelectedTermByPath(FullSubjectTagPath);
                WBTerm localPageSubjectTag = null;
                if (pageSeriesTagTerm != null)
                {
                    localPageSubjectTag = new WBTerm(subjectTags, pageSeriesTagTerm);
                }

                if (localPageSubjectTag != null)
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        WBQuery query = new WBQuery();

                        WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, localPageSubjectTag);
                        subjectTagClause.UseDescendants = false;
                        query.AddClause(subjectTagClause);

                        WBQueryClause isArchivedClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__ARCHIVED);
                        query.AddClause(isArchivedClause);


                        WBTeam team = null;
                        if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam))
                        {
                            team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam);

                            if (team != null)
                            {
                                query.AddEqualsFilter(WBColumn.OwningTeam, team);
                            }
                        }


                        if (webPart.ShowRecordTypes && !String.IsNullOrEmpty(recordsTypeFullPath) && recordsTypeFullPath != NO_RECORDS_TYPE_SELECTED)
                        {
                            WBRecordsType recordsTypeToFilterBy = recordsTypesTaxonomy.GetSelectedRecordsType(recordsTypeFullPath);

                            if (recordsTypeToFilterBy != null)
                            {
                                query.AddEqualsFilter(WBColumn.RecordsType, recordsTypeToFilterBy);
                            }
                        }

                        query.AddViewColumn(WBColumn.Name);
                        query.AddViewColumn(WBColumn.Title);
                        query.AddViewColumn(WBColumn.RecordID);


                        SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName];

                        SPListItemCollection foundArchivedItems = recordsLibrary.WBxGetItems(site, query);

                        foundDocuments = foundArchivedItems.Count;
                    }
                }
                else
                {
                    WBUtils.logMessage("pageSubjectTag was null");
                }
            }

            return(foundDocuments);
        }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // First we're going to check membership of the records management group:
            String  rmGroupName = WBFarm.Local.RecordsManagersGroupName;
            SPGroup rmGroup     = null;

            if (!String.IsNullOrEmpty(rmGroupName))
            {
                try
                {
                    rmGroup = SPContext.Current.Web.SiteGroups[rmGroupName];
                }
                catch (Exception exception)
                {
                    // Probably the group hasn't been created or setup here yet
                }
            }

            if (rmGroup == null || !rmGroup.ContainsCurrentUser)
            {
                AccessDeniedPanel.Visible          = true;
                UpdateRecordsMetadataPanel.Visible = false;
                return;
            }

            currentUserLoginName = SPContext.Current.Web.CurrentUser.LoginName;


            String listIDString   = "";
            String itemIDString   = "";
            String recordIDString = "";

            recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);
            subjectTagsTaxonomy  = WBTaxonomy.GetSubjectTags(recordsTypesTaxonomy);

            librarySite = new SPSite(WBFarm.Local.ProtectedRecordsLibraryUrl);
            libraryWeb  = librarySite.OpenWeb();

            libraryList = libraryWeb.GetList(WBFarm.Local.ProtectedRecordsLibraryUrl);


            if (!IsPostBack)
            {
                recordIDString = Request.QueryString["RecordID"];

                if (String.IsNullOrEmpty(recordIDString))
                {
                    listIDString = Request.QueryString["ListID"];
                    itemIDString = Request.QueryString["ItemID"];
                }
                else
                {
                    listIDString = libraryList.ID.ToString();
                }

                ListID.Value = listIDString;
                ItemID.Value = itemIDString;
            }
            else
            {
                recordIDString = RecordID.Text;
                listIDString   = ListID.Value;
                itemIDString   = ItemID.Value;
            }

            if (!String.IsNullOrEmpty(itemIDString))
            {
                int itemID = Convert.ToInt32(itemIDString);

                recordItem = libraryList.GetItemById(itemID);
            }
            else
            {
                recordItem = WBUtils.FindItemByColumn(SPContext.Current.Site, libraryList, WBColumn.RecordID, recordIDString);

                if (recordItem != null)
                {
                    itemIDString = recordItem.ID.ToString();
                    ItemID.Value = itemIDString;
                }
            }

            if (recordItem != null)
            {
                record = new WBDocument(recordItem);

                FunctionalArea.Text = record.FunctionalArea.Names();

                WBRecordsType recordsType = record.RecordsType;

                recordsType.Taxonomy = recordsTypesTaxonomy;

                RecordsType.Text = recordsType.FullPath.Replace("/", " / ");


                if (!IsPostBack)
                {
                    Filename.Text = recordItem.Name;
                    Title.Text    = recordItem.Title;
                    RecordID.Text = record[WBColumn.RecordID].WBxToString();

                    LiveOrArchived.DataSource = new String[] { "Live", "Archived" };
                    LiveOrArchived.DataBind();
                    LiveOrArchived.SelectedValue = record[WBColumn.LiveOrArchived].WBxToString();

                    ProtectiveZone.DataSource = WBRecordsType.getProtectiveZones();
                    ProtectiveZone.DataBind();
                    ProtectiveZone.SelectedValue = record.ProtectiveZone;

                    subjectTagsTaxonomy.InitialiseTaxonomyControl(SubjectTags, WBColumn.SubjectTags.DisplayName, true);
                    SubjectTags.Text = record.SubjectTags.UIControlValue;
                }
            }

            if (!IsPostBack)
            {
                libraryWeb.Dispose();
                librarySite.Dispose();

                LiveOrArchived.Focus();
            }
        }
示例#15
0
        private void RenderPage()
        {
            WBTaxonomy subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(SPContext.Current.Site);

            subjectTagsTaxonomy.InitialiseTaxonomyControl(SubjectTagsField, WorkBox.COLUMN_NAME__SUBJECT_TAGS, true);

            if (!String.IsNullOrEmpty(newSubjectTagsUIControlValue))
            {
                SubjectTagsField.Text = newSubjectTagsUIControlValue;
            }

            EditDocumentsTable.Controls.Clear();

            List <String> documentsDetailsList = new List <String>();

            string currentDetails = DocumentsDetails.Value.WBxTrim();

            WBLogging.Debug("Building the table with current details: " + currentDetails);

            if (!String.IsNullOrEmpty(currentDetails))
            {
                documentsDetailsList = new List <String>(currentDetails.Split(';'));
            }

            numOfDocs = documentsDetailsList.Count;

            Table table = new Table();

            table.Width = Unit.Percentage(100);

            TableRow headers = new TableRow();

            headers.WBxAddTableHeaderCell("Title");
            headers.WBxAddTableHeaderCell("Filename");
            headers.WBxAddTableHeaderCell("File Type");
            //            headers.WBxAddTableHeaderCell("Else");

            table.Rows.Add(headers);

            String recordsLibraryURL = WBFWebPartsUtils.GetRecordsLibraryURL(SPContext.Current.Site);

            using (SPSite site = new SPSite(recordsLibraryURL))
                using (SPWeb web = site.OpenWeb())
                {
                    SPList library = web.GetList(recordsLibraryURL);



                    int index = 0;
                    foreach (String details in documentsDetailsList)
                    {
                        TableRow row = CreateEditableTableRow(site, web, library, index, details);

                        allRows.Add(row);

                        table.Rows.Add(row);
                        index++;
                    }


                    if (extranetRecordsWeb != null)
                    {
                        extranetRecordsWeb.Dispose();
                    }
                    if (extranetRecordsSite != null)
                    {
                        extranetRecordsSite.Dispose();
                    }
                }
            EditDocumentsTable.Controls.Add(table);
        }
示例#16
0
        /// <summary>
        /// Initialise the form
        /// </summary>
        void BindForm()
        {
            if (String.IsNullOrEmpty(_path))
            {
                return;
            }

            SPSecurity.RunWithElevatedPrivileges(() =>
            {
                using (SPSite elevatedSite = new SPSite(SPContext.Current.Site.ID))
                {
                    WBTaxonomy subjectTags = WBTaxonomy.GetSubjectTags(elevatedSite);

                    Term rootSubjectTagTerm = subjectTags.GetSelectedTermByPath(_path);
                    WBSubjectTag subjectTag = null;

                    if (rootSubjectTagTerm != null)
                    {
                        subjectTag = new WBSubjectTag(subjectTags, rootSubjectTagTerm);
                        if (subjectTag == null)
                        {
                            return;
                        }
                    }

                    // DOes the current user have permission?
                    WBTaxonomy teamsTax = WBTaxonomy.GetTeams(elevatedSite);
                    if (!subjectTag.TeamsWithPermissionToEdit(teamsTax).WBxContainsCurrentUserAsTeamMember())
                    {
                        Response.Redirect("AccessDenied.html");
                    }

                    if (!CreateNew) // Edit Mode
                    {
                        txtTagName.Text     = subjectTag.Name;
                        txtTagName.ReadOnly = true;

                        // To support existing terms where content is stored in the description, first attempt to read from the the multi-property array Page Content,
                        // then fall back to the description. Changes will be saved to the multi-property array.
                        if (String.IsNullOrEmpty(subjectTag.PageContent))
                        {
                            htmlDescription.Field.Html = subjectTag.Description;
                        }
                        else
                        {
                            htmlDescription.Field.Html = subjectTag.PageContent;
                        }

                        ppInternalContact.WBxInitialise(subjectTag.InternalContact(SPContext.Current.Web)); // It's an option to use the RootWeb of the elevated site here, I have used SPContext for consistency
                        htmlExternalContact.Field.Html = subjectTag.ExternalContact;

                        // Added this due to issue with the Html editor in IE in a modal dialog!  If the value is null, you cannot click in to start editing.
                        if (String.IsNullOrEmpty(htmlExternalContact.Field.Html))
                        {
                            htmlExternalContact.Field.Html = " ";
                        }
                        if (String.IsNullOrEmpty(htmlDescription.Field.Html))
                        {
                            htmlDescription.Field.Html = " ";
                        }
                    }
                    else
                    {
                        // Nothing to do if creating a new child term
                    }
                }
            });
        }
示例#17
0
        private void BuildListOfAllowedTerms()
        {
            WBFarm farm = WBFarm.Local;

            using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl))
            {
                WBTaxonomy subjectTagsTaxonomy = WBTaxonomy.GetSubjectTags(site);
                WBTaxonomy teamsTaxonomy       = WBTaxonomy.GetTeams(subjectTagsTaxonomy);

                Term   pageSeriesTagTerm   = subjectTagsTaxonomy.GetSelectedTermByPath(FullSubjectTagPath);
                WBTerm localPageSubjectTag = null;
                if (pageSeriesTagTerm != null)
                {
                    localPageSubjectTag = new WBTerm(subjectTagsTaxonomy, pageSeriesTagTerm);
                }

                if (localPageSubjectTag != null)
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        WBQuery query = new WBQuery();

                        //WBQueryClause subjectTagClause = new WBQueryClause(WBColumn.SubjectTags, WBQueryClause.Comparators.Equals, localPageSubjectTag);
                        //subjectTagClause.UseDescendants = true;
                        //query.AddClause(subjectTagClause);

                        if (webPart.OnlyLiveRecords)
                        {
                            WBQueryClause isLiveClause = new WBQueryClause(WBColumn.LiveOrArchived, WBQueryClause.Comparators.Equals, WBColumn.LIVE_OR_ARCHIVED__LIVE);
                            query.AddClause(isLiveClause);
                        }

                        WBTeam team = null;
                        if (!String.IsNullOrEmpty(webPart.FilterByOwningTeam))
                        {
                            team = teamsTaxonomy.GetSelectedTeam(webPart.FilterByOwningTeam);

                            if (team != null)
                            {
                                query.AddEqualsFilter(WBColumn.OwningTeam, team);
                            }
                        }


                        /*
                         * string protectiveZoneFilter = "Public"; // Request.QueryString["ProtectiveZone"];
                         * if (protectiveZoneFilter != null && protectiveZoneFilter != "")
                         * {
                         *  query.AddEqualsFilter(WBColumn.ProtectiveZone, protectiveZoneFilter);
                         * }
                         * */

                        query.AddViewColumn(WBColumn.Name);
                        query.AddViewColumn(WBColumn.SubjectTags);

                        SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl); //"Documents"]; //farm.RecordsCenterRecordsLibraryName];

                        SPListItemCollection documents = recordsLibrary.WBxGetItems(site, query);

                        WBLogging.Debug("Got documents back");

                        WBLogging.Debug("Documents contains " + documents.Count + " items");

                        foreach (SPListItem document in documents)
                        {
                            WBTermCollection <WBTerm> subjectTags = document.WBxGetMultiTermColumn <WBTerm>(subjectTagsTaxonomy, WBColumn.SubjectTags.DisplayName);
                            foreach (WBTerm subjectTag in subjectTags)
                            {
                                string fullPath = subjectTag.FullPath;
                                if (allUsedTerms.Contains(fullPath))
                                {
                                    WBLogging.Debug("Already has term: " + fullPath + "  so not adding");
                                }
                                else
                                {
                                    WBLogging.Debug("Adding to list of allowed terms: " + fullPath);
                                    this.allUsedTerms.Add(fullPath);
                                    while (fullPath.Contains("/"))
                                    {
                                        int lastIndex = fullPath.LastIndexOf('/');
                                        fullPath = fullPath.Substring(0, lastIndex);
                                        if (allUsedTerms.Contains(fullPath))
                                        {
                                            WBLogging.Debug("Already has term: " + fullPath + "  so not adding");
                                            fullPath = "";
                                        }
                                        else
                                        {
                                            allUsedTerms.Add(fullPath);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    WBUtils.logMessage("pageSubjectTag was null");
                }
            }
        }