PageRenderTime 20ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/admin/Settings/Feed.aspx

#
ASP.NET | 131 lines | 124 code | 7 blank | 0 comment | 5 complexity | b95b71624a43287f9e253370ecd850d6 MD5 | raw file
  1<%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="Feed.aspx.cs" Inherits="admin.Settings.Feed" %>
  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        $(document).ready(function () {
  7            var frm = document.forms.aspnetForm;
  8            $(frm).validate({
  9                onsubmit: false
 10            });
 11
 12            $("#btnSave").click(function (evt) {
 13                if ($(frm).valid())
 14                    SaveSettings();
 15
 16                evt.preventDefault();
 17            });
 18        });
 19        function geodeAsk() {
 20            if (navigator.geolocation)
 21                navigator.geolocation.getCurrentPosition(geoFound, geoNotFound);
 22        }
 23        function geoFound(pos) {
 24            document.getElementById('<%=txtGeocodingLatitude.ClientID %>').value = pos.latitude;
 25            document.getElementById('<%=txtGeocodingLongitude.ClientID %>').value = pos.longitude;
 26        }
 27
 28        function geoNotFound() {
 29            alert('You must be on a wifi network for us to determine your location');
 30        } 
 31		function SaveSettings() {
 32            $('.loader').show();
 33            var dto = { 
 34				"syndicationFormat": $("[id$='_ddlSyndicationFormat']").val(),
 35				"postsPerFeed": $("[id$='_txtPostsPerFeed']").val(),
 36				"dublinCoreCreator": $("[id$='_txtDublinCoreCreator']").val(),
 37				"feedemail": $("[id$='_txtEmail']").val(),
 38				"dublinCoreLanguage": $("[id$='_txtDublinCoreLanguage']").val(),
 39				"geocodingLatitude": $("[id$='_txtGeocodingLatitude']").val(),
 40				"geocodingLongitude": $("[id$='_txtGeocodingLongitude']").val(),
 41				"blogChannelBLink": $("[id$='_txtBlogChannelBLink']").val(),
 42				"alternateFeedUrl": $("[id$='_txtAlternateFeedUrl']").val(),
 43				"enableEnclosures": $("[id$='_cbEnableEnclosures']").attr('checked')
 44			};
 45			
 46            $.ajax({
 47                url: SiteVars.ApplicationRelativeWebRoot + "admin/Settings/Feed.aspx/Save",
 48                type: "POST",
 49                dataType: "json",
 50                contentType: "application/json; charset=utf-8",
 51                data: JSON.stringify(dto),
 52                beforeSend: onAjaxBeforeSend,
 53                success: function (result) {
 54                    var rt = result.d;
 55                    if (rt.Success)
 56                        ShowStatus("success", rt.Message);
 57                    else
 58                        ShowStatus("warning", rt.Message);
 59                }
 60            });
 61            $('.loader').hide();
 62            return false;
 63        }
 64    </script>   
 65
 66	<div class="content-box-outer">
 67		<div class="content-box-right">
 68			<menu:TabMenu ID="TabMenu" runat="server" />
 69		</div>
 70		<div class="content-box-left">
 71            <h1><%=Resources.labels.settings %></h1>
 72
 73                <ul class="fl leftaligned">
 74                    <li>
 75                        <label class="lbl" for="<%=txtDublinCoreCreator.ClientID %>"><%=Resources.labels.author %></label>
 76                        <asp:TextBox runat="server" ID="txtDublinCoreCreator" Width="300" />
 77                    </li>
 78                    <li>
 79                        <label class="lbl" for="<%=txtEmail.ClientID %>"><%=Resources.labels.email %></label>
 80                        <asp:TextBox runat="server" ID="txtEmail" Width="300" CssClass="email" />
 81                        <span class="belowHelp">Feed author's email address (optional)</span>
 82                    </li>
 83                    <li>
 84                        <label class="lbl" for="<%=txtBlogChannelBLink.ClientID %>"><%=Resources.labels.endorsment %></label>
 85                        <asp:TextBox runat="server" ID="txtBlogChannelBLink" MaxLength="255" Width="300" />
 86                    </li>
 87                    <li>
 88                        <label class="lbl" for="<%=txtAlternateFeedUrl.ClientID %>"><%=Resources.labels.alternateFeedUrl %></label>
 89                        <asp:TextBox runat="server" ID="txtAlternateFeedUrl" Width="300" CssClass="url" />
 90                        <span class="belowHelp">(http://feeds.feedburner.com/username)</span>
 91                    </li>
 92                    <li>
 93                        <label class="lbl" for="<%=ddlSyndicationFormat.ClientID %>" style="position: relative; top: 4px"><%=Resources.labels.defaultFeedOutput %></label>
 94                        <asp:DropDownList runat="server" ID="ddlSyndicationFormat">
 95                            <asp:ListItem Text="RSS 2.0" Value="Rss" Selected="True" />
 96                            <asp:ListItem Text="Atom 1.0" Value="Atom" />
 97                        </asp:DropDownList>
 98                        format.
 99                    </li>
100                    <li>
101                        <label class="lbl" for="<%=txtDublinCoreLanguage.ClientID %>"><%=Resources.labels.languageCode %></label>
102                        <asp:TextBox runat="server" ID="txtDublinCoreLanguage" Width="60" />
103                    </li>
104                    <li>
105                        <label class="lbl" for="<%=txtPostsPerFeed.ClientID %>"><%=Resources.labels.postsPerFeed %></label>
106                        <asp:TextBox runat="server" ID="txtPostsPerFeed" Width="50" MaxLength="4" CssClass="required number" />
107                    </li>
108                    <li>
109                        <label class="lbl" for="<%=txtGeocodingLatitude.ClientID %>"><%=Resources.labels.latitude %></label>
110                        <asp:TextBox runat="server" ID="txtGeocodingLatitude" Width="150" CssClass="number" />
111                    </li>
112                    <li>
113                        <label class="lbl" for="<%=txtGeocodingLongitude.ClientID %>"><%=Resources.labels.longtitude %></label>
114                        <asp:TextBox runat="server" ID="txtGeocodingLongitude" Width="150" CssClass="number" />&nbsp;
115                        <input type="button" class="btn" id="findPosition" onclick="geodeAsk()" value="<%=Resources.labels.findPosition %>" style="display: none" />
116                        <script type="text/javascript">
117                            if (navigator.geolocation) document.getElementById('findPosition').style.display = 'inline';
118                        </script>
119                    </li>
120                    <li>
121                        <label class="lbl"><%=Resources.labels.otherSettings %></label>
122                        <asp:CheckBox runat="server" ID="cbEnableEnclosures" />
123                        <label for="<%=cbEnableEnclosures.ClientID %>"><%=Resources.labels.enableEnclosures %></label>
124                    </li>
125                </ul>
126            <div class="action_buttons">
127                <input type="submit" id="btnSave" class="btn primary" value="<%=Resources.labels.saveSettings %>" />
128            </div>
129       </div>
130    </div>
131</asp:Content>