Subversion Repositories wimsdev

Rev

Rev 15590 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
12569 bpr 1
!! add glose in a glossary
2
max_glossary=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
3
title_limit=50
4
desc_limit=25
5
!if $cmd=new or $cmd=resume
6
  glossary=
7
  !for i=1 to $glossarytot
8
    gl=!record $i of wimshome/log/classes/$wims_class/tool/.glossaryindex
9
    !distribute lines $gl into a_,t_
10
    glossarys=!append line $i,$t_ to $glossarys
11
  !next i
12
!endif
13
!if $cmd=reply
14
  !if $pickglossary=$empty
15
    error=no_pick
16
    !exit
17
  !endif
18
  !if $iniparm=$empty
19
    error=no_parm
20
    !exit
21
  !endif
22
  pickglossary=$[floor($pickglossary)]
23
  !if $pickglossary=NaN or $pickglossary<1 or $pickglossary>min($max_glossary,$glossarytot+1)
24
    error=bad_glossary
25
    !exit
26
  !endif
27
  ititle=!singlespace $title
28
  ititle=!char 1 to $title_limit of $ititle
15590 bpr 29
  tmp=!checkallpar $ititle
30
  !if $tmp=no
31
    ititle=!translate internal (){}[] to ------ in $ititle
32
  !endif
18604 gmarbeuf 33
 
34
  !!! glose content calculation
35
  !set test_type=!getdef gl_type in wimshome/public_html/scripts/data/glossary/$iniparm
36
  !if $test_type!=dynamic
37
    !set aa_cnt=!recordcnt wimshome/public_html/scripts/data/glossary/$iniparm
38
    !for aa_i=4 to $aa_cnt
39
      !set aa_tmp=!record $aa_i of wimshome/public_html/scripts/data/glossary/$iniparm
40
      !if $aa_tmp!=$empty
41
        !set aa_list=!append item $[$aa_i-3] to $aa_list
42
      !endif
43
    !next aa_i
44
    !set add_content=|content=[$aa_list]
45
  !else
46
    !set add_content=
47
  !endif
48
 
12569 bpr 49
  !if $pickglossary=$[$glossarytot+1]
18604 gmarbeuf 50
    !!!! add glose to a new glossary !!!
12569 bpr 51
    !set iglosstitle=!singlespace $new_glossary
12595 bpr 52
    !set idesc=!singlespace $new_glossarydesc
18604 gmarbeuf 53
    !appendfile $gloss_dir/.glossary$pickglossary :$iniparm$add_content\
12569 bpr 54
$ititle
55
    !appendfile $gloss_dir/.glossaryindex :0\
12595 bpr 56
$iglosstitle\
57
$idesc
12569 bpr 58
  !else
18604 gmarbeuf 59
    !!!! add glose to an existing glossary
60
    !!!! FIXME mettre dans l'ordre alphabetique des titres. Cela évitera
61
    !!!! de proposer de changer l'ordre !
62
    !!! on peut supposer qu'ils le sont quand on en ajoute un
63
    !!! mais pas quand on modifie
12569 bpr 64
    sh=!record $pickglossary of wimshome/log/classes/$wims_class/tool/.glossaryindex
65
    glosscnt=!recordcnt $gloss_dir/.glossary$pickglossary
66
    !if $glosscnt>=$max_glossary
67
      error=too_many_gloss
68
      !exit
69
    !endif
18604 gmarbeuf 70
    !!! checks if glose added is already in this glossary !!!
12569 bpr 71
    !for i=1 to $glosscnt
72
      e=!record $i of $gloss_dir/.glossary$pickglossary
73
      !distribute lines $e into wdi,win
18604 gmarbeuf 74
      !if $wdi=$iniparm$add_content
12569 bpr 75
        test=$pickglossary
76
        error=already_exist
77
        !exit
78
      !endif
79
    !next i
18604 gmarbeuf 80
    !appendfile $gloss_dir/.glossary$pickglossary :$iniparm$add_content\
12569 bpr 81
$ititle
82
  !endif
83
 
84
  wims_module_log=class $class: add No$glosscnt to glossary $pickglossary
85
!endif