Subversion Repositories wimsdev

Rev

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

Rev 16727 Rev 16749
Line 1085... Line 1085...
1085
        if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1);
1085
        if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1);
1086
      }
1086
      }
1087
      p2=strchr(p1,'\n'); if(p2) *p2=0;
1087
      p2=strchr(p1,'\n'); if(p2) *p2=0;
1088
      snprintf(nbuf,sizeof(nbuf),"bases/sheet/%s.def",p1);
1088
      snprintf(nbuf,sizeof(nbuf),"bases/sheet/%s.def",p1);
1089
    }
1089
    }
1090
    /* now nbuf is the filename for data in any case of ressource (sheet / public_sheet / freework) */
1090
    /* now nbuf is the filename for data in any case of ressource
-
 
1091
      (sheet / public_sheet / freework) */
1091
    if(readfile(nbuf,buf,sizeof(buf))==NULL) return;
1092
    if(readfile(nbuf,buf,sizeof(buf))==NULL) return;
1092
    /* buf is the data of ressources. nbuf no more needed */
1093
    /* buf is the data of ressources. nbuf no more needed */
1093
    for(p1=strstr(buf,"&+");p1!=NULL;p1=strstr(++p1,"&+"))    /* ????  */
1094
    for(p1=strstr(buf,"&+");p1!=NULL;p1=strstr(++p1,"&+"))    /* delete the &+ in buf */
1094
      ovlstrcpy(p1+1,p1+2);
1095
      ovlstrcpy(p1+1,p1+2);
1095
    /* in case of use an exercice of the class instead of a public exercise */
1096
    /* in case of use an exercice of the class instead of a public exercise */
1096
    if(strncmp(m,"classes/",strlen("classes/"))==0) {
1097
    if(strncmp(m,"classes/",strlen("classes/"))==0) {
1097
      m="classes/";
1098
      m="classes/";
1098
      for(p1=strstr(buf,":classes/");p1;p1=strstr(p1+1,":classes/")) {
1099
      for(p1=strstr(buf,":classes/");p1;p1=strstr(p1+1,":classes/")) {
Line 1102... Line 1103...
1102
        }
1103
        }
1103
      }
1104
      }
1104
    }
1105
    }
1105
    snprintf(nbuf,sizeof(nbuf),":%s\n%s\n",m,rqv);  /* rqv : execution parameters for the module ; m is the name of exercise module */
1106
    snprintf(nbuf,sizeof(nbuf),":%s\n%s\n",m,rqv);  /* rqv : execution parameters for the module ; m is the name of exercise module */
1106
    p1=strstr(buf,nbuf);
1107
    p1=strstr(buf,nbuf);
1107
    /* this boucle search exercise parameters in buf
1108
    /* this loop searches exercise parameters in buf
1108
      calculate num of the exercice in the ressources (sheet /public_sheet / freework)
1109
      calculate num of the exercice in the ressources (sheet /public_sheet / freework)
1109
    */
1110
    */
1110
    while(p1>buf && *(p1-1)!='\n') p1=strstr(p1+1,nbuf);
1111
    while(p1>buf && *(p1-1)!='\n') p1=strstr(p1+1,nbuf);
1111
    if(p1!=NULL) {
1112
    if(p1!=NULL) {
1112
      p2=strchr(buf,':');
1113
      p2=strchr(buf,':');
Line 1115... Line 1116...
1115
        p2=strchr(p2+1,':');
1116
        p2=strchr(p2+1,':');
1116
        while(p2>buf && *(p2-1)!='\n') p2=strchr(p2+1,':');
1117
        while(p2>buf && *(p2-1)!='\n') p2=strchr(p2+1,':');
1117
      }
1118
      }
1118
      if(p2==NULL) return; /* error which should not occur */
1119
      if(p2==NULL) return; /* error which should not occur */
1119
      snprintf(ubuf,sizeof(ubuf),"%d",i);
1120
      snprintf(ubuf,sizeof(ubuf),"%d",i);
-
 
1121
      /* look for dependency information */
1120
/* look for dependency information */     /* pas utile pour freework mais non active tant que les données ne dépasse pas .... */
1122
      /* not useful for freework  mais non active tant que les données ne dépassent pas .... */
1121
      for(j=0, p3=strchr(p1+strlen(nbuf),'\n');
1123
      for(j=0, p3=strchr(p1+strlen(nbuf),'\n');
1122
      j<3 && p3 && *(p3+1)!=':';
1124
      j<3 && p3 && *(p3+1)!=':';
1123
      j++, p3=strchr(p3+1,'\n'));
1125
      j++, p3=strchr(p3+1,'\n'));
1124
      if(j>=3 && p3!=NULL && *(p3+1)!=':') {
1126
      if(j>=3 && p3!=NULL && *(p3+1)!=':') {
1125
        p3++; p4=strchr(p3,'\n');
1127
        p3++; p4=strchr(p3,'\n');
Line 1142... Line 1144...
1142
        snprintf(bf,16,"P%s",sh);
1144
        snprintf(bf,16,"P%s",sh);
1143
        force_setvar("wims_sheet",bf);
1145
        force_setvar("wims_sheet",bf);
1144
      }
1146
      }
1145
      else {
1147
      else {
1146
        if(freework_sheet) {
1148
        if(freework_sheet) {
1147
          /* if an exo is already registered user cannot launch the same exercise an other time */
1149
          /* if an exo is already registered, user cannot launch the same exercise an other time */
1148
          snprintf(nbuf,sizeof(nbuf),"%s/log/classes/%s/freeworksdata/%s/work/%s-wimsexo/%s",
1150
          snprintf(nbuf,sizeof(nbuf),"%s/log/classes/%s/freeworksdata/%s/work/%s-wimsexo/%s",
1149
               getvar("wims_home"),getvar("wims_class"),sh,u,ubuf);
1151
               getvar("wims_home"),getvar("wims_class"),sh,u,ubuf);
1150
          if(ftest(mkfname(NULL,"%s",nbuf))!=is_file) {
1152
          if(ftest(mkfname(NULL,"%s",nbuf))!=is_file) {
1151
            force_setvar("wims_fwnumber",sh);
1153
            force_setvar("wims_fwnumber",sh);
1152
            force_setvar("wims_fwexo",ubuf);
1154
            force_setvar("wims_fwexo",ubuf);