Files
Disco/Disco.Web/Views/Job/JobParts/Resources.generated.cs
T
Gary Sharp a0e18ef963 SignalR Bug Fixes & Minor UI Changes
Document Template import status and Device Enrolment status fixes.
Attachment download fixes for SignalR foreverFrame transport. Database
queries for Devices, Jobs and Users updated. Device attributes (model,
profile, batch) now shown in various places.
2014-06-03 12:36:48 +10:00

1466 lines
49 KiB
C#

#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// 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;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services;
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.ToStringFriendly());
#line default
#line hidden
WriteLiteral("</span>");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.UserId))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1889), Tuple.Create("\"", 1927)
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1897), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
#line default
#line hidden
, 1897), false)
);
WriteLiteral(">");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToFullDateTime());
#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(" placeholder=\"write comment...\"");
WriteLiteral(" accesskey=\"l\"");
WriteLiteral("></textarea>\r\n <span");
WriteLiteral(" class=\"action post commentInputPost fa fa-comment\"");
WriteLiteral(" title=\"Post Comment\"");
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=\"", 2632), Tuple.Create("\"", 2707)
#line 49 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2640), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 2640), 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=\"", 2875), Tuple.Create("\"", 2932)
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2882), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default
#line hidden
, 2882), 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=\"", 3038), Tuple.Create("\"", 3058)
#line 54 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3046), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line default
#line hidden
, 3046), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 3125), Tuple.Create("\"", 3184)
#line 55 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3131), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default
#line hidden
, 3131), false)
);
WriteLiteral(" /></span>\r\n <span");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3247), Tuple.Create("\"", 3267)
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3255), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line default
#line hidden
, 3255), 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.ToStringFriendly());
#line default
#line hidden
WriteLiteral("</span>");
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId == CurrentUser.UserId))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3930), Tuple.Create("\"", 3968)
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3938), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line default
#line hidden
, 3938), false)
);
WriteLiteral(">");
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Timestamp.ToFullDateTime());
#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 fa fa-upload\"");
WriteLiteral(" title=\"Attach File\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"action photo fa fa-camera\"");
WriteLiteral(" title=\"Capture Image\"");
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=\"dialog\"");
WriteLiteral(" title=\"Remove this Comment?\"");
WriteLiteral(">\r\n <p>\r\n <i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 83 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 84 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments && canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogUpload\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Upload Attachment\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"silverlightHostUploadAttachment\"");
WriteLiteral(">\r\n </div>\r\n </div>\r\n");
#line 90 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 91 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments && (canRemoveAnyAttachments || canRemoveOwnAttachments))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogRemoveAttachment\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Remove this Attachment?\"");
WriteLiteral(">\r\n <p>\r\n <i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 98 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 99 "..\..\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 107 "..\..\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 123 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 123 "..\..\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 142 "..\..\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 164 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 165 "..\..\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 191 "..\..\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 220 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n function loadLiveComment(key) {\r\n $.ajax({\r\n " +
" url: \'");
#line 224 "..\..\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 },\r\n success: function (d) {\r\n " +
" if (d && d.JobId == jobId) {\r\n");
#line 229 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 229 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs)
{
#line default
#line hidden
WriteLiteral("addComment(d, false, true);");
#line 230 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canRemoveOwnLogs)
{
#line default
#line hidden
WriteLiteral("addComment(d, false, (d.AuthorId === \'");
#line 232 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\'));");
#line 232 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral("addComment(d, false, false);");
#line 234 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n }\r\n },\r\n " +
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to load live comment \' + id + \': \' + textStatus);\r\n " +
" }\r\n });\r\n }\r\n function" +
" liveRemoveComment(key) {\r\n $CommentOutput.children(\'div[data-log" +
"id=\"\' + key + \'\"]\').slideUp(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n $this.find(\'.timestamp\').livestam" +
"p(\'destroy\');\r\n $this.remove();\r\n });\r\n " +
" }\r\n function addComment(c, quick, canRemove) {\r\n " +
"var t = \'<div><span class=\"author\" />\';\r\n if (canRemove)\r\n " +
" t += \'<span class=\"remove fa fa-times-circle\" />\';\r\n " +
" t += \'<span class=\"timestamp\" /><span class=\"comment\" /></div>\';\r\n\r\n " +
" var e = $(t);\r\n e.attr(\'data-logid\', c.Id);\r\n " +
" e.find(\'.author\').text(c.Author);\r\n e.find(\'.timestamp\').text(c." +
"TimestampFull).attr(\'title\', c.TimestampFull).livestamp(c.TimestampUnixEpoc);\r\n " +
" if (canRemove)\r\n e.find(\'.remove\').click(remov" +
"ePost);\r\n var eComment = e.find(\'.comment\').text(c.Comments);\r\n " +
" var commentHtml = eComment.text().replace(/\\r\\n|\\r|\\n/g, \'<br />\')" +
";\r\n commentHtml = commentHtml.replace(/\\#(\\d+)/g, \'<a href=\"");
#line 264 "..\..\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: '#fafafa' }, 500, function () {
e.css('background-color', '');
});
});
$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');
});
function showDialog(navigationPath) {
if (!$dialogUpload) {
Silverlight.createObject(
'");
#line 328 "..\..\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 340 "..\..\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 () {
var sl = $('#silverlightUploadAttachment').get(0);
if (sl.content)
sl.content.Navigator.Navigate('/Hidden');
}
});
}
$dialogUpload.dialog('open');
if (isLoaded) {
$('#silverlightUploadAttachment').get(0).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(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
// Should be removed via Repository Notifications
} else {
alert('Unable to remove attachment: ' + d);
}
$dialogRemoveAttachment.dialog(""close"");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove attachment: ' + textStatus);
$dialogRemoveAttachment.dialog(""close"");
}
});
},
""Cancel"": function () {
$dialogRemoveAttachment.dialog(""close"");
}
}).dialog('open');
return false;
}
//#endregion
");
#line 422 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n function addAttachment(key, quick) {\r\n var data = { " +
"id: key };\r\n $.ajax({\r\n url: \'");
#line 427 "..\..\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 433 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 433 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 436 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 439 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 440 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 444 "..\..\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 fa fa-times-circle""></span>';
t += '<span class=""timestamp""></span></a>';
var e = $(t);
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 463 "..\..\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 464 "..\..\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.Description);\r\n " +
" e.find(\'.author\').text(a.Author);\r\n e.find(\'.ti" +
"mestamp\').text(a.TimestampFull).attr(\'title\', a.TimestampFull).livestamp(a.Times" +
"tampUnixEpoc);\r\n if (canRemove)\r\n e.fi" +
"nd(\'.remove\').click(removeLocalAttachment);\r\n if (!quick)\r\n " +
" e.hide();\r\n $attachmentOutput.append(e)" +
";\r\n document.DiscoFunctions.liveAfterUpdate();\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.Description });\r\n " +
" else\r\n e.click(onDownload);\r\n " +
" }\r\n }\r\n\r\n function onDownload() {\r\n v" +
"ar $this = $(this);\r\n var url = $this.attr(\'href\');\r\n\r\n " +
" if ($.connection && $.connection.hub && $.connection.hub.transport &&\r\n " +
" $.connection.hub.transport.name == \'foreverFram" +
"e\') {\r\n // SignalR active with foreverFrame transport - use p" +
"opup window\r\n window.open(url, \'_blank\', \'height=150,width=25" +
"0,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no\');\r\n " +
" } else {\r\n // use iFrame\r\n if" +
" (!$attachmentDownloadHost) {\r\n $attachmentDownloadHost =" +
" $(\'<iframe>\')\r\n .attr({ \'src\': url, \'title\': \'Attach" +
"ment Download Host\' })\r\n .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n .contents();" +
"\r\n } else {\r\n $attachmentDownloadHost[" +
"0].location.href = url;\r\n }\r\n }\r\n\r\n " +
" return false;\r\n }\r\n\r\n function removeAttachment(key) " +
"{\r\n var $element = $attachmentOutput.find(\'a[data-attachmentid=\"\'" +
" + key + \'\"]\');\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" +
".remove();\r\n document.DiscoFunctions.liveAfterUpdate();\r\n" +
" });\r\n }\r\n }\r\n\r\n $attach" +
"mentOutput.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.find(\'.comments\').text() });\r\n else\r\n " +
" $this.click(onDownload);\r\n });\r\n\r\n // Add Globally" +
" Available Functions\r\n document.DiscoFunctions.liveAddAttachment = ad" +
"dAttachment;\r\n document.DiscoFunctions.liveRemoveAttachment = removeA" +
"ttachment;\r\n\r\n //#endregion\r\n });\r\n\r\n\r\n </script>\r\n");
#line 536 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 537 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs || canShowAttachments)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 541 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n var hub = $.connection.jobUp" +
"dates;\r\n\r\n // Map Functions\r\n");
#line 547 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
#line default
#line hidden
WriteLiteral("\r\n hub.client.addLog = document.DiscoFunctions.liveLoadComment;\r\n " +
" hub.client.removeLog = document.DiscoFunctions.liveRemoveComment;\r\n " +
" ");
#line 551 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 552 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
#line default
#line hidden
WriteLiteral(@"
hub.client.addAttachment = document.DiscoFunctions.liveAddAttachment;
hub.client.removeAttachment = document.DiscoFunctions.liveRemoveAttachment;
document.DiscoFunctions.liveAfterUpdate = function () {
var tabLink = $('#jobDetailTab-ResourcesLink');
var attachmentCount = $('#Attachments').find('.attachmentOutput').children('a').length;
var tabHeading = tabLink.text();
tabHeading = tabHeading.substr(0, tabHeading.indexOf('[') + 1) + attachmentCount + ']';
tabLink.text(tabHeading);
}
");
#line 565 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@"
$.connection.hub.qs = { JobId: jobId };
$.connection.hub.error(onHubError);
// Start Connection
$.connection.hub.start().fail(onHubError);
function onHubError(error) {
alert('Live-update Error: ' + error);
}
//#endregion
});
</script>
");
#line 580 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591