using System;
using System.Collections.Generic;
using System.Net.Mail;
using System.Text.RegularExpressions;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ExWeb
{
    public partial class Mod_Content : Mod
    {
        public static string Help_Description =
            "Erstellt ein Inhaltsverzeichnis"
            + "\r\nFür eine korrekte Funktion des Inhaltsverzeichnisses ist die folgende Zeile"
            + "im Kopf-Teil der ASPX-Datei oder Mster-datei erforderlich."
            + "<pre>"
            + "<script src=\"js/jquery-1.7.2.min.js\" type=\"text/javascript\"></script>\r\n"
            + "</pre>"
            + "Unter Verwendung von Toc von Nikhil Dabas http://www.nikhildabas.com/toc/";
            
        public static string[][] Help_Attributes = new string[][]
        {
            // Attribut, Werte, DefaultWert, Optional, Hilfe, Beispiel
            new string[] {"area", "body .name", "body","opt","Bereich des Inhaltserzeichnisses","area=\"div.content\"" },
            new string[] {"headings", "h1 h2 h3 h4 h5 h6", "h2 h3 h4","opt","Die einzutragenden Texte","headings=\"h2 h3\"" },
        };
        protected string _Area = "body";
        public string Area
        {
            set
            {
                _Area = value;
            }
        }
        protected string _Headings = "h2,h3,h4";
        public string Headings
        {
            set
            {
                if (value.Trim()!="")
                    _Headings = Regex.Replace(value,@"\s+"," ");
                    _Headings = _Headings.Replace(" ",",");
            }
        }
        public new void Page_Load(object sender, EventArgs e)
        {
            Panel_Module.Controls.Add(new LiteralControl(
                "\r\n<script src=\"/js/jquery.toc.min.js\" type=\"text/javascript\"></script>"
                + " \r\n<ul data-toc=\"" + _Area + "\" data-toc-headings=\"" + _Headings + "\"></ul>"));
        }
    }
}