[wix-users] UI cleanup...

Lewis Henderson henderso at opentext.com
Tue Apr 5 08:33:07 PDT 2016

Hi People,

I'm sorry if this post gets a little long, but I've got a messy dialog interaction, and I was wondering if anyone with more experience can provide a neater means of doing the same thing.

First, the "internal" dialog could disable "Next" if the password field is empty, but that means that the user must fill in the password, then tab to "Back" before "Next" is enabled, and our UI people want to just enter the password and click "Next".  All of the other stuff is validation, but I'd like to know if there's a better way of doing this.

Now, here is the "internal" dialog fragment:


      <Dialog Id="WebDlg" Width="370" Height="270" Title="!(loc.GenericDlg_Title)">
        <Control Id="Prompt" Type="Text" X="45" Y="60" Width="280" Height="20" TabSkip="no" Text="!(loc.WebDlgPrompt)" />
        <Control Id="LocaleText" Type="Text" X="45" Y="92" Width="75" Height="15" TabSkip="no" Text="!(loc.WebDlgLang)" />
        <Control Id="Locale" Type="ComboBox" X="125" Y="90" Width="55" Height="18" Sorted="yes" Property="HOST_LANG" Text="English">
          <ComboBox Property="HOST_LANG">
            <ListItem Value="English" />
            <ListItem Value="German" />
            <ListItem Value="French" />
        <Control Id="VersionText" Type="Text" X="195" Y="92" Width="75" Height="15" TabSkip="no" Text="!(loc.WebDlgVersion)" />
        <Control Id="Version" Type="ComboBox" X="275" Y="90" Width="55" Height="18" Sorted="yes" Property="VERSION">
          <ComboBox Property="VERSION">
            <ListItem Value="1.3" />
            <ListItem Value="1.2" />
            <ListItem Value="1.1" />
            <ListItem Value="1.0" />
        <Control Id="TypeText" Type="Text" X="45" Y="112" Width="75" Height="15" TabSkip="no" Text="!(loc.WebDlgType)" />
        <Control Id="HostType" Type="ComboBox" X="125" Y="110" Width="75" Height="18" Sorted="yes" Property="HOST_TYPE">
          <ComboBox Property="HOST_TYPE">
            <ListItem Value="Windows" />
            <ListItem Value="Unix/Linux" />
            <ListItem Value="VMS" />
        <Control Id="NameText" Type="Text" X="45" Y="132" Width="75" Height="15" TabSkip="no" Text="!(loc.WebDlgName)" />
        <Control Id="HostName" Type="Edit" X="125" Y="130" Width="205" Height="18" Property="HOST_NAME" Text="{80}" />
        <Control Id="PortText" Type="Text" X="45" Y="152" Width="75" Height="15" TabSkip="no" Text="!(loc.WebDlgPort)" />
        <Control Id="HostPort" Type="MaskedEdit" X="125" Y="150" Width="205" Height="18" Property="HOST_PORT" Text="#####" />
        <Control Id="UserText" Type="Text" X="45" Y="172" Width="75" Height="15" TabSkip="no" Text="!(loc.WebDlgUser)" />
        <Control Id="HostUser" Type="Edit" X="125" Y="170" Width="205" Height="18" Property="HOST_USER" Text="{80}" />
        <Control Id="PwdText" Type="Text" X="45" Y="192" Width="75" Height="15" TabSkip="no" Text="!(loc.WebDlgPwd)" />
        <Control Id="HostPwd" Type="Edit" X="125" Y="190" Width="205" Height="18" Password="yes" Property="HOST_PWD" Text="{80}" />
        <Control Id="PwdEnc" Type="CheckBox" X="45" Y="210" Width="135" Height="18" CheckBoxValue="1" Property="PWD_FLAG" Text="!(loc.WebDlgPwdEnc)" />
        <Control Id="PktEnc" Type="CheckBox" X="195" Y="210" Width="135" Height="18" CheckBoxValue="1" Property="PKT_FLAG" Text="!(loc.WebDlgPktEnc)">
          <Condition Action="disable">HOST_TYPE="VMS"</Condition>
          <Condition Action="hide">HOST_TYPE="VMS"</Condition>
          <Condition Action="enable"><![CDATA[HOST_TYPE<>"VMS"]]></Condition>
          <Condition Action="show"><![CDATA[HOST_TYPE<>"VMS"]]></Condition>

        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
       <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
          <Condition Action="disable"><![CDATA[HOST_NAME="" OR HOST_USER=""]]></Condition>
          <Condition Action="enable"><![CDATA[HOST_NAME<>"" AND HOST_USER<>""]]></Condition>
          <Publish Order="1" Property="HOST_LOCALE" Value="de">HOST_LANG="German"</Publish>
          <Publish Order="2" Property="HOST_LOCALE" Value="fr">HOST_LANG="French"</Publish>
          <Publish Order="3" Property="HOST_LOCALE" Value="en"><![CDATA[HOST_LANG<>"German" AND HOST_LANG<>"French"]]></Publish>
          <Publish Order="4" Property="PWD_ENCRYPT" Value="NONE"><![CDATA[PWD_FLAG<>"1"]]></Publish>
          <Publish Order="5" Property="PWD_ENCRYPT" Value="BASIC">PWD_FLAG="1"</Publish>
          <Publish Order="6" Property="PKT_ENCRYPT" Value="NONE"><![CDATA[HOST_TYPE="VMS" OR OPI_FLAG<>"1"]]></Publish>
          <Publish Order="7" Property="PKT_ENCRYPT" Value="BASIC">NOT HOST_TYPE="VMS" AND OPI_FLAG="1"</Publish>
          <Publish Order="8" Property="PORT_CHECK" Value="HOST_PORT">1</Publish>
          <Publish Order="9" Event="DoAction" Value="ValidatePort">1</Publish>
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>

A couple of notes here: as coded here, packet encryption isn't supported on VMS, so there are conditions for that.  Also, the HOST_LANG is mapped to HOST_LOCALE.  Finally, the ValidatePort CA uses the property named in PORT_CHECK, validates it, and returns property PORT_VALID="1" if it's OK.

Now for the part of the UI that calls this mess:

      <Publish Dialog="WebDlg" Control="Back" Event="NewDialog" Value="{previous_dialog}">1</Publish>
      <!-- The Order for the Next button starts with "12", since WebDlg already has several Next publications -->
      <Publish Dialog="WebDlg" Control="Next" Order="12" Event="SpawnDialog" Value="InvalidPortDlg"><![CDATA[PORT_VALID<>"1"]]></Publish>
      <Publish Dialog="WebDlg" Control="Next" Order="13" Event="SpawnDialog" Value="InvalidPwdDlg">HOST_PWD=""</Publish>
      <Publish Dialog="WebDlg" Control="Next" Order="14" Property="PWD_CHECK" Value="HOST_PWD"> PORT_VALID="1" AND NOT HOST_PWD="" AND PWD_ENCRYPT="BASIC"</Publish>
      <Publish Dialog="WebDlg" Control="Next" Order="15" Property="PWD_MODE" Value="Encode"> PORT_VALID="1" AND NOT HOST_PWD="" AND PWD_ENCRYPT="BASIC"</Publish>
      <Publish Dialog="WebDlg" Control="Next" Order="16" Event="DoAction" Value="HandlePwd"> PORT_VALID="1" AND NOT HOST_PWD="" AND PWD_ENCRYPT="BASIC"</Publish>
      <Publish Dialog="WebDlg" Control="Next" Order="17" Event="NewDialog" Value="{next dialog}"> PORT_VALID="1" AND NOT HOST_PWD=""</Publish>

Another note for this: the HandlePwd CA looks at the property named by PWD_CHECK and encrypts/decrypts it based on the PWD_MODE property, returning the processed value in the original property, but only if PWD_ENCRYPT was set to "BASIC" in the WebDlg dialog.

What I'd like to know is if there is a cleaner way to do all of this, or if more can be done within the WebDlg dialog rather than falling out into the main UI?  I think the encryption must remain as it is, or the "Back"/"Next" processing will mess it up (and yes, I do decode the password again if the sequence goes back to WebDlg).

Thanks for looking this over and for any suggestions.

                                                                Lewis Henderson
                                                                OpenText, Inc.

More information about the wix-users mailing list