|
|
@ -26,15 +26,18 @@
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
<ul id="discussion">
|
|
|
|
<ul id="discussion">
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
<input type="text" id="message" />
|
|
|
|
|
|
|
|
<div style="display: inline-block;">
|
|
|
|
<div style="display: inline-block;">
|
|
|
|
|
|
|
|
<div id="sendmessagebox">
|
|
|
|
|
|
|
|
<input type="text" id="message" />
|
|
|
|
<input type="button" id="sendmessage" value="@SR["Send"]" />
|
|
|
|
<input type="button" id="sendmessage" value="@SR["Send"]" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
@if (ViewBag.IsAuthenticated) {
|
|
|
|
@if (ViewBag.IsAuthenticated) {
|
|
|
|
<br/>
|
|
|
|
<div id="sendpvbox">
|
|
|
|
<input type="button" id="sendpv" value="@SR["Send a private message"] @SR["to"]" />
|
|
|
|
<input type="text" id="pv" />
|
|
|
|
<select id="to" />
|
|
|
|
<button type="submit" id="sendpv">@SR["Send a private message"] @SR["to"] <div id="sendpvdest" /> </button>
|
|
|
|
<input type="button" id="btnDebug" Value="RUL"/>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<input type="hidden" id="mySignalRConnectionIdHidden" value="" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
@ -49,6 +52,24 @@
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
$(function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
document.userList = [];
|
|
|
|
|
|
|
|
var setPrivate = function(li)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$("#sendmessagebox").addClass("hidden");
|
|
|
|
|
|
|
|
$("#sendpvbox").removeClass("hidden");
|
|
|
|
|
|
|
|
document.privateChatter = document.userList[$(li).data("usernum")];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#sendpvdest').html(document.privateChatter.UserName)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var setPublic = function()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$("#sendmessagebox").removeClass("hidden");
|
|
|
|
|
|
|
|
$("#sendpvbox").addClass("hidden");
|
|
|
|
|
|
|
|
document.privateChatter = {};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setPublic();
|
|
|
|
|
|
|
|
|
|
|
|
var getUsers = function() {
|
|
|
|
var getUsers = function() {
|
|
|
|
$('#userlist').empty();
|
|
|
|
$('#userlist').empty();
|
|
|
|
$('#to').empty();
|
|
|
|
$('#to').empty();
|
|
|
@ -63,16 +84,20 @@
|
|
|
|
$.each(user.Connections,function() {
|
|
|
|
$.each(user.Connections,function() {
|
|
|
|
cxids.push(this.ConnectionId);
|
|
|
|
cxids.push(this.ConnectionId);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
li.data("name",user.UserName);
|
|
|
|
$(li).data("name",user.UserName);
|
|
|
|
li.data("cxids",cxids);
|
|
|
|
$(li).data("cxids",cxids);
|
|
|
|
|
|
|
|
document.userList.push(user);
|
|
|
|
|
|
|
|
$(li).data("usernum",document.userList.length-1);
|
|
|
|
|
|
|
|
$(li).css('cursor','pointer');
|
|
|
|
|
|
|
|
$(li).click(function(){
|
|
|
|
|
|
|
|
setPrivate(this);
|
|
|
|
|
|
|
|
});
|
|
|
|
li.appendTo('#userlist');
|
|
|
|
li.appendTo('#userlist');
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
document.userList = {};
|
|
|
|
|
|
|
|
// Reference the auto-generated proxy for the hub.
|
|
|
|
// Reference the auto-generated proxy for the hub.
|
|
|
|
var chat = $.connection.chatHub;
|
|
|
|
var chat = $.connection.chatHub;
|
|
|
|
// Create a function that the hub can call back to display messages.
|
|
|
|
// Create a function that the hub can call back to display messages.
|
|
|
@ -112,6 +137,8 @@
|
|
|
|
li.data("name",username);
|
|
|
|
li.data("name",username);
|
|
|
|
li.data("cxids",[cxid]);
|
|
|
|
li.data("cxids",[cxid]);
|
|
|
|
li.appendTo('#userlist');
|
|
|
|
li.appendTo('#userlist');
|
|
|
|
|
|
|
|
li.css('cursor','pointer');
|
|
|
|
|
|
|
|
li.click(function(){ setPrivate(this); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
chat.client.notify = function (tag, message, data) {
|
|
|
|
chat.client.notify = function (tag, message, data) {
|
|
|
@ -153,13 +180,13 @@ $('#discussion').append('<li class="notif"><i>' + htmlEncode(tag)
|
|
|
|
$('#message').val('').focus();
|
|
|
|
$('#message').val('').focus();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('#sendpv').click(function () {
|
|
|
|
$('#sendpv').click(function () {
|
|
|
|
|
|
|
|
|
|
|
|
// Call the Send method on the hub.
|
|
|
|
// Call the Send method on the hub.
|
|
|
|
var user = document.userList[$('#to').val()];
|
|
|
|
$.each(document.privateChatter.Connections,function () {
|
|
|
|
$.each(user.Connections,function () {
|
|
|
|
chat.server.sendPV( this.ConnectionId, $('#pv').val());
|
|
|
|
chat.server.sendPV( this.ConnectionId, $('#message').val());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// Clear text box and reset focus for next comment.
|
|
|
|
// Clear text box and reset focus for next comment.
|
|
|
|
$('#message').val('').focus();
|
|
|
|
$('#pv').val('').focus();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
getUsers();
|
|
|
|
getUsers();
|
|
|
|