Rev 13391 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4301 | bpr | 1 | #!/bin/sh |
1102 | bpr | 2 | |
5753 | bpr | 3 | #line 1: <img src= address /> |
1102 | bpr | 4 | #line 2: graphviz/number_of_image |
5 | #line 3: size in pixels width,height |
||
6 | #line 4 and following: plain output (for the coordinates) |
||
7 | |||
8 | if [ "$wims_exec_parm" = "" ] || [ "$s2_dir" = "" ] || [ ! -d "$s2_dir" ]; then |
||
4302 | bpr | 9 | exit |
1102 | bpr | 10 | fi |
11 | |||
12 | tstamp=`date '+%s'` |
||
13 | |||
14 | if [ "$wims_exec_parm" = "about" ]; then |
||
4302 | bpr | 15 | dd=`./bin/ch..root dot -V 2>&1| head -1` ; |
16 | echo "<a href=\"http://www.graphviz.org\">Graphviz</a> ($dd)" ; |
||
1102 | bpr | 17 | exit; |
18 | fi |
||
19 | |||
20 | if [ -z "$w_graphviz_charset" ]; then w_graphviz_charset="iso-8859-1"; fi |
||
21 | if [ -z "$w_graphviz_output" ]; then w_graphviz_output='png' ; fi |
||
22 | if [ -z "$w_graphviz_format" ]; then w_graphviz_format="dot"; fi ; |
||
23 | if [ "$w_graphviz_format" != 'dot' -a "$w_graphviz_format" != 'neato' -a "$w_graphviz_format" != 'circo' -a "$w_graphviz_format" != 'fdp' -a "$w_graphviz_format" != 'twopi' ]; then w_graphviz_format='dot'; fi |
||
24 | mkdir -p $s2_dir/graphviz |
||
25 | i=1 ; |
||
3311 | bpr | 26 | lsout=`ls $s2_dir/graphviz/*.$w_graphviz_output 2>/dev/null` |
27 | for file in $lsout |
||
1102 | bpr | 28 | do |
29 | num=`basename $file .$w_graphviz_output` |
||
2640 | bpr | 30 | if [ $i -le $num ]; then i=$(( $num+1 )) ; fi |
1102 | bpr | 31 | done |
32 | |||
33 | parm="-T$w_graphviz_output -o $tmp_dir/graphviz.$w_graphviz_output -Tplain -Gcharset=$w_graphviz_charset" |
||
34 | cat <<@ >$tmp_dir/graphviz |
||
35 | $wims_exec_parm |
||
36 | @ |
||
37 | |||
4302 | bpr | 38 | ./bin/ch..root $w_graphviz_format $parm $tmp_dir/graphviz > $tmp_dir/graphviz.plain |
13391 | bpr | 39 | if [ -f "../chroot/tmp/sessions/.chroot" ]; then |
40 | chroot=1; |
||
41 | else |
||
42 | chroot=0; |
||
43 | fi; |
||
44 | |||
45 | cp $tmp_dir/graphviz.$w_graphviz_output $s2_dir/graphviz/$i.$w_graphviz_output |
||
4302 | bpr | 46 | if [ -f "$s2_dir/graphviz/$i.$w_graphviz_output" ]; then |
12017 | bpr | 47 | if [ "$w_graphviz_output" = "svg" ]; then |
13391 | bpr | 48 | cat "$s2_dir/graphviz/$i.$w_graphviz_output" |
49 | echo "plain" |
||
50 | cat "$tmp_dir/graphviz.plain" |
||
12009 | bpr | 51 | else |
52 | echo "wims.cgi?session=$w_session&+cmd=getins&+special_parm=graphviz/$i.$w_graphviz_output&+modif=$tstamp" |
||
13392 | bpr | 53 | if [ "$chroot" = "0" ] ; then |
13391 | bpr | 54 | identify -format \%w,\%h $s2_dir/graphviz/$i.$w_graphviz_output |
55 | else |
||
13392 | bpr | 56 | ./bin/ch..root identify -format \%w,\%h $tmp_dir/graphviz.$w_graphviz_output |
13391 | bpr | 57 | fi; |
13387 | bpr | 58 | echo "" |
12009 | bpr | 59 | cat $tmp_dir/graphviz.plain |
60 | fi |
||
4302 | bpr | 61 | fi |
13391 | bpr | 62 | rm $tmp_dir/graphviz.$w_graphviz_output |
4302 | bpr | 63 | exit |