/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Everest.CmsServices.Extension.Module{
public class ModuleSettingCollection : List<ModuleSetting>
{
public ModuleSettingCollection(IEnumerable<ModuleSetting> collection)
{
if (collection != null)
{
foreach (var item in collection)
{
this.Add((ModuleSetting)item.Clone());
}
}
}
[System.Xml.Serialization.XmlIgnore]
public ModuleSetting this[string key]
{
get
{
if (this.Count > 0)
{
return this.Where(m => m.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
}
return null;
}
}
public string Theme
{
get
{
if (this["Theme"] != null)
{
return this["Theme"].Value;
}
return "Default";
}
}
public string UnauthorizedUrl
{
get
{
if (this["UnauthorizedUrl"] != null)
{
return this["UnauthorizedUrl"].Value;
}
return string.Empty;
}
}
public string EntryUrl
{
get
{
if (this["EntryUrl"] != null)
{
return this["EntryUrl"].Value;
}
return "~/";
}
}
/// <summary>
/// Gets the page title format.
/// </summary>
/// <value>The page title format.</value>
public string PageTitleFormat
{
get
{
if (this["PageTitleFormat"] != null)
{
return this["PageTitleFormat"].Value;
}
return "{0}";
}
}
bool? enabledPageTitle;
/// <summary>
/// Gets a value indicating whether [enabled page title].
/// </summary>
/// <value><c>true</c> if [enabled page title]; otherwise, <c>false</c>.</value>
public bool EnabledPageTitle
{
get
{
if (enabledPageTitle == null)
{
enabledPageTitle = false;
if (this["EnabledPageTitle"] != null)
{
bool enabled = false;
bool.TryParse(this["EnabledPageTitle"].Value, out enabled);
enabledPageTitle = enabled;
}
}
return enabledPageTitle.Value;
}
}
}
}
|