window:
	res:
		windowType	wstandard
	endres:
endwindow:
close:
	res:
		bitmapPath	$(bitmaps)
		bitmapFile	CLOSE::CBM
	endres:
endclose:
title:
	res:
		leftLabel	ݥݡxxxxxxxxxxפΥݥݾѹ
		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: home_label
		res:
			itemType	button
			label		'ۡݥǥ쥯ȥꡧ'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
		act:
			$(getdir) = getdir
			trap $(getdir) getdir
		endact:
	endditem:
	ditem: home
		res:
			itemType	text
			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		'롡'
			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 '
			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 $(TMP_POPDESK)
		endact:
	endditem:
	ditem: set
		res:
			itemType	button
			fromHoriz	home
			label		' ߡ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			switch $(TMP_SHELL)
				case '':
					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 $(USER_ENV)
				case on:
					switch $(TMP_HOME)
						case '':
							put 2 $(err_no)
							job err
							quit
						case /\*:
							$(etc)/User/Smkhome.sh -c $(TMP_HOME) > $(ERR_LIST)
							put #(status) $(hmstat)
							switch #(hmstat)
								case 0:
									job set
									quit
								default:
									job hmerr
									quit
							endswitch
						default:
							put 3 $(err_no)
							job err
							quit
					endswitch
			endswitch
			job set
		endact:
	endditem:
	ditem: reset
		res:
			itemType	button
			fromVert	set
			fromHoriz	home
			label		'  '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			job reset
		endact:
	endditem:
enddialog:
proc: pre
	$(TMP) = mktemp
	put /tmp/$(TMP) $(ERR_LIST)
	put 0 $(menu_no)
	global $(NEW_HOMEDIR)
	put 0 $(NEW_HOMEDIR)
	put off $(opened)
	put on $(mapped)
endproc:
proc: close
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 10:
			close $(err)
			break
		case 11:
			close $(n_end)
			break
	endswitch
	local $(NEW_HOMEDIR)
	rm -f $(ERR_LIST)
endproc:
proc: open
	setval title leftLabel ݥݡ$(USER_NAME)פΥݥݾѹ
	job curnons
	job reset
endproc:
proc: reset
	setval home string $(NONS_HOME)
	setval shell string $(NONS_SHELL)
	setval popSession selected $(NONS_POPDESK)
	switch $(USER_ENV)
		case on:
			setval popSession sensitive true
			break
		case off:
			setval popSession sensitive false
			break
	endswitch
endproc:
proc: curnons
	$(bin)/Spw_check -ugds $(USER_NAME)
	put $(stdout)@0 $(NONS_GID)
	put $(stdout)@1 $(NONS_HOME)
	put $(stdout)@2 $(NONS_SHELL)
	$(etc)/User/Spopenv.sh check $(USER_NAME)
	switch #(status)
		case 0:
			put on $(NONS_POPDESK)
			break
		default:
			put off $(NONS_POPDESK)
			break
	endswitch
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: set
	switch #(TMP_POPDESK)
		case 0:
			put off $(NONS_POPDESK)
			break
		case 1:
			put on $(NONS_POPDESK)
			break
	endswitch
	job chgproc1
endproc:
proc: err
	put 10 $(menu_no)
	switch #(err_no)
		case 2:
			put 'ȴĶ硢뤤ϴ¸ߤϡ' $(confirm_msg1)
			put 'ۡݥǥ쥯ȥꤷƲ' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 3:
			put 'ۡݥǥ쥯ȥˤ / ǻϤޤѥ̾' $(confirm_msg1)
			put 'ꤷƲ' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 4:
			put '̾ˤϤˤ / ǻϤޤѥ̾' $(confirm_msg1)
			put 'ꤷƲ' $(confirm_msg2)
			$(err) = sub $(commonPath)/error2 ++48++48
			break
		case 5:
			put '$(TMP_SHELL)פ¸ߤޤ' $(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: hmerr
	put 11 $(menu_no)
	switch #(hmstat)
		case 0x100:
			put $(error_dir) < $(ERR_LIST)
			put '$(error_dir)פȤǥ쥯ȥǤʤե뤬¸ߤޤΤǡ' $(confirm_msg1)
			put 'ǥ쥯ȥ$(TMP_HOME)פǤޤ' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			trap $(n_end) n_err
			break
		case 0x300:
			put $(error_dir) < $(ERR_LIST)
			put '$(error_dir)פȤǥ쥯ȥ˽񤭹ߤǤޤΤǡ' $(confirm_msg1)
			put 'ǥ쥯ȥ$(TMP_HOME)פǤޤ' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			trap $(n_end) n_err
			break
		case 0x400:
			put '$(TMP_HOME)פȤǥ쥯ȥ˽񤭹ߤǤޤ' $(confirm_msg1)
			$(n_end) = sub $(commonPath)/error1 ++48++48
			trap $(n_end) n_err
			break
	endswitch
	buzzer
endproc:
proc: n_err
	put off $(ONRUN)
	put 0 $(menu_no)
endproc:
##################
proc: chgproc1
	switch $(USER_ENV)
		case off:
			job chgproc2
			quit
	endswitch
	switch $(TMP_HOME)
		case $(NONS_HOME):
			break
		default:
			$(etc)/Common/Smkdir.sh -e / $(TMP_HOME)
			switch #(status)
				case 0:
					put 2 $(menu_no)
					$(home) = sub $(menu)/home_exist ++48++48
					trap $(home) home_end
					quit
			endswitch
			break
	endswitch
	job chgproc2
endproc:
proc: chgproc2
	put on $(ONRUN)
	put 101 $(menu_no)
	$(onrun) = sub $(commonPath)/onrun ++48++48
	$(pid) = bg $(etc)/User/Spasswd.sh chg $(USER_NAME) $(USER_NAME) $(USER_ID) $(USER_ENV) $(NONS_GID) $(TMP_HOME) $(TMP_SHELL) $(NONS_POPDESK) $(NEW_HOMEDIR) $(MAIL_MODE)
	$(bgstat) = trap $(pid) exec_end
endproc:
proc: home_end
	put 0 $(menu_no)
	switch #(NEW_HOMEDIR)
		case 0:
			quit
	endswitch
	job chgproc2
endproc:
proc: exec_end
	buzzer $(main)
	close $(onrun)
	switch $(mapped)
		case on:
			job bgdone
			break
		case off:
			put on $(opened)
			break
	endswitch
	put 102 $(menu_no)
endproc:
proc: unmap
	switch #(menu_no)
		case 1:
			unmap $(nonstand)
			break
		case 2:
			unmap $(home)
			break
		case 10:
			unmap $(err)
			break
		case 11:
			unmap $(n_end)
			break
		case 101:
			unmap $(onrun)
			break
		case 102:
			unmap $(n_end)
			break
	endswitch
	put off $(mapped)
endproc:
proc: map
	switch #(menu_no)
		case 1:
			raise $(nonstand)
			map $(nonstand)
			break
		case 2:
			raise $(home)
			map $(home)
			break
		case 10:
			move $(err)
			raise $(err)
			map $(err)
			break
		case 11:
			move $(n_end)
			raise $(n_end)
			map $(n_end)
			break
		case 101:
			move $(onrun)
			raise $(onrun)
			map $(onrun)
			break
		case 102:
			switch $(opened)
				case on:
					job bgdone
					break
				case off:
					move $(n_end)
					raise $(n_end)
					map $(n_end)
					break
			endswitch
	endswitch
	put on $(mapped)
	put off $(opened)
endproc:
proc: title
	job move
	job up
endproc:
proc: raise
	job up
endproc:
proc: move
	switch #(menu_no)
		case 10:
			move $(err)
			break
		case 11:
			move $(n_end)
			break
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		case 10:
			raise $(err)
			break
		case 11:
			raise $(n_end)
			break
		case 101:
			raise $(onrun)
			break
		case 102:
			raise $(n_end)
			break
	endswitch
endproc:
proc: bgdone
	switch #(bgstat)
		case 0:
			$(n_end) = sub $(commonPath)/normalEnd ++48++48
			break
		case 0x100:
			put 'ۡݥǥ쥯ȥ꤬ǤޤǤ' $(confirm_msg1)
			put 'ݥݤѹϤޤǤ' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			break
		case 0x200:
			put 'ۡݥǥ쥯ȥΥԡ桢ݤȯޤ' $(confirm_msg1)
			put 'ݥݤѹϤޤǤ' $(confirm_msg2)
			$(n_end) = sub $(commonPath)/error2 ++48++48
			break
	endswitch
	trap $(n_end) n_end
endproc:
proc: n_end
	put off $(ONRUN)
	put 0 $(menu_no)
	job close
endproc:
