Exemplo n.º 1
0
        private static void RenderIconForItem(Item item, TextWriter writer, UserContext userContext)
        {
            int  iconFlag     = -1;
            bool isInConflict = false;
            bool isRead       = false;

            if (item is MessageItem)
            {
                iconFlag     = ItemUtility.GetProperty <int>(item, ItemSchema.IconIndex, -1);
                isInConflict = ItemUtility.GetProperty <bool>(item, MessageItemSchema.MessageInConflict, false);
                isRead       = ItemUtility.GetProperty <bool>(item, MessageItemSchema.IsRead, false);
            }
            writer.Write("<img class=\"sI\" alt=\"\" src=\"");
            SmallIconManager.RenderItemIconUrl(writer, userContext, item.ClassName, null, isInConflict, isRead, iconFlag);
            writer.Write("\">");
        }
Exemplo n.º 2
0
        internal static void RenderAttachmentLinkForItem(TextWriter output, AttachmentWellInfo attachmentInfoObject, Item item, 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 (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            SanitizedHtmlString value;
            bool flag;

            if ((attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.ForceSave || attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.Allow) && AttachmentWell.AttachmentWellFlags.RenderEmbeddedItem == (flags & AttachmentWell.AttachmentWellFlags.RenderEmbeddedItem))
            {
                string format = string.Empty;
                if (attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.Allow)
                {
                    format = "<a id=\"{0}\" href=\"#\" onclick=\"{1}\" title=\"{2}\" oncontextmenu=\"return false;\">{3}</a>";
                }
                else
                {
                    format = "<a id=\"{0}\" href=\"#\" onclick=\"{1}\" title=\"{2}\">{3}</a>";
                }
                SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>();
                sanitizingStringBuilder.Append("?ae=Item&t=");
                sanitizingStringBuilder.Append(Utilities.UrlEncode(item.ClassName));
                sanitizingStringBuilder.Append("&atttyp=embdd");
                if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(item.ClassName))
                {
                    sanitizingStringBuilder.Append("&a=Read");
                }
                SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder2 = new SanitizingStringBuilder <OwaHtml>();
                if ((flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) == (AttachmentWell.AttachmentWellFlags) 0)
                {
                    sanitizingStringBuilder2.Append("return onClkEmbItem('");
                    sanitizingStringBuilder2.Append <SanitizedHtmlString>(sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>());
                    sanitizingStringBuilder2.Append("','");
                    sanitizingStringBuilder2.Append(Utilities.UrlEncode(attachmentInfoObject.AttachmentId.ToBase64String()));
                    sanitizingStringBuilder2.Append("');");
                }
                else
                {
                    sanitizingStringBuilder2.Append("return alert(L_ErrRchMxEmbDpth)");
                }
                string embeddedAttachmentDisplayName = AttachmentUtility.GetEmbeddedAttachmentDisplayName(item);
                value = SanitizedHtmlString.Format(format, new object[]
                {
                    "lnkAtmt",
                    sanitizingStringBuilder2.ToSanitizedString <SanitizedHtmlString>(),
                    embeddedAttachmentDisplayName,
                    AttachmentUtility.TrimAttachmentDisplayName(embeddedAttachmentDisplayName, previousAttachmentDisplayNames, true)
                });
                flag = false;
            }
            else
            {
                value = Utilities.SanitizeHtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(AttachmentUtility.GetEmbeddedAttachmentDisplayName(item), previousAttachmentDisplayNames, true));
                flag  = true;
            }
            if (prependSemicolon)
            {
                output.Write("; ");
            }
            output.Write("<span id=\"spnAtmt\" tabindex=\"-1\" level=\"3\"");
            if (flag)
            {
                output.Write(" class=\"dsbl\"");
            }
            output.Write(">");
            output.Write("<img class=\"sI\" src=\"");
            SmallIconManager.RenderItemIconUrl(output, userContext, item.ClassName);
            output.Write("\" alt=\"\">");
            output.Write(value);
            output.Write("</span>");
        }