bool TagHasChildTagAtPosition(ContainerTag tag, int position)
		{
			if (tag != null) {
				return tag.Contents.Count >= position;
			}
			return false;
		}
Пример #2
0
            private void Begin(ContainerTag tag)
            {
                Flush();

                containerStack.Peek().Contents.Add(tag);
                containerStack.Push(tag);
            }
Пример #3
0
        public void TestComplexTagRender()
        {
            ContainerTag complexTestTag = Html().With(Body().With(Header(), Main().With(P("Main stuff...")), Footer().CondWith(1 == 1, P("Conditional with!"))));
            string       expectedResult = "<html><body><header></header><main><p>Main stuff...</p></main><footer><p>Conditional with!</p></footer></body></html>";

            Assert.AreEqual(expectedResult, complexTestTag.Render());
        }
Пример #4
0
 public override ContainerTag CreateTagTree(ContainerTag container)
 {
     return(container
            [
                html.attr(xmlns: "http://www.w3.org/1999/xhtml")
                [
                    head
                    [
                        title[PlaceHolder(TitleContent)],
                        link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" })).ext("rel", "shortcut icon").ext("type", "image/x-icon"),
                        link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" }), rel: LinkType.bookmark),
                        link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "public.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                        link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "External.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                        script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" }))
                    ],
                    body
                    [
                        div[
                            PlaceHolder(MainContent),
                            p.attr(id: "credits")[
                                "&copy;2012 倍速软件&nbsp;&nbsp;",
                                strong["通用权限管理"],
                                br,
                                a.attr(href: "http://www.bzure.cn")["www.bzure.cn"]]
                        ]
                    ]
                ]
            ]);
 }
Пример #5
0
        public void TestTagRender()
        {
            ContainerTag testTag = new ContainerTag("a");

            testTag.Attr("href", "http://example.com");
            Assert.AreEqual("<a href=\"http://example.com\"></a>", testTag.Render());
        }
Пример #6
0
 public override ContainerTag CreateTagTree(ContainerTag container)
 {
     return container
     [
         html.attr(xmlns: "http://www.w3.org/1999/xhtml")
         [
             head
             [
                 title[PlaceHolder(TitleContent)],
                 link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" })).ext("rel", "shortcut icon").ext("type", "image/x-icon"),
                 link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" }), rel: LinkType.bookmark),
                 link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "public.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                 link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "External.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                 script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" }))
             ],
             body
             [
             div[
                   PlaceHolder(MainContent),
                   p.attr(id: "credits")[
                                                "&copy;2012 倍速软件&nbsp;&nbsp;",
                                                strong["通用权限管理"],
                                                br,
                                                a.attr(href: "http://www.bzure.cn")["www.bzure.cn"]]
                  ]
             ]
         ]
     ];
 }
Пример #7
0
 bool TagHasChildTagAtPosition(ContainerTag tag, int position)
 {
     if (tag != null)
     {
         return(tag.Contents.Count >= position);
     }
     return(false);
 }
		Tag GetChildTagAtPosition(ContainerTag parentTag, int position)
		{
			if (TagHasChildTagAtPosition(parentTag, position)) {
				int index = position - 1;
				return parentTag.Contents[index];
			}
			return null;
		}
Пример #9
0
        public virtual ContainerTag MainContent(ContainerTag container)
        {
            return(container
                   [
                       script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                       script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.validate.min.js" })),
                       script.attr(type: MimeType.text.javascript)[Script2(Model.Url)],
                       script.attr(type: MimeType.text.javascript)[Script1()],
                       h2[Model.Title],
                       p.attr(id: "page-intro")["请谨慎使用重置用户密码功能,重置后原密码将失效和无法找回。"],
                       div.attr(@class: "clear"),
                       div.attr(@class: "content-box")
                       [
                           div.attr(@class: "content-box-header")
                           [
                               h3["用户密码"],
                               ul.attr(@class: "content-box-tabs")
                               [
                                   li[a.attr(href: "#tab1", @class: "default-tab")["重置"]]
                               ],
                               div.attr(@class: "clear")
                           ],
                           div.attr(@class: "content-box-content")
                           [
                               div.attr(@class: "tab-content default-tab", id: "tab1")
                               [
                                   div.attr(id: "content_box_messages"),
                                   form.attr(id: "ResetPasswordForm")
                                   [
                                       p.attr(id: "ResetPassword_UserName")
                                       [
                                           label.attr(@for: "RoleName")["用&nbsp;户&nbsp;名:&nbsp;" + Model.UserName]

                                       ],
                                       p.attr(id: "ResetPassword-New")
                                       [
                                           label.attr(@for: "NewPassword")["密&nbsp;&nbsp;码:"],
                                           input.attr(type: InputType.password, id: "NewPassword", name: "NewPassword").ext("autocomplete", "off")
                                       ],
                                       p.attr(id: "ResetPassword-ConfirmPassword")
                                       [
                                           label.attr(@for: "ConfirmPassword")["确认密码:"],
                                           input.attr(type: InputType.password, id: "ConfirmPassword", name: "ConfirmPassword").ext("autocomplete", "off")
                                       ],
                                       p.attr(id: "ResetPassword-submit")
                                       [
                                           input.attr(type: InputType.button, @class: "button", value: "重置", onclick: "ResetPassword();")
                                       ],
                                       p.attr(id: "ResetPassword_ReturnUrl")
                                       [
                                           a.attr(href: Url.RouteUrl("SecurityApp_User", new { action = "UserList" }))["返回用户列表"]
                                       ]
                                   ]
                               ]
                           ]
                       ]
                   ]);
        }
Пример #10
0
 Tag GetChildTagAtPosition(ContainerTag parentTag, int position)
 {
     if (TagHasChildTagAtPosition(parentTag, position))
     {
         int index = position - 1;
         return(parentTag.Contents[index]);
     }
     return(null);
 }
Пример #11
0
 public override ContainerTag CreateTagTree(ContainerTag container)
 {
     return(container
            [
                "<!--" + Model.Data + "-->",
                div.attr(@class: GetClass(Model.NotificationType))[
                    p[Model.Content]
                ]
            ]);
 }
Пример #12
0
        public virtual ContainerTag MainContent(ContainerTag container)
        {
            return(container
                   [
                       style.attr(type: MimeType.text.css)
                       [
                           css()
                       ],
                       script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                       script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.validate.min.js" })),
                       script.attr(type: MimeType.text.javascript)
                       [
                           Script1()
                       ],
                       form.attr(id: "Logon_Form", method: Method.post)
                       [
                           h1[Model.Title],
                           div.attr(@class: "loginleft")
                           [
                               p.attr(id: "Logon_UserName")
                               [
                                   label.attr(@class: "labelTitle", @for: "UserName")["用户名"],
                                   input.attr(type: InputType.text, id: "UserName", name: "UserName").ext("autocomplete", "off")
                               ],
                               p.attr(id: "Logon_Password")
                               [
                                   label.attr(@class: "labelTitle", @for: "password")["密码"],
                                   input.attr(type: InputType.password, id: "Password", name: "Password").ext("autocomplete", "off")
                               ],
                               p.attr(id: "Logon_RememberMe")
                               [
                                   label.attr(@class: "labelTitle", @for: "RememberMe")["记住我?"],
                                   input.attr(type: InputType.checkbox, id: "RememberMe", name: "RememberMe")

                               ],
                               p.attr(id: "Logon_Submit")
                               [
                                   input.attr(type: InputType.submit, value: "登录", @class: "submit")
                               ],
                               If(!string.IsNullOrEmpty(this.Model.Message), Then: c => c
                                  [
                                      p.attr(id: "Logon_Message", @class: "MessageBox")[this.Model.Message]
                                  ]
                                  )
                           ],
                           div.attr(@class: "loginright")
                           [
                               ""
                           ]
                       ]
                   ]);
        }
Пример #13
0
 public Button()
 {
     template =
         Div()
         .WithClass("button")
         .With(
             Div()
             .WithClass("button-text")
             .With(
                 new ButtonText()
                 )
             );
 }
Пример #14
0
 public virtual ContainerTag MainContent(ContainerTag container)
 {
     return(container
            [
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.validate.min.js" })),
                script.attr(type: MimeType.text.javascript)[Script2(Model.Url)],
                h2[Model.Title],
                p.attr(id: "page-intro")[" 列表系统中所有的安全角色,您可以删除这些角色,但请谨慎,因为关联的角色授权及用户角色也将删除。"],
                div.attr(@class: "clear"),
                div.attr(@class: "content-box")
                [
                    div.attr(@class: "content-box-header")
                    [
                        h3["角色列表"],
                        ul.attr(@class: "content-box-tabs")
                        [
                            li[a.attr(href: "#tab1", @class: "default-tab")["所有"]]
                        ],
                        div.attr(@class: "clear")
                    ],
                    div.attr(@class: "content-box-content")
                    [
                        div.attr(@class: "tab-content default-tab", id: "tab1")
                        [
                            div.attr(id: "content_box_messages"),
                            table.attr(id: "RoleList_Table")
                            [
                                thead.attr(id: "RoleList_Table_Thead")
                                [
                                    tr[th["角色名"], th["角色描述"], th["操作"]]
                                ],
                                tbody.attr(id: "RoleList_Table_Tbody")
                                [
                                    ForEach(this.Model.Roles, (item, c) => c
                                            [
                                                tr.attr(@class: "tablerow rolelist", id: "tr_" + item.ID)
                                                [
                                                    th[item.Name],
                                                    td[item.RoleDescription],
                                                    td[a.attr(href: "#", onclick: "Del('" + item.ID + "','tr_" + item.ID + "');")["删除"]]
                                                ]
                                            ])
                                ]
                            ]
                        ]
                    ]
                ]
            ]);
 }
Пример #15
0
 public virtual ContainerTag MainContent(ContainerTag container)
 {
     return(container
            [
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.validate.min.js" })),
                script.attr(type: MimeType.text.javascript)[Script2(Model.Url)],
                script.attr(type: MimeType.text.javascript)[Script1()],
                h2[Model.Title],
                p.attr(id: "page-intro")["创建一个新的安全角色,请确保所有角色的名称是唯一的。"],
                div.attr(@class: "clear"),
                div.attr(@class: "content-box")
                [
                    div.attr(@class: "content-box-header")
                    [
                        h3["新角色"],
                        ul.attr(@class: "content-box-tabs")
                        [
                            li[a.attr(href: "#tab1", @class: "default-tab")["创建"]]
                        ],
                        div.attr(@class: "clear")
                    ],
                    div.attr(@class: "content-box-content")
                    [
                        div.attr(@class: "tab-content default-tab", id: "tab1")
                        [
                            div.attr(id: "content_box_messages"),
                            form.attr(id: "NewRoleForm")
                            [
                                p.attr(id: "NewRole-RoleName")
                                [
                                    label.attr(@for: "RoleName")["角&nbsp;&nbsp;色&nbsp;名:"],
                                    input.attr(type: InputType.text, id: "RoleName", name: "RoleName", maxlength: 20)
                                ],
                                p.attr(id: "NewRole-RoleDescription")
                                [
                                    label.attr(@for: "RoleDescription")["角色描述:"],
                                    input.attr(type: InputType.text, id: "RoleDescription", name: "RoleDescription", maxlength: 50)
                                ],
                                p.attr(id: "NewRole-submit")
                                [
                                    input.attr(type: InputType.button, @class: "button", value: "创建", onclick: "CreateRole();")
                                ]
                            ]
                        ]
                    ]
                ]
            ]);
 }
Пример #16
0
 public virtual ContainerTag MainContent(ContainerTag container)
 {
     return(container
            [
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.validate.min.js" })),
                script.attr(type: MimeType.text.javascript)
                [
                    Script1()
                ],
                form.attr(id: "ChangePassword_Form", method: Method.post)
                [
                    h1[Model.Title],
                    p.attr(id: "ChangePassword_UserName")
                    [
                        label.attr(@class: "labelTitle", @for: "UserName")["用户名"],
                        span[Model.UserName]
                    ],
                    p.attr(id: "ChangePassword_OldPassword")
                    [
                        label.attr(@class: "labelTitle", @for: "OldPassword")["旧密码"],
                        input.attr(type: InputType.password, id: "OldPassword", name: "OldPassword").ext("autocomplete", "off")
                    ],
                    p.attr(id: "ChangePassword_NewPassword")
                    [
                        label.attr(@class: "labelTitle", @for: "NewPassword")["新密码"],
                        input.attr(type: InputType.password, id: "NewPassword", name: "NewPassword").ext("autocomplete", "off")
                    ],
                    p.attr(id: "ChangePassword_ConfirmPassword")
                    [
                        label.attr(@class: "labelTitle", @for: "ConfirmPassword")["确认密码"],
                        input.attr(type: InputType.password, id: "ConfirmPassword", name: "ConfirmPassword").ext("autocomplete", "off")
                    ],
                    p.attr(id: "ChangePassword_Submit")
                    [
                        input.attr(type: InputType.submit, value: "修改", @class: "submit")
                    ],
                    If(!string.IsNullOrEmpty(this.Model.Message), Then: c => c
                       [
                           p.attr(id: "ChangePassword_Message", @class: "MessageBox")[this.Model.Message]
                       ]
                       )
                ]
            ]);
 }
Пример #17
0
 SectionTag GetFirstChildSectionTag(ContainerTag parentTag)
 {
     return(GetFirstChildTag(parentTag) as SectionTag);
 }
		MarkerTag GetFourthChildMarkerTag(ContainerTag parentTag)
		{
			return GetChildTagAtPosition(parentTag, 4) as MarkerTag;
		}
Пример #19
0
 Tag GetSecondChildTag(ContainerTag parentTag)
 {
     return(GetChildTagAtPosition(parentTag, 2));
 }
Пример #20
0
 public virtual ContainerTag TitleContent(ContainerTag container)
 {
     return(container[Model.Title]);
 }
Пример #21
0
 public virtual ContainerTag MainContent(ContainerTag container)
 {
     return(container
            [
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                script.attr(type: MimeType.text.javascript)[Script2(Model.Url)],
                h2[Model.Title],
                p.attr(id: "page-intro")["配置用户的状态和用户所具有的安全角色。"],
                div.attr(@class: "clear"),
                div.attr(@class: "content-box")
                [
                    div.attr(@class: "content-box-header")
                    [
                        h3["用户授权"],
                        ul.attr(@class: "content-box-tabs")
                        [
                            li[a.attr(href: "#tab1", @class: "default-tab")["配置"]]
                        ],
                        div.attr(@class: "clear")
                    ],
                    div.attr(@class: "content-box-content")
                    [
                        div.attr(@class: "tab-content default-tab", id: "tab1")
                        [
                            div.attr(id: "content_box_messages"),
                            form.attr(id: "AuthorizeUser_Form")
                            [
                                p.attr(id: "AuthorizeUser_UserName")
                                [
                                    label["用&nbsp;户&nbsp;名:&nbsp;" + Model.UserName]
                                ],
                                p.attr(id: "AuthorizeUser_State")
                                [
                                    label.attr(@for: "UserState")["用户激活:"],
                                    input.attr(type: InputType.checkbox, id: "UserState", name: "UserState", @checked: Model.UserState ? (Checked?)Checked.@checked : null)
                                ],
                                p.attr(id: "AuthorizeUser_RoleList")
                                [
                                    label.attr(id: "AuthorizeUser_Roles_Title")["用户角色:"],
                                    ForEach(Model.Roles, (item, c) => c[
                                                label.attr(@class: "authorizeUserRole label_check", id: "CK_" + item.ID, @for: "Role_" + item.ID)
                                                [
                                                    input.attr(type: InputType.checkbox, id: "Role_" + item.ID, name: "Role_" + item.ID, value: item.ID, @checked: Model.RIDs.Contains(item.ID) ? (Checked?)Checked.@checked : null),
                                                    item.Name
                                                ]
                                            ])
                                ],
                                p.attr(id: "AuthorizeUser_Submit")
                                [
                                    input.attr(type: InputType.button, @class: "button", value: "保存", onclick: "Authorize();")
                                ],
                                p.attr(id: "AuthorizeUser_ReturnUrl")
                                [
                                    a.attr(href: Url.RouteUrl("SecurityApp_User", new { action = "UserList" }))["返回用户列表"]
                                ]
                            ]
                        ]
                    ]
                ]
            ]);
 }
Пример #22
0
 public virtual ContainerTag MainContent(ContainerTag container)
 {
     return(container
            [
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                script.attr(type: MimeType.text.javascript)[Script2(Model.Url)],
                h2[Model.Title],
                p.attr(id: "page-intro")[" 配置" + Model.ResourceName + "的授权,您可以根据系统安全规则的需要来配置每个安全角色具有" + Model.ResourceName + "中的权限项或权限项组合。"],
                div.attr(@class: "clear"),
                div.attr(@class: "content-box")
                [
                    div.attr(@class: "content-box-header")
                    [
                        h3[Model.ResourceName],
                        ul.attr(@class: "content-box-tabs")
                        [
                            li[a.attr(href: "#tab1", @class: "default-tab")["授权"]]
                        ],
                        div.attr(@class: "clear")
                    ],
                    div.attr(@class: "content-box-content")
                    [
                        div.attr(@class: "tab-content default-tab", id: "tab1")
                        [
                            div.attr(id: "content_box_messages"),
                            form.attr(id: "DroitConfig_Form")
                            [
                                table.attr(id: "DroitConfig_Table")
                                [
                                    thead.attr(id: "DroitConfig_Table_thead")
                                    [
                                        tr[th["角色名称"], th["角色描述"], th.attr(colspan: Model.RS.Count)["授权"]]
                                    ],
                                    tbody.attr(id: "DroitConfig_Table_tbody")
                                    [
                                        ForEach(Model.RList, (item, c) => c[
                                                    tr[
                                                        th[item.Name],
                                                        th[item.RoleDescription],
                                                        ForEach(Model.RS, (m, b) => b[
                                                                    td[
                                                                        label.attr(@class: "label_check", id: "CK_" + item.ID + "_" + m.Key, @for: "RT_" + item.ID + "_" + m.Key)
                                                                        [
                                                                            input.attr(type: InputType.checkbox, @class: "checked", id: "RT_" + item.ID + "_" + m.Key, name: "RT_" + item.ID + "_" + m.Key, value: m.Key.ToString(), @checked: IsChecked(item, m.Key) ? (Checked?)Checked.@checked : null),
                                                                            m.Value
                                                                        ]
                                                                    ]
                                                                ])
                                                    ]
                                                ])
                                    ],
                                    tfoot.attr(id: "DroitConfig_Table_tfoot")
                                    [
                                        tr[
                                            th.attr(scope: Scope.row),
                                            td,
                                            td.attr(colspan: Model.RS.Count - 2),
                                            td.attr(colspan: 2, id: "DroitConfig_Table_Tfoot_Save")
                                            [
                                                input.attr(type: InputType.button, id: "DroitConfig_Save", @class: "button", value: "保存授权", onclick: "ConfigDroit();")
                                            ]
                                        ]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]);
 }
Пример #23
0
 public override ContainerTag CreateTagTree(ContainerTag container)
 {
     return(container
            [
                html.attr(xmlns: "http://www.w3.org/1999/xhtml")
                [
                    head
                    [
                        title[PlaceHolder(TitleContent)],
                        meta.attr(httpequiv: HttpEquiv.content_type, content: "text/xml; charset=UTF-8"),
                        link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" })).ext("rel", "shortcut icon").ext("type", "image/x-icon"),
                        link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" }), rel: LinkType.bookmark),
                        link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "reset.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                        link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "style.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                        link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "invalid.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                        link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "public.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                        link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "checkbox.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                        script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                        script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "Common.js" })),
                        script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.checkbox.js" })),
                        script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "simpla.jquery.configuration.js" })),
                        script.attr(type: MimeType.text.javascript)[Script1()]
                    ],
                    body
                    [
                        div.attr(id: "body-wrapper")
                        [
                            div.attr(id: "sidebar")
                            [
                                div.attr(id: "sidebar-wrapper")
                                [
                                    div.attr(id: "sidebar-title")[p["通用权限管理"]],
                                    div.attr(id: "profile-links")
                                    [
                                        If(Actor.Public.IsAuthenticated, Then: c => c
                                           [
                                               " 您好, " + Actor.Me.Principal.Identity.Name + "&nbsp;&nbsp;|&nbsp;&nbsp;",
                                               a.attr(href: Actor.Public.UserLogOffUrl())["注销"],
                                               br,
                                               br
                                           ],
                                           Else: c => c
                                           [
                                               a.attr(href: Actor.Public.UserLogOnUrl())["登录"],
                                               br,
                                               br
                                           ]
                                           )
                                    ],
                                    ul.attr(id: "main-nav")
                                    [
                                        li[
                                            a.attr(@class: "nav-top-item", id: "mi-user")["用户"],
                                            ul[
                                                li[
                                                    a.attr(id: "mi-userlist", href: Actor.Public.UserListUrl())["用户列表"]
                                                ]
                                            ]
                                        ],
                                        li[
                                            a.attr(@class: "nav-top-item", id: "mi-role")["角色"],
                                            ul[
                                                li[
                                                    a.attr(id: "mi-newrole", href: Actor.Public.RoleNewUrl())["新建角色"]
                                                ],
                                                li[
                                                    a.attr(id: "mi-rolelist", href: Actor.Public.RoleListUrl())["角色列表"]
                                                ]
                                            ]
                                        ],
                                        li[
                                            a.attr(@class: "nav-top-item", id: "mi-droitconfig")["授权"],
                                            ul[
                                                ForEach(Actor.Public.DroitsConfigUrl(), (item, c) => c[
                                                            li[
                                                                script.attr(type: MimeType.text.javascript)[Script2(item)],
                                                                a.attr(id: "mi-droit-" + item.Value, href: item.Key)[item.Value]
                                                            ]
                                                        ])
                                            ]
                                        ]
                                    ]
                                ]
                            ],
                            div.attr(id: "main-content")
                            [
                                PlaceHolder(MainContent),
                                div.attr(@class: "clear"),
                                div.attr(id: "footer")
                                [
                                    small
                                    [
                                        " &#169; Copyright 2012",
                                        a.attr(href: "http://www.bzure.cn")["bzure.cn"],
                                        " 版权所有 |",
                                        a.attr(href: "#")["Top"]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]);
 }
Пример #24
0
 TextTag GetFirstChildTextTag(ContainerTag parentTag)
 {
     return(GetFirstChildTag(parentTag) as TextTag);
 }
Пример #25
0
 MarkerTag GetSecondChildMarkerTag(ContainerTag parentTag)
 {
     return(GetSecondChildTag(parentTag) as MarkerTag);
 }
Пример #26
0
 public override ContainerTag CreateTagTree(ContainerTag container)
 {
     return(ReusableCreateTagTree(TitleContent, MainContent, Model.MasterViewModel));
 }
		MarkerTag GetFirstChildMarkerTag(ContainerTag parentTag)
		{
			return GetFirstChildTag(parentTag) as MarkerTag;
		}
Пример #28
0
 public override ContainerTag CreateTagTree(ContainerTag container)
 {
     return container
     [
         html.attr(xmlns: "http://www.w3.org/1999/xhtml")
         [
             head
             [
                 title[PlaceHolder(TitleContent)],
                 meta.attr(httpequiv: HttpEquiv.content_type, content: "text/xml; charset=UTF-8"),
                 link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" })).ext("rel", "shortcut icon").ext("type", "image/x-icon"),
                 link.attr(href: Url.RouteUrl("ResourceAccess_Image", new { location = "SecurityApp", id = "favicon.ico" }), rel: LinkType.bookmark),
                 link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "reset.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                 link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "style.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                 link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "invalid.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                 link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "public.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                 link.attr(href: Url.RouteUrl("ResourceAccess_CSS", new { location = "SecurityApp", id = "checkbox.css" }), rel: LinkType.stylesheet, type: MimeType.text.css),
                 script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                 script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "Common.js" })),
                 script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.checkbox.js" })),
             script.attr(type: MimeType.text.javascript, src: Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "simpla.jquery.configuration.js" })),
                 script.attr(type: MimeType.text.javascript)[Script1()]
             ],
             body
             [
                   div.attr(id: "body-wrapper")
                   [
                      div.attr(id: "sidebar")
                      [
                        div.attr(id: "sidebar-wrapper")
                           [
                              div.attr(id: "sidebar-title")[p["通用权限管理"]],
                              div.attr(id: "profile-links")
                               [
                                   If(Actor.Public.IsAuthenticated, Then: c => c
                                     [
                                       " 您好, " + Actor.Me.Principal.Identity.Name + "&nbsp;&nbsp;|&nbsp;&nbsp;",
                                       a.attr(href: Actor.Public.UserLogOffUrl())["注销"],
                                       br,
                                       br
                                     ],
                                   Else: c => c
                                     [
                                       a.attr(href: Actor.Public.UserLogOnUrl())["登录"],
                                       br,
                                       br
                                     ]
                                 )
                               ],
                              ul.attr(id: "main-nav")
                               [
                                    li[
                                        a.attr(@class: "nav-top-item", id: "mi-user")["用户"],
                                        ul[
                                            li[
                                            a.attr(id: "mi-userlist", href: Actor.Public .UserListUrl ())["用户列表"]
                                              ]
                                            ]
                                      ],
                                    li[
                                        a.attr(@class: "nav-top-item", id: "mi-role")["角色"],
                                        ul[
                                            li[
                                            a.attr(id: "mi-newrole", href: Actor.Public.RoleNewUrl ())["新建角色"]
                                              ],
                                            li[
                                            a.attr(id: "mi-rolelist", href: Actor.Public.RoleListUrl())["角色列表"]
                                              ]
                                            ]
                                      ],
                                    li[
                                        a.attr(@class: "nav-top-item", id: "mi-droitconfig")["授权"],
                                        ul[
                                            ForEach(Actor.Public.DroitsConfigUrl(), (item, c) => c[
                                                          li[
                                                          script.attr(type: MimeType.text.javascript)[Script2(item)],
                                                          a.attr(id: "mi-droit-" + item.Value, href: item.Key)[item.Value]
                                                           ]
                                                    ])
                                           ]
                                      ]
                               ]
                           ]
                      ],
                      div.attr(id: "main-content")
                      [
                       PlaceHolder(MainContent),
                       div.attr(@class: "clear"),
                       div.attr(id: "footer")
                               [
                               small
                                      [
                                      " &#169; Copyright 2012",
                                       a.attr(href: "http://www.bzure.cn")["bzure.cn"],
                                       " 版权所有 |",
                                       a.attr(href: "#")["Top"]
                                      ]
                               ]
                      ]
                  ]
             ]
         ]
     ];
 }
Пример #29
0
 Tag GetFirstChildTag(ContainerTag parentTag)
 {
     return(GetChildTagAtPosition(parentTag, 1));
 }
Пример #30
0
 MarkerTag GetFirstChildMarkerTag(ContainerTag parentTag)
 {
     return(GetFirstChildTag(parentTag) as MarkerTag);
 }
		SectionTag GetFirstChildSectionTag(ContainerTag parentTag)
		{
			return GetFirstChildTag(parentTag) as SectionTag;
		}
		TextTag GetFirstChildTextTag(ContainerTag parentTag)
		{
			return GetFirstChildTag(parentTag) as TextTag;
		}
		MarkerTag GetSecondChildMarkerTag(ContainerTag parentTag)
		{
			return GetSecondChildTag(parentTag) as MarkerTag;
		}
Пример #34
0
 MarkerTag GetFourthChildMarkerTag(ContainerTag parentTag)
 {
     return(GetChildTagAtPosition(parentTag, 4) as MarkerTag);
 }
		Tag GetSecondChildTag(ContainerTag parentTag)
		{
			return GetChildTagAtPosition(parentTag, 2);
		}
            private void Begin(ContainerTag tag)
            {
                Flush();

                containerStack.Peek().Contents.Add(tag);
                containerStack.Push(tag);
            }
		TextTag GetThirdChildTextTag(ContainerTag parentTag)
		{
			return GetChildTagAtPosition(parentTag, 3) as TextTag;
		}
		Tag GetFirstChildTag(ContainerTag parentTag)
		{
			return GetChildTagAtPosition(parentTag, 1);
		}
Пример #39
0
 TextTag GetThirdChildTextTag(ContainerTag parentTag)
 {
     return(GetChildTagAtPosition(parentTag, 3) as TextTag);
 }
Пример #40
0
        /// <summary>
        /// Generates the html that will render the menu
        /// </summary>
        /// <param name="tag">the tag used to render each menu item, can be li, span, div...</param>
        /// <param name="includeParentLink">Include the link of the parent when generating the link hierarchy
        /// this will not override the original property IncludeParentLink
        /// </param>
        /// <param name="renderChildren">flag to render children or not</param>
        /// <param name="childrenParentTag">The tag container for the children can be ul or div or ol...</param>
        /// <param name="childrenTag">the tag used to render each menu item, can be li, span, div...</param>
        /// <returns>HTML String</returns>
        public string ToString(string tag, bool includeParentLink, bool renderChildren, string childrenContainerTag, string childrenTag)
        {
            //TODO: fix caching by creating a unique key
            //Testing unique key from url
            //TODO: destroy cach when any related item is changed
            //It can be done by running through the cach's and destroying any related news or category
            //Another problem is to not cach the non-direct calls

            //string key = GetKey(renderChildren, tag);
            //if (WebContext.Cache[CachKey] != null)
            //	return WebContext.Cache[CachKey].ToString();

            bool   hasOneItem = false;
            string _ret       = "";

            try
            {
                //_lock.AcquireWriterLock(-1);

                if (!CanRender)
                {
                    return("");
                }

                if (_renderChildren != null)
                {
                    renderChildren = _renderChildren.Value;
                }

                StringBuilder ret = new StringBuilder();

                int?col = null;
                if (BreakAt != null)
                {
                    col = 0;
                }


                if (renderChildren)
                {
                    if (!String.IsNullOrWhiteSpace(SubPlaceHolder))
                    {
                        ret.Append("<" + SubPlaceHolder + ">");
                    }

                    if (!String.IsNullOrWhiteSpace(ContainerTag))
                    {
                        if (ContainerTag.ToLower() == "ol")
                        {
                            ClassName = "dd-list";
                        }
                        ret.Append("<" + ContainerTag + " start=\"1\" class=\"first" + (!String.IsNullOrEmpty(ClassName) ? " " + ClassName : "") + "\">");
                    }
                    for (int i = 0; i < Children.Count; i++)
                    {
                        lwMenu m = Children[i];
                        if (!m.CanRender)
                        {
                            continue;
                        }

                        hasOneItem = true;


                        //TODO: check first and last depending on visible items and not only on count.

                        string _class = m.Current ? " current" : "";
                        if (i == 0)
                        {
                            _class += " first";
                        }
                        if (i == Children.Count - 1)
                        {
                            _class += " last";
                        }

                        _class += " " + StringUtils.ToURL(m.url.Replace(".aspx", ""));

                        if (!String.IsNullOrWhiteSpace(m.ClassName))
                        {
                            _class = _class.Trim() + " " + m.ClassName;
                        }

                        if (_class != "")
                        {
                            _class = " class=\"" + _class.Trim() +
                                     (tag.ToLower().IndexOf("li") >= 0 && _class.Trim().IndexOf("dd-item") < 0 ? " dd-item" : "") + "\"";
                        }

                        string _children = "";
                        if (renderChildren && m.Children.Count > 0)
                        {
                            _children = m.ToString(childrenTag, includeParentLink, renderChildren, childrenContainerTag);
                            if (!String.IsNullOrEmpty(childrenContainerTag))
                            {
                                _children = _children != "" ? string.Format("<{0}>{1}</{0}>", childrenContainerTag, _children) : "";
                            }
                        }
                        ret.Append(String.Format(
                                       "<{0}{3}{4}>{1}{2}</{0}>",
                                       tag,
                                       m.GetLink(),
                                       _children,
                                       _class,
                                       (tag.ToLower().IndexOf("li") >= 0 ? " data-root=\"" + m.IsRoot + (m.id > 0 ? "\" data-id=\"" + m.id : "")
                                        + "\" data-parent=\"" + (m.parentId.HasValue && m.parentId.Value > 0 ? m.parentId.Value : -1) + "\"" : ""))
                                   );

                        if (BreakAt != null)
                        {
                            if (i > 0 && (i + 1) % BreakAt == 0 && i < Children.Count - 1 && !String.IsNullOrWhiteSpace(ContainerTag))
                            {
                                ret.Append(string.Format("</{0}><{0} start=\"{1}\"{2}>",
                                                         ContainerTag,
                                                         this.BreakAt + i,
                                                         i + BreakAt >= Children.Count - 1 ? " class=\"last\"" : ""));
                            }
                        }
                    }
                    ret.Append("</" + ContainerTag + ">");
                    if (!String.IsNullOrWhiteSpace(SubPlaceHolder))
                    {
                        ret.Append("</" + SubPlaceHolder + ">");
                    }
                }



                _ret = ret.ToString();

                //TODO: fix this after fixing the key

                /*
                 * WebContext.Cache.Insert(
                 *      CachKey,
                 *      _ret,
                 *      new System.Web.Caching.CacheDependency(WebContext.Server.MapPath("~/App_Code/Menu.cs"))
                 * );
                 * */
            }
            finally
            {
                //_lock.ReleaseWriterLock();
            }
            return(hasOneItem ? _ret : "");
        }
Пример #41
0
 public virtual ContainerTag MainContent(ContainerTag container)
 {
     return(container
            [
                style.attr(type: MimeType.text.css)[" .selectedpagelabel  {    cursor: default;    text-decoration: none;   }"],
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery-1.7.2.min.js" })),
                script.attr(type: MimeType.text.javascript, src: this.Url.RouteUrl("ResourceAccess_Script", new { location = "SecurityApp", id = "jquery.validate.min.js" })),
                script.attr(type: MimeType.text.javascript)[Script2(Model.Url)],
                script.attr(type: MimeType.text.javascript)[Script1(Model)],
                h2[Model.Title],
                p.attr(id: "page-intro")["  列表系统中所有的安全用户,您可以删除这些用户,但请谨慎,因为关联的用户授权及用户角色也将删除。"],
                div.attr(@class: "clear"),
                div.attr(@class: "content-box")
                [
                    div.attr(@class: "content-box-header")
                    [
                        h3["用户列表"],
                        ul.attr(@class: "content-box-tabs")
                        [
                            li[a.attr(href: "#tab1", @class: "default-tab")["所有"]]
                        ],
                        div.attr(@class: "clear")
                    ],
                    div.attr(@class: "content-box-content")
                    [
                        div.attr(@class: "tab-content default-tab", id: "tab1")
                        [
                            div.attr(id: "content_box_messages"),
                            table.attr(id: "UserList_Table")
                            [
                                thead.attr(id: "UserList_Table_Thead")
                                [
                                    tr[th["用户名"], th["昵称"], th["邮箱"], th["角色值"], th["状态值"], th["操作"]]
                                ],
                                tbody.attr(id: "UserList_Table_Tbody")
                                [
                                    ForEach(this.Model.Users, (item, c) => c
                                            [
                                                tr.attr(@class: "tablerow userlist", id: "tr_" + item.UserID)
                                                [
                                                    th[item.UserName],
                                                    td[item.NickName],
                                                    td[item.EMail],
                                                    td[item.RoleValue],
                                                    td[item.State],
                                                    td[
                                                        a.attr(href: Url.RouteUrl("SecurityApp_User", new { action = "AuthorizeUser" }) + "/" + item.UserID)["授权"],
                                                        "&nbsp;&nbsp;",
                                                        a.attr(href: Url.RouteUrl("SecurityApp_User", new { action = "ResetPassword" }) + "/" + item.UserID)["重置密码"],
                                                        "&nbsp;&nbsp;",
                                                        a.attr(href: "#", onclick: "Del('" + item.UserID + "','tr_" + item.UserID + "');")["删除"]
                                                    ]
                                                ]
                                            ])
                                ],
                                tfoot.attr(id: "UserList_Table_Tfoot")
                                [
                                    tr[
                                        td.attr(colspan: 6)[div.attr(id: "pagelabel", @class: "pagination")]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]);
 }