* Activities.aspx: implémente la vue Html de la liste éditable des activités * Activity.ascx: implémente la vue Html d'une activité * NpgsqlContentProvider.cs: implemente la gestion des activités côté base de donnée Npgsql * TestAPI.csproj: ... une référence au framework 4.5.1 en moins ... * FrontOfficeController.cs: Le contrôleur du FrontOffice gére les activités * Global.asax.cs: nettoyage du code * activity.sql: Typo corrigée sur le terme "MEACode" * style.css: enlève des images qui n'ont plus rien à faire ici, tant ce fichier concerne maintenant uniquement la disposition ou les éléments de base. * AccountController.cs: implémente le contrôle par l'utilisateur du paramêtre de l'activité principale associé à son profile. * FrontOfficeController.cs: Implemente le contrôle de la page des activités, et simplifie le contrôle de la page des compétences. * HomeController.cs: formattage du code * ModuleController.cs: inutilisé * App.master: Theming explicite en page maître * Profile.aspx: Propose maintenant l'édition de l'activité principalement éxercée * Skills.aspx: supprime une ligne de log * Index.aspx: RAZ en home page * MarkdownDeep.dll: remplace le tag englobant les transformations, il était un "<p>", il est maintenant un "<span>". * BlogManager.cs: refactorisation * Activity.cs: implémente un type de commande à associer à une activité. * LocalizedText.fr.resx: * LocalizedText.Designer.cs: * LocalizedText.fr.Designer.cs: La traduction de "ne pas publier mon activité" * LocalizedText.resx: La traduction de "ne pas publier mon activité", et de "Votre activité" * ManagerHelper.cs: refabrique l'instanciation des fournisseurs du workflow, pour avoir une liste de toutes les activité prises en charges par tous les fournisseurs de contenu. * Profile.cs: Implement le code activité de l'objet `Profile` * ProfileEdition.cs: xmldoc * SkillManager.cs: Formattage du code source * IContentProvider.cs: reformattage du code+ propriété "Name" du fournisseur + definition des methodes relatives à la gestion des activités * WorkFlowManager.cs: Methodes de recupperation des activités fournies auprés des fournisseurs de contenu * YavscModel.csproj: renommage * Web.csproj: reference les nouveaux éléments du projet relatifs au activités * Web.config: references manquante en cas d'utilisation du paramértrage global du thème via la section system.web/pages du fichier de configuration.
109 lines
3.6 KiB
C#
109 lines
3.6 KiB
C#
//
|
|
// Manager.cs
|
|
//
|
|
// Author:
|
|
// Paul Schneider <paul@pschneider.fr>
|
|
//
|
|
// Copyright (c) 2015 GNU GPL
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// 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 Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
using System;
|
|
using System.Configuration;
|
|
using System.Reflection;
|
|
using System.Configuration.Provider;
|
|
using System.Collections.Specialized;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Yavsc.Model {
|
|
/// <summary>
|
|
/// Manager.
|
|
/// </summary>
|
|
public static class ManagerHelper {
|
|
|
|
/// <summary>
|
|
/// Gets the provider.
|
|
/// </summary>
|
|
/// <value>The provider.</value>
|
|
public static TProvider CreateDefaultProvider<TProvider> (string configSetion) where TProvider: ProviderBase
|
|
{
|
|
var config = GetConfiguration (configSetion);
|
|
ProviderSettings celt =
|
|
config.Providers [config.DefaultProvider];
|
|
return CreateProvider<TProvider> (celt.Type, celt.Name, celt.Parameters);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates the providers.
|
|
/// </summary>
|
|
/// <returns>The providers.</returns>
|
|
/// <param name="configSetion">Config setion.</param>
|
|
/// <typeparam name="TProvider">The 1st type parameter.</typeparam>
|
|
public static TProvider [] CreateProviders<TProvider> (string configSetion) where TProvider: ProviderBase
|
|
{
|
|
var config = GetConfiguration (configSetion);
|
|
List<TProvider> providers = new List<TProvider> ();
|
|
foreach (ProviderSettings provConfig in config.Providers) {
|
|
var prov = CreateProvider<TProvider>
|
|
(provConfig.Type, provConfig.Name, provConfig.Parameters);
|
|
providers.Add (prov);
|
|
}
|
|
return providers.ToArray ();
|
|
}
|
|
|
|
private static DataProviderConfigurationSection GetConfiguration(string configSetion) {
|
|
DataProviderConfigurationSection config = ConfigurationManager.GetSection (configSetion) as DataProviderConfigurationSection;
|
|
if (config == null)
|
|
throw new ConfigurationErrorsException (
|
|
string.Format(
|
|
"The providers configuration bloc `{0}` was not found",
|
|
configSetion));
|
|
return config;
|
|
}
|
|
|
|
private static TProvider CreateProvider<TProvider>(string type, string name,
|
|
NameValueCollection config) where TProvider: ProviderBase {
|
|
Type provtype = Type.GetType (type);
|
|
if (provtype == null)
|
|
throw new ProviderException (
|
|
string.Format (
|
|
"Provider type '{0}' was not found",type));
|
|
ConstructorInfo ci = provtype.GetConstructor (Type.EmptyTypes);
|
|
TProvider bp = ci.Invoke (Type.EmptyTypes) as TProvider;
|
|
bp.Initialize (name, config);
|
|
return bp;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the default provider.
|
|
/// </summary>
|
|
/// <returns>The default provider.</returns>
|
|
/// <param name="configSetion">Config setion.</param>
|
|
public static ProviderBase CreateDefaultProvider (string configSetion)
|
|
{
|
|
return CreateDefaultProvider<ProviderBase>(configSetion);
|
|
}
|
|
/// <summary>
|
|
/// Creates the providers.
|
|
/// </summary>
|
|
/// <returns>The providers.</returns>
|
|
/// <param name="configSetion">Config setion.</param>
|
|
public static ProviderBase[] CreateProviders (string configSetion)
|
|
{
|
|
return CreateProviders<ProviderBase>(configSetion);
|
|
}
|
|
|
|
}
|
|
}
|