PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/stable-1.1.1/Client/PHPModule.cs

#
C# | 98 lines | 62 code | 23 blank | 13 comment | 4 complexity | 1a98f64324ff735a499861984d09e688 MD5 | raw file
 1//-----------------------------------------------------------------------
 2// <copyright>
 3// Copyright (C) Ruslan Yakushev for the PHP Manager for IIS project.
 4//
 5// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
 6// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
 7// </copyright>
 8//----------------------------------------------------------------------- 
 9
10using System;
11using System.Diagnostics;
12using Microsoft.Web.Management.Client;
13using Microsoft.Web.Management.Server;
14using Web.Management.PHP.Extensions;
15using Web.Management.PHP.Settings;
16using Web.Management.PHP.Setup;
17
18namespace Web.Management.PHP
19{
20
21    internal sealed class PHPModule : Module
22    {
23        private PHPModuleProxy _proxy;
24
25        internal PHPModuleProxy Proxy
26        {
27            get
28            {
29                if (_proxy == null)
30                {
31                    Connection connection = (Connection)GetService(typeof(Connection));
32                    _proxy = (PHPModuleProxy)connection.CreateProxy(this, typeof(PHPModuleProxy));
33                }
34
35                return _proxy;
36            }
37        }
38
39        protected override void Initialize(IServiceProvider serviceProvider, ModuleInfo moduleInfo)
40        {
41            base.Initialize(serviceProvider, moduleInfo);
42
43            IControlPanel controlPanel = (IControlPanel)GetService(typeof(IControlPanel));
44            Debug.Assert(controlPanel != null, "Couldn't get IControlPanel");
45
46            //PHPInfo page
47            ModulePageInfo modulePageInfo = new ModulePageInfo(this,
48                typeof(PHPInfoPage), Resources.PHPInfoPageTitle, Resources.PHPInfoPageDescription,
49                Resources.PHPLogo16, Resources.PHPLogo32, Resources.PHPInfoPageLongDescription);
50
51            controlPanel.RegisterPage(modulePageInfo);
52
53            //PHP Settings page
54            modulePageInfo = new ModulePageInfo(this,
55                typeof(AllSettingsPage), Resources.AllSettingsPageTitle, Resources.AllSettingsPageDescription,
56                Resources.PHPLogo16, Resources.PHPLogo32, Resources.AllSettingsPageLongDescription);
57
58            controlPanel.RegisterPage(modulePageInfo);
59
60            modulePageInfo = new ModulePageInfo(this,
61                typeof(ErrorReportingPage), Resources.ErrorReportingPageTitle, Resources.ErrorReportingPageDescription,
62                Resources.PHPLogo16, Resources.PHPLogo32, Resources.ErrorReportingPageLongDescription);
63
64            controlPanel.RegisterPage(modulePageInfo);
65
66            modulePageInfo = new ModulePageInfo(this,
67                typeof(RuntimeLimitsPage), Resources.RuntimeLimitsPageTitle, Resources.RuntimeLimitsPageDescription,
68                Resources.PHPLogo16, Resources.PHPLogo32, Resources.RuntimeLimitsPageLongDescription);
69
70            controlPanel.RegisterPage(modulePageInfo);
71
72            //PHP Extensions page
73            modulePageInfo = new ModulePageInfo(this,
74                typeof(AllExtensionsPage), Resources.AllExtensionsPageTitle, Resources.AllExtensionsPageDescription,
75                Resources.PHPLogo16, Resources.PHPLogo32, Resources.AllExtensionsPageLongDescription);
76
77            controlPanel.RegisterPage(modulePageInfo);
78
79
80            //PHPPage - PHP feature start page
81            modulePageInfo = new ModulePageInfo(this, 
82                typeof(PHPPage), Resources.PHPPageTitle, Resources.PHPPageDescription,
83                Resources.PHPLogo16, Resources.PHPLogo32, Resources.PHPPageLongDescription);
84
85            controlPanel.RegisterPage(ControlPanelCategoryInfo.Iis, modulePageInfo);
86            controlPanel.RegisterPage(ControlPanelCategoryInfo.ApplicationDevelopment, modulePageInfo);
87        }
88
89        protected override bool IsPageEnabled(ModulePageInfo pageInfo)
90        {
91            Connection connection = (Connection)GetService(typeof(Connection));
92
93            // We want the module configuration to be available on all levels except file.
94            return (connection.ConfigurationPath.PathType != ConfigurationPathType.File);
95        }
96
97    }
98}