Files
Disco/Disco.Web/Views/Job/JobParts/Resources.generated.cs
T
2013-11-12 12:21:35 +11:00

1515 lines
51 KiB
C#

#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// 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.Services.Authorization;
using Disco.Services.Web;
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 : Disco.Services.Web.WebViewPage<Disco.Web.Models.Job.ShowModel>
{
public Resources()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Job\JobParts\Resources.cshtml"
Authorization.RequireAny(Claims.Job.ShowLogs, Claims.Job.ShowAttachments);
var canShowLogs = Authorization.Has(Claims.Job.ShowLogs);
var canShowAttachments = Authorization.Has(Claims.Job.ShowAttachments);
var canAddLogs = Authorization.Has(Claims.Job.Actions.AddLogs);
var canRemoveAnyLogs = Authorization.Has(Claims.Job.Actions.RemoveAnyLogs);
var canRemoveOwnLogs = Authorization.Has(Claims.Job.Actions.RemoveOwnLogs);
var canAddAttachments = Authorization.Has(Claims.Job.Actions.AddAttachments);
var canRemoveAnyAttachments = Authorization.Has(Claims.Job.Actions.RemoveAnyAttachments);
var canRemoveOwnAttachments = Authorization.Has(Claims.Job.Actions.RemoveOwnAttachments);
if (canShowAttachments)
{
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");
WriteAttribute("class", Tuple.Create(" class=\"", 1045), Tuple.Create("\"", 1173)
#line 24 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1053), Tuple.Create<System.Object, System.Int32>(canShowLogs ? "canShowLogs" : "cannotShowLogs"
#line default
#line hidden
, 1053), false)
#line 24 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 1102), Tuple.Create<System.Object, System.Int32>(canShowAttachments ? "canShowAttachments" : "cannotShowAttachments"
#line default
#line hidden
, 1103), false)
);
WriteLiteral(">\r\n");
#line 25 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 25 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
#line default
#line hidden
WriteLiteral(" <td");
WriteLiteral(" id=\"Comments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 1244), Tuple.Create("\"", 1298)
#line 27 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1252), Tuple.Create<System.Object, System.Int32>(canAddLogs ? "canAddLogs" : "cannotAddLogs"
#line default
#line hidden
, 1252), false)
);
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"commentOutput\"");
WriteLiteral(">\r\n");
#line 29 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 29 "..\..\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 31 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.TechUser.ToString());
#line default
#line hidden
WriteLiteral("</span>");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.Id))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1812), Tuple.Create("\"", 1850)
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1820), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
#line default
#line hidden
, 1820), false)
);
WriteLiteral(">");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToFuzzy());
#line default
#line hidden
WriteLiteral("</span>\r\n <span");
WriteLiteral(" class=\"comment\"");
WriteLiteral(">");
#line 34 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Comments.ToMultilineJobRefString());
#line default
#line hidden
WriteLiteral("</span>\r\n </div>\r\n");
#line 36 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddLogs)
{
#line default
#line hidden
WriteLiteral(" <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");
#line 44 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n");
#line 46 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 47 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
#line default
#line hidden
WriteLiteral(" <td");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 2482), Tuple.Create("\"", 2557)
#line 49 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2490), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 2490), false)
);
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 51 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 51 "..\..\Views\Job\JobParts\Resources.cshtml"
foreach (var ja in Model.Job.JobAttachments)
{
#line default
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 2725), Tuple.Create("\"", 2782)
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2732), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default
#line hidden
, 2732), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 53 "..\..\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=\"", 2888), Tuple.Create("\"", 2908)
#line 54 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2896), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line default
#line hidden
, 2896), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2975), Tuple.Create("\"", 3034)
#line 55 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2981), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default
#line hidden
, 2981), false)
);
WriteLiteral(" /></span>\r\n <span");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3097), Tuple.Create("\"", 3117)
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3105), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line default
#line hidden
, 3105), false)
);
WriteLiteral(">\r\n");
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 57 "..\..\Views\Job\JobParts\Resources.cshtml"
if (!string.IsNullOrEmpty(ja.DocumentTemplateId))
{
#line default
#line hidden
#line 58 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.DocumentTemplate.Description);
#line default
#line hidden
#line 58 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
#line 60 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Comments);
#line default
#line hidden
#line 60 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </span><span");
WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.TechUser.ToString());
#line default
#line hidden
WriteLiteral("</span>");
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId == CurrentUser.Id))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>");
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3703), Tuple.Create("\"", 3741)
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3711), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line default
#line hidden
, 3711), false)
);
WriteLiteral(">");
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Timestamp.ToFuzzy());
#line default
#line hidden
WriteLiteral("</span>\r\n </a> \r\n");
#line 64 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 66 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 66 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <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");
#line 71 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n");
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n</table>\r\n");
#line 76 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs && (canRemoveAnyLogs || canRemoveOwnLogs))
{
#line default
#line hidden
WriteLiteral(" <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");
#line 84 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 85 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments && canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <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");
#line 91 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 92 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments && (canRemoveAnyAttachments || canRemoveOwnAttachments))
{
#line default
#line hidden
WriteLiteral(" <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");
#line 100 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 101 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n if (!document.DiscoFunctions) {\r\n document.Disco" +
"Functions = {};\r\n }\r\n\r\n $(function () {\r\n var jobId = p" +
"arseInt(\'");
#line 109 "..\..\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');
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
}
});
");
#line 125 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 125 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddLogs)
{
#line default
#line hidden
WriteLiteral(@"
//#region Add Logs
var $CommentInput = $Comments.find('textarea.commentInput');
$Comments.find('.commentInputPost').click(postComment);
$CommentInput.keypress(function (e) {
if (e.which == 13 && !e.shiftKey) {
postComment();
return false;
}
});
function postComment() {
var comment = $CommentInput.val();
if (comment != '') {
var data = { comment: comment }
$.ajax({
url: '");
#line 144 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.CommentPost(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
// Should be added via Repository Notifications
// addComment(d.Comment, false);
$CommentInput.val('').attr('disabled', false).focus();
} else {
alert('Unable to post comment: ' + d.Result);
$CommentInput.attr('disabled', false);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to post comment: ' + textStatus);
$CommentInput.attr('disabled', false);
}
});
}
}
//#endregion
");
#line 166 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 167 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || canRemoveOwnLogs)
{
#line default
#line hidden
WriteLiteral(@"
//#region Remove Logs
var $dialogRemoveLog;
$CommentOutput.find('span.remove').click(removePost);
function removePost() {
$this = $(this);
var data = { id: $this.closest('div').attr('data-logid') };
if (!$dialogRemoveLog) {
$dialogRemoveLog = $('#dialogRemoveLog').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveLog.dialog(""enable"").dialog('option', 'buttons', {
""Remove"": function () {
$dialogRemoveLog.dialog(""disable"");
$dialogRemoveLog.dialog(""option"", ""buttons"", null);
$.ajax({
url: '");
#line 193 "..\..\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;
}
//#endregion
");
#line 222 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n function loadLiveComment(key) {\r\n if (key.JobId == j" +
"obId) {\r\n $.ajax({\r\n url: \'");
#line 227 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Comment()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: { id" +
": key.Id },\r\n success: function (d) {\r\n " +
" if (d && d.JobId == jobId) {\r\n");
#line 232 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 232 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs)
{
#line default
#line hidden
WriteLiteral("addComment(d, false, true);");
#line 233 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canRemoveOwnLogs)
{
#line default
#line hidden
WriteLiteral("addComment(d, false, (d.AuthorId === \'");
#line 235 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.Id);
#line default
#line hidden
WriteLiteral("\'));");
#line 235 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral("addComment(d, false, false);");
#line 237 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@"
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to load live comment ' + id + ': ' + textStatus);
}
});
}
}
function liveRemoveComment(key) {
$CommentOutput.children('div[data-logid=""' + key + '""]').slideUp(300).delay(300).queue(function () {
$(this).remove();
});
}
function addComment(c, quick, canRemove) {
var t = '<div><span class=""author"" />';
if (canRemove)
t += '<span class=""remove"" />';
t += '<span class=""timestamp"" /><span class=""comment"" /></div>';
var e = $(t);
e.attr('data-logid', c.Id);
e.find('.author').text(c.Author);
e.find('.timestamp').text(c.TimestampFuzzy).attr('title', c.TimestampFull);
if (canRemove)
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 266 "..\..\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)
}
}
// Add Globally Available Functions
document.DiscoFunctions.liveLoadComment = loadLiveComment;
document.DiscoFunctions.liveRemoveComment = liveRemoveComment;
//#endregion
});
</script>
");
#line 285 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 286 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
#line default
#line hidden
WriteLiteral(@" <script>
Shadowbox.init({
skipSetup: true,
modal: true
});
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
}
$(function () {
var jobId = parseInt('");
#line 299 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral("\');\r\n\r\n //#region Attachments\r\n var $Attachments = $(\'#Atta" +
"chments\');\r\n var $attachmentOutput = $Attachments.find(\'.attachmentOu" +
"tput\');\r\n\r\n");
#line 305 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 305 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#region Add Attachments
// For Silverlight Backwards-compatibility
// - Repository notifications now handles this
document.DiscoFunctions.addAttachment = function () { };
var $dialogUpload;
var onLoadNavigation = null;
var isLoaded = null;
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) {
Silverlight.createObject(
'");
#line 329 "..\..\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').get(0).content.Navigator.Navigate(onLoadNavigation);
isLoaded = true;
}
}
},
'UploadUrl=");
#line 341 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral(@"'
);
$dialogUpload = $('#dialogUpload').dialog({
autoOpen: false,
draggable: false,
modal: true,
resizable: false,
width: 860,
height: 550,
close: function () {
if (silverlightUploadAttachment && silverlightUploadAttachment.content)
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
}
});
}
$dialogUpload.dialog('open');
if (isLoaded) {
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
} else {
onLoadNavigation = navigationPath;
}
};
//#endregion
");
#line 366 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 368 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 368 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#region Remove Attachments
var $dialogRemoveAttachment;
$attachmentOutput.find('span.remove').click(removeLocalAttachment);
function removeLocalAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveAttachment.dialog(""enable"").dialog('option', 'buttons', {
""Remove"": function () {
$dialogRemoveAttachment.dialog(""disable"");
$dialogRemoveAttachment.dialog(""option"", ""buttons"", null);
$.ajax({
url: '");
#line 395 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n da" +
"ta: data,\r\n success: function (d) {\r\n " +
" if (d == \'OK\') {\r\n // Should " +
"be removed via Repository Notifications\r\n //$" +
"this.hide(300).delay(300).queue(function () {\r\n " +
" // var $this = $(this);\r\n // if ($th" +
"is.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" // Shadowbox.removeCache(this);\r\n " +
" // $this.remove();\r\n //});" +
"\r\n } else {\r\n " +
"alert(\'Unable to remove attachment: \' + d);\r\n }\r\n" +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" },\r\n error: function (jqXHR, te" +
"xtStatus, errorThrown) {\r\n alert(\'Unable to remov" +
"e attachment: \' + textStatus);\r\n $dialogRemoveAtt" +
"achment.dialog(\"close\");\r\n }\r\n " +
" });\r\n },\r\n \"Cancel\": function () {\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" }\r\n }).dialog(\'open\');\r\n\r\n return false;\r\n " +
" }\r\n\r\n //#endregion\r\n\r\n ");
#line 428 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n function addAttachment(key, quick) {\r\n\r\n if (key.Job" +
"Id == jobId) {\r\n var data = { id: key.Id };\r\n\r\n " +
" $.ajax({\r\n url: \'");
#line 436 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Attachment()));
#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 var a = d.Attachment;\r\n" +
"");
#line 442 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 442 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 445 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 448 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.Id);
#line default
#line hidden
WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 449 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 453 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@" } else {
alert('Unable to add attachment: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to add attachment: ' + textStatus);
}
});
}
}
function buildAttachment(a, canRemove, quick) {
if (parseInt(a.ParentId) == jobId) {
var t = '<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span>';
if (canRemove)
t += '<span class=""remove""></span>';
t += '<span class=""timestamp""></span></a>';
var e = $(t);
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 473 "..\..\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 474 "..\..\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(\'.times" +
"tamp\').text(a.TimestampFuzzy).attr(\'title\', a.TimestampFull);\r\n " +
" if (canRemove)\r\n e.find(\'.remove\').click(removeLocalAt" +
"tachment);\r\n if (!quick)\r\n e.hide();\r\n" +
" $attachmentOutput.append(e);\r\n if (!quick" +
")\r\n e.show(\'slow\');\r\n if (a.MimeType.t" +
"oLowerCase().indexOf(\'image/\') == 0)\r\n e.shadowbox({ gall" +
"ery: \'attachments\', player: \'img\', title: a.Comments });\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.len" +
"gth > 0) {\r\n $element.hide(300).delay(300).queue(function" +
" () {\r\n if ($element.attr(\'data-mimetype\').toLowerCas" +
"e().indexOf(\'image/\') == 0)\r\n Shadowbox.removeCac" +
"he(this);\r\n $element.remove();\r\n " +
" });\r\n }\r\n }\r\n }\r\n\r\n\r\n\r\n " +
" $attachmentOutput.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\', pl" +
"ayer: \'img\', title: $this.find(\'.comments\').text() });\r\n });\r\n\r\n " +
" // Add Globally Available Functions\r\n document.DiscoFunctions." +
"liveAddAttachment = addAttachment;\r\n document.DiscoFunctions.liveRemo" +
"veAttachment = removeAttachment;\r\n\r\n //#endregion\r\n });\r\n\r\n\r\n " +
" </script>\r\n");
#line 520 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 521 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs && canShowAttachments)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 525 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n function liveMessageRecieved" +
"(d) {\r\n if (d) {\r\n window.setTimeout(function " +
"() {\r\n switch (d.EntityTypeName) {\r\n " +
" case \'JobAttachment\':\r\n switch (d.EventTyp" +
"e) {\r\n case 0: // Added\r\n " +
" document.DiscoFunctions.liveAddAttachment(d.EntityKey, false" +
");\r\n break;\r\n " +
" case 1: // Removed\r\n document.Dis" +
"coFunctions.liveRemoveAttachment(d.EntityKey);\r\n " +
" break;\r\n }\r\n " +
" break;\r\n case \'JobLog\':\r\n " +
" switch (d.EventType) {\r\n case 0: // Ad" +
"ded\r\n document.DiscoFunctions.liveLoadCom" +
"ment(d.EntityKey);\r\n break;\r\n " +
" case 1: // Removed\r\n " +
" if (d.EntityKey.JobId == jobId) {\r\n " +
" document.DiscoFunctions.liveRemoveComment(d.EntityKey.Id);\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 558 "..\..\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>
");
#line 568 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canShowLogs)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 573 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral(@"');
//#region LiveEvents
function liveMessageRecieved(d) {
if (d) {
window.setTimeout(function () {
switch (d.EventType) {
case 0: // Added
document.DiscoFunctions.liveLoadComment(d.EntityKey);
break;
case 1: // Removed
if (d.EntityKey.JobId == jobId) {
document.DiscoFunctions.liveRemoveComment(d.EntityKey.Id);
}
break;
}
}, 100);
}
}
var liveMessagesConnection = $.connection('");
#line 592 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/API/Repository/Notifications"));
#line default
#line hidden
WriteLiteral(@"', { addToGroups: 'JobLog' })
liveMessagesConnection.received(liveMessageRecieved);
liveMessagesConnection.error(function (e) {
if (e)
alert('Error: ' + JSON.stringify(e));
});
liveMessagesConnection.start();
//#endregion
});
</script>
");
#line 602 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canShowAttachments)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 607 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral(@"');
//#region LiveEvents
function liveMessageRecieved(d) {
if (d) {
window.setTimeout(function () {
switch (d.EventType) {
case 0: // Added
document.DiscoFunctions.liveAddAttachment(d.EntityKey, false);
break;
case 1: // Removed
document.DiscoFunctions.liveRemoveAttachment(d.EntityKey);
break;
}
}, 100);
}
}
var liveMessagesConnection = $.connection('");
#line 624 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/API/Repository/Notifications"));
#line default
#line hidden
WriteLiteral(@"', { addToGroups: 'JobAttachment' })
liveMessagesConnection.received(liveMessageRecieved);
liveMessagesConnection.error(function (e) {
if (e)
alert('Error: ' + JSON.stringify(e));
});
liveMessagesConnection.start();
//#endregion
});
</script>
");
#line 634 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591