/*
 * Author       : tzc
 * Generated on : 24-Nov-2009 13:07:33
 * Version      : 3.0
 */
application "Space Weather Alerts"
{
    type = public
    allow html = true
    date format = "dd-MMM-yyyy"
    time zone = "America/Los_Angeles"
    section Home
    {
        form  Capture_Alert
        {
            displayname  =  "Capture SEC Message"
            success message  =  "SEC Message Added Successfully."
            
            column
            {
                must  have  SpaceWeatherMessageCode
                (
                    displayname  =  "Space Weather Message Code"
                    type  =  text
                    width  =  6
                    maxchar  =  6
                )

                must  have  SerialNumber
                (
                    displayname  =  "Serial Number"
                    type  =  number
                    width  =  20
                    maxchar  =  4
                )

                ExtensionofSerialNumber
                (
                    displayname  =  "Extension of Serial Number"
                    type  =  text
                )

                CancelSerialNumber
                (
                    displayname  =  "Cancel Serial Number"
                    type  =  text
                )

                ContinuationofSerialNumber
                (
                    displayname  =  "Continuation of Serial Number"
                    type  =  text
                )

                must  have  IssueTime
                (
                    displayname  =  "Issue Time"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                SUMMARY
                (
                    type  =  text
                )

                WATCH
                (
                    type  =  text
                )

                ALERT
                (
                    type  =  text
                )

                CONTINUEDALERT
                (
                    displayname  =  "CONTINUED ALERT"
                    type  =  text
                )

                WARNING
                (
                    type  =  text
                )

                ActiveWarning
                (
                    displayname  =  "Active Warning"
                    type  =  text
                )

                CANCELWARNING
                (
                    displayname  =  "CANCEL WARNING"
                    type  =  text
                )

                EXTENDEDWARNING
                (
                    displayname  =  "EXTENDED WARNING"
                    type  =  text
                )

                WarningCondition
                (
                    displayname  =  "Warning Condition"
                    type  =  text
                )

                EstimatedVelocity
                (
                    displayname  =  "Estimated Velocity"
                    type  =  text
                )

                Duration
                (
                    type  =  text
                )

                FrequencyRange
                (
                    displayname  =  "Frequency Range"
                    type  =  text
                )

                Importance
                (
                    type  =  text
                )

                Station
                (
                    type  =  text
                )

                IPShockPassageObserved
                (
                    displayname  =  "IP Shock Passage Observed"
                    type  =  text
                )

                Observed
                (
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                Deviation
                (
                    type  =  text
                )

                created
                (
                    type  =  formula
                    value  =  zoho.currenttime
                )

            }
            column
            {
                ThresholdReached
                (
                    displayname  =  "Threshold Reached"
                    type  =  text
                )

                CurrentXrayFlux
                (
                    displayname  =  "Current X-ray Flux"
                    type  =  text
                )

                XrayClass
                (
                    displayname  =  "X-ray Class"
                    type  =  text
                )

                OpticalClass
                (
                    displayname  =  "Optical Class"
                    type  =  text
                )

                Location
                (
                    type  =  text
                )

                RegionNumber
                (
                    displayname  =  "Region Number"
                    type  =  text
                )

                NOAAScale
                (
                    displayname  =  "NOAA Scale"
                    type  =  text
                )

                OriginalIssueTime
                (
                    displayname  =  "Original Issue Time"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                BeginTime
                (
                    displayname  =  "Begin Time"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                MaximumTime
                (
                    displayname  =  "Maximum Time"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                EndTime
                (
                    displayname  =  "End Time"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                PeakFlux
                (
                    displayname  =  "Peak Flux"
                    type  =  text
                )

                LatestPentictonNoonFlux
                (
                    displayname  =  "Latest Penticton Noon Flux"
                    type  =  text
                )

                ValidFrom
                (
                    displayname  =  "Valid From"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                ValidTo
                (
                    displayname  =  "Valid To"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                NowValidUntil
                (
                    displayname  =  "Now Valid Until"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                SynopticPeriod
                (
                    displayname  =  "Synoptic Period"
                    type  =  text
                )

                ValidforUTCDay
                (
                    displayname  =  "Valid for UTC Day"
                    type  =  text
                    width  =  25
                    maxchar  =  25
                )

                ObservedYesterday
                (
                    displayname  =  "Observed Yesterday"
                    type  =  text
                    width  =  3
                    maxchar  =  3
                )

                YesterdayMaximum2MeVFlux
                (
                    displayname  =  "Yesterday Maximum 2MeV Flux"
                    type  =  text
                    width  =  10
                    maxchar  =  10
                )

                PredictedNOAAScale
                (
                    displayname  =  "Predicted NOAA Scale"
                    type  =  text
                )

                Current10MeVFlux
                (
                    displayname  =  "Current 10MeV Flux"
                    type  =  text
                )

                Current100MeVFlux
                (
                    displayname  =  "Current 100MeV Flux"
                    type  =  text
                )

                Maximum10MeVFlux
                (
                    displayname  =  "Maximum 10MeV Flux"
                    type  =  text
                )

                Maximum100MeVFlux
                (
                    displayname  =  "Maximum 100MeV Flux"
                    type  =  text
                )

            }
            actions
            {
                on add
                {
                    on load
                    {
                        if (zoho.loginuser  !=  zoho.adminuser)
                        {
                            app = "Space Alerts";
                            // REPLACE value with name of this application.
                            frm = "Capture Alert";
                            // REPLACE value with the name of this form.
                            usr = zoho.loginuser;
                            // The username of the current ZC user.
                            tst = zoho.currenttime.toLong();
                            // A timestamp of the current time.
                            log_entry = "Entry String : " + "App" + "|" + app + "*" + "Form" + "|" + frm + "*" + "User" + "|" + usr + "*" + "Time" + "|" + tst;
                            sendmail
                            (
                                To       :  "landofzc-73@forms.zohocreator.com" 
                                From     :  zoho.adminuserid 
                                Subject  :  "Log Entry" 
                                Message  :  log_entry 
                            )
                        }
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  SEC_Messages
        {
            displayname = "SEC Messages"
            show  all  rows  from  Capture_Alert 
            (
                SpaceWeatherMessageCode as "Space Weather Message Code"
                IssueTime as "Issue Time"
                ALERT
                WATCH
                WARNING
                SUMMARY
                created
                ThresholdReached as "Threshold Reached"
                CurrentXrayFlux as "Current X-ray Flux"
                OpticalClass as "Optical Class"
                Location
                RegionNumber as "Region Number"
                NOAAScale as "NOAA Scale"
                BeginTime as "Begin Time"
                MaximumTime as "Maximum Time"
                EndTime as "End Time"
                XrayClass as "X-ray Class"
                EstimatedVelocity as "Estimated Velocity"
                Duration
                FrequencyRange as "Frequency Range"
                Importance
                Station
                PeakFlux as "Peak Flux"
                LatestPentictonNoonFlux as "Latest Penticton Noon Flux"
                ValidFrom as "Valid From"
                ValidTo as "Valid To"
                IPShockPassageObserved as "IP Shock Passage Observed"
                Observed
                Deviation
                WarningCondition as "Warning Condition"
                NowValidUntil as "Now Valid Until"
                EXTENDEDWARNING as "EXTENDED WARNING"
                ExtensionofSerialNumber as "Extension of Serial Number"
                SynopticPeriod as "Synoptic Period"
                ActiveWarning as "Active Warning"
                ValidforUTCDay as "Valid for UTC Day"
                ObservedYesterday as "Observed Yesterday"
                YesterdayMaximum2MeVFlux as "Yesterday Maximum 2MeV Flux"
                PredictedNOAAScale as "Predicted NOAA Scale"
                Current10MeVFlux as "Current 10MeV Flux"
                Maximum10MeVFlux as "Maximum 10MeV Flux"
                CONTINUEDALERT as "CONTINUED ALERT"
                ContinuationofSerialNumber as "Continuation of Serial Number"
                Maximum100MeVFlux as "Maximum 100MeV Flux"
                Current100MeVFlux as "Current 100MeV Flux"
                CANCELWARNING as "CANCEL WARNING"
                CancelSerialNumber as "Cancel Serial Number"
                OriginalIssueTime as "Original Issue Time"
                SerialNumber as "Serial Number"
            )
            options
            (
                display rows = 100
            )
        }

    }

}
