private void renderPage()
        {
            // OK, so now we're finally in a position to load up the values of the page fields:

            SourceDocIcon.AlternateText = "Icon of document being publishing out.";
            SourceDocIcon.ImageUrl      = WBUtils.DocumentIcon32(sourceDocAsItem.Url);

            TitleField.Text = sourceFile.Title;

            ReadOnlyNameField.Text = sourceDocAsItem.Name;
            NameField.Text         = sourceDocAsItem.Name;
            OriginalFileName.Text  = sourceDocAsItem.WBxGetColumnAsString(WorkBox.COLUMN_NAME__ORIGINAL_FILENAME);

            DocumentFileNamingConvention.Text = documentRecordsType.DocumentNamingConvention.Replace("<", "&lt;").Replace(">", "&gt;");

            RecordsTypeUIControlValue.Value     = documentRecordsType.UIControlValue;
            PickRecordsTypeButton.OnClientClick = "WorkBoxFramework_pickANewRecordsType(WorkBoxFramework_PublishDoc_pickedANewRecordsType, '" + documentRecordsType.UIControlValue + "'); return false;";
            RecordsType.Text = documentRecordsType.FullPath.Replace("/", " / ");


            WBTermCollection <WBTerm> functionalAreas = sourceDocAsItem.WBxGetMultiTermColumn <WBTerm>(functionalAreasTaxonomy, WorkBox.COLUMN_NAME__FUNCTIONAL_AREA);

            functionalAreaFieldIsEditable = documentRecordsType.IsFunctionalAreaEditable;
            if (functionalAreaFieldIsEditable)
            {
                functionalAreasTaxonomy.InitialiseTaxonomyControl(FunctionalAreaField, WorkBox.COLUMN_NAME__FUNCTIONAL_AREA, false, false, this);

                String functionalAreaValue = functionalAreas.UIControlValue;
                if (functionalAreaValue.Contains(";"))
                {
                    string[] allFunctionalValues = functionalAreaValue.Split(';');
                    functionalAreaValue = allFunctionalValues[0];
                }

                FunctionalAreaField.Text = functionalAreaValue;
            }
            else
            {
                ReadOnlyFunctionalAreaField.Text = functionalAreas.Names();
            }

            bool    userCanPublishToPublic = false;
            SPGroup publishersGroup        = WorkBox.OwningTeam.PublishersGroup(SPContext.Current.Site);

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

            String selectedZone = WBRecordsType.PROTECTIVE_ZONE__PROTECTED;

            if (userCanPublishToPublic)
            {
                if (destinationType.Equals(WorkBox.PUBLISHING_OUT_DESTINATION_TYPE__PUBLIC_WEB_SITE))
                {
                    WBLogging.Generic.Verbose("In PUBLIC: The destination type was: " + destinationType);
                    selectedZone = WBRecordsType.PROTECTIVE_ZONE__PUBLIC;
                }
                else if (destinationType.Equals(WorkBox.PUBLISHING_OUT_DESTINATION_TYPE__PUBLIC_EXTRANET))
                {
                    WBLogging.Generic.Verbose("In PUBLIC EXTRANET: The destination type was: " + destinationType);
                    selectedZone = WBRecordsType.PROTECTIVE_ZONE__PUBLIC_EXTRANET;
                }
                else
                {
                    WBLogging.Generic.Verbose("The destination type was: " + destinationType);
                    selectedZone = WBRecordsType.PROTECTIVE_ZONE__PROTECTED;
                }
            }
            else
            {
                selectedZone = WBRecordsType.PROTECTIVE_ZONE__PROTECTED;
            }

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

            protectiveZoneList.Add(selectedZone);

            ProtectiveZone.DataSource = protectiveZoneList;
            ProtectiveZone.DataBind();

            ProtectiveZone.SelectedValue = selectedZone;


            if (showSubjectTags)
            {
                if (documentRecordsType.IsDocumentSubjectTagsRequired)
                {
                    SubjectTagsTitle.Text = "Subject Tags" + WBConstant.REQUIRED_ASTERISK;
                }
                else
                {
                    SubjectTagsTitle.Text = "Subject Tags (optional)";
                }
                SubjectTagsDescription.Text = documentRecordsType.DocumentSubjectTagsDescription;

                subjectTagsTaxonomy.InitialiseTaxonomyControl(SubjectTagsField, WorkBox.COLUMN_NAME__SUBJECT_TAGS, true, true, this);
                WBTermCollection <WBTerm> subjectTags = sourceDocAsItem.WBxGetMultiTermColumn <WBTerm>(subjectTagsTaxonomy, WorkBox.COLUMN_NAME__SUBJECT_TAGS);
                SubjectTagsField.Text = subjectTags.WBxToString();
            }


            if (showReferenceID)
            {
                if (documentRecordsType.IsDocumentReferenceIDRequired)
                {
                    ReferenceIDTitle.Text = "Reference ID" + WBConstant.REQUIRED_ASTERISK;
                }
                else
                {
                    ReferenceIDTitle.Text = "Reference ID (optional)";
                }
                ReferenceIDDescription.Text = documentRecordsType.DocumentReferenceIDDescription;
                ReferenceID.Text            = sourceDocAsItem.WBxGetColumnAsString(WorkBox.COLUMN_NAME__REFERENCE_ID);
            }

            if (showReferenceDate)
            {
                if (documentRecordsType.IsDocumentReferenceDateRequired)
                {
                    ReferenceDateTitle.Text = "Reference Date" + WBConstant.REQUIRED_ASTERISK;
                }
                else
                {
                    ReferenceDateTitle.Text = "Reference Date (optional)";
                }
                ReferenceDateDescription.Text = documentRecordsType.DocumentReferenceDateDescription;
                if (sourceDocAsItem.WBxColumnHasValue(WorkBox.COLUMN_NAME__REFERENCE_DATE))
                {
                    ReferenceDate.SelectedDate = (DateTime)sourceDocAsItem[WorkBox.COLUMN_NAME__REFERENCE_DATE];
                }
                else
                {
                    ReferenceDate.SelectedDate = DateTime.Now;
                }
            }

            if (showSeriesTag)
            {
                if (documentRecordsType.IsDocumentSeriesTagRequired)
                {
                    SeriesTagTitle.Text = "Series Tag" + WBConstant.REQUIRED_ASTERISK;
                }
                else
                {
                    SeriesTagTitle.Text = "Series Tag (optional)";
                }
                SeriesTagDescription.Text = documentRecordsType.DocumentSeriesTagDescription;

                SeriesTagDropDownList.DataSource     = GetSeriesTagDataSource(documentRecordsType.DocumentSeriesTagParentTerm(seriesTagsTaxonomy));
                SeriesTagDropDownList.DataTextField  = "SeriesTagTermName";
                SeriesTagDropDownList.DataValueField = "SeriesTagTermUIControlValue";
                SeriesTagDropDownList.DataBind();

                if (sourceDocAsItem.WBxColumnHasValue(WorkBox.COLUMN_NAME__SERIES_TAG))
                {
                    SeriesTagDropDownList.SelectedValue = sourceDocAsItem.WBxGetSingleTermColumn <WBTerm>(seriesTagsTaxonomy, WorkBox.COLUMN_NAME__SERIES_TAG).UIControlValue;
                }
            }

            if (showScanDate)
            {
                if (documentRecordsType.IsDocumentScanDateRequired)
                {
                    ScanDateTitle.Text = "Scan Date" + WBConstant.REQUIRED_ASTERISK;
                }
                else
                {
                    ScanDateTitle.Text = "Scan Date (optional)";
                }
                ScanDateDescription.Text = documentRecordsType.DocumentScanDateDescription;
                if (sourceDocAsItem.WBxColumnHasValue(WorkBox.COLUMN_NAME__SCAN_DATE))
                {
                    ScanDate.SelectedDate = (DateTime)sourceDocAsItem[WorkBox.COLUMN_NAME__SCAN_DATE];
                }
            }

            teamsTaxonomy.InitialiseTaxonomyControl(OwningTeamField, WorkBox.COLUMN_NAME__OWNING_TEAM, false);
            TaxonomyFieldValue owningTeamValue = sourceDocAsItem[WorkBox.COLUMN_NAME__OWNING_TEAM] as TaxonomyFieldValue;

            OwningTeamField.Text = owningTeamValue.WBxUIControlValue();

            teamsTaxonomy.InitialiseTaxonomyControl(InvolvedTeamsField, WorkBox.COLUMN_NAME__INVOLVED_TEAMS, true);
            TaxonomyFieldValueCollection involvedTeamsValues = sourceDocAsItem[WorkBox.COLUMN_NAME__INVOLVED_TEAMS] as TaxonomyFieldValueCollection;

            InvolvedTeamsField.Text = involvedTeamsValues.WBxUIControlValue();


            if (functionalAreaFieldIsEditable)
            {
                FunctionalAreaField.Focus();
            }
            else
            {
                PickRecordsTypeButton.Focus();
            }
        }
Esempio n. 2
0
        public String GetStandardHTMLTableRows()
        {
            SPListItem currentItem = this.CurrentItem;
            String     html        = "";

            if (this.ItemIDs.Count == 0)
            {
                WBLogging.Debug("process.ItemIDs.Count == 0");
                html += "<i>No documents selected!</i>";
            }
            else
            {
                int  numberOfDocuments = this.ItemIDs.Count;
                int  itemIndex         = -1;
                int  currentItemIndex  = -1;
                bool before            = true;
                foreach (String itemID in this.ItemIDs)
                {
                    itemIndex++;

                    String filename = this.MappedFilenames[itemID];

                    WBLogging.Debug("list through item with name: " + filename);
                    if (itemID == this.CurrentItemID)
                    {
                        currentItemIndex = itemIndex;
                        if (itemIndex != 0)
                        {
                            // OK so we've got to close the table row of the already published documents:
                            html += @"
    </td>
</tr>";
                        }

                        before = false;

                        if (this.PublishMode != PUBLISH_MODE__ALL_TOGETHER)
                        {
                            String originalFilename = "";
                            if (currentItem != null)
                            {
                                originalFilename = currentItem.WBxGetColumnAsString(WorkBox.COLUMN_NAME__ORIGINAL_FILENAME);
                            }

                            html += @"
<tr>
    <td class=""wbf-field-name-panel"">
        <div class=""wbf-field-name"">Publishing Document</div>
    </td>
    <td class=""wbf-field-value-panel"">
        <div class=""wbf-field-read-only-title"">
            <table border=""0"" cellpadding=""0"" cellspacing=""2px"">
                <tr>
                    <td rowspan=""2"" style=""padding-right: 10px; "">
                        <img src='" + WBUtils.DocumentIcon32(filename) + "' alt='Icon for file " + filename + @"'/>
                    </td>
                    <td>" + filename + @"</td>
                </tr>
                <tr>
                    <td>" + originalFilename + @"</td>
                </tr>
            </table>
        </div>
    </td>
</tr>
";
                        }
                        else
                        {
                            // So if we're here then we are publishing all together - so let's slightly change the layout:
                            html += @"
<tr>
    <td class=""wbf-field-name-panel"">
        <div class=""wbf-field-name"">Publishing Documents</div>
    </td>
    <td class=""wbf-field-value-panel"">
        <div>
            <img src='/_layouts/images/WorkBoxFramework/list-item-16.png' alt='Unpublished document'/>
            <img src='" + WBUtils.DocumentIcon16(filename) + "' alt='Icon for file " + filename + "'/> " + filename + @"
        </div>
";
                        }
                    }
                    else
                    {
                        if (before)
                        {
                            String statusIcon    = "/_layouts/images/WorkBoxFramework/green-tick-16.png";
                            String statusAltText = "Successfully published";
                            if (this.ItemStatus[itemID] == WBPublishingProcess.DOCUMENT_STATUS__ERROR)
                            {
                                statusIcon    = "/_layouts/images/WorkBoxFramework/red-cross-16.png";
                                statusAltText = "Failed to publish";
                            }

                            if (itemIndex == 0)
                            {
                                // OK so let's start the table row of the documents that have already been published:
                                html += @"
<tr>
    <td class=""wbf-field-name-panel"">
        <div class=""wbf-field-name""></div>
    </td>
    <td class=""wbf-field-name-panel"">
";
                            }

                            html += @"
        <div>
            <img src='" + statusIcon + "' alt='" + statusAltText + @"'/>
            <img src='" + WBUtils.DocumentIcon16(filename) + "' alt='Icon for file " + filename + "'/> " + filename + @"
        </div>
";
                        }
                        else
                        {
                            if (itemIndex == currentItemIndex + 1 && this.PublishMode != PUBLISH_MODE__ALL_TOGETHER)
                            {
                                html += @"
<tr>
    <td class=""wbf-field-name-panel"">
        <div class=""wbf-field-name""></div>
    </td>
    <td class=""wbf-field-name-panel"">
";
                            }

                            html += @"
        <div>
            <img src='/_layouts/images/WorkBoxFramework/list-item-16.png' alt='Unpublished document'/>
            <img src='" + WBUtils.DocumentIcon16(filename) + "' alt='Icon for file " + filename + "'/> " + filename + @"
        </div>
";

                            if (itemIndex == numberOfDocuments - 1)
                            {
                                html += @"
    </td>
</tr>";
                            }
                        }
                    }
                }
            }
            return(html);
        }