Subversion Repositories wimsdev

Rev

Rev 18091 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18091 Rev 18153
Line 100... Line 100...
100
char *scorepname[]={
100
char *scorepname[]={
101
  "class","user","sheet","work","exam"
101
  "class","user","sheet","work","exam"
102
};
102
};
103
#define scorepname_no (sizeof(scorepname)/sizeof(scorepname[0]))
103
#define scorepname_no (sizeof(scorepname)/sizeof(scorepname[0]))
104
char score_class[MAX_CLASSLEN+1];
104
char score_class[MAX_CLASSLEN+1];
105
int score_sheet,score_exo,score_isexam;
105
int score_sheet,score_exo,score_isexam,score_exam;
106
char score_user[256];
106
char score_user[256];
107
 
107
 
108
/* Uniformed treatment of score command parameters
108
/* Uniformed treatment of score command parameters
109
 * format: class=? user=? sheet=? work=?
109
 * format: class=? user=? sheet=? work=?
110
 * all are optional.
110
 * all are optional.
Line 113... Line 113...
113
{
113
{
114
    int i;
114
    int i;
115
    char *pn, *pe, *pd, *pf;
115
    char *pn, *pe, *pd, *pf;
116
    char sav;
116
    char sav;
117
 
117
 
118
    score_sheet=score_exo=score_isexam=score_ispublic=0; *score_class=0;
118
    score_sheet=score_exo=score_isexam=score_exam=score_ispublic=0; *score_class=0;
119
    score_user[0]=0;
119
    score_user[0]=0;
120
    for(i=0;i<scorepname_no;i++) {
120
    for(i=0;i<scorepname_no;i++) {
121
      pf=p;
121
      pf=p;
122
      ahead:
122
      ahead:
123
      pn=strstr(pf,scorepname[i]); pf=pn+1;
123
      pn=strstr(pf,scorepname[i]); pf=pn+1;
Line 140... Line 140...
140
          break;
140
          break;
141
        }
141
        }
142
        case 3: /* work=exo */
142
        case 3: /* work=exo */
143
          score_exo=atoi(pd); break;
143
          score_exo=atoi(pd); break;
144
        case 4: /* exam */
144
        case 4: /* exam */
145
          score_isexam=1; break;
145
          score_isexam=1;score_exam=atoi(pd); break;
146
     }
146
     }
147
     *pf=sav; ovlstrcpy(pn, pf);
147
     *pf=sav; ovlstrcpy(pn, pf);
148
    }
148
    }
149
    *p=0;
149
    *p=0;
150
    /* the commands are OK from a non trusted module if the user and the
150
    /* the commands are OK from a non trusted module if the user and the
Line 531... Line 531...
531
{
531
{
532
  _scoreparm(p);
532
  _scoreparm(p);
533
  if(*score_class==0 || (score_sheet==0 && score_isexam==0)) {
533
  if(*score_class==0 || (score_sheet==0 && score_isexam==0)) {
534
    *p=0; return;
534
    *p=0; return;
535
  }
535
  }
536
  snprintf(p,20,"%d",getsheetstatus(score_class, score_sheet?score_sheet:score_isexam));
536
  snprintf(p,20,"%d",getsheetstatus(score_class, score_sheet?score_sheet:score_exam));
537
}
537
}
538
 
538
 
539
/* whether there are too much tries for the exo return yes or no */
539
/* whether there are too much tries for the exo return yes or no */
540
void calc_getscoremaxexotry(char *p)
540
void calc_getscoremaxexotry(char *p)
541
{
541
{