コード例 #1
0
        public override ConsultNotesDataConverter DataConverter(int nVerseIndex)
        {
            VerseData verse = Verse(nVerseIndex);
            ConsultNotesDataConverter aCNsDC = verse.CoachNotes;

            return(aCNsDC);
        }
コード例 #2
0
        protected bool GetDataConverters(string strId, out int nVerseIndex, out int nConversationIndex,
                                         out ConsultNotesDataConverter theCNsDC, out ConsultNoteDataConverter theCNDC)
        {
            theCNsDC = null;
            theCNDC  = null;

            if (!GetIndicesFromId(strId, out nVerseIndex, out nConversationIndex))
            {
                return(false);
            }

            StoryEditor theSE;

            if (!CheckForProperEditToken(out theSE))
            {
                return(false);
            }

            theCNsDC = DataConverter(nVerseIndex);
            System.Diagnostics.Debug.Assert((theCNsDC != null) && (theCNsDC.Count > nConversationIndex));
            theCNDC = theCNsDC[nConversationIndex];

            // this always leads to the document being modified
            theSE.Modified = true;

            return(true);
        }
コード例 #3
0
        public ConsultNoteDataConverter DataConverter(int nVerseIndex, int nConversationIndex)
        {
            ConsultNotesDataConverter aCNsDC = DataConverter(nVerseIndex);

            System.Diagnostics.Debug.Assert(aCNsDC.Count > nConversationIndex);
            return(aCNsDC[nConversationIndex]);
        }
コード例 #4
0
ファイル: VerseData.cs プロジェクト: sillsdevarchive/onestory
        protected string GetHeaderRow(string strHeader, int nVerseIndex, bool bVerseVisible,
                                      ConsultNotesDataConverter theCNsDC, TeamMemberData LoggedOnMember)
        {
            string strHtmlAddNoteButton = null;

            if (theCNsDC.HasAddNotePrivilege(LoggedOnMember.MemberType))
            {
                strHtmlAddNoteButton = String.Format(Properties.Resources.HTML_TableCell,
                                                     String.Format(Properties.Resources.HTML_Button,
                                                                   nVerseIndex,
                                                                   "return window.external.OnAddNote(this.id, null);",
                                                                   "Add Note"));
            }

            string strLink = String.Format(Properties.Resources.HTML_LinkJumpLine,
                                           nVerseIndex, strHeader);

            if (!bVerseVisible)
            {
                strLink += StoryEditor.CstrHiddenVerseSuffix;
            }
            return(String.Format(Properties.Resources.HTML_TableRowColor, "#AACCFF",
                                 String.Format("{0}{1}",
                                               String.Format(Properties.Resources.HTML_TableCellWidthId,
                                                             LineId(nVerseIndex),
                                                             100,
                                                             strLink),
                                               strHtmlAddNoteButton)));
        }
コード例 #5
0
        public bool OnAddNote(int nVerseIndex, string strNote)
        {
            ConsultNotesDataConverter aCNsDC = DataConverter(nVerseIndex);
            ConsultNoteDataConverter  aCNDC  = DoAddNote(strNote, aCNsDC);

            if (aCNDC != null)
            {
                StrIdToScrollTo = ConsultNoteDataConverter.TextareaId(nVerseIndex, aCNsDC.IndexOf(aCNDC));
            }
            return(true);
        }
コード例 #6
0
        public ConsultNoteDataConverter DoAddNote(string strNote,
                                                  ConsultNotesDataConverter aCNsDC)
        {
            // the only function of the button here is to add a slot to type a con note
            StoryEditor theSE;

            if (!CheckForProperEditToken(out theSE))
            {
                return(null);
            }

            // if we're not given anything to put in the box, at least put in the logged
            //  in member's initials and re
            if (String.IsNullOrEmpty(strNote) && (theSE.LoggedOnMember != null))
            {
                strNote = StoryEditor.GetInitials(theSE.LoggedOnMember.Name) + ": Re: ";
            }

            // if the coach tries to add a note in the consultant's pane, that should fail.
            // (but it's okay for a project facilitator to add one if they have a question
            //  for the consultant)
            if (!aCNsDC.CheckAddNotePrivilege(theSE, theSE.LoggedOnMember.MemberType))
            {
                return(null);
            }

            StoryStageLogic.ProjectStages eCurState = theSE.theCurrentStory.ProjStage.ProjectStage;
            int round = 1;

            if (eCurState > StoryStageLogic.ProjectStages.eProjFacOnlineReview1WithConsultant)
            {
                round = 2;
            }

            ConsultNoteDataConverter cndc =
                aCNsDC.Add(round, theSE.theCurrentStory.ProjStage,
                           theSE.LoggedOnMember.MemberType, strNote);

            System.Diagnostics.Debug.Assert(cndc.Count == 1);

            LoadDocument();
            theSE.Modified = true;

            // return the conversation we just created
            return(cndc);
        }
コード例 #7
0
        public ConsultNoteControl(VerseControl ctrlVerse, StoryStageLogic storyStageLogic, ConsultNotesDataConverter theCollection,
                                  ConsultNoteDataConverter aCNDC, TeamMemberData.UserTypes eLoggedOnMemberType)
            : base(storyStageLogic)
        {
            _myCNDC       = aCNDC;
            _myCollection = theCollection;

            m_nRoundNum = aCNDC.RoundNum;
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            InsertColumn(2);

            labelRound.Text = CstrRoundLabel + m_nRoundNum.ToString();
            tableLayoutPanel.SetColumnSpan(labelRound, 2);
            tableLayoutPanel.Controls.Add(labelRound, 0, 0);
            tableLayoutPanel.Controls.Add(buttonDragDropHandle, 1, 0);

            System.Diagnostics.Debug.Assert(tableLayoutPanel.RowCount == 1, "otherwise, fix this assumption: ConsultNoteControl.cs.28");

            // finally populate the buttons on that tool strip
            theCollection.InsureExtraBox(aCNDC, eLoggedOnMemberType);
            int nNumRows = 1;

            foreach (CommInstance aCI in aCNDC)
            {
                if ((aCI.Direction == ConsultNoteDataConverter.CommunicationDirections.eConsultantToProjFac) ||
                    (aCI.Direction == ConsultNoteDataConverter.CommunicationDirections.eCoachToConsultant))
                {
                    InitRow(ctrlVerse, aCNDC.MentorLabel, aCI, aCNDC.CommentColor, aCNDC.ThrowIfWrongEditor,
                            aCNDC.MentorRequiredEditor, ref nNumRows);
                }
                else
                {
                    InitRow(ctrlVerse, aCNDC.MenteeLabel, aCI, aCNDC.ResponseColor, aCNDC.ThrowIfWrongEditor,
                            aCNDC.MenteeRequiredEditor, ref nNumRows);
                }
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
コード例 #8
0
        public ConsultNotesControl(StoryEditor theSE,
                                   LineFlowLayoutPanel parentFlowLayoutPanel,
                                   StoryStageLogic storyStageLogic,
                                   ConsultNotesDataConverter aCNsDC, int nVerseNumber,
                                   TeamMemberData.UserTypes eLoggedOnMemberType)
            : base(storyStageLogic, nVerseNumber, theSE, parentFlowLayoutPanel)
        {
            _theCNsDC = aCNsDC;
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            labelReference.Text = (VerseNumber == 0) ? CstrZerothVerseName : CstrVerseName + VerseNumber;
            tableLayoutPanel.Controls.Add(labelReference, 0, 0);
            tableLayoutPanel.Controls.Add(buttonDragDropHandle, 1, 0);

            if (aCNsDC.Count > 0)
            {
                int nRowIndex = 1;
                foreach (ConsultNoteDataConverter aCNDC in aCNsDC)
                {
                    if (aCNDC.Visible || theSE.hiddenVersesToolStripMenuItem.Checked)
                    {
                        ConsultNoteControl aCNCtrl = new ConsultNoteControl(this, storyStageLogic, aCNsDC, aCNDC, eLoggedOnMemberType);
                        aCNCtrl.Name          = CstrFieldNameConsultantNote + nRowIndex;
                        aCNCtrl.ParentControl = this;

                        InsertRow(nRowIndex);
                        tableLayoutPanel.SetColumnSpan(aCNCtrl, 2);
                        tableLayoutPanel.Controls.Add(aCNCtrl, 0, nRowIndex);
                        nRowIndex++;
                    }
                }
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
コード例 #9
0
        static void DoConsultData(string[] astrFile, ref int nIndexLine, bool bUsingStoryProject,
                                  ConsultNotesDataConverter theCNsD, string strMentorSfm, string strMentorInitials, List <string> astrMenteeSfms,
                                  ConsultNoteDataConverter.CommunicationDirections eMentorToMentee, ConsultNoteDataConverter.CommunicationDirections eMenteeToMentor)
        {
            if (++nIndexLine >= astrFile.Length)
            {
                return;
            }

            int    nConvNumber = 0, nNoteNumber = 0;
            string strMarker, strData;

            ParseLine(astrFile[nIndexLine], out strMarker, out strData);
            if (strMarker == @"\ln")
            {
                return;
            }

            while ((strMarker != @"\ln") && (strMarker != @"\c"))
            {
                ConsultNoteDataConverter con = null;
                if (theCNsD.Count > nConvNumber)
                {
                    con = theCNsD[nConvNumber];
                }

                int nRound = 1;
                if (strMarker == strMentorSfm)
                {
                    try
                    {
                        char chRound = (strData.Substring(0, 2) == strMentorInitials) ? strData[2] : '1';
                        nRound = Convert.ToInt32(chRound.ToString());
                    }
                    catch { }

                    if (con == null)
                    {
                        con = theCNsD.AddEmpty(nRound);
                    }

                    if (con.Count > nNoteNumber)
                    {
                        CommInstance aCI = con[nNoteNumber];
                        System.Diagnostics.Debug.Assert((aCI.ToString() == strData) && (aCI.Direction == eMentorToMentee));
                        aCI.SetValue(strData);
                        aCI.Direction = eMentorToMentee;
                    }
                    else
                    {
                        con.Add(new CommInstance(strData, eMentorToMentee, Guid.NewGuid().ToString()));
                    }

                    nNoteNumber++;
                }
                else if (astrMenteeSfms.Contains(strMarker))
                {
                    // sometimes the CIT has a comment for the coach
                    if (con == null)
                    {
                        con = theCNsD.AddEmpty(nRound);
                    }

                    if (con.Count > nNoteNumber)
                    {
                        CommInstance aCI = con[nNoteNumber];
                        System.Diagnostics.Debug.Assert((aCI.ToString() == strData) && (aCI.Direction == eMenteeToMentor));
                        aCI.SetValue(strData);
                        aCI.Direction = eMenteeToMentor;
                    }
                    else
                    {
                        con.Add(new CommInstance(strData, eMenteeToMentor, Guid.NewGuid().ToString()));
                    }

                    // for now, we just do two per conversation (or maybe 3 if the mentee started the conversation)
                    if (++nNoteNumber >= 2)
                    {
                        nConvNumber++;
                        nNoteNumber = 0;
                    }
                }
                else if (lstSfmsToIgnore.Contains(strMarker))
                {
                    Console.WriteLine("Found, but don't care about marker:" + strMarker);
                }
                else if (!String.IsNullOrEmpty(strMarker) && !String.IsNullOrEmpty(strData))
                {
                    System.Diagnostics.Debug.Assert(false, String.Format("not handling the '{0}' marker", strMarker));
                }

                if (++nIndexLine < astrFile.Length)
                {
                    ParseLine(astrFile[nIndexLine], out strMarker, out strData);
                }
                else
                {
                    break;
                }
            }
        }