b1d16ae87c
Use OnConnection query string to add group membership rather than making an additional call after connection.
811 lines
31 KiB
C#
811 lines
31 KiB
C#
#pragma warning disable 1591
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version:4.0.30319.18033
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace Disco.Web.Views.Job.JobParts
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Helpers;
|
|
using System.Web.Mvc;
|
|
using System.Web.Mvc.Ajax;
|
|
using System.Web.Mvc.Html;
|
|
using System.Web.Routing;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.WebPages;
|
|
using Disco.BI.Extensions;
|
|
using Disco.Models.Repository;
|
|
using Disco.Web;
|
|
using Disco.Web.Extensions;
|
|
|
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
|
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Job/JobParts/Resources.cshtml")]
|
|
public partial class Resources : System.Web.Mvc.WebViewPage<Disco.Web.Models.Job.ShowModel>
|
|
{
|
|
public Resources()
|
|
{
|
|
}
|
|
public override void Execute()
|
|
{
|
|
|
|
#line 2 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
|
|
Html.BundleDeferred("~/Style/Shadowbox");
|
|
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
|
|
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n<table");
|
|
|
|
WriteLiteral(" id=\"jobShowResources\"");
|
|
|
|
WriteLiteral(">\r\n <tr>\r\n <td");
|
|
|
|
WriteLiteral(" id=\"Comments\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" class=\"commentOutput\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 11 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 11 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
foreach (var jl in Model.Job.JobLogs.OrderBy(m => m.Timestamp))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" data-logid=\"");
|
|
|
|
|
|
#line 13 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(jl.Id);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">\r\n <span");
|
|
|
|
WriteLiteral(" class=\"author\"");
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 14 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(jl.TechUser.ToString());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span><span");
|
|
|
|
WriteLiteral(" class=\"remove\"");
|
|
|
|
WriteLiteral("></span><span");
|
|
|
|
WriteLiteral(" class=\"timestamp\"");
|
|
|
|
WriteAttribute("title", Tuple.Create(" title=\"", 608), Tuple.Create("\"", 646)
|
|
|
|
#line 14 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 616), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
|
|
|
|
#line default
|
|
#line hidden
|
|
, 616), false)
|
|
);
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 14 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(jl.Timestamp.ToFuzzy());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span>\r\n <span");
|
|
|
|
WriteLiteral(" class=\"comment\"");
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 15 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(jl.Comments.ToMultilineJobRefString());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span>\r\n </div>\r\n");
|
|
|
|
|
|
#line 17 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </div>\r\n <div");
|
|
|
|
WriteLiteral(" class=\"commentInput clearfix\"");
|
|
|
|
WriteLiteral(">\r\n <textarea");
|
|
|
|
WriteLiteral(" class=\"commentInput\"");
|
|
|
|
WriteLiteral(" accesskey=\"l\"");
|
|
|
|
WriteLiteral("></textarea>\r\n <span");
|
|
|
|
WriteLiteral(" class=\"action post commentInputPost\"");
|
|
|
|
WriteLiteral("></span>\r\n </div>\r\n </td>\r\n <td");
|
|
|
|
WriteLiteral(" id=\"Attachments\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" class=\"attachmentOutput\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 26 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 26 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
foreach (var ja in Model.Job.JobAttachments)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <a");
|
|
|
|
WriteAttribute("href", Tuple.Create(" href=\"", 1245), Tuple.Create("\"", 1302)
|
|
|
|
#line 28 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1252), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1252), false)
|
|
);
|
|
|
|
WriteLiteral(" data-attachmentid=\"");
|
|
|
|
|
|
#line 28 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(ja.Id);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(" data-mimetype=\"");
|
|
|
|
|
|
#line 28 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(ja.MimeType);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">\r\n <span");
|
|
|
|
WriteLiteral(" class=\"icon\"");
|
|
|
|
WriteAttribute("title", Tuple.Create(" title=\"", 1404), Tuple.Create("\"", 1424)
|
|
|
|
#line 29 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1412), Tuple.Create<System.Object, System.Int32>(ja.Filename
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1412), false)
|
|
);
|
|
|
|
WriteLiteral(">\r\n <img");
|
|
|
|
WriteLiteral(" alt=\"Attachment Thumbnail\"");
|
|
|
|
WriteAttribute("src", Tuple.Create(" src=\"", 1487), Tuple.Create("\"", 1546)
|
|
|
|
#line 30 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1493), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1493), false)
|
|
);
|
|
|
|
WriteLiteral(" /></span>\r\n <span");
|
|
|
|
WriteLiteral(" class=\"comments\"");
|
|
|
|
WriteAttribute("title", Tuple.Create(" title=\"", 1605), Tuple.Create("\"", 1625)
|
|
|
|
#line 31 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1613), Tuple.Create<System.Object, System.Int32>(ja.Comments
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1613), false)
|
|
);
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
if (!string.IsNullOrEmpty(ja.DocumentTemplateId))
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(ja.DocumentTemplate.Description);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
}
|
|
else
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 35 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(ja.Comments);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 35 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
}
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </span><span");
|
|
|
|
WriteLiteral(" class=\"author\"");
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 36 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(ja.TechUser.ToString());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span><span");
|
|
|
|
WriteLiteral(" class=\"remove\"");
|
|
|
|
WriteLiteral("></span><span");
|
|
|
|
WriteLiteral(" class=\"timestamp\"");
|
|
|
|
WriteAttribute("title", Tuple.Create(" title=\"", 1995), Tuple.Create("\"", 2033)
|
|
|
|
#line 36 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 2003), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
|
|
|
|
#line default
|
|
#line hidden
|
|
, 2003), false)
|
|
);
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 36 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(ja.Timestamp.ToFuzzy());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span>\r\n </a> \r\n");
|
|
|
|
|
|
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </div>\r\n <div");
|
|
|
|
WriteLiteral(" class=\"attachmentInput clearfix\"");
|
|
|
|
WriteLiteral(">\r\n <span");
|
|
|
|
WriteLiteral(" class=\"action upload\"");
|
|
|
|
WriteLiteral("></span><span");
|
|
|
|
WriteLiteral(" class=\"action photo\"");
|
|
|
|
WriteLiteral("></span>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n<div");
|
|
|
|
WriteLiteral(" id=\"dialogUpload\"");
|
|
|
|
WriteLiteral(" class=\"hiddenDialog\"");
|
|
|
|
WriteLiteral(" title=\"Upload Attachment\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" id=\"silverlightHostUploadAttachment\"");
|
|
|
|
WriteLiteral(">\r\n </div>\r\n</div>\r\n<div");
|
|
|
|
WriteLiteral(" id=\"dialogRemoveLog\"");
|
|
|
|
WriteLiteral(" class=\"hiddenDialog\"");
|
|
|
|
WriteLiteral(" title=\"Remove this Comment?\"");
|
|
|
|
WriteLiteral(">\r\n <p>\r\n <span");
|
|
|
|
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
|
|
|
|
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
|
|
|
|
WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n</div>\r\n<div");
|
|
|
|
WriteLiteral(" id=\"dialogRemoveAttachment\"");
|
|
|
|
WriteLiteral(" class=\"hiddenDialog\"");
|
|
|
|
WriteLiteral(" title=\"Remove this Attachment?\"");
|
|
|
|
WriteLiteral(">\r\n <p>\r\n <span");
|
|
|
|
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
|
|
|
|
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
|
|
|
|
WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n</div>\r\n<script>\r\n Shadowbox.init({" +
|
|
"\r\n skipSetup: true,\r\n modal: true\r\n });\r\n\r\n\r\n $(function () " +
|
|
"{\r\n var jobId = parseInt(\'");
|
|
|
|
|
|
#line 70 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Model.Job.Id);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"');
|
|
|
|
//#region Comments
|
|
var $Comments = $('#Comments');
|
|
var $CommentOutput = $Comments.find('.commentOutput');
|
|
var $CommentOutputContainer = $Comments.find('.commentOutputContainer');
|
|
var $CommentInput = $Comments.find('textarea.commentInput');
|
|
var $dialogRemoveLog;
|
|
|
|
window.setTimeout(function () {
|
|
$CommentOutput[0].scrollTop = $CommentOutput[0].scrollHeight; // Scroll to Bottom
|
|
}, 0);
|
|
$('#jobDetailTabs').on('tabsactivate', function (event, ui) {
|
|
if (ui.newPanel && ui.newPanel.is('#jobDetailTab-Resources')) {
|
|
$CommentOutput[0].scrollTop = $CommentOutput[0].scrollHeight; // Scroll to Bottom
|
|
}
|
|
});
|
|
|
|
$Comments.find('.commentInputPost').click(postComment);
|
|
$CommentInput.keypress(function (e) {
|
|
if (e.which == 13 && !e.shiftKey) {
|
|
postComment();
|
|
return false;
|
|
}
|
|
});
|
|
$CommentOutput.find('span.remove').click(removePost);
|
|
|
|
function postComment() {
|
|
var comment = $CommentInput.val();
|
|
if (comment != '') {
|
|
var data = { comment: comment }
|
|
$.ajax({
|
|
url: '");
|
|
|
|
|
|
#line 102 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Url.Action(MVC.API.Job.CommentPost(Model.Job.Id, null)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
|
" success: function (d) {\r\n if (d.Result == " +
|
|
"\'OK\') {\r\n // Should be added via Repository Notificat" +
|
|
"ions\r\n // addComment(d.Comment, false);\r\n " +
|
|
" $CommentInput.val(\'\').attr(\'disabled\', false).focus();\r\n " +
|
|
" } else {\r\n alert(\'Unable to post comm" +
|
|
"ent: \' + d.Result);\r\n $CommentInput.attr(\'disabled\', " +
|
|
"false);\r\n }\r\n },\r\n " +
|
|
"error: function (jqXHR, textStatus, errorThrown) {\r\n aler" +
|
|
"t(\'Unable to post comment: \' + textStatus);\r\n $CommentInp" +
|
|
"ut.attr(\'disabled\', false);\r\n }\r\n });\r\n " +
|
|
" }\r\n }\r\n function removePost() {\r\n $this = $(this);" +
|
|
"\r\n var data = { id: $this.closest(\'div\').attr(\'data-logid\') };\r\n\r\n " +
|
|
" if (!$dialogRemoveLog) {\r\n $dialogRemoveLog = $(\'#dialog" +
|
|
"RemoveLog\').dialog({\r\n resizable: false,\r\n " +
|
|
" height: 140,\r\n modal: true,\r\n autoOpen: f" +
|
|
"alse\r\n });\r\n }\r\n\r\n $dialogRemoveLog.dialog(" +
|
|
"\"enable\").dialog(\'option\', \'buttons\', {\r\n \"Remove\": function () {" +
|
|
"\r\n $dialogRemoveLog.dialog(\"disable\");\r\n $" +
|
|
"dialogRemoveLog.dialog(\"option\", \"buttons\", null);\r\n $.ajax({" +
|
|
"\r\n url: \'");
|
|
|
|
|
|
#line 140 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Url.Action(MVC.API.Job.CommentRemove()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"',
|
|
dataType: 'json',
|
|
data: data,
|
|
success: function (d) {
|
|
if (d == 'OK') {
|
|
// Should be removed via Repository Notifications
|
|
//$this.closest('div').slideUp(300).delay(300).queue(function () {
|
|
// $(this).remove();
|
|
//});
|
|
} else {
|
|
alert('Unable to remove comment: ' + d);
|
|
}
|
|
$dialogRemoveLog.dialog(""close"");
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert('Unable to remove comment: ' + textStatus);
|
|
$dialogRemoveLog.dialog(""close"");
|
|
}
|
|
});
|
|
},
|
|
""Cancel"": function () {
|
|
$dialogRemoveLog.dialog(""close"");
|
|
}
|
|
}).dialog('open');
|
|
|
|
return false;
|
|
}
|
|
function loadLiveComment(key) {
|
|
if (key.JobId == jobId) {
|
|
$.ajax({
|
|
url: '");
|
|
|
|
|
|
#line 170 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Url.Action(MVC.API.Job.Comment()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"',
|
|
dataType: 'json',
|
|
data: { id: key.Id },
|
|
success: function (d) {
|
|
if (d && d.JobId == jobId) {
|
|
addComment(d, false);
|
|
}
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert('Unable to load live comment ' + id + ': ' + textStatus);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
function addComment(c, quick) {
|
|
var e = $('<div><span class=""author"" /><span class=""remove"" /><span class=""timestamp"" /><span class=""comment"" /></div>');
|
|
e.attr('data-logid', c.Id);
|
|
e.find('.author').text(c.Author);
|
|
e.find('.timestamp').text(c.TimestampFuzzy).attr('title', c.TimestampFull);
|
|
e.find('.remove').click(removePost);
|
|
var eComment = e.find('.comment').text(c.Comments);
|
|
var commentHtml = eComment.text().replace(/\r\n|\r|\n/g, '<br />');
|
|
commentHtml = commentHtml.replace(/\#(\d+)/g, '<a href=""");
|
|
|
|
|
|
#line 192 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Url.Action(MVC.Job.Show(null)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"?id=$1"">#$1</a>');
|
|
eComment.html(commentHtml);
|
|
|
|
$CommentOutput.append(e);
|
|
|
|
if (!quick) {
|
|
e.animate({ backgroundColor: '#ffff99' }, 500, function () {
|
|
e.animate({ backgroundColor: '#f4f4f4' }, 500);
|
|
});
|
|
$CommentOutput.animate({ scrollTop: $CommentOutput[0].scrollHeight }, 250)
|
|
}
|
|
}
|
|
//#endregion
|
|
|
|
//#region Attachments
|
|
if (!document.DiscoFunctions) {
|
|
document.DiscoFunctions = {};
|
|
}
|
|
// For Silverlight Backwards-compatibility
|
|
// - Repository notifications now handles this
|
|
document.DiscoFunctions.addAttachment = function () { };
|
|
|
|
var $Attachments = $('#Attachments');
|
|
var $attachmentOutput = $Attachments.find('.attachmentOutput');
|
|
var $dialogUpload, $dialogRemoveAttachment;
|
|
|
|
$attachmentOutput.find('span.remove').click(removeLocalAttachment);
|
|
|
|
var onLoadNavigation = null;
|
|
var isLoaded = null;
|
|
Silverlight.createObject(
|
|
'");
|
|
|
|
|
|
#line 223 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap);
|
|
|
|
|
|
#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 235 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"'
|
|
);
|
|
|
|
var $attachmentInput = $Attachments.find('.attachmentInput');
|
|
$attachmentInput.find('.photo').click(function () {
|
|
showDialog('/WebCam');
|
|
});
|
|
$attachmentInput.find('.upload').click(function () {
|
|
showDialog('/File');
|
|
});
|
|
|
|
var silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
|
|
function showDialog(navigationPath) {
|
|
if (!$dialogUpload) {
|
|
$dialogUpload = $('#dialogUpload').dialog({
|
|
autoOpen: false,
|
|
draggable: false,
|
|
modal: true,
|
|
resizable: false,
|
|
width: 860,
|
|
height: 550,
|
|
close: function () {
|
|
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
|
|
}
|
|
});
|
|
}
|
|
$dialogUpload.dialog('open');
|
|
if (isLoaded) {
|
|
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
|
|
} else {
|
|
onLoadNavigation = navigationPath;
|
|
}
|
|
};
|
|
function addAttachment(key, quick) {
|
|
|
|
if (key.JobId == jobId) {
|
|
var data = { id: key.Id };
|
|
|
|
$.ajax({
|
|
url: '");
|
|
|
|
|
|
#line 274 "..\..\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 = $('<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span><span class=""remove""></span><span class=""timestamp""></span></a>');
|
|
|
|
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
|
|
|
|
|
|
#line 284 "..\..\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 285 "..\..\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.TimestampFull);\r\n e.find(\'.remove\').click(remov" +
|
|
"eLocalAttachment);\r\n if (!quick)\r\n " +
|
|
" e.hide();\r\n $attachmentOutpu" +
|
|
"t.append(e);\r\n if (!quick)\r\n " +
|
|
" e.show(\'slow\');\r\n if (a.MimeType.t" +
|
|
"oLowerCase().indexOf(\'image/\') == 0)\r\n e.shad" +
|
|
"owbox({ 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, textStatus, e" +
|
|
"rrorThrown) {\r\n alert(\'Unable to add attachment: \' + text" +
|
|
"Status);\r\n }\r\n });\r\n }\r\n }\r\n" +
|
|
" function removeAttachment(key) {\r\n if (key.JobId == jobId) {\r" +
|
|
"\n var $element = $attachmentOutput.find(\'a[data-attachmentid=\"\' +" +
|
|
" key.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 $elemen" +
|
|
"t.remove();\r\n });\r\n }\r\n }\r\n " +
|
|
"}\r\n\r\n function removeLocalAttachment() {\r\n $this = $(this).clo" +
|
|
"sest(\'a\');\r\n\r\n var data = { id: $this.attr(\'data-attachmentid\') };\r\n\r" +
|
|
"\n if (!$dialogRemoveAttachment) {\r\n $dialogRemoveAttac" +
|
|
"hment = $(\'#dialogRemoveAttachment\').dialog({\r\n resizable: fa" +
|
|
"lse,\r\n height: 140,\r\n modal: true,\r\n " +
|
|
" autoOpen: false\r\n });\r\n }\r\n\r\n " +
|
|
" $dialogRemoveAttachment.dialog(\"enable\").dialog(\'option\', \'buttons\', {\r\n " +
|
|
" \"Remove\": function () {\r\n $dialogRemoveAttachment.di" +
|
|
"alog(\"disable\");\r\n $dialogRemoveAttachment.dialog(\"option\", \"" +
|
|
"buttons\", null);\r\n $.ajax({\r\n url: \'");
|
|
|
|
|
|
#line 340 "..\..\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 }).d" +
|
|
"ialog(\'open\');\r\n\r\n return false;\r\n }\r\n\r\n $attachmentOut" +
|
|
"put.children(\'a\').each(function () {\r\n $this = $(this);\r\n " +
|
|
"if ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
|
" $this.shadowbox({ gallery: \'attachments\', player: \'img\', title: $this.fin" +
|
|
"d(\'.comments\').text() });\r\n });\r\n //#endregion\r\n\r\n //#regio" +
|
|
"n LiveEvents\r\n function liveMessageRecieved(d) {\r\n if (d) {\r\n " +
|
|
" window.setTimeout(function () {\r\n switch (d.En" +
|
|
"tityTypeName) {\r\n case \'JobAttachment\':\r\n " +
|
|
" switch (d.EventType) {\r\n case 0: // A" +
|
|
"dded\r\n addAttachment(d.EntityKey, false);\r\n " +
|
|
" break;\r\n case 1" +
|
|
": // Removed\r\n removeAttachment(d.EntityKey);" +
|
|
"\r\n break;\r\n }\r\n " +
|
|
" break;\r\n case \'JobLog\':\r\n " +
|
|
" switch (d.EventType) {\r\n cas" +
|
|
"e 0: // Added\r\n loadLiveComment(d.EntityKey);" +
|
|
"\r\n break;\r\n ca" +
|
|
"se 1: // Removed\r\n if (d.EntityKey.JobId == j" +
|
|
"obId) {\r\n $CommentOutput.children(\'div[da" +
|
|
"ta-logid=\"\' + d.EntityKey.Id + \'\"]\').slideUp(300).delay(300).queue(function () {" +
|
|
"\r\n $(this).remove();\r\n " +
|
|
" });\r\n }\r\n " +
|
|
" break;\r\n }\r\n " +
|
|
" break;\r\n }\r\n }, 100);\r\n " +
|
|
" }\r\n }\r\n var liveMessagesConnection = $.connection(\'");
|
|
|
|
|
|
#line 411 "..\..\Views\Job\JobParts\Resources.cshtml"
|
|
Write(Url.Content("~/API/Repository/Notifications"));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"', { addToGroups: 'JobLog,JobAttachment' })
|
|
liveMessagesConnection.received(liveMessageRecieved);
|
|
liveMessagesConnection.error(function (e) {
|
|
if (e)
|
|
alert('Error: ' + JSON.stringify(e));
|
|
});
|
|
liveMessagesConnection.start();
|
|
//#endregion
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
");
|
|
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore 1591
|