/*
  update

*!  VERSION 1.0.0  27jun2011

*/

VERSION 12.0
MODAL
INCLUDE _std_small
POSITION . . _dlgwd 200
OK ok1, label("OK")
CANCEL can1, label("Cancel")

HELP hlp1, view("help update")
RESET res1

DIALOG main, label("update - Check for official updates")		///
	tabtitle("Main")
BEGIN
  RADIO     rb_official	_lft	20	_iwd	., 			///
	first								///
	label("From http://www.stata.com")				///
	onclickon(main.br_open.disable)
  RADIO     rb_alt	@	+23	@	.,			///
	last								///
	label("From alternate location:")				///
	onclickon(main.br_open.enable)
  BROWSE    br_open	+20	+20	-20	.,			///
	error("From alternate location") label("Browse...") directory

  GROUPBOX  gb_box	_lft	+40	_iwd	80,
  TEXTBOX   tx_note	_ilft	+20	_inwd	_tb2,			///
	label("If you cannot access the web from within"		///
	"Stata, you can manually download updates from the link below.")
  HLINK     br_download @	+30	@	.,			///
	label("click here for manual download") 			///
	onpush(view browser www.stata.com/support/updates)
END

PROGRAM check_updates
BEGIN
	if (main.rb_alt) {
		require main.br_open
		put `"update from ""'
		put main.br_open
		put `"""'
	}
	else {
		put "update from http://www.stata.com"
	}
END

PROGRAM command
BEGIN
	put /program check_updates
END
