set context user creator;
verb on;

tcl;
eval {
	# Returns 1 if the given administrative object exists, otherwise 0
	proc adminExists { sAdminType sName } {
		if { $sName == "" } {
			return 1
		}
		if { $sAdminType == "systable" } {
			if { [lsearch [split [mql list table system] "\n"] $sName] == -1} {
				return 0
			}
			return 1
		}
		if { [lsearch [split [mql list $sAdminType] "\n"] $sName] == -1 } {
			return 0
		} else {
			return 1
		}
	}


	# Start transaction
	########################################
	mql start transaction

	# Remove Launchpad commands
	########################################
	set lsCommands {
		"LP-HELIUM-VIEW"	\
		"LP-TVC-Homepage"	\
		"LP-UPS"			\
		"LP-UPS-Navigate"	\
		"LP-EBOM"			\
		"LP-Schedule"		\
		"LP-Bookmarks"		\
	}
	foreach commandName $lsCommands {
		puts -nonewline "Removing command $commandName ..."
		if {[adminExists command $commandName] != 1} {
			puts "Not present."
		} else {
			mql delete command $commandName
			puts "Ok."
		}
	}

	#
	# commit transaction
	puts -nonewline "Commiting transaction ..."
	mql commit transaction
	puts "Ok."
}