Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.Frontier.tools.isEnabled
on isEnabled (f) {
<<Return true if a Tool is enabled, false otherwise. Tools are disabled when:
<<1. There is a top-level item in the gdb named #enabled.
<<2. #enabled is false.
<<01/05/01; 5:12:27 PM by PBS
<<Changes
<<10/7/01; 8:34:11 PM by JES
<<Respect the flEnabled flag in the tool's user table.
local (flEnabled = true);
if not (file.exists (f)) { //it's an error if the Tool doesn't exist
scriptError ("Can't determine if " + file.FileFromPath (f) + " is enabled because it doesn't exist.")};
on checkBoolean () {
local (toolName = Frontier.tools.cleanToolName (file.fileFromPath (f)));
if defined (user.tools.databases.[toolName]) {
if not defined (user.tools.databases.[toolName].flEnabled) {
user.tools.databases.[toolName].flEnabled = true};
if not user.tools.databases.[toolName].flEnabled {
return (false)}};
if defined ([f].["#enabled"]) {
if not ([f].["#enabled"]) {
if defined (user.tools.databases.[toolName]) {
user.tools.databases.[toolName].flEnabled = false};
return (false)}};
return (true)};
if not defined ([f]) { //is the gdb open?
fileMenu.open (f, true); //open hidden
flEnabled = checkBoolean ();
if not flEnabled {
fileMenu.close (f)}} //close it, it's not enabled
else {
flEnabled = checkBoolean ()};
return (flEnabled)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.