tazpanel rev 261

installer.cgi: fix validate update
author Dominique Corbex <domcox@slitaz.org>
date Sun Mar 04 08:52:46 2012 +0100 (2012-03-04)
parents 287584977263
children 8eb0c310c78c
files installer.cgi
line diff
     1.1 --- a/installer.cgi	Sat Mar 03 12:14:00 2012 +0100
     1.2 +++ b/installer.cgi	Sun Mar 04 08:52:46 2012 +0100
     1.3 @@ -7,7 +7,7 @@
     1.4  # Authors : Dominique Corbex <domcox@slitaz.org>
     1.5  #
     1.6  
     1.7 -VERSION=0.25
     1.8 +VERSION=0.26
     1.9  
    1.10  # Common functions from libtazpanel
    1.11  . lib/libtazpanel
    1.12 @@ -539,6 +539,48 @@
    1.13  EOT
    1.14  }
    1.15  
    1.16 +validate()
    1.17 +{
    1.18 +	case $1 in
    1.19 +		install)
    1.20 +			cat << EOT
    1.21 +<script type="text/javascript">
    1.22 +	function SubmitForm() {
    1.23 +		if (false == checkHostname()) {
    1.24 +			alert("Hostname error");
    1.25 +		} else if (false == checkRootPwd()) {
    1.26 +			alert("Root password error");
    1.27 +		} else if (false == checkUserLogin()) {
    1.28 +			alert("User login error");
    1.29 +		} else if (false == checkUserPwd()) {
    1.30 +			alert("User password error");
    1.31 +		} else {
    1.32 +			var r=confirm("$(gettext "Do you really want to continue?")");
    1.33 +			if (r==true)
    1.34 +			{
    1.35 +				document.ConfigForm.submit();
    1.36 +			}
    1.37 +		}
    1.38 +	}
    1.39 +</script>
    1.40 +EOT
    1.41 +		;;
    1.42 +		upgrade)
    1.43 +			cat << EOT
    1.44 +<script>
    1.45 +	function SubmitForm() {
    1.46 +		var r=confirm("$(gettext "Do you really want to continue?")");
    1.47 +		if (r==true)
    1.48 +		{
    1.49 +			document.ConfigForm.submit();
    1.50 +		}
    1.51 +	}
    1.52 +</script>
    1.53 +EOT
    1.54 +		;;
    1.55 +	esac
    1.56 +}
    1.57 +
    1.58  moveto_page()
    1.59  {
    1.60  	case $1 in
    1.61 @@ -558,25 +600,6 @@
    1.62  			title2=$(gettext "Back to Installer Start Page") ;;
    1.63  	esac
    1.64  	cat <<EOT
    1.65 -<script type="text/javascript">
    1.66 -	function SubmitForm() {
    1.67 -		if (false == checkHostname()) {
    1.68 -			alert("Hostname error");
    1.69 -		} else if (false == checkRootPwd()) {
    1.70 -			alert("Root password error");
    1.71 -		} else if (false == checkUserLogin()) {
    1.72 -			alert("User login error");
    1.73 -		} else if (false == checkUserPwd()) {
    1.74 -			alert("User password error");
    1.75 -		} else {
    1.76 -			var r=confirm("$(gettext "Do you really want to continue?")");
    1.77 -			if (r==true)
    1.78 -			{
    1.79 -				document.ConfigForm.submit();
    1.80 -			}
    1.81 -		}
    1.82 -	}
    1.83 -</script>
    1.84  <hr />
    1.85  <input type="hidden" name="page" value="$2" />
    1.86  <a class="button" value="$1"  href="$SCRIPT_NAME?page=$1" >$title1</a>
    1.87 @@ -693,6 +716,7 @@
    1.88  		xhtml_header
    1.89  		form_start
    1.90  		display_action install
    1.91 +		validate install
    1.92  		read_setup
    1.93  		select_source
    1.94  		select_partition
    1.95 @@ -708,6 +732,7 @@
    1.96  		xhtml_header
    1.97  		form_start
    1.98  		display_action upgrade
    1.99 +		validate upgrade
   1.100  		read_setup
   1.101  		select_source
   1.102  		select_old_slitaz