/* C file: C:\netos\src\examples\nahttp\html2C\_netarm2.c created
 by NET+Works HTML to C Utility on Wednesday, November 29, 2000 11:04:37 */


#define _WEB_TO_C_
/* @! Begin Function Prototype Forward Declaration */
/*  @! File: na_get_text_data_value */
static void na_get_text_data_value (unsigned long handle);
/*  @! File: na_get_check */
static void na_get_check (unsigned long handle);
/*  @! File: na_get_choice_list */
static void na_get_choice_list (unsigned long handle);
/*  @! File: na_get_info_block */
static void na_get_info_block (unsigned long handle);
/* @! End Function Prototype Forward Declaration   */

/* @! Begin HTML page */
/*  @! File: C:\netsilicon_netos_source\netos\src\examples\nahttp\html2c\html\netarm2.htm {{ */
void Send_function_1(unsigned long handle)
{
    HSSend (handle, "<HTML>\n");
    HSSend (handle, "<HEAD><TITLE>Sample Web Server Form</TITLE></HEAD>\n");
    HSSend (handle, "\n");
    HSSend (handle, "<BODY>\n");
    HSSend (handle, "\n");
    HSSend (handle, "<CENTER>\n");
    HSSend (handle, "<img src=\"Images/netsilicon.gif\" width=\"362\" height=\"69\">\n");
    HSSend (handle, "</CENTER>\n");
    HSSend (handle, "<HR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "<FORM METHOD=\"POST\" ACTION=\"formreply\">\n");
    HSSend (handle, "<CENTER>\n");
    HSSend (handle, "<H2>Web Server Sample Form</H2>\n");
    HSSend (handle, "<HR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "<BR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "<TABLE CELLSPACING=2  CELLPADDING=2>\n");
    HSSend (handle, "<TR>\n");
    HSSend (handle, "<TD>Text Data Field:</TD>\n");
    HSSend (handle, "<TD>\n");
    HSSend (handle, "<INPUT TYPE=\"TEXT\" NAME=\"Pri\" SIZE=\"31\" MAXLENGTH=\"31\" VALUE=\"");
    na_get_text_data_value (handle);
    HSSend (handle, "\">\n");
    HSSend (handle, "</TD>\n");
    HSSend (handle, "</TR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "\n");
    HSSend (handle, "<TR>\n");
    HSSend (handle, "<TD>Secret Data Field:</TD>\n");
    HSSend (handle, "<TD>\n");
    HSSend (handle, "<INPUT TYPE=\"PASSWORD\" NAME=\"http_pwd\" SIZE=\"15\" MAXLENGTH=\"15\">\n");
    HSSend (handle, "</TD>\n");
    HSSend (handle, "</TR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "\n");
    HSSend (handle, "<TR>\n");
    HSSend (handle, "<TD>Check Box</TD>\n");
    HSSend (handle, "<TD>\n");
    HSSend (handle, "<INPUT TYPE=\"CHECKBOX\" NAME=\"Rng\" ");
    na_get_check (handle);
    HSSend (handle, "></TD>\n");
    HSSend (handle, "</TR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "\n");
    HSSend (handle, "<TR>\n");
    HSSend (handle, "<TD>Choose one of these fine choices:</TD>\n");
    HSSend (handle, "<TD>\n");
    HSSend (handle, "<SELECT NAME=\"doc_def\" SIZE=\"1\">\n");
    HSSend (handle, "");
    na_get_choice_list (handle);
    HSSend (handle, "\n");
    HSSend (handle, "</SELECT>\n");
    HSSend (handle, "</TD>\n");
    HSSend (handle, "</TR>\n");
    HSSend (handle, "</TABLE>\n");
    HSSend (handle, "<BR>\n");
    HSSend (handle, "<BR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "<TABLE>\n");
    HSSend (handle, "<TR><TD align=center>Big Information Block:</TD></TR>\n");
    HSSend (handle, "<TR><TD align=center size=50%>\n");
    HSSend (handle, "    <TEXTAREA NAME=\"infoBlock\" ROWS=\"4\" COLS=\"50\">");
    na_get_info_block (handle);
    HSSend (handle, "</TEXTAREA>\n");
    HSSend (handle, "</TD></TR>\n");
    HSSend (handle, "</TABLE>\n");
    HSSend (handle, "\n");
    HSSend (handle, "<BR>\n");
    HSSend (handle, "<INPUT TYPE=\"SUBMIT\" NAME=\"Submit\" VALUE=\"Submit\">\n");
    HSSend (handle, "<INPUT TYPE=\"RESET\" VALUE=\"Clear Inputs\">\n");
    HSSend (handle, "</FORM>\n");
    HSSend (handle, "<HR>\n");
    HSSend (handle, "\n");
    HSSend (handle, "</BODY>\n");
    HSSend (handle, "</HTML>\n");
}    /*  @! File: C:\netsilicon_netos_source\netos\src\examples\nahttp\html2c\html\netarm2.htm }} */
/* @! End HTML page   */



char chDataValue[32] = "This is a string of data.";
char SecretDataValue[16];

int bCheckboxData =0;
int u32Choice = 5;
char *cChoices[] = {    "Choice0",
                        "Choice1",
                        "Choice2",
                        "Choice3",
                        "Choice4",
                        "Choice5",
                        "Choice6",
                        "Choice7",
                        ""   };

char bigInfoBlock[204] =    "This is a block of information that will get \n"
                            "stuffed into a big block on your Web Page";

/* @! Begin of post function */
/* @! Function: Post_formreply  {{ */
void Post_formreply(unsigned long handle)
{
    /* This is our implementation   */
    char tmp[20];

    HSGetValue (handle, "Pri", chDataValue, 32);
    HSGetValue (handle, "infoBlock", bigInfoBlock, sizeof (bigInfoBlock));

    /* check box is either on or off */
    HSGetValue (handle, "Rng", tmp, sizeof (tmp));
    bCheckboxData =  (strcmp ("on", tmp)==0)? 1: 0;

    /* option is set to text string if value is missing */
    HSGetValue (handle, "doc_def", tmp, sizeof (tmp));
    u32Choice = tmp[6] - '0';

    HSGetValue (handle, "http_pwd", SecretDataValue, 16);

    /*  I want to post formreply.htm -- which is Send_function_4  */
    Send_function_4(handle);
}   /* @! Function: Post_formreply  }} */
/* @! End of post function   */


/* @! Begin of dynamic functions */
/* @! Function: na_get_text_data_value  {{ */
void na_get_text_data_value(unsigned long handle)
{
    /* This is our implementation   */
    HSSend (handle, chDataValue);
}   /* @! Function: na_get_text_data_value  }} */


/* @! Function: na_get_check  {{ */
void na_get_check(unsigned long handle)
{
    /* This is our implementation   */
    if (bCheckboxData)
    {
        HSSend (handle, "CHECKED");
    }

}   /* @! Function: na_get_check  }} */

/* @! Function: na_get_choice_list  {{ */
void na_get_choice_list(unsigned long handle)
{
    /* This is our implementation   */
    int i = 0;
    char buf[120];

    while (*cChoices[i]) 
    {
        sprintf (buf, "<OPTION %s > %s", (i== u32Choice)? "SELECTED":"", cChoices[i]);
        HSSend (handle, buf);
        i++;
    }
}   /* @! Function: na_get_choice_list  }} */

/* @! Function: na_get_info_block  {{ */
void na_get_info_block(unsigned long handle)
{
    /* This is our implementation   */
    HSSend (handle, bigInfoBlock);
}   /* @! Function: na_get_info_block  }} */
/* @! End of dynamic functions   */



