Subversion Repositories wimsdev

Rev

Rev 12498 | Rev 14052 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 reyssat 1
mailchar=.-@_$alnum
2
 
3
!if $modreq!=$empty
12498 bpr 4
  modreq=!word 1 of $modreq
5
  !if $wims_developer!=$empty
6
    !set modreq=!replace internal devel/$wims_developer/ by in $modreq
7
  !endif
8
  !if / isin $modreq or .. isin $modreq
9
  modreq=
10284 bpr 10
!endif
23 reyssat 11
mtest=!filelist $devdir/$modreq
12
!if $mtest=$empty and ($modreq!=.new or $inddef=$empty)
12498 bpr 13
  modreq=
23 reyssat 14
!endif
15
!if $modreq=$empty
12498 bpr 16
  job=modname
17
  !changeto $job.proc
23 reyssat 18
!endif
19
 
20
!read scripts/getindex $modreq
21
!if $title=$empty and $inddef=$empty
12498 bpr 22
  job=modname
23
  modreq=
24
  !changeto $job.proc
23 reyssat 25
!endif
26
 
27
mod=$modreq
28
 
29
!if $inddef!=$empty
12498 bpr 30
  inddef=
31
  !if $mod=.new
32
    !read scripts/target
33
    !if $error!=$empty or $target=$empty
34
      job=create
35
      !distribute item $target1,$t2,$t3,$target4 into o1,o2,o3,o4
36
      !changeto create.proc
37
    !endif
38
    mod=$target
23 reyssat 39
  !endif
12498 bpr 40
  !for i in title, description, category
41
    i_$i=!trim $(i_$i)
42
    !if $(i_$i)=$empty
43
      error=empty_data
44
      empty_data=$i
45
      job=index
46
      mod=
47
      !exit
48
    !endif
23 reyssat 49
 !next i
50
 !if exercise isitemof $i_category or oef isitemof $i_category or\
12498 bpr 51
	    deductio isitemof $i_category
52
    !if exercise notitemof $i_category
53
      i_category=$i_category, exercise
54
    !endif
55
    !if oef isitemof $i_category or $deductio isitemof $i_category
56
      default=yes
57
    !else
58
      default=no
59
    !endif
60
    !bound i_scoring within yes, no default $default
23 reyssat 61
  !else
12498 bpr 62
    i_scoring=no
23 reyssat 63
  !endif
12498 bpr 64
  !if deductio isitemof $i_category
65
   i_vardef=deduc/var.def
66
  !endif
67
  !if oef isitemof $i_category
68
   i_vardef=oef/var.def
69
  !endif
70
  !if document isitemof $i_category
71
   i_vardef=docu/var.def
72
  !endif
9932 bpr 73
 
12498 bpr 74
  c=!char 1 of $i_description
75
  c=!lower $c
76
  i_description=!replace char number 1 by $c in $i_description
77
  c=!char -1 of $i_description
78
  !if $c!=.
79
   i_description=$i_description.
80
  !endif
81
  !if $i_translation_language!=$empty
82
    !for l_ in $i_translation_language
83
      c=!char 1 of $(i_description_$l_)
84
      c=!lower $c
85
      i_description_$l_=!replace char number 1 by $c in $(i_description_$l_)
86
      c=!char -1 of $(i_description_$l_)
87
      !if $c!=. and $(i_description_$l_)!= $empty
88
        i_description_$l_=$(i_description_$l_).
89
      !endif
90
    !next
23 reyssat 91
 !endif
9932 bpr 92
 
12498 bpr 93
  !bound i_language within $langlist default $module_language
94
  i_level=!listintersect $i_level and $levellist
95
  i_level_cnt=!itemcnt $i_level
96
  !if $i_level issametext $levellist or $i_level_cnt >= 10
97
    !reset i_level
98
  !endif
99
  level_def=!replace internal ~ by , in $modreq
100
  !default i_level=!listintersect $(level_def[1]) and $levellist
101
  i_copyright=$copyright
102
  !default i_copyright=$gnu
103
  i_copyright=!replace internal \COPYING\> by "COPYING"> in $i_copyright
104
  !if $year notwordof $i_copyright
105
    i_copyright=$i_copyright $year
6824 bpr 106
 !endif
23 reyssat 107
 i_require=!listintersect $i_require and $swlist
108
 !default i_author=$auth_name
109
 i_author=!char 1 to 100 of $i_author
4410 bpr 110
 !if , notin in $i_author
111
   author1=!word 1 of $i_author
112
   author2=!word 2 to -1 of $i_author
113
   i_author=$author1, $author2
114
!endif
12498 bpr 115
!default i_address=$auth_email
116
i_address=!items2words $i_address
117
!!i_address=!word 1 of $i_address
118
i_address=!words2items $i_address
119
i_address=!text select ;,$mailchar in $i_address
120
i_translator=!char 1 to 100 of $i_translator
121
i_translator_address=!word 1 of $i_translator_address
122
i_translator_address=!text select $mailchar in $i_translator_address
9932 bpr 123
 
12498 bpr 124
!if $i_translation_language!=$empty
125
  !for l_ in $i_translation_language
126
    i_translator_$l_=!char 1 to 100 of $(i_translator_$l_)
127
    i_translator_address_$l_=!word 1 of $(i_translator_address_$l_)
128
    i_translator_address_$l_=!text select $mailchar in $(i_translator_address_$l_)
129
  !next
130
!endif
131
i_version=!word 1 of $i_version
12559 bpr 132
tmp=!replace internal . by , in $i_version
133
tmp=!charcnt $(tmp[2])
134
!if $tmp<2
135
  !if $tmp=0
136
    !if . notin $i_version
137
      i_version=$i_version.00
138
    !else
139
      i_version=$(i_version)00
140
    !endif
141
  !endif
142
  !if $tmp=1
143
    i_version=$(i_version)0
144
  !endif
145
!endif
146
!reset tmp
147
i_version=!char 1 to 4 of $i_version
12498 bpr 148
i_wims_version=!word 1 of $i_wims_version
149
!default i_version=1.00
150
!default i_wims_version=$wims_version
9932 bpr 151
 
12498 bpr 152
!for l in $deflist1
153
  i_$l=$(i_$l)
154
!next
155
i_translation_language=!items2words $i_translation_language
156
###add fields not accessible by the interface for the moment
157
### will be useful in case of translation in the module itself
158
i_mod_related=!words2items $i_mod_related
159
i_mod_related=!text select _.-/,$alnum in $i_mod_related
160
!default i_mod_related=$mod_related
161
!if .. isin $i_mod_related
162
  i_mod_related=
163
!endif
6312 bpr 164
 
12498 bpr 165
!default i_data=$data
166
!if .. isin $i_data
23 reyssat 167
  i_data=
12498 bpr 168
!endif
169
ind=# This file is automatically generated by $module_title $module_version.\
23 reyssat 170
# Do not edit by hand.\
171
\
172
 
554 bpr 173
!if dialog isitemof $category
549 bpr 174
  i_category=exercise,dialog
175
!endif
572 bpr 176
!if scenario isitemof $category
177
  i_category=exercise,scenario
178
!endif
12498 bpr 179
cat1=!item 1 of $i_category
180
!if document isin $i_category
23 reyssat 181
  i_category=document
182
  cat1=doc
12498 bpr 183
!endif
3999 bpr 184
 
12498 bpr 185
!for i in $deflist,$deflist1
23 reyssat 186
  ind=$ind$i=$(i_$i)\
187
 
12498 bpr 188
!next i
189
!if $cat1=exercise and , isin $i_category
23 reyssat 190
  cat1=!item 2 of $i_category
12498 bpr 191
!endif
192
!if $cat1=recreation
23 reyssat 193
  cat1=exercise
12498 bpr 194
!endif
195
dest=$devdir/$mod
196
src=modules/template/$cat1.$i_language
197
ind=!replace " by \\" in $ind
198
!sh if [ ! -e "$dest" ]; then\
199
  mkdir -p $dest\
200
  cp -pR $src/* $dest\
201
  if [ "$cat1" = "doc" ]; then\
202
   echo '*' >$dest/doc/1/.code\
203
   cat >$dest/doc/1/.def <<@\
23 reyssat 204
tit=$i_title\
205
author=$i_author\
206
email=$i_address\
207
copyright=gnu\
208
dlang=$i_language\
209
docopen=yes\
210
header=\
211
@\
212
   fi\
213
  fi\
214
  echo "$ind" >$dest/INDEX
11551 bpr 215
  !if $i_common_images=yes
216
    !sh sed -i.bak 's/common_images=no/common_images=yes/g' $dest/var.proc\
217
    sed -i.bak 's/class_importation=yes/class_importation=no/g' $dest/var.proc\
218
    rm $dest/var.proc.bak
12498 bpr 219
  !endif
220
  !read scripts/getindex $mod
221
  wims_module_log=$mod/INDEX
23 reyssat 222
!endif
223
 
224
!read files
6322 bpr 225
!default useropts1=2
226
!default useropts2=1
227
!default useropts3=0
7150 bpr 228
!set usersize=$[$wims_texbasesize + ($useropts4)]
7130 bpr 229
 
230
!setdef wims_useropts=$(usersize)$(useropts1)$(useropts2)$(useropts3) in wimshome/sessions/$wims_session/var.stat