s4

changeset 350:a6ff48595a4d

Add link to raw format of text file
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 25 Oct 2016 22:56:41 +0859
parents aba890241157
children deb4cc74a415
files examples/common/default/pretty.m4.txt s4-funcs.sh
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/examples/common/default/pretty.m4.txt	Tue Oct 25 22:48:19 2016 +0859
     1.2 +++ b/examples/common/default/pretty.m4.txt	Tue Oct 25 22:56:41 2016 +0859
     1.3 @@ -16,6 +16,7 @@
     1.4  </style>
     1.5  </head>
     1.6  <body>
     1.7 +<p>[[ <a href="_LINK_">RAW TEXT</a> ]]</p>
     1.8  <pre>
     1.9  _BODY_
    1.10  </pre>
     2.1 --- a/s4-funcs.sh	Tue Oct 25 22:48:19 2016 +0859
     2.2 +++ b/s4-funcs.sh	Tue Oct 25 22:56:41 2016 +0859
     2.3 @@ -3338,7 +3338,7 @@
     2.4    GF_VIEWONLY=1 genform "$@"
     2.5  }
     2.6  showattc() {
     2.7 -  # $1=table_m $2=rowid
     2.8 +  # $1=table_m $2=rowid &optional $3=RawFlag
     2.9    err \$1=$1 \$2=$2
    2.10    if ! isfilereadable $user $1 $2; then
    2.11      contenttype; echo
    2.12 @@ -3361,12 +3361,17 @@
    2.13        case $charset in
    2.14  	ASCII*)	charset=""	;;
    2.15        esac
    2.16 -      ct="text/html${charset:+; charset=$charset}"
    2.17 -      cat $bin | htmlescape \
    2.18 -	  | sed 's,^,<span></span>,' \
    2.19 -	  | _m4 -D_TITLE_="$fn" -D_CONTENT_TYPE_="$ct" \
    2.20 -		-D_BODY_="syscmd(\`cat')" $layout/pretty.m4.txt
    2.21 -      exit $?
    2.22 +      if [ -z "$3" ]; then
    2.23 +	ct="text/html${charset:+; charset=$charset}"
    2.24 +	link="?showattc+$1+$2+raw"
    2.25 +	cat $bin | htmlescape \
    2.26 +	    | sed 's,^,<span></span>,' \
    2.27 +	    | _m4 -D_TITLE_="$fn" -D_CONTENT_TYPE_="$ct" \
    2.28 +		  -D_LINK_="$link" \
    2.29 +		  -D_BODY_="syscmd(\`cat')" $layout/pretty.m4.txt
    2.30 +	exit $?
    2.31 +      fi
    2.32 +      ct="text/plain${charset:+; charset=$charset}"
    2.33        ;;
    2.34    esac
    2.35    contenttype "$ct"