Changeset 164

Show
Ignore:
Timestamp:
12/26/05 16:35:28 (3 years ago)
Author:
ogawa
Message:

Improve the user interface by using Javascript.

Location:
mt-db-convert/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • mt-db-convert/trunk/mt-db-convert.cgi

    r141 r164  
    254254<p>Please fill the following:</p> 
    255255 
    256 <form method="post" action="$name"> 
     256<form id="dbconvert" method="post" action="$name"> 
    257257  <fieldset> 
    258258    <legend>Source DB Configuration</legend> 
    259     <dl> 
    260       <dt>DataSource: (Required for BerkeleyDB)</dt> 
    261       <dd><input name="src_DataSource" type="text" value="$src_cfg->{DataSource}" /></dd> 
    262       <dt>ObjectDriver:</dt> 
    263       <dd> 
    264         <select name="src_ObjectDriver"> 
    265           <option value="">Select a driver</option> 
    266           <option value="DBM" $src_sel{'DBM'}>BerkeleyDB</option> 
    267           <option value="DBI::mysql" $src_sel{'DBI::mysql'}>MySQL</option> 
    268           <option value="DBI::postgres" $src_sel{'DBI::postgres'}>PostgreSQL</option> 
    269           <option value="DBI::sqlite" $src_sel{'DBI::sqlite'}>SQLite</option> 
    270         </select> 
    271       </dd> 
    272       <dt>Database:</dt> 
    273       <dd><input name="src_Database" type="text" value="$src_cfg->{Database}" /></dd> 
    274       <dt>DBUser:</dt> 
    275       <dd><input name="src_DBUser" type="text" value="$src_cfg->{DBUser}" /></dd> 
    276       <dt>DBHost:</dt> 
    277       <dd><input name="src_DBHost" type="text" value="$src_cfg->{DBHost}" /></dd> 
    278       <dt>DBPassword:</dt> 
    279       <dd><input name="src_DBPassword" type="password" value="" /></dd> 
    280     </dl> 
     259    <p> 
     260    <label>ObjectDriver:</label><br /> 
     261    <select name="src_ObjectDriver" onchange="refresh_src()"> 
     262      <option value="">Select your source driver</option> 
     263      <option value="DBM" $src_sel{'DBM'}>BerkeleyDB</option> 
     264      <option value="DBI::mysql" $src_sel{'DBI::mysql'}>MySQL</option> 
     265      <option value="DBI::postgres" $src_sel{'DBI::postgres'}>PostgreSQL</option> 
     266      <option value="DBI::sqlite" $src_sel{'DBI::sqlite'}>SQLite</option> 
     267    </select> 
     268    </p> 
     269 
     270    <p> 
     271    <label>DataSource:</label><br /> 
     272    <input name="src_DataSource" type="text" value="$src_cfg->{DataSource}" size="50" /><br /> 
     273    <small>BerkeleyDB requires the full path to your database directory (e.g., $ENV{MT_HOME}db).</small> 
     274    </p> 
     275 
     276    <p> 
     277    <label>Database:</label><br /> 
     278    <input name="src_Database" type="text" value="$src_cfg->{Database}" size="50" /><br /> 
     279    <small>SQLite requires the full path to your SQLite database file (e.g., $ENV{MT_HOME}db/sqlite.db).<br />MySQL and PostgreSQL require the database name.</small> 
     280    </p> 
     281 
     282    <p> 
     283    <label>DBUser:</label><br /> 
     284    <input name="src_DBUser" type="text" value="$src_cfg->{DBUser}" size="50" /><br /> 
     285    <small>MySQL and PostgreSQL require the database user name.</small> 
     286    </p> 
     287 
     288    <p> 
     289    <label>DBPassword:</label><br /> 
     290    <input name="src_DBPassword" type="password" value="" size="50" /><br /> 
     291    <small>MySQL and PostgreSQL require the database user password.</small> 
     292    </p> 
     293 
     294    <p> 
     295    <label>DBHost:</label><br /> 
     296    <input name="src_DBHost" type="text" value="$src_cfg->{DBHost}" size="50" /><br /> 
     297    <small>MySQL and PostgreSQL require the database host name.</small> 
     298    </p> 
    281299  </fieldset> 
    282300 
    283301  <fieldset> 
    284302    <legend>Destination DB Configuration</legend> 
    285     <dl> 
    286       <dt>DataSource: (Required for BerkeleyDB)</dt> 
    287       <dd><input name="dst_DataSource" type="text" value="$dst_cfg->{DataSource}" /></dd> 
    288       <dt>ObjectDriver:</dt> 
    289       <dd> 
    290         <select name="dst_ObjectDriver"> 
    291           <option value="">Select a driver</option> 
    292           <option value="DBM" $dst_sel{'DBM'}>BerkeleyDB</option> 
    293           <option value="DBI::mysql" $dst_sel{'DBI::mysql'}>MySQL</option> 
    294           <option value="DBI::postgres" $dst_sel{'DBI::postgres'}>PostgreSQL</option> 
    295           <option value="DBI::sqlite" $dst_sel{'DBI::sqlite'}>SQLite</option> 
    296         </select> 
    297       </dd> 
    298       <dt>Database:</dt> 
    299       <dd><input name="dst_Database" type="text" value="$dst_cfg->{Database}" /></dd> 
    300       <dt>DBUser:</dt> 
    301       <dd><input name="dst_DBUser" type="text" value="$dst_cfg->{DBUser}" /></dd> 
    302       <dt>DBHost:</dt> 
    303       <dd><input name="dst_DBHost" type="text" value="$dst_cfg->{DBHost}" /></dd> 
    304       <dt>DBPassword:</dt> 
    305       <dd><input name="dst_DBPassword" type="password" value="$dst_cfg->{DBPassword}" /></dd> 
    306     </dl> 
     303    <p> 
     304    <label>ObjectDriver:</label><br /> 
     305    <select name="dst_ObjectDriver" onchange="refresh_dst()"> 
     306      <option value="">Select your destination driver</option> 
     307      <option value="DBM" $dst_sel{'DBM'}>BerkeleyDB</option> 
     308      <option value="DBI::mysql" $dst_sel{'DBI::mysql'}>MySQL</option> 
     309      <option value="DBI::postgres" $dst_sel{'DBI::postgres'}>PostgreSQL</option> 
     310      <option value="DBI::sqlite" $dst_sel{'DBI::sqlite'}>SQLite</option> 
     311    </select> 
     312    </p> 
     313 
     314    <p> 
     315    <label>DataSource:<label><br /> 
     316    <input name="dst_DataSource" type="text" value="$dst_cfg->{DataSource}" size="50" /><br /> 
     317    <small>BerkeleyDB requires the full path to your database directory (e.g., $ENV{MT_HOME}db).</small> 
     318    </p> 
     319 
     320    <p> 
     321    <label>Database:</label><br /> 
     322    <input name="dst_Database" type="text" value="$dst_cfg->{Database}" size="50" /><br /> 
     323    <small>SQLite requires the full path to your SQLite database file (e.g., $ENV{MT_HOME}db/sqlite.db).<br />MySQL and PostgreSQL require the database name.</small> 
     324    </p> 
     325 
     326    <p> 
     327    <label>DBUser:</label><br /> 
     328    <input name="dst_DBUser" type="text" value="$dst_cfg->{DBUser}" size="50" /><br /> 
     329    <small>MySQL and PostgreSQL require the database user name.</small> 
     330    </p> 
     331 
     332    <p> 
     333    <label>DBPassword:</label><br /> 
     334    <input name="dst_DBPassword" type="password" value="" size="50" /><br /> 
     335    <small>MySQL and PostgreSQL require the database user password.</small> 
     336    </p> 
     337 
     338    <p> 
     339    <label>DBHost:</label><br /> 
     340    <input name="dst_DBHost" type="text" value="$dst_cfg->{DBHost}" size="50" /><br /> 
     341    <small>MySQL and PostgreSQL require the database host name.</small> 
     342    </p> 
    307343  </fieldset> 
    308344 
    309345  <p style="clear: both;"><input type="submit" value="Convert" /></p> 
    310346</form> 
     347<script type="text/javascript"> 
     348var f = document.forms['dbconvert']; 
     349function refresh_src() { 
     350  f.src_DataSource.disabled = 'disabled'; 
     351  f.src_Database.disabled = 'disabled'; 
     352  f.src_DBUser.disabled = 'disabled'; 
     353  f.src_DBHost.disabled = 'disabled'; 
     354  f.src_DBPassword.disabled = 'disabled'; 
     355  if (f.src_ObjectDriver.value == 'DBM') { 
     356    f.src_DataSource.disabled = ''; 
     357  } else if (f.src_ObjectDriver.value == 'DBI::mysql' || f.src_ObjectDriver.value == 'DBI::postgres') { 
     358    f.src_Database.disabled = ''; 
     359    f.src_DBUser.disabled = ''; 
     360    f.src_DBHost.disabled = ''; 
     361    f.src_DBPassword.disabled = ''; 
     362  } else if (f.src_ObjectDriver.value == 'DBI::sqlite') { 
     363    f.src_Database.disabled = ''; 
     364  } 
     365} 
     366function refresh_dst() { 
     367  f.dst_DataSource.disabled = 'disabled'; 
     368  f.dst_Database.disabled = 'disabled'; 
     369  f.dst_DBUser.disabled = 'disabled'; 
     370  f.dst_DBHost.disabled = 'disabled'; 
     371  f.dst_DBPassword.disabled = 'disabled'; 
     372  if (f.dst_ObjectDriver.value == 'DBM') { 
     373    f.dst_DataSource.disabled = ''; 
     374  } else if (f.dst_ObjectDriver.value == 'DBI::mysql' || f.dst_ObjectDriver.value == 'DBI::postgres') { 
     375    f.dst_Database.disabled = ''; 
     376    f.dst_DBUser.disabled = ''; 
     377    f.dst_DBHost.disabled = ''; 
     378    f.dst_DBPassword.disabled = ''; 
     379  } else if (f.dst_ObjectDriver.value == 'DBI::sqlite') { 
     380    f.dst_Database.disabled = ''; 
     381  } 
     382} 
     383refresh_src(); 
     384refresh_dst(); 
     385</script> 
    311386HTML 
    312387} 
  • mt-db-convert/trunk/mt-db-convert31.cgi

    r141 r164  
    248248<p>Please fill the following:</p> 
    249249 
    250 <form method="post" action="$name"> 
     250<form id="dbconvert" method="post" action="$name"> 
    251251  <fieldset> 
    252252    <legend>Source DB Configuration</legend> 
    253     <dl> 
    254       <dt>DataSource: (Required for BerkeleyDB)</dt> 
    255       <dd><input name="src_DataSource" type="text" value="$src_cfg->{DataSource}" /></dd> 
    256       <dt>ObjectDriver:</dt> 
    257       <dd> 
    258         <select name="src_ObjectDriver"> 
    259           <option value="">Select a driver</option> 
    260           <option value="DBM" $src_sel{'DBM'}>BerkeleyDB</option> 
    261           <option value="DBI::mysql" $src_sel{'DBI::mysql'}>MySQL</option> 
    262           <option value="DBI::postgres" $src_sel{'DBI::postgres'}>PostgreSQL</option> 
    263           <option value="DBI::sqlite" $src_sel{'DBI::sqlite'}>SQLite</option> 
    264         </select> 
    265       </dd> 
    266       <dt>Database:</dt> 
    267       <dd><input name="src_Database" type="text" value="$src_cfg->{Database}" /></dd> 
    268       <dt>DBUser:</dt> 
    269       <dd><input name="src_DBUser" type="text" value="$src_cfg->{DBUser}" /></dd> 
    270       <dt>DBHost:</dt> 
    271       <dd><input name="src_DBHost" type="text" value="$src_cfg->{DBHost}" /></dd> 
    272       <dt>DBPassword:</dt> 
    273       <dd><input name="src_DBPassword" type="password" value="" /></dd> 
    274     </dl> 
     253    <p> 
     254    <label>ObjectDriver:</label><br /> 
     255    <select name="src_ObjectDriver" onchange="refresh_src()"> 
     256      <option value="">Select your source driver</option> 
     257      <option value="DBM" $src_sel{'DBM'}>BerkeleyDB</option> 
     258      <option value="DBI::mysql" $src_sel{'DBI::mysql'}>MySQL</option> 
     259      <option value="DBI::postgres" $src_sel{'DBI::postgres'}>PostgreSQL</option> 
     260      <option value="DBI::sqlite" $src_sel{'DBI::sqlite'}>SQLite</option> 
     261    </select> 
     262    </p> 
     263 
     264    <p> 
     265    <label>DataSource:</label><br /> 
     266    <input name="src_DataSource" type="text" value="$src_cfg->{DataSource}" size="50" /><br /> 
     267    <small>BerkeleyDB requires the full path to your database directory (e.g., ${MT_DIR}db).</small> 
     268    </p> 
     269 
     270    <p> 
     271    <label>Database:</label><br /> 
     272    <input name="src_Database" type="text" value="$src_cfg->{Database}" size="50" /><br /> 
     273    <small>SQLite requires the full path to your SQLite database file (e.g., ${MT_DIR}db/sqlite.db).<br />MySQL and PostgreSQL require the database name.</small> 
     274    </p> 
     275 
     276    <p> 
     277    <label>DBUser:</label><br /> 
     278    <input name="src_DBUser" type="text" value="$src_cfg->{DBUser}" size="50" /><br /> 
     279    <small>MySQL and PostgreSQL require the database user name.</small> 
     280    </p> 
     281 
     282    <p> 
     283    <label>DBPassword:</label><br /> 
     284    <input name="src_DBPassword" type="password" value="" size="50" /><br /> 
     285    <small>MySQL and PostgreSQL require the database user password.</small> 
     286    </p> 
     287 
     288    <p> 
     289    <label>DBHost:</label><br /> 
     290    <input name="src_DBHost" type="text" value="$src_cfg->{DBHost}" size="50" /><br /> 
     291    <small>MySQL and PostgreSQL require the database host name.</small> 
     292    </p> 
    275293  </fieldset> 
    276294 
    277295  <fieldset> 
    278296    <legend>Destination DB Configuration</legend> 
    279     <dl> 
    280       <dt>DataSource: (Required for BerkeleyDB)</dt> 
    281       <dd><input name="dst_DataSource" type="text" value="$dst_cfg->{DataSource}" /></dd> 
    282       <dt>ObjectDriver:</dt> 
    283       <dd> 
    284         <select name="dst_ObjectDriver"> 
    285           <option value="">Select a driver</option> 
    286           <option value="DBM" $dst_sel{'DBM'}>BerkeleyDB</option> 
    287           <option value="DBI::mysql" $dst_sel{'DBI::mysql'}>MySQL</option> 
    288           <option value="DBI::postgres" $dst_sel{'DBI::postgres'}>PostgreSQL</option> 
    289           <option value="DBI::sqlite" $dst_sel{'DBI::sqlite'}>SQLite</option> 
    290         </select> 
    291       </dd> 
    292       <dt>Database:</dt> 
    293       <dd><input name="dst_Database" type="text" value="$dst_cfg->{Database}" /></dd> 
    294       <dt>DBUser:</dt> 
    295       <dd><input name="dst_DBUser" type="text" value="$dst_cfg->{DBUser}" /></dd> 
    296       <dt>DBHost:</dt> 
    297       <dd><input name="dst_DBHost" type="text" value="$dst_cfg->{DBHost}" /></dd> 
    298       <dt>DBPassword:</dt> 
    299       <dd><input name="dst_DBPassword" type="password" value="$dst_cfg->{DBPassword}" /></dd> 
    300     </dl> 
     297    <p> 
     298    <label>ObjectDriver:</label><br /> 
     299    <select name="dst_ObjectDriver" onchange="refresh_dst()"> 
     300      <option value="">Select your destination driver</option> 
     301      <option value="DBM" $dst_sel{'DBM'}>BerkeleyDB</option> 
     302      <option value="DBI::mysql" $dst_sel{'DBI::mysql'}>MySQL</option> 
     303      <option value="DBI::postgres" $dst_sel{'DBI::postgres'}>PostgreSQL</option> 
     304      <option value="DBI::sqlite" $dst_sel{'DBI::sqlite'}>SQLite</option> 
     305    </select> 
     306    </p> 
     307 
     308    <p> 
     309    <label>DataSource:<label><br /> 
     310    <input name="dst_DataSource" type="text" value="$dst_cfg->{DataSource}" size="50" /><br /> 
     311    <small>BerkeleyDB requires the full path to your database directory (e.g., ${MT_DIR}db).</small> 
     312    </p> 
     313 
     314    <p> 
     315    <label>Database:</label><br /> 
     316    <input name="dst_Database" type="text" value="$dst_cfg->{Database}" size="50" /><br /> 
     317    <small>SQLite requires the full path to your SQLite database file (e.g., ${MT_DIR}db/sqlite.db).<br />MySQL and PostgreSQL require the database name.</small> 
     318    </p> 
     319 
     320    <p> 
     321    <label>DBUser:</label><br /> 
     322    <input name="dst_DBUser" type="text" value="$dst_cfg->{DBUser}" size="50" /><br /> 
     323    <small>MySQL and PostgreSQL require the database user name.</small> 
     324    </p> 
     325 
     326    <p> 
     327    <label>DBPassword:</label><br /> 
     328    <input name="dst_DBPassword" type="password" value="" size="50" /><br /> 
     329    <small>MySQL and PostgreSQL require the database user password.</small> 
     330    </p> 
     331 
     332    <p> 
     333    <label>DBHost:</label><br /> 
     334    <input name="dst_DBHost" type="text" value="$dst_cfg->{DBHost}" size="50" /><br /> 
     335    <small>MySQL and PostgreSQL require the database host name.</small> 
     336    </p> 
    301337  </fieldset> 
    302338 
    303339  <p style="clear: both;"><input type="submit" value="Convert" /></p> 
    304340</form> 
     341<script type="text/javascript"> 
     342var f = document.forms['dbconvert']; 
     343function refresh_src() { 
     344  f.src_DataSource.disabled = 'disabled'; 
     345  f.src_Database.disabled = 'disabled'; 
     346  f.src_DBUser.disabled = 'disabled'; 
     347  f.src_DBHost.disabled = 'disabled'; 
     348  f.src_DBPassword.disabled = 'disabled'; 
     349  if (f.src_ObjectDriver.value == 'DBM') { 
     350    f.src_DataSource.disabled = ''; 
     351  } else if (f.src_ObjectDriver.value == 'DBI::mysql' || f.src_ObjectDriver.value == 'DBI::postgres') { 
     352    f.src_Database.disabled = ''; 
     353    f.src_DBUser.disabled = ''; 
     354    f.src_DBHost.disabled = ''; 
     355    f.src_DBPassword.disabled = ''; 
     356  } else if (f.src_ObjectDriver.value == 'DBI::sqlite') { 
     357    f.src_Database.disabled = ''; 
     358  } 
     359} 
     360function refresh_dst() { 
     361  f.dst_DataSource.disabled = 'disabled'; 
     362  f.dst_Database.disabled = 'disabled'; 
     363  f.dst_DBUser.disabled = 'disabled'; 
     364  f.dst_DBHost.disabled = 'disabled'; 
     365  f.dst_DBPassword.disabled = 'disabled'; 
     366  if (f.dst_ObjectDriver.value == 'DBM') { 
     367    f.dst_DataSource.disabled = ''; 
     368  } else if (f.dst_ObjectDriver.value == 'DBI::mysql' || f.dst_ObjectDriver.value == 'DBI::postgres') { 
     369    f.dst_Database.disabled = ''; 
     370    f.dst_DBUser.disabled = ''; 
     371    f.dst_DBHost.disabled = ''; 
     372    f.dst_DBPassword.disabled = ''; 
     373  } else if (f.dst_ObjectDriver.value == 'DBI::sqlite') { 
     374    f.dst_Database.disabled = ''; 
     375  } 
     376} 
     377refresh_src(); 
     378refresh_dst(); 
     379</script> 
    305380HTML 
    306381}