}).success(function(data) {
sel = $('#annotateMessageList')
sel.find('option').remove();
+ sel.append('<option value="">---</option>');
$.each(data, function(i,m) {
sel.append('<option value="' + m.msgid + '">' + m.from + ': ' + m.subj + ' (' + m.date + ')</option>');
});
function addAnnotation(threadid) {
$('#annotateThreadList').find('option').remove();
$('#annotateMessage').val('');
+ $('#annotateMsgId').val('');
$('#annotateModal').modal();
+ $('#annotateThreadList').focus();
updateAnnotationMessages(threadid);
$('#doAnnotateMessageButton').unbind('click');
$('#doAnnotateMessageButton').click(function() {
$('#annotateMessageBody').addClass('loading');
$.post('/ajax/annotateMessage/', {
't': threadid,
- 'msgid': $('#annotateMessageList').val(),
+ 'msgid': $.trim($('#annotateMsgId').val()),
'msg': $('#annotateMessage').val()
}).success(function(data) {
if (data != 'OK') {
alert(data);
+ $('#annotateMessageBody').removeClass('loading');
}
else {
$('#annotateModal').modal('hide');
});
}
+function annotateMsgPicked() {
+ var val = $('#annotateMessageList').val();
+ if (val) {
+ $('#annotateMsgId').val(val);
+ annotateChanged();
+ }
+}
+
function annotateChanged() {
/* Enable/disable the annotate button */
- if ($('#annotateMessage').val() != '' && $('#annotateMessageList').val()) {
+ if ($('#annotateMessage').val() != '' && $('#annotateMsgId').val()) {
$('#doAnnotateMessageButton').removeClass('disabled');
}
else {
<div id="annotateMessageBody" class="modal-body">
<div>Pick one of the messages in this thread</div>
<div id="annotateListWrap">
- <select id="annotateMessageList" style="width:100%;" onChange="annotateChanged()">
+ <select id="annotateMessageList" style="width:100%;" onChange="annotateMsgPicked()">
</select>
</div>
+ <div>Or copy/paste the message-id:</div>
+ <div id="annotateMsgidWrap">
+ <input id="annotateMsgId" type="text" style="width:100%" onKeyUp="annotateChanged()">
+ </div>
<div><br/></div>
<div>Enter a messages for the annotation</div>
<div id="annotateTextWrap">