/*
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{
/// <summary>
///
/// </summary>
public class ModuleConfiguration
{
public ModuleConfiguration()
{
Settings = new ModuleSettingEditor[0];
Assemblies = new ModuleAssembly[0];
Schemas = new IncludeFile[0];
InstallSqlFiles = new IncludeFile[0];
UnstallSqlFiles = new IncludeFile[0];
Folders = new FolderInfo[0];
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public string Version { get; set; }
/// <summary>
/// Gets or sets the framework version.
/// </summary>
/// <value>The framework version.</value>
public string FrameworkVersion { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="ModuleConfiguration"/> is installed.
/// </summary>
/// <value><c>true</c> if installed; otherwise, <c>false</c>.</value>
public bool Installed { get; set; }
/// <summary>
/// Gets or sets the admin URL.
/// </summary>
/// <value>The admin URL.</value>
public string AdminUrl { get; set; }
/// <summary>
/// Gets or sets the module settings.
/// </summary>
/// <value>The module settings.</value>
public ModuleSettingEditor[] Settings { get; set; }
/// <summary>
/// Gets or sets the assemblies.
/// </summary>
/// <value>The assemblies.</value>
public ModuleAssembly[] Assemblies { get; set; }
/// <summary>
/// Gets or sets the schemas.
/// </summary>
/// <value>The schemas.</value>
public IncludeFile[] Schemas { get; set; }
/// <summary>
/// Gets or sets the SQL files.
/// </summary>
/// <value>The SQL files.</value>
public IncludeFile[] InstallSqlFiles { get; set; }
/// <summary>
/// Gets or sets the unstall SQL files.
/// </summary>
/// <value>The unstall SQL files.</value>
public IncludeFile[] UnstallSqlFiles { get; set; }
/// <summary>
/// Gets or sets the folders.
/// </summary>
/// <value>The folders.</value>
public FolderInfo[] Folders { get; set; }
[System.Xml.Serialization.XmlIgnore]
public ModuleSettingEditor this[string key]
{
get
{
if (Settings.Length > 0)
{
return Settings.Where(m => m.Key == key).FirstOrDefault();
}
return null;
}
}
}
/// <summary>
///
/// </summary>
public class ModuleSetting : ICloneable
{
public string Key { get; set; }
public string Value { get; set; }
#region ICloneable Members
public object Clone()
{
return new ModuleSetting() { Key = this.Key, Value = this.Value };
}
#endregion
}
/// <summary>
///
/// </summary>
//public enum SettingEditorType
//{
// /// <summary>
// /// Text box
// /// </summary>
// Textfield,
// /// <summary>
// /// Date
// /// </summary>
// Datefield,
// /// <summary>
// /// Combobox
// /// </summary>
// Combo,
// /// <summary>
// /// Multi-Select combobox.
// /// </summary>
// Lovcombo
//}
public class ModuleSettingEditorCollection : List<ModuleSettingEditor>
{
/// <summary>
/// Adds the setting.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
/// <param name="items">The items.</param>
public void AddSetting(string name, string value, params string[] items)
{
var settingEditor = new ModuleSettingEditor() { Key = name, Value = value };
if (items != null && items.Length > 0)
{
settingEditor.Items = string.Join("|", items);
}
this.Add(settingEditor);
}
/// <summary>
/// Sets the theme.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="themes">The themes.</param>
public void SetTheme(string value, params string[] themes)
{
this.AddSetting("Theme", value, themes);
}
/// <summary>
/// Sets the unauthorized URL.
/// </summary>
/// <param name="value">The value.</param>
public void SetUnauthorizedUrl(string value)
{
this.AddSetting("UnauthorizedUrl", value);
}
/// <summary>
/// Sets the entry URL.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="entryUrls">The entry urls.</param>
public void SetEntryUrl(string value, params string[] entryUrls)
{
this.AddSetting("EntryUrl", value, entryUrls);
}
/// <summary>
/// Enableds the page title.
/// </summary>
/// <param name="value">if set to <c>true</c> [value].</param>
public void SetEnabledPageTitle(bool value)
{
this.AddSetting("EnabledPageTitle", value.ToString().ToLower(), "true", "false");
}
/// <summary>
/// Sets the page title format.
/// </summary>
/// <param name="format">The format.</param>
public void SetPageTitleFormat(string format)
{
this.AddSetting("PageTitleFormat", format);
}
}
/// <summary>
///
/// </summary>
public class ModuleSettingEditor : ModuleSetting
{
/// <summary>
/// Gets or sets the editor.
/// </summary>
/// <value>The editor.</value>
//public SettingEditorType Editor { get; set; }
/// <summary>
/// Gets or sets the items. For Combobox and Lovcombo editor control. e.g: Value1|Value2|Value3
/// </summary>
/// <value>The items.</value>
public string Items { get; set; }
}
/// <summary>
///
/// </summary>
public class ModuleAssembly
{
/// <summary>
/// Gets or sets the name of the assembly.
/// </summary>
/// <value>The name of the assembly.</value>
public string AssemblyName { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [contains controller].
/// </summary>
/// <value><c>true</c> if [contains controller]; otherwise, <c>false</c>.</value>
public bool ContainsController { get; set; }
}
/// <summary>
///
/// </summary>
public class IncludeFile
{
public string Path { get; set; }
}
/// <summary>
///
/// </summary>
public class FolderInfo
{
public string FolderName { get; set; }
public string SchemaName { get; set; }
public FolderInfo[] Children { get; set; }
}
}
|