window:
	res:
		windowType	wstandard
	endres:
endwindow:
close:
	res:
		bitmapPath	$(bitmaps)
		bitmapFile	CLOSE::CBM
	endres:
endclose:
title:
	res:
		leftLabel	'Setup of Default User Information'
		leftKanjiFont	$(kanjiFont)
		leftFont	$(kanaFont)
		switch $(COLOR)
			case MONO:
				bitmapPath	$(bitmaps)
				backgroundFile	GRAY3
				transparent	false
				break
		endswitch
	endres:
endtitle:
dialog: dialogs
	res:
		defaultDistance		#(fWidth)
		dialogType		modeless
	endres:
	ditem: gid_label
		res:
			itemType	bitmap
			label		'Group ID          : '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: gid
		res:
			itemType	numtext
			fromHoriz	gid_label
			vertDistance	#(fWidth)
			horizDistance	4
			length		5
			height		#(fHeight)
			width		#(fWidth)*5+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(TMP_GID)
		endact:
	endditem:
	ditem: grp_list
		res:
			itemType	scrtext
			fromVert	gid_label
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
			width		#(fWidth)+1*26
			height		#(lHeight)*6+8
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		select1
			bind2		select2
			file		/dev/null
		endres:
		act:
			put $(line)
			put $(line)@1 $(TMP_GID1)
		endact:
	endditem:
	ditem: select
		res:
			itemType	button
			fromVert	gid_label
			fromHoriz	grp_list
			vertDistance	#(fWidth)*10
			horizDistance	#(fWidth)
			label		' Select '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
		endres:
		act:
			job select
		endact:
	endditem:
	ditem: home_label
		res:
			itemType	button
			fromVert	grp_list
			label		'Home directory    : '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			$(getdir) = getdir
			trap $(getdir) getdir
		endact:
	endditem:
	ditem: home
		res:
			itemType	text
			fromVert	grp_list
			fromHoriz	home_label
			vertDistance	#(fWidth)
			horizDistance	4
			length		32
			height		#(fHeight)
			width		#(fWidth)*32+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(TMP_HOME)
			put $(TMP_HOME)@0 $(TMP_HOME)
		endact:
	endditem:
	ditem: shell_label
		res:
			itemType	button
			fromVert	home_label
			label		'Shell             : '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			$(getfile) = getfile
			trap $(getfile) getfile
		endact:
	endditem:
	ditem: shell
		res:
			itemType	text
			fromVert	home_label
			fromHoriz	home_label
			vertDistance	#(fWidth)
			horizDistance	4
			length		32
			height		#(fHeight)
			width		#(fWidth)*32+4
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			shadowWidth	0
			borderWidth	2
			focus
		endres:
		act:
			put $(TMP_SHELL)
			put $(TMP_SHELL)@0 $(TMP_SHELL)
		endact:
	endditem:
	ditem: popSession
		res:
			itemType	check
			fromVert	shell_label
			label		'NEWS Desk use'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			selected	on
			shadowWidth	0
			switch $(COLOR)
				case MONO:
					background	white
					foreground	black
					highlightBack	white
					highlightFore	black
					selectedBack	white
					selectedFore	black
					selhighBack	white
					break
				default:
					background	#c5c5c5
					highlightBack	#c5c5c5
					selectedBack	#c5c5c5
					break
			endswitch
		endres:
		act:
			put $(popdesk)
		endact:
	endditem:
	ditem: set
		res:
			itemType	button
			fromHoriz	gid
			label		' Set '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*15
		endres:
		act:
			switch $(TMP_SHELL)
				case '':
					put no_shell $(TMP_SHELL)
					break
				case /\*:
					test -f $(TMP_SHELL)
					switch #(status)
						case 0:
							break
						default:
							put 5 $(err_no)
							job err
							quit
					endswitch
					break
				default:
					put 4 $(err_no)
					job err
					quit
			endswitch
			switch #(popdesk)
				case 0:
					put off $(TMP_POPDESK)
					break
				case 1:
					put on $(TMP_POPDESK)
					break
			endswitch
			switch $(TMP_HOME)
				case '':
					put 2 $(err_no)
					job err
					quit
				case /\*:
					break
				default:
					put 3 $(err_no)
					job err
					quit
			endswitch
			put on $(ONRUN)
			put 101 $(menu_no)
			$(onrun) = sub $(commonPath)/onrun ++48++48
			$(pid) = bg $(etc)/User/Smkhome.sh -m $(TMP_HOME) > $(ERR_LIST)
			$(bgstat) = trap $(pid) cmd_end
		endact:
	endditem:
	ditem: reset
		res:
			itemType	button
			fromVert	set
			fromHoriz	gid
			label		' Undo '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*15
		endres:
		act:
			job reset
		endact:
	endditem:
enddialog:
proc: pre
	$(TMP) = mktemp
	put /tmp/$(TMP) $(LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(ERR_LIST)
	put 0 $(menu_no)
	$(bin)/Sgrp_check -lgi -o $(LIST)
	test -f $(USER_SKEL)
	switch #(status)
		case 0:
			break
		default:
			put '31 /home /bin/csh on' > $(USER_SKEL)
	endswitch
	put $(line) < $(USER_SKEL)
	put $(line)@0 $(CUR_GID)
	put $(line)@1 $(CUR_HOME)
	put $(line)@2 $(CUR_SHELL)
	switch $(CUR_SHELL)
		case no_shell:
			put '' $(CUR_SHELL)
	endswitch
	put $(line)@3 $(CUR_POPDESK)
	put on $(mapped)
	put off $(opened)
endproc:
proc: close
	switch $(ONRUN)
		case on:
			quit
	endswitch
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			close $(err)
	endswitch
	rm -f $(LIST) $(ERR_LIST)
endproc:
proc: open
	setval grp_list file $(LIST)
	setval select sensitive false
	job reset
endproc:
proc: reset
	setval gid string $(CUR_GID)
	setval home string $(CUR_HOME)
	setval shell string $(CUR_SHELL)
	setval popSession selected $(CUR_POPDESK)
endproc:
proc: select1
	switch $(TMP_GID1)
		case '':
			quit
	endswitch
	setval select sensitive true
endproc:
proc: select2
	switch $(TMP_GID1)
		case '':
			quit
	endswitch
	setval select selected true
	job select
	setval select selected false
endproc:
proc: select
	setval gid string $(TMP_GID1)
endproc:
proc: getdir
	switch #(pg_stat)
		case 0:
			setval home string $(pg_path)
			break
	endswitch
endproc:
proc: getfile
	switch #(pg_stat)
		case 0:
			setval shell string $(pg_path)
			break
	endswitch
endproc:
proc: cmd_end
	close $(onrun)
	buzzer $(main)
	switch $(mapped)
		case on:
			job bgdone
			break
		case off:
			put on $(opened)
			break
	endswitch
	put 102 $(menu_no)
endproc:
proc: err
	put #(err_no) $(menu_no)
	switch #(err_no)
		case 1:
			put 'Range of group ID is 0-32767 !!' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 2:
			put 'Specify home directory !!' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 3:
			put 'Home directory must the pass name which start with / !!' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 4:
			put 'Shell name must the pass name which start with / !!' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
		case 5:
			put 'Shell "$(TMP_SHELL)" does not exist !!' $(confirm_msg1)
			$(err) = sub $(commonPath)/error1 ++48++48
			break
	endswitch
	buzzer
	trap $(err) err_end
endproc:
proc: err_end
	put 0 $(menu_no)
endproc:
proc: bgdone
	switch #(bgstat)
		case 0:
			put '$(TMP_GID) $(TMP_HOME) $(TMP_SHELL) $(TMP_POPDESK)' > $(USER_SKEL)
			$(n_end) = sub $(commonPath)/normalEnd ++48++48
			trap $(n_end) n_end
			break
		case 0x100:
			put $(error_dir) < $(ERR_LIST)
			put 'Not directory file "$(error_dir)" exists.' $(confirm_msg1)
			put 'Cannot make directory "$(TMP_HOME)" !!' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			trap $(n_end) n_err
			break
		case 0x200:
			put $(error_dir) < $(ERR_LIST)
			put 'Cannot make directory "$(error_dir)" !!' $(confirm_msg1)
			$(n_end) = sub $(commonPath)/error1 ++48++48
			trap $(n_end) n_err
			break
		case 0x300:
			put $(error_dir) < $(ERR_LIST)
			put 'Cannot write to the directory "$(error_dir)".' $(confirm_msg1)
			put 'Cannot make directory "$(TMP_HOME)" !!' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			trap $(n_end) n_err
			break
		case 0x400:
			put 'Cannot write to the directory "$(TMP_HOME)".' $(confirm_msg1)
			$(n_end) = sub $(commonPath)/error1 ++48++48
			trap $(n_end) n_err
			break
	endswitch
endproc:
proc: n_err
	put off $(ONRUN)
	put 0 $(menu_no)
endproc:
proc: n_end
	put off $(ONRUN)
	put 0 $(menu_no)
	job off
	close
endproc:
proc: unmap
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			unmap $(err)
			break
		case 101:
			unmap $(onrun)
			break
		case 102:
			unmap $(n_end)
			break
	endswitch
endproc:
proc: map
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			move $(err)
			raise $(err)
			map $(err)
			break
		case 101:
			move $(onrun)
			raise $(onrun)
			map $(onrun)
			break
		case 102:
			move $(n_end)
			raise $(n_end)
			map $(n_end)
			break
	endswitch
endproc:
proc: title
	job move
	job up
endproc:
proc: raise
	job up
endproc:
proc: move
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			move $(err)
			break
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			raise $(err)
			break
		case 101:
			raise $(onrun)
			break
		case 102:
			raise $(n_end)
			break
	endswitch
endproc:
