Subversion Repositories wimsdev

Rev

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

Rev 6394 Rev 6564
Line 37... Line 37...
37
char lang[MAX_LANGS][4]={
37
char lang[MAX_LANGS][4]={
38
    "en","fr","cn","es","it","nl","si","ca","pt"
38
    "en","fr","cn","es","it","nl","si","ca","pt"
39
};
39
};
40
#define DEFAULT_LANGCNT 6
40
#define DEFAULT_LANGCNT 6
41
char allang[MAX_LANGS][4]={
41
char allang[MAX_LANGS][4]={
42
    "en","fr","cn","es","it","nl","tw","de","si","ca","pt"
42
    "en","fr","cn","es","it","nl","de","si","ca","pt"
43
};
43
};
44
#define allangcnt 8
44
#define allangcnt 8
45
char ignore[MAX_LANGS][MAX_LINELEN+1];
45
char ignore[MAX_LANGS][MAX_LINELEN+1];
46
char mlistfile[MAX_LANGS][256];
46
char mlistfile[MAX_LANGS][256];
47
int langcnt;
47
int langcnt;
Line 219... Line 219...
219
    for(p1=strstr(buf,name); p1!=NULL; p1=strstr(p1+1,name)) {
219
    for(p1=strstr(buf,name); p1!=NULL; p1=strstr(p1+1,name)) {
220
        p2=find_word_start(p1+strlen(name));
220
        p2=find_word_start(p1+strlen(name));
221
        if((p1>buf && !isspace(*(p1-1))) || *p2!='=') continue;
221
        if((p1>buf && !isspace(*(p1-1))) || *p2!='=') continue;
222
        p3=p1; while(p3>buf && isspace(*(p3-1)) && *(p3-1)!='\n') p3--;
222
        p3=p1; while(p3>buf && isspace(*(p3-1)) && *(p3-1)!='\n') p3--;
223
        if(p3>buf && *(p3-1)!='\n') continue;
223
        if(p3>buf && *(p3-1)!='\n') continue;
224
        p2=find_word_start(p2+1);
-
 
225
        p3=strchr(p2,'\n');
224
        p3=strchr(p2,'\n');
-
 
225
        p2=find_word_start(p2+1);
-
 
226
        if(p3 <= p2) continue;
226
        snprintf(value,MAX_LINELEN,"%s",p2);
227
        snprintf(value,MAX_LINELEN,"%s",p2);
227
        if(p3!=NULL && p3-p2<MAX_LINELEN) value[p3-p2]=0;
228
        if(p3!=NULL && p3-p2<MAX_LINELEN) value[p3-p2]=0;
228
        strip_trailing_spaces(value);
229
        strip_trailing_spaces(value);
229
        break;
230
        break;
230
    }
231
    }
Line 295... Line 296...
295
        p2=find_word_end(p1);
296
        p2=find_word_end(p1);
296
        l=p2-p1; if(*p2) *p2++=0;
297
        l=p2-p1; if(*p2) *p2++=0;
297
        fprintf(addrf,"%d:%s\n",t,p1);
298
        fprintf(addrf,"%d:%s\n",t,p1);
298
        fprintf(serialf,"%s:%d\n",p1,t);
299
        fprintf(serialf,"%s:%d\n",p1,t);
299
        thislang=-1;
300
        thislang=-1;
-
 
301
/* language is taken from the address */
300
        if(l>3 && p1[l-3]=='.') {
302
        if(l>3 && p1[l-3]=='.') {
301
            for(i=0;i<langcnt;i++) if(strcasecmp(lang[i],p1+l-2)==0) break;
303
            for(i=0;i<langcnt;i++) if(strcasecmp(lang[i],p1+l-2)==0) break;
302
            if(i<langcnt) {p1[l-3]=0; thislang=i;}
304
            if(i<langcnt) {p1[l-3]=0; thislang=i;}
303
            else {      /* unknown language, not referenced */
305
            else {      /* unknown language, not referenced */
304
                continue;
306
                continue;
Line 307... Line 309...
307
        if(modcnt>0 && strcmp(old,p1)==0 && thislang>=0) {
309
        if(modcnt>0 && strcmp(old,p1)==0 && thislang>=0) {
308
            if(mod[modcnt-1].langcnt<langcnt) {
310
            if(mod[modcnt-1].langcnt<langcnt) {
309
                mod[modcnt-1].langs[mod[modcnt-1].langcnt]=thislang;
311
                mod[modcnt-1].langs[mod[modcnt-1].langcnt]=thislang;
310
                mod[modcnt-1].counts[mod[modcnt-1].langcnt]=t;
312
                mod[modcnt-1].counts[mod[modcnt-1].langcnt]=t;
311
                (mod[modcnt-1].langcnt)++;
313
                (mod[modcnt-1].langcnt)++;
312
            }
314
            }
313
        }
315
        }
314
        else {
316
        else {
315
            mod[modcnt].name=old=p1;
317
            mod[modcnt].name=old=p1;
316
            if(thislang>=0) {
318
            if(thislang>=0) {
317
                mod[modcnt].langs[0]=thislang;
319
                mod[modcnt].langs[0]=thislang;
318
                mod[modcnt].langcnt=1;
320
                mod[modcnt].langcnt=1;
Line 397... Line 399...
397
      i_author,i_address,i_copyright,
399
      i_author,i_address,i_copyright,
398
      i_version,i_wims_version,i_language,
400
      i_version,i_wims_version,i_language,
399
      i_category,i_level,i_domain,i_keywords,
401
      i_category,i_level,i_domain,i_keywords,
400
      i_keywords_ca,i_keywords_fr,i_keywords_it,i_keywords_nl,
402
      i_keywords_ca,i_keywords_fr,i_keywords_it,i_keywords_nl,
401
      i_require
403
      i_require
402
};
404
};
403
 
405
 
404
char *module_special_file[]={
406
char *module_special_file[]={
405
    "intro","help","about"
407
    "intro","help","about"
406
};
408
};
407
#define MODSPEC_NO (sizeof(module_special_file)/sizeof(module_special_file[0]))
409
#define MODSPEC_NO (sizeof(module_special_file)/sizeof(module_special_file[0]))
408
char module_language[4];
410
char module_language[4];
Line 495... Line 497...
495
        i_title,i_description,i_category,i_domain,i_keywords,
497
        i_title,i_description,i_category,i_domain,i_keywords,
496
          i_require,i_author,
498
          i_require,i_author,
497
          i_keywords_ca,i_keywords_fr,i_keywords_it,i_keywords_nl
499
          i_keywords_ca,i_keywords_fr,i_keywords_it,i_keywords_nl
498
    };
500
    };
499
    #define trcnt (sizeof(trlist)/sizeof(trlist[0]))
501
    #define trcnt (sizeof(trlist)/sizeof(trlist[0]))
500
    char *p1, *p2, *pp, buf[MAX_LINELEN+1], lbuf[16];
502
    char *p1, *p2, *pp, *q, buf[MAX_LINELEN+1], lbuf[16];
501
    FILE *f;
503
    FILE *f;
502
   
504
   
503
    if(module_index(name)) return;
505
    if(module_index(name)) return;
504
    towords(indbuf[i_category]);
506
    towords(indbuf[i_category]);
505
    for(i=catcnt=0;i<catno && catcnt<16;i++) {
507
    for(i=catcnt=0;i<catno && catcnt<16;i++) {
Line 579... Line 581...
579
        appenditem(p1,lind,serial,2,module_language);
581
        appenditem(p1,lind,serial,2,module_language);
580
    }
582
    }
581
    snprintf(buf,sizeof(buf),"%s",indbuf[i_level]);
583
    snprintf(buf,sizeof(buf),"%s",indbuf[i_level]);
582
    ovlstrcpy(lbuf,"level");
584
    ovlstrcpy(lbuf,"level");
583
    for(p1=buf; *p1; p1++) if(!isalnum(*p1)) *p1=' ';
585
    for(p1=buf; *p1; p1++) if(!isalnum(*p1)) *p1=' ';
-
 
586
    q=buf+strlen(buf);
584
    for(p1=find_word_start(buf); *p1;
587
    for(p1=find_word_start(buf); (*p1) && (p1 < q) ;
585
        p1=find_word_start(p2)) {
588
        p1=find_word_start(p2)) {
586
        p2=find_word_end(p1);
589
        p2=find_word_end(p1);
587
        if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1);
590
        if(p2!=NULL) *p2++=0; else p2=p1+strlen(p1);
588
        if(!isalpha(*p1) ||
591
        if(!isalpha(*p1) ||
589
           (!isdigit(*(p1+1)) && *(p1+1)!=0) ||
592
           (!isdigit(*(p1+1)) && *(p1+1)!=0) ||