#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG  				#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2011 Christopher Bratusek		#
#							#
#########################################################

wizard_user ()
{
	whiptail --title $"personal infos" --msgbox $"Next follow some options asking your for personal informations (real name, birthday, mail-address)." 12 85

	user_name=$(whiptail --title $"username" --inputbox $"Enter your real name (name and surname)
This info is mainly used by the Owner-field of .dirinfo files:" 12 85 "$(wizard_get user_real_name)" 3>&1 1>&2 2>&3)

	if [[ $user_name != "" ]]; then
		wizard_set user_real_name $user_name
	fi

	user_bday=$(whiptail --title $"birthday" --inputbox $"Enter your birthday in MM-DD (eg 12-24) format.
(You'll see what happens):" 12 85 "$(wizard_get user_birthday)" 3>&1 1>&2 2>&3)

	if [[ $user_bday != "" ]]; then
		wizard_set user_birthday $user_bday
	fi

	user_location=$(whiptail --title $"location" --inputbox $"Enter your location in CITY COUNTRY (eg Berlin Deutschland) format." 12 85 "$(wizard_get user_location)" 3>&1 1>&2 2>&3)

	if [[ $user_location != "" ]]; then
		wizard_set user_location "( $user_location )"
	fi

	user_mail=$(whiptail --title $"mail" --inputbox $"Enter your mail-address." 12 85 "$(wizard_get user_mail)" 3>&1 1>&2 2>&3)

	if [[ $user_mail != "" ]]; then
		wizard_set user_mail $user_mail
	fi

	user_level=$(whiptail --title $"userlevel" --menu $"Choose your userlevel" 12 85 3 1 novice 2 user 3 expert 3>&1 1>&2 2>&3)

	case $user_level in

		1) xlevel="novice" ;;
		2) xlevel="average" ;;
		3) xlevel="expert" ;;

	esac

	wizard_set user_level $xlevel
}
