RemoteAccess Ftp

source:NethGui/Module/RemoteAccess/Ftp.php

This sample Module shows a common issue: map 1 view parameters into N database values, through some functions. See #14.

VIEW  serviceStatus = {off, localNetwork, anyNetwork}
VIEW  acceptPasswordFromAnyNetwork = {0,1}

DB    status = {enabled, disabled}
DB    access = {public, private}
DB    LoginAccess = {public, private}

F1(status, access) => serviceStatus
{
  if status == enabled
     if access == public
        return anyNetwork
     elseif access == private
        return localNetwork

  return off
}

F2(serviceStatus) => (status, access)
{
   if serviceStatus == off
     return (disabled, private)
   elseif serviceStatus == localNetwork
     return (enabled, private)
   elseif serviceStatus == anyNetwork
     return (enabled, public)
   else
     return (disabled, private)
}

F3(LoginAccess) => acceptPasswordFromAnyNetwork
{
   if LoginAccess == public
     return 1
   else
     return 0
}

F4(acceptPasswordFromAnyNetwork) => (LoginAccess)
{
   if acceptPasswordFromAnyNetwork == 1
      return public
   else
      return private
}