[ PHPXref.com ] [ Generated: Sun Jul 20 16:25:17 2008 ] [ ActionApps 2.8.1b ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> fillform.php3 (source)

   1  <?php
   2  /*
   3   *  Uses a combination of JavaScript and PHP to fill values in anonymous posting
   4   *  forms and searchforms.
   5   *
   6   *  See documentation in doc/anonym.html.
   7   *
   8   *    @param bool fillConds If true, the script generates the fillConds code.
   9   *        Otherwise, the fillForm code is generated.
  10   *    @param string my_item_id Unpacked long ID of the item.
  11   *    @param bool notrun If true, doesn't call the JavaScript function
  12   *        This is useful if you include fillform before the actual HTML form.
  13   *        You must call fillForm() or fillConds() explicitly by JavaScript
  14   *        later in code after the form is created.
  15   *    @param string form The name of the form, if it is not "f".
  16   *  @param array oldcontent4id Sent by filler to allow to show the values
  17   *        entered even if some of them was wrong and thus they are not
  18   *        stored in database. If fillform finds this array, it doesn't try
  19   *        to load the values by GetItemContent().
  20   *  @param string show_result Name of a PHP script which receives the array
  21   *        result created by filler. The script than usually shows some info
  22   *        about the errors occured to the user.
  23   *  @param array result Array with error messages passed from filler.php3.
  24   *
  25   *  @param string ac  Access Code to be used with Reader Management to
  26   *        find the correct reader data.
  27   *  @param string aw  The same Access Code as "ac", but additionally
  28   *        confirms the reader's email. See doc/reader.html for more info.
  29   *  @param string au  The same Access Code as "ac", but additionally
  30   *        unsubscribes the user from the collection, the ID of which is given in $c
  31   *  @param string c   Collection ID, used in connection with $au (see above).
  32   *
  33   *  WARNING: There are some troubles with check boxes. You should never use
  34   *      checkboxes checked by default (<INPUT TYPE="CHECKBOX" CHECKED>)
  35   *      in combination with fillform.
  36   *
  37   *     This script contains two similar functions:
  38   *
  39   *     <b>fillForm</b> is used on anonymous posting forms<br>
  40   *     <b>fillConds</b> is used on search forms
  41   *
  42   *     <h1>Function fillForm</h1>
  43   *
  44   *   Prints a JavaScript function which refills form fields with values from database.
  45   *
  46   *   You must supply the var $my_item_id with the item id.
  47   *
  48   *   Works well with HTML - Plain text radio buttons and with Dates
  49   *   represented by 3 select boxes.
  50   *
  51   *   <h1>Function fillConds</h1>
  52   *
  53   *   Prints a JavaScript function which refills form fields with name conds[][] with
  54   *     previous values.
  55   *
  56   *   Uses the array conds and function setControlOrAADate - see fillformutils to get a feel
  57   *   about which form control types are supported (most of them are).
  58   *
  59   *   @param array dateConds Special feature: contains names of textfields which are
  60   *      dates represented by 3 select boxes in the way of AA. E.g. <br>
  61   *      <tt>dateConds[3]="mydate"</tt> means:<br>
  62   *      <tt>conds[3]['value']</tt> is a date in some strtotime format,
  63   *      mydate_day is the select box cotaining day, mydate_month contains month,
  64   *      mydate_year contains year
  65   *
  66   * @package UserInput
  67   * @version $Id: fillform.php3,v 1.27 2005/04/24 21:48:11 honzam Exp $
  68   * @author Jakub Adamek <jakubadamek@ecn.cz>
  69   * @copyright Copyright (C) 1999, 2000 Association for Progressive Communications
  70  */
  71  /*
  72  Copyright (C) 1999, 2000 Association for Progressive Communications
  73  http://www.apc.org/
  74  
  75      This program is free software; you can redistribute it and/or modify
  76      it under the terms of the GNU General Public License as published by
  77      the Free Software Foundation; either version 2 of the License, or
  78      (at your option) any later version.
  79  
  80      This program is distributed in the hope that it will be useful,
  81      but WITHOUT ANY WARRANTY; without even the implied warranty of
  82      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  83      GNU General Public License for more details.
  84  
  85      You should have received a copy of the GNU General Public License
  86      along with this program (LICENSE); if not, write to the Free Software
  87      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  88  */
  89  
  90  if (!isset ($form)) $form = "f";
  91  
  92  $encap = ( ($encap=="false") ? false : true );
  93  
  94  /** APC-AA configuration file */
  95  require_once  "include/config.php3";
  96  /** Defines simplified class for page scroller */
  97  require_once $GLOBALS['AA_INC_PATH']."easy_scroller.php3";
  98  /** Set of useful functions used on most pages */
  99  require_once $GLOBALS['AA_INC_PATH']."util.php3";
 100  /**  Defines class for item manipulation (shows item in compact or fulltext format, replaces aliases ...) */
 101  require_once $GLOBALS['AA_INC_PATH']."item.php3";
 102  /** parses view settings, gets view data and other functions */
 103  require_once $GLOBALS['AA_INC_PATH']."view.php3";
 104  /** defines PageCache class used for caching informations into database */
 105  require_once $GLOBALS['AA_INC_PATH']."pagecache.php3";
 106  /** functions for searching and filtering items */
 107  require_once $GLOBALS['AA_INC_PATH']."searchlib.php3";
 108  /** discussion utility functions */
 109  require_once $GLOBALS['AA_INC_PATH']."discussion.php3";
 110  /** Defines class for inserting and updating database fields */
 111  require_once $GLOBALS['AA_INC_PATH']."varset.php3";
 112  if ($encap) {
 113      /** Main include file for using session management function on an encapsulated (.shtml) page */
 114      require_once $GLOBALS['AA_INC_PATH']."locsessi.php3";
 115  } else {
 116      /** Main include file for using session management function on a page */
 117      require_once $GLOBALS['AA_INC_PATH']."locsess.php3";
 118  }
 119  require_once $GLOBALS["AA_BASE_PATH"]."modules/alerts/util.php3";
 120  /** Used for getFrmJavascript() */
 121  require_once $GLOBALS['AA_INC_PATH']."formutil.php3";
 122  /** Some functions pulled from here to allow inclusion elsewhere */
 123  require_once $GLOBALS['AA_INC_PATH']."fillform.php3";
 124  
 125  page_open(array("sess" => "AA_SL_Session"));
 126  
 127  function RestoreVariables() {
 128      $r_state_vars = unserialize($GLOBALS['r_packed_state_vars']);
 129      if (isset($r_state_vars) AND is_array($r_state_vars)) {
 130          foreach ( $r_state_vars as $k=>$v ) {
 131              $GLOBALS[$k] = $v;
 132          }
 133      }
 134  }
 135  RestoreVariables();
 136  
 137  echo fillFormFromVars($fillConds);
 138  
 139  if ($show_result) {
 140      if ($result) {
 141          readfile(con_url($show_result, "result=".urlencode(serialize($result))));
 142      } else {
 143          readfile($show_result);
 144      }
 145  } elseif (is_array($result)) {
 146      echo "<b>";
 147      foreach ( $result as $k => $v) {
 148          echo $k.": ";
 149          if (is_array($v)) {
 150              foreach ($v as $kk => $vv) {
 151                  echo "$kk - $vv ";
 152              }
 153          } else {
 154              echo $v;
 155          }
 156          echo "<br>\n";
 157      }
 158      echo "</b>";
 159  }
 160  
 161  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]