Subversion Repositories wimsdev

Rev

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

mailchar=.-@_$alnum

!if $modreq!=$empty
modreq=!word 1 of $modreq
!if $wims_developer!=$empty
  !set modreq=!replace internal devel/$wims_developer/ by in $modreq
!endif
!if / isin $modreq or .. isin $modreq
 modreq=
!endif
mtest=!filelist $devdir/$modreq
!if $mtest=$empty and ($modreq!=.new or $inddef=$empty)
 modreq=
!endif
!if $modreq=$empty
 job=modname
 !changeto $job.proc
!endif

!read scripts/getindex $modreq
!if $title=$empty and $inddef=$empty
 job=modname
 modreq=
 !changeto $job.proc
!endif

mod=$modreq

!if $inddef!=$empty
 inddef=
 !if $mod=.new
  !read scripts/target
  !if $error!=$empty or $target=$empty
   job=create
   !distribute item $target1,$t2,$t3,$target4 into o1,o2,o3,o4
   !changeto create.proc
  !endif
  mod=$target
 !endif
 !for i in title, description, category
  i_$i=!trim $(i_$i)
  !if $(i_$i)=$empty
   error=empty_data
   empty_data=$i
   job=index
   mod=
   !exit
  !endif
 !next i
 !if exercise isitemof $i_category or oef isitemof $i_category or\
        deductio isitemof $i_category
  !if exercise notitemof $i_category
   i_category=$i_category, exercise
  !endif
  !if oef isitemof $i_category or $deductio isitemof $i_category
   default=yes
  !else
   default=no
  !endif
  !bound i_scoring within yes, no default $default
 !else
  i_scoring=no
 !endif
 !if deductio isitemof $i_category
  i_vardef=deduc/var.def
 !endif
 !if oef isitemof $i_category
  i_vardef=oef/var.def
 !endif
 !if document isitemof $i_category
  i_vardef=docu/var.def
 !endif

 c=!char 1 of $i_description
 c=!lower $c
 i_description=!replace char number 1 by $c in $i_description
 c=!char -1 of $i_description
 !if $c!=.
  i_description=$i_description.
 !endif
 !if $i_translation_language!=$empty
   !for l_ in $i_translation_language
     c=!char 1 of $(i_description_$l_)
     c=!lower $c
     i_description_$l_=!replace char number 1 by $c in $(i_description_$l_)
     c=!char -1 of $(i_description_$l_)
     !if $c!=. and $(i_description_$l_)!= $empty
       i_description_$l_=$(i_description_$l_).
     !endif
   !next
 !endif

 !bound i_language within $langlist default $module_language
 i_level=!listintersect $i_level and $levellist
 i_level_cnt=!itemcnt $i_level
 !if $i_level issametext $levellist or $i_level_cnt >= 10
   !reset i_level
 !endif
 level_def=!replace internal ~ by , in $modreq
 !default i_level=!listintersect $(level_def[1]) and $levellist
 i_copyright=$copyright
 !default i_copyright=$gnu
 i_copyright=!replace internal \COPYING\> by "COPYING"> in $i_copyright
 !if $year notwordof $i_copyright
  i_copyright=$i_copyright $year
 !endif
 i_require=!listintersect $i_require and $swlist
 !default i_author=$auth_name
 i_author=!char 1 to 100 of $i_author
 !if , notin in $i_author
   author1=!word 1 of $i_author
   author2=!word 2 to -1 of $i_author
   i_author=$author1, $author2
!endif
 !default i_address=$auth_email
 i_address=!items2words $i_address
 !!i_address=!word 1 of $i_address
 i_address=!words2items $i_address
 i_address=!text select ;,$mailchar in $i_address
 i_translator=!char 1 to 100 of $i_translator
 i_translator_address=!word 1 of $i_translator_address
 i_translator_address=!text select $mailchar in $i_translator_address

 !if $i_translation_language!=$empty
   !for l_ in $i_translation_language
     i_translator_$l_=!char 1 to 100 of $(i_translator_$l_)
     i_translator_address_$l_=!word 1 of $(i_translator_address_$l_)
     i_translator_address_$l_=!text select $mailchar in $(i_translator_address_$l_)
   !next
 !endif
 i_version=!word 1 of $i_version
 i_wims_version=!word 1 of $i_wims_version
 !default i_version=1.00
 !default i_wims_version=$wims_version

 !for l in $deflist1
   i_$l=$(i_$l)
 !next
 i_translation_language=!items2words $i_translation_language
 ###add fields not accessible by the interface for the moment
 ### will be useful in case of translation in the module itself
 i_mod_related=!words2items $i_mod_related
 i_mod_related=!text select _.-/,$alnum in $i_mod_related
 !default i_mod_related=$mod_related
 !if .. isin $i_mod_related
   i_mod_related=
 !endif

 !default i_data=$data
 !if .. isin $i_data
  i_data=
 !endif
 ind=# This file is automatically generated by $module_title $module_version.\
# Do not edit by hand.\
\

!if dialog isitemof $category
  i_category=exercise,dialog
!endif
!if scenario isitemof $category
  i_category=exercise,scenario
!endif
 cat1=!item 1 of $i_category
 !if document isin $i_category
  i_category=document
  cat1=doc
 !endif

 !for i in $deflist,$deflist1
  ind=$ind$i=$(i_$i)\

 !next i
 !if $cat1=exercise and , isin $i_category
  cat1=!item 2 of $i_category
 !endif
 !if $cat1=recreation
  cat1=exercise
 !endif
 dest=$devdir/$mod
 src=modules/template/$cat1.$i_language
 ind=!replace " by \\" in $ind
 !sh if [ ! -e "$dest" ]; then\
   mkdir -p $dest\
   cp -pR $src/* $dest\
   if [ "$cat1" = "doc" ]; then\
    echo '*' >$dest/doc/1/.code\
    cat >$dest/doc/1/.def <<@\
tit=$i_title\
author=$i_author\
email=$i_address\
copyright=gnu\
dlang=$i_language\
docopen=yes\
header=\
@\
   fi\
  fi\
  echo "$ind" >$dest/INDEX
  !if $i_common_images=yes
    !sh sed -i.bak 's/common_images=no/common_images=yes/g' $dest/var.proc\
    sed -i.bak 's/class_importation=yes/class_importation=no/g' $dest/var.proc\
    rm $dest/var.proc.bak
 !endif
 !read scripts/getindex $mod
 wims_module_log=$mod/INDEX
!endif

!read files
!default useropts1=2
!default useropts2=1
!default useropts3=0
!set usersize=$[$wims_texbasesize + ($useropts4)]

!setdef wims_useropts=$(usersize)$(useropts1)$(useropts2)$(useropts3) in wimshome/sessions/$wims_session/var.stat