src/chxj_hdml.c
/**
 * The substitution processing of tag "input type = radio" is done. 
 * 
 * @param hdml [i/o] The pointer to the HDML structure at the output 
 *                   destination is specified. 
 * @param tag  [i]   The tag node of input type=radio is specified. 
 */
The substitution processing of tag "input type = radio" is done.

@param hdml [i/o] The pointer to the HDML structure at the output
destination is specified.
@param tag  [i]   The tag node of input type=radio is specified.
The substitution processing of tag " input type = radio " is done . @param hdml [ i / o ] The pointer to the HDML structure at the output destination is specified . @param tag [ i ] The tag node of input type = radio is specified .
static void
s_hdml_do_input_radio_tag(hdml_t *hdml, Node *tag)
{
  Doc         *doc       = hdml->doc;
  request_rec *r         = doc->r;
  char        *nm        = NULL;
  char        *val       = NULL;
  int         ii;
  int         jj;
  int         kk;
  int         r_cnt;
  s_hdml_tag_output_upper_half(hdml, tag);
  nm  = qs_get_name_attr  (doc, tag, r->pool);
  val = qs_get_value_attr (doc, tag, r->pool);
  for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
    if (! hdml->radio_name_list[ii]) {
      DBG(r, "Oops... radio list is null[%d]", ii);
      return;
    }
    if (strcasecmp(hdml->radio_name_list[ii], nm) == 0) 
      break;
  }
  if (ii == MAX_RADIO_COUNT) {
    DBG(r,"Oops... The same name was not in the list. ");
    return;
  }
  s_output_to_hdml_out(hdml, 
                  apr_psprintf(r->pool, 
                          "<A TASK=GOSUB "
                          "LABEL=\"check\" "
                          "DEST=#R%d VARS=\"VAL=%s\" "
                          "RECEIVE=\"%s;", 
                          ii, 
                          val, 
                          nm));
  if (hdml->radio_out_cnt[ii] == 0) {
    s_output_to_hdml_card(hdml, 
                    apr_psprintf(r->pool,
                            "<NODISPLAY NAME=R%d>\r\n",
                            ii));
    s_output_to_hdml_card(hdml, 
                    apr_psprintf(r->pool, 
                            "<ACTION "
                            "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
  }
  kk = hdml->radio_out_cnt[ii];
  for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) 
    if (! hdml->radio_value_list[ii][jj]) 
      break;
  r_cnt = jj;
  for (jj=0; jj<r_cnt; jj++) {
    if (! hdml->radio_value_list[ii][jj])
      break;
    if (jj != 0) {
      s_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
      if (hdml->radio_out_cnt[ii] == 0) 
        s_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
    }
    s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
    if (hdml->radio_out_cnt[ii] == 0)  {
      if (jj == 0) 
        s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
      else 
        s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
    }
    kk++;
    if (kk >= r_cnt) 
      kk=0;
  }
  s_output_to_hdml_out(hdml, 
                  apr_psprintf(r->pool, "\" >$%s_%02d</A>", 
                          nm, 
                          hdml->radio_out_cnt[ii]));
  if (! hdml->radio_out_cnt[ii]) {
    s_output_to_hdml_card(hdml, "\">\r\n"         );
    s_output_to_hdml_card(hdml, "</NODISPLAY>\r\n");
    s_output_to_postdata(hdml,  apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
    for (jj=0; jj<r_cnt; jj++) {
      if (hdml->radio_value_list[ii][jj] &&  hdml->radio_checked_value[ii]) {
        if (strcasecmp(hdml->radio_value_list[ii][jj], 
                       hdml->radio_checked_value[ii]) == 0) {
          s_output_to_init_vars(hdml, 
                          apr_psprintf(r->pool, 
                                  "%s_%02d=X", 
                                  nm, 
                                  jj));
        }
        else {
          s_output_to_init_vars(hdml, 
                          apr_psprintf(r->pool, 
                                  "%s_%02d=_", 
                                  nm, 
                                  jj));
        }
      }
      else {
        s_output_to_init_vars(hdml, 
                        apr_psprintf(r->pool, 
                                "%s_%02d=_", 
                                nm, 
                                jj));
      }
    }
    if (hdml->radio_checked_value[ii]) {
      DBG(r,"radio button is checked. checked value is [%s]", 
        hdml->radio_checked_value[ii]);
      s_output_to_init_vars(hdml, 
                    apr_psprintf(r->pool, 
                            "%s=%s", 
                            nm, 
                            hdml->radio_checked_value[ii]));
    }
    else {
      DBG(r,"radio button is not checked. checked value is []");
      s_output_to_init_vars(hdml, 
                    apr_psprintf(r->pool, 
                            "%s=", 
                            nm));
    }
  }
  hdml->radio_out_cnt[ii]++;
}
static void s_hdml_do_input_radio_tag ( hdml_t * hdml , Node * tag ) { Doc * doc = hdml -> doc ; request_rec * r = doc -> r ; char * nm = NULL ; char * val = NULL ; int ii ; int jj ; int kk ; int r_cnt ; s_hdml_tag_output_upper_half ( hdml , tag ) ; nm = qs_get_name_attr ( doc , tag , r -> pool ) ; val = qs_get_value_attr ( doc , tag , r -> pool ) ; for ( ii = 0 ; ii < MAX_RADIO_COUNT ; ii ++ ) { if ( ! hdml -> radio_name_list [ ii ] ) { DBG ( r , " " , ii ) ; return ; } if ( strcasecmp ( hdml -> radio_name_list [ ii ] , nm ) == 0 ) break ; } if ( ii == MAX_RADIO_COUNT ) { DBG ( r , " " ) ; return ; } s_output_to_hdml_out ( hdml , apr_psprintf ( r -> pool , " " " \" \" " " \" \" " " \" " , ii , val , nm ) ) ; if ( hdml -> radio_out_cnt [ ii ] == 0 ) { s_output_to_hdml_card ( hdml , apr_psprintf ( r -> pool , " \r \n " , ii ) ) ; s_output_to_hdml_card ( hdml , apr_psprintf ( r -> pool , " " " \" " ) ) ; } kk = hdml -> radio_out_cnt [ ii ] ; for ( jj = 0 ; jj < MAX_RADIO_VALUE_COUNT ; jj ++ ) if ( ! hdml -> radio_value_list [ ii ] [ jj ] ) break ; r_cnt = jj ; for ( jj = 0 ; jj < r_cnt ; jj ++ ) { if ( ! hdml -> radio_value_list [ ii ] [ jj ] ) break ; if ( jj != 0 ) { s_output_to_hdml_out ( hdml , apr_psprintf ( r -> pool , " " ) ) ; if ( hdml -> radio_out_cnt [ ii ] == 0 ) s_output_to_hdml_card ( hdml , apr_psprintf ( r -> pool , " " ) ) ; } s_output_to_hdml_out ( hdml , apr_psprintf ( r -> pool , " " , nm , kk ) ) ; if ( hdml -> radio_out_cnt [ ii ] == 0 ) { if ( jj == 0 ) s_output_to_hdml_card ( hdml , apr_psprintf ( r -> pool , " " ) ) ; else s_output_to_hdml_card ( hdml , apr_psprintf ( r -> pool , " " ) ) ; } kk ++ ; if ( kk >= r_cnt ) kk = 0 ; } s_output_to_hdml_out ( hdml , apr_psprintf ( r -> pool , " \" " , nm , hdml -> radio_out_cnt [ ii ] ) ) ; if ( ! hdml -> radio_out_cnt [ ii ] ) { s_output_to_hdml_card ( hdml , " \" \r \n " ) ; s_output_to_hdml_card ( hdml , " \r \n " ) ; s_output_to_postdata ( hdml , apr_psprintf ( r -> pool , " " , RADIO_BUTTON_PREFIX , nm , nm ) ) ; for ( jj = 0 ; jj < r_cnt ; jj ++ ) { if ( hdml -> radio_value_list [ ii ] [ jj ] && hdml -> radio_checked_value [ ii ] ) { if ( strcasecmp ( hdml -> radio_value_list [ ii ] [ jj ] , hdml -> radio_checked_value [ ii ] ) == 0 ) { s_output_to_init_vars ( hdml , apr_psprintf ( r -> pool , " " , nm , jj ) ) ; } else { s_output_to_init_vars ( hdml , apr_psprintf ( r -> pool , " " , nm , jj ) ) ; } } else { s_output_to_init_vars ( hdml , apr_psprintf ( r -> pool , " " , nm , jj ) ) ; } } if ( hdml -> radio_checked_value [ ii ] ) { DBG ( r , " " , hdml -> radio_checked_value [ ii ] ) ; s_output_to_init_vars ( hdml , apr_psprintf ( r -> pool , " " , nm , hdml -> radio_checked_value [ ii ] ) ) ; } else { DBG ( r , " " ) ; s_output_to_init_vars ( hdml , apr_psprintf ( r -> pool , " " , nm ) ) ; } } hdml -> radio_out_cnt [ ii ] ++ ; }
The substitution processing of tag "input type = radio" is done.
The substitution processing of tag " input type = radio " is done .
/*--------------------------------------------------------------------------*/ /* get name and value attribute                                             */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* The same name is searched out from the list made beforehand.             */ /*--------------------------------------------------------------------------*/ /* @todo Oops..  */ /*----------------------------------------------------------------------*/ /* Processing is ended because it doesn't happen off the fly.           */ /*----------------------------------------------------------------------*/ /* @todo Oops.. */ /*------------------------------------------------------------------------*/ /* Processing is ended because it doesn't happen off the fly.             */ /*------------------------------------------------------------------------*/