Пример #1
0
            public string HtmlStyle(string strLangCat)
            {
                string strHtmlStyle = String.Format(Properties.Resources.HTML_LangStyle,
                                                    strLangCat,
                                                    FontToUse.Name,
                                                    FontToUse.SizeInPoints,
                                                    VerseData.HtmlColor(FontColor),
                                                    (DoRtl) ? "rtl" : "ltr",
                                                    (DoRtl) ? "right" : "left");

                return(strHtmlStyle);
            }
        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);
        }