コード例 #1
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)));
        }
コード例 #2
0
 public void InitializeOverrides(TeamMemberData loggedOnMember)
 {
     if (!String.IsNullOrEmpty(loggedOnMember.OverrideFontNameVernacular))
     {
         Vernacular.FontToUse =
             new Font(loggedOnMember.OverrideFontNameVernacular, loggedOnMember.OverrideFontSizeVernacular);
     }
     if (!String.IsNullOrEmpty(loggedOnMember.OverrideFontNameNationalBT))
     {
         NationalBT.FontToUse =
             new Font(loggedOnMember.OverrideFontNameNationalBT, loggedOnMember.OverrideFontSizeNationalBT);
     }
     if (!String.IsNullOrEmpty(loggedOnMember.OverrideFontNameInternationalBT))
     {
         InternationalBT.FontToUse =
             new Font(loggedOnMember.OverrideFontNameInternationalBT, loggedOnMember.OverrideFontSizeInternationalBT);
     }
     if (!String.IsNullOrEmpty(loggedOnMember.OverrideVernacularKeyboard))
     {
         Vernacular.KeyboardOverride = loggedOnMember.OverrideVernacularKeyboard;
     }
     if (!String.IsNullOrEmpty(loggedOnMember.OverrideNationalBTKeyboard))
     {
         NationalBT.KeyboardOverride = loggedOnMember.OverrideNationalBTKeyboard;
     }
     if (!String.IsNullOrEmpty(loggedOnMember.OverrideInternationalBTKeyboard))
     {
         InternationalBT.KeyboardOverride = loggedOnMember.OverrideInternationalBTKeyboard;
     }
     Vernacular.InvertRtl      = loggedOnMember.OverrideRtlVernacular;
     NationalBT.InvertRtl      = loggedOnMember.OverrideRtlNationalBT;
     InternationalBT.InvertRtl = loggedOnMember.OverrideRtlInternationalBT;
 }
コード例 #3
0
        /*
         * internal static string QueryProjectName()
         * {
         *      bool bDoItAgain;
         *      string strProjectName = null;
         *      do
         *      {
         *              bDoItAgain = false;
         *              strProjectName = Microsoft.VisualBasic.Interaction.InputBox(Properties.Resources.IDS_EnterProjectName, Properties.Resources.IDS_Caption, strProjectName, 300, 200);
         *              if (String.IsNullOrEmpty(strProjectName))
         *                      throw new ApplicationException(Properties.Resources.IDS_UnableToCreateProjectWithoutName);
         *
         *              // See if there's already a project with this name (which may be elsewhere)
         *              for (int i = 0; i < Properties.Settings.Default.RecentProjects.Count; i++)
         *              {
         *                      string strProject = Properties.Settings.Default.RecentProjects[i];
         *                      if (strProject == strProjectName)
         *                      {
         *                              string strProjectFolder = Properties.Settings.Default.RecentProjectPaths[i];
         *                              DialogResult res = MessageBox.Show(String.Format(Properties.Resources.IDS_AboutToStrandProject, Environment.NewLine, strProjectName, strProjectFolder), Properties.Resources.IDS_Caption, MessageBoxButtons.YesNoCancel);
         *                              if (res == DialogResult.Cancel)
         *                                      throw StoryEditor.BackOutWithNoUI;
         *                              if (res == DialogResult.No)
         *                                      bDoItAgain = true;
         *                              break;
         *                      }
         *              }
         *      } while (bDoItAgain);
         *      return strProjectName;
         * }
         */

        internal TeamMemberData GetLogin(ref bool bModified)
        {
            // look at the last person to log in and see if we ought to automatically log them in again
            //  (basically Crafters or others that are also the same role as last time)
            string         strMemberName  = null;
            TeamMemberData loggedOnMember = null;

            if (!String.IsNullOrEmpty(Properties.Settings.Default.LastMemberLogin))
            {
                strMemberName = Properties.Settings.Default.LastMemberLogin;
                string strMemberTypeString = Properties.Settings.Default.LastUserType;
                if (CanLoginMember(strMemberName, strMemberTypeString))
                {
                    loggedOnMember = TeamMembers[strMemberName];
                }
            }

            // otherwise, fall thru and make them pick it.
            if (loggedOnMember == null)
            {
                loggedOnMember = EditTeamMembers(strMemberName, null, ref bModified);
            }

            // if we have a logged on person, then initialize the overrides for that
            //  person (i.e. fonts, keyboards)
            if (loggedOnMember != null)
            {
                ProjSettings.InitializeOverrides(loggedOnMember);
            }

            return(loggedOnMember);
        }
コード例 #4
0
ファイル: VerseData.cs プロジェクト: sillsdevarchive/onestory
        public string CoachNotesHtml(HtmlConNoteControl htmlConNoteCtrl,
                                     StoryStageLogic theStoryStage, TeamMemberData LoggedOnMember, bool bViewHidden)
        {
            string strHtml = null;

            strHtml += GetHeaderRow(CstrZerothLineName, 0, FirstVerse.IsVisible,
                                    FirstVerse.CoachNotes, LoggedOnMember);

            strHtml += FirstVerse.CoachNotes.Html(htmlConNoteCtrl, theStoryStage,
                                                  LoggedOnMember, bViewHidden, FirstVerse.IsVisible, 0);

            for (int i = 1; i <= Count; i++)
            {
                VerseData aVerseData = this[i - 1];
                if (aVerseData.IsVisible || bViewHidden)
                {
                    strHtml += GetHeaderRow("Ln: " + i, i, aVerseData.IsVisible,
                                            aVerseData.CoachNotes, LoggedOnMember);

                    strHtml += aVerseData.CoachNotes.Html(htmlConNoteCtrl, theStoryStage,
                                                          LoggedOnMember, bViewHidden, aVerseData.IsVisible, i);
                }
            }

            return(String.Format(Properties.Resources.HTML_Table, strHtml));
        }
コード例 #5
0
        public void CheckForProjectFacilitator(StoryProjectData storyProjectData, TeamMemberData loggedOnMember)
        {
            if (CraftingInfo.ProjectFacilitatorMemberID == null)
            {
                // this means that we've opened a file which didn't have the proj fac listed
                // if there's only one PF, then just put that one in. If there are multiple,
                //  then ask which one to use
                if ((storyProjectData.TeamMembers.CountOfProjectFacilitator == 1) &&
                    (loggedOnMember.MemberType == TeamMemberData.UserTypes.eProjectFacilitator))
                {
                    CraftingInfo.ProjectFacilitatorMemberID = loggedOnMember.MemberGuid;
                    return;
                }

                // fall thru means either the logged in person isn't a PF or there are multiple,
                //  so, ask the user to tell which PF added this story
                var dlg = new MemberPicker(storyProjectData, TeamMemberData.UserTypes.eProjectFacilitator)
                {
                    Text = "Choose the Project Facilitator that entered this story"
                };
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                CraftingInfo.ProjectFacilitatorMemberID = dlg.SelectedMember.MemberGuid;
            }
        }
コード例 #6
0
        public string Html(HtmlConNoteControl htmlConNoteCtrl,
                           StoryStageLogic theStoryStage, TeamMemberData LoggedOnMember,
                           bool bViewHidden, bool bVerseVisible, int nVerseIndex)
        {
            string strHtml = null;

            for (int i = 0; i < Count; i++)
            {
                ConsultNoteDataConverter aCNDC = this[i];
                if (aCNDC.Visible || bViewHidden)
                {
                    strHtml += aCNDC.Html(htmlConNoteCtrl, theStoryStage, LoggedOnMember, nVerseIndex, i);
                }
            }

            // color changes if hidden
            string strColor;

            if (bVerseVisible)
            {
                strColor = "#FFFFFF";
            }
            else
            {
                strColor = "#F0E68C";
            }

            return(String.Format(Properties.Resources.HTML_TableRowColor, strColor,
                                 String.Format(Properties.Resources.HTML_TableCellWithSpan, 2,
                                               String.Format(Properties.Resources.HTML_TableNoBorder, strHtml))));
        }
コード例 #7
0
        protected void InitGrid()
        {
            dataGridViewPanorama.Rows.Clear();
            foreach (StoryData aSD in _stories)
            {
                TimeSpan ts             = DateTime.Now - aSD.StageTimeStamp;
                string   strTimeInState = "";
                if (ts.Days > 0)
                {
                    strTimeInState += String.Format("{0} days, ", ts.Days);
                }
                if (ts.Hours > 0)
                {
                    strTimeInState += String.Format("{0} hours, ", ts.Hours);
                }
                strTimeInState += String.Format("{0} minutes", ts.Minutes);

                StoryStageLogic.StateTransition st = StoryStageLogic.stateTransitions[aSD.ProjStage.ProjectStage];
                object[] aObs = new object[]
                {
                    aSD.Name,
                    aSD.CraftingInfo.StoryPurpose,
                    TeamMemberData.GetMemberTypeAsDisplayString(aSD.ProjStage.MemberTypeWithEditToken),
                    st.StageDisplayString,
                    strTimeInState
                };
                int             nRowIndex = dataGridViewPanorama.Rows.Add(aObs);
                DataGridViewRow aRow      = dataGridViewPanorama.Rows[nRowIndex];
                aRow.Tag    = st;
                aRow.Height = _fontForDev.Height + 4;
            }
        }
コード例 #8
0
 public bool IsEditable(StoryStageLogic theStoryStage, int i,
                        TeamMemberData LoggedOnMember, CommInstance aCI)
 {
     return((i == (Count - 1)) &&
            !IsFinished &&
            theStoryStage.IsEditAllowed(LoggedOnMember.MemberType) &&
            ((IsFromMentor(aCI) && !IsWrongEditor(LoggedOnMember.MemberType, MentorRequiredEditor)) ||
             (!IsFromMentor(aCI) && !IsWrongEditor(LoggedOnMember.MemberType, MenteeRequiredEditor))));
 }
コード例 #9
0
ファイル: VerseData.cs プロジェクト: sillsdevarchive/onestory
        public string StoryBtHtml(ProjectSettings projectSettings, TeamMembersData membersData,
                                  StoryStageLogic stageLogic, TeamMemberData loggedOnMember, int nVerseIndex,
                                  ViewItemToInsureOn viewItemToInsureOn, int nNumCols)
        {
            string strRow = null;

            if (IsViewItemOn(viewItemToInsureOn, ViewItemToInsureOn.eVernacularLangField))
            {
                strRow += String.Format(Properties.Resources.HTML_TableCellWidthAlignTop, 100 / nNumCols,
                                        String.Format(Properties.Resources.HTML_Textarea,
                                                      TextareaId(nVerseIndex, StoryLineControl.CstrFieldNameVernacular),
                                                      StoryData.CstrLangVernacularStyleClassName,
                                                      VernacularText));
            }

            if (IsViewItemOn(viewItemToInsureOn, ViewItemToInsureOn.eNationalLangField))
            {
                strRow += String.Format(Properties.Resources.HTML_TableCellWidthAlignTop, 100 / nNumCols,
                                        String.Format(Properties.Resources.HTML_Textarea,
                                                      TextareaId(nVerseIndex, StoryLineControl.CstrFieldNameNationalBt),
                                                      StoryData.CstrLangNationalBtStyleClassName,
                                                      NationalBTText));
            }

            if (IsViewItemOn(viewItemToInsureOn, ViewItemToInsureOn.eEnglishBTField))
            {
                strRow += String.Format(Properties.Resources.HTML_TableCellWidthAlignTop, 100 / nNumCols,
                                        String.Format(Properties.Resources.HTML_Textarea,
                                                      TextareaId(nVerseIndex, StoryLineControl.CstrFieldNameInternationalBt),
                                                      StoryData.CstrLangInternationalBtStyleClassName,
                                                      InternationalBTText));
            }

            string strStoryLineRow = String.Format(Properties.Resources.HTML_TableRow,
                                                   strRow);

            if (IsViewItemOn(viewItemToInsureOn, ViewItemToInsureOn.eAnchorFields))
            {
                strStoryLineRow += Anchors.Html(nVerseIndex, nNumCols);
            }

            if (IsViewItemOn(viewItemToInsureOn, ViewItemToInsureOn.eRetellingFields) &&
                (Retellings.Count > 0))
            {
                strStoryLineRow += Retellings.Html(nVerseIndex, nNumCols);
            }

            if (IsViewItemOn(viewItemToInsureOn, ViewItemToInsureOn.eStoryTestingQuestionFields) &&
                (TestQuestions.Count > 0))
            {
                strStoryLineRow += TestQuestions.Html(projectSettings, viewItemToInsureOn,
                                                      stageLogic, loggedOnMember, nVerseIndex, nNumCols,
                                                      membersData.HasOutsideEnglishBTer);
            }

            return(strStoryLineRow);
        }
コード例 #10
0
        private void buttonAddNewMember_Click(object sender, EventArgs e)
        {
            // unselect any member and set the target tab (see
            //  tabControlProjectMetaData_Selected for what happens)
            listBoxTeamMembers.SelectedIndex = -1;

            EditMemberForm dlg = new EditMemberForm(null);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (listBoxTeamMembers.Items.Contains(dlg.MemberName))
                {
                    MessageBox.Show(String.Format("Oops... you already have a member with the name, '{0}'. If you meant to edit that member, then select the name in the listbox and click the 'Edit Member' button", dlg.MemberName));
                    return;
                }

                Modified = true;

                TeamMemberData theNewMemberData;
                if (m_mapNewMembersThisSession.TryGetValue(dlg.MemberName, out theNewMemberData))
                {
                    // I don't see how this could happen... this must have been from back when
                    //  you could edit and add in a similar way. Now *Add* means *add a new one*
                    //  and they can't exist in this map...
                    System.Diagnostics.Debug.Assert(false);

                    // must just be editing the already added member...
                    System.Diagnostics.Debug.Assert(listBoxTeamMembers.Items.Contains(dlg.MemberName));

                    theNewMemberData.MemberType   = dlg.MemberType;
                    theNewMemberData.Email        = dlg.Email;
                    theNewMemberData.AltPhone     = dlg.AltPhone;
                    theNewMemberData.Phone        = dlg.Phone;
                    theNewMemberData.BioData      = dlg.BioData;
                    theNewMemberData.SkypeID      = dlg.SkypeID;
                    theNewMemberData.TeamViewerID = dlg.TeamViewerID;

                    // update the role listbox
                    int nIndex = listBoxTeamMembers.Items.IndexOf(dlg.MemberName);
                    listBoxMemberRoles.Items[nIndex] = TeamMemberData.GetMemberTypeAsDisplayString(theNewMemberData.MemberType);
                }
                else
                {
                    // add this new user to the proj file
                    theNewMemberData = new TeamMemberData(dlg.MemberName,
                                                          dlg.MemberType, String.Format("mem-{0}", Guid.NewGuid()),
                                                          dlg.Email, dlg.SkypeID, dlg.TeamViewerID, dlg.Phone, dlg.AltPhone,
                                                          dlg.BioData);

                    _dataTeamMembers.Add(dlg.MemberName, theNewMemberData);
                    m_mapNewMembersThisSession.Add(dlg.MemberName, theNewMemberData);
                    listBoxTeamMembers.Items.Add(dlg.MemberName);
                    listBoxMemberRoles.Items.Add(TeamMemberData.GetMemberTypeAsDisplayString(theNewMemberData.MemberType));
                    listBoxTeamMembers.SelectedItem = dlg.MemberName;
                }
            }
        }
コード例 #11
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            string strSelectedMember = (string)listBoxUNSs.SelectedItem;

            SelectedMember = _theStoryProjectData.TeamMembers[strSelectedMember];

            DialogResult = DialogResult.OK;
            Close();
        }
コード例 #12
0
        private void buttonBrowseUnsTest3_Click(object sender, EventArgs e)
        {
            TeamMemberData aUns = SelectedUnsMember();

            textBoxUnsTest3.Tag = aUns;
            if (aUns != null)
            {
                InitToolboxTextTip(aUns, textBoxUnsTest3);
            }
        }
コード例 #13
0
        private void buttonBrowseUNSBackTranslator_Click(object sender, EventArgs e)
        {
            TeamMemberData aUns = SelectedUnsMember();

            textBoxUnsBackTranslator.Tag = aUns;
            if (aUns != null)
            {
                InitToolboxTextTip(aUns, textBoxUnsBackTranslator);
            }
        }
コード例 #14
0
        private void buttonEditMember_Click(object sender, EventArgs e)
        {
            // this button should only be enabled if a team member is selected
            System.Diagnostics.Debug.Assert(listBoxTeamMembers.SelectedIndex != -1);
            int nIndex = listBoxTeamMembers.SelectedIndex;

            m_strSelectedMember = (string)listBoxTeamMembers.SelectedItem;
            System.Diagnostics.Debug.Assert(_dataTeamMembers.ContainsKey(m_strSelectedMember));
            TeamMemberData theMemberData = _dataTeamMembers[m_strSelectedMember];
            EditMemberForm dlg           = new EditMemberForm(theMemberData);

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Modified = true;

            // if the name of the edited item has been changed and the new name is already
            //  in use, then don't change the name
            if ((dlg.MemberName != m_strSelectedMember) &&
                _dataTeamMembers.ContainsKey(dlg.MemberName))
            {
                MessageBox.Show(String.Format("Oops... you already have a member with the name, '{0}'. If you meant to edit that member, then select the name in the listbox and click the 'Edit Member' button.", dlg.MemberName));
            }
            else
            {
                theMemberData.Name = dlg.MemberName;
            }

            theMemberData.MemberType   = dlg.MemberType;
            theMemberData.Email        = dlg.Email;
            theMemberData.AltPhone     = dlg.AltPhone;
            theMemberData.Phone        = dlg.Phone;
            theMemberData.BioData      = dlg.BioData;
            theMemberData.SkypeID      = dlg.SkypeID;
            theMemberData.TeamViewerID = dlg.TeamViewerID;

            // update the role listbox
            listBoxMemberRoles.Items[nIndex] = TeamMemberData.GetMemberTypeAsDisplayString(theMemberData.MemberType);
            if (theMemberData.Name != m_strSelectedMember)
            {
                _dataTeamMembers.Remove(m_strSelectedMember);
                m_strSelectedMember = theMemberData.Name;
                _dataTeamMembers.Add(m_strSelectedMember, theMemberData);
            }

            listBoxTeamMembers.Items[nIndex] = theMemberData.Name;

            // keep a hang on it so we don't try to, for example, give it a new guid
            if (!m_mapNewMembersThisSession.ContainsKey(dlg.MemberName))
            {
                m_mapNewMembersThisSession.Add(dlg.MemberName, theMemberData);
            }
        }
コード例 #15
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (textBoxProjectFacilitator.Tag != null)
            {
                TeamMemberData thePF = (TeamMemberData)textBoxProjectFacilitator.Tag;
                _theCurrentStory.CraftingInfo.ProjectFacilitatorMemberID = thePF.MemberGuid;
                _theSE.Modified = true;
            }

            if (textBoxStoryCrafter.Tag != null)
            {
                TeamMemberData theSC = (TeamMemberData)textBoxStoryCrafter.Tag;
                _theCurrentStory.CraftingInfo.StoryCrafterMemberID = theSC.MemberGuid;
                _theSE.Modified = true;
            }

            if (_theCurrentStory.CraftingInfo.StoryPurpose != textBoxStoryPurpose.Text)
            {
                _theCurrentStory.CraftingInfo.StoryPurpose = textBoxStoryPurpose.Text;
                _theSE.Modified = true;
            }

            if (_theCurrentStory.CraftingInfo.ResourcesUsed != textBoxResourcesUsed.Text)
            {
                _theCurrentStory.CraftingInfo.ResourcesUsed = textBoxResourcesUsed.Text;
                _theSE.Modified = true;
            }

            if (textBoxUnsBackTranslator.Tag != null)
            {
                TeamMemberData theBT = (TeamMemberData)textBoxUnsBackTranslator.Tag;
                _theCurrentStory.CraftingInfo.BackTranslatorMemberID = theBT.MemberGuid;
                _theSE.Modified = true;
            }

            if (textBoxUnsTest1.Tag != null)
            {
                AddOrInsertTestor(textBoxUnsTest1, 0);
            }

            if (textBoxUnsTest2.Tag != null)
            {
                AddOrInsertTestor(textBoxUnsTest2, 1);
            }

            if (textBoxUnsTest3.Tag != null)
            {
                AddOrInsertTestor(textBoxUnsTest3, 2);
            }

            DialogResult = DialogResult.OK;
            Close();
        }
コード例 #16
0
        public string VersesHtml(ProjectSettings projSettings, bool bViewHidden,
                                 TeamMembersData membersData, TeamMemberData loggedOnMember,
                                 VerseData.ViewItemToInsureOn viewItemToInsureOn)
        {
            string strHtml = Verses.StoryBtHtml(projSettings, bViewHidden, ProjStage,
                                                membersData, loggedOnMember, viewItemToInsureOn);

            return(String.Format(Properties.Resources.HTML_HeaderStoryBt,
                                 StylePrefix(projSettings),
                                 Properties.Resources.HTML_DOM_PrefixStoryBt,
                                 strHtml));
        }
コード例 #17
0
 // 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)
 public bool CheckAddNotePrivilege(StoryEditor theSE,
                                   TeamMemberData.UserTypes eLoggedOnMember)
 {
     if (!HasAddNotePrivilege(eLoggedOnMember))
     {
         theSE.SetStatusBar("Error: " + String.Format("You must be logged in as a '{0}' or a '{1}' to add a note here",
                                                      TeamMemberData.GetMemberTypeAsDisplayString(MentorType),
                                                      TeamMemberData.GetMemberTypeAsDisplayString(MenteeType)));
         return(false);
     }
     return(true);
 }
コード例 #18
0
        public string CoachNotesHtml(HtmlConNoteControl htmlConNoteCtrl,
                                     StoryStageLogic theStoryStage, ProjectSettings projSettings,
                                     TeamMemberData LoggedOnMember,
                                     bool bViewHidden)
        {
            string strHtml = Verses.CoachNotesHtml(htmlConNoteCtrl, theStoryStage,
                                                   LoggedOnMember, bViewHidden);

            return(String.Format(Properties.Resources.HTML_Header,
                                 StylePrefix(projSettings),
                                 Properties.Resources.HTML_DOM_Prefix,
                                 strHtml));
        }
コード例 #19
0
 private void buttonAddNewMember_Click(object sender, EventArgs e)
 {
     try
     {
         bool           bModified = false;
         TeamMemberData theMember = _theStoryProjectData.EditTeamMembers(null, "&Return", ref bModified);
         InitializeListBox(_eWantedType);
         listBoxUNSs.SelectedItem = theMember.Name;
     }
     catch (StoryEditor.BackOutWithNoUIException)
     {
         // sub-routine has taken care of the UI, just exit without doing anything
     }
 }
コード例 #20
0
        public bool IsChangeOfStateAllowed(TeamMemberData loggedOnMember)
        {
            bool bRet = ((loggedOnMember.MemberType == TeamMemberData.UserTypes.eJustLooking) ||
                         (loggedOnMember.MemberType == MemberTypeWithEditToken));

            if (!bRet)
            {
                MessageBox.Show(
                    String.Format(Properties.Resources.IDS_WhichUserEdits,
                                  TeamMemberData.GetMemberTypeAsDisplayString(MemberTypeWithEditToken)),
                    Properties.Resources.IDS_Caption);
            }

            return(bRet);
        }
コード例 #21
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            // this button should only be enabled if a team member is selected
            System.Diagnostics.Debug.Assert(listBoxTeamMembers.SelectedIndex != -1);
            if (listBoxTeamMembers.SelectedIndex == -1)
            {
                return;
            }

            /*
             * // first see if the project information has been configured
             * if (String.IsNullOrEmpty(textBoxProjectName.Text)
             || (checkBoxVernacular.Checked
             ||             &&  (  String.IsNullOrEmpty(textBoxVernacular.Text)
             || String.IsNullOrEmpty(textBoxVernacularEthCode.Text)
             || String.IsNullOrEmpty(textBoxVernSentFullStop.Text)))
             || (checkBoxNationalLangBT.Checked
             ||             &&  (  String.IsNullOrEmpty(textBoxNationalBTLanguage.Text)
             || String.IsNullOrEmpty(textBoxNationalBTEthCode.Text)
             || String.IsNullOrEmpty(textBoxNationalBTSentFullStop.Text))))
             ||{
             ||     tabControlProjectMetaData.SelectedTab = tabPageLanguageInfo;
             ||     MessageBox.Show("Configure the Project and Language Name information as well.",  Properties.Resources.IDS_Caption);
             ||     return;
             ||}
             */
            // if the selected user is a UNS, this is probably a mistake.
            TeamMemberData theMember = _dataTeamMembers[SelectedMember];

            if ((theMember.MemberType == TeamMemberData.UserTypes.eUNS) && (buttonOK.Text == CstrDefaultOKLabel))
            {
                MessageBox.Show("You may have added a UNS in order to identify, for example, which UNS did the back translation or a particular test. However, you as the crafter should still be logged in to enter the UNS's comments. So select your *crafter* member name and click 'Login' again", Properties.Resources.IDS_Caption);
                return;
            }

            // when the button label is "OK", it means we're adding a UNS
            if (buttonOK.Text == CstrDefaultOKLabel)
            {
                Properties.Settings.Default.LastMemberLogin = SelectedMember;
                Properties.Settings.Default.LastUserType    = _dataTeamMembers[SelectedMember].MemberTypeAsString;
                Properties.Settings.Default.Save();
            }

            // _projSettings.IsConfigured = true;
            DialogResult = DialogResult.OK;
            Close();
        }
コード例 #22
0
        // if this is "new", then we won't have a project name yet, so query the user for it
        public bool InitializeProjectSettings(TeamMemberData loggedOnMember)
        {
            NewProjectWizard dlg = new NewProjectWizard(this)
            {
                LoggedInMember = loggedOnMember,
                Text           = "Edit Project Settings"
            };

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                throw StoryEditor.BackOutWithNoUI;
            }

            // otherwise, it has our new project settings
            ProjSettings = dlg.ProjSettings;
            return(dlg.Modified);
        }
コード例 #23
0
        public EditMemberForm(TeamMemberData theMemberData)
        {
            InitializeComponent();

            if (theMemberData == null)
            {
                return;
            }

            textBoxName.Text        = theMemberData.Name;
            MemberType              = theMemberData.MemberType;
            textBoxEmail.Text       = theMemberData.Email;
            textBoxPhoneNumber.Text = theMemberData.Phone;
            textBoxAltPhone.Text    = theMemberData.AltPhone;
            textBoxSkypeID.Text     = theMemberData.SkypeID;
            textBoxTeamViewer.Text  = theMemberData.TeamViewerID;
            textBoxBioData.Text     = theMemberData.BioData;
        }
コード例 #24
0
        protected void AddOrInsertTestor(TextBox tb, int nIndex)
        {
            TeamMemberData theUns = (TeamMemberData)tb.Tag;

            if (_theCurrentStory.CraftingInfo.Testors.Count <= nIndex)
            {
                _theCurrentStory.CraftingInfo.Testors.Add(theUns.MemberGuid);
            }
            else
            {
                // but might means that they've changed the UNS, which means we have
                //  to update all the test values in the verses.

                _theCurrentStory.CraftingInfo.Testors[nIndex] = theUns.MemberGuid;
                System.Diagnostics.Debug.Assert(false);
            }
            _theSE.Modified = true;
        }
コード例 #25
0
        // this can be used to determine whether a given member name and type are one
        //  of the ones in this project (for auto-login)
        public bool CanLoginMember(string strMemberName, string strMemberType)
        {
            if (TeamMembers.ContainsKey(strMemberName))
            {
                TeamMemberData aTMD = TeamMembers[strMemberName];
                if (aTMD.MemberTypeAsString == strMemberType)
                {
                    // kind of a kludge, but necessary for the state logic
                    //  If we're going to return true (meaning that we can auto-log this person in), then
                    //  if we have an English Back-translator person in the team, then we have to set the
                    //  member with the edit token when we get to the EnglishBT state as that person
                    //  otherwise, it's a crafter

                    /*
                     * StoryStageLogic.stateTransitions[StoryStageLogic.ProjectStages.eBackTranslatorTypeInternationalBT].MemberTypeWithEditToken =
                     *      (TeamMembers.HasOutsideEnglishBTer) ? TeamMemberData.UserTypes.eEnglishBacktranslator : TeamMemberData.UserTypes.eProjectFacilitator;
                     */
                    return(true);
                }
            }
            return(false);
        }
コード例 #26
0
        // use of this version factors in both the settings in the project file
        public bool GetHgRepoUsernamePassword(string strProjectName, TeamMemberData loggedOnMember,
                                              out string strUsername, out string strPassword, out string strHgUrlBase)
        {
            strPassword = strHgUrlBase = null;                // just in case we don't have anything for this.

            string strRepoUrl, strDummy;

            if (Program.GetHgRepoParameters(strProjectName, out strUsername, out strRepoUrl,
                                            out strDummy))
            {
                if (!String.IsNullOrEmpty(strRepoUrl))
                {
                    var uri = new Uri(strRepoUrl);
                    if (!String.IsNullOrEmpty(uri.UserInfo) && (uri.UserInfo.IndexOf(':') != -1))
                    {
                        string[] astrUserInfo = uri.UserInfo.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                        System.Diagnostics.Debug.Assert((astrUserInfo.Length == 2) && (astrUserInfo[0] == strUsername));
                        strUsername = astrUserInfo[0];
                        strPassword = astrUserInfo[1];
                    }
                    strHgUrlBase = uri.Scheme + "://" + uri.Host;
                }
            }

            // okay, the above is what we saved in the user file, but it's possible that that
            //  will be empty (e.g. if change the assembly number), so let's get it out of the
            //  project file as well (which will supercede the above information)
            if ((loggedOnMember != null) &&
                (!String.IsNullOrEmpty(loggedOnMember.HgUsername)) &&
                (!String.IsNullOrEmpty(loggedOnMember.HgPassword)))
            {
                strUsername = loggedOnMember.HgUsername;
                strPassword = loggedOnMember.HgPassword;
            }

            return(!String.IsNullOrEmpty(strHgUrlBase));
        }
コード例 #27
0
        public string Html(HtmlConNoteControl htmlConNoteCtrl,
                           StoryStageLogic theStoryStage,
                           TeamMemberData LoggedOnMember,
                           int nVerseIndex, int nConversationIndex)
        {
            System.Diagnostics.Debug.Assert(Count > 0);
            if (Count == 0)
            {
                return(null);
            }

            // r1: "Round: n"; "button"
            // r2-n: "Label:"; "value in textbox"
            string strRow = String.Format(Properties.Resources.HTML_TableCellWithSpanAndWidth, 100, 2,
                                          String.Format("{0}{1}", CstrRoundLabel, RoundNum));

            // only the initiator of a conversation gets the buttons to delete, hide or
            //  end conversation.
            CommInstance aCInitiator = this[0];

            if (CanDoConversationButtons(LoggedOnMember.MemberType, aCInitiator.Initiator))
            {
                strRow += String.Format(Properties.Resources.HTML_TableCell,
                                        String.Format(Properties.Resources.HTML_Button,
                                                      ButtonId(nVerseIndex, nConversationIndex, CnBtnIndexDelete),
                                                      "return window.external.OnClickDelete(this.id);",
                                                      "Delete"));

                strRow += String.Format(Properties.Resources.HTML_TableCell,
                                        String.Format(Properties.Resources.HTML_Button,
                                                      ButtonId(nVerseIndex, nConversationIndex, CnBtnIndexHide),
                                                      "return window.external.OnClickHide(this.id);",
                                                      (Visible) ? CstrButtonLabelHide : CstrButtonLabelUnhide));

                strRow += String.Format(Properties.Resources.HTML_TableCell,
                                        String.Format(Properties.Resources.HTML_Button,
                                                      ButtonId(nVerseIndex, nConversationIndex,
                                                               CnBtnIndexEndConversation),
                                                      "return window.external.OnClickEndConversation(this.id);",
                                                      (IsFinished)
                                                                                                                  ? CstrButtonLabelConversationReopen
                                                                                                                  : CstrButtonLabelConversationEnd));
            }

            string strHtml = String.Format(Properties.Resources.HTML_TableRowId,
                                           ButtonRowId(nVerseIndex, nConversationIndex),
                                           strRow);

            string strHtmlTable = null;

            for (int i = 0; i < Count; i++)
            {
                CommInstance aCI = this[i];

                strRow = null;
                Color clrRow;
                if (IsFromMentor(aCI))
                {
                    strRow += String.Format(Properties.Resources.HTML_TableCell,
                                            MentorLabel);
                    clrRow = CommentColor;
                }
                else
                {
                    strRow += String.Format(Properties.Resources.HTML_TableCell,
                                            MenteeLabel);
                    clrRow = ResponseColor;
                }

                string strColor = VerseData.HtmlColor(clrRow);

                // only the last one is editable and then only if the right person is
                //  logged in
                string strHtmlElementId;
                if (IsEditable(theStoryStage, i, LoggedOnMember, aCI))
                {
                    strHtmlElementId = TextareaId(nVerseIndex, nConversationIndex);
                    strRow          += String.Format(Properties.Resources.HTML_TableCellForTextArea, "#FF0000",
                                                     String.Format(Properties.Resources.HTML_TextareaWithRefDrop,
                                                                   strHtmlElementId,
                                                                   StoryData.CstrLangInternationalBtStyleClassName,
                                                                   aCI));

                    strHtmlTable += String.Format(Properties.Resources.HTML_TableRowIdColor,
                                                  TextareaRowId(nVerseIndex, nConversationIndex),
                                                  strColor,
                                                  strRow);
                }
                else
                {
                    strHtmlElementId = TextParagraphId(nVerseIndex, nConversationIndex, i);
                    string strHyperlinkedText = aCI.ToString().Replace("\r\n", "<br />");                       // regexParagraph.Replace(aCI.ToString(), ParagraphFound);
                    strHyperlinkedText = regexBibRef.Replace(strHyperlinkedText, BibleReferenceFound);
                    strHyperlinkedText = regexLineRef.Replace(strHyperlinkedText, LineReferenceFound);
                    strHyperlinkedText = regexItalics.Replace(strHyperlinkedText, EmphasizedTextFound);
                    strHyperlinkedText = regexHttpRef.Replace(strHyperlinkedText, HttpReferenceFound);

                    strRow += String.Format(Properties.Resources.HTML_TableCellWidth, 100,
                                            String.Format(Properties.Resources.HTML_ParagraphText,
                                                          strHtmlElementId,
                                                          StoryData.CstrLangInternationalBtStyleClassName,
                                                          strHyperlinkedText));

                    strHtmlTable += String.Format(Properties.Resources.HTML_TableRowIdColor,
                                                  TextareaReadonlyRowId(nVerseIndex, nConversationIndex, i),
                                                  strColor,
                                                  strRow);
                }

                // keep track of the element id so we can use it during 'Search/Replace' operations
                aCI.HtmlElementId   = strHtmlElementId;
                aCI.HtmlConNoteCtrl = htmlConNoteCtrl;
            }

            string strEmbeddedTable = String.Format(Properties.Resources.HTML_Table,
                                                    strHtmlTable);

            strHtml += String.Format(Properties.Resources.HTML_TableRowIdColor,
                                     ConversationTableRowId(nVerseIndex, nConversationIndex),
                                     "#CCFFAA",
                                     String.Format(Properties.Resources.HTML_TableCellWithSpan, 5,
                                                   strEmbeddedTable));

            return(strHtml);
        }
コード例 #28
0
        public string Html(ProjectSettings projectSettings,
                           VerseData.ViewItemToInsureOn viewItemToInsureOn,
                           StoryStageLogic stageLogic, TeamMemberData loggedOnMember,
                           int nVerseIndex, int nNumCols, bool bHasOutsideEnglishBTer)
        {
            int  nNumTestQuestionCols = 0;
            bool bShowVernacular      =
                (VerseData.IsViewItemOn(viewItemToInsureOn, VerseData.ViewItemToInsureOn.eVernacularLangField));
            bool bShowNationalBT = (projectSettings.NationalBT.HasData &&
                                    (bHasOutsideEnglishBTer
                                     ||
                                     (VerseData.IsViewItemOn(viewItemToInsureOn,
                                                             VerseData.ViewItemToInsureOn.eNationalLangField) &&
                                      !projectSettings.Vernacular.HasData)));
            bool bShowEnglishBT = (VerseData.IsViewItemOn(viewItemToInsureOn,
                                                          VerseData.ViewItemToInsureOn.eEnglishBTField) &&
                                   (!bHasOutsideEnglishBTer ||
                                    (stageLogic.MemberTypeWithEditToken !=
                                     TeamMemberData.UserTypes.eProjectFacilitator)
                                    ||
                                    (loggedOnMember.MemberType !=
                                     TeamMemberData.UserTypes.eProjectFacilitator)));

            if (bShowVernacular)
            {
                nNumTestQuestionCols++;
            }
            if (bShowNationalBT)
            {
                nNumTestQuestionCols++;
            }
            if (bShowEnglishBT)
            {
                nNumTestQuestionCols++;
            }

            string strRow = null;

            for (int i = 0; i < Count; i++)
            {
                TestQuestionData testQuestionData = this[i];
                strRow += testQuestionData.Html(nVerseIndex, i, nNumTestQuestionCols,
                                                bShowVernacular, bShowNationalBT, bShowEnglishBT);
            }

            /*
             * // make a cell out of the testing question boxes
             * string strHtmlCell = String.Format(Properties.Resources.HTML_TableCellWidth,
             *                                                                 100,
             *                                                                 strRow);
             *
             * // add combine with the 'tst:' header cell into a Table Row
             * string strHtml = String.Format(Properties.Resources.HTML_TableRow,
             *                                                         strHtmlCell);
             * // add exegetical comments as their own rows
             * for (int i = 0; i < Count; i++)
             * {
             *      AnchorData anchorData = this[i];
             *      if (anchorData.ExegeticalHelpNotes.Count > 0)
             *              strHtml += anchorData.ExegeticalHelpNotes.Html(nVerseIndex, i);
             * }
             */

            // make a sub-table out of all this
            strRow = String.Format(Properties.Resources.HTML_TableRow,
                                   String.Format(Properties.Resources.HTML_TableCellWithSpan, nNumCols,
                                                 String.Format(Properties.Resources.HTML_TableNoBorder,
                                                               strRow)));
            return(strRow);
        }
コード例 #29
0
        public TeamMemberForm(TeamMembersData dataTeamMembers, string strOKLabel)
        {
            _dataTeamMembers = dataTeamMembers;
            InitializeComponent();

            foreach (TeamMemberData aMember in _dataTeamMembers.Values)
            {
                listBoxTeamMembers.Items.Add(aMember.Name);
                listBoxMemberRoles.Items.Add(TeamMemberData.GetMemberTypeAsDisplayString(aMember.MemberType));
            }

            if ((listBoxTeamMembers.Items.Count > 0) && !String.IsNullOrEmpty(Properties.Settings.Default.LastMemberLogin))
            {
                listBoxTeamMembers.SelectedItem = Properties.Settings.Default.LastMemberLogin;
            }

            /*
             * // initialize the keyboard combo list
             * foreach (KeyboardController.KeyboardDescriptor keyboard in
             *      KeyboardController.GetAvailableKeyboards(KeyboardController.Engines.All))
             * {
             *      comboBoxKeyboardVernacular.Items.Add(keyboard.Name);
             *      comboBoxKeyboardNationalBT.Items.Add(keyboard.Name);
             * }
             *
             * // initialize the vernacular language controls
             * if (_projSettings.Vernacular.HasData)
             * {
             *      textBoxVernacular.Text = ((String.IsNullOrEmpty(_projSettings.Vernacular.LangName)) ? _projSettings.ProjectName : _projSettings.Vernacular.LangName);
             *      textBoxVernacularEthCode.Text = _projSettings.Vernacular.LangCode;
             *
             *      // select the configured keyboard in the combo box (this is made complicated by the fact
             *      //  that members may have overridden the default keyboard for their own system)
             *      // First check if the logged in member (which is approximated by being the 'last member')
             *      //  has an override for the keyboard
             *      if ((_tmdLastMember != null)
             *              && !String.IsNullOrEmpty(_tmdLastMember.OverrideVernacularKeyboard)
             *              && comboBoxKeyboardVernacular.Items.Contains(_tmdLastMember.OverrideVernacularKeyboard))
             *      {
             *              comboBoxKeyboardVernacular.SelectedItem = _tmdLastMember.OverrideVernacularKeyboard;
             *      }
             *      else if (!String.IsNullOrEmpty(_projSettings.Vernacular.DefaultKeyboard)
             *              && comboBoxKeyboardVernacular.Items.Contains(_projSettings.Vernacular.DefaultKeyboard))
             *      {
             *              comboBoxKeyboardVernacular.SelectedItem = _projSettings.Vernacular.DefaultKeyboard;
             *      }
             *      checkBoxVernacularRTL.Checked = _projSettings.Vernacular.IsRTL;
             *      checkBoxVernacular.Checked = true;
             * }
             * else
             *      checkBoxVernacular.Checked = false;
             *
             * // even if there's no Vern, these should still be set (in case they check the box for Vern)
             * textBoxVernSentFullStop.Font = _projSettings.Vernacular.LangFont;
             * textBoxVernSentFullStop.ForeColor = _projSettings.Vernacular.FontColor;
             * textBoxVernSentFullStop.Text = _projSettings.Vernacular.FullStop;
             * toolTip.SetToolTip(buttonVernacularFont, String.Format(CstrDefaultFontTooltipVernacular,
             *                                                                                                         Environment.NewLine, _projSettings.Vernacular.LangFont,
             *                                                                                                         _projSettings.Vernacular.FontColor,
             *                                                                                                         _projSettings.Vernacular.IsRTL));
             *
             * // if there is a national language configured, then initialize those as well.
             * if (_projSettings.NationalBT.HasData)
             * {
             *      textBoxNationalBTLanguage.Text = _projSettings.NationalBT.LangName;
             *      textBoxNationalBTEthCode.Text = _projSettings.NationalBT.LangCode;
             *
             *      // select the configured keyboard in the combo box (this is made complicated by the fact
             *      //  that members may have overridden the default keyboard for their own system)
             *      // First check if the logged in member (which is approximated by being the 'last member')
             *      //  has an override for the keyboard
             *      if ((_tmdLastMember != null)
             *              && !String.IsNullOrEmpty(_tmdLastMember.OverrideNationalBTKeyboard)
             *              && comboBoxKeyboardNationalBT.Items.Contains(_tmdLastMember.OverrideNationalBTKeyboard))
             *      {
             *              comboBoxKeyboardNationalBT.SelectedItem = _tmdLastMember.OverrideNationalBTKeyboard;
             *      }
             *      else if (!String.IsNullOrEmpty(_projSettings.NationalBT.DefaultKeyboard)
             *              && comboBoxKeyboardNationalBT.Items.Contains(_projSettings.NationalBT.DefaultKeyboard))
             *      {
             *              comboBoxKeyboardNationalBT.SelectedItem = _projSettings.NationalBT.DefaultKeyboard;
             *      }
             *
             *      checkBoxNationalRTL.Checked = _projSettings.NationalBT.IsRTL;
             *      checkBoxNationalLangBT.Checked = true;
             * }
             * else
             *      checkBoxNationalLangBT.Checked = false;
             *
             * // even if there's no National language BT, these should still be set (in case they check the box for National language BT)
             * textBoxNationalBTSentFullStop.Font = _projSettings.NationalBT.LangFont;
             * textBoxNationalBTSentFullStop.ForeColor = _projSettings.NationalBT.FontColor;
             * textBoxNationalBTSentFullStop.Text = _projSettings.NationalBT.FullStop;
             * toolTip.SetToolTip(buttonNationalBTFont, String.Format(CstrDefaultFontTooltipNationalBT,
             *                                                                                                         Environment.NewLine, _projSettings.NationalBT.LangFont,
             *                                                                                                         _projSettings.NationalBT.FontColor,
             *                                                                                                         _projSettings.NationalBT.IsRTL));
             *
             * // even if there's no English BT, these should still be set (in case they check the box for English BT)
             * toolTip.SetToolTip(buttonInternationalBTFont, String.Format(CstrDefaultFontTooltipInternationalBT,
             *                                                                                                         Environment.NewLine, _projSettings.InternationalBT.LangFont,
             *                                                                                                         _projSettings.InternationalBT.FontColor,
             *                                                                                                         _projSettings.InternationalBT.IsRTL));
             *
             *
             * textBoxProjectName.Text = _projSettings.ProjectName;
             */
            if (!String.IsNullOrEmpty(strOKLabel))
            {
                buttonOK.Text = strOKLabel;
            }

            /*
             * // if the user hasn't configured the language information, send them there first
             * if (!_projSettings.IsConfigured)
             *      tabControlProjectMetaData.SelectedTab = tabPageLanguageInfo;
             *
             * if (_projSettings.Vernacular.HasData && !String.IsNullOrEmpty(textBoxVernacular.Text) && String.IsNullOrEmpty(textBoxVernacularEthCode.Text))
             *      ProposeEthnologueCode(textBoxVernacular.Text, textBoxVernacularEthCode);
             */
        }
コード例 #30
0
ファイル: VerseData.cs プロジェクト: sillsdevarchive/onestory
        public string StoryBtHtml(ProjectSettings projectSettings, bool bViewHidden,
                                  StoryStageLogic stageLogic, TeamMembersData membersData, TeamMemberData loggedOnMember,
                                  VerseData.ViewItemToInsureOn viewItemToInsureOn)
        {
            int nColSpan = CalculateColumns(viewItemToInsureOn);

            // add a row indicating which languages are in what columns
            string strHtml = null;

            if (VerseData.IsViewItemOn(viewItemToInsureOn, VerseData.ViewItemToInsureOn.eVernacularLangField))
            {
                strHtml += String.Format(Properties.Resources.HTML_TableCell,
                                         projectSettings.Vernacular.LangName);
            }
            if (VerseData.IsViewItemOn(viewItemToInsureOn, VerseData.ViewItemToInsureOn.eNationalLangField))
            {
                strHtml += String.Format(Properties.Resources.HTML_TableCell,
                                         projectSettings.NationalBT.LangName);
            }
            if (VerseData.IsViewItemOn(viewItemToInsureOn, VerseData.ViewItemToInsureOn.eEnglishBTField))
            {
                strHtml += String.Format(Properties.Resources.HTML_TableCell,
                                         projectSettings.InternationalBT.LangName);
            }

            strHtml = String.Format(Properties.Resources.HTML_TableRow,
                                    strHtml);
            ;
            for (int i = 1; i <= Count; i++)
            {
                VerseData aVerseData = this[i - 1];
                if (aVerseData.IsVisible || bViewHidden)
                {
                    strHtml += GetHeaderRow("Ln: " + i, i, aVerseData.IsVisible, nColSpan);

                    strHtml += aVerseData.StoryBtHtml(projectSettings, membersData,
                                                      stageLogic, loggedOnMember, i, viewItemToInsureOn, nColSpan);
                }
            }

            return(String.Format(Properties.Resources.HTML_Table, strHtml));
        }