From: David ‘Bombe’ Roden Date: Wed, 19 Jan 2011 18:12:40 +0000 (+0100) Subject: Merge branch 'mark-as-read' into next X-Git-Tag: 0.4.2^2~27 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=ecf753a31601e558b681daab0598009fe9eec99a;hp=-c Merge branch 'mark-as-read' into next Conflicts: src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java --- ecf753a31601e558b681daab0598009fe9eec99a diff --combined src/main/java/net/pterodactylus/sone/template/SoneAccessor.java index 119a28e,911f5cd..27b4c24 --- a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java +++ b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java @@@ -27,8 -27,8 +27,8 @@@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.freenet.wot.Trust; import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.template.Accessor; - import net.pterodactylus.util.template.DataProvider; import net.pterodactylus.util.template.ReflectionAccessor; + import net.pterodactylus.util.template.TemplateContext; /** * {@link Accessor} for {@link Sone}s that adds a couple of properties to Sones. @@@ -39,7 -39,7 +39,7 @@@ *
friend
*
Will return {@code true} if the sone in question is a friend of the * currently logged in Sone (as determined by accessing the “currentSone” - * variable of the given {@link DataProvider}).
+ * variable of the given {@link TemplateContext}). *
current
*
Will return {@code true} if the sone in question is the currently logged * in Sone.
@@@ -69,17 -69,17 +69,17 @@@ public class SoneAccessor extends Refle * {@inheritDoc} */ @Override - public Object get(DataProvider dataProvider, Object object, String member) { + public Object get(TemplateContext templateContext, Object object, String member) { Sone sone = (Sone) object; if (member.equals("niceName")) { return getNiceName(sone); } else if (member.equals("local")) { - return sone.getInsertUri() != null; + return core.isLocalSone(sone); } else if (member.equals("friend")) { - Sone currentSone = (Sone) dataProvider.get("currentSone"); + Sone currentSone = (Sone) templateContext.get("currentSone"); return (currentSone != null) && currentSone.hasFriend(sone.getId()); } else if (member.equals("current")) { - Sone currentSone = (Sone) dataProvider.get("currentSone"); + Sone currentSone = (Sone) templateContext.get("currentSone"); return (currentSone != null) && currentSone.equals(sone); } else if (member.equals("modified")) { return core.isModifiedSone(sone); @@@ -94,11 -94,11 +94,11 @@@ } else if (member.equals("downloading")) { return core.getSoneStatus(sone) == SoneStatus.downloading; } else if (member.equals("new")) { - return core.isNewSone(sone); + return core.isNewSone(sone.getId(), false); } else if (member.equals("locked")) { return core.isLocked(sone); } else if (member.equals("trust")) { - Sone currentSone = (Sone) dataProvider.get("currentSone"); + Sone currentSone = (Sone) templateContext.get("currentSone"); if (currentSone == null) { return null; } @@@ -109,7 -109,7 +109,7 @@@ } return trust; } - return super.get(dataProvider, object, member); + return super.get(templateContext, object, member); } // diff --combined src/main/java/net/pterodactylus/sone/web/CreatePostPage.java index ef88fd6,8e60287..57eb18a --- a/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java @@@ -20,8 -20,8 +20,8 @@@ package net.pterodactylus.sone.web import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.Page.Request.Method; - import net.pterodactylus.util.template.DataProvider; import net.pterodactylus.util.template.Template; + import net.pterodactylus.util.template.TemplateContext; /** * This page lets the user create a new {@link Post}. @@@ -50,26 -50,21 +50,26 @@@ public class CreatePostPage extends Son * {@inheritDoc} */ @Override - protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException { - super.processTemplate(request, dataProvider); + protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { + super.processTemplate(request, templateContext); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); if (request.getMethod() == Method.POST) { String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim(); if (text.length() != 0) { + String senderId = request.getHttpRequest().getPartAsStringFailsafe("sender", 43); String recipientId = request.getHttpRequest().getPartAsStringFailsafe("recipient", 43); - Sone recipient = webInterface.getCore().getSone(recipientId, false); Sone currentSone = getCurrentSone(request.getToadletContext()); - webInterface.getCore().createPost(currentSone, recipient, System.currentTimeMillis(), text); + Sone sender = webInterface.getCore().getLocalSone(senderId, false); + if (sender == null) { + sender = currentSone; + } + Sone recipient = webInterface.getCore().getSone(recipientId, false); + webInterface.getCore().createPost(sender, recipient, System.currentTimeMillis(), text); throw new RedirectException(returnPage); } - dataProvider.set("errorTextEmpty", true); + templateContext.set("errorTextEmpty", true); } - dataProvider.set("returnPage", returnPage); + templateContext.set("returnPage", returnPage); } } diff --combined src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java index d3b7c35,0b7e88f..aae5e83 --- a/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java @@@ -20,8 -20,8 +20,8 @@@ package net.pterodactylus.sone.web import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.Page.Request.Method; - import net.pterodactylus.util.template.DataProvider; import net.pterodactylus.util.template.Template; + import net.pterodactylus.util.template.TemplateContext; /** * This page lets the user post a reply to a post. @@@ -50,27 -50,23 +50,27 @@@ public class CreateReplyPage extends So * {@inheritDoc} */ @Override - protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException { - super.processTemplate(request, dataProvider); + protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { + super.processTemplate(request, templateContext); String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36); String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim(); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); if (request.getMethod() == Method.POST) { Post post = webInterface.getCore().getPost(postId); if (text.length() > 0) { - Sone currentSone = getCurrentSone(request.getToadletContext()); - webInterface.getCore().createReply(currentSone, post, text); + String senderId = request.getHttpRequest().getPartAsStringFailsafe("sender", 43); + Sone sender = webInterface.getCore().getLocalSone(senderId, false); + if (sender == null) { + sender = getCurrentSone(request.getToadletContext()); + } + webInterface.getCore().createReply(sender, post, text); throw new RedirectException(returnPage); } - dataProvider.set("errorTextEmpty", true); + templateContext.set("errorTextEmpty", true); } - dataProvider.set("postId", postId); - dataProvider.set("text", text); - dataProvider.set("returnPage", returnPage); + templateContext.set("postId", postId); + templateContext.set("text", text); + templateContext.set("returnPage", returnPage); } } diff --combined src/main/java/net/pterodactylus/sone/web/DeletePostPage.java index 78c9f22,ecbb368..7a36d02 --- a/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DeletePostPage.java @@@ -18,9 -18,10 +18,9 @@@ package net.pterodactylus.sone.web; import net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.Page.Request.Method; - import net.pterodactylus.util.template.DataProvider; import net.pterodactylus.util.template.Template; + import net.pterodactylus.util.template.TemplateContext; /** * Lets the user delete a post they made. @@@ -49,30 -50,31 +49,30 @@@ public class DeletePostPage extends Son * {@inheritDoc} */ @Override - protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException { - super.processTemplate(request, dataProvider); + protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { + super.processTemplate(request, templateContext); if (request.getMethod() == Method.GET) { String postId = request.getHttpRequest().getParam("post"); String returnPage = request.getHttpRequest().getParam("returnPage"); Post post = webInterface.getCore().getPost(postId); - dataProvider.set("post", post); - dataProvider.set("returnPage", returnPage); + templateContext.set("post", post); + templateContext.set("returnPage", returnPage); return; } else if (request.getMethod() == Method.POST) { String postId = request.getHttpRequest().getPartAsStringFailsafe("post", 36); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); Post post = webInterface.getCore().getPost(postId); - Sone currentSone = getCurrentSone(request.getToadletContext()); - if (!post.getSone().equals(currentSone)) { + if (!webInterface.getCore().isLocalSone(post.getSone())) { throw new RedirectException("noPermission.html"); } if (request.getHttpRequest().isPartSet("confirmDelete")) { - currentSone.removePost(post); + webInterface.getCore().deletePost(post); throw new RedirectException(returnPage); } else if (request.getHttpRequest().isPartSet("abortDelete")) { throw new RedirectException(returnPage); } - dataProvider.set("post", post); - dataProvider.set("returnPage", returnPage); + templateContext.set("post", post); + templateContext.set("returnPage", returnPage); } } diff --combined src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java index e10036b,67a6f3d..782589f --- a/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java +++ b/src/main/java/net/pterodactylus/sone/web/DeleteReplyPage.java @@@ -18,9 -18,10 +18,9 @@@ package net.pterodactylus.sone.web; import net.pterodactylus.sone.data.Reply; -import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.page.Page.Request.Method; - import net.pterodactylus.util.template.DataProvider; import net.pterodactylus.util.template.Template; + import net.pterodactylus.util.template.TemplateContext; /** * This page lets the user delete a reply. @@@ -49,13 -50,14 +49,13 @@@ public class DeleteReplyPage extends So * {@inheritDoc} */ @Override - protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException { - super.processTemplate(request, dataProvider); + protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { + super.processTemplate(request, templateContext); String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36); Reply reply = webInterface.getCore().getReply(replyId); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256); if (request.getMethod() == Method.POST) { - Sone currentSone = getCurrentSone(request.getToadletContext()); - if (!reply.getSone().equals(currentSone)) { + if (!webInterface.getCore().isLocalSone(reply.getSone())) { throw new RedirectException("noPermission.html"); } if (request.getHttpRequest().isPartSet("confirmDelete")) { @@@ -65,8 -67,8 +65,8 @@@ throw new RedirectException(returnPage); } } - dataProvider.set("reply", reply); - dataProvider.set("returnPage", returnPage); + templateContext.set("reply", reply); + templateContext.set("returnPage", returnPage); } } diff --combined src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java index 9619531,c1afade..fa43945 --- a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java @@@ -24,8 -24,8 +24,8 @@@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.main.SonePlugin; import net.pterodactylus.sone.web.page.Page; import net.pterodactylus.sone.web.page.TemplatePage; - import net.pterodactylus.util.template.DataProvider; import net.pterodactylus.util.template.Template; + import net.pterodactylus.util.template.TemplateContext; import freenet.clients.http.SessionManager.Session; import freenet.clients.http.ToadletContext; @@@ -74,10 -74,10 +74,10 @@@ public class SoneTemplatePage extends T * Whether this page requires a login */ public SoneTemplatePage(String path, Template template, String pageTitleKey, WebInterface webInterface, boolean requireLogin) { - super(path, template, webInterface.getL10n(), pageTitleKey, "noPermission.html"); + super(path, webInterface.getTemplateContextFactory(), template, webInterface.getL10n(), pageTitleKey, "noPermission.html"); this.webInterface = webInterface; this.requireLogin = requireLogin; - template.set("webInterface", webInterface); + template.getInitialContext().set("webInterface", webInterface); } // @@@ -186,15 -186,14 +186,15 @@@ * {@inheritDoc} */ @Override - protected void processTemplate(Request request, DataProvider dataProvider) throws RedirectException { - super.processTemplate(request, dataProvider); - dataProvider.set("currentSone", getCurrentSone(request.getToadletContext(), false)); - dataProvider.set("localSones", webInterface.getCore().getLocalSones()); - dataProvider.set("request", request); - dataProvider.set("currentVersion", SonePlugin.VERSION); - dataProvider.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion()); - dataProvider.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion()); - dataProvider.set("latestVersionTime", webInterface.getCore().getUpdateChecker().getLatestVersionDate()); + protected void processTemplate(Request request, TemplateContext templateContext) throws RedirectException { + super.processTemplate(request, templateContext); + templateContext.set("currentSone", getCurrentSone(request.getToadletContext(), false)); ++ templateContext.set("localSones", webInterface.getCore().getLocalSones()); + templateContext.set("request", request); + templateContext.set("currentVersion", SonePlugin.VERSION); + templateContext.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion()); + templateContext.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion()); + templateContext.set("latestVersionTime", webInterface.getCore().getUpdateChecker().getLatestVersionDate()); } /** diff --combined src/main/resources/i18n/sone.en.properties index b5c7e24,26c13df..50dab27 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@@ -55,7 -55,6 +55,7 @@@ Page.DeleteSone.Button.No=No, do not de Page.Index.Title=Your Sone - Sone Page.Index.Label.Text=Post text: +Page.Index.Label.Sender=Sender: Page.Index.Button.Post=Post! Page.Index.PostList.Title=Post Feed Page.Index.PostList.Text.NoPostYet=Nobody has written any posts yet. You should probably start it right now! @@@ -158,6 -157,8 +158,8 @@@ Page.Distrust.Title=Distrust Sone - Son Page.Untrust.Title=Untrust Sone - Sone + Page.MarkAsKnown.Title=Mark as Known - Sone + Page.NoPermission.Title=Unauthorized Access - Sone Page.NoPermission.Page.Title=Unauthorized Access Page.NoPermission.Text.NoPermission=You tried to do something that you do not have sufficient authorization for. Please refrain from such actions in the future or we will be forced to take counter-measures! @@@ -201,8 -202,6 +203,8 @@@ View.Post.Reply.DeleteLink=Delet View.Post.LikeLink=Like View.Post.UnlikeLink=Unlike +View.UpdateStatus.Text.ChooseSenderIdentity=Choose the sender identity + View.Trust.Tooltip.Trust=Trust this person View.Trust.Tooltip.Distrust=Assign negative trust to this person View.Trust.Tooltip.Untrust=Remove your trust assignment for this person @@@ -236,6 -235,7 +238,7 @@@ Notification.NewSone.ShortText=New Sone Notification.NewSone.Text=New Sones have been discovered: Notification.NewPost.ShortText=New posts have been discovered. Notification.NewPost.Text=New posts have been discovered by the following Sones: + Notification.NewPost.Button.MarkRead=Mark as read Notification.NewReply.ShortText=New replies have been discovered. Notification.NewReply.Text=New replies have been discovered by the following Sones: Notification.SoneIsBeingRescued.Text=The following Sones are currently being rescued: diff --combined src/main/resources/static/css/sone.css index 7895246,a83d3a1..c2cbdd1 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@@ -35,11 -35,6 +35,11 @@@ textarea margin: 0px; } +#sone select { + color: #444; + padding: 0.5ex 1.5ex; +} + /* now for the real stuff. */ #sone { @@@ -113,6 -108,10 +113,10 @@@ margin-left: 1ex; } + #sone #notification-area .notification .mark-as-read { + float: right; + } + #sone #plugin-warning { border: solid 0.5em red; padding: 0.5em; @@@ -172,15 -171,6 +176,15 @@@ float: right; } +#sone #update-status .select-sender, #sone .create-reply .select-sender { + display: none; +} + +#sone #update-status .select-sender button { + display: inline; + float: left; +} + #sone .nice-name { font-weight: bold; } @@@ -371,12 -361,12 +375,12 @@@ #sone .post .create-reply input[type=text] { margin-left: 0.5ex; - width: 44em; + width: 42em; } #sone .post .create-reply textarea { margin-left: 0.5ex; - width: 44em; + width: 42em; height: 4em; } @@@ -384,11 -374,6 +388,11 @@@ float: right; } +#sone .create-reply .select-sender button { + display: inline; + float: left; +} + #sone .sone { clear: both; background-color: #f0f0ff; @@@ -494,7 -479,7 +498,7 @@@ display: none; } -#sone .profile-field button.confirm { +#sone .profile-field button.confirm.edit { font-weight: bold; color: #080; } @@@ -515,7 -500,6 +519,7 @@@ #sone .profile-field .edit-field-name, #sone .profile-field .move-up-field, #sone .profile-field .move-down-field, #sone .profile-field .delete-field-name { float: right; margin-top: -1ex; + position: relative; } #sone #tail { diff --combined src/main/resources/static/javascript/sone.js index 35b53e3,5922717..a0bbf8a --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@@ -491,8 -491,6 +491,8 @@@ function updateReplyLikes(replyId) /** * Posts a reply and calls the given callback when the request finishes. * + * @param sender + * The ID of the sender * @param postId * The ID of the post the reply refers to * @param text @@@ -501,14 -499,14 +501,14 @@@ * The callback function to call when the request finishes (takes 3 * parameters: success, error, replyId) */ -function postReply(postId, text, callbackFunction) { - $.getJSON("createReply.ajax", { "formPassword" : getFormPassword(), "post" : postId, "text": text }, function(data, textStatus) { +function postReply(sender, postId, text, callbackFunction) { + $.getJSON("createReply.ajax", { "formPassword" : getFormPassword(), "sender": sender, "post" : postId, "text": text }, function(data, textStatus) { if (data == null) { /* TODO - show error */ return; } if (data.success) { - callbackFunction(true, null, data.reply); + callbackFunction(true, null, data.reply, data.sone); } else { callbackFunction(false, data.error); } @@@ -547,25 -545,21 +547,25 @@@ function ajaxifyPost(postElement) return false; }); $(postElement).find(".create-reply button:submit").click(function() { - inputField = $(this.form).find(":input:enabled").get(0); + sender = $(this.form).find(":input[name=sender]").val(); + inputField = $(this.form).find(":input[name=text]:enabled").get(0); postId = getPostId(this); text = $(inputField).val(); - (function(postId, text, inputField) { - postReply(postId, text, function(success, error, replyId) { + (function(sender, postId, text, inputField) { + postReply(sender, postId, text, function(success, error, replyId, soneId) { if (success) { $(inputField).val(""); - loadNewReply(replyId, getCurrentSoneId(), postId); + loadNewReply(replyId, soneId, postId); markPostAsKnown(getPostElement(inputField)); $("#sone .post#" + postId + " .create-reply").addClass("hidden"); + $("#sone .post#" + postId + " .create-reply .sender").hide(); + $("#sone .post#" + postId + " .create-reply .select-sender").show(); + $("#sone .post#" + postId + " .create-reply :input[name=sender]").val(getCurrentSoneId()); } else { alert(error); } }); - })(postId, text, inputField); + })(sender, postId, text, inputField); return false; }); @@@ -618,15 -612,6 +618,15 @@@ }); }); + /* process sender selection. */ + $(".select-sender", postElement).css("display", "inline"); + $(".sender", postElement).hide(); + $(".select-sender button", postElement).click(function() { + $(".sender", postElement).show(); + $(".select-sender", postElement).hide(); + return false; + }); + /* mark everything as known on click. */ $(postElement).click(function(event) { if ($(event.target).hasClass("click-to-show")) { @@@ -692,9 -677,17 +692,17 @@@ function ajaxifyReply(replyElement) * jQuery object representing the notification. */ function ajaxifyNotification(notification) { - notification.find("form.dismiss").submit(function() { + notification.find("form").submit(function() { return false; }); + notification.find("input[name=returnPage]").val($.url.attr("relative")); + if (notification.find(".short-text").length > 0) { + notification.find(".short-text").removeClass("hidden"); + notification.find(".text").addClass("hidden"); + } + notification.find("form.mark-as-read button").click(function() { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": $(":input[name=id]", this.form).val()}); + }); notification.find("form.dismiss button").click(function() { $.getJSON("dismissNotification.ajax", { "formPassword" : getFormPassword(), "notification" : notification.attr("id") }, function(data, textStatus) { /* dismiss in case of error, too. */ @@@ -936,7 -929,7 +944,7 @@@ function markPostAsKnown(postElements) postElement = this; if ($(postElement).hasClass("new")) { (function(postElement) { - $.getJSON("markPostAsKnown.ajax", {"formPassword": getFormPassword(), "post": getPostId(postElement)}, function(data, textStatus) { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "post", "id": getPostId(postElement)}, function(data, textStatus) { $(postElement).removeClass("new"); $(".click-to-show", postElement).removeClass("new"); }); @@@ -951,7 -944,7 +959,7 @@@ function markReplyAsKnown(replyElements replyElement = this; if ($(replyElement).hasClass("new")) { (function(replyElement) { - $.getJSON("markReplyAsKnown.ajax", {"formPassword": getFormPassword(), "reply": getReplyId(replyElement)}, function(data, textStatus) { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "reply", "id": getReplyId(replyElement)}, function(data, textStatus) { $(replyElement).removeClass("new"); }); })(replyElement); @@@ -1093,28 -1086,17 +1101,28 @@@ $(document).ready(function() /* this initializes the status update input field. */ getTranslation("WebInterface.DefaultText.StatusUpdate", function(defaultText) { registerInputTextareaSwap("#sone #update-status .status-input", defaultText, "text", false, false); + $("#sone #update-status .select-sender").css("display", "inline"); + $("#sone #update-status .sender").hide(); + $("#sone #update-status .select-sender button").click(function() { + $("#sone #update-status .sender").show(); + $("#sone #update-status .select-sender").hide(); + return false; + }); $("#sone #update-status").submit(function() { if ($(this).find(":input.default:enabled").length > 0) { return false; } - text = $(this).find(":input:enabled").val(); - $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "text": text }, function(data, textStatus) { + sender = $(this).find(":input[name=sender]").val(); + text = $(this).find(":input[name=text]:enabled").val(); + $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "sender": sender, "text": text }, function(data, textStatus) { if ((data != null) && data.success) { - loadNewPost(data.postId, getCurrentSoneId()); + loadNewPost(data.postId, data.sone, data.recipient); } }); - $(this).find(":input:enabled").val("").blur(); + $(this).find(":input[name=sender]").val(getCurrentSoneId()); + $(this).find(":input[name=text]:enabled").val("").blur(); + $(this).find(".sender").hide(); + $(this).find(".select-sender").show(); return false; }); });