;***** SETUP JOTI-IRC ******
alias startsetup {
	/__resetinfo
	/dialog -m setup2 setup2
}

alias __resetinfo {
	if (%setup.joti.naam == $null) {
		/set %setup.joti.naam $null
		/set %setup.joti.email info@jota-joti.nl
		/set %setup.joti.weburl https://www.facebook.com/JOTAJOTINL/
		/set %setup.joti.woonplaats $null
		/set %setup.joti.deelname JOTI
		/set %setup.joti.jid $null
		/set %setup.joti.call $null
		/set %setup.joti.qth $null
		/set %setup.joti.avatar $null
		/set %setup.joti.prefix $null
		/set %setup.joti.localadmin $null
	}
}


dialog setup2 {
  title "Welcome to the setup of JOTI-IRC"
  size -1 -1 400 600
  icon 1, 1 1 400 188, $adiircdir\pix\banner2A.jpg
  text "Please enter the information below",2, 10 195 200 25
  text "Your name or troop name",3, 10 220 175 25
  edit "%setup.joti.naam",4, 190 220 200 20, limit 120
  text "Your E-mail address",5, 10 245 175 25
  edit "%setup.joti.email",6, 190 245 200 20, limit 120
  text "Facebook or troop website",7, 10 270 175 25
  edit "%setup.joti.weburl",8, 190 270 200 20, limit 120
  text "City",9, 10 295 175 25
  edit "%setup.joti.woonplaats",10, 190 295 200 20
  text "Avatar or logo url",11,10 320 175 25
  edit "%setup.joti.avatar",12,190 320 200 20  
  text "Nickname prefix",13,10 345 175 25
  edit "%setup.joti.prefix",14,190 345 200 20  
  text "Local administrator name",15,10 370 175 25
  edit "%setup.joti.localadmin",16,190 370 200 20  
 

  text "Participation",17, 10 400 175 25
  combo 18,190 400 120 140,drop 
  
  text "JOTI identification (JID)",19, 10 425 175 25
  edit "%setup.joti.jid",20, 190 425 200 20
  text "(please find it on your registration)",21, 10 450 390 25
  text "If you are participating with JOTA:",22,10 480 390 25
  text "JOTA Call",23, 10 505 150 25
  edit "%setup.joti.call",24, 190 505 200 20
  text "QTH locator",25, 10 530 175 25
  edit "%setup.joti.qth",26, 190 530 200 20
  
  button "Store",100, 130 570 100 25, OK
}

on *:DIALOG:setup2:init:0: { 
  /did -a setup2 18 JOTA-JOTI 
  /did -a setup2 18 JOTI 
  /did -a setup2 18 JOTA
  /did setup2 18 %setup.joti.deelname)
} 

On *:DIALOG:setup2:sclick:100: {
	/set %setup.joti.naam $did(setup2,4).text
	/set %setup.joti.email $did(setup2,6).text
	/set %setup.joti.weburl $did(setup2,8).text
	/set %setup.joti.woonplaats $did(setup2,10).text
	/set %setup.joti.avatar $did(setup2,12).text
	/set %setup.joti.prefix $did(setup2,14).text
	/set %setup.joti.localadmin $did(setup2,16).text
	/set %setup.joti.deelname $did(setup2,18).text
	/set %setup.joti.jid $did(setup2,20).text
	/set %setup.joti.call $did(setup2,24).text
	/set %setup.joti.qth $did(setup2,26).text
	/dialog -x setup2
	var %dorepeat = 0
	
	if (%setup.joti.naam == $null) {
		%dorepeat = 1
		/echo -sg Your name or troop name is mandatory
	}
	
	if ( ( %setup.joti.localadmin != $null) && (%setup.joti.prefix == $null) ) {
		%dorepeat = 1
		/echo -sg if you have filled in a local administrator, a nickname prefix is mandatory
	}
	
	if ( ( (%setup.joti.deelname == JOTA) || (%setup.joti.deelname == JOTA-JOTI) ) && (%setup.joti.call == $null)) {
		%dorepeat = 1
		/echo -sg if you participate with JOTA, at least the JOTA Call is mandatory
	}

	if ( %dorepeat == 1) {
		/dialog -m setup2 setup2
	} else {
		
		if (%setup.joti.localadmin != $null) {
			/set %setup.joti.mode group
		} else {
			/set %setup.joti.mode single
		}
		
		if (%setup.joti.mode == group) {
			/set %tmp.herstart Joti IRC will now be closed so you can copy the folder to other stations.
		} else {
			/set %tmp.herstart Joti IRC will now be retarted to activate the changes.
		}
  	/dialog -m setup3 setup3
  }
}

On *:DIALOG:setup2:sclick:101: {
	/dialog -x setup2
  /dialog -m setup1 setup1
}

dialog setup3 {
  title "Welcome to the setup of JOTI-IRC"
  size -1 -1 400 280
  icon 1, 1 1 400 188, $adiircdir\pix\banner11A.jpg
  text "Setup is complete",3, 15 195 300 175
  text "%tmp.herstart",4, 15 220 380 175
  button "START",5, 150 250 100 25, OK 
}

on *:DIALOG:setup3:sclick:5: {
	/unset %tmp.tekst1
	/unset %tmp.herstart
	if (%tmp.joti.mode == group) {
  	/exit -n
  } else {
  	/exit -rn
  }
}

