示例#1
0
        /// <summary>
        /// The Method would open up and initialze the Article Information Plugin window. You can use this to set Taxonomy items, Article MetaData etc.
        /// </summary>
        private void OpenArticleInformation()
        {
            try
            {
                ArticleDetail.Open();

                if (GetArticleNumber() != null)
                {
                    CheckoutStatus checkedOut = SitecoreClient.GetLockedStatus(GetArticleNumber());
                    if (checkedOut.User == SitecoreUser.GetUser().Username)
                    {
                        SaveToSitecoreBtn.Enabled  = true;
                        ArticlePreviewMenu.Enabled = true;
                    }
                    else
                    {
                        SaveToSitecoreBtn.Enabled  = false;
                        ArticlePreviewMenu.Enabled = false;
                    }
                }
            }
            catch (UnauthorizedAccessException uax)
            {
                Globals.SitecoreAddin.LogException("ESRibbon.OpenArticleInformation: Error loading the article information window! Unauthorized access to API handler. Asking user to login again", uax);
                MessageBox.Show(Constants.SESSIONTIMEOUTERRORMESSAGE);
            }
            catch (Exception ex)
            {
                Globals.SitecoreAddin.LogException("ESRibbon.OpenArticleInformation: Error loading the article information window!", ex);
                MessageBox.Show
                    (@"An error has occurred while attempting to display the article information window. Please restart Word and try again." +
                    Environment.NewLine + Environment.NewLine +
                    @"If the problem persists, contact your system administrator.", @"Informa", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void InitializeLogin()
        {
            try
            {
                loginControl1.ToReveal = uxArticlePanel;
                loginControl1.ShowLogin();


                if (!SitecoreClient.IsAvailable())
                {
                    SitecoreUser.GetUser().Logout();
                }
                if (SitecoreUser.GetUser().IsLoggedIn)
                {
                    _wordUtils = new WordUtils();
                    loginControl1.HideLogin();
                    UpdateFieldsUsingSitecore();
                }
            }
            catch (UnauthorizedAccessException uax)
            {
                Globals.SitecoreAddin.LogException("ArticleDetail.InitializeLogin: Unauthorized access to API handler. Must re-login", uax);
                throw uax;
            }
            catch (Exception ex)
            {
                var ax = new ApplicationException("ArticleDetail.InitializeLogin: Error setting up the login screen!", ex);
                Globals.SitecoreAddin.LogException(ax.Message, ex);
                throw ax;
            }
        }
示例#3
0
        /// <summary>
        /// Ascertain valid article number
        /// Link to article
        /// Indicate item is locked
        /// </summary>
        /// <param name="articleNumber"></param>
        /// <param name="prompt">Flag to prompt user if problem occurs</param>
        public bool CheckOut(string articleNumber, bool prompt = true)
        {
            if (articleNumber.IsNullOrEmpty())
            {
                MessageBox.Show
                    (@"Please enter an article number to link to.", @"Informa",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            try
            {
                bool exists = SitecoreClient.DoesArticleExist(articleNumber);
                if (!exists && prompt)
                {
                    MessageBox.Show
                        (@"Article number entered does not exist.", @"Informa",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                ArticleNumber = articleNumber;
                //uxArticleNumberLabel.Text = articleNumber;

                PluginModels.CheckoutStatus checkedOut = SitecoreClient.GetLockedStatus(articleNumber);

                if (!checkedOut.Locked)
                { //if unlocked, then lock it by current user
                    if (SitecoreClient.DoesArticleHaveText(articleNumber) && prompt)
                    {
                        DialogResult dialogResult = MessageBox.Show
                                                        (@"This article already has some content uploaded. "
                                                        + @"If you choose to check out the article now and later upload, "
                                                        + @"you will overwrite that content. "
                                                        + @"Are you sure you wish to checkout this article?",
                                                        @"Informa",
                                                        MessageBoxButtons.YesNo,
                                                        MessageBoxIcon.Question);
                        if (dialogResult != DialogResult.Yes)
                        {
                            return(false);
                        }
                    }
                    SitecoreClient.CheckOutArticle(articleNumber, SitecoreUser.GetUser().Username);
                }
                SetCheckedOutStatus();
                if (_parent.CloseOnSuccessfulLock && IsCheckedOutByMe)
                {
                    return(true);
                }
                //establish link, regardless of lock status
                _parent.SetArticleDetails(SitecoreClient.ForceReadArticleDetails(articleNumber));
                _parent.UpdateFields();
                return(true);
            }
            catch (Exception ex)
            {
                Globals.SitecoreAddin.LogException("Error in article details when checking out article: [" + articleNumber + "]", ex);
                throw;
            }
        }
示例#4
0
 /// <summary>
 /// This method is used to perform the lock action. This is called when "Yes" is clicked in the lock confirmation box.
 /// </summary>
 public void LockYesActionMethod()
 {
     if (SitecoreClient.CheckOutArticle(_articleNumber, SitecoreUser.GetUser().Username))
     {
         _articleInformationControl.CheckWordDocVersion(_parent.ArticleDetails);
     }
     SetCheckedOutStatus();
 }
示例#5
0
        /// <summary>
        /// Get from sitecore checked out status, then set control accordingly
        ///
        /// Unprotects document if locked by current user
        /// </summary>
        public void SetCheckedOutStatus()
        {
            if (_parent == null || _parent.ArticleDetails == null)
            {
                return;
            }
            DocumentCustomProperties = new DocumentCustomProperties(SitecoreAddin.ActiveDocument);
            string articleNum = _parent.GetArticleNumber();

            if (!string.IsNullOrEmpty(_articleNumber))
            { //document is linked to an article
                SetArticleNumber(articleNum);
                CheckoutStatus checkedOut;
                if (_parent.ArticleDetails.ArticleGuid != Guid.Empty)
                {
                    checkedOut = SitecoreClient.GetLockedStatus(_parent.ArticleDetails.ArticleGuid);
                }
                else
                {
                    checkedOut = SitecoreClient.GetLockedStatus(articleNum);
                }
                _articleInformationControl.IsCheckedOut = checkedOut.Locked;
                if (_articleInformationControl.IsCheckedOut)
                {
                    if (SitecoreUser.GetUser().Username == checkedOut.User)
                    { //locked by me
                        IndicateCheckedOutByMe(checkedOut);
                        _parent.articleStatusBar1.ChangeLockButtonStatus(LockStatus.Locked);
                        _articleInformationControl.UpdateControlsForLockedStatus();
                    }
                    else
                    { //locked by other
                        IndicateCheckedOutByOther(checkedOut);
                        _parent.articleStatusBar1.ChangeLockButtonStatus(LockStatus.Locked);
                        _articleInformationControl.UpdateControlsForUnlockedStatus();
                    }
                    uxLockStatusLabel.Text = @"Locked";
                }
                else
                { //unlocked
                    IndicateUnlocked();
                    _articleInformationControl.UpdateControlsForUnlockedStatus();
                }
                uxRefreshStatus.Enabled = true;
            }
            else
            { //document is not linked to an article
                DocumentProtection.Unprotect(DocumentCustomProperties);
                _articleInformationControl.IsCheckedOutByMe = false;
                _articleInformationControl.IsCheckedOut     = false;
                _parent.PreLinkEnable();
            }
        }
示例#6
0
        /// <summary>
        /// Get from sitecore checked out status, then set control accordingly
        ///
        /// Unprotects document if locked by current user
        /// </summary>
        public void SetCheckedOutStatus()
        {
            if (_parent == null || _parent.ArticleDetails == null)
            {
                return;
            }
            _documentCustomProperties = new DocumentCustomProperties(SitecoreAddin.ActiveDocument);
            string articleNum = _parent.GetArticleNumber();

            if (!articleNum.IsNullOrEmpty())
            { //document is linked to an article
                SetArticleNumber(articleNum);
                PluginModels.CheckoutStatus checkedOut;
                if (_parent.ArticleDetails.ArticleGuid != Guid.Empty)
                {
                    checkedOut = SitecoreClient.GetLockedStatus(_parent.ArticleDetails.ArticleGuid);
                }
                else
                {
                    checkedOut = SitecoreClient.GetLockedStatus(articleNum);
                }
                IsCheckedOut = checkedOut.Locked;
                if (IsCheckedOut)
                {
                    if (SitecoreUser.GetUser().Username == checkedOut.User)
                    { //locked by me
                        IndicateCheckedOutByMe(checkedOut);
                    }
                    else
                    { //locked by other
                        IndicateCheckedOutByOther(checkedOut);
                    }
                    //uxLockStatusLabel.Text = @"Locked";
                }
                else
                { //unlocked
                    IndicateUnlocked();
                }
                //uxRefreshStatus.Enabled = true;
            }
            else
            { //document is not linked to an article
                DocumentProtection.Unprotect(_documentCustomProperties);
                IsCheckedOutByMe = false;
                IsCheckedOut     = false;

                _parent.PreLinkEnable();
            }
        }
示例#7
0
        protected void SendWordDocumentToSitecore(Document activeDocument, DocumentCustomProperties documentCustomProperties, string articleNumber, ArticleStruct articleDetails)
        {
            string extension = GetExtension(activeDocument);

            DocumentProtection.Protect(documentCustomProperties);

            byte[] data = _wordUtils.GetWordBytes(activeDocument);
            if (data == null)
            {
                throw new Exception("Error saving file to disk.");
            }

            DocumentProtection.Unprotect(documentCustomProperties);
            string uploader = SitecoreUser.GetUser().Username;
            int    wordSitecoreVersionNumber = articleDetails.ArticleGuid != Guid.Empty
                                                ? this.SendDocumentToSitecoreByGuid(articleDetails.ArticleGuid, data, extension, uploader)
                                                : this.SendDocumentToSitecore(articleNumber, data, extension, uploader);

            documentCustomProperties.WordSitecoreVersionNumber = wordSitecoreVersionNumber;
        }
示例#8
0
        void OpenArticleInformationWindowIfNeeded(Word.Document doc)
        {
            var props = new DocumentCustomProperties(doc);

            if (props.PluginName != Constants.InformaPluginName)
            {
                return;
            }
            string articleNumber = props.ArticleNumber;

            if (!string.IsNullOrEmpty(articleNumber))
            {
                Log("Document opened with article number: " + articleNumber);
                if (!SitecoreUser.GetUser().IsLoggedIn)
                {
                    ArticleDetail.Open(true);
                }
                else
                {
                    CheckoutStatus checkedOut = SitecoreClient.GetLockedStatus(articleNumber);
                    if (checkedOut.User == SitecoreUser.GetUser().Username)
                    {
                        DocumentProtection.Unprotect(props);
                        return;
                    }
                    if (!checkedOut.Locked)
                    {
                        if (DialogFactory.PromptAutoLock() == DialogResult.Yes &&
                            SitecoreClient.CheckOutArticle(articleNumber, SitecoreUser.GetUser().Username))
                        {
                            DocumentProtection.Unprotect(props);
                        }
                    }
                    else
                    {
                        ArticleDetail.Open();
                    }
                }
            }
        }
示例#9
0
 private void SitecoreAddin_SelectedWordDocumentChanged()
 {
     if (_user.IsLoggedIn == false || string.IsNullOrEmpty(GetArticleNumber()))
     {
         SaveToSitecoreBtn.Enabled  = false;
         ArticlePreviewMenu.Enabled = false;
     }
     else
     {
         CheckoutStatus checkedOut = SitecoreClient.GetLockedStatus(GetArticleNumber());
         if (checkedOut.User == SitecoreUser.GetUser().Username)
         {
             SaveToSitecoreBtn.Enabled  = true;
             ArticlePreviewMenu.Enabled = true;
         }
         else
         {
             SaveToSitecoreBtn.Enabled  = false;
             ArticlePreviewMenu.Enabled = false;
         }
     }
 }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        public ArticleDetail()
        {
            SitecoreAddin.TagActiveDocument();

            _sitecoreArticle             = new SitecoreClient();
            _documentCustomProperties    = new DocumentCustomProperties(SitecoreAddin.ActiveDocument);
            _structConverter             = new StructConverter();
            ArticleDetails.ArticleNumber = _documentCustomProperties.ArticleNumber;

            InitializeComponent();

            articleDetailsPageSelector.LinkToParent(this);


            articleStatusBar1.LinkToParent(this);
            if (!string.IsNullOrEmpty(_documentCustomProperties.ArticleNumber))
            {
                articleStatusBar1.DisplayStatusBar(true, _documentCustomProperties.ArticleNumber);
            }
            else
            {
                articleStatusBar1.DisplayStatusBar(false, _documentCustomProperties.ArticleNumber);
            }

            if (this.articleDetailsPageSelector.pageArticleInformationControl._isCheckedOut)
            {
                articleStatusBar1.ChangeLockButtonStatus(LockStatus.Unlocked);
            }
            else
            {
                articleStatusBar1.ChangeLockButtonStatus(LockStatus.Locked);
            }

            articleDetailsPageSelector.InitializePages();
            SitecoreUser.GetUser().ResetAuthenticatedSubscription();
            SitecoreUser.GetUser().Authenticated += PopulateFieldsOnAuthentication;
            InitializeLogin();
        }
示例#11
0
        private void uxSaveMetadata_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            var command = articleDetailsPageSelector.pageWorkflowControl.GetSelectedCommandState();

            // Checking for Taxonomy is the workflow state is final
            if (command.SendsToFinal && articleDetailsPageSelector.GetTaxonomyCount() < 1)
            {
                MessageBox.Show(@"Select at least one taxonomy item for the article!", @"Informa", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            try
            {
                if (articleDetailsPageSelector.pageWorkflowControl.uxUnlockOnSave.Enabled)
                {
                    workflowChange_UnlockOnSave = articleDetailsPageSelector.pageWorkflowControl.uxUnlockOnSave.Checked;
                }

                var articleDate = articleDetailsPageSelector.GetDate();

                //var timeUtc = DateTime.UtcNow;
                //TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
                DateTime currentTime = DateTime.Now;// TimeZoneInfo.ConvertTimeFromUtc(timeUtc, easternZone);

                if (articleDate < currentTime)
                {
                    var result = WantsToSetArticleDateToNow(command);
                    if (result == DialogResult.Yes)
                    {
                        articleDetailsPageSelector.SetDate(DateTime.Now, true);
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        MessageBox.Show("Save cancelled.");
                        return;
                    }
                }

                SuspendLayout();

                var  isPublished = ArticleDetails.IsPublished;
                Guid guidCopy    = ArticleDetails.ArticleGuid;
                ArticleDetails             = articleDetailsPageSelector.GetArticleDetailsWithoutDocumentParsing();
                ArticleDetails.ArticleGuid = guidCopy;
                ArticleDetails.IsPublished = isPublished;
                ArticleDetails.IsPublished = ArticleDetails.IsPublished;
                ArticleDetails.ArticleSpecificNotifications = articleDetailsPageSelector.pageWorkflowControl.GetNotifyList();

                ArticleDetails.WordCount        = SitecoreAddin.ActiveDocument.ComputeStatistics(0);
                ArticleDetails.CommandID        = articleDetailsPageSelector.pageWorkflowControl.GetSelectedCommand();
                ArticleDetails.NotificationText = articleDetailsPageSelector.pageWorkflowControl.GetNotificationText();

                var lockStateBeforeSaveMetaData = SitecoreClient.GetLockedStatus(ArticleDetails.ArticleGuid);
                SitecoreClient.SaveMetadataToSitecore(ArticleDetails.ArticleNumber, _structConverter.GetServerStruct(ArticleDetails));
                //I know the following checks are weird, but issue IIPP-1031 occurs sometimes only on UAT env. So had to hack around it.
                //On UAT after SaveMetadataToSitecore, the locked status becomes false for no apparent reason.
                var lockStateAfterSaveMetaData = SitecoreClient.GetLockedStatus(ArticleDetails.ArticleGuid);
                if (lockStateBeforeSaveMetaData.Locked && lockStateAfterSaveMetaData.Locked == false && workflowChange_UnlockOnSave == false)
                {
                    SitecoreClient.CheckOutArticle(ArticleDetails.ArticleNumber, SitecoreUser.GetUser().Username);
                }

                if (articleDetailsPageSelector.pageWorkflowControl.uxUnlockOnSave.Checked)
                {
                    articleDetailsPageSelector.pageArticleInformationControl.CheckIn(false);
                }
                articleDetailsPageSelector.pageWorkflowControl.UpdateFields(ArticleDetails.ArticleGuid != Guid.Empty
                                                ? SitecoreClient.GetWorkflowState(ArticleDetails.ArticleGuid)
                                                : SitecoreClient.GetWorkflowState(ArticleDetails.ArticleNumber), ArticleDetails);
                articleDetailsPageSelector.pageRelatedArticlesControl.PushSitecoreChanges();
                articleDetailsPageSelector.UpdateFields();
                articleDetailsPageSelector.ResetChangedStatus(true);

                UpdateFieldsAfterSave();
                DocumentPropertyEditor.WritePublicationAndDate(SitecoreAddin.ActiveDocument, articleDetailsPageSelector.GetPublicationName(), articleDetailsPageSelector.GetProperDate());

                //TamerM - 2016-03-22: Prompt and ReExport  NLM FEED
                NLMFeedUtils.PromptAndReExportNLMFeed(ArticleDetails.ArticleNumber, ArticleDetails.IsPublished);

                if (workflowChange_UnlockOnSave)
                {
                    EnablePreview();
                    uxCreateArticle.Visible = false;
                }
                articleStatusBar1.RefreshWorkflowDetails();

                MessageBox.Show(@"Metadata saved!", @"Informa");
            }
            catch (WebException wex)
            {
                AlertConnectionFailure();
                Globals.SitecoreAddin.LogException("Web connection error when saving metadata!", wex);
            }
            catch (Exception ex)
            {
                Globals.SitecoreAddin.LogException("Error when saving meta data!", ex);
                MessageBox.Show(@"Error when saving metadata! Error recorded in logs.", @"Informa");
            }
            finally
            {
                ResumeLayout();
                Cursor = Cursors.Default;
                workflowChange_UnlockOnSave = false;
            }

            Document activeDocument = SitecoreAddin.ActiveDocument;
            var      path           = activeDocument.Path;

            if (!activeDocument.ReadOnly && !string.IsNullOrWhiteSpace(path))
            {
                WordUtils.Save(activeDocument);
            }
        }
示例#12
0
        public ArticleDetails()
        {
            try
            {
                Globals.SitecoreAddin.Log("Initializing the article details window...");
                InitializeComponent();
                Opacity = 0;

                _scTree   = new SCTree();
                _scServer = new SCServer();

                // TEMPORARY code to deal with QA login
                var credCache = new CredentialCache();
                var netCred   =
                    new NetworkCredential("velir", "ebi3000");
                credCache.Add(new Uri(_scTree.Url), "Basic", netCred);
                credCache.Add(new Uri(_scServer.Url), "Basic", netCred);

                _scTree.PreAuthenticate = true;
                _scTree.Credentials     = credCache;

                _scServer.PreAuthenticate = true;
                _scServer.Credentials     = credCache;

                // end temporary

                _user = SitecoreUser.GetUser();

                _authors = _scTree.GetAuthors().Select(t => new StaffStruct()
                {
                    ID = t.ID, Name = t.Name, Publications = t.Publications
                }).ToArray().ToList();
                _editors = _scTree.GetEditors().Select(t => new StaffStruct()
                {
                    ID = t.ID, Name = t.Name, Publications = t.Publications
                }).ToArray().ToList();

                _sitecoreArticle          = new SitecoreArticle();
                _wordUtils                = new WordUtils();
                _wordApp                  = SitecoreAddin.WordApp;
                _documentCustomProperties = new DocumentCustomProperties(_wordApp, _wordApp.ActiveDocument);


                try
                {
                    InitializeDropdowms();
                    InitializeControllers();
                    Opacity = 1;

                    SetCheckedOutStatus();

                    _connectedAtStart = true;
                }
                catch
                (WebException e)
                {
                    AlertConnectionFailed();
                    Globals.SitecoreAddin.LogException("Error getting metadata or checked out status!", e);
                    throw new ApplicationException("Error getting metadata or checked out status!", e);
                }

                var deleteIcon = new ImageList();
                deleteIcon.Images.Add(Resources.delete_icon);
                uxSelectedAuthors.SmallImageList = deleteIcon;
                uxSelectedEditors.SmallImageList = deleteIcon;

                string articleNumber = GetArticleNumber();
                if (!articleNumber.IsNullOrEmpty())
                {
                    uxArticleNumber.Text = articleNumber;
                    GetArticeDetailsFromSitecore();
                }
                uxLockStatus.Refresh();
                Globals.SitecoreAddin.Log("Article details window initialized.");
            }
            catch (Exception ex)
            {
                Globals.SitecoreAddin.LogException("Error while loading article details!", ex);
            }
        }
示例#13
0
        protected void InitializeControllers()
        {
            List <SitecoreTree.TaxonomyStruct> industries = _scTree.SearchIndustries("").ToList();
            HDirectoryStruct industryDirectory            = _scTree.GetHierarchyByGuid(new Guid(Constants.INDUSTRY_GUID));

            Guid subjectGuid = new Guid(Constants.SUBJECT_GUID);
            List <SitecoreTree.TaxonomyStruct> subjects = _scTree.SearchTaxonomy(subjectGuid, "").ToList();
            HDirectoryStruct subjectDirectory           = _scTree.GetHierarchyByGuid(subjectGuid);

            Guid regionGuid = new Guid(Constants.REGION_GUID);
            List <SitecoreTree.TaxonomyStruct> regions = _scTree.SearchTaxonomy(regionGuid, "").ToList();
            HDirectoryStruct regionDirectory           = _scTree.GetHierarchyByGuid(regionGuid);

            Guid therapeuticCategoryGuid = new Guid(Constants.THERAPEUTIC_CATEGORY_GUID);
            List <SitecoreTree.TaxonomyStruct> therapeuticCategories = _scTree.SearchTaxonomy(therapeuticCategoryGuid, "").ToList();
            HDirectoryStruct therapeuticCategoryDirectory            = _scTree.GetHierarchyByGuid(therapeuticCategoryGuid);

            Guid marketSegmentGuid = new Guid(Constants.MARKET_SEGMENT_GUID);
            List <SitecoreTree.TaxonomyStruct> marketSegments = _scTree.SearchTaxonomy(marketSegmentGuid, "").ToList();
            HDirectoryStruct marketSegmentDirectory           = _scTree.GetHierarchyByGuid(marketSegmentGuid);

            _industryTabController = new TaxonomyTabController(uxIndustriesKeywords, uxIndustriesViewTree, uxIndustriesViewSearch,
                                                               uxIndustriesResults, uxIndustriesResultsTree, uxIndustriesSelected, industries, industryDirectory,
                                                               uxIndustriesIcon, tabControl1, tabControl1.TabPages[4]);

            _subjectTabController = new TaxonomyTabController(uxSubjectsKeywords, uxSubjectsViewTree, uxSubjectsViewSearch, uxSubjectsResults,
                                                              uxSubjectsResultsTree, uxSubjectsSelected, subjects, subjectDirectory, uxSubjectsIcon, tabControl1, tabControl1.TabPages[5]);

            _geographyTabController = new TaxonomyTabController(uxGeographyKeywords, uxGeographyViewTree, uxGeographyViewSearch, uxGeographyResults,
                                                                uxGeographyResultsTree, uxGeographySelected, regions, regionDirectory, uxGeographyIcon, tabControl1, tabControl1.TabPages[6]);

            _therapeuticCategoriesTabController = new TaxonomyTabController(uxTherapeuticCategoriesKeywords, uxTherapeuticCategoriesViewTree, uxTherapeuticCategoriesViewSearch,
                                                                            uxTherapeuticCategoriesResults, uxTherapeuticCategoriesResultsTree, uxTherapeuticCategoriesSelected, therapeuticCategories,
                                                                            therapeuticCategoryDirectory, uxTherapeuticCategoriesIcon, tabControl1, tabControl1.TabPages[7]);

            _marketSegmentsTabController = new TaxonomyTabController(uxMarketSegmentsKeywords, uxMarketSegmentsViewTree, uxMarketSegmentsViewSearch, uxMarketSegmentsResults,
                                                                     uxMarketSegmentsResultsTree, uxMarketSegmentsSelected, marketSegments, marketSegmentDirectory, uxMarketSegmentsIcon, tabControl1, tabControl1.TabPages[8]);

            tabControl1.TabPages[4].Tag = _industryTabController;
            tabControl1.TabPages[5].Tag = _subjectTabController;
            tabControl1.TabPages[6].Tag = _geographyTabController;
            tabControl1.TabPages[7].Tag = _therapeuticCategoriesTabController;
            tabControl1.TabPages[8].Tag = _marketSegmentsTabController;

            _taxonomyTabControllers.Add(_industryTabController);
            _taxonomyTabControllers.Add(_subjectTabController);
            _taxonomyTabControllers.Add(_geographyTabController);
            _taxonomyTabControllers.Add(_therapeuticCategoriesTabController);
            _taxonomyTabControllers.Add(_marketSegmentsTabController);

            loginControl1.ToReveal = uxArticlePanel;


            if (SitecoreUser.GetUser().LoggedIn)
            {
                loginControl1.HideLogin();
            }

            Image collapsedImage = Properties.Resources.right_icon;
            Image expandedImage  = Properties.Resources.down_icon;

            _industriesExpandPanel = new ExpandFlowPanel(uxSummaryIndustriesExpand, uxSummaryIndustriesFlow,
                                                         expandedImage, collapsedImage);
            _subjectsExpandPanel = new ExpandFlowPanel(uxSummarySubjectsExpand, uxSummarySubjectsFlow,
                                                       expandedImage, collapsedImage);
            _geographyExpandPanel = new ExpandFlowPanel(uxSummaryGeographyExpand, uxSummaryGeographyFlow,
                                                        expandedImage, collapsedImage);
            _therapeuticCategoriesExpandPanel = new ExpandFlowPanel(uxSummaryTherapeuticCategoriesExpand,
                                                                    uxSummaryTherapeuticCategoriesFlow, expandedImage, collapsedImage);
            _marketSegmentsExpandPanel = new ExpandFlowPanel(uxSummaryMarketSegmentsExpand, uxSummaryMarketSegmentsFlow,
                                                             expandedImage, collapsedImage);
        }
示例#14
0
        /// <summary>
        /// Checks out article associated with _parent.ArticleDetails.ArticleGuid
        /// </summary>
        /// <returns></returns>
        public bool CheckOut(bool prompt = false)
        {
            Guid articleGuid = _parent.ArticleDetails.ArticleGuid;

            if (articleGuid == Guid.Empty)
            {
                MessageBox.Show
                    (@"No article associated with file.", @"Informa",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            try
            {
                bool exists = SitecoreClient.DoesArticleExist(articleGuid);
                if (!exists)
                {
                    MessageBox.Show
                        (@"Article no longer exists on Sitecore", @"Informa",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                ArticleNumber = _parent.ArticleDetails.ArticleNumber;
                //uxArticleNumberLabel.Text = ArticleNumber;


                PluginModels.CheckoutStatus checkedOut = SitecoreClient.GetLockedStatus(articleGuid);

                if (SitecoreClient.DoesArticleHaveText(articleGuid) && prompt)
                {
                    DialogResult dialogResult = MessageBox.Show
                                                    (@"This article already has some content uploaded. "
                                                    + @"If you choose to check out the article now and later upload, "
                                                    + @"you will overwrite that content. "
                                                    + @"Are you sure you wish to checkout this article?",
                                                    @"Informa",
                                                    MessageBoxButtons.YesNo,
                                                    MessageBoxIcon.Question);
                    if (dialogResult != DialogResult.Yes)
                    {
                        return(false);
                    }
                }
                if (!checkedOut.Locked)
                {
                    if (_parent.CloseOnSuccessfulLock)
                    {
                        if (DialogFactory.PromptAutoLock() == DialogResult.Yes)
                        {
                            SitecoreClient.CheckOutArticle(articleGuid, SitecoreUser.GetUser().Username);
                        }
                    }
                    else
                    {
                        SitecoreClient.CheckOutArticle(articleGuid, SitecoreUser.GetUser().Username);
                    }
                }
                SetCheckedOutStatus();
                if (_parent.CloseOnSuccessfulLock && IsCheckedOutByMe)
                {
                    return(true);
                }
                //establish link, regardless of lock status
                _parent.SetArticleDetails(SitecoreClient.ForceReadArticleDetails(articleGuid));
                _parent.UpdateFields();
                return(true);
            }
            catch (Exception ex)
            {
                Globals.SitecoreAddin.LogException("Error in article details when checking out article: " + articleGuid, ex);
                throw;
            }
        }