Example #1
0
        internal static void Initialize()
        {
            SmallIconManager.smallIconTable            = new Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> >();
            SmallIconManager.prefixMatchSmallIconTable = new Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> >();
            string xmlFilePath = Path.Combine(HttpRuntime.AppDomainAppPath, "SmallIcons.xml");

            SmallIconManager.LoadXmlData(xmlFilePath, null, SmallIconManager.prefixMatchSmallIconTable, SmallIconManager.smallIconTable);
            string fullExtensionFileName = UIExtensionManager.FullExtensionFileName;

            if (!File.Exists(fullExtensionFileName))
            {
                return;
            }
            try
            {
                Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > dictionary  = new Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> >();
                Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > dictionary2 = new Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> >();
                SmallIconManager.LoadXmlData(fullExtensionFileName, "forms/Customization/", dictionary2, dictionary);
                SmallIconManager.MergeSmallIconTable(SmallIconManager.smallIconTable, dictionary);
                SmallIconManager.MergeSmallIconTable(SmallIconManager.prefixMatchSmallIconTable, dictionary2);
            }
            catch (Exception)
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_CustomizationUIExtensionParseError, string.Empty, new object[]
                {
                    fullExtensionFileName
                });
            }
        }
Example #2
0
 private static SmallIconManager.SmallIcon GetFolderSmallIcon(UserContext userContext, string containerClass, FolderSharingFlag sharingFlag)
 {
     SmallIconManager.SmallIcon smallIcon;
     if (containerClass == null)
     {
         smallIcon = SmallIconManager.normalFolderIcon;
     }
     else
     {
         smallIcon = SmallIconManager.LookupSmallIcon(containerClass, -1);
         if (smallIcon == null)
         {
             smallIcon = SmallIconManager.PrefixMatchLookupSmallIcon(containerClass, -1);
             if (smallIcon == null)
             {
                 smallIcon = SmallIconManager.normalFolderIcon;
             }
         }
     }
     if (!smallIcon.IsCustom && sharingFlag != FolderSharingFlag.None)
     {
         smallIcon = (SmallIconManager.GetIconForSharedFolder(containerClass, sharingFlag) ?? smallIcon);
     }
     return(smallIcon);
 }
Example #3
0
 private static SmallIconManager.SmallIcon GetFileSmallIcon(UserContext userContext, string fileExtension, int iconFlag)
 {
     SmallIconManager.SmallIcon smallIcon = SmallIconManager.LookupSmallIcon(fileExtension, iconFlag);
     if (smallIcon == null)
     {
         smallIcon = new SmallIconManager.SmallIcon(129, -1018465893);
     }
     return(smallIcon);
 }
Example #4
0
 public static SmallIconManager.SmallIcon GetItemSmallIcon(string itemClass, string defaultItemClass, bool isInConflict, bool isRead, int iconFlag)
 {
     if (isInConflict)
     {
         return(new SmallIconManager.SmallIcon(82, -1240042979));
     }
     if (!EnumValidator.IsValidValue <IconIndex>((IconIndex)iconFlag))
     {
         iconFlag = -1;
     }
     if (iconFlag == -1 && isRead)
     {
         iconFlag = 256;
     }
     else if (iconFlag == 306 && isRead)
     {
         iconFlag = 256;
     }
     SmallIconManager.SmallIcon smallIcon = SmallIconManager.LookupSmallIcon(itemClass, iconFlag);
     if (smallIcon == null && iconFlag == 256)
     {
         iconFlag  = -1;
         smallIcon = SmallIconManager.LookupSmallIcon(itemClass, iconFlag);
     }
     if (iconFlag == -1 && isRead && smallIcon == null)
     {
         smallIcon = SmallIconManager.PrefixMatchLookupSmallIcon(itemClass, 256);
     }
     if (smallIcon == null)
     {
         smallIcon = SmallIconManager.PrefixMatchLookupSmallIcon(itemClass, iconFlag);
     }
     if (smallIcon == null)
     {
         smallIcon = SmallIconManager.LookupSmallIcon(itemClass, -1);
     }
     if (smallIcon == null && defaultItemClass != null)
     {
         smallIcon = SmallIconManager.LookupSmallIcon(defaultItemClass, iconFlag);
     }
     if (smallIcon == null && defaultItemClass != null)
     {
         smallIcon = SmallIconManager.PrefixMatchLookupSmallIcon(defaultItemClass, iconFlag);
     }
     if (smallIcon == null && (iconFlag == 261 || iconFlag == 262))
     {
         smallIcon = SmallIconManager.LookupSmallIcon("IPM.Note", iconFlag);
     }
     if (smallIcon == null)
     {
         smallIcon = (isRead ? new SmallIconManager.SmallIcon(132, -1075414859) : new SmallIconManager.SmallIcon(133, -1679159840));
     }
     return(smallIcon);
 }
 public void RenderOpenLink(TextWriter output)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     AttachmentPolicy.Level levelForAttachment = AttachmentLevelLookup.GetLevelForAttachment(this.fileExtension, this.mimeType, this.owaContext.UserContext);
     output.Write("<span id=\"spnLnk\" tabindex=\"-1\">");
     SmallIconManager.RenderFileIcon(output, this.owaContext.UserContext, this.fileExtension, "tbLh", new string[0]);
     output.Write("<span class=\"tbLh\">");
     if (levelForAttachment == AttachmentPolicy.Level.ForceSave || levelForAttachment == AttachmentPolicy.Level.Allow)
     {
         output.Write("<a id=\"lnk\" href=\"");
         output.Write(this.openLink);
         output.Write("\" target=_blank onclick=\"");
         output.Write("return onClkAtmt(");
         output.Write((int)levelForAttachment);
         output.Write(")\" title=\"");
         Utilities.HtmlEncode(this.fileName, output);
         output.Write("\">");
         Utilities.HtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(this.fileName, null, false), output);
         output.Write("</a>");
     }
     else
     {
         Utilities.HtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(this.fileName, null, false), output);
     }
     if (this.fileSize > 0L)
     {
         output.Write(this.owaContext.UserContext.DirectionMark);
         output.Write(" ");
         output.Write(LocalizedStrings.GetHtmlEncoded(6409762));
         Utilities.RenderSizeWithUnits(output, this.fileSize, true);
         output.Write(this.owaContext.UserContext.DirectionMark);
         output.Write(LocalizedStrings.GetHtmlEncoded(-1023695022));
     }
     output.Write("</span></span>");
 }
Example #6
0
 private static void LoadXmlData(string xmlFilePath, string folderName, Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > prefixIconTable, Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > iconTable)
 {
     ExTraceGlobals.SmallIconCallTracer.TraceDebug <string>(0L, "LoadXmlData: XmlFilePath = '{0}'", xmlFilePath);
     using (XmlTextReader xmlTextReader = SmallIconManager.InitializeXmlTextReader(xmlFilePath))
     {
         bool          flag          = false;
         StringBuilder stringBuilder = new StringBuilder();
         while (xmlTextReader.Read())
         {
             XmlNodeType nodeType = xmlTextReader.NodeType;
             if (nodeType != XmlNodeType.Element)
             {
                 if (nodeType == XmlNodeType.EndElement)
                 {
                     if (xmlTextReader.Name == xmlTextReader.NameTable.Get("SmallIconMappings"))
                     {
                         flag = false;
                     }
                 }
             }
             else if (xmlTextReader.Name == xmlTextReader.NameTable.Get("SmallIconMappings"))
             {
                 flag = true;
             }
             else if (flag && xmlTextReader.Name == xmlTextReader.NameTable.Get("Mapping"))
             {
                 SmallIconManager.ParseMappingElement(xmlTextReader, folderName, stringBuilder, prefixIconTable, iconTable);
             }
         }
         if (stringBuilder.Length != 0)
         {
             OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_SmallIconsAltReferenceInvalid, string.Empty, new object[]
             {
                 stringBuilder.ToString()
             });
         }
     }
 }
Example #7
0
 internal static void RenderItemIconUrl(TextWriter writer, UserContext userContext, string itemClass, string defaultItemClass)
 {
     SmallIconManager.RenderItemIconUrl(writer, userContext, itemClass, defaultItemClass, false, false, -1);
 }
Example #8
0
        private bool BindItemAndShowDialog(StoreObjectId itemId, string type, StringWriter writer)
        {
            MessageItem messageItem = null;
            bool        result;

            try
            {
                messageItem = Item.BindAsMessage(this.mailboxSession, itemId);
                if (messageItem != null)
                {
                    string text = ItemUtility.GetProperty <string>(messageItem, StoreObjectSchema.ItemClass, null);
                    if (text == null)
                    {
                        text = "IPM.Note";
                    }
                    string property = ItemUtility.GetProperty <string>(messageItem, StoreObjectSchema.ContentClass, string.Empty);
                    if (ObjectClass.IsOfClass(property, "rpmsg.message"))
                    {
                        text += ".irm";
                    }
                    writer.Write("shwNwItmDlg(\"");
                    if (messageItem.From != null && messageItem.From.DisplayName != null)
                    {
                        Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.From.DisplayName), writer);
                    }
                    writer.Write("\",\"");
                    if (messageItem.Subject != null)
                    {
                        Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.Subject), writer);
                    }
                    writer.Write("\",\"" + type + "\",\"");
                    using (StringWriter stringWriter = new StringWriter())
                    {
                        SmallIconManager.RenderItemIcon(stringWriter, this.userContext, text, false, "nwItmImg", new string[0]);
                        Utilities.JavascriptEncode(stringWriter.ToString(), writer);
                    }
                    writer.Write("\");");
                }
                result = true;
            }
            catch (ObjectNotFoundException)
            {
                if (type != null)
                {
                    if (!(type == "lnkNwMl"))
                    {
                        if (!(type == "lnkNwVMl"))
                        {
                            if (type == "lnkNwFx")
                            {
                                writer.Write("shwNF(0);");
                            }
                        }
                        else
                        {
                            writer.Write("shwNVM(0);");
                        }
                    }
                    else
                    {
                        writer.Write("shwNM(0);");
                    }
                }
                result = false;
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                }
            }
            return(result);
        }
Example #9
0
 internal static void RenderFileIconUrl(TextWriter writer, UserContext userContext, string fileExtension)
 {
     SmallIconManager.RenderFileIconUrl(writer, userContext, fileExtension, -1);
 }
Example #10
0
 internal static void RenderFileIconUrl(TextWriter writer, UserContext userContext, string fileExtension, int iconFlag)
 {
     SmallIconManager.SmallIcon fileSmallIcon = SmallIconManager.GetFileSmallIcon(userContext, fileExtension, iconFlag);
     SmallIconManager.RenderIconUrl(writer, userContext, fileSmallIcon);
 }
Example #11
0
 internal static void RenderFileIcon(TextWriter writer, UserContext userContext, string fileExtension, string styleClass, params string[] extraAttributes)
 {
     SmallIconManager.RenderFileIcon(writer, userContext, fileExtension, -1, false, styleClass, extraAttributes);
 }
Example #12
0
 internal static void RenderFileIcon(TextWriter writer, UserContext userContext, string fileExtension, int iconFlag, bool showTooltip, string styleClass, params string[] extraAttributes)
 {
     SmallIconManager.SmallIcon fileSmallIcon = SmallIconManager.GetFileSmallIcon(userContext, fileExtension, iconFlag);
     SmallIconManager.RenderIcon(writer, userContext, fileSmallIcon, showTooltip, styleClass, extraAttributes);
 }
Example #13
0
 internal static void RenderFolderIcon(TextWriter writer, UserContext userContext, string containerClass, FolderSharingFlag sharingFlag, bool showTooltip, params string[] extraAttributes)
 {
     SmallIconManager.SmallIcon folderSmallIcon = SmallIconManager.GetFolderSmallIcon(userContext, containerClass, sharingFlag);
     SmallIconManager.RenderIcon(writer, userContext, folderSmallIcon, showTooltip, string.Empty, extraAttributes);
 }
Example #14
0
 internal static void RenderItemIconUrl(TextWriter writer, UserContext userContext, string itemClass, string defaultItemClass, bool isInConflict, bool isRead, int iconFlag)
 {
     SmallIconManager.SmallIcon itemSmallIcon = SmallIconManager.GetItemSmallIcon(itemClass, defaultItemClass, isInConflict, isRead, iconFlag);
     SmallIconManager.RenderIconUrl(writer, userContext, itemSmallIcon);
 }
Example #15
0
 internal static void RenderItemIconUrl(TextWriter writer, UserContext userContext, string itemClass, int iconFlag)
 {
     SmallIconManager.RenderItemIconUrl(writer, userContext, itemClass, null, false, false, iconFlag);
 }
Example #16
0
 internal void ExecuteApplicationStart(object sender, EventArgs e)
 {
     ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "Global.Application_Start");
     try
     {
         if (OwaApplicationBase.IsRunningDfpowa)
         {
             string          localPath   = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
             DirectoryInfo[] directories = Directory.GetParent(Directory.GetParent(localPath).FullName).GetDirectories("Config");
             if (directories.Length > 0)
             {
                 VariantConfiguration.Initialize(directories[0].FullName);
             }
         }
         Globals.Initialize(this.OwaVDirType);
         Kerberos.FlushTicketCache();
         SmallIconManager.Initialize();
         ThemeManager.Initialize();
         FormsRegistryManager.Initialize(HttpRuntime.AppDomainAppPath);
         ADCustomPropertyParser.Initialize(HttpRuntime.AppDomainAppPath);
         PerformanceCounterManager.InitializePerformanceCounters();
         ProxyEventHandler.Initialize();
         ExRpcModule.Bind();
         UIExtensionManager.Initialize();
         HelpProvider.Initialize(HelpProvider.HelpAppName.Owa);
         this.ExecuteApplicationSpecificStart();
     }
     catch (OwaSmallIconManagerInitializationException initializationError)
     {
         ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization failed");
         Globals.InitializationError = initializationError;
         return;
     }
     catch (OwaThemeManagerInitializationException initializationError2)
     {
         ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization failed");
         Globals.InitializationError = initializationError2;
         return;
     }
     catch (OwaFormsRegistryInitializationException initializationError3)
     {
         ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization failed");
         Globals.InitializationError = initializationError3;
         return;
     }
     catch (OwaInvalidConfigurationException ex)
     {
         ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization failed because of a problem with configuration: " + ex.Message);
         Globals.InitializationError = ex;
         return;
     }
     catch (OwaWin32Exception ex2)
     {
         ExTraceGlobals.CoreTracer.TraceDebug <int>(0L, "Application initialization failed with a win32 error: {0}", ex2.LastError);
         Globals.InitializationError = ex2;
         return;
     }
     catch (Exception initializationError4)
     {
         ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization failed");
         Globals.InitializationError = initializationError4;
         throw;
     }
     Globals.IsInitialized = true;
     ExTraceGlobals.CoreTracer.TraceDebug(0L, "Application initialization succeeded");
     if (Globals.IsPreCheckinApp)
     {
         OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_DfpOwaStartedSuccessfully, string.Empty, new object[0]);
         return;
     }
     OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_OwaStartedSuccessfully, string.Empty, new object[0]);
 }
Example #17
0
 internal static void RenderFolderIconUrl(TextWriter writer, UserContext userContext, string containerClass)
 {
     SmallIconManager.RenderFolderIconUrl(writer, userContext, containerClass, FolderSharingFlag.None);
 }
Example #18
0
 internal static void RenderItemIcon(TextWriter writer, UserContext userContext, string itemClass, params string[] extraAttributes)
 {
     SmallIconManager.RenderItemIcon(writer, userContext, itemClass, false, string.Empty, extraAttributes);
 }
Example #19
0
 internal static void RenderItemIcon(TextWriter writer, UserContext userContext, string itemClass, bool showTooltip, string defaultItemClass, bool isInConflict, bool isRead, int iconFlag, string styleClass, params string[] extraAttributes)
 {
     SmallIconManager.SmallIcon itemSmallIcon = SmallIconManager.GetItemSmallIcon(itemClass, defaultItemClass, isInConflict, isRead, iconFlag);
     SmallIconManager.RenderIcon(writer, userContext, itemSmallIcon, showTooltip, styleClass, extraAttributes);
 }
Example #20
0
 internal static void RenderItemIcon(TextWriter writer, UserContext userContext, string itemClass, bool showTooltip, bool isInConflict, bool isRead, string styleClass, params string[] extraAttributes)
 {
     SmallIconManager.RenderItemIcon(writer, userContext, itemClass, showTooltip, null, isInConflict, isRead, -1, styleClass, extraAttributes);
 }
Example #21
0
 internal static void RenderItemIcon(TextWriter writer, UserContext userContext, string itemClass, bool showTooltip, int iconFlag, string styleClass, params string[] extraAttributes)
 {
     SmallIconManager.RenderItemIcon(writer, userContext, itemClass, showTooltip, null, false, false, iconFlag, styleClass, extraAttributes);
 }
Example #22
0
 internal static void RenderItemIconUrl(TextWriter writer, UserContext userContext, string itemClass, bool isInConflict, bool isRead)
 {
     SmallIconManager.RenderItemIconUrl(writer, userContext, itemClass, null, isInConflict, isRead, -1);
 }
Example #23
0
 internal static void RenderFolderIconUrl(TextWriter writer, UserContext userContext, string containerClass, FolderSharingFlag sharingFlag)
 {
     SmallIconManager.SmallIcon folderSmallIcon = SmallIconManager.GetFolderSmallIcon(userContext, containerClass, sharingFlag);
     SmallIconManager.RenderIconUrl(writer, userContext, folderSmallIcon);
 }