PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/BlogEngine/BlogEngine.NET/admin/Users/Profile.aspx

#
ASP.NET | 110 lines | 98 code | 12 blank | 0 comment | 5 complexity | 40c0c9c3ad4f093f6a9b8d5b4837a3d0 MD5 | raw file
  1<%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="Profile.aspx.cs" Inherits="Admin.Users.ProfilePage" %>
  2<%@ Register Src="~/admin/htmlEditor.ascx" TagPrefix="Blog" TagName="TextEditor" %>
  3<asp:Content ID="Content1" ContentPlaceHolderID="cphAdmin" Runat="Server">
  4    <script type="text/javascript">
  5        function SaveProfile() {
  6            var vals = new Array();
  7            var roles = new Array();
  8            var cnt = 0;
  9
 10            $.each($('.chkRole:checked'), function (i, v) {
 11                roles[cnt] = v.id;
 12                cnt++;
 13            });
 14
 15            var displayName = $('#txtDispalayName').val();
 16            var firstName = $('#txtFirstName').val();
 17            var middleName = $('#txtMiddleName').val();
 18            var lastName = $('#txtLastName').val();
 19            var email = $('#txtEmail').val();
 20            var birthday = $('#txtBirthday').val();
 21            var photoURL = $('#txtPhotoURL').val();
 22            var isPrivate = false;
 23            if ($('#chkPrivate').attr('checked')) {
 24                isPrivate = true;
 25            }
 26            var mobile = $('#txtMobile').val();
 27            var phone = $('#txtMainPhone').val();
 28            var fax = $('#txtFax').val();
 29
 30            var city = $('#txtCity').val();
 31            var state = $('#txtState').val();
 32            var country = $('#txtCountry').val();
 33            var biography = $('#biography').val();
 34
 35            if (displayName.length == 0) {
 36                $('#txtDispalayNameReq').removeClass('hidden');
 37                $('#txtDispalayName').focus().select();
 38                ShowStatus("warning", "Display Name is Required.");
 39                return false;
 40            }
 41
 42            $('#txtDispalayNameReq').addClass('hidden');
 43
 44            vals[0] = displayName;
 45            vals[1] = firstName;
 46            vals[2] = middleName;
 47            vals[3] = lastName;
 48            vals[4] = email;
 49            vals[5] = birthday;
 50            vals[6] = photoURL;
 51            vals[7] = isPrivate;
 52            vals[8] = mobile;
 53            vals[9] = phone;
 54            vals[10] = fax;
 55
 56            vals[11] = city;
 57            vals[12] = state;
 58            vals[13] = country;
 59            vals[14] = biography;
 60
 61            var dto = { "id": Querystring('id'), "vals" : vals, "roles" : roles };
 62
 63            $.ajax({
 64                url: SiteVars.ApplicationRelativeWebRoot + "api/Profile.asmx/Save",
 65                data: JSON.stringify(dto),
 66                type: "POST",
 67                contentType: "application/json; charset=utf-8",
 68                dataType: "json",
 69                beforeSend: onAjaxBeforeSend,
 70                success: function (result) {
 71                    var rt = result.d;
 72                    if (rt.Success) {
 73                        ShowStatus("success", rt.Message);
 74                    }
 75                    else {
 76                        ShowStatus("warning", rt.Message);
 77                    }
 78                }
 79            });
 80            return false;
 81        }
 82
 83        LoadProfile();
 84    </script>
 85	<div class="content-box-outer">
 86        <asp:PlaceHolder ID="phRightContentBox" runat="server">
 87		    <div class="content-box-right">
 88                <ul>
 89			        <li class="content-box-selected"><a href="Users.aspx"><%=Resources.labels.users %></a></li>
 90			        <li><a href="Roles.aspx" class="selected"><%=Resources.labels.roles %></a></li>
 91                </ul>
 92		    </div>
 93        </asp:PlaceHolder>
 94		<div class="content-box-left">
 95            <h1 style="border:none;"><%=Resources.labels.profile %> : <%=Request.QueryString["id"] %></h1>
 96            <div id="Container"></div>
 97
 98            <asp:PlaceHolder ID="phRoles" runat="server">
 99                <h2><%=Resources.labels.roles %></h2>
100                <div id="rolelist" style="margin:0 0 20px;"><%=RolesList%></div>
101            </asp:PlaceHolder>
102
103            <div id="Container2"></div>
104            <div class="action_buttons">
105                <input type="submit" class="btn primary rounded" value="<%=Resources.labels.saveProfile %>" onclick="return SaveProfile()" />
106		        or <a href="Users.aspx"><%=Resources.labels.cancel %></a>
107            </div>
108		</div>
109	</div>
110</asp:Content>