Example #1
0
		private static Language Load(Module module, string language)
		{
			string CacheKey = "Language_" + module.ModuleType + "_" + language;
			// Lookup in Cache
			Language l = (Language)HttpContext.Current.Cache[CacheKey];
			if(l != null) return l;

			// Load Portaldefinition
			XmlTextReader xmlReader = new XmlTextReader(Config.GetModuleLanguagePhysicalPath(module.ModuleType, language));
			try
			{
				l = (Language)xmlLanguage.Deserialize(xmlReader);
				if(l == null) throw new PortalException("Unable to load Language " + language);

				UpdateLanguageProperties(l);

				// Add to Cache
				HttpContext.Current.Cache.Insert(CacheKey, l, 
					new System.Web.Caching.CacheDependency(Config.GetModuleLanguagePhysicalPath(module.ModuleType, language)));
			}
			finally
			{
				xmlReader.Close();
			}

			return l;
		}
        /// <summary>
        /// Überprüft ob diese Url im angegebenen Modul konfiguriert ist.
        /// </summary>
        /// <param name="szTab"></param>
        /// <param name="HostingModule"></param>
        /// <param name="szUrl"></param>
        /// <returns></returns>
        private bool UrlExist(string szTab, PortalDefinition.Module HostingModule, string szUrl)
        {
            bool bUrlFound = false;

            // Wir laden das Modul in den Speicher, damit wir einfach auf die Konfiguration zugrefen können.
            Portal.API.Module Md = (Portal.API.Module)LoadControl(Config.GetModuleVirtualPath(HostingModule.type) +
                                                                  HostingModule.type + ".ascx");

            // Modul initialisieren.
            Md.InitModule(szTab, HostingModule.reference, HostingModule.type,
                          Config.GetModuleDataVirtualPath(HostingModule.type), false);

            // Konfiguration laden.
            DataSet ModConfig = Md.ReadConfig();

            if (ModConfig != null)
            {
                // Nun iterieren wir über alle Url's in diesem Module.
                foreach (DataRow Entry in ModConfig.Tables["news"].Rows)
                {
                    if (szUrl == (string)Entry["Url"])
                    {
                        return(true);
                    }
                }
            }

            return(bUrlFound);
        }
Example #3
0
		public static string GetText(Module module, string reference)
		{
			if(module == null)
			{
				return GetText(reference);
			}
			else
			{
				Language l = Load(module, System.Threading.Thread.CurrentThread.CurrentUICulture.Name);
				string w = (string)l.wordsTbl[reference];
				return w==null?"":w;
			}
		}