version 1.8, 1999/12/13 21:38:44
|
version 1.19, 2000/07/07 18:33:03
|
Line 1
|
Line 1
|
|
/* Most of the web output generation routines. |
|
Copyright (C) 1992-2000 Michigan State University |
|
|
|
The CAPA system is free software; you can redistribute it and/or |
|
modify it under the terms of the GNU Library General Public License as |
|
published by the Free Software Foundation; either version 2 of the |
|
License, or (at your option) any later version. |
|
|
|
The CAPA system is distributed in the hope that it will be useful, |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
Library General Public License for more details. |
|
|
|
You should have received a copy of the GNU Library General Public |
|
License along with the CAPA system; see the file COPYING. If not, |
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
Boston, MA 02111-1307, USA. |
|
|
|
As a special exception, you have permission to link this program |
|
with the TtH/TtM library and distribute executables, as long as you |
|
follow the requirements of the GNU GPL in regard to all of the |
|
software in the executable aside from TtH/TtM. |
|
*/ |
|
|
/* ===================================================================== */ |
/* ===================================================================== */ |
/* copyrighted by Isaac Tsai, 1998, 1999, 2000 */ |
|
/* ===================================================================== */ |
/* ===================================================================== */ |
#include <stdio.h> |
#include <stdio.h> |
#include <ctype.h> |
#include <ctype.h> |
Line 229 void web_printheader(FILE *out)
|
Line 252 void web_printheader(FILE *out)
|
fprintf(out,"<HTML><HEAD>\n"); |
fprintf(out,"<HTML><HEAD>\n"); |
fprintf(out,"<BODY BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#EE1100\">\n"); |
fprintf(out,"<BODY BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#EE1100\">\n"); |
} |
} |
|
|
#ifdef CAPA_WEB |
|
fprintf(out,"<!-- capasbin, CAPA Version %s, %s -->\n", |
|
CAPA_VER,COMPILE_DATE); |
|
#else |
|
fprintf(out,"<!-- capahtml, CAPA Version %s, %s -->\n", |
|
CAPA_VER,COMPILE_DATE); |
|
#endif |
|
} |
} |
|
|
void web_printfooter(FILE *out) |
void web_printfooter(FILE *out) |
Line 425 void w_get_responses(int x,int q_idx,cha
|
Line 440 void w_get_responses(int x,int q_idx,cha
|
sa_p->a_idx = sub_idx; |
sa_p->a_idx = sub_idx; |
sa_p->a_str = strsave(g_entries[x].val); |
sa_p->a_str = strsave(g_entries[x].val); |
sa_p->a_next = NULL; |
sa_p->a_next = NULL; |
|
trim_response_ws(sa_p->a_str); |
if( g_stu_ans_pp[q_idx] == NULL ) { |
if( g_stu_ans_pp[q_idx] == NULL ) { |
g_stu_ans_pp[q_idx] = sa_p; |
g_stu_ans_pp[q_idx] = sa_p; |
} else { |
} else { |
Line 789 and have entered you student id correctl
|
Line 805 and have entered you student id correctl
|
return (error); |
return (error); |
} |
} |
|
|
|
void append_qtext_addbr(new_str) char *new_str; |
|
{ |
|
int ii,jj,len; |
|
char *br_added; |
|
if (new_str==NULL) return; |
|
len=strlen(new_str); |
|
br_added=capa_malloc(len*5,sizeof(char)); |
|
for (ii=0,jj=0;ii<len;ii++) { |
|
if (new_str[ii] == '\n') { |
|
br_added[jj]='<';jj++;br_added[jj]='b';jj++;br_added[jj]='r';jj++; |
|
br_added[jj]='>';jj++;br_added[jj]='\n';jj++; |
|
} else { |
|
br_added[jj]=new_str[ii];jj++; |
|
} |
|
} |
|
br_added[jj]='\0'; |
|
append_qtext(br_added); |
|
capa_mfree(br_added); |
|
} |
|
void append_qtext_addbr2(new_str) char *new_str; |
|
{ |
|
char *br="<br>\n"; |
|
char single[2]; |
|
int ii,len; |
|
single[0]='\0';single[1]='\0'; |
|
if (new_str==NULL) return; |
|
len=strlen(new_str); |
|
for (ii=0;ii<len;ii++) { |
|
if (new_str[ii] == '\n') { |
|
append_qtext(br); |
|
} else { |
|
single[0]=new_str[ii]; |
|
append_qtext(single); |
|
} |
|
} |
|
} |
/* ============================================================================= */ |
/* ============================================================================= */ |
void append_qtext(new_str) char *new_str; |
void append_qtext(new_str) char *new_str; |
{ |
{ |
Line 800 void append_qtext(new_str) char *
|
Line 852 void append_qtext(new_str) char *
|
len,g_qchar_cnt,g_qsize); |
len,g_qchar_cnt,g_qsize); |
fflush(g_cgi); |
fflush(g_cgi); |
#endif /* CGI_DBUG */ |
#endif /* CGI_DBUG */ |
if (g_qchar_cnt+len>g_qsize-1) { |
if (g_qchar_cnt+len>g_qsize-3) { |
char *temp_text; |
char *temp_text; |
g_qsize=(g_qchar_cnt+len)*2; |
g_qsize=(g_qchar_cnt+len)*2; |
temp_text=capa_malloc(g_qsize,sizeof(char)); |
temp_text=capa_malloc(g_qsize,sizeof(char)); |
strncpy(temp_text,g_question_txt,g_qchar_cnt); |
strncpy(temp_text,g_question_txt,g_qchar_cnt); |
|
temp_text[g_qchar_cnt]='\0'; |
capa_mfree(g_question_txt); |
capa_mfree(g_question_txt); |
g_question_txt=temp_text; |
g_question_txt=temp_text; |
|
/* |
|
g_qsize=(g_qchar_cnt+len)*2; |
|
g_question_txt=realloc(g_question_txt,g_qsize); |
|
*/ |
} |
} |
for(ii=0;ii<len;ii++) { |
for(ii=0;ii<len;ii++) { |
g_question_txt[g_qchar_cnt+ii]=new_str[ii]; |
g_question_txt[g_qchar_cnt+ii]=new_str[ii]; |
} |
} |
g_qchar_cnt += len; |
g_qchar_cnt += len; |
g_question_txt[g_qchar_cnt+1]='\0'; |
g_question_txt[g_qchar_cnt]='\0'; |
#ifdef CGI_DBUG |
#ifdef CGI_DBUG |
fprintf(g_cgi,"after: len %d; g_qchar_cnt %d; g_qsize %d\n",len,g_qchar_cnt,g_qsize); |
fprintf(g_cgi,"after: len %d; g_qchar_cnt %d; g_qsize %d; strlen(g_question_txt):%d\n",len,g_qchar_cnt,g_qsize,strlen(g_question_txt)); |
fflush(g_cgi); |
fflush(g_cgi); |
#endif /* CGI_DBUG */ |
#endif /* CGI_DBUG */ |
} |
} |
Line 828 void append_stext(new_str) char *
|
Line 885 void append_stext(new_str) char *
|
new_str,len,g_schar_cnt,g_ssize); |
new_str,len,g_schar_cnt,g_ssize); |
fflush(g_cgi); |
fflush(g_cgi); |
#endif /* CGI_DBUG */ |
#endif /* CGI_DBUG */ |
if (g_schar_cnt+len>g_ssize-1) { |
if (g_schar_cnt+len>g_ssize-2) { |
char *temp_text; |
char *temp_text; |
g_ssize=(g_schar_cnt+len)*2; |
g_ssize=(g_schar_cnt+len)*2; |
temp_text=capa_malloc(g_ssize,sizeof(char)); |
temp_text=capa_malloc(g_ssize,sizeof(char)); |
Line 1062 print_page_header(mode,num_quest) int mo
|
Line 1119 print_page_header(mode,num_quest) int mo
|
char *serverName; |
char *serverName; |
int configResult,term_summary_button=1; |
int configResult,term_summary_button=1; |
|
|
|
buf[0]='\0'; |
|
discussdir[0]='\0'; |
serverName=getenv("SERVER_NAME"); |
serverName=getenv("SERVER_NAME"); |
if (!serverName) { |
if (!serverName) { |
fprintf(stdout,"Enviroment variable SERVER_NAME not set.\n"); |
fprintf(stdout,"Enviroment variable SERVER_NAME not set.\n"); |
Line 1300 char *class_dir; char *c_owner;char *cla
|
Line 1359 char *class_dir; char *c_owner;char *cla
|
char cmp_ans[MAX_BUFFER_SIZE],date_str[DATE_BUFFER]; |
char cmp_ans[MAX_BUFFER_SIZE],date_str[DATE_BUFFER]; |
time_t curtime; |
time_t curtime; |
char *serverName; |
char *serverName; |
|
char *c_ans; |
|
|
serverName=getenv("SERVER_NAME"); |
serverName=getenv("SERVER_NAME"); |
if (!serverName) { |
if (!serverName) { |
Line 1376 char *class_dir; char *c_owner;char *cla
|
Line 1436 char *class_dir; char *c_owner;char *cla
|
} |
} |
} |
} |
|
|
if ((mode==CHECK_ANSWER_MODE) || (mode== TRY_SET_MODE)) |
if ((mode==CHECK_ANSWER_MODE) || (mode== TRY_SET_MODE) || (mode==VIEW_PREVIOUS_MODE)) |
capa_set_login_time(g_student_number,set); |
capa_set_login_time(g_student_number,set); |
|
|
capa_get_header(&header,set); |
capa_get_header(&header,set); |
Line 1405 char *class_dir; char *c_owner;char *cla
|
Line 1465 char *class_dir; char *c_owner;char *cla
|
|
|
if ( result != 0 ) { |
if ( result != 0 ) { |
if( !g_passdue ) { |
if( !g_passdue ) { |
append_qtext("<FORM method=\"post\" "); |
append_qtext("<FORM NAME=\"CAPA\" method=\"post\" "); |
sprintf(buf,"action=\"http://%s/%s/%s/capasbin\">",serverName, |
sprintf(buf,"action=\"http://%s/%s/%s/capasbin\">",serverName, |
g_cgibin_path,c_owner); |
g_cgibin_path,c_owner); |
append_qtext(buf); |
append_qtext(buf); |
Line 1450 char *class_dir; char *c_owner;char *cla
|
Line 1510 char *class_dir; char *c_owner;char *cla
|
if ( !prob_idx->show_br ) { |
if ( !prob_idx->show_br ) { |
append_qtext(prob_idx->question); |
append_qtext(prob_idx->question); |
} else { |
} else { |
|
append_qtext_addbr(prob_idx->question); |
|
/* |
for(idx=0;idx<q_leng;idx++) { |
for(idx=0;idx<q_leng;idx++) { |
if ( g_qchar_cnt+2 >= g_qsize ) { |
if ( g_qchar_cnt+2 > g_qsize-2 ) { |
char *temp_text; |
char *temp_text; |
g_qsize=g_qchar_cnt*2; |
g_qsize=(g_qchar_cnt+2)*2; |
temp_text=capa_malloc(g_qsize,sizeof(char)); |
temp_text=capa_malloc(g_qsize,sizeof(char)); |
strncpy(temp_text,g_question_txt,g_qsize); |
strncpy(temp_text,g_question_txt,g_qsize); |
capa_mfree(g_question_txt); |
capa_mfree(g_question_txt); |
Line 1465 char *class_dir; char *c_owner;char *cla
|
Line 1527 char *class_dir; char *c_owner;char *cla
|
append_qtext("<br>\n"); |
append_qtext("<br>\n"); |
} |
} |
} |
} |
|
*/ |
} |
} |
} |
} |
} |
} |
if(mode == VIEW_PREVIOUS_MODE) { /* VIEW_PREVIOUS_MODE */ |
if(mode == VIEW_PREVIOUS_MODE) { /* VIEW_PREVIOUS_MODE */ |
if( display_ans ) { |
/* |
if( prob_idx->ans_type == ANSWER_IS_FLOAT ) { |
if( prob_idx->ans_type == ANSWER_IS_FLOAT ) { |
a = (double)atof(prob_idx->answer); |
a = (double)atof(prob_idx->answer); |
sprintf(cmp_ans,prob_idx->ans_fmt, a); |
sprintf(cmp_ans,prob_idx->ans_fmt, a); |
} else { |
} else { |
strcpy(cmp_ans,prob_idx->answer); |
if ( prob_idx->ans_type == ANSWER_IS_SUBJECTIVE) { |
|
strcpy(cmp_ans,"Subjective Answer"); |
|
} else { |
|
if (prob_idx->answer) { |
|
strcpy(cmp_ans,prob_idx->answer); |
|
} else { |
|
strcpy(cmp_ans,"No Answer"); |
|
} |
|
} |
} |
} |
if( prob_idx->ans_unit ) { |
if( prob_idx->ans_unit ) { |
sprintf(buf,"<p><tt><b>Answer:</b> %s %s</tt><br>\n",cmp_ans, prob_idx->unit_str); |
sprintf(buf,"<p><tt><b>Answer:</b> %s %s</tt><br>\n",cmp_ans, prob_idx->unit_str); |
} else { |
} else { |
sprintf(buf,"<p><tt><b>Answer:</b> %s</tt><br>\n",cmp_ans); |
sprintf(buf,"<p><tt><b>Answer:</b> %s</tt><br>\n",cmp_ans); |
} |
} |
|
*/ |
|
if( display_ans ) { |
|
c_ans=answers_string(ANSWER_STRING_MODE, prob_idx); |
|
sprintf(buf,"<p><tt><b>Answer:</b> %s</tt><br>",c_ans); |
append_qtext(buf); |
append_qtext(buf); |
|
capa_mfree(c_ans); |
if ( prob_idx->explain) { |
if ( prob_idx->explain) { |
sprintf(buf,"<p><b>Explanation: </b>\n<p>%s<br>\n",prob_idx->explain); |
sprintf(buf,"<p><b>Explanation: </b>\n<p>%s<br>\n",prob_idx->explain); |
append_qtext(buf); |
append_qtext(buf); |
} |
} |
} |
} |
} else { /* could be TRY_SET_MODE, CHECK_ANSWER_MODE */ |
} else { /* could be TRY_SET_MODE, CHECK_ANSWER_MODE */ |
|
|
if( g_passdue ) { |
if( g_passdue ) { |
get_response(header.partial_credit[question_idx],entry.answers[question_idx],question_idx,prob_idx); |
get_response(header.partial_credit[question_idx],entry.answers[question_idx],question_idx,prob_idx); |
}else{ |
}else{ |
Line 1512 char *class_dir; char *c_owner;char *cla
|
Line 1587 char *class_dir; char *c_owner;char *cla
|
append_qtext("\n</OL>\n"); |
append_qtext("\n</OL>\n"); |
if( EndText_p ) append_qtext(EndText_p); |
if( EndText_p ) append_qtext(EndText_p); |
free_problems(first_prob); |
free_problems(first_prob); |
|
free_units(); |
#ifdef CGI_DBUG |
#ifdef CGI_DBUG |
fprintf(g_cgi,"End display each problem\n"); fflush(g_cgi); |
fprintf(g_cgi,"End display each problem\n"); fflush(g_cgi); |
#endif /* CGI_DBUG */ |
#endif /* CGI_DBUG */ |
Line 1895 int gather_answers(char ***ans,int q_idx
|
Line 1970 int gather_answers(char ***ans,int q_idx
|
int cnt; |
int cnt; |
if(p->ans_op==ANS_AND) { |
if(p->ans_op==ANS_AND) { |
int i; StudentAnswer_t *sa_p; |
int i; StudentAnswer_t *sa_p; |
*ans=(char**)capa_malloc(p->ans_cnt,1); |
*ans=(char**)capa_malloc(p->ans_cnt,sizeof(char*)); |
sa_p= g_stu_ans_pp[q_idx+1]; |
sa_p= g_stu_ans_pp[q_idx+1]; |
for(i=0;((i<p->ans_cnt)&&(sa_p));i++){ |
for(i=0;((i<p->ans_cnt)&&(sa_p));i++){ |
ans[0][i]=sa_p->a_str; |
ans[0][i]=sa_p->a_str; |
Line 1905 int gather_answers(char ***ans,int q_idx
|
Line 1980 int gather_answers(char ***ans,int q_idx
|
cnt=p->ans_cnt; |
cnt=p->ans_cnt; |
if (i<p->ans_cnt) return -1; |
if (i<p->ans_cnt) return -1; |
} else { |
} else { |
*ans=(char**)capa_malloc(p->ans_cnt,1); |
*ans=(char**)capa_malloc(p->ans_cnt,sizeof(char*)); |
ans[0][0]=g_stu_ans_pp[q_idx+1]->a_str; |
ans[0][0]=g_stu_ans_pp[q_idx+1]->a_str; |
if ((strlen(ans[0][0])+1) > ANSWER_STRING_LENG) ans[0][0][ANSWER_STRING_LENG]='\0'; |
if ((strlen(ans[0][0])+1) > ANSWER_STRING_LENG) ans[0][0][ANSWER_STRING_LENG]='\0'; |
cnt=1; |
cnt=1; |
Line 1918 void
|
Line 1993 void
|
log_user_ans(int q_idx,Problem_t *p) |
log_user_ans(int q_idx,Problem_t *p) |
{ |
{ |
char **ans; |
char **ans; |
|
char *error; |
int cnt; |
int cnt; |
if (p->ans_type==ANSWER_IS_SUBJECTIVE) { |
if (p->ans_type==ANSWER_IS_SUBJECTIVE) { |
/*capa_set_subjective(g_login_set,q_idx+1,g_student_number, |
/*capa_set_subjective(g_login_set,q_idx+1,g_student_number, |
g_stu_ans_pp[q_idx+1]->a_str);*/ |
g_stu_ans_pp[q_idx+1]->a_str);*/ |
} else { |
} else { |
if (-1 != (cnt=gather_answers(&ans,q_idx,p))) { |
if (-1 != (cnt=gather_answers(&ans,q_idx,p))) { |
switch( capa_check_answers(p,ans,cnt) ) { |
switch( capa_check_answers(p,ans,cnt,&error) ) { |
case EXACT_ANS: g_log_string[q_idx]='Y'; break; |
case EXACT_ANS: g_log_string[q_idx]='Y'; break; |
case APPROX_ANS: g_log_string[q_idx]='Y'; break; |
case APPROX_ANS: g_log_string[q_idx]='Y'; break; |
case SIG_FAIL: g_log_string[q_idx]='S'; break; |
case SIG_FAIL: g_log_string[q_idx]='S'; capa_mfree(error); break; |
case UNIT_FAIL: g_log_string[q_idx]='U'; break; |
case UNIT_FAIL: g_log_string[q_idx]='U'; capa_mfree(error); break; |
case UNIT_NOTNEEDED: g_log_string[q_idx]='U'; break; |
case UNIT_NOTNEEDED: g_log_string[q_idx]='U'; capa_mfree(error); break; |
case NO_UNIT: g_log_string[q_idx]='u'; break; |
case NO_UNIT: g_log_string[q_idx]='u'; break; |
case BAD_FORMULA: g_log_string[q_idx]='F'; break; |
case BAD_FORMULA: g_log_string[q_idx]='F'; break; |
case INCORRECT: g_log_string[q_idx]='N'; break; |
case INCORRECT: g_log_string[q_idx]='N'; break; |
|
case WANTED_NUMERIC: g_log_string[q_idx]='s'; break; |
} |
} |
} |
} |
} |
} |
Line 1977 int sig_u;
|
Line 2054 int sig_u;
|
char *a_fmt; |
char *a_fmt; |
int tries; |
int tries; |
char buf[MAX_BUFFER_SIZE]; |
char buf[MAX_BUFFER_SIZE]; |
|
char *error; |
|
|
a_tpe = p->ans_type; |
a_tpe = p->ans_type; |
t_tpe = p->tol_type; |
t_tpe = p->tol_type; |
tol = p->tolerance; |
tol = p->tolerance; |
Line 2014 int tries;
|
Line 2092 int tries;
|
return; |
return; |
} |
} |
|
|
switch( capa_check_answers(p,ans,cnt) ) { |
switch( capa_check_answers(p,ans,cnt,&error) ) { |
case EXACT_ANS: |
case EXACT_ANS: |
case APPROX_ANS: |
case APPROX_ANS: |
c_ans=answers_string(ANSWER_STRING_MODE, p); |
c_ans=answers_string(ANSWER_STRING_MODE, p); |
Line 2024 int tries;
|
Line 2102 int tries;
|
g_log_string[q_idx]='Y'; |
g_log_string[q_idx]='Y'; |
capa_mfree(c_ans); |
capa_mfree(c_ans); |
break; |
break; |
|
case WANTED_NUMERIC: |
|
create_answer_area(p,q_idx); |
|
g_tried[q_idx]--; /* don't count as a try */ |
|
sprintf(buf,"<br><tt>This question expects a numeric answer, tries %d/%d.</tt>\n",g_tried[q_idx],tries); |
|
append_qtext(buf); |
|
g_new_answerdb[q_idx] = 'N'; |
|
g_log_string[q_idx]='s'; |
|
break; |
case SIG_FAIL: |
case SIG_FAIL: |
create_answer_area(p,q_idx); |
create_answer_area(p,q_idx); |
g_tried[q_idx]--; /* don't count as a try */ |
g_tried[q_idx]--; /* don't count as a try */ |
sprintf(buf,"<br><tt>Please adjust significant figures, tries %d/%d.</tt>\n",g_tried[q_idx],tries); |
sprintf(buf,"<br><tt>Please adjust significant figures, you provided %s significant figures, tries %d/%d.</tt>\n",error,g_tried[q_idx],tries); |
append_qtext(buf); |
append_qtext(buf); |
|
capa_mfree(error); |
g_new_answerdb[q_idx] = 'N'; |
g_new_answerdb[q_idx] = 'N'; |
g_log_string[q_idx]='S'; |
g_log_string[q_idx]='S'; |
break; |
break; |
case UNIT_FAIL: |
case UNIT_FAIL: |
create_answer_area(p,q_idx); |
create_answer_area(p,q_idx); |
g_tried[q_idx]--; /* don't count as a try */ |
g_tried[q_idx]--; /* don't count as a try */ |
sprintf(buf,"<br><tt>Units incorrect, tries %d/%d.</tt>\n",g_tried[q_idx],tries); |
sprintf(buf,"<br><tt>Units incorrect, Computer reads units as %s, tries %d/%d.</tt>\n",error,g_tried[q_idx],tries); |
|
capa_mfree(error); |
append_qtext(buf); |
append_qtext(buf); |
g_new_answerdb[q_idx] = 'N'; |
g_new_answerdb[q_idx] = 'N'; |
g_log_string[q_idx]='U'; |
g_log_string[q_idx]='U'; |
Line 2044 int tries;
|
Line 2132 int tries;
|
create_answer_area(p,q_idx); |
create_answer_area(p,q_idx); |
g_tried[q_idx]--; /* don't count as a try */ |
g_tried[q_idx]--; /* don't count as a try */ |
if(tries > 0) { |
if(tries > 0) { |
sprintf(buf,"<br><tt>Only a number required, tries %d/%d.</tt>\n",g_tried[q_idx],tries); |
sprintf(buf,"<br><tt>Only a number required, Computer reads units of %s, tries %d/%d.</tt>\n",error,g_tried[q_idx],tries); |
append_qtext(buf); |
append_qtext(buf); |
} |
} |
|
capa_mfree(error); |
g_new_answerdb[q_idx] = 'N'; |
g_new_answerdb[q_idx] = 'N'; |
g_log_string[q_idx]='U'; |
g_log_string[q_idx]='U'; |
break; |
break; |
Line 2097 int sig_u;
|
Line 2186 int sig_u;
|
char *a_fmt; |
char *a_fmt; |
int tries; |
int tries; |
char buf[MAX_BUFFER_SIZE]; |
char buf[MAX_BUFFER_SIZE]; |
|
char *error; |
|
|
a_tpe = p->ans_type; |
a_tpe = p->ans_type; |
c_ans = p->answer; |
c_ans = p->answer; |
t_tpe = p->tol_type; |
t_tpe = p->tol_type; |
Line 2136 int tries;
|
Line 2226 int tries;
|
return; |
return; |
} |
} |
|
|
switch( capa_check_answers(p,ans,cnt) ) { |
switch( capa_check_answers(p,ans,cnt,&error) ) { |
case EXACT_ANS: |
case EXACT_ANS: |
case APPROX_ANS: |
case APPROX_ANS: |
g_new_answerdb[q_idx] = 'Y'; |
g_new_answerdb[q_idx] = 'Y'; |
g_log_string[q_idx]='Y'; |
g_log_string[q_idx]='Y'; |
break; |
break; |
|
case WANTED_NUMERIC: |
|
g_new_answerdb[q_idx] = 'N'; |
|
g_log_string[q_idx]='s'; |
|
break; |
case SIG_FAIL: |
case SIG_FAIL: |
g_new_answerdb[q_idx] = 'N'; |
g_new_answerdb[q_idx] = 'N'; |
g_log_string[q_idx]='S'; |
g_log_string[q_idx]='S'; |
|
capa_mfree(error); |
break; |
break; |
case UNIT_FAIL: |
case UNIT_FAIL: |
g_new_answerdb[q_idx] = 'N'; |
g_new_answerdb[q_idx] = 'N'; |
g_log_string[q_idx]='U'; |
g_log_string[q_idx]='U'; |
|
capa_mfree(error); |
break; |
break; |
case UNIT_NOTNEEDED: |
case UNIT_NOTNEEDED: |
g_new_answerdb[q_idx] = 'N'; |
g_new_answerdb[q_idx] = 'N'; |
g_log_string[q_idx]='U'; |
g_log_string[q_idx]='U'; |
|
capa_mfree(error); |
break; |
break; |
case NO_UNIT: |
case NO_UNIT: |
g_new_answerdb[q_idx] = 'N'; |
g_new_answerdb[q_idx] = 'N'; |
Line 2597 FILE *out;
|
Line 2694 FILE *out;
|
|
|
|
|
fprintf(out,"<CENTER>\n"); |
fprintf(out,"<CENTER>\n"); |
fprintf(out,"<APPLET CODE=TScore.class CODEBASE=\"http://%s\" width=%d height=%d>\n",capa_server,width,height); |
fprintf(out,"<APPLET CODE=TScore.class CODEBASE=\"http://%s/CAPA/\" width=%d height=%d>\n",capa_server,width,height); |
fprintf(out,"<PARAM NAME=\"HW_W\" VALUE=\"%f\">\n", hw_w); |
fprintf(out,"<PARAM NAME=\"HW_W\" VALUE=\"%f\">\n", hw_w); |
fprintf(out,"<PARAM NAME=\"QZ_W\" VALUE=\"%f\">\n", qz_w); |
fprintf(out,"<PARAM NAME=\"QZ_W\" VALUE=\"%f\">\n", qz_w); |
fprintf(out,"<PARAM NAME=\"EX_W\" VALUE=\"%f\">\n", ex_w); |
fprintf(out,"<PARAM NAME=\"EX_W\" VALUE=\"%f\">\n", ex_w); |
Line 2641 FILE *out;
|
Line 2738 FILE *out;
|
capa_mfree((char *)capa_server); |
capa_mfree((char *)capa_server); |
} |
} |
|
|
int |
void |
get_tscore_width_height(width,height) |
get_tscore_width_height(width,height) |
int *width;int *height; |
int *width;int *height; |
{ |
{ |
Line 2677 int *hc;int *qc;int *fs;
|
Line 2774 int *hc;int *qc;int *fs;
|
configResult=read_capa_config("homework_weight",buf); |
configResult=read_capa_config("homework_weight",buf); |
if (configResult != 0 && configResult != -1 ) { |
if (configResult != 0 && configResult != -1 ) { |
sscanf(buf,"%f", &hw_w); |
sscanf(buf,"%f", &hw_w); |
if(hw_w <= 0.0 ) { |
if(hw_w < 0.0 ) { |
hw_w = DEFAULT_HW_W; |
hw_w = DEFAULT_HW_W; |
} |
} |
} else { |
} else { |
Line 2686 int *hc;int *qc;int *fs;
|
Line 2783 int *hc;int *qc;int *fs;
|
configResult=read_capa_config("quiz_weight",buf); |
configResult=read_capa_config("quiz_weight",buf); |
if (configResult != 0 && configResult != -1 ) { |
if (configResult != 0 && configResult != -1 ) { |
sscanf(buf,"%f", &qz_w); |
sscanf(buf,"%f", &qz_w); |
if(qz_w <= 0.0 ) { |
if(qz_w < 0.0 ) { |
qz_w = DEFAULT_QZ_W; |
qz_w = DEFAULT_QZ_W; |
} |
} |
} else { |
} else { |
Line 2695 int *hc;int *qc;int *fs;
|
Line 2792 int *hc;int *qc;int *fs;
|
configResult=read_capa_config("exam_weight",buf); |
configResult=read_capa_config("exam_weight",buf); |
if (configResult != 0 && configResult != -1 ) { |
if (configResult != 0 && configResult != -1 ) { |
sscanf(buf,"%f", &ex_w); |
sscanf(buf,"%f", &ex_w); |
if(ex_w <= 0.0 ) { |
if(ex_w < 0.0 ) { |
ex_w = DEFAULT_EX_W; |
ex_w = DEFAULT_EX_W; |
} |
} |
} else { |
} else { |
Line 2704 int *hc;int *qc;int *fs;
|
Line 2801 int *hc;int *qc;int *fs;
|
configResult=read_capa_config("final_weight",buf); |
configResult=read_capa_config("final_weight",buf); |
if (configResult != 0 && configResult != -1 ) { |
if (configResult != 0 && configResult != -1 ) { |
sscanf(buf,"%f", &fe_w); |
sscanf(buf,"%f", &fe_w); |
if(fe_w <= 0.0 ) { |
if(fe_w < 0.0 ) { |
fe_w = DEFAULT_FE_W; |
fe_w = DEFAULT_FE_W; |
} |
} |
} else { |
} else { |
Line 2713 int *hc;int *qc;int *fs;
|
Line 2810 int *hc;int *qc;int *fs;
|
configResult=read_capa_config("correction_weight",buf); |
configResult=read_capa_config("correction_weight",buf); |
if (configResult != 0 && configResult != -1 ) { |
if (configResult != 0 && configResult != -1 ) { |
sscanf(buf,"%f", &pc_w); |
sscanf(buf,"%f", &pc_w); |
if(pc_w <= 0.0 ) { |
if(pc_w < 0.0 ) { |
pc_w = DEFAULT_PC_W; |
pc_w = DEFAULT_PC_W; |
} |
} |
} else { |
} else { |