// FGLWEBSITE.FGL

// CLASSES
//   pagelib
//   objLibraries
//   FGL_Files_Libraries (generated by ObjectManager)
//   objExtensions
//   FGL_Files_Extensions (generated by ObjectManager)
//   objUserGroups
//   objProducts
//   FGL_Products (generated by ObjectManager)
//   objMembers
//   FGL_Member (generated by ObjectManager)
//   objWebCast
//   objWebCastRegistration


// FGL License, Version 1.0
// Copyright (c) 2006, FGL Foundation, Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification, are permitted 
// provided that the following conditions are met:
//
// 1.   Redistributions of source code must retain the above copyright notice, this list of 
//      conditions and the following disclaimer.
//
// 2.   Redistributions in binary form must reproduce the above copyright notice, this list of 
//      conditions and the following disclaimer in the documentation and/or other materials 
//      provided with the distribution.
//
// 3.   The name “FGL” may not be used to endorse or promote products derived from this software 
//      without specific prior written permission. For written permission, please contact 
//      licensing@fglfoundation.org.
//
// 4.   Products derived from this software may not be called “FGL”, nor may “FGL” appear in 
//      product names without prior written permission. For written permission, please contact 
//      licensing@fglfoundation.org. You may indicate that software works in conjunction with 
//      FGL by saying “Stuff for FGL” rather than naming it “FGL Stuff” or “FGLStuff”.
//
// 5.   FGL Foundation, Inc. may publish revised and/or new versions of the license from time to 
//      time. Each version will be given a distinguishing version number. Once covered code has 
//      been published under a particular version of the license, you may always continue to use 
//      it under the terms of that version. You may also choose to use such covered code under 
//      the terms of any subsequent version of the license published by FGL Foundation, Inc. No 
//      one other than FGL Foundation, Inc. has the right to modify the terms applicable to 
//      covered code created under this license.
//
// 6.   Redistributions of any form whatsoever must retain the following acknowledgment: “This 
//      product includes FGL, which is freely available from http://www.fglfoundation.org”.
//
// THIS SOFTWARE IS PROVIDED BY THE FGL FOUNDATION AND CONTRIBUTORS ON AN “AS IS” BASIS. THE FGL 
// FOUNDATION MAKES NO REPRESENTATIONS OR WARRANTIES AND DISCLAIMS ANY WARRANTIES OF ANY KIND, 
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF 
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE FGL FOUNDATION OR 
// ANY OF ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA, OR PROFITS; 
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, TORT (INCLUDING NEGLIGENCE), 
// OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
// POSSIBILITY OF SUCH DAMAGES.
// ………………………………………………………………………………………………………………
// This software includes voluntary contributions made by many individuals on behalf of the FGL 
// Foundation. The FGL Foundation can be contacted via e-mail at questions@fglfoundation.org.
// More information on FGL and the FGL Foundation is available at http://www.fglfoundation.org. 
// FGL uses the FifthGen Engine, which is freely available from http://www.fglfoundation.org or 
// http://www.fithgensys.com.


LIBRARY \fgl\libs\system.flb

CLASS pagelib
  PUBLIC:
      local errmsg
      local versionFGL, versionEngine, title
      local linkclr, msgclr, warningclr, defineclr
    local insmgmt, session
    local IsPlain
    local curServerIndex
    local IsLoggedIn, userid, password, LoginAttempt
      
      METHOD new( session )
          ::init( )
          ::session = type( session ) == "O" ? session : new( "session" )
          ::isplain = 0 + ::session.var( "plain" )
          ::LoginAttempt = 0
          return( 1 )
      END
      
      METHOD init( )
          ::versionFGL = "v" + ( EngineVersionNumber() >> 16 ) + "." + ( EngineVersionNumber() & 0xFFFF )
          ::versionEngine = "Build #" + EngineBuildNumber( )
    
          ::linkclr = "#2058a5"
          ::defineclr = "#00B000"
          ::msgclr = "#FFFFD0"
          ::warningclr = "#FFA0A0"
                    
          ::title = ""
          ::insmgmt = "http://66.165.182.174/insmgmt"
          
          ::curServerIndex = 0
          
          ::IsLoggedIn = 0
          ::userid = ""
          ::password = ""
          
          return( 1 )
      END
      
    ACCESS basedir
        if ( fileExists( 'c:\sdweb\home\websites\fgldev\index.ap' ) )
            return( 'c:\sdweb\home\websites\fgldev' )
        end
        return( ::session.serverroot )
    END

      METHOD menuInit( )
          local s = new( "ServerBuffer" )

        if ( ::IsPlain )
            return( "" )
        end
          
        s += "<!-- FGL Menu Initializer for QuickMenu Pro (fglwebsite.flb->pagelib) -->\r\n"
        s += "<!-- For information on QuickMenu Pro visit www.opencube.com -->\r\n"
          s += "<script language=\"JavaScript\" type=\"text/JavaScript\">\r\n"
          s += "function MM_reloadPage( init ) {\r\n"
          s += " if ( init == true ) with (navigator) {\r\n"
          s += "  if ( ( appName == \"Netscape\" ) && ( parseInt( appVersion ) == 4 ) ) {\r\n"
          s += "   document.MM_pgW=innerWidth;\r\n"
          s += "   document.MM_pgH=innerHeight;\r\n"
          s += "   onresize=MM_reloadPage;\r\n"
          s += "  }\r\n"
          s += " }\r\n"
          s += " else if ( innerWidth != document.MM_pgW || innerHeight != document.MM_pgH ) {\r\n"
          s += "  location.reload( );\r\n"
          s += " }\r\n"
          s += "}\r\n"
          s += "MM_reloadPage(true);\r\n"
          s += "</script>\r\n"
          s += "<script language=\"JavaScript1.2\" vqm_id=\"mydata.js\">\r\n"
          s += " vqm__notice='Visual QuickMenu Pro, (c) 2004 OpenCube Inc., All Rights Reserved, Visit - www.opencube.com';\r\n"
          s += " vqm__codebase='';\r\n"
          s += " vqm__database='';\r\n"
          s += "</script>\r\n"
          s += "<script language=\"JavaScript1.2\" src=\"mydata.js\"></script>\r\n"
          s += "<script language=\"JavaScript1.2\" src=\"tdqm_loader.js\"></script>\r\n"

          return( s.str )
      END
      
      METHOD menuDisplay( left, top )
          local s = new( "ServerBuffer" )

        if ( ::IsPlain )
            return( "" )
        end
          
        s += "<!-- FGL Menu Display for QuickMenu Pro (fglwebsite.flb->pagelib) -->\r\n"
          s += "<div id=\"Layer4\" style=\"position:absolute; width:200px; height:115px; z-index:3; left: " + left + "px; top: " + top + "px;\">\r\n"
          s += "<script language=\"JavaScript1.2\" id=\"vqp_generate_mainitems\">generate_mainitems();</script>\r\n"
          s += "</div>\r\n"

          return( s.str )
      END

    METHOD headInit( title, keywords )
          local s = new( "ServerBuffer" )

        ::title = title

        s += "<title>FGL - " + title + "</title>\r\n"
         s += "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>\r\n"
        s += "<meta http-equiv='Content-language' content='eng-US'>\r\n"
        s += "<meta name='description' content=\"" + title + "\">\r\n"
        s += "<meta name='keywords' content=\"" + ::defKeywords + ( strempty( keywords ) ? "" : "," + keywords ) + "\">\r\n"
        s += "<meta name='author' content='RW/smr'>\r\n"
        s += "<meta name='copyright' content='" + ::CopyrightPlainText( ) + "'>\r\n"
        s += "<meta name='generator' content='FGL/TextPad/Hand+Eye Coordination'>\r\n"
         s += "<meta http-equiv='imagetoolbar' content='no'>\r\n"
        s += "<link rel='shortcut icon' href='http://www.fgldev.org/favicon.ico'>\r\n"
         s += "<link rel='alternate' type='application/rss+xml' title='FGL - Fifth Generation Language' href='http://www.fgldev.org/news.rss'>\r\n"
         s += "<link rel='stylesheet' href='style.css' type='text/css' media='screen,print'>\r\n"
         s += "<script language='Javascript' src='/fglcommon.js'></script>\r\n"
         s += "\r\n"

          return( s.str )
      END
      
      ACCESS defKeywords
          return( "FGL,Fifth Generation Language,FifthGen,Web Server,Object Database,Web Development" )
      END

    METHOD link( title, url, IsNewWindow, tooltip = "" )
        if ( type( url ) == "N" )
            IsNewWindow = url
            url = title
        elseif ( type( url ) != "C" )
            IsNewWindow = 0
            url = title
        else
            IsNewWindow = type( IsNewWindow ) == "N" ? IsNewWindow : 0
        end
        if ( strat( "@", url ) )
            url = "mailto:" + url
        end
        if ( strempty( tooltip ) )
            return( "<a href='" + url + "'" + ( IsNewWindow ? " target=_blank" : "" ) + "><font color='" + ::linkclr + "'>" + title + "</font></a>" )
        end
        return( "<a href='" + url + "'" + ( IsNewWindow ? " target=_blank" : "" ) + " title=\"" + tooltip + "\"><font color='" + ::linkclr + "'>" + title + "</font></a>" )
    END
    
    METHOD define( text, definition )
        return( "<span title='" + definition + "' onMouseover=\"this.style.cursor='pointer';this.style.cursor='hand';\" onClick='alert( \"Definition for " + text + ":\\n" + definition + "\" );'><font color='" + ::defineclr + "'>" + text + "</font></span>\r\n" )
    END

    METHOD MouseOverClick( msg, action )
        return( "onMouseover=\"this.style.cursor='pointer';this.style.cursor='hand';\" onClick=\"" + action + "\" title=\"" + msg + "\"" )
    END

    METHOD HeaderDisplay( imgLogo )
        local val
          local s = new( "ServerBuffer" )

        if ( ::IsPlain )
            return( "" )
        end

        ::login( )
          
          imgLogo = type( imgLogo ) == "C" ? imgLogo : "images/navtop_logo.gif"
          
        s += "<!-- FGL Navtop Display (fglwebsite.flb->pagelib) -->\r\n"
        s += "<table border=0 width=100% cellspacing=0 cellpadding=0 class=txt>\r\n"
        s += " <tr height=90>\r\n"
        s += "  <td width=467 background=\"" + imgLogo + "\"><img src='images/transdot.gif' border=0 width=467 height=90 usemap='#home_map'></td>\r\n"
        s += "  <td>\r\n"
        s += "   <table border=0 width=100% height=100% cellspacing=0 cellpadding=0 class=txt background=\"images/navtop_stretch.gif\">\r\n"
        s += "    <tr><td>&nbsp;</td></tr>\r\n"
        s += "   </table>\r\n"
        s += "  </td>\r\n"
        s += " </tr>\r\n"
        s += "</table>\r\n"
        s += "<div id=\"searchbar\" style=\"position:absolute; width:200px; height:115px; z-index:9; left: 600px; top: 25px;\">\r\n"
        val = ::session.var( "searchstr" )
        if ( strempty( val ) )
            val = "search site"
        end
        s += " <input type=text name=\"searchstr\" class=smtxt value=\"" + val + "\" style=\"width:150px;\" onFocus='initSearch( this, 1 );' onBlur='initSearch( this, 0 );' onKeyDown='defbutton( srchbtn );'><input id=srchbtn type=button class=smtxtb onClick='doSearch( );' value=\"...\" style='width:18px;'>\r\n"
        s += "</div>\r\n"

        if ( ::IsLoggedIn )
            s += "<div style=\"position:absolute; left:600px; top:10px; width:200px; height:115px; z-index:3;\" class=smtxt>\r\n"
            s += "<font color=#C0C0C0><a href='accountUpdate.htm'><font color=#C0C0C0>update your account now</font></a> | <a href='accountLogoff.htm'><font color=#C0C0C0>log off</font></a></font>\r\n"
            s += "</div>\r\n"
        else
            s += "<div style=\"position:absolute; left:600px; top:10px; width:200px; height:115px; z-index:3;\" class=smtxt>\r\n"
            s += "<font color=#C0C0C0><a href='membership.htm'><font color=#C0C0C0>log in to your account</font></a> | <a href='join.htm'><font color=#C0C0C0>join now</font></a></font>\r\n"
            s += "</div>\r\n"
        end

        s += "<map name=home_map>\r\n"
        s += "<area shape='rect' coords='15,15,410,55' href='main.htm' alt='Return to the home page...' title='Return to the home page...'>\r\n"
        s += "</map>\r\n"
          s += "<script language='JavaScript' type='text/JavaScript'>\r\n"
        s += "function initSearch( obj, flag ) {\r\n"
        s += "  if ( ( flag ) && ( obj.value == 'search site' ) ) {\r\n"
        s += "       obj.value = '';\r\n"
        s += "  }\r\n"
        s += "  else if ( ( ! flag ) && ( obj.value == '' ) ) {\r\n"
        s += "       obj.value = 'search site';\r\n"
        s += "  }\r\n"
        s += "}\r\n"
        s += "function doSearch( ) {\r\n"
        s += "  input.action = 'search.htm';\r\n"
        s += "  input.submit( );\r\n"
        s += "}\r\n"
        s += "</script>\r\n\r\n"
    
          return( s.str )
    END

    METHOD CopyrightDisplay( )
        local s = new( "ServerBuffer" )
        local str = ::session.var( "searchstr" )
        
        if ( ( ! strempty( str ) ) && ( upper( str ) != "SEARCH SITE" ) )
            s += "<script language='Javascript' src='/docs/hilite.js'></script>"
            s += "<script language='Javascript'>highlight( \"" + str + "\" )</script>\r\n"
        end
        s += "<font class=copyright>Copyright (c) 2008-" + date( "YYYY" ) + " by RadWeb Technologies, LLC.</font>"

        return( s.str )
    END
    METHOD CopyrightPlainText( )
        return( "Copyright (c) 2008-" + date( "YYYY" ) + " by RadWeb Technologies, LLC." )
    END

    METHOD docs( x, y, title, url, target )
          local s = new( "ServerBuffer" )

        s += "<div style='position:absolute; width:32px; height:32px; left: " + x + "px; top: " + y + "px;'>"
        s += "<a href=\"" + url + "\" title=\"" + title + "\"" + ( strempty( target ) ? "" : " target=" + target ) + "><img src='images/docs.gif' border=0 width=32 height=32 align=right></a>"
        s += "</div>\r\n"

        return( s.str )    
    END

    METHOD rating( val )
        local s = "", i

        for ( i=1; i<=val; i++ )
            s += "<img src='images/star2.gif' border=0 width=12 height=12>"
        end

        return( s )
    END
    

    METHOD download( x, y, title, url, target )
          local s = new( "ServerBuffer" )

        s += "<div style='position:absolute; width:32px; height:32px; left: " + x + "px; top: " + y + "px;'>"
        s += "<a href=\"" + url + "\" title=\"" + title + "\"" + ( strempty( target ) ? "" : " target=" + target ) + "><img src='images/download.gif' border=0 width=32 height=32 align=right></a>"
        s += "</div>\r\n"

        return( s.str )    
    END

    METHOD memberSignin( )
          local s = new( "ServerBuffer" )

        s += "<table border=0 cellspacing=0 cellpadding=0 class=smtxt>\r\n"
        s += " <tr><td>Email Address:<br><input type=text class=smtxt name=userid style='width:120px;'></td></tr>\r\n"
        s += " <tr><td>Password:<br><input type=password class=smtxt name=password style='width:120px;' onKeyDown='defbutton( DefButton )'></td></tr>\r\n"
        s += "</table>\r\n"
        s += "<input id='DefButton' type=button class=smtxtBLACK value='Sign in' onClick='signin( );'>\r\n"
        s += "<script language=JavaScript>\r\n"
        s += "function signin( ) {\r\n"
        s += "  input.action = 'signin.htm';"
        s += "  input.submit( );\r\n"
        s += "}\r\n"
        s += "</script>\r\n"
        
        return( s.str )
    END

    METHOD eventCalendar( title, txtclass )
          local s = new( "ServerBuffer" )
        local d = date( )
        
        s += "<a href='events.htm?date=" + d + "'><font class=" + txtclass + ">" + title + cMonthYear( d ) + "</font></a><br>\r\n"
        s += DisplayCalendarX( d, 1, 155, 22, "", 0, 0, "smtxtBLACK" )
        
        return( s.str )
    END

    ACCESS aProgrammerQuickLinks
        static a = {
            { "FGL Documentation...", "documentation.htm" },
            { "FGL Tutorials...", "tutorials.htm" },
            { "FGL Samples...", "samples.htm" },
            { "<hr>", "" },
            { "Latest Build Release...", "fgl.htm" },
            { "Latest Source...", "downloads.htm" },
            { "<hr>", "" },
            { "New to FGL Programming...", "newtofgl.htm" },
            { "Advanced FGL Features...", "advancedfgl.htm" },
            { "New to Programming...", "newtoprogramming.htm" },
            { "<hr>", "" },
            { "Apply for a Grant...", "grants.htm" }
        }
        return( a )
    END

    ACCESS aEndUserQuickLinks
        static a = {
            { "Find a Solution Provider...", "consultants.htm" },
            { "Post an RFP...", "rfps.htm" },
            { "<hr>", "" },
            { "Management Tools...", "http://www.fifthgensys.com/coMgmtSuite_FGL.htm", "_blank" },
            { "<hr>", "" },
            { "Testimonials...", "testimonials.htm" },
            { "Case Studies...", "casestudies.htm" },
            { "Showcase...", "showcase.htm" }
        }
        return( a )
    END

    ACCESS aPressQuickLinks
        static a = {
            { "Reviewer's Guide...", "reviewersguide.htm" },
            { "Benchmark Tests...", "assessment.htm" },
            { "Comparisons...", "comparison.htm" }
        }
        return( a )
    END

    ACCESS aServers
        static a = {
            "http://www.fglfoundation.org",
            "http://www.fgldev.com",
            "http://www.fglfoundation.com",
            "http://fgldev.net",
            ""
        }
        return( a )
    END


    ACCESS downloadserver
        local a, datafile

        a = ::aServers

        datafile = fglServerFile( "/download/download.dat", ::session )
        ::curServerIndex = 0 + iniGetString( datafile, "CONFIG", "CurIndex", "1" )

        ::curServerIndex++
        if ( ::curServerIndex > len( a ) )
            ::curServerIndex = 1
        end

        iniSetString( datafile, "CONFIG", "CurIndex", "" + ::curServerIndex )
        
        return( a[ ::curServerIndex ] )
    END

    METHOD dl( url )
        return( "javascript:RunAjax( '" + url + "' );" )
    END
    
    METHOD TutorialLinks( link )
        local a, cnt, i, s="", qstr
        
        a = {
            "GettingStarted",
            "HelloWorld",
            "ActivePages",
            "Variables",
            "ControlStructures",
            "Functions",
            "Objects",
            "Files",
            "Databases",
            "ErrHandling"
        }
        
        link = upper( link )
        
        cnt = len( a )
        for ( i=1; i<=cnt; i++ )
            if ( link == upper( a[i] ) )
                break
            end
        end

        qstr = ::IsPlain ? "?plain=1" : ""
        
        if ( i > 1 )
            s += "<a href='tutorial_" + a[i-1] + ".htm" + qstr + "'>Previous</a> | "
        end
        if ( i < cnt )
            s += "<a href='tutorial_" + a[i+1] + ".htm" + qstr + "'>Next</a> | "
        end
        s += "<a href='tutorials.htm" + qstr + "'>Tutorial Home</a>"
        
        return( s )
    END
    
    METHOD exTitle( title, action )
        if ( strempty( action ) )
            return( "<p><table border=0 width=100% cellspacing=0 cellpadding=0 class=txt_body><tr><td><b>" + title + ":</b></td><td align=right></td></tr></table>" )
        end
        return( "<p><table border=0 width=100% cellspacing=0 cellpadding=0 class=txt_body><tr><td><b>" + title + ":</b></td><td align=right><input type=button value='^' class=smtxtb onClick=\"OpenWindow(-1,-1,600,480,'sample', '" + action + "', 'POPUPMENU');\" style='width:20px;height:16px' title='Click to view this example...'></td></tr></table>" )
    END
    
    METHOD exStart( )
        return( "<table border=0 width=100% cellspacing=0 cellpadding=20 class=smtxtBLACK bgcolor=#F0F0F0><tr><td>" )
    END

    METHOD exEnd( )
        return( "</table>" )
    END

    METHOD login( VerifyFlag )
        local members

        VerifyFlag = type( VerifyFlag ) == "N" ? VerifyFlag : 1

        if ( ::LoginAttempt )
            return( 0 )
        end
        ::LoginAttempt = 1

        ::errmsg = ""
        ::IsLoggedIn = 0

        ::GetCookie( )
        
        if ( strempty( ::userid ) || strempty( ::password ) )
            ::userid = ::session.var( "userid" )
            ::password = ::session.var( "password" )
            
            if ( strempty( ::userid ) )
                ::errmsg += "Must specify a USERID. "
            end
            if ( strempty( ::password ) )
                ::errmsg += "Must specify a PASSWORD. "
            end

            if ( ! strempty( ::errmsg ) )
                return( 0 )
            end

            ::SetCookie( )
        end
    
        members = new( "objMembers" )
        if ( ! members.GetRecord( ::userid ) )
            ::errmsg = "Unable to locate user information (" + ::userid + ")"
            return( 0 )
        end

        if ( VerifyFlag )
            if ( ! members.data.IsVerified )
                ::errmsg = "You have successfully created a member account, however the account has not yet been verified. "
                ::errmsg += "A verification email has been sent to your email address. Click the verification link in the email to complete the registration process.<br><br>"
                ::errmsg += "<a href=''><font color='" + ::linkclr + "'>Click here</font></a> to resend the verification email to " + members.data.email + "."
                return( 0 )
            end

            members.data.usagecount = 1 + members.data.usagecount
            members.SetRecord( ::userid )

            ::IsLoggedIn = 1

        end

        return( members.data )
    END

    METHOD GetCookie( )
        local cookie, data

        cookie = new( "cookie" )
        data = cookie.get( "fglfoundation" )

        ::userid = strextract( data, "|", 1 )
        ::password = strextract( data, "|", 2 )
        
        return( 1 )
    END
    
    METHOD SetCookie( )
        local cookie
        
        cookie = new( "cookie" )
        cookie.set( "fglfoundation", ::userid + "|" + ::password )
        
        return( 1 )
    END

    METHOD DeleteCookie( )
        local cookie
        
        cookie = new( "cookie" )
        cookie.set( "fglfoundation" )

        return( 1 )    
    END

    METHOD GenValidationLink( )
        return( "http://www.fglfoundation.org/index.htm?_goto_=RegistrationVerification.htm&sessionID=" + ::sessionid )
//        return( "/websites/fgldev/index.htm?_goto_=RegistrationVerification.htm&sessionID=" + ::sessionid )
    END

    ACCESS sessionID
        return( ::encodeSessionID( ) )
    END

    METHOD decodeSessionID( sessionid )
        local obj = new( "objSession" )
        return( obj.decode( sessionid ) )
    END

    METHOD encodeSessionID( )
        local obj, s
        obj = new( "objSession" )
        s = obj.encode( left( ::userid + "|" + ::password + "|" + date( ) + "|" + time( ) + "|MLKAJNDCQWERTYUIOPASDFGHJKLZXCVBNMMLKAJNDCQWERTYUIOPASDFGHJKLZXCVBNMMLKAJNDCQWERTYUIOPASDFGHJKLZXCVBNM", 80 ) )
        return( webEncodeURL( s ) )
    END

END



CLASS objLibraries
  PUBLIC:
    local IsOpen, LockTimeout, errmsg, db
    local data, id

    METHOD New( )
        ::IsOpen = 0
        ::errmsg = ""
        ::LockTimeout = 2
        ::db = 0
        ::data = new( "FGL_Files_Libraries" )
        ::Init( )
        return( 1 )
    END

    METHOD Init( )
        ::id = ""
        ::data.init( )
        return( 1 )
    END

    ACCESS dbFileName
        return( 'c:\fgl\data\objLibraries.db' )
    END

    ACCESS dbIndexName
        return( 'c:\fgl\data\objLibraries.dx' )
    END

    METHOD create( )
        local db_struct = {
            { "id", "C", 40, 0 },
            { "data", "B", 20, 0 }
        }
        return( dbcreate( ::dbFileName, db_struct ) )
    END

    METHOD open( )
        local a, cnt, i
    
        if ( ::IsOpen )
            ::IsOpen++
            return( 1 )
        end

        if ( ! fileExists( ::dbFileName ) )
            ::create( )
            
            // create default recs
            ::data.contributedBy = "SMR"
            ::data.contributedDate = date( )
            ::data.status = 1
            ::data.version = "1.0"
            ::data.type = 1
            ::data.platforms = ::data.ID_PLATFORM_STANDARD
            ::data.lisc = "BSD Public License"
            
            // id, cat, title, desc, libfile, srcfile
            a = { 
                { "DTE001", "Date/Time", "Calendar", "FGL library containing numerous classes and functions for the creation and manipulation of date/time/calendaring elements.", "system.flb", "calendar.fgl" },
                { "WEB001", "Web Sites", "FGL Website Support Library", "This FGL library contains all of the support classes and functions used in the creation and deployment of the FGL Foundation website, including this library manager.", "fglwebsite.flb", "fglwebsite.fgl" },
                { "APP001", "Applications", "Help System", "This FGL library provides all of the support classes and functions required to create dynamically-generated web-based help systems.", "help.flb", "help.fgl" },
                { "COR001", "Core", "FGL System Library", "This is one of the primary FGL core libraries, includes: system, object, webclient, and calendar classes and support functions", "system.flb", "system.fgl" },
                { "FAX001", "Fax", "Fax Library", "This library contains classes and functions for the creation and manipulation of faxes", "fax.flb", "fax.fgl" },
                { "GFX001", "Graphics", "Graph", "This library contains functions and classes for the creation and manipulation of graphs.", "graph.flb", "graph.fgl" },
                { "MAI001", "Email", "Mail", "This library provides classes for the interaction with SMTP mail servers.", "mail.flb", "mail.fgl" },
                { "SER001", "Server", "Web Client", "This library provides classes for the manipulation of web components, including page gets, cookies, and others. Part of the system.flb library.", "system.flb", "webclient.fgl" }
            }

            cnt = len( a )
            for ( i=1; i<=cnt; i++ )
                ::id = a[i,1]
                ::data.category = a[i,2]
                ::data.title = a[i,3]
                ::data.desc = a[i,4]
                ::data.libfile = a[i,5]
                ::data.srcfile = a[i,6]
                   ::CreateNewRecord( ::id )
            end
            
        end

        ::IsOpen = 1

        ::db = dbuse( ::dbFileName, "objLibraries", 1 )
        if ( ! fileExists( ::dbIndexName ) )
            (::db)->dbCreateIndex( ::dbIndexName, "upper( field->id )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName )

        return( 1 )
    END

    METHOD close( )
        if ( ::IsOpen == 1 )
            (::db)->dbClose( )
        end
        ::IsOpen--
        return( 1 )
    END

    METHOD seek( item )
        (::db)->dbSeek( upper( item ) )
        return( (::db)->dbFound( ) )
    END

    METHOD reindex( )
        return( (::db)->dbReindex( ) )
    END

    METHOD get( )
        ::id = alltrim( (::db)->id )
        ::data.get( (::db)->data )
        return( 1 )
    END

    METHOD put( )
        (::db)->id = ::id
        ::data.id = ::id
        (::db)->data = ::data.put(  )
        return( 1 )
    END

    METHOD validate( )
        return( 1 )
    END

    METHOD CreateNewRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )
        if ( ::seek( key ) )
            ::errmsg = "Record (" + key + ") already exists!"
            ::close( )
            return( 0 )
        end

        (::db)->dbAppend( )
        ::put( )
        ::unlock( )

        ::close( )
        return( 1 )
    END

    METHOD GetRecord( key )
        ::open( )

        ::init( )
        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        ::get( )
        ::close( )

        return( 1 )
    END

    METHOD SetRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )

        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        if ( ::rlock( ) )
            ::put( )
            ::unlock( )
        end
        ::close( )

        return( 1 )
    END

    METHOD dbOrder( val )
        (::db)->dbOrder( val )
    END
    METHOD dbGoto( val )
        (::db)->dbGoto( val )
    END
    METHOD dbGoTop( )
        (::db)->dbGoTop( )
    END
    METHOD dbGoBottom( )
        (::db)->dbGoBottom( )
    END
    METHOD dbEOF( )
        return( (::db)->dbEOF( ) )
    END
    METHOD dbBOF( )
        return( (::db)->dbBOF( ) )
    END
    METHOD dbseek( id )
        return( ::seek( id ) )
    END
    METHOD dbSkip( index )
        if ( type( index ) == 'N' )
            (::db)->dbSkip( index )
        else
            (::db)->dbSkip( )
        end
        return( 1 )
    END

    METHOD rlock( )
        local EndTime
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to lock record'
            return( 0 )
        end
        EndTime = seconds( ) + ::LockTimeout
        while ( ! (::db)->dbRLock( ) )
            if ( ( seconds( ) > EndTime ) || ( ( seconds( ) + ::LockTimeout ) < EndTime ) )
                ::errmsg ='Unable to lock database record'
                return( 0 )
            end
        end
        return( 1 )
    END

    METHOD unlock( )
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to unlock record'
            return( 0 )
        end
        (::db)->dbUnLock( )
        return( 1 )
    END

END


CLASS FGL_Files_Libraries
  // FGL library master object
  // Created: January 16, 2006 at 16:14:35 by 127.0.0.1
  // Generated: January 17, 2006 11:37:34
  // IsPacked=1 NoHeader=1 IsAutoPacked=0
  PUBLIC:
    local _status_
    local category, contributedBy, contributedDate, desc, docfile, fdate, fsize
    local ftime, id, keywords, libfile, lisc, platforms, projectid, srcfile, status
    local title, type, version

    METHOD new( )
        ::init( )
        return( 1 )
    END

    METHOD init( )
        ::_status_ = 1
        ::initFields( )
        return( 1 )
    END

    METHOD initFields( )
        ::category = ""
        ::contributedBy = ""
        ::contributedDate = ""
        ::desc = ""
        ::docfile = ""
        ::fdate = ""
        ::fsize = 0
        ::ftime = ""
        ::id = ""
        ::keywords = ""
        ::libfile = ""
        ::lisc = ""
        ::platforms = 0
        ::projectid = ""
        ::srcfile = ""
        ::status = ""
        ::title = ""
        ::type = 0
        ::version = ""
        return( 1 )
    END

    METHOD UpdateFromForm( session )
        ::category = session.var( "category" )
        ::contributedBy = session.var( "contributedBy" )
        ::contributedDate = session.var( "contributedDate" )
        ::desc = session.var( "desc" )
        ::docfile = session.var( "docfile" )
        ::fdate = session.var( "fdate" )
        ::fsize = 0 + session.var( "fsize" )
        ::ftime = session.var( "ftime" )
        ::id = session.var( "id" )
        ::keywords = session.var( "keywords" )
        ::libfile = session.var( "libfile" )
        ::lisc = session.var( "lisc" )
        ::platforms = 0 + session.var( "platforms" )
        ::projectid = session.var( "projectid" )
        ::srcfile = session.var( "srcfile" )
        ::status = session.var( "status" )
        ::title = session.var( "title" )
        ::type = 0 + session.var( "type" )
        ::version = session.var( "version" )
        return( 1 )
    END

    METHOD FieldList( )
        static flds = { 
            { "category", 1, 0, 0, 0, 1, "", "", "" },
            { "contributedBy", 1, 0, 0, 0, 1, "", "", "" },
            { "contributedDate", 1, 0, 0, 0, 1, "", "", "" },
            { "desc", 1, 0, 0, 0, 1, "", "", "" },
            { "docfile", 1, 0, 0, 0, 1, "", "", "" },
            { "fdate", 1, 0, 0, 0, 1, "", "", "" },
            { "fsize", 3, 0, 0, 0, 1, "", "", "" },
            { "ftime", 1, 0, 0, 0, 1, "", "", "" },
            { "id", 1, 0, 0, 0, 1, "", "", "" },
            { "keywords", 1, 0, 0, 0, 1, "", "", "" },
            { "libfile", 1, 0, 0, 0, 1, "", "", "" },
            { "lisc", 1, 0, 0, 0, 1, "", "", "" },
            { "platforms", 3, 0, 0, 0, 1, "", "", "" },
            { "projectid", 1, 0, 0, 0, 1, "", "", "" },
            { "srcfile", 1, 0, 0, 0, 1, "", "", "" },
            { "status", 1, 0, 0, 0, 1, "", "", "" },
            { "title", 1, 0, 0, 0, 1, "", "", "" },
            { "type", 3, 0, 0, 0, 1, "", "", "" },
            { "version", 1, 0, 0, 0, 1, "", "", "" }
        }
        return( flds )
    END

    ACCESS avars
        static a = { 
            "category",
            "contributedBy",
            "contributedDate",
            "desc",
            "docfile",
            "fdate",
            "fsize",
            "ftime",
            "id",
            "keywords",
            "libfile",
            "lisc",
            "platforms",
            "projectid",
            "srcfile",
            "status",
            "title",
            "type",
            "version"
        }
        return( a )
    END

    METHOD get( data )
        return( unpack( data, self ) )
    END

    METHOD put( )
        return( pack( self ) )
    END

    ACCESS TransactionData
        return( ArrayToNameValue( objToArray( self ), '=', '&' ) )
    END

    ACCESS aCategory
        static a = {
            "Applications",
            "Barcode",
            "Core",
            "Database",
            "Date/Time",
            "E-commerce",
            "Email",
            "Fax",
            "Games/Entertainment",
            "Graphics",
            "Imaging",
            "Math",
            "Server",
            "Validation",
            "Web Sites",
            "Other"
        }
        return( a )
    END

    ACCESS aPlatform
        static a = {
            { 1, "Win32" },
            { 2, "Win64" },
            { 4, "Linux" },
            { 8, "Unix" },
            { 16, "Solaris" },
            { 1023, "ALL" }
        }
        return( a )
    END

    ACCESS aStatus
        static a = {
            { 1, "Production" },
            { 2, "Beta" },
            { 4, "Alpha" },
            { 8, "Planning" },
            { 16, "Other" }
        }
        return( a )
    END

    ACCESS aType
        static a = {
            { 1, "FGL" },
            { 2, "DLL" },
            { 4, "ActiveX" },
            { 8, "Java" },
            { 16, ".Net" },
            { 1023, "ALL" }
        }
        return( a )
    END

    ACCESS ID_PLATFORM_LINUX
        return( 4 )
    END

    ACCESS ID_PLATFORM_SOLARIS
        return( 16 )
    END

    ACCESS ID_PLATFORM_STANDARD
        return( 7 )
    END

    ACCESS ID_PLATFORM_UNIX
        return( 8 )
    END

    ACCESS ID_PLATFORM_WIN32
        return( 1 )
    END

    ACCESS ID_PLATFORM_WIN64
        return( 2 )
    END

    ACCESS statusdesc
        local i, cnt, a
        
        a = ::aStatus
        cnt = len( a )
        for ( i=1; i<=cnt; i++ )
            if ( ::status == a[i,1] )
                return( a[i,2] )
            end
        end
        return( "Unknown" )
    END

    ACCESS typedesc
        local i, cnt, a
        
        a = ::aType
        cnt = len( a )
        for ( i=1; i<=cnt; i++ )
            if ( ::type == a[i,1] )
                return( a[i,2] )
            end
        end
        return( "Unknown" )
    END

    METHOD rules( )
        return( 1 )
    END

    ACCESS default( name )
        name = name
        return( 0 )
    END
    ASSIGN default( name, val )
        name = name
        val = val
        return
    END

END


CLASS objExtensions
  PUBLIC:
    local IsOpen, LockTimeout, errmsg, db
    local data, id

    METHOD New( )
        ::IsOpen = 0
        ::errmsg = ""
        ::LockTimeout = 2
        ::db = 0
        ::data = new( "FGL_Files_Extensions" )
        ::Init( )
        return( 1 )
    END

    METHOD Init( )
        ::id = ""
        ::data.init( )
        return( 1 )
    END

    ACCESS dbFileName
        return( 'c:\fgl\data\objExtensions.db' )
    END

    ACCESS dbIndexName
        return( 'c:\fgl\data\objExtensions.dx' )
    END

    METHOD create( )
        local db_struct = {
            { "id", "C", 40, 0 },
            { "data", "B", 20, 0 }
        }
        return( dbcreate( ::dbFileName, db_struct ) )
    END

    METHOD open( )
        local a, cnt, i
    
        if ( ::IsOpen )
            ::IsOpen++
            return( 1 )
        end

        if ( ! fileExists( ::dbFileName ) )
            ::create( )
            
            // create default recs
            ::data.contributedBy = "SMR"
            ::data.contributedDate = date( )
            ::data.status = 1
            ::data.version = "1.0"
            ::data.type = 1
            ::data.platforms = ::data.ID_PLATFORM_WIN32 | ::data.ID_PLATFORM_WIN64
            ::data.lisc = "GNU Public License"
            
            // id, cat, title, desc, libfile, srcfile
            a = { 
                { "SRV001", "Server", "FGL ISAPI Interface", "Includes everything you need to add FGL support to any ISAPI compatible web server. Not required when using the internal server provided in the FifthGen Engine.", "/download/files/fgl_isapi.zip", "" },
                { "SRV002", "Server", "PHP ISAPI Interface", "Includes everything you need to run PHP on the FifthGen Engine or other ISAPI compatible web servers.", "/download/files/php5_isapi.zip", "" }
            }
            
            cnt = len( a )
            for ( i=1; i<=cnt; i++ )
                ::id = a[i,1]
                ::data.category = a[i,2]
                ::data.title = a[i,3]
                ::data.desc = a[i,4]
                ::data.fname = a[i,5]
                ::data.srcfile = a[i,6]
                   ::CreateNewRecord( ::id )
            end
            
        end

        ::IsOpen = 1

        ::db = dbuse( ::dbFileName, "objExtensions", 1 )
        if ( ! fileExists( ::dbIndexName ) )
            (::db)->dbCreateIndex( ::dbIndexName, "upper( field->id )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName )

        return( 1 )
    END

    METHOD close( )
        if ( ::IsOpen == 1 )
            (::db)->dbClose( )
        end
        ::IsOpen--
        return( 1 )
    END

    METHOD seek( item )
        (::db)->dbSeek( upper( item ) )
        return( (::db)->dbFound( ) )
    END

    METHOD reindex( )
        return( (::db)->dbReindex( ) )
    END

    METHOD get( )
        ::id = alltrim( (::db)->id )
        ::data.get( (::db)->data )
        return( 1 )
    END

    METHOD put( )
        (::db)->id = ::id
        ::data.id = ::id
        (::db)->data = ::data.put(  )
        return( 1 )
    END

    METHOD validate( )
        return( 1 )
    END

    METHOD CreateNewRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )
        if ( ::seek( key ) )
            ::errmsg = "Record (" + key + ") already exists!"
            ::close( )
            return( 0 )
        end

        (::db)->dbAppend( )
        ::put( )
        ::unlock( )

        ::close( )
        return( 1 )
    END

    METHOD GetRecord( key )
        ::open( )

        ::init( )
        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        ::get( )
        ::close( )

        return( 1 )
    END

    METHOD SetRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )

        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        if ( ::rlock( ) )
            ::put( )
            ::unlock( )
        end
        ::close( )

        return( 1 )
    END

    METHOD dbOrder( val )
        (::db)->dbOrder( val )
    END
    METHOD dbGoto( val )
        (::db)->dbGoto( val )
    END
    METHOD dbGoTop( )
        (::db)->dbGoTop( )
    END
    METHOD dbGoBottom( )
        (::db)->dbGoBottom( )
    END
    METHOD dbEOF( )
        return( (::db)->dbEOF( ) )
    END
    METHOD dbBOF( )
        return( (::db)->dbBOF( ) )
    END
    METHOD dbseek( id )
        return( ::seek( id ) )
    END
    METHOD dbSkip( index )
        if ( type( index ) == 'N' )
            (::db)->dbSkip( index )
        else
            (::db)->dbSkip( )
        end
        return( 1 )
    END

    METHOD rlock( )
        local EndTime
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to lock record'
            return( 0 )
        end
        EndTime = seconds( ) + ::LockTimeout
        while ( ! (::db)->dbRLock( ) )
            if ( ( seconds( ) > EndTime ) || ( ( seconds( ) + ::LockTimeout ) < EndTime ) )
                ::errmsg ='Unable to lock database record'
                return( 0 )
            end
        end
        return( 1 )
    END

    METHOD unlock( )
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to unlock record'
            return( 0 )
        end
        (::db)->dbUnLock( )
        return( 1 )
    END

END


CLASS FGL_Files_Extensions
  // FGL extensions master object
  // Created: January 16, 2006 at 16:14:35 by 127.0.0.1
  // Generated: January 21, 2006 17:49:45
  // IsPacked=1 NoHeader=1 IsAutoPacked=0
  PUBLIC:
    local _status_
    local category, contributedBy, contributedDate, desc, docfile, fdate, fname
    local fsize, ftime, id, keywords, lisc, platforms, projectid, srcfile, status
    local title, type, version

    METHOD new( )
        ::init( )
        return( 1 )
    END

    METHOD init( )
        ::_status_ = 1
        ::initFields( )
        return( 1 )
    END

    METHOD initFields( )
        ::category = ""
        ::contributedBy = ""
        ::contributedDate = ""
        ::desc = ""
        ::docfile = ""
        ::fdate = ""
        ::fname = ""
        ::fsize = 0
        ::ftime = ""
        ::id = ""
        ::keywords = ""
        ::lisc = ""
        ::platforms = 0
        ::projectid = ""
        ::srcfile = ""
        ::status = ""
        ::title = ""
        ::type = 0
        ::version = ""
        return( 1 )
    END

    METHOD UpdateFromForm( session )
        ::category = session.var( "category" )
        ::contributedBy = session.var( "contributedBy" )
        ::contributedDate = session.var( "contributedDate" )
        ::desc = session.var( "desc" )
        ::docfile = session.var( "docfile" )
        ::fdate = session.var( "fdate" )
        ::fname = session.var( "fname" )
        ::fsize = 0 + session.var( "fsize" )
        ::ftime = session.var( "ftime" )
        ::id = session.var( "id" )
        ::keywords = session.var( "keywords" )
        ::lisc = session.var( "lisc" )
        ::platforms = 0 + session.var( "platforms" )
        ::projectid = session.var( "projectid" )
        ::srcfile = session.var( "srcfile" )
        ::status = session.var( "status" )
        ::title = session.var( "title" )
        ::type = 0 + session.var( "type" )
        ::version = session.var( "version" )
        return( 1 )
    END

    METHOD FieldList( )
        static flds = { 
            { "category", 1, 0, 0, 0, 1, "", "", "" },
            { "contributedBy", 1, 0, 0, 0, 1, "", "", "" },
            { "contributedDate", 1, 0, 0, 0, 1, "", "", "" },
            { "desc", 1, 0, 0, 0, 1, "", "", "" },
            { "docfile", 1, 0, 0, 0, 1, "", "", "" },
            { "fdate", 1, 0, 0, 0, 1, "", "", "" },
            { "fname", 1, 0, 0, 0, 1, "", "", "" },
            { "fsize", 3, 0, 0, 0, 1, "", "", "" },
            { "ftime", 1, 0, 0, 0, 1, "", "", "" },
            { "id", 1, 0, 0, 0, 1, "", "", "" },
            { "keywords", 1, 0, 0, 0, 1, "", "", "" },
            { "lisc", 1, 0, 0, 0, 1, "", "", "" },
            { "platforms", 3, 0, 0, 0, 1, "", "", "" },
            { "projectid", 1, 0, 0, 0, 1, "", "", "" },
            { "srcfile", 1, 0, 0, 0, 1, "", "", "" },
            { "status", 1, 0, 0, 0, 1, "", "", "" },
            { "title", 1, 0, 0, 0, 1, "", "", "" },
            { "type", 3, 0, 0, 0, 1, "", "", "" },
            { "version", 1, 0, 0, 0, 1, "", "", "" }
        }
        return( flds )
    END

    ACCESS avars
        static a = { 
            "category",
            "contributedBy",
            "contributedDate",
            "desc",
            "docfile",
            "fdate",
            "fname",
            "fsize",
            "ftime",
            "id",
            "keywords",
            "lisc",
            "platforms",
            "projectid",
            "srcfile",
            "status",
            "title",
            "type",
            "version"
        }
        return( a )
    END

    METHOD get( data )
        return( unpack( data, self ) )
    END

    METHOD put( )
        return( pack( self ) )
    END

    ACCESS TransactionData
        return( ArrayToNameValue( objToArray( self ), '=', '&' ) )
    END

    ACCESS aCategory
        static a = {
            "Applications",
            "Barcode",
            "Core",
            "Database",
            "Date/Time",
            "E-commerce",
            "Email",
            "Fax",
            "Games/Entertainment",
            "Graphics",
            "Imaging",
            "Math",
            "Server",
            "Validation",
            "Web Sites",
            "Other"
        }
        return( a )
    END

    ACCESS aPlatform
        static a = {
            { 1, "Win32" },
            { 2, "Win64" },
            { 4, "Linux" },
            { 8, "Unix" },
            { 16, "Solaris" },
            { 1023, "ALL" }
        }
        return( a )
    END

    ACCESS aStatus
        static a = {
            { 1, "Production" },
            { 2, "Beta" },
            { 4, "Alpha" },
            { 8, "Planning" },
            { 16, "Other" }
        }
        return( a )
    END

    ACCESS aType
        static a = {
            { 1, "FGL" },
            { 2, "DLL" },
            { 4, "ActiveX" },
            { 8, "Java" },
            { 16, ".Net" },
            { 1023, "ALL" }
        }
        return( a )
    END

    ACCESS ID_PLATFORM_LINUX
        return( 4 )
    END

    ACCESS ID_PLATFORM_SOLARIS
        return( 16 )
    END

    ACCESS ID_PLATFORM_STANDARD
        return( 7 )
    END

    ACCESS ID_PLATFORM_UNIX
        return( 8 )
    END

    ACCESS ID_PLATFORM_WIN32
        return( 1 )
    END

    ACCESS ID_PLATFORM_WIN64
        return( 2 )
    END

    ACCESS statusdesc
        local i, cnt, a
        
        a = ::aStatus
        cnt = len( a )
        for ( i=1; i<=cnt; i++ )
            if ( ::status == a[i,1] )
                return( a[i,2] )
            end
        end
        return( "Unknown" )
    END

    ACCESS typedesc
        local i, cnt, a
        
        a = ::aType
        cnt = len( a )
        for ( i=1; i<=cnt; i++ )
            if ( ::type == a[i,1] )
                return( a[i,2] )
            end
        end
        return( "Unknown" )
    END

    METHOD rules( )
        return( 1 )
    END

    ACCESS default( name )
        name = name
        return( 0 )
    END
    ASSIGN default( name, val )
        name = name
        val = val
        return
    END

END



CLASS objUserGroups
  PUBLIC:
    local IsOpen, LockTimeout, errmsg, db
    local city, country, name, state, website

    METHOD New( )
        ::IsOpen = 0
        ::errmsg = ""
        ::LockTimeout = 2
        ::db = 0
        ::Init( )
        return( 1 )
    END

    METHOD Init( )
        ::city = ""
        ::country = ""
        ::name = ""
        ::state = ""
        ::website = ""
        return( 1 )
    END

    ACCESS dbFileName
        return( 'c:\fgl\data\usergroups.db' )
    END

    ACCESS dbIndexName
        return( 'c:\fgl\data\usergroups.dx' )
    END

    METHOD create( )
        local db_struct = {
            { "name", "C", 40, 0 },
            { "city", "C", 40, 0 },
            { "state", "C", 10, 0 },
            { "country", "C", 30, 0 },
            { "website", "C", 60, 0 }
        }
        return( dbcreate( ::dbFileName, db_struct ) )
    END

    METHOD open( )
        local a, cnt, i
    
        if ( ::IsOpen )
            ::IsOpen++
            return( 1 )
        end

        if ( ! fileExists( ::dbFileName ) )
            ::create( )
            
            // name/city/state/country/website
            a = { 
                { "Greater DC FGL User's Group", "District of Columbia", "DC", "USA", "http://dc-fgl-ug.fglfoundation.org" },
                { "Southern California FGL User's Group", "Irvine", "CA", "USA", "http://sc-fgl-ug.fglfoundation.org" },
                { "South Florida FGL User's Group", "Fort Lauderdale", "FL", "USA", "http://sfl-fgl-ug.fglfoundation.org" }
            }
            
            cnt = len( a )
            for ( i=1; i<=cnt; i++ )
                ::name = a[i,1]
                ::city = a[i,2]
                ::state = a[i,3]
                ::country = a[i,4]
                ::website = a[i,5]
                   ::CreateNewRecord( ::name )
            end
            
        end

        ::IsOpen = 1

        ::db = dbuse( ::dbFileName, "objUserGroups", 1 )
        if ( ! fileExists( ::dbIndexName ) )
            (::db)->dbCreateIndex( ::dbIndexName, "upper( field->name )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName )

        return( 1 )
    END

    METHOD close( )
        if ( ::IsOpen == 1 )
            (::db)->dbClose( )
        end
        ::IsOpen--
        return( 1 )
    END

    METHOD seek( item )
        (::db)->dbSeek( upper( item ) )
        return( (::db)->dbFound( ) )
    END

    METHOD reindex( )
        return( (::db)->dbReindex( ) )
    END

    METHOD get( )
        ::city = alltrim( (::db)->city )
        ::country = alltrim( (::db)->country )
        ::name = alltrim( (::db)->name )
        ::state = alltrim( (::db)->state )
        ::website = alltrim( (::db)->website )
        return( 1 )
    END

    METHOD put( )
        (::db)->city = ::city
        (::db)->country = ::country
        (::db)->name = ::name
        (::db)->state = ::state
        (::db)->website = ::website
        return( 1 )
    END

    METHOD validate( )
        return( 1 )
    END

    METHOD CreateNewRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )
        if ( ::seek( key ) )
            ::errmsg = "Record (" + key + ") already exists!"
            ::close( )
            return( 0 )
        end

        (::db)->dbAppend( )
        ::put( )
        ::unlock( )

        ::close( )
        return( 1 )
    END

    METHOD GetRecord( key )
        ::open( )

        ::init( )
        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        ::get( )
        ::close( )

        return( 1 )
    END

    METHOD SetRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )

        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        if ( ::rlock( ) )
            ::put( )
            ::unlock( )
        end
        ::close( )

        return( 1 )
    END

    METHOD dbOrder( val )
        (::db)->dbOrder( val )
    END
    METHOD dbGoto( val )
        (::db)->dbGoto( val )
    END
    METHOD dbGoTop( )
        (::db)->dbGoTop( )
    END
    METHOD dbGoBottom( )
        (::db)->dbGoBottom( )
    END
    METHOD dbEOF( )
        return( (::db)->dbEOF( ) )
    END
    METHOD dbBOF( )
        return( (::db)->dbBOF( ) )
    END
    METHOD dbseek( id )
        return( ::seek( id ) )
    END
    METHOD dbSkip( index )
        if ( type( index ) == 'N' )
            (::db)->dbSkip( index )
        else
            (::db)->dbSkip( )
        end
        return( 1 )
    END

    METHOD rlock( )
        local EndTime
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to lock record'
            return( 0 )
        end
        EndTime = seconds( ) + ::LockTimeout
        while ( ! (::db)->dbRLock( ) )
            if ( ( seconds( ) > EndTime ) || ( ( seconds( ) + ::LockTimeout ) < EndTime ) )
                ::errmsg ='Unable to lock database record'
                return( 0 )
            end
        end
        return( 1 )
    END

    METHOD unlock( )
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to unlock record'
            return( 0 )
        end
        (::db)->dbUnLock( )
        return( 1 )
    END

END

CLASS objProducts
  PUBLIC:
    local IsOpen, LockTimeout, errmsg, db
    local data, id, sys

    METHOD New( )
        ::IsOpen = 0
        ::errmsg = ""
        ::LockTimeout = 2
        ::db = 0
        ::data = new( "FGL_Products" )
        ::Init( )
        ::sys = new( "objSystem" )        
        return( 1 )
    END

    METHOD Init( )
        ::id = ""
        ::data.init( )
        return( 1 )
    END

    ACCESS dbFileName
        return( 'c:\fgl\data\objProducts.db' )
    END

    ACCESS dbIndexName
        return( 'c:\fgl\data\objProducts.dx' )
    END

    METHOD create( )
        local db_struct = {
            { "id", "C", 40, 0 },
            { "data", "B", 20, 0 }
        }
        return( dbcreate( ::dbFileName, db_struct ) )
    END

    METHOD open( )
        local a, cnt, i
    
        if ( ::IsOpen )
            ::IsOpen++
            return( 1 )
        end

        if ( ! fileExists( ::dbFileName ) )
            ::create( )
            
            // create default recs
            ::data.contributedBy = "SMR"
            ::data.contributedDate = date( )
            ::data.status = 1
            ::data.version = "1.0"
            ::data.type = 1
            ::data.platforms = ::data.ID_PLATFORM_WIN32 | ::data.ID_PLATFORM_WIN64
            ::data.lisc = "Commercial license"
            ::data.cost = ""
            ::data.UserRating = 5
            ::data.ReviewRating = 5
            ::data.publisher = "Fifth Generation Systems, Inc."
            ::data.website = "http://www.fifthgensys.com"
            
            // id, cat, title, desc, fname, imgSmall
            a = { 
                { "FGSCOFGL01", "Server", "Corner Office Management Suite for FGL", "The CornerOFFICE Management Suite for FGL makes it easy to monitor and administer a diverse collection of high-performance distributed servers – with added functionality unique to FGL platforms. The suite provides unprecedented real-time access to a wide array of information, including server connectivity, performance,  operational status, security, and access control, as well as remote configuration management. System utilization and activity usage allows administrators to examine current user and resource activity and 'hammer down' into a high level of detail – all in real-time as it occurs. Information can be gathered, filtered, sorted, reported, and exported.", "http://www.fifthgensys.com/coMgmtSuite_FGL.htm", "market/FGSCOFGL01.gif" },
                { "FGSDEVRE01", "Developer", "FifthGen Rules Engine for FGL", "The FifthGen Rules Engine provides a highly optimized rules engine for the automation of business and workflow processes. The rules engine can integrate with and alter the behavior of any application component. Rules can be integrated into the system without knowledge of programming skills, but can also be incorporated directly into objects by knowledgeable programming personnel for optimized performance.", "http://www.fifthgensys.com/FifthGen_RulesEngine_FGL.htm", "market/FGSDEVRE01.gif" },
                { "BRTINSMGMT", "Application", "BRT's INSMGMT Solution for the Insurance Industry", "The InsMGMT™ system (pronounced \"Ins-Management\") provides individual components and complete web-based end-to-end solutions for insurance companies, MGAs, GAs, TPAs, and agencies. The complete solution is fully customizable, object oriented, rules-based, automates your existing forms and workflow processes, and easily integrates with your existing legacy systems.", "http://www.insmgmt.com", "market/BRTINSMGMT.gif" }
            }

            
            cnt = len( a )
            for ( i=1; i<=cnt; i++ )
if ( i == 3 )
            ::data.publisher = "Business Risk Technologies, Inc."
            ::data.website = "http://www.brtsystems.com"
end

                ::id = a[i,1]
                ::data.category = a[i,2]
                ::data.title = a[i,3]
                ::data.desc = a[i,4]
                ::data.fname = a[i,5]
                ::data.imgSmall = a[i,6]
                   ::CreateNewRecord( ::id )
            end
            
        end

        ::IsOpen = 1

        ::db = dbuse( ::dbFileName, "objExtensions", 1 )
        if ( ! fileExists( ::dbIndexName ) )
            (::db)->dbCreateIndex( ::dbIndexName, "upper( field->id )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName )

        return( 1 )
    END

    METHOD close( )
        if ( ::IsOpen == 1 )
            (::db)->dbClose( )
        end
        ::IsOpen--
        return( 1 )
    END

    METHOD seek( item )
        (::db)->dbSeek( upper( item ) )
        return( (::db)->dbFound( ) )
    END

    METHOD reindex( )
        return( (::db)->dbReindex( ) )
    END

    METHOD get( )
        ::id = alltrim( (::db)->id )
        ::data.get( (::db)->data )
        return( 1 )
    END

    METHOD put( )
        (::db)->id = ::id
        ::data.id = ::id
        (::db)->data = ::data.put(  )
        return( 1 )
    END

    METHOD validate( )
        return( 1 )
    END

    METHOD CreateNewRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )
        if ( ::seek( key ) )
            ::errmsg = "Record (" + key + ") already exists!"
            ::close( )
            return( 0 )
        end

        (::db)->dbAppend( )
        ::put( )
        ::unlock( )

        ::close( )
        return( 1 )
    END

    METHOD GetRecord( key )
        ::open( )

        ::init( )
        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        ::get( )
        ::close( )

        return( 1 )
    END

    METHOD SetRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )

        if ( ! ::seek( key ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        if ( ::rlock( ) )
            ::put( )
            ::unlock( )
        end
        ::close( )

        return( 1 )
    END

    METHOD dbOrder( val )
        (::db)->dbOrder( val )
    END
    METHOD dbGoto( val )
        (::db)->dbGoto( val )
    END
    METHOD dbGoTop( )
        (::db)->dbGoTop( )
    END
    METHOD dbGoBottom( )
        (::db)->dbGoBottom( )
    END
    METHOD dbEOF( )
        return( (::db)->dbEOF( ) )
    END
    METHOD dbBOF( )
        return( (::db)->dbBOF( ) )
    END
    METHOD dbseek( id )
        return( ::seek( id ) )
    END
    METHOD dbSkip( index )
        if ( type( index ) == 'N' )
            (::db)->dbSkip( index )
        else
            (::db)->dbSkip( )
        end
        return( 1 )
    END

    METHOD rlock( )
        local EndTime
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to lock record'
            return( 0 )
        end
        EndTime = seconds( ) + ::LockTimeout
        while ( ! (::db)->dbRLock( ) )
            if ( ( seconds( ) > EndTime ) || ( ( seconds( ) + ::LockTimeout ) < EndTime ) )
                ::errmsg ='Unable to lock database record'
                return( 0 )
            end
        end
        return( 1 )
    END

    METHOD unlock( )
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to unlock record'
            return( 0 )
        end
        (::db)->dbUnLock( )
        return( 1 )
    END

    ACCESS IDSTYLE_SHORT
        return( 1 )
    END
    ACCESS IDSTYLE_LONG
        return( 2 )
    END

    METHOD DisplayRecord( id, style )
        local s
        
        if ( ! ::GetRecord( upper( id ) ) )
            return( "" )
        end

        s = new( "ServerBuffer" )
        
        switch ( style )
          case ( ::IDSTYLE_SHORT )
              s += "<font class=subtitle>" + ::data.title + "</font><hr size=1>"
              s += "v." + ::data.version + ", " + ::data.lisc + "<br>"
              s += "by " + ::data.publisher + "<br><br>"
            s += "<center><img src='" + ::data.imgSmall + "' border=0></center><br>"
              s += ::sys.AbbreviateString( ::data.desc, 256 )
          
              break
        end

        return( s.str )
    END


END



CLASS FGL_Products
  // FGL products master object
  // Created: January 16, 2006 at 16:14:35 by 127.0.0.1
  // Generated: January 24, 2006 23:38:31
  // IsPacked=1 NoHeader=1 IsAutoPacked=0
  PUBLIC:
    local _status_
    local category, contributedBy, contributedDate, cost, desc, docfile, fdate, fname
    local fsize, ftime, id, imgLarge, imgSmall, keywords, lisc, platforms, projectid
    local publisher, ReviewRating, srcfile, status, title, ttlDownloads, type, UserRating
    local version, website

    METHOD new( )
        ::init( )
        return( 1 )
    END

    METHOD init( )
        ::_status_ = 1
        ::initFields( )
        return( 1 )
    END

    METHOD initFields( )
        ::category = ""
        ::contributedBy = ""
        ::contributedDate = ""
        ::cost = ""
        ::desc = ""
        ::docfile = ""
        ::fdate = ""
        ::fname = ""
        ::fsize = 0
        ::ftime = ""
        ::id = ""
        ::imgLarge = ""
        ::imgSmall = ""
        ::keywords = ""
        ::lisc = ""
        ::platforms = 0
        ::projectid = ""
        ::publisher = ""
        ::ReviewRating = 0
        ::srcfile = ""
        ::status = ""
        ::title = ""
        ::ttlDownloads = 0
        ::type = 0
        ::UserRating = ""
        ::version = ""
        ::website = ""
        return( 1 )
    END

    METHOD UpdateFromForm( session )
        ::category = session.var( "category" )
        ::contributedBy = session.var( "contributedBy" )
        ::contributedDate = session.var( "contributedDate" )
        ::cost = session.var( "cost" )
        ::desc = session.var( "desc" )
        ::docfile = session.var( "docfile" )
        ::fdate = session.var( "fdate" )
        ::fname = session.var( "fname" )
        ::fsize = 0 + session.var( "fsize" )
        ::ftime = session.var( "ftime" )
        ::id = session.var( "id" )
        ::imgLarge = session.var( "imgLarge" )
        ::imgSmall = session.var( "imgSmall" )
        ::keywords = session.var( "keywords" )
        ::lisc = session.var( "lisc" )
        ::platforms = 0 + session.var( "platforms" )
        ::projectid = session.var( "projectid" )
        ::publisher = session.var( "publisher" )
        ::ReviewRating = 0 + session.var( "ReviewRating" )
        ::srcfile = session.var( "srcfile" )
        ::status = session.var( "status" )
        ::title = session.var( "title" )
        ::ttlDownloads = 0 + session.var( "ttlDownloads" )
        ::type = 0 + session.var( "type" )
        ::UserRating = session.var( "UserRating" )
        ::version = session.var( "version" )
        ::website = session.var( "website" )
        return( 1 )
    END

    METHOD FieldList( )
        static flds = { 
            { "category", 1, 0, 0, 0, 1, "", "", "" },
            { "contributedBy", 1, 0, 0, 0, 1, "", "", "" },
            { "contributedDate", 1, 0, 0, 0, 1, "", "", "" },
            { "cost", 1, 0, 0, 0, 1, "", "", "" },
            { "desc", 1, 0, 0, 0, 1, "", "", "" },
            { "docfile", 1, 0, 0, 0, 1, "", "", "" },
            { "fdate", 1, 0, 0, 0, 1, "", "", "" },
            { "fname", 1, 0, 0, 0, 1, "", "", "" },
            { "fsize", 3, 0, 0, 0, 1, "", "", "" },
            { "ftime", 1, 0, 0, 0, 1, "", "", "" },
            { "id", 1, 0, 0, 0, 1, "", "", "" },
            { "imgLarge", 1, 0, 0, 0, 1, "", "", "" },
            { "imgSmall", 1, 0, 0, 0, 1, "", "", "" },
            { "keywords", 1, 0, 0, 0, 1, "", "", "" },
            { "lisc", 1, 0, 0, 0, 1, "", "", "" },
            { "platforms", 3, 0, 0, 0, 1, "", "", "" },
            { "projectid", 1, 0, 0, 0, 1, "", "", "" },
            { "publisher", 1, 0, 0, 0, 1, "", "", "" },
            { "ReviewRating", 3, 0, 0, 0, 1, "", "", "" },
            { "srcfile", 1, 0, 0, 0, 1, "", "", "" },
            { "status", 1, 0, 0, 0, 1, "", "", "" },
            { "title", 1, 0, 0, 0, 1, "", "", "" },
            { "ttlDownloads", 3, 0, 0, 0, 1, "", "", "" },
            { "type", 3, 0, 0, 0, 1, "", "", "" },
            { "UserRating", 1, 0, 0, 0, 1, "", "", "" },
            { "version", 1, 0, 0, 0, 1, "", "", "" },
            { "website", 1, 0, 0, 0, 1, "", "", "" }
        }
        return( flds )
    END

    ACCESS avars
        static a = { 
            "category",
            "contributedBy",
            "contributedDate",
            "cost",
            "desc",
            "docfile",
            "fdate",
            "fname",
            "fsize",
            "ftime",
            "id",
            "imgLarge",
            "imgSmall",
            "keywords",
            "lisc",
            "platforms",
            "projectid",
            "publisher",
            "ReviewRating",
            "srcfile",
            "status",
            "title",
            "ttlDownloads",
            "type",
            "UserRating",
            "version",
            "website"
        }
        return( a )
    END

    METHOD get( data )
        return( unpack( data, self ) )
    END

    METHOD put( )
        return( pack( self ) )
    END

    ACCESS TransactionData
        return( ArrayToNameValue( objToArray( self ), '=', '&' ) )
    END

    ACCESS aCategory
        static a = {
            "Application",
            "Barcode",
            "Core",
            "Database",
            "Date/Time",
            "Developer",
            "E-commerce",
            "Email",
            "Fax",
            "Games/Entertainment",
            "Graphics",
            "Imaging",
            "Math",
            "Server",
            "Validation",
            "Web Sites",
            "Other"
        }
        return( a )
    END

    ACCESS aPlatform
        static a = {
            { 1, "Win32" },
            { 2, "Win64" },
            { 4, "Linux" },
            { 8, "Unix" },
            { 16, "Solaris" },
            { 1023, "ALL" }
        }
        return( a )
    END

    ACCESS aStatus
        static a = {
            { 1, "Production" },
            { 2, "Beta" },
            { 4, "Alpha" },
            { 8, "Planning" },
            { 16, "Other" }
        }
        return( a )
    END

    ACCESS aType
        static a = {
            { 1, "FGL" },
            { 2, "DLL" },
            { 4, "ActiveX" },
            { 8, "Java" },
            { 16, ".Net" },
            { 1023, "ALL" }
        }
        return( a )
    END

    ACCESS ID_PLATFORM_LINUX
        return( 4 )
    END

    ACCESS ID_PLATFORM_SOLARIS
        return( 16 )
    END

    ACCESS ID_PLATFORM_STANDARD
        return( 7 )
    END

    ACCESS ID_PLATFORM_UNIX
        return( 8 )
    END

    ACCESS ID_PLATFORM_WIN32
        return( 1 )
    END

    ACCESS ID_PLATFORM_WIN64
        return( 2 )
    END

    ACCESS statusdesc
        local i, cnt, a
        
        a = ::aStatus
        cnt = len( a )
        for ( i=1; i<=cnt; i++ )
            if ( ::status == a[i,1] )
                return( a[i,2] )
            end
        end
        return( "Unknown" )
    END

    ACCESS typedesc
        local i, cnt, a
        
        a = ::aType
        cnt = len( a )
        for ( i=1; i<=cnt; i++ )
            if ( ::type == a[i,1] )
                return( a[i,2] )
            end
        end
        return( "Unknown" )
    END

    METHOD rules( )
        return( 1 )
    END

    ACCESS default( name )
        name = name
        return( 0 )
    END
    ASSIGN default( name, val )
        name = name
        val = val
        return
    END

END


CLASS objMembers
  PUBLIC:
    local IsOpen, LockTimeout, errmsg, db
    local city, country, data, id, name, state, valid, zip

    METHOD New( )
        ::IsOpen = 0
        ::errmsg = ""
        ::LockTimeout = 2
        ::db = 0
        ::Init( )
        return( 1 )
    END

    METHOD Init( )
        ::city = ""
        ::country = ""
        ::data = new( "FGL_Member" )
        ::id = ""
        ::name = ""
        ::state = ""
        ::zip = ""
        return( 1 )
    END

    ACCESS dbFileName
        return( 'c:\fgl\data\members.db' )
    END

    ACCESS dbIndexName
        return( 'c:\fgl\data\members.dx' )
    END

    ACCESS dbIndexName2
        return( 'c:\fgl\data\members2.dx' )
    END

    ACCESS dbIndexName3
        return( 'c:\fgl\data\members3.dx' )
    END

    ACCESS dbIndexName4
        return( 'c:\fgl\data\members4.dx' )
    END

    METHOD create( )
        local db_struct = {
            { "id", "C", 65, 0 },
            { "name", "C", 40, 0 },
            { "city", "C", 40, 0 },
            { "state", "C", 20, 0 },
            { "zip", "C", 20, 0 },
            { "country", "C", 30, 0 },
            { "data", "B", 20, 0 },
            { "valid", "~", 4, 0 }
        }
        return( dbcreate( ::dbFileName, db_struct ) )
    END

    METHOD open( )
        if ( ::IsOpen )
            ::IsOpen++
            return( 1 )
        end

        if ( ! fileExists( ::dbFileName ) )
            ::create( )
        end

        ::IsOpen = 1

        ::db = dbuse( ::dbFileName, "objMembers", 1 )
        if ( ! fileExists( ::dbIndexName ) )
            (::db)->dbCreateIndex( ::dbIndexName, "upper( field->id )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName )

        if ( ! fileExists( ::dbIndexName2 ) )
            (::db)->dbCreateIndex( ::dbIndexName2, "upper( field->name + field->zip )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName2 )

        if ( ! fileExists( ::dbIndexName3 ) )
            (::db)->dbCreateIndex( ::dbIndexName3, "upper( field->zip + field->name )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName3 )

        if ( ! fileExists( ::dbIndexName4 ) )
            (::db)->dbCreateIndex( ::dbIndexName4, "upper( field->country + field->name + field->zip )", 0 )
        end
        (::db)->dbOpenIndex( ::dbIndexName4 )

        (::db)->dbOrder( 1 )

        return( 1 )
    END

    METHOD close( )
        if ( ::IsOpen == 1 )
            (::db)->dbClose( )
        end
        ::IsOpen--
        return( 1 )
    END

    METHOD seek( item )
        (::db)->dbSeek( upper( item ) )
        return( (::db)->dbFound( ) )
    END

    METHOD reindex( )
        return( (::db)->dbReindex( ) )
    END

    METHOD get( )
        ::city = alltrim( (::db)->city )
        ::country = alltrim( (::db)->country )
        ::data = ::data.get( (::db)->data )
        ::id = alltrim( (::db)->id )
        ::name = alltrim( (::db)->name )
        ::state = alltrim( (::db)->state )
        ::zip = alltrim( (::db)->zip )
        return( 1 )
    END

    METHOD put( )
        (::db)->city = ::data.city
        (::db)->country = ::data.country
        (::db)->data = ::data.put( )
        (::db)->id = upper( ::data.email )
        (::db)->name = ::data.fname + " " + ::data.fname
        (::db)->state = ::data.state
        (::db)->zip = ::data.zip
        return( 1 )
    END

    METHOD validate( )
        return( 1 )
    END

    METHOD CreateNewRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )
        if ( ::seek( upper( key ) ) )
            ::errmsg = "Record (" + key + ") already exists!"
            ::close( )
            return( 0 )
        end

        ::data.datecreated = date( ) + " " + time( )

        (::db)->dbAppend( )
        ::put( )
        ::unlock( )

        ::close( )
        return( 1 )
    END

    METHOD GetRecord( key )
        ::open( )

        ::init( )
        if ( ! ::seek( upper( key ) ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        ::get( )
        ::close( )

        return( 1 )
    END

    METHOD SetRecord( key )
        if ( ! ::validate( ) )
            return( 0 )
        end

        ::open( )

        if ( ! ::seek( upper( key ) ) )
            ::errmsg = "Unable to locate record (" + key + ")"
            ::close( )
            return( 0 )
        end

        if ( ::rlock( ) )
            ::put( )
            ::unlock( )
        end
        ::close( )

        return( 1 )
    END

    METHOD dbOrder( val )
        (::db)->dbOrder( val )
    END
    METHOD dbGoto( val )
        (::db)->dbGoto( val )
    END
    METHOD dbGoTop( )
        (::db)->dbGoTop( )
    END
    METHOD dbGoBottom( )
        (::db)->dbGoBottom( )
    END
    METHOD dbEOF( )
        return( (::db)->dbEOF( ) )
    END
    METHOD dbBOF( )
        return( (::db)->dbBOF( ) )
    END
    METHOD dbseek( id )
        return( ::seek( id ) )
    END
    METHOD dbSkip( index )
        if ( type( index ) == 'N' )
            (::db)->dbSkip( index )
        else
            (::db)->dbSkip( )
        end
        return( 1 )
    END

    METHOD rlock( )
        local EndTime
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to lock record'
            return( 0 )
        end
        EndTime = seconds( ) + ::LockTimeout
        while ( ! (::db)->dbRLock( ) )
            if ( ( seconds( ) > EndTime ) || ( ( seconds( ) + ::LockTimeout ) < EndTime ) )
                ::errmsg ='Unable to lock database record'
                return( 0 )
            end
        end
        return( 1 )
    END

    METHOD unlock( )
        if ( ! ::IsOpen )
            ::errmsg = 'Database must be open to unlock record'
            return( 0 )
        end
        (::db)->dbUnLock( )
        return( 1 )
    END

END


CLASS FGL_Member
  // Master FGL Member data object
  // Created: January 26, 2006 at 14:19:05 by 127.0.0.1
  // Generated: February  2, 2006 20:31:24
  // IsPacked=1 NoHeader=1 IsAutoPacked=0
  PUBLIC:
    local _status_
    local browserFirefox, browserIE, browserOpera, browserOther, city, company, companySize
    local country, datecreated, dbAccess, dbDB2, dbFifthGen, dbMSSQL, dbMySQL, dbOracle
    local dbOther, email, experience, faxhome, faxoffice, fname, IsVerified, langASP
    local langC, langCPlusPlus, langDotNet, langFGL, langJava, langOther, langPHP
    local langPython, langRuby, langVB, lastused, lname, LoginPage, osLinux, osMac
    local osOther, osSolaris, osUnix, osWin32, osWin64, password, phonecell, phonehome
    local phoneoffice, RecommendationCount, ReferredBy, serverApache, serverFifthGen
    local serverIIS, serverOther, serverSun, state, street, usagecount, usertype
    local website, WhereHeardAbout, zip

    METHOD new( )
        ::init( )
        return( 1 )
    END

    METHOD init( )
        ::_status_ = 1
        ::initFields( )
        return( 1 )
    END

    METHOD initFields( )
        ::browserFirefox = ""
        ::browserIE = ""
        ::browserOpera = ""
        ::browserOther = ""
        ::city = ""
        ::company = ""
        ::companySize = ""
        ::country = ""
        ::datecreated = ""
        ::dbAccess = ""
        ::dbDB2 = ""
        ::dbFifthGen = ""
        ::dbMSSQL = ""
        ::dbMySQL = ""
        ::dbOracle = ""
        ::dbOther = ""
        ::email = ""
        ::experience = ""
        ::faxhome = ""
        ::faxoffice = ""
        ::fname = ""
        ::IsVerified = 0
        ::langASP = ""
        ::langC = ""
        ::langCPlusPlus = ""
        ::langDotNet = ""
        ::langFGL = ""
        ::langJava = ""
        ::langOther = ""
        ::langPHP = ""
        ::langPython = ""
        ::langRuby = ""
        ::langVB = ""
        ::lastused = ""
        ::lname = ""
        ::LoginPage = ""
        ::osLinux = ""
        ::osMac = ""
        ::osOther = ""
        ::osSolaris = ""
        ::osUnix = ""
        ::osWin32 = ""
        ::osWin64 = ""
        ::password = ""
        ::phonecell = ""
        ::phonehome = ""
        ::phoneoffice = ""
        ::RecommendationCount = 0
        ::ReferredBy = ""
        ::serverApache = ""
        ::serverFifthGen = ""
        ::serverIIS = ""
        ::serverOther = ""
        ::serverSun = ""
        ::state = ""
        ::street = ""
        ::usagecount = 0
        ::usertype = ""
        ::website = ""
        ::WhereHeardAbout = ""
        ::zip = ""
        return( 1 )
    END

    METHOD UpdateFromForm( session )
        ::browserFirefox = session.var( "browserFirefox" )
        ::browserIE = session.var( "browserIE" )
        ::browserOpera = session.var( "browserOpera" )
        ::browserOther = session.var( "browserOther" )
        ::city = session.var( "city" )
        ::company = session.var( "company" )
        ::companySize = session.var( "companySize" )
        ::country = session.var( "country" )
        ::datecreated = session.var( "datecreated" )
        ::dbAccess = session.var( "dbAccess" )
        ::dbDB2 = session.var( "dbDB2" )
        ::dbFifthGen = session.var( "dbFifthGen" )
        ::dbMSSQL = session.var( "dbMSSQL" )
        ::dbMySQL = session.var( "dbMySQL" )
        ::dbOracle = session.var( "dbOracle" )
        ::dbOther = session.var( "dbOther" )
        ::email = session.var( "email" )
        ::experience = session.var( "experience" )
        ::faxhome = session.var( "faxhome" )
        ::faxoffice = session.var( "faxoffice" )
        ::fname = session.var( "fname" )
        ::IsVerified = 0 + session.var( "IsVerified" )
        ::langASP = session.var( "langASP" )
        ::langC = session.var( "langC" )
        ::langCPlusPlus = session.var( "langCPlusPlus" )
        ::langDotNet = session.var( "langDotNet" )
        ::langFGL = session.var( "langFGL" )
        ::langJava = session.var( "langJava" )
        ::langOther = session.var( "langOther" )
        ::langPHP = session.var( "langPHP" )
        ::langPython = session.var( "langPython" )
        ::langRuby = session.var( "langRuby" )
        ::langVB = session.var( "langVB" )
        ::lastused = session.var( "lastused" )
        ::lname = session.var( "lname" )
        ::LoginPage = session.var( "LoginPage" )
        ::osLinux = session.var( "osLinux" )
        ::osMac = session.var( "osMac" )
        ::osOther = session.var( "osOther" )
        ::osSolaris = session.var( "osSolaris" )
        ::osUnix = session.var( "osUnix" )
        ::osWin32 = session.var( "osWin32" )
        ::osWin64 = session.var( "osWin64" )
        ::password = session.var( "password" )
        ::phonecell = session.var( "phonecell" )
        ::phonehome = session.var( "phonehome" )
        ::phoneoffice = session.var( "phoneoffice" )
        ::RecommendationCount = 0 + session.var( "RecommendationCount" )
        ::ReferredBy = session.var( "ReferredBy" )
        ::serverApache = session.var( "serverApache" )
        ::serverFifthGen = session.var( "serverFifthGen" )
        ::serverIIS = session.var( "serverIIS" )
        ::serverOther = session.var( "serverOther" )
        ::serverSun = session.var( "serverSun" )
        ::state = session.var( "state" )
        ::street = session.var( "street" )
        ::usagecount = 0 + session.var( "usagecount" )
        ::usertype = session.var( "usertype" )
        ::website = session.var( "website" )
        ::WhereHeardAbout = session.var( "WhereHeardAbout" )
        ::zip = session.var( "zip" )
        return( 1 )
    END

    METHOD FieldList( )
        static flds = { 
            { "browserFirefox", 1, 0, 0, 0, 1, "", "", "" },
            { "browserIE", 1, 0, 0, 0, 1, "", "", "" },
            { "browserOpera", 1, 0, 0, 0, 1, "", "", "" },
            { "browserOther", 1, 0, 0, 0, 1, "", "", "" },
            { "city", 1, 0, 0, 0, 1, "", "", "" },
            { "company", 1, 0, 0, 0, 1, "", "", "" },
            { "companySize", 1, 0, 0, 0, 1, "", "", "" },
            { "country", 1, 0, 0, 0, 1, "", "", "" },
            { "datecreated", 1, 0, 0, 0, 1, "", "", "" },
            { "dbAccess", 1, 0, 0, 0, 1, "", "", "" },
            { "dbDB2", 1, 0, 0, 0, 1, "", "", "" },
            { "dbFifthGen", 1, 0, 0, 0, 1, "", "", "" },
            { "dbMSSQL", 1, 0, 0, 0, 1, "", "", "" },
            { "dbMySQL", 1, 0, 0, 0, 1, "", "", "" },
            { "dbOracle", 1, 0, 0, 0, 1, "", "", "" },
            { "dbOther", 1, 0, 0, 0, 1, "", "", "" },
            { "email", 1, 0, 0, 0, 1, "", "", "" },
            { "experience", 1, 0, 0, 0, 1, "", "", "" },
            { "faxhome", 1, 0, 0, 0, 1, "", "", "" },
            { "faxoffice", 1, 0, 0, 0, 1, "", "", "" },
            { "fname", 1, 0, 0, 0, 1, "", "", "" },
            { "IsVerified", 3, 0, 0, 0, 1, "", "", "" },
            { "langASP", 1, 0, 0, 0, 1, "", "", "" },
            { "langC", 1, 0, 0, 0, 1, "", "", "" },
            { "langCPlusPlus", 1, 0, 0, 0, 1, "", "", "" },
            { "langDotNet", 1, 0, 0, 0, 1, "", "", "" },
            { "langFGL", 1, 0, 0, 0, 1, "", "", "" },
            { "langJava", 1, 0, 0, 0, 1, "", "", "" },
            { "langOther", 1, 0, 0, 0, 1, "", "", "" },
            { "langPHP", 1, 0, 0, 0, 1, "", "", "" },
            { "langPython", 1, 0, 0, 0, 1, "", "", "" },
            { "langRuby", 1, 0, 0, 0, 1, "", "", "" },
            { "langVB", 1, 0, 0, 0, 1, "", "", "" },
            { "lastused", 1, 0, 0, 0, 1, "", "", "" },
            { "lname", 1, 0, 0, 0, 1, "", "", "" },
            { "LoginPage", 1, 0, 0, 0, 1, "", "", "" },
            { "osLinux", 1, 0, 0, 0, 1, "", "", "" },
            { "osMac", 1, 0, 0, 0, 1, "", "", "" },
            { "osOther", 1, 0, 0, 0, 1, "", "", "" },
            { "osSolaris", 1, 0, 0, 0, 1, "", "", "" },
            { "osUnix", 1, 0, 0, 0, 1, "", "", "" },
            { "osWin32", 1, 0, 0, 0, 1, "", "", "" },
            { "osWin64", 1, 0, 0, 0, 1, "", "", "" },
            { "password", 1, 0, 0, 0, 1, "", "", "" },
            { "phonecell", 1, 0, 0, 0, 1, "", "", "" },
            { "phonehome", 1, 0, 0, 0, 1, "", "", "" },
            { "phoneoffice", 1, 0, 0, 0, 1, "", "", "" },
            { "RecommendationCount", 3, 0, 0, 0, 1, "", "", "" },
            { "ReferredBy", 1, 0, 0, 0, 1, "", "", "" },
            { "serverApache", 1, 0, 0, 0, 1, "", "", "" },
            { "serverFifthGen", 1, 0, 0, 0, 1, "", "", "" },
            { "serverIIS", 1, 0, 0, 0, 1, "", "", "" },
            { "serverOther", 1, 0, 0, 0, 1, "", "", "" },
            { "serverSun", 1, 0, 0, 0, 1, "", "", "" },
            { "state", 1, 0, 0, 0, 1, "", "", "" },
            { "street", 1, 0, 0, 0, 1, "", "", "" },
            { "usagecount", 3, 0, 0, 0, 1, "", "", "" },
            { "usertype", 1, 0, 0, 0, 1, "", "", "" },
            { "website", 1, 0, 0, 0, 1, "", "", "" },
            { "WhereHeardAbout", 1, 0, 0, 0, 1, "", "", "" },
            { "zip", 1, 0, 0, 0, 1, "", "", "" }
        }
        return( flds )
    END

    ACCESS avars
        static a = { 
            "browserFirefox",
            "browserIE",
            "browserOpera",
            "browserOther",
            "city",
            "company",
            "companySize",
            "country",
            "datecreated",
            "dbAccess",
            "dbDB2",
            "dbFifthGen",
            "dbMSSQL",
            "dbMySQL",
            "dbOracle",
            "dbOther",
            "email",
            "experience",
            "faxhome",
            "faxoffice",
            "fname",
            "IsVerified",
            "langASP",
            "langC",
            "langCPlusPlus",
            "langDotNet",
            "langFGL",
            "langJava",
            "langOther",
            "langPHP",
            "langPython",
            "langRuby",
            "langVB",
            "lastused",
            "lname",
            "LoginPage",
            "osLinux",
            "osMac",
            "osOther",
            "osSolaris",
            "osUnix",
            "osWin32",
            "osWin64",
            "password",
            "phonecell",
            "phonehome",
            "phoneoffice",
            "RecommendationCount",
            "ReferredBy",
            "serverApache",
            "serverFifthGen",
            "serverIIS",
            "serverOther",
            "serverSun",
            "state",
            "street",
            "usagecount",
            "usertype",
            "website",
            "WhereHeardAbout",
            "zip"
        }
        return( a )
    END

    METHOD get( data )
        return( unpack( data, self ) )
    END

    METHOD put( )
        return( pack( self ) )
    END

    ACCESS TransactionData
        return( ArrayToNameValue( objToArray( self ), '=', '&' ) )
    END

    ACCESS aCompanySize
        static a = {
            "1",
            "less than 10",
            "less than 100",
            "less than 1000",
            "1000 or more"
        }
        return( a )
    END

    ACCESS aEndorse
        static a = {
            "Stake my reputation",
            "Highly regarded",
            "Worth mentioning",
            "Form your own conclusions"
        }
        return( a )
    END

    ACCESS aEndorseAffiliation
        static a = {
            "No Association",
            "Indirect Association",
            "Arms-length Association",
            "Direct Association"
        }
        return( a )
    END

    ACCESS aExperience
        static a = {
            "Inexperienced",
            "Experienced",
            "Guru",
            "Other"
        }
        return( a )
    END

    ACCESS aLoginPage
        static a = {
            { "main.htm", "Home" },
            { "developers.htm", "Developers" },
            { "endusers.htm", "End Users" },
            { "fgl.htm", "FGL Overview" },
            { "documentation.htm", "Documentation" }
        }
        return( a )
    END

    ACCESS aPercent
        static a = {
            "0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"
        }
        return( a )
    END

    ACCESS aUserType
        static a ={
            "Programmer",
            "Developer",
            "End User",
            "Student",
            "Management",
            "Researcher",
            "Technician",
            "Designer",
            "Media",
            "Other"
        }
        return( a )
    END

    ACCESS aWhereHeardAbout
        static a = {
            "Internet",
            "Friend",
            "Co-worker",
            "Newspaper",
            "Magazine",
            "TV",
            "Radio",
            "Other"
        }
        return( a )
    END

    METHOD GetMatchingVars( varname )
        static a
        local cnt, i, s="", l
        
        varname = upper( varname )
        l = len( varname )
        
        a = ::aVars
        cnt = len( a )
        
        for ( i=1; i<=cnt; i++ )
            if ( varname == upper( left( a[i], l ) ) )
                s += a[i] + ";"
            end
        end
        
        i = len( s )
        if ( i > 2 )
            s = left( s, i-1 )
        end
        
        return( s )
    END

    METHOD rules( )
        return( 1 )
    END

    ACCESS default( name )
        name = name
        return( 0 )
    END
    ASSIGN default( name, val )
        name = name
        val = val
        return
    END

END




CLASS objWebCast
  PUBLIC:      
    INHERIT objFromArray
    
    local id, errmsg
    
    METHOD new( )
        ::errmsg = ""
        return( 1 )
    END
    
    ACCESS datafile
        return( 'c:\fgl\data\webcasts.dat' )
    END
    
    METHOD get( id )
        local data, a, i, cnt, akeys
        
        ::id = id
        data = ::datafile
        akeys = split( data.iniGetKeys( id ), ";" )
        cnt = len( akeys )
        if ( ! cnt )
            return( 0 )
        end
        for ( i=1; i<=cnt; i++ )
            a[i,1] = akeys[i]
            a[i,2] = data.iniGetString( id, akeys[i], "" )
        end
        
        ::a = a

        return( 1 )        
    END

    METHOD DisplayBrief( id )
        local s
    
        s = new( "ServerBuffer" )
    
        if ( type( id ) == "C" )
            ::get( id )
        end
    
        s += "<p><font class=title><font class=smtxtb>WebCast – " + ::date + " – " + ::time + "</font><br>\r\n"
           s += "" + ::title + "</font><br><br>\r\n"
           s += "" + ::brief + "<br>\r\n"
           s += "<i>[<a href='webcast.htm?webcastid=" + ::id + "'><font class=pglinks>More Information...</font></a>] [<a href='webcast.htm?webcastid=" + ::id + "&cmd=REGISTER'><font class=pglinks>Register...</font></a>]</i></p>\r\n"

        return( s.str )        
    END

    METHOD DisplayEvent( page, id )
        local s
    
        s = new( "ServerBuffer" )
    
        if ( type( id ) == "C" )
            ::get( id )
        end

           s += "<a href='webcast.htm?webcastid=" + ::id + "' title='Click here for additional information or to signup for this webcast...'><font color='" + page.linkclr + "'>" + ::title + "<br>\r\n"
        s += "WebCast – " + ::date + " – " + ::time + "</font><br>\r\n"
           s += "<p><font color='#A0A0A0'>" + ::brief + "</font>\r\n"
        s += "</a><br><br>\r\n"

        return( s.str )        
    END



    METHOD IsTime( )
        local d1, d2, rval=0
    
        d1 = ::icsStartDate
        d2 = date( "YYYYMMDD" )
        
        if ( d1 > d2 )
            ::errmsg = "This webcast is not yet available. Please check back on the scheduled date."
        elseif ( d1 < d2 )
            ::errmsg = "This webcast has already been presented. Check the webcast archives to review the presentation."
        else
            d1 = ::icsStartTime
            d2 = date( "HHMMSS" )
            if ( d1 < d2 )
                ::errmsg = "This webcast is scheduled for today but has not yet begun. Please check back at the scheduled time."
            elseif ( ::icsEndTime > d2 )
                ::errmsg = "This webcast has already been presented. Check the webcast archives to review the presentation."
            else
                rval = 1
            end
        end
        
        return( rval )
    END

    METHOD RegisterUser( session, user )
        // requires access to dbtrans.flb
        local ref, trans, data
        
        ref = upper( "WC:" + ::id + ":" + user.email )
        trans = new( "objTrans" )
        trans.open( )
        
        // check if they are already registered
        if ( trans.GetRecord( ref, 3 ) )
            if ( alltrim( trans.ref ) == ref )
                ::errmsg = "You have already registered for this webcast event."
                return( 0 )
            end
        end
        
        data = ArrayToNameValue( session.varArray( ), '=', '&' )
        trans.CreateTrans( session, "FGL", user.email, "WebCast Registration", ref, ::title, 0, data )
        
        return( 1 )
    END


    
END


CLASS objWebCastRegistration
  PUBLIC:
    local formfile, formid, formfilename, created, errmsg
    local city, country, email, fname, lname, state, zip

    METHOD new( )
        ::formfile = 'C:\sdweb\HOME\WebSites\fgldev\webcast.ap'
        ::formfilename = "webcast.ap"
        ::formid = "objWebCastRegistration"
        ::created = "20060307 11:41:44"
        ::errmsg = ""
        ::init( )
        return( 1 )
    END

    METHOD init( )
        ::city = ""
        ::country = ""
        ::email = ""
        ::fname = ""
        ::lname = ""
        ::state = ""
        ::zip = ""
        return( 1 )
    END

    ACCESS aVars
       static a = {
            "city",
            "country",
            "email",
            "fname",
            "lname",
            "state",
            "zip"
        }
        return( a )
    END

    METHOD UpdateFromForm( s )
        ::city = s.var( "city" )
        ::country = s.var( "country" )
        ::email = s.var( "email" )
        ::fname = s.var( "fname" )
        ::lname = s.var( "lname" )
        ::state = s.var( "state" )
        ::zip = s.var( "zip" )
        return( 1 )
    END

    METHOD get( data )
        objUnpackWeb( self, data, "&" )
        return( 1 )
    END

    METHOD put( )
        local i, s, l, aVars
        s = new( "serverbuffer" )
        aVars = ::aVars
        l = len( aVars )
        for ( i=1; i<=l; i++ )
            if ( type( self.( aVars[i] ) ) == "U" )
                s += aVars[i] + "=UNDEFINED&"
            else
                s += aVars[i] + "=" + webEncodeUrl( "" + ( self.( aVars[i] ) ) ) + "&"
            end
        end
        if ( ! strempty( s.str ) )
            return( left( s.str, len( s.str ) - 1 ) )
        end
        return( s.str )
    END

    ASSIGN default( name, val )
        name; val;
        // global error handler
        return
    END

END


Click here to view the FGL source code for this page...
http://www.fifthgensys.com
View Source