/*
 * Author       : manageengine
 * Generated on : 23-Nov-2009 02:00:14
 * Version      : 3.0
 */
application "ServiceDesk PLUS Report Query Database"
{
    type = public
    date format = "dd-MMM-yyyy"
    time zone = "Europe/Dublin"
    section Submit_Query
    {
        displayname = "Submit Query"
        form  Submit_Query
        {
            displayname  =  "Submit Query"
            captcha = true
            success message  =  "Query Added Successfully!"
            
            plain
            (
                type  =  plaintext
                value = "<div id=\"ted\"><div id=\"ted\"><div id=\"ted\"><span style=\"font-weight: bold;\">Query code posted here will be added as non-validated query code prior to testing and validation.</span><br style=\"font-weight: bold;\"><br style=\"font-weight: bold;\"><span style=\"font-weight: bold;\">When posting your query please try to be as descriptive as possible. </span><br style=\"font-weight: bold;\"><br style=\"font-weight: bold;\"><span style=\"font-weight: bold;\">Any additional notes you can provide are greatly appreciated.</span><br><br></div></div></div>\n"
            )

            must  have  QueryTitle
            (
                displayname  =  "Query Title"
                type  =  text
                tooltip  =  "Please enter a descriptive title for the Report Query"
            )

            must  have  Database_Module
            (
                displayname  =  "Database Module"
                type  =  list
                values  =  {"Requests",   "Problems",   "Changes",   "TimeSpent",   "Contract",   "Workstation",   "Purchase",   "Resources"}
            )

            must  have  ReportQuery
            (
                displayname  =  "Report Query"
                type  =  textarea
                tooltip  =  "Enter the SQL query"
            )

            Notes
            (
                type  =  textarea
            )

            must  have  Database
            (
                displayname  =  "Works With"
                type  =  checkboxes
                values  =  {"MySQL",   "Microsoft SQL"}
                tooltip  =  "Enter the database support for the report query"
            )

            Name
            (
                displayname  =  "Posted By"
                type  =  text
            )

            Validated
            (
                type  =  radiobuttons
                private  =  true
                values  =  {"Yes",   "No"}
                defaultvalue  =  "No"
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                        on success
                        {
                            sendmail
                            (
                                To       :  "nigel.arnold@netunlim.com" 
                                From     :  zoho.adminuserid 
                                Subject  :  "SQL Query Code Posted" 
                                Message  :  input.Name + "<br />" + input.QueryTitle + "<br />" + input.Database_Module + "<br />" + input.ReportQuery 
                            )
                        }
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

    }

    section Search_Non_Validated_Query
    {
        displayname = "Search Non-Validated Query"
        form  Non_Validated_Query
        {
            displayname  =  "Non Validated Query"
            
            plain
            (
                type  =  plaintext
                value = "<div id=\"ted\"><span style=\"font-weight: bold;\">The query code posted here has not yet been tested and validated and may contain errors.</span><br></div>\n"
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Non_Validated_Query_View
        {
            displayname = "Non-Validated Query View"
            show  all  rows  from  Submit_Query [Validated == "No"]
            (
                QueryTitle as "Query Title"
                Database as "Works With"
                Database_Module as "Database Module"
                ReportQuery as "Report Query"
                Notes
                Name as "Posted By"
            )
            filters 
            (
                Validated
            )
            options
            (
                display rows = 100
            )
        }

    }

    section Search_Validated_Query
    {
        displayname = "Search Validated Query"
        form  Validated_Query
        {
            displayname  =  "Validated Query"
            
            plain
            (
                type  =  plaintext
                value = "<div id=\"ted\"><div id=\"ted\"><span style=\"font-weight: bold;\">The query code posted here has been independently tested and verified. If you experience any difficulty in using the query code posted here please use the feedback form provided. </span><br></div></div>\n"
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Validated_Query_View
        {
            displayname = "Validated Query View"
            show  all  rows  from  Submit_Query [Validated == "Yes"]
            (
                QueryTitle as "Query Title"
                Database as "Works With"
                Database_Module as "Database Module"
                ReportQuery as "Report Query"
                Notes
                Name as "Posted By"
            )
            filters 
            (
                Database
            )
            options
            (
                display rows = 100
            )
        }

    }

    section Feedback
    {
        form  Feedback
        {
            captcha = true
            success message  =  "Thank you for your feedback!"
            
            must  have  Name
            (
                type  =  text
            )

            must  have  Feedback
            (
                type  =  textarea
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Feedback_View
        {
            displayname = "Feedback View"
            show  all  rows  from  Feedback 
            (
                Name
                Feedback
            )
            options
            (
                display rows = 100
            )
        }

    }

}
