Permissions & Authorization for Users #24

Initial Release; Includes Database and MVC refactoring
This commit is contained in:
Gary Sharp
2013-10-10 19:13:16 +11:00
parent 172ce5524a
commit a099d68915
458 changed files with 40221 additions and 12130 deletions
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Views.User.UserParts
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/User/UserParts/_Resources.cshtml")]
public partial class Resources : System.Web.Mvc.WebViewPage<Disco.Web.Models.User.ShowModel>
public partial class Resources : Disco.Services.Web.WebViewPage<Disco.Web.Models.User.ShowModel>
{
public Resources()
{
@@ -43,9 +45,19 @@ namespace Disco.Web.Views.User.UserParts
#line 2 "..\..\Views\User\UserParts\_Resources.cshtml"
Authorization.Require(Claims.User.ShowAttachments);
var canAddAttachments = Authorization.Has(Claims.User.Actions.AddAttachments);
var canRemoveAnyAttachments = Authorization.Has(Claims.User.Actions.RemoveAnyAttachments);
var canRemoveOwnAttachments = Authorization.Has(Claims.User.Actions.RemoveOwnAttachments);
Html.BundleDeferred("~/Style/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
if (Authorization.Has(Claims.User.Actions.AddAttachments))
{
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
}
#line default
@@ -64,6 +76,16 @@ WriteLiteral(">\r\n <tr>\r\n <td");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 778), Tuple.Create("\"", 853)
#line 20 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 786), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 786), false)
);
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"attachmentOutput\"");
@@ -71,13 +93,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 12 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 12 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
if (Model.User.UserAttachments != null)
{
foreach (var ua in Model.User.UserAttachments)
@@ -88,20 +110,20 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 618), Tuple.Create("\"", 676)
WriteAttribute("href", Tuple.Create(" href=\"", 1115), Tuple.Create("\"", 1173)
#line 16 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 625), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line 26 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1122), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line default
#line hidden
, 625), false)
, 1122), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 16 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 26 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Id);
@@ -112,7 +134,7 @@ WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 16 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 26 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.MimeType);
@@ -124,68 +146,68 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 782), Tuple.Create("\"", 802)
WriteAttribute("title", Tuple.Create(" title=\"", 1279), Tuple.Create("\"", 1299)
#line 17 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 790), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1287), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line default
#line hidden
, 790), false)
, 1287), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 869), Tuple.Create("\"", 929)
WriteAttribute("src", Tuple.Create(" src=\"", 1366), Tuple.Create("\"", 1426)
#line 18 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 875), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line 28 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1372), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line default
#line hidden
, 875), false)
, 1372), false)
);
WriteLiteral(" /></span>\r\n <span");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 992), Tuple.Create("\"", 1012)
WriteAttribute("title", Tuple.Create(" title=\"", 1489), Tuple.Create("\"", 1509)
#line 19 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1000), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line 29 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1497), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line default
#line hidden
, 1000), false)
, 1497), false)
);
WriteLiteral(">\r\n");
#line 20 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 20 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
if (!string.IsNullOrEmpty(ua.DocumentTemplateId))
{
#line default
#line hidden
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.DocumentTemplate.Description);
#line default
#line hidden
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
@@ -193,14 +215,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 23 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 33 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Comments);
#line default
#line hidden
#line 23 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 33 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
@@ -212,35 +234,52 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 24 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.TechUser.ToString());
#line default
#line hidden
WriteLiteral("</span><span");
WriteLiteral("</span>");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>\r\n <span");
WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1432), Tuple.Create("\"", 1470)
#line 25 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1440), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ua.TechUserId == CurrentUser.Id))
{
#line default
#line hidden
, 1440), false)
WriteLiteral("<span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>");
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2095), Tuple.Create("\"", 2133)
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2103), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line default
#line hidden
, 2103), false)
);
WriteLiteral(">");
#line 25 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToFuzzy());
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToFuzzy());
#line default
@@ -248,18 +287,34 @@ WriteLiteral(">");
WriteLiteral("</span>\r\n </a> \r\n");
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 37 "..\..\Views\User\UserParts\_Resources.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </div>\r\n <div");
WriteLiteral(" </div>\r\n");
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"action upload\"");
@@ -267,34 +322,69 @@ WriteLiteral("></span><span");
WriteLiteral(" class=\"action photo\"");
WriteLiteral("></span>\r\n </div>\r\n <script");
WriteLiteral("></span>\r\n </div>\r\n");
#line 45 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n Shadowbox.init({\r\n skipSetup: true," +
"\r\n modal: true\r\n });\r\n " +
" $(function () {\r\n if (!document.DiscoFunctions) {\r\n " +
" document.DiscoFunctions = {};\r\n " +
" }\r\n document.DiscoFunctions.addAttachment = addAttachmen" +
"t;\r\n\r\n $Attachments = $(\'#Attachments\');\r\n " +
" $attachmentOutput = $Attachments.find(\'.attachmentOutput\');\r\n\r\n " +
" $attachmentOutput.find(\'span.remove\').click(removeAttachment);\r\n" +
"\r\n $(\'#dialogUpload\').dialog({\r\n " +
" autoOpen: false,\r\n draggable: false,\r\n " +
" modal: true,\r\n resizable: false,\r\n " +
" width: 860,\r\n height: 550,\r\n" +
" close: function () {\r\n " +
" silverlightUploadAttachment.content.Navigator.Navigate(\'/Hidden\');\r\n " +
" }\r\n });\r\n\r\n $(\'#" +
"dialogRemoveAttachment\').dialog({\r\n resizable: false," +
"\r\n height: 140,\r\n modal: t" +
"rue,\r\n autoOpen: false\r\n });\r\n" +
"\r\n var onLoadNavigation = null;\r\n " +
"var isLoaded = null;\r\n Silverlight.createObject(\r\n " +
" \'");
WriteLiteral(@">
Shadowbox.init({
skipSetup: true,
modal: true
});
$(function () {
$Attachments = $('#Attachments');
$attachmentOutput = $Attachments.find('.attachmentOutput');
");
#line 71 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 55 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 55 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#region Add Attachments
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
}
document.DiscoFunctions.addAttachment = addAttachment;
$('#dialogUpload').dialog({
autoOpen: false,
draggable: false,
modal: true,
resizable: false,
width: 860,
height: 550,
close: function () {
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
}
});
var onLoadNavigation = null;
var isLoaded = null;
Silverlight.createObject(
'");
#line 78 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap);
@@ -315,7 +405,7 @@ WriteLiteral(@"',
'UploadUrl=");
#line 83 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 90 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.Id, null)));
@@ -324,151 +414,330 @@ WriteLiteral(@"',
WriteLiteral(@"'
);
$attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
showDialog('/WebCam');
});
$attachmentInput.find('.upload').click(function () {
showDialog('/File');
});
$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: '");
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 106 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment()));
#line 113 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
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', '");
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
");
#line 115 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
#line 119 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 119 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments)
{
#line default
#line hidden
WriteLiteral("buildAttachment(a, true);");
#line 120 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 122 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(CurrentUser.Id);
#line default
#line hidden
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', " +
"\'");
WriteLiteral("\'));");
#line 116 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
#line 122 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral("buildAttachment(a, false);");
#line 124 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.Comme" +
"nts);\r\n e.find(\'.author\').text(a.Author);\r\n " +
" e.find(\'.timestamp\').text(a.TimestampFuzzy).at" +
"tr(\'title\', a.TimestampFull);\r\n e.find(\'.remo" +
"ve\').click(removeAttachment);\r\n if (!quick)\r\n" +
" e.hide();\r\n " +
" $attachmentOutput.append(e);\r\n if (!qu" +
"ick)\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 } else {\r\n " +
" alert(\'Unable to add attachment: \' + d.Result);\r\n " +
" }\r\n },\r\n " +
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to add attachment: \' + textStatus);\r\n " +
" }\r\n });\r\n }\r\n " +
" function removeAttachment() {\r\n $this = $(this)." +
"closest(\'a\');\r\n\r\n var data = { id: $this.attr(\'data-attac" +
"hmentid\') };\r\n var $dialogRemoveAttachment = $(\'#dialogRe" +
"moveAttachment\');\r\n $dialogRemoveAttachment.dialog(\"enabl" +
"e\");\r\n $dialogRemoveAttachment.dialog(\'option\', \'buttons\'" +
", {\r\n \"Remove\": function () {\r\n " +
" $dialogRemoveAttachment.dialog(\"disable\");\r\n " +
" $dialogRemoveAttachment.dialog(\"option\", \"buttons\", null);\r\n " +
" $.ajax({\r\n url: \'");
WriteLiteral(@"
} else {
alert('Unable to add attachment: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to add attachment: ' + textStatus);
}
});
}
function buildAttachment(a, canRemove) {
var t = '<a><span");
WriteLiteral(" class=\"icon\"");
WriteLiteral("><img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteLiteral(" /></span><span");
WriteLiteral(" class=\"comments\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"author\"");
WriteLiteral("></span>\';\r\n if (canRemove)\r\n " +
" t += \'<span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>\';\r\n t += \'<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r\n\r\n " +
" e.attr(\'data-attachmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).at" +
"tr(\'href\', \'");
#line 148 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
#line 143 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
#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 " +
" $this.hide(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n " +
" if ($this.attr(\'data-mimetype\').toLowerCase(" +
").indexOf(\'image/\') == 0)\r\n S" +
"hadowbox.removeCache(this);\r\n $th" +
"is.remove();\r\n });\r\n " +
" } else {\r\n ale" +
"rt(\'Unable to remove attachment: \' + d);\r\n " +
" }\r\n $dialogRemoveAttachment.dialog(\"clo" +
"se\");\r\n },\r\n " +
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to remove attachment: \' + textStatus);\r\n " +
" $dialogRemoveAttachment.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 $dialogRem" +
"oveAttachment.dialog(\'open\');\r\n\r\n return false;\r\n " +
" }\r\n $attachmentOutput.children(\'a\').each(function" +
" () {\r\n $this = $(this);\r\n if ($th" +
"is.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" $this.shadowbox({ gallery: \'attachments\', player: \'img\', title: $thi" +
"s.find(\'.comments\').text() });\r\n });\r\n });\r\n " +
" </script>\r\n </td>\r\n </tr>\r\n </table>\r\n <di" +
"v");
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
#line 144 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
#line default
#line hidden
WriteLiteral(@"/' + a.Id);
e.find('.comments').text(a.Comments);
e.find('.author').text(a.Author);
e.find('.timestamp').text(a.TimestampFuzzy).attr('title', a.TimestampFull);
if (canRemove)
e.find('.remove').click(removeAttachment);
if (!quick)
e.hide();
$attachmentOutput.append(e);
if (!quick)
e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Comments });
}
//#endregion
");
#line 160 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 161 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#region Remove Attachments
$attachmentOutput.find('span.remove').click(removeAttachment);
$('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
function removeAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
var $dialogRemoveAttachment = $('#dialogRemoveAttachment');
$dialogRemoveAttachment.dialog(""enable"");
$dialogRemoveAttachment.dialog('option', 'buttons', {
""Remove"": function () {
$dialogRemoveAttachment.dialog(""disable"");
$dialogRemoveAttachment.dialog(""option"", ""buttons"", null);
$.ajax({
url: '");
#line 185 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
" data: data,\r\n succe" +
"ss: function (d) {\r\n if (d == \'OK\') {" +
"\r\n $this.hide(300).delay(300).que" +
"ue(function () {\r\n var $this " +
"= $(this);\r\n if ($this.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: functi" +
"on (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to remove attachment: \' + textStatus);\r\n " +
" $dialogRemoveAttachment.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 false;\r\n }\r\n\r\n //#endr" +
"egion\r\n ");
#line 218 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@"
$attachmentOutput.children('a').each(function () {
$this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
});
});
</script>
</td>
</tr>
</table>
");
#line 230 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 230 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogUpload\"");
WriteLiteral(" title=\"Upload Attachment\"");
WriteLiteral(">\r\n <div");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"silverlightHostUploadAttachment\"");
WriteLiteral(">\r\n </div>\r\n </div>\r\n <div");
WriteLiteral(">\r\n </div>\r\n </div>\r\n");
#line 236 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 237 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogRemoveAttachment\"");
WriteLiteral(" title=\"Remove this Attachment?\"");
WriteLiteral(">\r\n <p>\r\n <span");
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 " +
" $(\'#UserDetailTabItems\').append(\'<li><a href=\"#UserDetailTab-Resources\" id=\"" +
"UserDetailTab-ResourcesLink\">Attachments [");
WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n </div>\r\n");
#line 200 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 245 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script>\r\n $(\'#UserDetailTabItems\').append(\'<li><a href=\"#UserDetailTa" +
"b-Resources\" id=\"UserDetailTab-ResourcesLink\">Attachments [");
#line 247 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);