Example #1
0
    static HElement Page(MailState state, HttpContext httpContext)
    {
      try
      {
        string viewKind = httpContext.Get("view") ?? "inbox";
        int? displayPage = httpContext.GetUInt("page");
        int? messageId = httpContext.GetUInt("id");

        //Logger.AddMessage("ViewKind: {0}, {1}", viewKind, state.MessageSendError);

        bool guest = httpContext.UserName() == null;

        string title;
        IHtmlControl mainPanel = new HPanel("main",
          std.RowPanel(
            new HHoverDropdown(
              new HDropStyle().
                DropList(new HTone()
                  .Left("0px").Top("20px")
                  .Padding(4)
                ),
              new HButton("Все проекты"),
              new HLink(@"https://r.mail.ru/n211655019", "Авто"),
              new HLink(@"https://r.mail.ru/n211655021", "Гороскопы"),
              new HLink(@"https://r.mail.ru/n211655026", "Погода")
            ).Hide(true),
            std.DockFill(),
            //new HPanel(
            //  new HPanel().Size(1200, 10)
            //).Width("100%").WidthLimit("100px", "0").Overflow("hidden"),
            ViewHlp.GetAuthPanel(MailContext.Default.DbConnection, httpContext, state)
          ),
          new HXPanel().HeightLimit("3em", "").Background(Color.FromArgb(22, 141, 226)),
          //ViewHlp.GetButtonPanel(httpContext, state, viewKind).Hide(guest),
          new HXPanel(
            new HPanel(ViewHlp.GetLeftPanel(httpContext, state, viewKind)),
            ViewHlp.GetCenterPanel(httpContext, state, viewKind, displayPage, messageId, out title)
            //new HPanel("left",
            //  ViewHlp.GetLeftGrid(state, viewKind)
            //).Height("40em").Padding(0, 5, 5, 20).Background(Color.WhiteSmoke).Border("2px", "solid", Color.DarkGray, ""),
            //new HPanel("center",
            //  ViewHlp.GetCenterPanel(httpContext, state, viewKind, page, messageId)
            //).Width("100%").WidthLimit("", "0").Background(Color.WhiteSmoke).Border("2px", "solid", Color.DarkGray, "")
          ).HeightLimit("600px", "").Hide(guest),
          new HPanel("test",
            new HSpoiler("SPOILER", new HSpan("Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet aspernatur dolorem ducimus eaque! Alias assumenda, blanditiis dignissimos facilis fuga ipsam molestias necessitatibus nostrum numquam raesentium quo sed sit! Aut, vitae?"))
          ),
          new HPanel("debug", 
            new HSpan(string.Format("{0}{1}{1}{2}", state.lastJson, Environment.NewLine, state.Authorization))).
            Align(null, null).Border("10px", "solid", Color.Gray, "3px").Background(Color.WhiteSmoke).
            Hide(!state.Authorization),
          std.OperationState(state.Operation).Top("2em").Right("0")
        ).WidthLimit("800px", "").EditContainer("allData");

        StringBuilder css = new StringBuilder();

        //HtmlHlp.AddClassToCss(css, buttonStyle);

        HElement mainElement = mainPanel.ToHtml("main", css);

        if (guest)
          title = "Авторизация - Почта";

        return h.Html
        (
          h.Head(
          ),
          h.Body(
            h.Element("title", title),
            h.LinkCss("font/font.css"),
            h.LinkScript("ckeditor/ckeditor.js"),
            h.Script(@"
               function CK_updateAll()
               {
                 try
                 {
                   for (instance in CKEDITOR.instances)
                     CKEDITOR.instances[instance].updateElement();
                 }
                 catch(ex)
                 {
                   console.log(ex);
                 }
               }
            "),
            h.Css(h.Raw(css.ToString())
            ),
            mainElement
//            h.Script(@"
//               function CK_updateAll()
//               {
//                 for (instance in CKEDITOR.instances)
//                   CKEDITOR.instances[instance].updateElement();
//               }
//            ")

            //h.Script(new HAttribute("data-sample", "1"), @"CKEDITOR.replace( 'editor1' );")
          )
        );
      }
      catch (Exception ex)
      {
        Logger.WriteException(ex);
        throw;
      }
    }
Example #2
0
    /// <summary>
    /// Создает HXPanel
    /// Оборачивает дочерние контролы не являющиеся панелями в HPanel
    /// По умолчанию выставляет всем дочерним панелям VAlign(null)
    /// </summary>
    public static HXPanel RowPanel(params IHtmlControl[] controls)
    {
      IHtmlControl[] panelControls = ArrayHlp.Convert(controls, delegate(IHtmlControl control)
      {
        if (!(control is HPanel || control is HXPanel))
          control = new HPanel(control);
        DefaultExtensionContainer defaults = new DefaultExtensionContainer(control);
        defaults.VAlign(null);
        return control;
      });

      return new HXPanel(panelControls); //.NoWrap();
    }