Subversion Repositories wimsdev

Rev

Rev 17173 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /bin/sh

cd `dirname $0`
cd ..
WIMS_HOME=`pwd`
if [ -f ../../log/wims.conf ] ; then
 language=`awk -F= '$1=="site_languages" {print $2;exit}' ../../log/wims.conf`
fi
if [ -z "$language" ] ; then
 language="en fr nl it es cn ca si"
fi
cd $WIMS_HOME/slib

cat <<@ >index.phtml
!! This file is automatically generated! Do not edit it.
!! Edit the script 'mkindex'.

!if adm/createxo isin \$module
  !set slib_cmd=help
!endif
!read tabletheme
!read lang/slib.phtml.\$lang
!if \$slib_lang_exists!=yes
  !read lang/slib.phtml.en
!endif
!default slib_cmd=resume
!default slib_detname=special_cmd
!set slib_detail=\$(\$slib_detname)

!if \$slib_detail!=\$empty

  !set box_head=<div class="field box"><h3 class="box_title">
  !set box_head2=<li class="field box"><h4 class="box_title">
  !set box_head_full=<div class="field box fullwidth"><h3 class="box_title">
  !set box_middle=</h3><div class="box_desc">
  !set box_middle2=</h4><div class="box_desc">
  !set box_middle_tt=</h3><div class="box_desc tt">
  !set box_foot=</div></div>
  !set box_foot2=</div></li>

  !readproc slib/\$slib_detail slib_header
  !reset slib_lang_exists_tmp
  !readproc help/\$lang/slib/\$slib_detail
  !if \$slib_lang_exists_tmp!=yes
    !readproc help/en/slib/\$slib_detail
  !endif
  !distribute lines \$slib_parms into slpcnt,slp1,slp2,slp3,slp4,slp5,slp6,slp7,slp8,slp9,slp10,slp11,slp12,slp13,slp14
  !for i=1 to \$slpcnt
    !set slpdflt\$i=!item 1 of \$(slp\$i)
    !set slp\$i=!item 2 to -1 of \$(slp\$i)
  !next i
  !readproc namewriting.phtml \$slib_author
  !set slib_author=\$script_out
  <fieldset class="property_fields blockcenter">
  <legend>\$wims_name_slib</legend>
  \$box_head \$wims_name_name \$box_middle_tt \$slib_detail \$box_foot
  \$box_head \$wims_name_title \$box_middle \$slib_title \$box_foot
  \$box_head \$wims_name_Author \$box_middle \$slib_author \$box_foot
  \$box_head \$wims_name_call1 \$box_middle <code>!readproc slib/\$slib_detail [parameters]</code>
  (\$wims_name_result <span class="tt">slib_out</span>) \$box_foot
  \$box_head \$wims_name_call2 \$box_middle <code>slib(\$slib_detail [parameters])</code> \$box_foot
  \$box_head_full \$wims_name_Parameters \$box_middle
  !if \$slpcnt>1
    !if + isin \$slpcnt
      \$wims_name_variable_list
    !else
      \$wims_name_upto
    !endif
  !else
    : \$slpcnt
  !endif
  </div>
  <ol class="flex_box">
    !for i=1 to \$slpcnt
      \$box_head2 \$wims_name_Parameter \$i
      !ifval \$i=\$slpcnt and + isin \$slpcnt
        and up
      !endif
      \$box_middle2 \$(slp\$i)
      !if \$(slpdflt\$i)!=\$empty
        <div class="param_default"><em>(\$wims_name_default: <span class="tt">\$(slpdflt\$i)</span>)</em></div>
      !endif
      \$box_foot2
    !next i
  </ol>
  </div>
  \$box_head \$wims_name_Output \$box_middle \$slib_out \$box_foot
  !if \$slib_comment!=\$empty
    \$box_head \$wims_name_comment \$box_middle \$slib_comment \$box_foot
  !endif
  !if \$slib_require!=\$empty
    \$box_head \$wims_name_Required_Software \$box_middle_tt \$slib_require \$box_foot
  !endif
  !if \$slib_example!=\$empty
    !set excnt=!linecnt \$slib_example
    \$box_head_full \$wims_name_Example OEF \$box_middle
    !for i=1 to \$excnt
      !set slib_exemple=!line \$i of \$slib_example
      <hr>
      <code>\text{A=slib(\$slib_detail \$slib_exemple)}</code>
      !set slib_wims_backslash=\$wims_backslash_insmath
      !set wims_backslash_insmath=yes
      !readproc slib/\$slib_detail \$slib_exemple
      <p>\$wims_name_Output:</p>
      !if table notin \$slib_out and object notin \$slib_out and bubble notin \$slib_out and geogebra notin \$slib_detail and jsxgraph notin \$slib_detail
        <pre>\$slib_out</pre>
      !else
        \$slib_out
      !endif
      !set wims_backslash_insmath=\$slib_wims_backslash
      !reset slib_wims_backslash
      !next i
      !reset slib_exemple
      \$box_foot
    !endif

    </fieldset>
    !reset \$slib_detname
  !exit
!endif
\$wims_name_instruction

!read slib/index.phtml.\$lang
@
for ll in $language
do
  echo "!! This file is automatically generated! Do not edit it.
!! Edit the script 'mkindex'.

!reset table_center
<h2>\$wims_name_listslib</h2>
<div id='listslib'>
   <ul>" > index.phtml.$ll
  echo "" > index.phtml.temp
  cnt_slib_tot=0

  for categorie in `find . -maxdepth 1 -type d | sed 's!^\./!!g' |  egrep -v '\/\.svn\/'  | sort`
  do
    if [ "$categorie" = "." ];then
      cat_name="\$wims_name_All"
    else
      cat_name="$categorie"
    fi
    cat <<@ >>index.phtml.temp
    <div id="content_$categorie">
    \$table_header
    <caption>$cat_name</caption>
    \$table_tr<th>\$wims_name_name</th><th>\$wims_name_Output</th></tr>
@
    cnt_slib=0
    for f in `find ./$categorie -type f | sed 's!^\./!!g' | sed 's!^\./!!g' | grep ./ |  egrep -v '\/\.svn\/' |  egrep -v '\.html'| sort`
    do
      if [ -f "$WIMS_HOME/help/$ll/slib/$f" ]; then
        tit=`awk -F= '$1=="slib_title" {print $2; exit}' $WIMS_HOME/help/$ll/slib/$f`
      fi
      if [ -z "$tit" ]; then
        if [ -f "$WIMS_HOME/help/en/slib/$f" ]; then
          tit=`awk -F= '$1=="slib_title" {print $2; exit}' $WIMS_HOME/help/en/slib/$f`
        else
         tit=`awk -F= '$1=="slib_title" {print $2; exit}' $f`
        fi
      fi
      if [ -n "$tit" ]; then
        #echo $f
        cnt_slib=`expr $cnt_slib + 1`
        if [ $cnt_slib -ge 1 ]; then
        cat <<@ >>index.phtml.temp
        \$table_tr<td class="tt wims_code_words">$f</td><td>$tit
        !href cmd=\$slib_cmd&special_parm=slib&\$slib_detname=$f\$slib_detailanchor [\$wims_name_detail]
        </td></tr>
@
        fi;
        tit=''
      fi
    done
    echo "'$cat_name' done ($cnt_slib)"
    cat <<@ >>index.phtml.temp
    \$table_end
    </div>
@

  cat <<@ >>index.phtml.$ll
      <li>
       <a href="#content_$categorie">
         $cat_name ($cnt_slib)</a>
      </li>
@
  cnt_slib_tot=`expr $cnt_slib_tot + $cnt_slib`
  done

  cat <<@ >>index.phtml.$ll
      </ul>
@

  cat index.phtml.temp >>index.phtml.$ll
  cat <<@ >>index.phtml.$ll
      </div>
      !!# Si les librairies Jquery sont chargées, on affiche des onglets.
      !if \$jquery_defined=yes
        <script>
          /*<![CDATA[*/ jQuery(function(jq) {
            jq( "#listslib" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );
            jq( "#listslib li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );
            jq( "#listslib li a" ).click(function() {
              //get the top offset of the target anchor
              var target_offset = jq("#listslib").offset();
              var target_top = target_offset.top;
              //goto that anchor by setting the body scroll top to anchor top
              jq('html, body').animate({scrollTop:target_top});
            });
          }); /*]]>*/
        </script>
        <style>
         /*<![CDATA[*/\
          /*.ui-tabs-vertical { width: 55em; }*/
          .ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left; /*width: 12em;*/ }
          .ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; }
          .ui-tabs-vertical .ui-tabs-nav li a { display:block; }
          .ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; }
          .ui-tabs-vertical .ui-tabs-panel { margin-left: 1em; float: left; width: 70%;}
          .ui-tabs-vertical .ui-tabs-panel .wimstable { width: 100%;}
          /*]]>*/\
         </style>
      !endif
@

  echo "*** '$ll' done ($cnt_slib_tot)"
  echo
done
echo
echo Indexed $cnt_slib_tot scripts.
echo