Browse files

client side: notification delete button

  • Loading branch information...
1 parent 12ccf4b commit 266ce5cf3e805916cb301aa1820dbb22f60a6df2 @Martikos Martikos committed Apr 25, 2013
Showing with 30 additions and 7 deletions.
  1. +7 −1 Views/Private/Notifications.aspx
  2. +23 −6 Views/Private/Notifications.aspx.cs
View
8 Views/Private/Notifications.aspx
@@ -11,7 +11,6 @@
<asp:MultiView ID="notifications_multiview" runat="server">
<asp:View ID="onenotification_view" runat="server">
-
<div class="conversation_window">
<asp:HiddenField ID="otherUserId" runat="server" />
@@ -23,6 +22,13 @@
</div>
</div>
+ <script type="text/javascript">
+ function deletenotification(parameter, number) {
+ // __doPostBack(parameter, parameter)
+ window.location.replace("http://stackoverflow.com");
+ }
+ </script>
+
<div class="conversation_window_chat">
<textarea class="chat_area" ID="chat_area" cols="20" rows="2" runat="server"></textarea><br />
<asp:Button class="chat_send" ID="Button1" runat="server" Text="Send" OnClick="send_message" PostBackUrl="#"/>
View
29 Views/Private/Notifications.aspx.cs
@@ -11,12 +11,24 @@ public partial class Views_Notifications : System.Web.UI.Page
// public Notification(string message, Guid senderId, Guid recieverId, DateTime date, int parentId)
protected void Page_Load(object sender, EventArgs e)
{
- string parameter = Request["__EVENTARGUMENT"];
+ String parameter = Request["__EVENTARGUMENT"];
+
if (parameter != null && parameter != "")
{
- notifications_multiview.ActiveViewIndex = 0;
- conversation_div.InnerHtml = "";
- showConversation(parameter);
+ string argument = parameter.Split('=')[0];
+ string value = parameter.Split('=')[1];
+ if (argument.Equals("preview"))
+ {
+
+ notifications_multiview.ActiveViewIndex = 0;
+ conversation_div.InnerHtml = "";
+ showConversation(value);
+ }
+ else if (argument.Equals("delete"))
+ {
+ Boolean deleted = NotificationDataService.deleteNotification(value);
+ showConversation(otherUserId.Value.ToString());
+ }
}
else
{
@@ -74,6 +86,7 @@ protected void Page_Load(object sender, EventArgs e)
private void showConversation(String uid)
{
+ conversation_div.InnerHtml = "";
otherUserId.Value = uid;
conversation_title.Text = "Conversation with " + UserDataService.getUser(new Guid(uid)).name;
MembershipUser user = Membership.GetUser();
@@ -125,7 +138,10 @@ private string createReceiverDiv(Notification n)
/* add item thumbnail */
objectHTML += "<img width=\"40px\" height=\"40px\" src=\"../Helpers/GetThumbnail.ashx?ID=" + UserDataService.getUser(n.senderId).imageId + "\"></img>";
+ objectHTML += "<div class=\"notification_div\" onclick=\"previewchat('delete=" + n.id + "')\" runat=\"server\">remove</div>";
+
/* add person name */
+
objectHTML += "<div class=\"message_receiver_user\">" + UserDataService.getUser(n.senderId).name + "</div>";
objectHTML += "<div class=\"message_receiver_message\">" + n.message + "</div>";
@@ -146,6 +162,7 @@ private string createSenderDiv(Notification n)
objectHTML += "<img width=\"40px\" height=\"40px\" src=\"../Helpers/GetThumbnail.ashx?ID=" + UserDataService.getUser(n.senderId).imageId + "\"></img>";
/* add person name */
+ objectHTML += "<div class=\"notification_div\" onclick=\"previewchat('delete=" + n.id + "')\" runat=\"server\">remove</div>";
objectHTML += "<div class=\"message_sender_user\">" + UserDataService.getUser(n.senderId).name + "</div>";
objectHTML += "<div class=\"message_sender_message\">" + n.message + "</div>";
@@ -163,7 +180,7 @@ private string createNotificationDiv(Notification n, bool sender)
if (sender)
{
/* if i'm the sender, put information about the receiving user */
- objectHTML += "<div class=\"notification_div\" onclick=\"javascript:previewchat('" + n.recieverId + "')\" runat=\"server\">";
+ objectHTML += "<div class=\"notification_div\" onclick=\"previewchat('preview=" + n.recieverId + "')\" runat=\"server\">";
/* add item thumbnail */
objectHTML += "<img class=\"notification_image\" align=\"left\">" + "" + "</img>";
@@ -188,7 +205,7 @@ private string createNotificationDiv(Notification n, bool sender)
else
{
/* if i'm the receiver, put information about the sending user */
- objectHTML += "<div class=\"notification_div\" onclick=\"javascript:previewchat('" + n.senderId + "')\" runat=\"server\">";
+ objectHTML += "<div class=\"notification_div\" onclick=\"previewchat('preview=" + n.senderId + "')\" runat=\"server\">";
/* add item thumbnail */
objectHTML += "<img class=\"notification_image\" align=\"left\">" + "" + "</img>";

0 comments on commit 266ce5c

Please sign in to comment.