Menu

[r35]: / trunk / docscript / questionnaire.include  Maximize  Restore  History

Download this file

90 lines (78 with data), 3.3 kB

#!/bin/bash

# DocScript questionnaire function definitions

# Copyright (C) 2009
# Andreas Harnack (ah8 at freenet dot de)

# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this library; see the file COPYING.  If not, write to the Free
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.

# As a special exception, you may use this file as part of a free software
# library without restriction.  Specifically, if other files instantiate
# templates or use macros or inline functions from this file, or you compile
# this file and link it with other files to produce an executable, this
# file does not by itself cause the resulting executable to be covered by
# the GNU General Public License.  This exception does not however
# invalidate any other reasons why the executable file might be covered by
# the GNU General Public License.


source html.include
source php.include

function questionnaire
{
    (
        while IFS='. ' read question questiontext; do
            (
                bl "$questiontext" strong | blck p
                while IFS=') ' read answer answertext; do
                    test "$answer" != "" || break
                    bl "$answertext" input type=radio "name='${question}'" \
                        "value='${answer}'" "`is_checked $1 $question $answer`" | entr li
                done | block ol type=a | blck p
            ) | entry li
        done | block ol type=1
        bl '' input 'type=submit' 'value="Submit"' "name='$1'"
        bl '' input 'type=reset' 'value="Reset"'
    ) | block form 'action="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26%2334%3B%26lt%3B%3Fphp%2520echo%2520%24_SERVER%5B%26%2339%3B%26%2334%3B%26%2339%3BPHP_SELF%26%2339%3B%26%2334%3B%26%2339%3B%5D%3B%2520%3F%26gt%3B%26%2334%3B%26%2339%3B%2520%26%2339%3Bmethod%3D%26%2334%3Bget%26%2334%3B%26%2339%3B%7Dfunction%2520is_checked%2520%7Bphp_print%2520%26%2334%3B%26%2339%3Bchecked%26%2339%3B%26%2334%3B%2520%7Cphp_if%2520%26%2334%3Bisset(%2560php_env%2520GET%2520%241%2560)%2520%26amp%3B%26amp%3B%2520%2560php_env%2520GET%2520%242%2560%2520%3D%3D%2520%26%2339%3B%243%26%2339%3B%26%2334%3B%2520%7Cphp%7Dfunction%2520response%7B%2520%2520%2520%2520questionnaire%3D%26%2334%3B%241%26%2334%3B%3B%2520shift%2520%2520%2520%2520values%3D%26%2334%3B%2560echo%2520%26%2334%3B%2520.%2520%241%2520%26%2334%3B%3B%2520shift%3B%2520for%2520i%3B%2520do%2520echo%2520%26%2334%3B%2520.%2520%26%2339%3B%5C%5C%26%2334%3B%2C%5C%5C%26%2334%3B%26%2339%3B%2520.%2520%24i%26%2334%3B%3B%2520done%2560%26%2334%3B%2520%2520%2520%2520connect%3D%26%2334%3B%26%2339%3B%24MYSQL_server%26%2339%3B%2C%2520%26%2339%3B%24MYSQL_user%26%2339%3B%2C%2520%26%2339%3B%24MYSQL_password%26%2339%3B%26%2334%3B%2520%2520%2520%2520select%3D%26%2334%3B%26%2339%3B%24MYSQL_db%26%2339%3B%26%2334%3B%2520%2520%2520%2520query%3D%26%2334%3B%26%2339%3BINSERT%2520INTO%2520%24questionnaire%2520VALUES%2520(%5C%26%2334%3B%26%2339%3B%24values%2520.%2520%26%2339%3B%5C%26%2334%3B)%26%2339%3B%26%2334%3B%2520%2520%2520%2520(%2520%2520%2520%2520%2520%2520%2520%2520php_assign%2520errors%2520%26%2339%3Barray()%26%2339%3B%2520%2520%2520%2520%2520%2520%2520%2520while%2520IFS%3D%26%2339%3B%3A%26%2339%3B%2520read%2520message%2520condition%3B%2520do%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520test%2520%26%2334%3B%24message%26%2334%3B%2520!%3D%2520%26%2334%3B%26%2334%3B%2520%7C%7C%2520break%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520php_assign%2520%26%2339%3Berrors%5B%5D%26%2339%3B%2520%26%2334%3B%26%2339%3B%24message%26%2339%3B%26%2334%3B%2520%7C%2520php_if%2520%26%2334%3B%24condition%26%2334%3B%2520%2520%2520%2520%2520%2520%2520%2520done%2520%2520%2520%2520%2520%2520%2520%2520(%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520php_print%2520%26%2339%3B%26%2334%3B%26%2339%3B%26%2334%3B%2560image%2520%24icon_warning%2520WARNING%2560%2560tag%2520br%2560%26%2334%3B%26%2339%3B%26%2334%3B%26%2339%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520(%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520php_print%2520%26%2334%3B%2560php_var%2520error%2560%26%2334%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520php_print%2520%26%2334%3B%26%2339%3B%2560tag%2520br%2560%26%2339%3B%26%2334%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520)%2520%7C%2520php_foreach%2520%26%2334%3B%2560php_var%2520errors%2560%2520as%2520%2560php_var%2520error%2560%26%2334%3B%2520%2520%2520%2520%2520%2520%2520%2520)%2520%7C%2520php_if%2520%26%2334%3Bcount(%2560php_var%2520errors%2560)%2520%26gt%3B%25200%26%2334%3B%2520%2520%2520%2520%2520%2520%2520%2520mysql_elseif%2520%26%2334%3B(%2560php_var%2520dbh%2560%2520%3D%2520mysql_connect(%24connect))%26%2334%3B%2520%5C%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%26%2339%3BCould%2520not%2520connect%2520to%2520database%26%2339%3B%2520%2520%2520%2520%2520%2520%2520%2520mysql_elseif%2520%26%2334%3Bmysql_select_db(%24select)%26%2334%3B%2520%5C%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%26%2339%3BCould%2520not%2520select%2520database%26%2339%3B%2520%2520%2520%2520%2520%2520%2520%2520mysql_elseif%2520%26%2334%3Bmysql_query(%24query)%26%2334%3B%2520%5C%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%26%2339%3BCould%2520not%2520insert%2520values%26%2339%3B%2520%2520%2520%2520%2520%2520%2520%2520(%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520php_print%2520%26%2339%3B%26%2334%3B%26%2339%3B%26%2334%3B%2560image%2520%24icon_ok%2520OK%2560%2560tag%2520br%2560%26%2334%3B%26%2339%3B%26%2334%3B%26%2339%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520while%2520read%2520line%3B%2520do%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520php_print%2520%26%2334%3B%26%2339%3B%24line%26%2339%3B%26%2334%3B%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520done%2520%2520%2520%2520%2520%2520%2520%2520)%2520%7C%2520php_else%2520%2520%2520%2520)%2520%7C%2520php_if%2520%26%2334%3Bisset(%2560php_env%2520GET%2520%24questionnaire%2560)%26%2334%3B%2520%7C%2520php%7D%253C%2Fpre">
      
    
MongoDB Logo MongoDB