//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();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as ViewSeriesPages;

            string additionalPath = Request.QueryString["AdditionalPath"];

            if (additionalPath == null)
            {
                additionalPath = "";
            }

            if (webPart.ParentSeriesTag == null || webPart.ParentSeriesTag == "")
            {
                PageSeriesTagName.Text = "<i>(Web part not yet configured)</i>";
                return;
            }

            string fullPath = webPart.ParentSeriesTag + additionalPath;

            WBTaxonomy seriesTags = WBTaxonomy.GetSeriesTags(SPContext.Current.Site);

            WBTerm pageSeriesTag = null;

            Term pageSeriesTagTerm = seriesTags.GetSelectedTermByPath(fullPath);

            if (pageSeriesTagTerm != null)
            {
                pageSeriesTag = new WBTerm(seriesTags, pageSeriesTagTerm);
            }

            if (pageSeriesTag == null)
            {
                PageSeriesTagName.Text = "<i>(Could not find the series tag with path: " + fullPath + ")</i>";
                return;
            }


            PageSeriesTagName.Text        = pageSeriesTag.Name;
            PageSeriesTagDescription.Text = pageSeriesTag.Description;

            string html = "<table cellspacing=\"10\" cellpadding=\"10\" class=\"seriesTags\">";

            foreach (Term child in pageSeriesTag.Term.Terms)
            {
                if (child.Terms.Count > 0)
                {
                    html = html + createTableRowForChildSeriesTag(seriesTags, additionalPath, child);
                }
                else
                {
                    html = html + createTableRowForDocument(seriesTags, child);
                }
            }

            html += "</table>";

            TableOfChildTerms.Text = html;
        }
Beispiel #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            WorkBox workBox = WorkBox.GetIfWorkBox(SPContext.Current);

            if (workBox == null)
            {
                errorLiteral.Text = "<i>(You can only use this web part in a work box)</i>";
            }
            else
            {
                WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);
                WBTaxonomy seriesTags   = WBTaxonomy.GetSeriesTags(recordsTypes);

                WBTerm thisSeries = workBox.SeriesTag(seriesTags);

                WBQuery query = new WBQuery();

                query.AddEqualsFilter(WBColumn.RecordsType, workBox.RecordsType);

                if (FilterBySeriesTag)
                {
                    query.AddEqualsFilter(WBColumn.SeriesTag, workBox.SeriesTag(seriesTags));
                }

                if (FilterByReferenceID)
                {
                    query.AddEqualsFilter(WBColumn.ReferenceID, workBox.ReferenceID);
                }

                //            if (FilterByOwningTeam)
                //            query.AddEqualsFilter(WBColumn.OwningTeam, workBox.OwningTeam);


                if (sortColumn != null)
                {
                    WBLogging.Debug("Sorting in Render with sortColumn: " + sortColumn.DisplayName);
                }
                else
                {
                    WBLogging.Debug("Sorting Render - sortColumn was null");
                }

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

                query.AddViewColumn(WBColumn.Title);
                query.AddViewColumn(WBColumn.WorkBoxURL);
                query.AddViewColumn(WBColumn.ReferenceDate);
                query.AddViewColumn(WBColumn.WorkBoxStatus);

                WBColumn testIfIsThisWorkBox = new WBColumn("IfIsThisWorkBox", WBColumn.DataTypes.VirtualConditional);
                testIfIsThisWorkBox.TestColumnInternalName = WBColumn.Title.InternalName;
                testIfIsThisWorkBox.TestColumnValue        = workBox.Title;
                testIfIsThisWorkBox.ValueIfEqual           = "===>";

                query.AddViewColumn(testIfIsThisWorkBox);

                DataTable dataTable = workBox.Collection.Query(query);

                gridView.DataSource = new DataView(dataTable);

                BoundField testIfIsThisWorkBoxField = WBUtils.BoundField(testIfIsThisWorkBox, HorizontalAlign.Center, sortColumn, ascending);
                testIfIsThisWorkBoxField.HeaderText = "     ";

                gridView.Columns.Add(testIfIsThisWorkBoxField);
                gridView.Columns.Add(WBUtils.FixedIconTemplateField(WorkBox.ICON_16_IMAGE_URL, WBColumn.WorkBoxURL));
                gridView.Columns.Add(WBUtils.HyperLinkField(WBColumn.Title, WBColumn.WorkBoxURL, sortColumn, ascending));
                gridView.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending));
                gridView.Columns.Add(WBUtils.BoundField(WBColumn.WorkBoxStatus, HorizontalAlign.Center, sortColumn, ascending));

                gridView.DataBind();


                if (ShowCreateNewLink)
                {
                    string createNewText = workBox.RecordsType.CreateNewWorkBoxText;
                    string createNewURL  = workBox.Collection.GetUrlForNewDialog(workBox, WorkBox.RELATION_TYPE__DYNAMIC);

                    createNewLink.Text = "<a href=\"#\" onclick=\"javascript: WorkBoxFramework_commandAction('" + createNewURL + "', 600, 500); \">" + createNewText + "</a>";
                }

                workBox.Dispose();
            }

            base.Render(writer);
        }
        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();
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            //WBTaxonomy recordsTypes = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);
            WBTaxonomy seriesTags = WBTaxonomy.GetSeriesTags(SPContext.Current.Site);

            WBTerm seriesTag = null;

            if (SeriesTag != null && SeriesTag != "")
            {
                Term seriesTagTerm = seriesTags.GetSelectedTermByPath(SeriesTag);
                if (seriesTagTerm != null)
                {
                    seriesTag = new WBTerm(seriesTags, seriesTagTerm);
                }
            }

            WBQuery query = new WBQuery();

            //query.AddEqualsFilter(WBColumn.RecordsType, workBox.RecordsType);

            if (seriesTag != null)
            {
                query.AddEqualsFilter(WBColumn.SeriesTag, seriesTag);
            }

            if (ReferenceID != null && ReferenceID != "")
            {
                query.AddEqualsFilter(WBColumn.ReferenceID, ReferenceID);
            }

            //            if (FilterByOwningTeam)
            //            query.AddEqualsFilter(WBColumn.OwningTeam, workBox.OwningTeam);


            if (sortColumn != null)
            {
                WBLogging.Debug("Sorting in Render with sortColumn: " + sortColumn.DisplayName);
            }
            else
            {
                WBLogging.Debug("SortColumn was null - so sorting by declared record date.");

                sortColumn = WBColumn.DeclaredRecord;
                ascending  = false;
            }

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

            query.AddViewColumn(WBColumn.Name);
            query.AddViewColumn(WBColumn.FileTypeIcon);
            query.AddViewColumn(WBColumn.EncodedAbsoluteURL);
            query.AddViewColumn(WBColumn.ReferenceDate);
            query.AddViewColumn(WBColumn.ProtectiveZone);
            query.AddViewColumn(WBColumn.DeclaredRecord);

            WBFarm farm = WBFarm.Local;

            using (SPSite site = new SPSite(farm.ProtectedRecordsLibraryUrl))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList recordsLibrary = web.GetList(farm.ProtectedRecordsLibraryUrl);

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

                    gridView.DataSource = dataTable;

                    gridView.Columns.Clear();
                    gridView.Columns.Add(WBUtils.DynamicIconTemplateField(WBColumn.FileTypeIcon, WBColumn.EncodedAbsoluteURL));
                    gridView.Columns.Add(WBUtils.HyperLinkField(WBColumn.Name, WBColumn.EncodedAbsoluteURL, sortColumn, ascending));
                    gridView.Columns.Add(WBUtils.BoundField(WBColumn.ReferenceDate, sortColumn, ascending));
                    gridView.Columns.Add(WBUtils.BoundField(WBColumn.ProtectiveZone, sortColumn, ascending));
                    gridView.Columns.Add(WBUtils.BoundField(WBColumn.DeclaredRecord, sortColumn, ascending));

                    gridView.DataBind();
                }
            }

            base.Render(writer);
        }
Beispiel #6
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();
            }
        }