||| Copyright (C) 1998-2007, Sumisho Computer Systems Corp.  All Rights Reserved.
|||
||| An OpenCurl project.

||| Licensed under the Apache License, Version 2.0 (the "License");
||| you may not use this file except in compliance with the License.
||| You may obtain a copy of the License at
||| 
|||     http://www.apache.org/licenses/LICENSE-2.0
||| 
||| Unless required by applicable law or agreed to in writing, software
||| distributed under the License is distributed on an "AS IS" BASIS,
||| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
||| See the License for the specific language governing permissions and
||| limitations under the License.

{curl 7.0 applet}
{curl-file-attributes character-encoding = "windows-latin-1"}
{applet manifest = "manifest.mcurl",
    resync-as-of = {utc-date-time "2008-05-09 20:00"},
    curl-root = ".",
    {compiler-directives careful? = true}
}


|| This procedure calls occ-root-installer wrapped in a try/catch clause,
|| so if there is a problem partway through the update procedure that
|| causes the update procedure to be abandoned and throw an exception,
|| the exception can be reported to the user, who can then continue on
|| to use the un-updated application.
{define-proc {lenient-occ-root-installer new-root-url:Url, old-root-url:Url}:bool
    let result:bool = false
    {try
        set result = {occ-root-installer new-root-url, old-root-url}
     catch e:Exception do
        {popup-message
            {VBox spacing = 4pt,
                {message
                    An exception occurred while trying to update this applet:
                },
                {format "%s", e}
            }
        }
    }
    {return result}
}


{do
    || This is the standard boilerplate method for updating the
    || installed application, if necessary, before beginning to run it.
    def (permission?, network?, allowed?, updated?) =
        {occ-install-or-update
            lenient-occ-root-installer, 

            install-name = "Timeline Viewer",
            install-filename = "Timeline Viewer",
            install-version = null,
            install-directory = null,
            install-description = "Curl Nitro applet for viewing timeline files",
            install-icons =
                {new {Array-of Url},
                    {url "timeline-icon.png"}
                }
        }
    def installed? = permission? ||and network? and allowed?
    {if not installed? then
        || We reach this point if the user cancelled out of the
        || installation process.
        {exit}
    }
}


|| Now we include the common code for the application that would run
|| regardless of whether it was an installed OCC application or just
|| a detached applet run directly from a Web site without installation.
{include "start-common.scurl"}
