[mapguide-commits] r7642 - in branches/maestro-4.0.x/Maestro.Editors: . FeatureSource/Providers FeatureSource/Providers/Odbc/SubEditors
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Jun 25 05:20:17 PDT 2013
Author: jng
Date: 2013-06-25 05:20:17 -0700 (Tue, 25 Jun 2013)
New Revision: 7642
Modified:
branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.Designer.cs
branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.cs
branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.resx
branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/SetCredentialsDialog.cs
branches/maestro-4.0.x/Maestro.Editors/Strings.Designer.cs
branches/maestro-4.0.x/Maestro.Editors/Strings.resx
Log:
#2232: Add %MG_USERNAME% and %MG_PASSWORD% placeholder token support for the ODBC Feature Source editor in RawConnectionString mode.
Modified: branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.Designer.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.Designer.cs 2013-06-25 12:10:39 UTC (rev 7641)
+++ branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.Designer.cs 2013-06-25 12:20:17 UTC (rev 7642)
@@ -31,6 +31,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConnectionStringCtrl));
this.label1 = new System.Windows.Forms.Label();
this.txtConnStr = new System.Windows.Forms.TextBox();
+ this.lnkApplyCredentials = new System.Windows.Forms.LinkLabel();
this.SuspendLayout();
//
// label1
@@ -43,10 +44,18 @@
resources.ApplyResources(this.txtConnStr, "txtConnStr");
this.txtConnStr.Name = "txtConnStr";
//
+ // lnkApplyCredentials
+ //
+ resources.ApplyResources(this.lnkApplyCredentials, "lnkApplyCredentials");
+ this.lnkApplyCredentials.Name = "lnkApplyCredentials";
+ this.lnkApplyCredentials.TabStop = true;
+ this.lnkApplyCredentials.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkApplyCredentials_LinkClicked);
+ //
// ConnectionStringCtrl
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lnkApplyCredentials);
this.Controls.Add(this.txtConnStr);
this.Controls.Add(this.label1);
this.Name = "ConnectionStringCtrl";
@@ -59,5 +68,6 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtConnStr;
+ private System.Windows.Forms.LinkLabel lnkApplyCredentials;
}
}
Modified: branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.cs 2013-06-25 12:10:39 UTC (rev 7641)
+++ branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.cs 2013-06-25 12:20:17 UTC (rev 7642)
@@ -25,6 +25,8 @@
using System.Text;
using System.Windows.Forms;
using System.Collections.Specialized;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.ObjectModels.FeatureSource;
namespace Maestro.Editors.FeatureSource.Providers.Odbc.SubEditors
{
@@ -36,9 +38,12 @@
InitializeComponent();
}
+ private IEditorService _service;
+
public override void Bind(IEditorService service)
{
- service.RegisterCustomNotifier(this);
+ _service = service;
+ _service.RegisterCustomNotifier(this);
}
void OnConnectionChanged()
@@ -76,5 +81,33 @@
public event EventHandler RequestDocumentReset;
+
+ private void lnkApplyCredentials_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+ {
+ string connStr = txtConnStr.Text;
+ if (connStr.Contains("%MG_USERNAME%") &&
+ connStr.Contains("%MG_PASSWORD%"))
+ {
+ using (var diag = new SetCredentialsDialog("%MG_USERNAME%", "%MG_PASSWORD%"))
+ {
+ if (diag.ShowDialog() == DialogResult.OK)
+ {
+ var fs = (IFeatureSource)_service.GetEditedResource();
+ fs.SetEncryptedCredentials(diag.Username, diag.Password);
+ //Bit of a hack as parent does a 64-bit driver check to determine
+ //which NameValueCollection to return from the child, but we can
+ //get away with this because the same NameValueCollection is returned
+ //for both
+ fs.ApplyConnectionProperties(this.ConnectionProperties);
+ _service.SyncSessionCopy();
+ MessageBox.Show("Credentials applied");
+ }
+ }
+ }
+ else
+ {
+ MessageBox.Show(Strings.OdbcConnStrMissingMgPlaceholders);
+ }
+ }
}
}
Modified: branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.resx
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.resx 2013-06-25 12:10:39 UTC (rev 7641)
+++ branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Odbc/SubEditors/ConnectionStringCtrl.resx 2013-06-25 12:20:17 UTC (rev 7642)
@@ -112,16 +112,16 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
- <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 10</value>
</data>
@@ -138,26 +138,26 @@
<value>label1</value>
</data>
<data name=">>label1.Type" xml:space="preserve">
- <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name=">>label1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name=">>label1.ZOrder" xml:space="preserve">
- <value>1</value>
+ <value>2</value>
</data>
- <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtConnStr.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<data name="txtConnStr.Location" type="System.Drawing.Point, System.Drawing">
- <value>3, 26</value>
+ <value>3, 35</value>
</data>
<data name="txtConnStr.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="txtConnStr.Size" type="System.Drawing.Size, System.Drawing">
- <value>583, 158</value>
+ <value>583, 149</value>
</data>
<data name="txtConnStr.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@@ -166,15 +166,42 @@
<value>txtConnStr</value>
</data>
<data name=">>txtConnStr.Type" xml:space="preserve">
- <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name=">>txtConnStr.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name=">>txtConnStr.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="lnkApplyCredentials.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="lnkApplyCredentials.Location" type="System.Drawing.Point, System.Drawing">
+ <value>179, 10</value>
+ </data>
+ <data name="lnkApplyCredentials.Size" type="System.Drawing.Size, System.Drawing">
+ <value>94, 13</value>
+ </data>
+ <data name="lnkApplyCredentials.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="lnkApplyCredentials.Text" xml:space="preserve">
+ <value>(Apply Credentials)</value>
+ </data>
+ <data name=">>lnkApplyCredentials.Name" xml:space="preserve">
+ <value>lnkApplyCredentials</value>
+ </data>
+ <data name=">>lnkApplyCredentials.Type" xml:space="preserve">
+ <value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>lnkApplyCredentials.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>lnkApplyCredentials.ZOrder" xml:space="preserve">
<value>0</value>
</data>
- <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
@@ -187,6 +214,6 @@
<value>ConnectionStringCtrl</value>
</data>
<data name=">>$this.Type" xml:space="preserve">
- <value>Maestro.Editors.EditorBase, Maestro.Editors, Version=3.0.0.5475, Culture=neutral, PublicKeyToken=null</value>
+ <value>Maestro.Editors.EditorBase, Maestro.Editors, Version=5.0.0.6640, Culture=neutral, PublicKeyToken=f526c48929fda856</value>
</data>
</root>
\ No newline at end of file
Modified: branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/SetCredentialsDialog.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/SetCredentialsDialog.cs 2013-06-25 12:10:39 UTC (rev 7641)
+++ branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/SetCredentialsDialog.cs 2013-06-25 12:20:17 UTC (rev 7642)
@@ -38,6 +38,15 @@
_propertyNames = propertyNames;
}
+ public SetCredentialsDialog(string userProp, string passProp)
+ {
+ InitializeComponent();
+ txtUserProperty.Text = userProp;
+ txtPasswordProperty.Text = passProp;
+ btnUserProperty.Visible = false;
+ btnPasswordProperty.Visible = false;
+ }
+
public string UserProperty { get { return txtUserProperty.Text; } }
public string PasswordProperty { get { return txtPasswordProperty.Text; } }
Modified: branches/maestro-4.0.x/Maestro.Editors/Strings.Designer.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/Strings.Designer.cs 2013-06-25 12:10:39 UTC (rev 7641)
+++ branches/maestro-4.0.x/Maestro.Editors/Strings.Designer.cs 2013-06-25 12:20:17 UTC (rev 7642)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.5420
+// Runtime Version:2.0.50727.5466
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -68,5 +68,14 @@
return ResourceManager.GetString("ConfirmWmsLogicalClassSwap", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to The ODBC connection string requires a %MG_USERNAME% and %MG_PASSWORD% placeholder tokens present.
+ /// </summary>
+ internal static string OdbcConnStrMissingMgPlaceholders {
+ get {
+ return ResourceManager.GetString("OdbcConnStrMissingMgPlaceholders", resourceCulture);
+ }
+ }
}
}
Modified: branches/maestro-4.0.x/Maestro.Editors/Strings.resx
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/Strings.resx 2013-06-25 12:10:39 UTC (rev 7641)
+++ branches/maestro-4.0.x/Maestro.Editors/Strings.resx 2013-06-25 12:20:17 UTC (rev 7642)
@@ -120,4 +120,7 @@
<data name="ConfirmWmsLogicalClassSwap" xml:space="preserve">
<value>In some cases, the actual WMS layer name would be generated in the FDO class description. Swap FDO logical class names with their descriptions?</value>
</data>
+ <data name="OdbcConnStrMissingMgPlaceholders" xml:space="preserve">
+ <value>The ODBC connection string requires a %MG_USERNAME% and %MG_PASSWORD% placeholder tokens present</value>
+ </data>
</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list