Subversion Repositories wimsdev

Rev

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

Rev 12559 Rev 14052
Line 4... Line 4...
4
  modreq=!word 1 of $modreq
4
  modreq=!word 1 of $modreq
5
  !if $wims_developer!=$empty
5
  !if $wims_developer!=$empty
6
    !set modreq=!replace internal devel/$wims_developer/ by in $modreq
6
    !set modreq=!replace internal devel/$wims_developer/ by in $modreq
7
  !endif
7
  !endif
8
  !if / isin $modreq or .. isin $modreq
8
  !if / isin $modreq or .. isin $modreq
9
  modreq=
9
    modreq=
10
!endif
-
 
11
mtest=!filelist $devdir/$modreq
-
 
12
!if $mtest=$empty and ($modreq!=.new or $inddef=$empty)
-
 
13
  modreq=
-
 
14
!endif
-
 
15
!if $modreq=$empty
-
 
16
  job=modname
-
 
17
  !changeto $job.proc
-
 
18
!endif
-
 
19
 
-
 
20
!read scripts/getindex $modreq
-
 
21
!if $title=$empty and $inddef=$empty
-
 
22
  job=modname
-
 
23
  modreq=
-
 
24
  !changeto $job.proc
-
 
25
!endif
-
 
26
 
-
 
27
mod=$modreq
-
 
28
 
-
 
29
!if $inddef!=$empty
-
 
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
-
 
39
  !endif
-
 
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
-
 
49
 !next i
-
 
50
 !if exercise isitemof $i_category or oef isitemof $i_category or\
-
 
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
-
 
61
  !else
-
 
62
    i_scoring=no
-
 
63
  !endif
-
 
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
10
  !endif
70
  !if document isitemof $i_category
11
  mtest=!filelist $devdir/$modreq
-
 
12
  !if $mtest=$empty and ($modreq!=.new or $inddef=$empty)
71
   i_vardef=docu/var.def
13
    modreq=
72
  !endif
14
  !endif
73
 
-
 
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!=.
15
  !if $modreq=$empty
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
16
    job=modname
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
-
 
91
 !endif
-
 
92
 
-
 
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
17
    !changeto $job.proc
98
  !endif
18
  !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
-
 
106
 !endif
-
 
107
 i_require=!listintersect $i_require and $swlist
-
 
108
 !default i_author=$auth_name
-
 
109
 i_author=!char 1 to 100 of $i_author
-
 
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
-
 
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
-
 
123
 
19
 
124
!if $i_translation_language!=$empty
-
 
125
  !for l_ in $i_translation_language
20
  !read scripts/getindex $modreq
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
-
 
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
21
  !if $title=$empty and $inddef=$empty
138
    !else
22
    job=modname
139
      i_version=$(i_version)00
-
 
140
    !endif
23
    modreq=
141
  !endif
-
 
142
  !if $tmp=1
-
 
143
    i_version=$(i_version)0
24
    !changeto $job.proc
144
  !endif
25
  !endif
145
!endif
-
 
146
!reset tmp
-
 
147
i_version=!char 1 to 4 of $i_version
-
 
148
i_wims_version=!word 1 of $i_wims_version
-
 
149
!default i_version=1.00
-
 
150
!default i_wims_version=$wims_version
-
 
151
 
-
 
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
-
 
164
 
26
 
-
 
27
  mod=$modreq
-
 
28
 
-
 
29
  !if $inddef!=$empty
-
 
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
-
 
39
    !endif
-
 
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
-
 
49
    !next i
-
 
50
    !if exercise isitemof $i_category or oef isitemof $i_category or\
-
 
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
-
 
61
    !else
-
 
62
      i_scoring=no
-
 
63
    !endif
-
 
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
-
 
73
 
-
 
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
-
 
91
    !endif
-
 
92
 
-
 
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
-
 
106
    !endif
-
 
107
    i_require=!listintersect $i_require and $swlist
-
 
108
    !default i_author=$auth_name
-
 
109
    i_author=!char 1 to 100 of $i_author
-
 
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
-
 
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
-
 
123
 
-
 
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
-
 
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
-
 
148
    i_wims_version=!word 1 of $i_wims_version
-
 
149
    !default i_version=1.00
-
 
150
    !default i_wims_version=$wims_version
-
 
151
 
-
 
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
-
 
164
 
165
!default i_data=$data
165
    !default i_data=$data
166
!if .. isin $i_data
166
    !if .. isin $i_data
167
  i_data=
167
      i_data=
168
!endif
168
    !endif
169
ind=# This file is automatically generated by $module_title $module_version.\
169
    ind=# This file is automatically generated by $module_title $module_version.\
170
# Do not edit by hand.\
170
# Do not edit by hand.\
171
\
171
\
172
 
172
 
173
!if dialog isitemof $category
173
    !if dialog isitemof $category
174
  i_category=exercise,dialog
174
      i_category=exercise,dialog
175
!endif
175
    !endif
176
!if scenario isitemof $category
176
    !if scenario isitemof $category
177
  i_category=exercise,scenario
177
      i_category=exercise,scenario
178
!endif
178
    !endif
179
cat1=!item 1 of $i_category
179
    cat1=!item 1 of $i_category
180
!if document isin $i_category
180
    !if document isin $i_category
181
  i_category=document
181
      i_category=document
182
  cat1=doc
182
      cat1=doc
183
!endif
183
    !endif
184
 
184
 
185
!for i in $deflist,$deflist1
185
    !for i in $deflist,$deflist1
186
  ind=$ind$i=$(i_$i)\
186
      ind=$ind$i=$(i_$i)\
187
 
187
 
188
!next i
188
    !next i
189
!if $cat1=exercise and , isin $i_category
189
    !if $cat1=exercise and , isin $i_category
190
  cat1=!item 2 of $i_category
190
      cat1=!item 2 of $i_category
191
!endif
191
    !endif
192
!if $cat1=recreation
192
    !if $cat1=recreation
193
  cat1=exercise
193
      cat1=exercise
194
!endif
194
    !endif
195
dest=$devdir/$mod
195
    dest=$devdir/$mod
196
src=modules/template/$cat1.$i_language
196
    src=modules/template/$cat1.$i_language
197
ind=!replace " by \\" in $ind
197
    ind=!replace " by \\" in $ind
198
!sh if [ ! -e "$dest" ]; then\
198
    !sh if [ ! -e "$dest" ]; then\
199
  mkdir -p $dest\
199
    mkdir -p $dest\
200
  cp -pR $src/* $dest\
200
    cp -pR $src/* $dest\
201
  if [ "$cat1" = "doc" ]; then\
201
    if [ "$cat1" = "doc" ]; then\
202
   echo '*' >$dest/doc/1/.code\
202
    echo '*' >$dest/doc/1/.code\
203
   cat >$dest/doc/1/.def <<@\
203
    cat >$dest/doc/1/.def <<@\
204
tit=$i_title\
204
tit=$i_title\
205
author=$i_author\
205
author=$i_author\
206
email=$i_address\
206
email=$i_address\
207
copyright=gnu\
207
copyright=gnu\
208
dlang=$i_language\
208
dlang=$i_language\
Line 210... Line 210...
210
header=\
210
header=\
211
@\
211
@\
212
   fi\
212
   fi\
213
  fi\
213
  fi\
214
  echo "$ind" >$dest/INDEX
214
  echo "$ind" >$dest/INDEX
215
  !if $i_common_images=yes
215
    !if $i_common_images=yes
216
    !sh sed -i.bak 's/common_images=no/common_images=yes/g' $dest/var.proc\
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\
217
      sed -i.bak 's/class_importation=yes/class_importation=no/g' $dest/var.proc\
218
    rm $dest/var.proc.bak
218
      rm $dest/var.proc.bak
-
 
219
    !endif
-
 
220
    !read scripts/getindex $mod
-
 
221
    wims_module_log=$mod/INDEX
219
  !endif
222
  !endif
220
  !read scripts/getindex $mod
-
 
221
  wims_module_log=$mod/INDEX
-
 
222
!endif
-
 
223
 
-
 
224
!read files
-
 
225
!default useropts1=2
-
 
226
!default useropts2=1
-
 
227
!default useropts3=0
-
 
228
!set usersize=$[$wims_texbasesize + ($useropts4)]
-
 
229
 
223
 
-
 
224
  !read files
-
 
225
  !default useropts1=2
-
 
226
  !default useropts2=1
-
 
227
  !default useropts3=0
-
 
228
  !set usersize=$[$wims_texbasesize + ($useropts4)]
-
 
229
 
230
!setdef wims_useropts=$(usersize)$(useropts1)$(useropts2)$(useropts3) in wimshome/sessions/$wims_session/var.stat
230
  !setdef wims_useropts=$(usersize)$(useropts1)$(useropts2)$(useropts3) in wimshome/sessions/$wims_session/var.stat
-
 
231
!endif