>>>>>> origin/Repository-Monitor
#line default
#line hidden
WriteLiteral(@"',
$('#silverlightHostUploadAttachment').get(0),
'silverlightUploadAttachment',
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
{
onLoad: function () {
if (onLoadNavigation) {
silverlightUploadAttachment.content.Navigator.Navigate(onLoadNavigation);
isLoaded = true;
}
}
},
'UploadUrl=");
#line 252 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral(@"'
);
$attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
showDialog('/WebCam');
});
$attachmentInput.find('.upload').click(function () {
showDialog('/File');
});
silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
function showDialog(navigationPath) {
$('#dialogUpload').dialog('open');
if (isLoaded) {
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
} else {
onLoadNavigation = navigationPath;
}
};
function addAttachment(id, quick) {
var data = { id: id };
$.ajax({
url: '");
#line 275 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Attachment()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
if (parseInt(a.ParentId) == jobId) {
var e = $('
![]()
');
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 285 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentDownload()));
#line default
#line hidden
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
#line 286 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentThumbnail()));
#line default
#line hidden
WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.Comments);\r\n " +
" e.find(\'.author\').text(a.Author);\r\n " +
" e.find(\'.timestamp\').text(a.TimestampFuzzy).attr(\'title\', a.TimestampF" +
"ull);\r\n e.find(\'.remove\').click(removeLocalAttachment" +
");\r\n if (!quick)\r\n e.h" +
"ide();\r\n $attachmentOutput.append(e);\r\n " +
" if (!quick)\r\n e.show(\'slow\');\r\n " +
" if (a.MimeType.toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" e.shadowbox({ gallery: \'attachments\', player: \'img" +
"\', title: a.Comments });\r\n }\r\n } else " +
"{\r\n alert(\'Unable to add attachment: \' + d.Result);\r\n " +
" }\r\n },\r\n error: function (jqXHR, t" +
"extStatus, errorThrown) {\r\n alert(\'Unable to add attachment: " +
"\' + textStatus);\r\n }\r\n });\r\n }\r\n functio" +
"n removeAttachment(id) {\r\n var $element = $attachmentOutput.find(\'a[d" +
"ata-attachmentid=\"\' + id + \'\"]\');\r\n if ($element.length > 0) {\r\n " +
" $element.hide(300).delay(300).queue(function () {\r\n " +
" if ($element.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" Shadowbox.removeCache(this);\r\n $element.r" +
"emove();\r\n });\r\n }\r\n }\r\n\r\n function remo" +
"veLocalAttachment() {\r\n $this = $(this).closest(\'a\');\r\n\r\n " +
"var data = { id: $this.attr(\'data-attachmentid\') };\r\n\r\n var $dialogRe" +
"moveAttachment = $(\'#dialogRemoveAttachment\');\r\n $dialogRemoveAttachm" +
"ent.dialog(\"enable\");\r\n $dialogRemoveAttachment.dialog(\'option\', \'but" +
"tons\', {\r\n \"Remove\": function () {\r\n $dialogRe" +
"moveAttachment.dialog(\"disable\");\r\n $dialogRemoveAttachment.d" +
"ialog(\"option\", \"buttons\", null);\r\n $.ajax({\r\n " +
" url: \'");
#line 331 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data" +
",\r\n success: function (d) {\r\n " +
"if (d == \'OK\') {\r\n // Should be removed via Repos" +
"itory Notifications\r\n //$this.hide(300).delay(300" +
").queue(function () {\r\n // var $this = $(this)" +
";\r\n // if ($this.attr(\'data-mimetype\').toLower" +
"Case().indexOf(\'image/\') == 0)\r\n // Shadow" +
"box.removeCache(this);\r\n // $this.remove();\r\n " +
" //});\r\n } else {\r\n " +
" alert(\'Unable to remove attachment: \' + d);\r\n " +
" }\r\n $dialogRemoveAttachment.dial" +
"og(\"close\");\r\n },\r\n error: functio" +
"n (jqXHR, textStatus, errorThrown) {\r\n alert(\'Unable " +
"to remove attachment: \' + textStatus);\r\n $dialogRemov" +
"eAttachment.dialog(\"close\");\r\n }\r\n });" +
"\r\n },\r\n \"Cancel\": function () {\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r\n }\r\n });\r" +
"\n\r\n $dialogRemoveAttachment.dialog(\'open\');\r\n\r\n return fal" +
"se;\r\n }\r\n\r\n $attachmentOutput.children(\'a\').each(function () {\r\n " +
" $this = $(this);\r\n if ($this.attr(\'data-mimetype\').toLowerC" +
"ase().indexOf(\'image/\') == 0)\r\n $this.shadowbox({ gallery: \'attac" +
"hments\', player: \'img\', title: $this.find(\'.comments\').text() });\r\n });\r\n" +
" //#endregion\r\n\r\n //#region LiveEvents\r\n function liveMessa" +
"geRecieved(d) {\r\n if (d) {\r\n switch (d.EntityTypeName)" +
" {\r\n case \'JobAttachment\':\r\n switch (d" +
".EventType) {\r\n case 0: // Added\r\n " +
" addAttachment(d.EntityKey[0], false);\r\n " +
" break;\r\n case 1: // Removed\r\n " +
" removeAttachment(d.EntityKey[0]);\r\n b" +
"reak;\r\n }\r\n break;\r\n " +
" case \'JobLog\':\r\n switch (d.EventType) {\r\n " +
" case 0: // Added\r\n loadLiveComm" +
"ent(d.EntityKey[0]);\r\n break;\r\n " +
" case 1: // Removed\r\n $CommentOutput.chi" +
"ldren(\'div[data-logid=\"\' + d.EntityKey[0] + \'\"]\').slideUp(300).delay(300).queue(" +
"function () {\r\n $(this).remove();\r\n " +
" });\r\n break;\r\n " +
" }\r\n break;\r\n }\r\n }\r\n" +
" }\r\n var liveMessagesConnection = $.connection(\'");
#line 400 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/API/Repository/Notifications"));
#line default
#line hidden
WriteLiteral(@"')
liveMessagesConnection.received(liveMessageRecieved);
liveMessagesConnection.error(function (e) {
alert('Error: ' + JSON.stringify(e));
});
liveMessagesConnection.start(function () {
liveMessagesConnection.send('/addToGroups:JobLog,JobAttachment');
});
//#endregion
});
");
}
}
}
#pragma warning restore 1591