1 <%include include/head.html>
3 <script language="javascript">
4 function recheckMoveButtons() {
5 $("#sone .profile-field").each(function() {
6 $(".move-up-field", this).toggleClass("hidden", $(this).prev(".profile-field").length == 0);
7 $(".move-down-field", this).toggleClass("hidden", $(this).next(".profile-field").length == 0);
12 getTranslation("WebInterface.DefaultText.FirstName", function(firstNameDefaultText) {
13 registerInputTextareaSwap("#sone #edit-profile input[name=first-name]", firstNameDefaultText, "first-name", true, true);
15 getTranslation("WebInterface.DefaultText.MiddleName", function(middleNameDefaultText) {
16 registerInputTextareaSwap("#sone #edit-profile input[name=middle-name]", middleNameDefaultText, "middle-name", true, true);
18 getTranslation("WebInterface.DefaultText.LastName", function(lastNameDefaultText) {
19 registerInputTextareaSwap("#sone #edit-profile input[name=last-name]", lastNameDefaultText, "last-name", true, true);
21 getTranslation("WebInterface.DefaultText.BirthDay", function(birthDayDefaultText) {
22 registerInputTextareaSwap("#sone #edit-profile input[name=birth-day]", birthDayDefaultText, "birth-day", true, true);
24 getTranslation("WebInterface.DefaultText.BirthMonth", function(birthMonthDefaultText) {
25 registerInputTextareaSwap("#sone #edit-profile input[name=birth-month]", birthMonthDefaultText, "birth-month", true, true);
27 getTranslation("WebInterface.DefaultText.BirthYear", function(birthYearDefaultText) {
28 registerInputTextareaSwap("#sone #edit-profile input[name=birth-year]", birthYearDefaultText, "birth-year", true, true);
30 getTranslation("WebInterface.DefaultText.FieldName", function(fieldNameDefaultText) {
31 registerInputTextareaSwap("#sone #add-profile-field input[name=field-name]", fieldNameDefaultText, "field-name", false, true);
34 <%foreach fields field>
35 registerInputTextareaSwap("#sone #edit-profile input[name=field-<% loop.count>]", <% field.key|js>, "field-<% loop.count>", true, true);
38 /* hide all the labels. */
39 $("#sone #edit-profile label, #sone #add-profile-field label").hide();
41 /* ajaxify the delete buttons. */
42 getTranslation("Page.EditProfile.Fields.Button.ReallyDelete", function(reallyDeleteText) {
43 $("#sone #edit-profile .delete-field-name button").each(function() {
44 confirmButton = $(this).clone().addClass("hidden").addClass("confirm").text(reallyDeleteText).insertAfter(this);
45 (function(deleteButton, confirmButton) {
46 deleteButton.click(function() {
47 deleteButton.fadeOut("slow", function() {
48 confirmButton.fadeIn("slow");
49 $(document).one("click", function() {
50 if (this != confirmButton.get(0)) {
51 confirmButton.fadeOut("slow", function() {
52 deleteButton.fadeIn("slow");
60 confirmButton.click(function() {
61 confirmButton.fadeOut("slow");
62 buttonName = confirmButton.attr("name");
63 fieldId = buttonName.substring("delete-field-".length);
64 deleteProfileField(fieldId);
68 })($(this), confirmButton);
72 /* ajaxify the edit button. */
73 $("#sone #edit-profile .edit-field-name button").each(function() {
74 profileField = $(this).parents(".profile-field");
75 fieldNameElement = profileField.find(".name");
76 inputField = $("input[type=text].short", profileField);
77 confirmButton = $("button.confirm", profileField);
78 cancelButton = $("button.cancel", profileField);
79 (function(editButton, inputField, confirmButton, cancelButton, fieldNameElement) {
80 cleanUp = function(editButton, inputField, confirmButton, cancelButton, fieldNameElement) {
81 editButton.removeAttr("disabled");
82 inputField.addClass("hidden");
83 confirmButton.addClass("hidden");
84 cancelButton.addClass("hidden");
85 fieldNameElement.removeClass("hidden");
87 confirmButton.click(function() {
88 inputField.attr("disabled", "disabled");
89 confirmButton.attr("disabled", "disabled");
90 cancelButton.attr("disabled", "disabled");
91 editProfileField(confirmButton.parents(".profile-field").attr("id"), inputField.val(), function() {
92 fieldNameElement.text(inputField.val());
93 cleanUp(editButton, inputField, confirmButton, cancelButton, fieldNameElement);
97 cancelButton.click(function() {
98 cleanUp(editButton, inputField, confirmButton, cancelButton, fieldNameElement);
101 inputField.keypress(function(event) {
102 if (event.which == 13) {
103 confirmButton.click();
105 } else if (event.which == 27) {
106 cancelButton.click();
110 editButton.click(function() {
111 editButton.attr("disabled", "disabled");
112 fieldNameElement.addClass("hidden");
113 inputField.removeAttr("disabled").val(fieldNameElement.text()).removeClass("hidden").focus().select();
114 confirmButton.removeAttr("disabled").removeClass("hidden");
115 cancelButton.removeAttr("disabled").removeClass("hidden");
118 })($(this), inputField, confirmButton, cancelButton, fieldNameElement);
121 /* ajaxify “move up” and “move down” buttons. */
122 $("#sone .profile-field .move-down-field button").click(function() {
123 profileField = $(this).parents(".profile-field");
124 moveProfileFieldDown(profileField.attr("id"), function() {
125 next = profileField.next();
126 current = profileField.insertAfter(next);
127 recheckMoveButtons();
131 $("#sone .profile-field .move-up-field button").click(function() {
132 profileField = $(this).parents(".profile-field");
133 moveProfileFieldUp(profileField.attr("id"), function() {
134 previous = profileField.prev();
135 current = profileField.insertBefore(previous);
136 recheckMoveButtons();
143 <h1><%= Page.EditProfile.Page.Title|l10n|html></h1>
145 <p><%= Page.EditProfile.Page.Description|l10n|html></p>
146 <p><%= Page.EditProfile.Page.Hint.Optionality|l10n|html></p>
148 <form id="edit-profile" method="post">
149 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
152 <label for="first-name"><%= Page.EditProfile.Label.FirstName|l10n|html></label>
153 <input type="text" name="first-name" value="<% firstName|html>" />
157 <label for="middle-name"><%= Page.EditProfile.Label.MiddleName|l10n|html></label>
158 <input type="text" name="middle-name" value="<% middleName|html>" />
162 <label for="last-name"><%= Page.EditProfile.Label.LastName|l10n|html></label>
163 <input type="text" name="last-name" value="<% lastName|html>" />
166 <h1><%= Page.EditProfile.Birthday.Title|l10n|html></h1>
169 <label for="birth-day"><%= Page.EditProfile.Birthday.Label.Day|l10n|html></label>
170 <input type="text" name="birth-day" value="<% birthDay|html>" />
173 <div id="birth-month">
174 <label for="birth-month"><%= Page.EditProfile.Birthday.Label.Month|l10n|html></label>
175 <input type="text" name="birth-month" value="<% birthMonth|html>" />
178 <div id="birth-year">
179 <label for="birth-year"><%= Page.EditProfile.Birthday.Label.Year|l10n|html></label>
180 <input type="text" name="birth-year" value="<% birthYear|html>" />
183 <h1><%= Page.EditProfile.Avatar.Title|l10n|html></h1>
185 <p><%= Page.EditProfile.Avatar.Description|l10n|html></p>
187 <ul id="avatar-selection">
189 <input type="radio" name="avatar-id" value="none"<%ifnull avatar-image> checked="checked"<%/if>/>
190 <%= Page.EditProfile.Avatar.Delete|l10n|html>
192 <%foreach currentSone.allImages image>
194 <input type="radio" name="avatar-id" value="<%image.id|html>"<%if avatar-id|match key=image.id> checked="checked"<%/if>/>
195 <div class="post-avatar"><% image|image-link max-width=48 max-height=48 mode=enlarge title==image.title></div>
201 <button type="submit" name="save-profile" value="true"><%= Page.EditProfile.Button.Save|l10n|html></button>
204 <h1><%= Page.EditProfile.Fields.Title|l10n|html></h1>
206 <p><%= Page.EditProfile.Fields.Description|l10n|html></p>
208 <%foreach fields field fieldLoop>
209 <div class="profile-field" id="<% field.id|html>">
210 <div class="name"><% field.name|html></div>
211 <input class="short hidden" type="text"><button class="edit confirm hidden" type="button">✔</button><button class="cancel hidden" type="button">✘</button>
212 <div class="edit-field-name"><button type="submit" name="edit-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.Edit|l10n|html></button></div>
213 <div class="delete-field-name"><button type="submit" name="delete-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.Delete|l10n|html></button></div>
214 <div class="<%if fieldLoop.last>hidden <%/if>move-down-field"><button type="submit" name="move-down-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.MoveDown|l10n|html></button></div>
215 <div class="<%if fieldLoop.first>hidden <%/if>move-up-field"><button type="submit" name="move-up-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.MoveUp|l10n|html></button></div>
216 <div class="value"><input type="text" name="field-<% field.id|html>" value="<% field.value|html>" /></div>
221 <button type="submit" name="save-profile" value="true"><%= Page.EditProfile.Button.Save|l10n|html></button>
228 <form id="add-profile-field" method="post">
229 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
231 <a name="profile-fields"></a>
232 <h2><%= Page.EditProfile.Fields.AddField.Title|l10n|html></h2>
234 <%if duplicateFieldName>
235 <p><%= Page.EditProfile.Error.DuplicateFieldName|l10n|replace needle="{fieldName}" replacementKey="fieldName"|html></p>
239 <label for="new-field"><%= Page.EditProfile.Fields.AddField.Label.Name|l10n|html></label>
240 <input type="text" name="field-name" value="" />
241 <button type="submit" name="add-field" value="true"><%= Page.EditProfile.Fields.AddField.Button.AddField|l10n|html></button>
246 <%include include/tail.html>