PageRenderTime 24ms CodeModel.GetById 17ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/admin/Settings/Main.aspx

#
ASP.NET | 198 lines | 181 code | 17 blank | 0 comment | 4 complexity | de9149340aad50701e906cf766dc875e MD5 | raw file
  1<%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="Main.aspx.cs" Inherits="admin.Settings.Main" %>
  2<%@ Register src="Menu.ascx" tagname="TabMenu" tagprefix="menu" %>
  3
  4<asp:Content ID="Content1" ContentPlaceHolderID="cphAdmin" Runat="Server"> 
  5    <script type="text/javascript">
  6
  7        var oShowDescChkBox;
  8        var oShowDescTagCatChkBox;
  9        var oDescCharContainer;
 10        var oDescCharTagCatContainer;
 11
 12        function syncCharCountBox(oChkBox,oCharContainer) {
 13
 14            var isChecked = oChkBox.is(":checked");
 15            if (isChecked) {
 16                oCharContainer.show();
 17            } else {
 18                oCharContainer.hide();
 19            }
 20        }
 21
 22        $(document).ready(function () {
 23            var frm = document.forms.aspnetForm;
 24            $(frm).validate({
 25                onsubmit: false
 26            });
 27
 28            oShowDescChkBox = $("#<%=cbShowDescriptionInPostList.ClientID %>");
 29            oShowDescTagCatChkBox = $("#<%=cbShowDescriptionInPostListForPostsByTagOrCategory.ClientID %>");
 30            oDescCharContainer = $("#DescriptionCharacters");
 31            oDescCharTagCatContainer = $("#DescriptionCharactersForPostsByTagOrCategory");
 32
 33            $("#btnSave").click(function (evt) {
 34                if ($(frm).valid())
 35                    SaveSettings();
 36
 37                evt.preventDefault();
 38            });
 39
 40            oShowDescTagCatChkBox.change(function () {
 41                syncCharCountBox(oShowDescTagCatChkBox, oDescCharTagCatContainer);
 42            });
 43
 44            oShowDescChkBox.change(function () {
 45                syncCharCountBox(oShowDescChkBox, oDescCharContainer);
 46            });
 47
 48            syncCharCountBox(oShowDescChkBox, oDescCharContainer);
 49            syncCharCountBox(oShowDescTagCatChkBox, oDescCharTagCatContainer);
 50
 51        });
 52        function SaveSettings() {
 53            $('.loader').show();
 54            var dto = { 
 55				"name": $("[id$='_txtName']").val(),
 56				"desc": $("[id$='_txtDescription']").val(),
 57				"postsPerPage": $("[id$='_txtPostsPerPage']").val(),
 58				"themeCookieName": $("[id$='_txtThemeCookieName']").val(),
 59				"useBlogNameInPageTitles": $("[id$='_cbUseBlogNameInPageTitles']").attr('checked'),
 60				"enableRelatedPosts": $("[id$='_cbShowRelatedPosts']").attr('checked'),
 61				"enableRating": $("[id$='_cbEnableRating']").attr('checked'),
 62				"showDescriptionInPostList": oShowDescChkBox.attr('checked'),
 63				"descriptionCharacters": $("input", oDescCharContainer).val(),
 64				"showDescriptionInPostListForPostsByTagOrCategory": oShowDescTagCatChkBox.attr('checked'),
 65				"descriptionCharactersForPostsByTagOrCategory": $("input", oDescCharTagCatContainer).val(),
 66				"timeStampPostLinks": $("[id$='_cbTimeStampPostLinks']").attr('checked'),
 67				"showPostNavigation": $("[id$='_cbShowPostNavigation']").attr('checked'),
 68				"culture": $("[id$='_ddlCulture']").val(),
 69				"timezone": $("[id$='_txtTimeZone']").val(),
 70				"enablePasswordReset": $("[id$='cbEnablePasswordReset']").attr('checked'),
 71				"enableSelfRegistration": $("[id$='_cbEnableSelfRegistration']").attr('checked'),
 72				"selfRegistrationInitialRole": $("[id$='_ddlSelfRegistrationInitialRole']").val()
 73			};
 74			
 75            $.ajax({
 76                url: SiteVars.ApplicationRelativeWebRoot + "admin/Settings/Main.aspx/Save",
 77                type: "POST",
 78                dataType: "json",
 79                contentType: "application/json; charset=utf-8",
 80                data: JSON.stringify(dto),
 81                beforeSend: onAjaxBeforeSend,
 82                success: function (result) {
 83                    var rt = result.d;
 84                    if (rt.Success)
 85                        ShowStatus("success", rt.Message);
 86                    else
 87                        ShowStatus("warning", rt.Message);
 88                }
 89            });
 90            $('.loader').hide();
 91            return false;
 92        }  
 93    </script>
 94    
 95 
 96	<div class="content-box-outer">
 97		<div class="content-box-right">
 98			<menu:TabMenu ID="TabMenu" runat="server" />
 99		</div>
100		<div class="content-box-left">
101            <h1 ><%=Resources.labels.basic %> <%=Resources.labels.settings %></h1>
102
103                <ul class="fl leftaligned">
104                    <li>
105                        <label class="lbl" for="<%=txtName.ClientID %>"><%=Resources.labels.name %></label>
106                        <asp:TextBox width="300" runat="server" ID="txtName" CssClass="required" /></li>
107                    <li>
108                        <label class="lbl" for="<%=txtDescription.ClientID %>"><%=Resources.labels.description %></label>
109                        <asp:TextBox width="300" runat="server" ID="txtDescription" />
110                    </li>
111                    <li>
112                        <label class="lbl" for="<%=txtThemeCookieName.ClientID %>"><%=Resources.labels.themeCookieName %></label>
113                        <asp:TextBox CssClass="w300" runat="server" ID="txtThemeCookieName" />
114                    </li>
115                    <li>
116                        <label class="lbl" for="<%=ddlCulture.ClientID %>"><%=Resources.labels.language %></label>
117                        <asp:DropDownList runat="Server" ID="ddlCulture" Style="text-transform: capitalize">
118                            <asp:ListItem Text="Auto" />
119                            <asp:ListItem Text="english" Value="en" />
120                        </asp:DropDownList>
121                    </li>
122                    <li>
123                        <label class="lbl" for="<%=txtTimeZone.ClientID %>"><%=Resources.labels.timezone %></label>
124                        <asp:TextBox runat="Server" ID="txtTimeZone" Width="30" CssClass="number" />
125                        <span>Server time: <%=DateTime.Now.ToShortTimeString() %></span>
126                    </li>
127                    <li>
128                        <label class="lbl" for="<%=txtPostsPerPage.ClientID %>"><%=Resources.labels.postPerPage %></label>
129                        <asp:TextBox runat="server" ID="txtPostsPerPage" Width="50" MaxLength="4" CssClass="required number" />
130                    </li>
131                    <li>
132                        <label class="lbl"><%=Resources.labels.appearance %></label>
133                        <asp:CheckBox runat="server" ID="cbShowDescriptionInPostList" />
134                        <label for="<%=cbShowDescriptionInPostList.ClientID %>"><%=Resources.labels.showDescriptionInPostList %></label>
135                        <div class="insetForm" id="DescriptionCharacters" style=" display:none;">
136                            <label class="lbl" for="<%=txtDescriptionCharacters.ClientID %>"><%=Resources.labels.numberOfCharacters %></label>
137                            <asp:TextBox runat="server" ID="txtDescriptionCharacters" Width="40" CssClass="number" />      
138                        </div>
139                    </li>
140                    <li>
141                        <span class="filler"></span>
142                        <asp:CheckBox runat="server" ID="cbShowDescriptionInPostListForPostsByTagOrCategory" />
143                        <label for="<%=cbShowDescriptionInPostListForPostsByTagOrCategory.ClientID %>"><%=Resources.labels.showDescriptionInPostListForPostsByTagOrCategory %></label>
144                        <div class="insetForm" id="DescriptionCharactersForPostsByTagOrCategory" style=" display:none;">
145                            <label class="lbl" for="<%=txtDescriptionCharactersForPostsByTagOrCategory.ClientID %>" ><%=Resources.labels.numberOfCharacters %></label>
146                            <asp:TextBox runat="server" ID="txtDescriptionCharactersForPostsByTagOrCategory" Width="40" CssClass="number" />
147                        </div>
148                    </li>
149                    <li>
150                        <span class="filler"></span>
151                        <asp:CheckBox runat="server" ID="cbShowRelatedPosts" />
152                        <label for="<%=cbShowRelatedPosts.ClientID %>"><%=Resources.labels.showRelatedPosts %></label>
153                    </li>
154                    <li>
155                        <span class="filler"></span>
156                        <asp:CheckBox runat="server" ID="cbShowPostNavigation" />
157                        <label for="<%=cbShowPostNavigation.ClientID %>"><%=Resources.labels.showPostNavigation %></label>
158                    </li>
159                    <li>
160                        <label class="lbl"><%=Resources.labels.otherSettings %></label>
161                        <asp:CheckBox runat="server" ID="cbUseBlogNameInPageTitles" />
162                        <label for="<%=cbUseBlogNameInPageTitles.ClientID %>"><%=Resources.labels.useBlogNameInPageTitles%></label>
163                        <span class="insetHelp">(<%=Resources.labels.useBlogNameInPageTitlesDescription%>)</span>
164                    </li>
165                    <li>
166                        <span class="filler"></span>
167                        <asp:CheckBox runat="server" ID="cbEnableRating" />
168                        <label for="<%=cbEnableRating.ClientID %>"><%=Resources.labels.enableRating %></label>
169                    </li>
170                    <li>
171                        <span class="filler"></span>
172                        <asp:CheckBox runat="server" ID="cbTimeStampPostLinks" />
173                        <label for="<%=cbTimeStampPostLinks.ClientID %>"><%=Resources.labels.timeStampPostLinks %></label>
174                    </li>
175                    <li>
176                        <span class="filler"></span>
177                        <asp:CheckBox runat="server" ID="cbEnablePasswordReset" />
178                        <label for="<%=cbEnablePasswordReset.ClientID %>"><%=Resources.labels.enablePasswordReset %></label>
179                    </li>
180                    <li>
181                        <span class="filler"></span>
182                        <asp:CheckBox runat="server" ID="cbEnableSelfRegistration" />
183                        <label for="<%=cbEnableSelfRegistration.ClientID %>"><%=Resources.labels.enableSelfRegistration %></label>
184                    </li>
185                    <li>
186                        <label class="lbl" for="<%=ddlSelfRegistrationInitialRole.ClientID %>"><%=Resources.labels.selfRegistrationInitialRole%></label>
187                        <asp:DropDownList runat="Server" ID="ddlSelfRegistrationInitialRole" Style="text-transform: capitalize">
188                            <asp:ListItem Text="Select" />
189                        </asp:DropDownList>
190                    </li>
191                </ul>
192
193            <div class="action_buttons">
194                <input type="submit" id="btnSave" class="btn primary" value="<%=Resources.labels.saveSettings %>" />
195            </div>
196		</div>
197	</div>    
198</asp:Content>