// Token: 0x0600008B RID: 139 RVA: 0x000051B0 File Offset: 0x000033B0 public static void RenderAttachmentWell(TextWriter output, AttachmentWellType wellType, ArrayList attachmentList, string itemId, UserContext userContext, AttachmentWell.AttachmentWellFlags flags) { if (output == null) { throw new ArgumentNullException("output"); } if (itemId == null) { throw new ArgumentNullException("itemId"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (wellType == AttachmentWellType.ReadOnly && AttachmentUtility.IsLevelOneAndBlockOnly(attachmentList)) { return; } output.Write("<div id=\"divAtt\" class=\"aw\">"); AttachmentWell.RenderAttachments(output, wellType, attachmentList, itemId, userContext, flags); output.Write("</div>"); }
private static void RenderAttachments(TextWriter output, AttachmentWellType wellType, ArrayList attachmentList, string itemId, UserContext userContext, AttachmentWell.AttachmentWellFlags flags) { if (attachmentList == null) { return; } int count = attachmentList.Count; if (count <= 0) { return; } if (Utilities.GetEmbeddedDepth(HttpContext.Current.Request) >= AttachmentPolicy.MaxEmbeddedDepth) { flags |= AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth; } ArrayList previousAttachmentDisplayNames = new ArrayList(); bool prependSemicolon = false; foreach (object obj in attachmentList) { AttachmentWellInfo attachmentWellInfo = (AttachmentWellInfo)obj; AttachmentUtility.AttachmentLinkFlags attachmentLinkFlag = AttachmentUtility.GetAttachmentLinkFlag(wellType, attachmentWellInfo); if (AttachmentUtility.AttachmentLinkFlags.Skip != (AttachmentUtility.AttachmentLinkFlags.Skip & attachmentLinkFlag) && (!attachmentWellInfo.IsInline || (flags & AttachmentWell.AttachmentWellFlags.RenderInLine) == AttachmentWell.AttachmentWellFlags.RenderInLine) && ((flags & AttachmentWell.AttachmentWellFlags.RenderInLine) == AttachmentWell.AttachmentWellFlags.RenderInLine || (!attachmentWellInfo.IsInline && attachmentWellInfo.AttachmentType != AttachmentType.Ole))) { Item item = null; ItemAttachment itemAttachment = null; try { if (attachmentWellInfo.AttachmentType == AttachmentType.EmbeddedMessage) { itemAttachment = (ItemAttachment)attachmentWellInfo.OpenAttachment(); item = itemAttachment.GetItemAsReadOnly(null); } if (item != null) { AttachmentWell.RenderAttachmentLinkForItem(output, attachmentWellInfo, item, itemId, userContext, previousAttachmentDisplayNames, flags, prependSemicolon); } else { AttachmentWell.RenderAttachmentLink(output, wellType, attachmentWellInfo, itemId, userContext, previousAttachmentDisplayNames, flags | AttachmentWell.AttachmentWellFlags.RenderAttachmentSize, prependSemicolon); } prependSemicolon = true; } catch (ObjectNotFoundException) { } finally { if (item != null) { item.Dispose(); item = null; } if (itemAttachment != null) { itemAttachment.Dispose(); itemAttachment = null; } } } } }
internal static ArrayList GetAttachmentInformation(Item item, IList <AttachmentLink> attachmentLinks, bool isLoggedOnFromPublicComputer) { return(AttachmentWell.GetAttachmentInformation(item, attachmentLinks, isLoggedOnFromPublicComputer, false)); }
public static string RenderEmbeddedQueryString(string parentItemId) { return(AttachmentWell.RenderEmbeddedUrl(parentItemId, true)); }
public static string RenderEmbeddedUrl(string parentItemId) { return(AttachmentWell.RenderEmbeddedUrl(parentItemId, false)); }
internal static void RenderAttachmentLink(TextWriter output, AttachmentWellType wellType, AttachmentWellInfo attachmentInfoObject, string itemId, UserContext userContext, ArrayList previousAttachmentDisplayNames, AttachmentWell.AttachmentWellFlags flags, bool prependSemicolon = false) { if (output == null) { throw new ArgumentNullException("output"); } if (attachmentInfoObject == null) { throw new ArgumentNullException("attachmentInfoObject"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (string.IsNullOrEmpty(itemId)) { throw new ArgumentException("itemId may not be null or empty string"); } SanitizedHtmlString value = null; string fileExtension = string.Empty; SanitizedHtmlString sanitizedHtmlString = null; AttachmentUtility.AttachmentLinkFlags attachmentLinkFlag = AttachmentUtility.GetAttachmentLinkFlag(wellType, attachmentInfoObject); if ((flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) != (AttachmentWell.AttachmentWellFlags) 0) { string format = "<a id=\"{0}\" href=\"#\" onclick=\"{1}\" title=\"{2}\">{3}"; string text = AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false); value = SanitizedHtmlString.Format(format, new object[] { "lnkAtmt", "return alert(L_ErrRchMxEmbDpth)", attachmentInfoObject.AttachmentName, text }); } else { string format2 = "<a id=\"{0}\" href=\"attachment.ashx?attach=1&{1}\" target=_blank onclick=\"{2}\" title=\"{3}\">{4}"; SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>(); if (AttachmentWell.AttachmentWellFlags.RenderEmbeddedAttachment != (flags & AttachmentWell.AttachmentWellFlags.RenderEmbeddedAttachment)) { sanitizingStringBuilder.Append("id="); sanitizingStringBuilder.Append(Utilities.UrlEncode(itemId)); sanitizingStringBuilder.Append("&attid0="); sanitizingStringBuilder.Append(Utilities.UrlEncode(attachmentInfoObject.AttachmentId.ToBase64String())); sanitizingStringBuilder.Append("&attcnt=1"); } else { sanitizingStringBuilder.Append(AttachmentWell.RenderEmbeddedQueryString(itemId)); sanitizingStringBuilder.Append(Utilities.UrlEncode(attachmentInfoObject.AttachmentId.ToBase64String())); } sanitizedHtmlString = sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>(); if (attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.ForceSave) { string text2 = AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false); value = SanitizedHtmlString.Format(format2, new object[] { "lnkAtmt", sanitizedHtmlString, "return onClkAtmt(2)", attachmentInfoObject.AttachmentName, text2 }); } if (attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.Allow) { string text3 = AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false); value = SanitizedHtmlString.Format(format2, new object[] { "lnkAtmt", sanitizedHtmlString, "return onClkAtmt(3)", attachmentInfoObject.AttachmentName, text3 }); } } if (prependSemicolon) { output.Write("; "); } output.Write("<span id=\"spnAtmt\" tabindex=\"-1\" level=\""); output.Write((int)attachmentInfoObject.AttachmentLevel); if (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink != (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink & attachmentLinkFlag) && (flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) == (AttachmentWell.AttachmentWellFlags) 0) { output.Write("\" class=\"dsbl"); } output.Write("\">"); output.Write("<img class=\"sI\" src=\""); if (attachmentInfoObject.FileExtension != null) { fileExtension = attachmentInfoObject.FileExtension; } SmallIconManager.RenderFileIconUrl(output, userContext, fileExtension); output.Write("\" alt=\"\">"); if (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink == (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink & attachmentLinkFlag) || (flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) != (AttachmentWell.AttachmentWellFlags) 0) { output.Write(value); } else { Utilities.SanitizeHtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false), output); } if (AttachmentWell.AttachmentWellFlags.RenderAttachmentSize == (flags & AttachmentWell.AttachmentWellFlags.RenderAttachmentSize)) { long size = attachmentInfoObject.Size; if (size > 0L) { output.Write(userContext.DirectionMark); output.Write(" "); output.Write(SanitizedHtmlString.FromStringId(6409762)); Utilities.RenderSizeWithUnits(output, size, true); output.Write(userContext.DirectionMark); output.Write(SanitizedHtmlString.FromStringId(-1023695022)); } } output.Write("</a>"); if (AttachmentUtility.AttachmentLinkFlags.OpenAsWebPageLink == (AttachmentUtility.AttachmentLinkFlags.OpenAsWebPageLink & attachmentLinkFlag)) { output.Write("<span class=\"wvsn\">[<a id=\"wvLnk\" href=\"#\" onclick=\""); output.Write("opnWin('WebReadyView.aspx?t=att&"); output.Write(sanitizedHtmlString); output.Write("')\">"); output.Write(SanitizedHtmlString.FromStringId(1547877601)); output.Write("</a>]</span>"); } output.Write("</span>"); }
public static void RenderAttachmentWell(TextWriter output, AttachmentWellType wellType, ArrayList attachmentList, string itemId, UserContext userContext) { AttachmentWell.RenderAttachmentWell(output, wellType, attachmentList, itemId, userContext, AttachmentWell.AttachmentWellFlags.None); }