// Renders the beginning of the form.
        //
        protected internal virtual void RenderBeginForm(WmlTextWriter writer)
        {
            RenderBeginCardTag(writer);

            // Write form variables.

            //


            _writtenFormVariables = true;
            if (_formVariables == null)
            {
                _formVariables = new ListDictionary();
            }
            _formVariables[_postBackEventTargetVarName]   = String.Empty; // Whidbey 18260
            _formVariables[_postBackEventArgumentVarName] = String.Empty;
            writer.Write("<onevent type=\"onenterforward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            writer.Write("<onevent type=\"onenterbackward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            //
            writer.BeginFormOrPanel();
        }
示例#2
0
        // Renders the beginning of the form.
        // UNDONE: Remove internal modifier when method is completely removed from writer.
        protected internal virtual void RenderBeginForm(WmlTextWriter writer)
        {
            RenderBeginCardTag(writer);

            // Write form variables.

            // UNDONE: Move writer._provideBackButton to this adapter.
            // Review: In V1 we had a writer.ProvideBackButton property, is there any need for this with (more advanced)
            // whidbey devices?
            _writtenFormVariables = true;
            if (_formVariables == null)
            {
                _formVariables = new ListDictionary();
            }
            _formVariables[_postBackEventTargetVarName]   = String.Empty; // Whidbey 18260
            _formVariables[_postBackEventArgumentVarName] = String.Empty;
            writer.Write("<onevent type=\"onenterforward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            writer.Write("<onevent type=\"onenterbackward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            // UNDONE: formAdapter.RenderExtraCardElements(this);
            writer.BeginFormOrPanel();
        }
 // Renders the end of the form.
 protected internal virtual void RenderEndForm(WmlTextWriter writer)
 {
     writer.CloseParagraph();
     writer.Indent--;
     writer.WriteEndTag("card");
     writer.WriteLine();
 }
        //     Renders postback cards.
        private void RenderPostBackCard(WmlTextWriter writer)
        {
            if (!_writtenPostBack)
            {
                return;
            }

            writer.WriteBeginTag("card");
            writer.WriteAttribute("id", WmlTextWriter.PostBackWithVarsCardID);
            writer.WriteLine(">");

            writer.Write("<onevent type=\"onenterforward\">");
            RenderFormPostInGoAction(writer, null, _postBackEventArgumentVarName, WmlPostFieldType.Variable, String.Empty);
            //
            writer.WriteLine("</onevent>");

            writer.WriteLine("<onevent type=\"onenterbackward\"><prev /></onevent>");
            writer.WriteLine("</card>");
        }
        private void AnalyzeAndRenderHtmlForm(WmlTextWriter writer, HtmlForm form)
        {
            if (form == null)
            {
                return;
            }

            writer.SetAnalyzeMode(true);
            RenderForm(writer, form);
            Page.ResetOnFormRenderCalled();
            writer.SetAnalyzeMode(false);
            RenderForm(writer, form);
            writer.WriteLine();
        }
示例#6
0
        // Renders the TextBox.
        public virtual void RenderTextBox(WmlTextWriter writer, String id, String value, String format, String title, bool password, int size, int maxLength, bool generateRandomID)
        {
            if (!writer.AnalyzeMode)
            {
                //

                // VSWhidbey 147458.  Close any style tags.
                writer.CloseCurrentStyleTags();
                writer.WriteBeginTag("input");
                // Map the client ID to a short name. See
                // MapClientIDToShortName for details.
                writer.WriteAttribute("name", writer.MapClientIDToShortName(id, generateRandomID));
                if (password)
                {
                    writer.WriteAttribute("type", "password");
                }
                if (!String.IsNullOrEmpty(format))
                {
                    writer.WriteAttribute("format", format);
                }
                if (!String.IsNullOrEmpty(title))
                {
                    writer.WriteAttribute("title", title, true);
                }
                if (size > 0)
                {
                    writer.WriteAttribute("size", size.ToString(CultureInfo.InvariantCulture));
                }
                if (maxLength > 0)
                {
                    writer.WriteAttribute("maxlength", maxLength.ToString(CultureInfo.InvariantCulture));
                }
                // We do not need a value attribute.  The Text value is populated by the client side var set in onenterforward.
                writer.WriteLine(" />");
                writer.OpenCurrentStyleTags();
            }
        }
 // Renders the TextBox.
 public virtual void RenderTextBox(WmlTextWriter writer, String id, String value, String format, String title, bool password, int size, int maxLength, bool generateRandomID) {
     if (!writer.AnalyzeMode) {
         // 
                         
         // VSWhidbey 147458.  Close any style tags.
         writer.CloseCurrentStyleTags();
         writer.WriteBeginTag("input");
         // Map the client ID to a short name. See
         // MapClientIDToShortName for details.
         writer.WriteAttribute("name", writer.MapClientIDToShortName(id, generateRandomID));
         if (password) {
             writer.WriteAttribute("type", "password");
         }
         if (!String.IsNullOrEmpty(format)) {
             writer.WriteAttribute("format", format);
         }
         if (!String.IsNullOrEmpty(title)) {
             writer.WriteAttribute("title", title, true);
         }
         if (size > 0) {
             writer.WriteAttribute("size", size.ToString(CultureInfo.InvariantCulture));
         }
         if (maxLength > 0) {
             writer.WriteAttribute("maxlength", maxLength.ToString(CultureInfo.InvariantCulture));
         }
         // We do not need a value attribute.  The Text value is populated by the client side var set in onenterforward.
         writer.WriteLine(" />");
         writer.OpenCurrentStyleTags();
     }
 }
        //     Transforms text for the target device.  The default transformation is the identity transformation,
        //     which does not change the text.
        internal void RenderTransformedText(WmlTextWriter writer, string text)
        {
            bool leadingSpace  = false;
            bool setPendingP   = false;
            bool trailingSpace = false;

            // p's replaced by brs as in MMIT V1 for valid containment.
            text = LiteralControlAdapterUtility.PreprocessLiteralText(text);
            bool isEmpty = (text != null && text.Length == 0);

            if (isEmpty)
            {
                return;
            }

            if (writer.TopOfForm)
            {
                while (Regex.IsMatch(text, "^(?'space'\\s*)(?:<p|</p)\\s*>"))
                {
                    text = Regex.Replace(text, "^(?'space'\\s*)(?:<p|</p)\\s*>", "${space}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
                }
            }

            if (setPendingP = Regex.IsMatch(text, "</p\\s*>\\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
            {
                text = Regex.Replace(text, "</p\\s*>(?'space'\\s*)$", "${space}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            }

            text = Regex.Replace(text, "<br\\s*/?>", "<br/>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            text = Regex.Replace(text, "</p\\s*>(?'space'\\s*)<p\\s*>", "<br/>${space}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            text = Regex.Replace(text, "(?:<p|</p)\\s*>", "<br/>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

            if (trailingSpace = Regex.IsMatch(text, "\\s+$"))
            {
                text = Regex.Replace(text, "\\s+$", String.Empty);
            }
            if (leadingSpace = Regex.IsMatch(text, "^\\s+"))
            {
                text = Regex.Replace(text, "^\\s+", String.Empty);
            }

            text = text.Replace("$", "$$");

            // Render text.
            if (text.Trim().Length > 0)
            {
                if (leadingSpace)
                {
                    writer.WriteLine();
                }
                Style emptyStyle = new Style();
                writer.BeginRender();          // write pending tags.
                writer.EnterStyle(emptyStyle); // VSWhidbey 114083
                writer.Write(text);
                writer.ExitStyle(emptyStyle);
                writer.EndRender();
                if (trailingSpace)
                {
                    writer.WriteLine();
                }
            }
            // Whidbey 19653 transform space as newline.  If we are at the top of the form (before the leading p),
            // don't need literal text -it won't be rendered. Similarly, if we are setting a pending p, no need to writeline.
            else if (!setPendingP && !writer.TopOfForm)
            {
                Debug.Assert(!isEmpty, "Empty text.  Should have returned before this point.");
                writer.WriteLine();
            }

            if (setPendingP)
            {
                writer.SetPendingP();
            }
        }
 // Renders a card tag.
 protected virtual void RenderBeginCardTag(WmlTextWriter writer)
 {
     writer.WriteLine("<card>");
     writer.Indent++;
 }
        private void AnalyzeAndRenderHtmlForm(WmlTextWriter writer, HtmlForm form) {
            if (form == null) {
                return;
            }

            writer.SetAnalyzeMode(true);
            RenderForm(writer, form);
            Page.ResetOnFormRenderCalled();
            writer.SetAnalyzeMode(false);
            RenderForm(writer, form);
            writer.WriteLine();
        }
        //     Transforms text for the target device.  The default transformation is the identity transformation,
        //     which does not change the text.
        internal void RenderTransformedText(WmlTextWriter writer, string text) {
            bool leadingSpace = false;
            bool setPendingP = false;
            bool trailingSpace = false;

            // p's replaced by brs as in MMIT V1 for valid containment.
            text = LiteralControlAdapterUtility.PreprocessLiteralText(text);
            bool isEmpty = (text != null && text.Length == 0);
            if (isEmpty) {
                return;
            }

            if (writer.TopOfForm) {
                while (Regex.IsMatch(text, "^(?'space'\\s*)(?:<p|</p)\\s*>")) {
                    text = Regex.Replace(text, "^(?'space'\\s*)(?:<p|</p)\\s*>", "${space}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
                }
            }

            if (setPendingP = Regex.IsMatch(text, "</p\\s*>\\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) {
                text = Regex.Replace(text, "</p\\s*>(?'space'\\s*)$", "${space}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            }

            text = Regex.Replace(text, "<br\\s*/?>", "<br/>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            text = Regex.Replace(text, "</p\\s*>(?'space'\\s*)<p\\s*>", "<br/>${space}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
            text = Regex.Replace(text, "(?:<p|</p)\\s*>", "<br/>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

            if (trailingSpace = Regex.IsMatch(text, "\\s+$")) {
                text = Regex.Replace(text, "\\s+$", String.Empty);
            }
            if (leadingSpace = Regex.IsMatch(text, "^\\s+")) {
                text = Regex.Replace(text, "^\\s+", String.Empty);
            }

            text = text.Replace("$", "$$");

            // Render text.
            if (text.Trim().Length > 0) {
                if (leadingSpace) {
                    writer.WriteLine();
                }
                Style emptyStyle = new Style();
                writer.BeginRender(); // write pending tags.
                writer.EnterStyle(emptyStyle); // VSWhidbey 114083
                writer.Write(text);
                writer.ExitStyle(emptyStyle);
                writer.EndRender();
                if (trailingSpace) {
                    writer.WriteLine();
                }
            }
            // Whidbey 19653 transform space as newline.  If we are at the top of the form (before the leading p),
            // don't need literal text -it won't be rendered. Similarly, if we are setting a pending p, no need to writeline.
            else if (!setPendingP && !writer.TopOfForm) {
                Debug.Assert(!isEmpty, "Empty text.  Should have returned before this point.");
                writer.WriteLine();
            }

            if (setPendingP) {
                writer.SetPendingP();
            }
        }
        //     Renders postback cards.
        private void RenderPostBackCard(WmlTextWriter writer) {
            if (!_writtenPostBack) {
                return;
            }

            writer.WriteBeginTag("card");
            writer.WriteAttribute("id", WmlTextWriter.PostBackWithVarsCardID);
            writer.WriteLine(">");

            writer.Write("<onevent type=\"onenterforward\">");
            RenderFormPostInGoAction(writer, null, _postBackEventArgumentVarName, WmlPostFieldType.Variable, String.Empty);
            // 
            writer.WriteLine("</onevent>");

            writer.WriteLine("<onevent type=\"onenterbackward\"><prev /></onevent>");
            writer.WriteLine("</card>");
        }
 // Renders the end of the form.
 protected internal virtual void RenderEndForm(WmlTextWriter writer) {
     writer.CloseParagraph();
     writer.Indent--;
     writer.WriteEndTag("card");
     writer.WriteLine();
 }
 // Renders a card tag.
 protected virtual void RenderBeginCardTag(WmlTextWriter writer) {
     writer.WriteLine("<card>");
     writer.Indent++;
 }
        // Renders the beginning of the form.
        // 
        protected internal virtual void RenderBeginForm(WmlTextWriter writer) {

            RenderBeginCardTag(writer);

            // Write form variables.

            // 


            _writtenFormVariables = true;
            if (_formVariables == null) {
                _formVariables = new ListDictionary();
            }
            _formVariables[_postBackEventTargetVarName] = String.Empty; // Whidbey 18260
            _formVariables[_postBackEventArgumentVarName] = String.Empty;
            writer.Write("<onevent type=\"onenterforward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            writer.Write("<onevent type=\"onenterbackward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            // 
            writer.BeginFormOrPanel();
        }
        // Renders the beginning of the form.
        // UNDONE: Remove internal modifier when method is completely removed from writer.
        protected internal virtual void RenderBeginForm(WmlTextWriter writer) {

            RenderBeginCardTag(writer);

            // Write form variables.

            // UNDONE: Move writer._provideBackButton to this adapter.
            // Review: In V1 we had a writer.ProvideBackButton property, is there any need for this with (more advanced)
            // whidbey devices?
            _writtenFormVariables = true;
            if (_formVariables == null) {
                _formVariables = new ListDictionary();
            }
            _formVariables[_postBackEventTargetVarName] = String.Empty; // Whidbey 18260
            _formVariables[_postBackEventArgumentVarName] = String.Empty;
            writer.Write("<onevent type=\"onenterforward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            writer.Write("<onevent type=\"onenterbackward\"><refresh>");
            RenderSetFormVariables(writer);
            RenderPostUrlFormVariable(writer);
            writer.WriteLine("</refresh></onevent>");
            // UNDONE: formAdapter.RenderExtraCardElements(this);
            writer.BeginFormOrPanel();
        }