[mapguide-commits] r5922 - in trunk/Tools/MgInstantSetup: InstantSetup InstantSetup.Core InstantSetup.Core/Resources

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 3 13:10:39 EDT 2011


Author: jng
Date: 2011-06-03 10:10:39 -0700 (Fri, 03 Jun 2011)
New Revision: 5922

Modified:
   trunk/Tools/MgInstantSetup/InstantSetup.Core/AbstractSetupConfigurationProcess.cs
   trunk/Tools/MgInstantSetup/InstantSetup.Core/ApacheSetupConfigurationProcess.cs
   trunk/Tools/MgInstantSetup/InstantSetup.Core/Resources/APACHE_WEB.txt
   trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.Designer.cs
   trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.cs
   trunk/Tools/MgInstantSetup/InstantSetup/Form1.Designer.cs
Log:
#1608: Update the instant setup utility to specify the default viewer and fill in a missing value in php.ini. Also update the web tier batch script to use our custom MENTOR_DICTIONARY_PATH


Modified: trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.Designer.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.Designer.cs	2011-06-03 15:42:40 UTC (rev 5921)
+++ trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.Designer.cs	2011-06-03 17:10:39 UTC (rev 5922)
@@ -46,6 +46,9 @@
             this.chkEnableJava = new System.Windows.Forms.CheckBox();
             this.numTomcatPort = new System.Windows.Forms.NumericUpDown();
             this.label5 = new System.Windows.Forms.Label();
+            this.groupBox4 = new System.Windows.Forms.GroupBox();
+            this.rdJava = new System.Windows.Forms.RadioButton();
+            this.rdPhp = new System.Windows.Forms.RadioButton();
             this.groupBox1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.numSitePort)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.numClientPort)).BeginInit();
@@ -54,6 +57,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.numHttpdPort)).BeginInit();
             this.groupBox3.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.numTomcatPort)).BeginInit();
+            this.groupBox4.SuspendLayout();
             this.SuspendLayout();
             // 
             // groupBox1
@@ -162,7 +166,7 @@
                         | System.Windows.Forms.AnchorStyles.Right)));
             this.txtServiceName.Location = new System.Drawing.Point(154, 77);
             this.txtServiceName.Name = "txtServiceName";
-            this.txtServiceName.Size = new System.Drawing.Size(236, 20);
+            this.txtServiceName.Size = new System.Drawing.Size(229, 20);
             this.txtServiceName.TabIndex = 11;
             this.txtServiceName.TextChanged += new System.EventHandler(this.txtServiceName_TextChanged);
             // 
@@ -203,7 +207,7 @@
                         | System.Windows.Forms.AnchorStyles.Right)));
             this.txtVirtualDirectory.Location = new System.Drawing.Point(154, 25);
             this.txtVirtualDirectory.Name = "txtVirtualDirectory";
-            this.txtVirtualDirectory.Size = new System.Drawing.Size(236, 20);
+            this.txtVirtualDirectory.Size = new System.Drawing.Size(229, 20);
             this.txtVirtualDirectory.TabIndex = 1;
             this.txtVirtualDirectory.TextChanged += new System.EventHandler(this.txtVirtualDirectory_TextChanged);
             // 
@@ -224,9 +228,9 @@
             this.groupBox3.Controls.Add(this.chkEnableJava);
             this.groupBox3.Controls.Add(this.numTomcatPort);
             this.groupBox3.Controls.Add(this.label5);
-            this.groupBox3.Location = new System.Drawing.Point(4, 246);
+            this.groupBox3.Location = new System.Drawing.Point(4, 303);
             this.groupBox3.Name = "groupBox3";
-            this.groupBox3.Size = new System.Drawing.Size(440, 106);
+            this.groupBox3.Size = new System.Drawing.Size(440, 66);
             this.groupBox3.TabIndex = 2;
             this.groupBox3.TabStop = false;
             // 
@@ -263,15 +267,53 @@
             this.label5.TabIndex = 6;
             this.label5.Text = "Tomcat Port Number";
             // 
+            // groupBox4
+            // 
+            this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.groupBox4.Controls.Add(this.rdJava);
+            this.groupBox4.Controls.Add(this.rdPhp);
+            this.groupBox4.Location = new System.Drawing.Point(4, 247);
+            this.groupBox4.Name = "groupBox4";
+            this.groupBox4.Size = new System.Drawing.Size(440, 50);
+            this.groupBox4.TabIndex = 3;
+            this.groupBox4.TabStop = false;
+            this.groupBox4.Text = "Preferred Default Viewer";
+            // 
+            // rdJava
+            // 
+            this.rdJava.AutoSize = true;
+            this.rdJava.Location = new System.Drawing.Point(111, 19);
+            this.rdJava.Name = "rdJava";
+            this.rdJava.Size = new System.Drawing.Size(48, 17);
+            this.rdJava.TabIndex = 1;
+            this.rdJava.TabStop = true;
+            this.rdJava.Text = "Java";
+            this.rdJava.UseVisualStyleBackColor = true;
+            this.rdJava.CheckedChanged += new System.EventHandler(this.defaultViewerCheckedChanged);
+            // 
+            // rdPhp
+            // 
+            this.rdPhp.AutoSize = true;
+            this.rdPhp.Location = new System.Drawing.Point(26, 19);
+            this.rdPhp.Name = "rdPhp";
+            this.rdPhp.Size = new System.Drawing.Size(47, 17);
+            this.rdPhp.TabIndex = 0;
+            this.rdPhp.TabStop = true;
+            this.rdPhp.Text = "PHP";
+            this.rdPhp.UseVisualStyleBackColor = true;
+            this.rdPhp.CheckedChanged += new System.EventHandler(this.defaultViewerCheckedChanged);
+            // 
             // ApacheConfigCtrl
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.groupBox4);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox1);
             this.Name = "ApacheConfigCtrl";
-            this.Size = new System.Drawing.Size(447, 355);
+            this.Size = new System.Drawing.Size(447, 372);
             this.groupBox1.ResumeLayout(false);
             this.groupBox1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.numSitePort)).EndInit();
@@ -283,6 +325,8 @@
             this.groupBox3.ResumeLayout(false);
             this.groupBox3.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.numTomcatPort)).EndInit();
+            this.groupBox4.ResumeLayout(false);
+            this.groupBox4.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -307,5 +351,8 @@
         private System.Windows.Forms.Label label6;
         private System.Windows.Forms.TextBox txtServiceName;
         private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.GroupBox groupBox4;
+        private System.Windows.Forms.RadioButton rdJava;
+        private System.Windows.Forms.RadioButton rdPhp;
     }
 }

Modified: trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.cs	2011-06-03 15:42:40 UTC (rev 5921)
+++ trunk/Tools/MgInstantSetup/InstantSetup/ApacheConfigCtrl.cs	2011-06-03 17:10:39 UTC (rev 5922)
@@ -98,6 +98,24 @@
         private void chkEnableJava_CheckedChanged(object sender, EventArgs e)
         {
             ApacheConfig.EnableJava = chkEnableJava.Checked;
+
+            if (chkEnableJava.Checked)
+            {
+                rdJava.Enabled = true;
+            }
+            else 
+            {
+                rdJava.Enabled = false;
+                rdPhp.Checked = true;
+            }
         }
+
+        private void defaultViewerCheckedChanged(object sender, EventArgs e)
+        {
+            if (rdJava.Checked)
+                this.Config.DefaultViewer = ApiType.Java;
+            else if (rdPhp.Checked)
+                this.Config.DefaultViewer = ApiType.Php;
+        }
     }
 }

Modified: trunk/Tools/MgInstantSetup/InstantSetup/Form1.Designer.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetup/Form1.Designer.cs	2011-06-03 15:42:40 UTC (rev 5921)
+++ trunk/Tools/MgInstantSetup/InstantSetup/Form1.Designer.cs	2011-06-03 17:10:39 UTC (rev 5922)
@@ -47,7 +47,7 @@
             // btnConfigure
             // 
             this.btnConfigure.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnConfigure.Location = new System.Drawing.Point(465, 464);
+            this.btnConfigure.Location = new System.Drawing.Point(465, 509);
             this.btnConfigure.Name = "btnConfigure";
             this.btnConfigure.Size = new System.Drawing.Size(75, 23);
             this.btnConfigure.TabIndex = 0;
@@ -64,7 +64,7 @@
             this.tabControl1.Location = new System.Drawing.Point(13, 87);
             this.tabControl1.Name = "tabControl1";
             this.tabControl1.SelectedIndex = 0;
-            this.tabControl1.Size = new System.Drawing.Size(527, 371);
+            this.tabControl1.Size = new System.Drawing.Size(527, 416);
             this.tabControl1.TabIndex = 1;
             // 
             // TAB_APACHE
@@ -72,7 +72,7 @@
             this.TAB_APACHE.Location = new System.Drawing.Point(4, 22);
             this.TAB_APACHE.Name = "TAB_APACHE";
             this.TAB_APACHE.Padding = new System.Windows.Forms.Padding(3);
-            this.TAB_APACHE.Size = new System.Drawing.Size(519, 345);
+            this.TAB_APACHE.Size = new System.Drawing.Size(519, 390);
             this.TAB_APACHE.TabIndex = 1;
             this.TAB_APACHE.Text = "Apache";
             this.TAB_APACHE.UseVisualStyleBackColor = true;
@@ -130,7 +130,7 @@
             // 
             this.chkInstallServices.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
             this.chkInstallServices.AutoSize = true;
-            this.chkInstallServices.Location = new System.Drawing.Point(13, 468);
+            this.chkInstallServices.Location = new System.Drawing.Point(13, 513);
             this.chkInstallServices.Name = "chkInstallServices";
             this.chkInstallServices.Size = new System.Drawing.Size(97, 17);
             this.chkInstallServices.TabIndex = 7;
@@ -173,7 +173,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(552, 499);
+            this.ClientSize = new System.Drawing.Size(552, 544);
             this.Controls.Add(this.button1);
             this.Controls.Add(this.txtBatchOutput);
             this.Controls.Add(this.label3);

Modified: trunk/Tools/MgInstantSetup/InstantSetup.Core/AbstractSetupConfigurationProcess.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetup.Core/AbstractSetupConfigurationProcess.cs	2011-06-03 15:42:40 UTC (rev 5921)
+++ trunk/Tools/MgInstantSetup/InstantSetup.Core/AbstractSetupConfigurationProcess.cs	2011-06-03 17:10:39 UTC (rev 5922)
@@ -39,6 +39,7 @@
         protected AbstractSetupConfigurationProcess()
         {
             this.EnablePhp = true;
+            this.DefaultViewer = ApiType.Php;
 
             //Port numbers specified not to intentionally clash with an existing 
             //MGOS installation
@@ -150,6 +151,11 @@
         /// </summary>
         public int ServerSitePort { get; set; }
 
+        /// <summary>
+        /// The default viewer that mapviewerajax will resolve to
+        /// </summary>
+        public ApiType DefaultViewer { get; set; }
+
         private IniFile _serverConfig;
         private IniFile _webConfig;
         private IniFile _phpConfig;
@@ -218,6 +224,7 @@
         private void SetPhpConfigProperties()
         {
             _phpConfig.IniWriteValue("PHP", "extension_dir", Path.Combine(this.WebTierPhpDir, "ext"));
+            _phpConfig.IniWriteValue("Session", "session.save_path", Path.Combine(this.WebTierRootDir, "Temp"));
         }
 
         private void SetWebConfigProperties()
@@ -228,13 +235,13 @@
             _webConfig.IniWriteValue("SiteConnectionProperties","Port",this.ServerSitePort.ToString(CultureInfo.InvariantCulture));
 
             _webConfig.IniWriteValue("GeneralProperties","ResourcesPath",Path.Combine(this.WebTierMapAgentDir, "Resources"));
-            _webConfig.IniWriteValue("GeneralProperties","TempPath",Path.Combine(this.WebTierRootDir, "Logs"));
+            _webConfig.IniWriteValue("GeneralProperties","TempPath",Path.Combine(this.WebTierRootDir, "Temp"));
 
             _webConfig.IniWriteValue("SiteConnectionProperties","IpAddress","127.0.0.1");
 
-            _webConfig.IniWriteValue("WebApplicationProperties","TemplateRootFolder",Path.Combine(this.WebTierRootDir, "fusion\\templates\\mapguide"));
-            _webConfig.IniWriteValue("WebApplicationProperties","WidgetInfoFolder",Path.Combine(this.WebTierRootDir, "fusion\\widgets\\widgetinfo"));
-            _webConfig.IniWriteValue("WebApplicationProperties", "ContainerInfoFolder", Path.Combine(this.WebTierRootDir, "fusion\\containerinfo"));
+            _webConfig.IniWriteValue("WebApplicationProperties","TemplateRootFolder",Path.Combine(this.WebTierPublicDir, "fusion\\templates\\mapguide"));
+            _webConfig.IniWriteValue("WebApplicationProperties", "WidgetInfoFolder", Path.Combine(this.WebTierPublicDir, "fusion\\widgets\\widgetinfo"));
+            _webConfig.IniWriteValue("WebApplicationProperties", "ContainerInfoFolder", Path.Combine(this.WebTierPublicDir, "fusion\\containerinfo"));
         }
 
         private void SetServerConfigProperties()

Modified: trunk/Tools/MgInstantSetup/InstantSetup.Core/ApacheSetupConfigurationProcess.cs
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetup.Core/ApacheSetupConfigurationProcess.cs	2011-06-03 15:42:40 UTC (rev 5921)
+++ trunk/Tools/MgInstantSetup/InstantSetup.Core/ApacheSetupConfigurationProcess.cs	2011-06-03 17:10:39 UTC (rev 5922)
@@ -57,6 +57,11 @@
             }
         }
 
+        public virtual string WebTierTomcatDir
+        {
+            get { return Path.Combine(this.WebTierRootDir, "Tomcat"); }
+        }
+
         protected override void ValidateConfigSettings()
         {
 
@@ -88,24 +93,42 @@
             if (this.EnableJava)
             {
                 httpdBuffer.Replace("%MG_INCLUDE_TOMCAT%", "Include conf/tomcat.conf");
+            }
+            else
+            {
+                httpdBuffer.Replace("%MG_INCLUDE_TOMCAT%", "#Uncomment to enable the Java API\n#Include conf/tomcat.conf");
+            }
+
+            if (this.DefaultViewer == ApiType.Java)
+            {
                 httpdBuffer.Replace("%MG_PHP_API%", "#");
                 httpdBuffer.Replace("%MG_JAVA_API%", "");
-
-                var tomcatConf = Path.Combine(this.WebTierApacheDir, "conf\\tomcat.conf");
-                var tomcatBuffer = new StringBuilder(File.ReadAllText(tomcatConf));
-
-                tomcatBuffer.Replace("%MG_WEB_APACHE%", Apachify(this.WebTierApacheDir));
-                tomcatBuffer.Replace("%MG_VIRTUAL_DIR%", this.VirtualDirectoryName);
-
-                File.WriteAllText(tomcatConf, tomcatBuffer.ToString());
             }
-            else
+            else if (this.DefaultViewer == ApiType.Php)
             {
-                httpdBuffer.Replace("%MG_INCLUDE_TOMCAT%", "#Uncomment to enable the Java API\n#Include conf/tomcat.conf");
                 httpdBuffer.Replace("%MG_PHP_API%", "");
                 httpdBuffer.Replace("%MG_JAVA_API%", "#");
             }
+            else
+            {
+                throw new InvalidOperationException(".net viewer is not supported in the Apache configuration");
+            }
 
+
+            //Do the tomcat substitutions anyway
+            var tomcatConf = Path.Combine(this.WebTierApacheDir, "conf\\tomcat.conf");
+            var tomcatBuffer = new StringBuilder(File.ReadAllText(tomcatConf));
+
+            tomcatBuffer.Replace("%MG_WEB_APACHE%", Apachify(this.WebTierApacheDir));
+            tomcatBuffer.Replace("%MG_VIRTUAL_DIR%", this.VirtualDirectoryName);
+
+            var catalinaConf = Path.Combine(this.WebTierTomcatDir, "conf\\Catalina\\localhost\\mapguide.xml");
+            var catalinaBuffer = new StringBuilder(File.ReadAllText(catalinaConf));
+
+            catalinaBuffer.Replace("%MG_WEB_ROOT%", this.WebTierPublicDir);
+
+            File.WriteAllText(catalinaConf, catalinaBuffer.ToString());
+            File.WriteAllText(tomcatConf, tomcatBuffer.ToString());
             File.WriteAllText(httpdConf, httpdBuffer.ToString());
         }
 
@@ -117,7 +140,7 @@
         protected override void WriteAdditionalBatchFiles()
         {
             //Write httpd batch file
-            string httpdText = string.Format(Properties.Resources.APACHE_WEB, Path.Combine(this.WebTierApacheDir, "bin"));
+            string httpdText = string.Format(Properties.Resources.APACHE_WEB, this.CsMapDictionaryDir, Path.Combine(this.WebTierApacheDir, "bin"));
             File.WriteAllText(Path.Combine(this.BatchFileOutputDirectory, "mgwebtier.bat"), httpdText);
         }
     }

Modified: trunk/Tools/MgInstantSetup/InstantSetup.Core/Resources/APACHE_WEB.txt
===================================================================
--- trunk/Tools/MgInstantSetup/InstantSetup.Core/Resources/APACHE_WEB.txt	2011-06-03 15:42:40 UTC (rev 5921)
+++ trunk/Tools/MgInstantSetup/InstantSetup.Core/Resources/APACHE_WEB.txt	2011-06-03 17:10:39 UTC (rev 5922)
@@ -1,3 +1,4 @@
-pushd {0}
+SET MENTOR_DICTIONARY_PATH={0}
+pushd {1}
 httpd.exe
 popd
\ No newline at end of file



More information about the mapguide-commits mailing list