Diff for /capa/capa51/pProj/capaCgiUtils.c between versions 1.1.1.1 and 1.4

version 1.1.1.1, 1999/09/28 21:26:20 version 1.4, 1999/11/08 22:30:02
Line 1067  print_mainmenu(class,sn,pin)char *class; Line 1067  print_mainmenu(class,sn,pin)char *class;
 void  void
 print_page_header(mode,num_quest) int mode;int num_quest;  print_page_header(mode,num_quest) int mode;int num_quest;
 {  {
   char   buf[MAX_BUFFER_SIZE];    char   buf[MAX_BUFFER_SIZE], discussdir[MAX_BUFFER_SIZE];
   char *serverName;    char *serverName;
   int    configResult,term_summary_button=1;    int    configResult,term_summary_button=1;
   
Line 1206  print_page_header(mode,num_quest) int mo Line 1206  print_page_header(mode,num_quest) int mo
     fprintf(stdout,"</form></TD>");      fprintf(stdout,"</form></TD>");
   }    }
   
     /*Discuss Button*/
   
     sprintf(discussdir,"%s/discussion/%d",g_class_fullpath,g_login_set);
     if ( access(discussdir,F_OK) == 0 ) {
       fprintf(stdout,"<TD><form method=\"post\" ");
       sprintf(buf,"action=\"http://%s/%s/%s/capadiscuss\">",serverName,g_cgibin_path,g_cowner);
       fprintf(stdout,"%s\n", buf);
       fprintf(stdout,"<input type=\"hidden\" name=\"CLASS\" value=\"%s\">\n",g_class_name);
       fprintf(stdout,"<input type=\"hidden\" name=\"SNUM\" value=\"%s\">\n",g_student_number);
       fprintf(stdout,"<input type=\"hidden\" name=\"CAPAID\" value=\"%d\">\n",g_entered_pin);
       fprintf(stdout,"<input type=\"hidden\" name=\"SETID\" value=\"%d\">\n",g_login_set);
       fprintf(stdout,"<input type=\"submit\" value=\"Discuss\" >\n</form></TD>");
     }
   
   fprintf(stdout,"\n</TR></TABLE>\n");    fprintf(stdout,"\n</TR></TABLE>\n");
   fflush(stdout);        fflush(stdout);    
 }  }
Line 1440  char *class_dir; char *c_owner;char *cla Line 1454  char *class_dir; char *c_owner;char *cla
      append_qtext("<A href=\"#TOP\">Top</A>");       append_qtext("<A href=\"#TOP\">Top</A>");
      sprintf(buf,"&nbsp;&nbsp;<A href=\"#P%d\">Next</A>",question_idx+2);  append_qtext(buf);       sprintf(buf,"&nbsp;&nbsp;<A href=\"#P%d\">Next</A>",question_idx+2);  append_qtext(buf);
      }*/       }*/
            q_leng = strlen(prob_idx->question);     if (prob_idx->question != NULL) {
    if ( !prob_idx->show_br ) {       q_leng = strlen(prob_idx->question);
      append_qtext(prob_idx->question);       if ( !prob_idx->show_br ) {
    } else {         append_qtext(prob_idx->question);
      for(idx=0;idx<q_leng;idx++) {       } else {
        if ( g_qchar_cnt+2 >= g_qsize ) {         for(idx=0;idx<q_leng;idx++) {
  char *temp_text;   if ( g_qchar_cnt+2 >= g_qsize ) {
  g_qsize=g_qchar_cnt*2;     char *temp_text;
  temp_text=capa_malloc(g_qsize,sizeof(char));     g_qsize=g_qchar_cnt*2;
  strncpy(temp_text,g_question_txt,g_qsize);     temp_text=capa_malloc(g_qsize,sizeof(char));
  capa_mfree(g_question_txt);     strncpy(temp_text,g_question_txt,g_qsize);
  g_question_txt=temp_text;       capa_mfree(g_question_txt);
        }     g_question_txt=temp_text;  
        g_question_txt[g_qchar_cnt]=prob_idx->question[idx];   }
        g_qchar_cnt++;   g_question_txt[g_qchar_cnt]=prob_idx->question[idx];
        if(prob_idx->question[idx] == '\n' ) {   g_qchar_cnt++;
  append_qtext("<br>\n");   if(prob_idx->question[idx] == '\n' ) {
      append_qtext("<br>\n");
    }
        }         }
      }       }
    }     }
Line 1669  void display_last_subjective(int q_idx) Line 1685  void display_last_subjective(int q_idx)
   
 void create_answer_area(Problem_t *p,int q_idx)   void create_answer_area(Problem_t *p,int q_idx) 
 {  {
   int ii;    int ii=0;
   char       buf[MAX_BUFFER_SIZE];      char       buf[MAX_BUFFER_SIZE];  
     AnswerInfo_t *ai;
 #ifdef CGI_DBUG  #ifdef CGI_DBUG
   fprintf(g_cgi,"Enter create_answer_area() [%d]\n",q_idx); fflush(g_cgi);    fprintf(g_cgi,"Enter create_answer_area() [%d]\n",q_idx); fflush(g_cgi);
 #endif /* CGI_DBUG */  #endif /* CGI_DBUG */
Line 1681  void create_answer_area(Problem_t *p,int Line 1697  void create_answer_area(Problem_t *p,int
   }    }
   if ( p->show_ans_box ) {     if ( p->show_ans_box ) { 
     if ( p->ans_op == ANS_AND ) {      if ( p->ans_op == ANS_AND ) {
       for(ii=0;ii<p->ans_cnt;ii++) {        if (p->ans_type == ANSWER_IS_FORMULA) {
  if (p->ans_type == ANSWER_IS_FORMULA) {   /* first answer is stored in p, the rest are linked off of p->ans_list */
  sprintf(buf,"<p><B>Answer %d of %d:</B><input size=80 name=\"INPUT%02d,%02d\" value=\"\">\n",ii+1,p->ans_cnt,q_idx+1,ii+1);   sprintf(buf,"<p><B>Answer %d of %d:</B><input size=80 name=\"INPUT%02d,%02d\" value=\"\">\n",ii+1,p->ans_cnt,q_idx+1,ii+1);
         } else {
    sprintf(buf,"<p><B>Answer %d of %d:</B><input name=\"INPUT%02d,%02d\" value=\"\">\n",ii+1,p->ans_cnt,q_idx+1,ii+1);
         }
         append_qtext(buf);
         for(ii=1, ai=p->ans_list;ii<p->ans_cnt;ai=ai->ans_next,ii++) {
    if (ai->ans_type == ANSWER_IS_FORMULA) {
     sprintf(buf,"<p><B>Answer %d of %d:</B><input size=80 name=\"INPUT%02d,%02d\" value=\"\">\n",ii+1,p->ans_cnt,q_idx+1,ii+1);
  } else {   } else {
   sprintf(buf,"<p><B>Answer %d of %d:</B><input name=\"INPUT%02d,%02d\" value=\"\">\n",ii+1,p->ans_cnt,q_idx+1,ii+1);    sprintf(buf,"<p><B>Answer %d of %d:</B><input name=\"INPUT%02d,%02d\" value=\"\">\n",ii+1,p->ans_cnt,q_idx+1,ii+1);
  }   }
Line 2171  char *class_dir;char *class;char *studen Line 2194  char *class_dir;char *class;char *studen
            set_score,                   /*    Score on a set           */             set_score,                   /*    Score on a set           */
            term_score=0,                /*    Total points received    */             term_score=0,                /*    Total points received    */
            term_valid=0,                /*    Total points possible    */             term_valid=0,                /*    Total points possible    */
            result;             result,
              tot_num_sets=0;
   T_entry  entry;                       /*    Database entry for a set */    T_entry  entry;                       /*    Database entry for a set */
   char     buf[MAX_BUFFER_SIZE]; /* Output line buffer  */    char     buf[MAX_BUFFER_SIZE]; /* Output line buffer  */
   char     buf2[MAX_BUFFER_SIZE]; /* Output line buffer  */    char     buf2[MAX_BUFFER_SIZE]; /* Output line buffer  */
Line 2186  char *class_dir;char *class;char *studen Line 2210  char *class_dir;char *class;char *studen
     fprintf(stdout,"Unable to complete actions.\n");      fprintf(stdout,"Unable to complete actions.\n");
     return;      return;
   }    }
     printf("<!--print_summary-->");
   sprintf(class_fullpath,"%s/%s",class_dir,class);    sprintf(class_fullpath,"%s/%s",class_dir,class);
   chdir(class_fullpath);    chdir(class_fullpath);
   configResult=read_capa_config("web_status_line_length",buf);    configResult=read_capa_config("web_status_line_length",buf);
Line 2207  char *class_dir;char *class;char *studen Line 2231  char *class_dir;char *class;char *studen
   for (set_idx=1; set_idx<=set; set_idx++) {    for (set_idx=1; set_idx<=set; set_idx++) {
     g_inhibit_response=capa_check_option(OPTION_INHIBIT_RESPONSE,set_idx,      g_inhibit_response=capa_check_option(OPTION_INHIBIT_RESPONSE,set_idx,
  g_student_data.s_sec);   g_student_data.s_sec);
     if (g_inhibit_response > 0) continue;      if (g_inhibit_response > 0) {
         printf("<!-- Set %d is inhibited -->\n",set_idx);
         continue;
       }
       if ( capa_check_date(CHECK_OPEN_DATE,g_student_number,
        g_student_data.s_sec,set_idx) < 0 ){
         printf("<!-- Set %d is not open -->\n",set_idx);
         continue;
       }
   
     if (capa_get_header(&header,set_idx))  return;      if (capa_get_header(&header,set_idx))  return;
       tot_num_sets++;
     capa_get_entry(&entry,student_number,set_idx);      capa_get_entry(&entry,student_number,set_idx);
     sscanf(header.num_questions,"%d", &(question_cnt) );      sscanf(header.num_questions,"%d", &(question_cnt) );
     valid_wgt = 0; set_score = 0;      valid_wgt = 0; set_score = 0;
Line 2253  char *class_dir;char *class;char *studen Line 2286  char *class_dir;char *class;char *studen
   printf("\n</TABLE>\n<hr>\n");    printf("\n</TABLE>\n<hr>\n");
   /* SHOW TOTALS */    /* SHOW TOTALS */
   /* if capalogin_show_summary_score is set to none don't show it */    /* if capalogin_show_summary_score is set to none don't show it */
   sprintf(buf,"%d sets, total = %3d/%3d (%d%%)\n", set, term_score, term_valid, 100*term_score/term_valid);    if (term_valid > 0) {
       sprintf(buf,"%d sets, total = %3d/%3d (%d%%)\n", tot_num_sets, term_score, term_valid, 100*term_score/term_valid);
     } else {
       sprintf(buf,"%d sets, total = %3d/%3d\n", tot_num_sets, term_score, term_valid);
     }
   result=read_capa_config("capalogin_show_summary_score",buf2);    result=read_capa_config("capalogin_show_summary_score",buf2);
   if (result != 0 && result != -1) {    if (result != 0 && result != -1) {
     if (strcasecmp(buf2,"none")==0) {      if (strcasecmp(buf2,"none")==0) {
Line 2369  FILE *out; Line 2406  FILE *out;
            i,                           /*    Question counter         */             i,                           /*    Question counter         */
            set_score,                   /*    Score on a set           */             set_score,                   /*    Score on a set           */
            term_score=0,                /*    Total points received    */             term_score=0,                /*    Total points received    */
            term_valid=0,                /*    Total points possible    */             term_valid=0;                /*    Total points possible    */
            result;  
   T_entry  entry;                       /*    Database entry for a set */    T_entry  entry;                       /*    Database entry for a set */
   char     buf[MAX_BUFFER_SIZE]; /* Output line buffer  */    char     buf[MAX_BUFFER_SIZE]; /* Output line buffer  */
   char     buf2[MAX_BUFFER_SIZE]; /* Output line buffer  */  
   T_header header;                      /*    Problem set header       */    T_header header;                      /*    Problem set header       */
   int      question_cnt,valid_wgt, rate,configResult,    int      question_cnt,valid_wgt,configResult;
     status_line_length=DEFAULT_STATUS_LINE_LENGTH,row;  
   char     class_fullpath[ONE_K],*serverName;    char     class_fullpath[ONE_K],*serverName;
   int      hw_c, hw_r, qz_c, qz_r, fs, homework_count, quiz_count;    int      hw_c, hw_r, qz_c, qz_r, fs, homework_count, quiz_count;
   int      ex_c, epc_c;  
   float    hw_w, qz_w, ex_w, fe_w, pc_w;    float    hw_w, qz_w, ex_w, fe_w, pc_w;
   int      idx, entry_count, tmp_len;    int      idx, entry_count, tmp_len;
   float    *S, *F;    float    *S, *F;
   int      *X;    int      *X;
   char     *capa_server, *qz_p, *ex_p, *epc_p;     char     *capa_server;
   int      max_set[4];    int      max_set[4];
   char     **c_path_pp;    char     **c_path_pp;
     
       /*Unused Vars  
         char     buf2[MAX_BUFFER_SIZE]; 
       char *qz_p, *ex_p, *epc_p; 
       int      ex_c, epc_c, result;
       int  rate, status_line_length=DEFAULT_STATUS_LINE_LENGTH,row;
     */
   
   serverName=getenv("SERVER_NAME");    serverName=getenv("SERVER_NAME");
   if (!serverName) {    if (!serverName) {
     fprintf(out,"Enviroment variable SERVER_NAME not set.\n");      fprintf(out,"Enviroment variable SERVER_NAME not set.\n");

Removed from v.1.1.1.1  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>