modules.bas at [7348021f6d]

File core/modules.bas artifact 247033a571 part of check-in 7348021f6d


#INCLUDE "modules\modules.bi"

SUB LoadModule (ModuleName AS STRING)
  'Main module procedure trigger
  SELECT CASE ModuleName
    CASE "users"
      LoadUsersInterface()
    CASE "admin"
      LoadAdminPanel()
    CASE ELSE
  END SELECT
END SUB

FUNCTION ModuleVars (ModuleName AS STRING, Key AS STRING) AS STRING
  'This function returns the value from the helper function of each module
  SELECT CASE ModuleName
    CASE "users"
      ModuleVars = ReadUserData(Key)
    CASE ELSE
      ModuleVars = Key
  END SELECT
END FUNCTION

FUNCTION ModuleParser (Key AS STRING) AS STRING
  DIM AS STRING ModuleName, SubKey
  'Try to find an underscore inside the command
  IF INSTR(Key, "_") > 0 THEN
    ModuleName = LEFT(Key, INSTR(Key, "_") - 1)
    SubKey = MID(Key, INSTR(Key, "_") + 1, LEN(Key))
  ELSE
    ModuleName = Key
    SubKey = ""
  END IF
  ModuleParser = ModuleVars(ModuleName, SubKey)
END FUNCTION