/[papo]/gnue/phpforms/src/gnue-forms.php
ViewVC logotype

Diff of /gnue/phpforms/src/gnue-forms.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by charlie, Tue Aug 27 18:15:54 2002 UTC revision 1.4 by styxman, Fri Nov 8 17:07:45 2002 UTC
# Line 34  $clientversion="0.0.7";     // full pers Line 34  $clientversion="0.0.7";     // full pers
34  $clientversion="0.0.8";     // new database abstraction layer, gfd source  $clientversion="0.0.8";     // new database abstraction layer, gfd source
35                              // code print out                              // code print out
36  $clientversion="0.0.8.1";   // changes to database/datasource creation code  $clientversion="0.0.8.1";   // changes to database/datasource creation code
37    $clientversion="0.0.8.2";   // added appserver driver but broke postgres driv.
38    $clientversion="0.0.8.3";   // split gnue-forms.php in more files,
39                                // added settings.php
40    $clientversion="0.0.9";     // fixed postgres bug, split gnue-forms into
41                                // common and gnue-forms, many new settings
42    $clientversion="0.0.9.1";   // add Mailgateway (and modified contact.gfd to
43                                // use it
44    
45    
46  // set debug level  require_once("settings.php");
 $debuglevel=9;  // > 10 very detailed  
                 // > 3 normal  
                 // > 1 just basics  
                 //   0,1 no debugging messages  
   
47  require_once("connection.php");  require_once("connection.php");
48  #require_once("xmlrpc.inc");  // has to be included here to get global scope  require_once("xmlrpc.inc");  // has to be included here to get global scope
49    require_once("common.php");  
 // +++++++++++++ Debugging Code ++++++++++++++++++++++++++++++  
   
 if ($debuglevel>8) {  
     error_log ("\n\n".  
                "****************************************\n".  
                "            phpforms restarted          \n".  
                "****************************************\n\n",  
                3, "/tmp/phpforms-errors.log");  
 }  
   
 function DEBUG($level,$str) {  
     global $debuglevel;  
     if ($level<=$debuglevel) {  
         $estr="DEBUG (".$level."):".$str;  
         # print($estr."<BR>");  
         error_log ($estr."\n", 3, "/tmp/phpforms-errors.log");  
     }  
 }  
 ############### FILE UI.PHP ############ BEGIN ###########  
   
 class htmlproducer {  
     var $output;  
     function write($s) {  
         $this->output.=$s;  
     }  
     function writedown() {  
         echo $this->output;  
     }  
 }  
 $out=new htmlproducer;  
 $out->writedown();  
   
 ############### FILE UI.PHP ############ END #############  
   
 ############### FILE CLASSDEF.PHP ###### BEGIN ###########  
   
 class database {  
     var $connected;  
     var $attr;  
     var $status;  
     function database() {  
         $this->connected=false;  
         $this->attr=array();  
     }  
     function setAttr($attr) {  
         $this->attr=$attr;  
     }  
     function getEmptyResultSet($table) {    
         $r=new Resultset;  
         $r->setDatabase($this);  
         $r->setTable($table);  
         return $r;  
     }  
     function getResultSet($table,$query) {  
         return $this->getEmptyResultSet($table);  
     }  
     // global commit /rollback  
     function commit() {  
     }  
     function rollback() {  
     }  
     // BACKUP / RESTORE FUNCTIONS  
     function getBackupData() {  
         return $this->attr;  
     }  
     function restoreData($data) {  
         $this->attr=$data;  
     }      
 }  
 class Resultset {  
     var $lastentry;  
     var $dbcon;  // set by the database itself, or by the datasoure  
     var $table;  
     function Resultset() {    
     }  
     function setDatabase($dbcon) {  
         $this->dbcon=&$dbcon;  
     }  
     function setTable($table) {  
         $this->table=$table;  
     }  
     // cache functions  
     function isSaved() {  
     }  
     function markforRemoval($recordno) {  
     }  
     function ismarkedforRemoval ($recordno) {  
     }  
     function getLastRecordNumber() {  
         return $lastentry;  
     }  
     function commit($dbcon,$table) {  // write datacache  
     }  
     function newEntry($pos=-1) {  
     }  
     function getField($fieldname,$pos) {          
     }  
     function setField($fieldname,$pos,$data) {  
     }  
     // BACKUP / RESTORE FUNCTIONS  
     function getBackupData() {  
         return $this->attr;  
     }  
     function restoreData($data) {          
         $this->attr=$data;  
     }  
 }  
   
 function getDatabaseOfType($type) {  
     if ($type=="XMLRPCtoCommonGateway") {          
         require_once("xmlrpc_Gateway.inc");  
         $db=new XMLRPCtoCommonDB;  
         // Attr: Commonprovider  
     }  
     if (($type=="pgsql")||  
         ($type=="popy")||  
         ($type=="psycopg")||  
         ($type=="pypgsql")) {  
         require_once("database.inc");  
         $db=new PGSQL_DB;  
     }  
     if ($type=="MailGateway") {  
         // Attr: Email-Addr.  
         // MODES: Delete-after-commit  
     }  
     if ($type=="SessionCache") {  
         // Attr: MaxEntrys  
        require_once("database.inc");  
        $db=new SessionCacheDB;  
     }  
     if (!isset($db)) {  
         require_once("database.inc");  
         $db=new database;  
     }  
     return $db;  
 }  
 function databaseFactory($name,$attr) {  
     $db=&getDatabaseOfType($attr["PROVIDER"]);  
     $db->setAttr($attr);  
     return $db;  
 }  
 function restoreDatabase($name,$data) {  
     $db=&getDatabaseOfType($data["PROVIDER"]);  
     $db->restoreData($data);  
     return $db;  
 }  
50    
51    
 class xmlEntity {  // persistent Object  
     var $type;  
     var $name;  
     var $attr;  
     var $_parent;  
     function xmlEntity() {  
         $this->type="XMLEntity";  
         $this->name="";  
     }  
     function setName($n) {  
         $this->name=$n;  
     }  
     function getName() {  
         return $this->name;  
     }  
     function setParent(&$p) {  
         $this->_parent=&$p;  
     }  
     function getParent() {  
         return $this->_parent;  
     }  
     function setAttr($attr) {  
         $this->attr=$attr;  
         if (isset($attr["NAME"])) {  
             $this->name=$attr["NAME"];  
         }  
     }      
     function getAttr() {  
         return $this->attr;  
     }        
     function dump() {  
         $p=$this->_parent;  
         $this->_parent="PARENT";  
         if (isset($this->_parent->type))  
             $this->_parent=$this->_parent->type;  
         var_dump($this);  
         $this->_parent=$p;  
     }  
     function getBackupData() {  
         // for all datasources do getBackupData  
         // echo "MYTYPE: ".$this->type."<BR><BR>";  
         $data= array("name"=>$this->name,  
                      "attr"=>$this->attr,  
                      "type"=>$this->type);  
         return $data;  
     }  
     function restoreData($data) {  
         $this->attr=$data["attr"];  
         $this->type=$data["type"];  
         $this->name=$data["name"];  
     }  
 }  
52  /*  /*
53  +------------+-----------+---------+  +------------+-----------+---------+
54  | Attribute  | Datatype  | Default | Supported?  | Attribute  | Datatype  | Default | Supported?
# Line 276  class xE_datasource extends xmlEntity { Line 80  class xE_datasource extends xmlEntity {
80      var $querymode;      var $querymode;
81      var $querydata;      var $querydata;
82    
     // SOAPconnect  
     var $SOAP;  
   
83      function xE_datasource() {        function xE_datasource() {  
84          parent::xmlEntity();          parent::xmlEntity();
85          $this->type="xE_datasource";          $this->type="xE_datasource";
# Line 294  class xE_datasource extends xmlEntity { Line 95  class xE_datasource extends xmlEntity {
95              $this->doPreQuery($attr["PREQUERY"]);              $this->doPreQuery($attr["PREQUERY"]);
96          } else {                      } else {            
97              $this->Dataset=              $this->Dataset=
98                   $this->dbcon->getEmptyResultSet($this->attr["TABLE"]);                   $this->dbcon->getEmptyResultSet($this->attr["TABLE"],
99                                                     $this->attr["ORDER_BY"]);
100          }/*          }/*
101          if (isset($attr["MASTER"])) {          if (isset($attr["MASTER"])) {
102              $this->doPreQuery($attr["PREQUERY"]);              $this->doPreQuery($attr["PREQUERY"]);
# Line 305  class xE_datasource extends xmlEntity { Line 107  class xE_datasource extends xmlEntity {
107      }        }  
108      function doPreQuery($preq) {      function doPreQuery($preq) {
109          if ($this->attr["TABLE"]=="") return;          if ($this->attr["TABLE"]=="") return;
110          $this->clearCache(); // possibly double call  
111          // if dbdriver=postscript get OIDs          # TO IMPLEMENT: parse prequery string ($preq)
112          $sql = "SELECT OID,* FROM ".$this->attr["TABLE"];          $querytable=array();
113          if ($preq!="")  
114              $sql = $sql." WHERE ".$preq;          if (isset($this->attr["ORDER_BY"])) {
115          if (isset($this->attr["ORDER_BY"]))              
116              $sql=$sql." ORDER BY ".$this->attr["ORDER_BY"];              $dts=$this->dbcon->getResultSet($this->attr["TABLE"],
117          $dts=$this->dbcon->getResultSet($this->attr["TABLE"],$sql);                                              $querytable,
118                                                $this->attr["ORDER_BY"]);
119            } else {
120                
121                $dts=$this->dbcon->getResultSet($this->attr["TABLE"],
122                                                $querytable);
123            };
124          $this->Dataset=&$dts;          $this->Dataset=&$dts;
125      }      }
126    
# Line 320  class xE_datasource extends xmlEntity { Line 128  class xE_datasource extends xmlEntity {
128      function isSaved() {      function isSaved() {
129          $this->Dataset->isSaved();          $this->Dataset->isSaved();
130      }      }
131        function clearCache() {}
132      function markforRemoval ($recordno) {      function markforRemoval ($recordno) {
133          if ($this->querymode) return;          if ($this->querymode) return;
134          $this->Dataset->markforRemoval($recordno);          $this->Dataset->markforRemoval($recordno);
# Line 375  class xE_datasource extends xmlEntity { Line 184  class xE_datasource extends xmlEntity {
184          if ((strlen($this->attr["TABLE"])>0)&&($this->querymode)) {          if ((strlen($this->attr["TABLE"])>0)&&($this->querymode)) {
185              $this->querymode=false;                      $this->querymode=false;        
186              // create sql              // create sql
187              $sql = "select OID,* from ".$this->attr["TABLE"];              $querytable= array();
188              reset($this->querydata);              reset($this->querydata);
189              while (list($k,$v)=each($this->querydata)) {              while (list($k,$v)=each($this->querydata)) {
190                  if (strlen($v)>0) {                  if (strlen($v)>0) {
191                      $where=$where2." ".$k." LIKE '".$v."' ";                      $querytable[$k]=$v;
                     $where2=$where."AND";  
192                      // get field info like: defaultQuery                      // get field info like: defaultQuery
193                      // ignoreCaseOnquery, sloopyQuery...                      // ignoreCaseOnquery, sloopyQuery...
194                  }                  }
195              };              };
196              if (isset($where))              if (isset($this->attr["ORDER_BY"])) {
197                  $sql=$sql." WHERE ".$where;                            
198              if (isset($this->attr["ORDER_BY"]))                  $dts=$this->dbcon->getResultSet($this->attr["TABLE"],
199                  $sql=$sql." ORDER BY ".$this->attr["ORDER_BY"];                                                  $querytable,
200                                                    $this->attr["ORDER_BY"]);
201                } else {
202                  
203                    $dts=$this->dbcon->getResultSet($this->attr["TABLE"],
204                                                    $querytable);
205                };
206              // execute query and store results              // execute query and store results
             $dts=$this->dbcon->getResultSet($this->attr["TABLE"],$sql);  
207              $this->Dataset=&$dts;                      $this->Dataset=&$dts;        
208          }          }
209      }      }
# Line 412  class xE_datasource extends xmlEntity { Line 224  class xE_datasource extends xmlEntity {
224          DEBUG(3,"Restoring DATASOURCE: database='".$dbname."'");          DEBUG(3,"Restoring DATASOURCE: database='".$dbname."'");
225          $this->dbcon=&$this->_parent->dbcons[$dbname];          $this->dbcon=&$this->_parent->dbcons[$dbname];
226          $this->Dataset=          $this->Dataset=
227               $this->dbcon->getEmptyResultSet($this->attr["TABLE"]);               &$this->dbcon->restoreResultSet($this->attr["TABLE"],
228          $this->Dataset->restoreData($data["dataset"]);                                              $data["dataset"]);
229          $this->Dataset->dbcon=&$this->_parent->dbcons[$dbname];          $this->Dataset->dbcon=&$this->_parent->dbcons[$dbname];
230      }      }
231  }  }
# Line 1083  class form { Line 895  class form {
895          $b->setParent($this);          $b->setParent($this);
896    
897          // check if datasource exists          // check if datasource exists
898          if (array_key_exists($attr["DATASOURCE"], $this->datasources)) {          if (array_key_exists("DATASOURCE",$attr) &&
899                array_key_exists($attr["DATASOURCE"], $this->datasources)) {
900                        
901              $dts=&$this->datasources[$attr["DATASOURCE"]];              $dts=&$this->datasources[$attr["DATASOURCE"]];
902              DEBUG(6,"Using Datasource '".$attr["DATASOURCE"]."' for block '".              DEBUG(6,"Using Datasource '".$attr["DATASOURCE"]."' for block '".
# Line 1268  GMenu Line 1081  GMenu
1081          echo "<TABLE BGCOLOR=#EEEEEE><TR>";          echo "<TABLE BGCOLOR=#EEEEEE><TR>";
1082    
1083          echo "<TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;</TD><TD>";          echo "<TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;</TD><TD>";
1084          echo "<input type=image src=\"img/tb_save.png\" name=\"commit\" ".          echo "<input type=image src=\"images/tb_save.png\" name=\"commit\" ".
1085              "alt=\"Commit\">";              "alt=\"Commit\">";
1086          echo "<input type=image src=\"img/tb_new.png\" name=\"new\" ".          echo "<input type=image src=\"images/tb_new.png\" name=\"new\" ".
1087              "alt=\"New Record\" accesskey=\"n\">";              "alt=\"New Record\" accesskey=\"n\">";
1088          echo "<input type=image src=\"img/tb_trash.png\" ".          echo "<input type=image src=\"images/tb_trash.png\" ".
1089              "name=\"delete\" alt=\"Mark Record for removal.\"".              "name=\"delete\" alt=\"Mark Record for removal.\"".
1090              " accesskey=\"d\">";                  " accesskey=\"d\">";    
1091          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";
1092          echo "<input type=image src=\"img/tb_left_arrow.png\"".          echo "<input type=image src=\"images/tb_left_arrow.png\"".
1093              " name=\"prev\" alt=\"Previous Record\" accesskey=\"p\">";              " name=\"prev\" alt=\"Previous Record\" accesskey=\"p\">";
1094          echo "<input type=image src=\"img/tb_right_arrow.png\"".          echo "<input type=image src=\"images/tb_right_arrow.png\"".
1095              " name=\"next\" alt=\"Next Record\" accesskey=\"n\">";                    " name=\"next\" alt=\"Next Record\" accesskey=\"n\">";      
1096          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";
1097          echo "<input type=image src=\"img/tb_preferences.png\" ".          echo "<input type=image src=\"images/tb_preferences.png\" ".
1098              " name=\"prepq\" alt=\"Prepare Query\">";              " name=\"prepq\" alt=\"Prepare Query\">";
1099          echo "<input type=image src=\"img/tb_search.png\" ".          echo "<input type=image src=\"images/tb_search.png\" ".
1100              " name=\"query\" alt=\"Execute Query\" accesskey=\"q\">";              " name=\"query\" alt=\"Execute Query\" accesskey=\"q\">";
1101          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";
1102          echo "<input type=image src=\"img/tb_undo.png\" ".          echo "<input type=image src=\"images/tb_undo.png\" ".
1103              " name=\"rollback\" alt=\"Rollback\">";              " name=\"rollback\" alt=\"Rollback\">";
1104          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";
1105          echo "<input type=image src=\"img/tb_help.png\" ".          echo "<input type=image src=\"images/tb_help.png\" ".
1106              " name=\"help\" alt=\"About\" accesskey=\"a\">";              " name=\"help\" alt=\"About\" accesskey=\"a\">";
1107          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;";
1108          echo "<input type=image src=\"img/tb_close.png\" name=\"close\"".          echo "<input type=image src=\"images/tb_close.png\" name=\"close\"".
1109              " onclick=\"confirm_close();\" ".              " onclick=\"confirm_close();\" ".
1110              "onmouseover='window.status=\"Close Form.\";' ".              "onmouseover='window.status=\"Close Form.\";' ".
1111              "onSubmit=\"confirm_close();\" alt=\"Close\">";              "onSubmit=\"confirm_close();\" alt=\"Close\">";
1112          /*          /*
1113  echo "<input type=image src=\"img/tb_save.png\" name=\"test\">";  echo "<input type=image src=\"images/tb_save.png\" name=\"test\">";
1114  //".  //".
1115              //          "onclick=\"do_action('commit','');\" ".              //          "onclick=\"do_action('commit','');\" ".
1116              // "ONMOUSEOVER='window.status=\"Commit Changes.\";'>";              // "ONMOUSEOVER='window.status=\"Commit Changes.\";'>";
1117          echo "<input type=image src=\"img/tb_new.png\" ".          echo "<input type=image src=\"images/tb_new.png\" ".
1118              "onclick=\"do_action('new','');\" ".              "onclick=\"do_action('new','');\" ".
1119              "ONMOUSEOVER='window.status=\"New Record.\";'>";              "ONMOUSEOVER='window.status=\"New Record.\";'>";
1120   */   */
# Line 1313  echo "<input type=image src=\"img/tb_sav Line 1126  echo "<input type=image src=\"img/tb_sav
1126    
1127          echo "<TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;</TD><TD>";          echo "<TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;</TD><TD>";
1128          if ($t==1) {          if ($t==1) {
1129              echo "<input type=image src=\"img/tb_save.png\" name=\"commit\" ".              echo "<input type=image src=\"images/tb_save.png\" name=\"commit\" ".
1130                  "alt=\"Commit\">";                  "alt=\"Commit\">";
1131              echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";              echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";
1132          }          }
1133          if ($t!=-1) {          if ($t!=-1) {
1134          echo "<input type=image src=\"img/tb_left_arrow.png\"".          echo "<input type=image src=\"images/tb_left_arrow.png\"".
1135              " name=\"ppage\" alt=\"Previous Page\" accesskey=\"p\">";              " name=\"ppage\" alt=\"Previous Page\" accesskey=\"p\">";
1136          }          }
1137          if ($t!=1) {          if ($t!=1) {
1138          echo "<input type=image src=\"img/tb_right_arrow.png\"".          echo "<input type=image src=\"images/tb_right_arrow.png\"".
1139              " name=\"npage\" alt=\"Next Page\" accesskey=\"n\">";                    " name=\"npage\" alt=\"Next Page\" accesskey=\"n\">";      
1140          }          }
1141          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";
1142          echo "<input type=image src=\"img/tb_help.png\" ".          echo "<input type=image src=\"images/tb_help.png\" ".
1143              " name=\"help\" alt=\"About\" accesskey=\"a\">";              " name=\"help\" alt=\"About\" accesskey=\"a\">";
1144          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;";
1145          echo "<input type=image src=\"img/tb_close.png\" name=\"close\"".          echo "<input type=image src=\"images/tb_close.png\" name=\"close\"".
1146              " onclick=\"confirm_close();\" ".              " onclick=\"confirm_close();\" ".
1147              "onmouseover='window.status=\"Close Form.\";' ".              "onmouseover='window.status=\"Close Form.\";' ".
1148              "onSubmit=\"confirm_close();\" alt=\"Close\">";              "onSubmit=\"confirm_close();\" alt=\"Close\">";
1149          /*          /*
1150  echo "<input type=image src=\"img/tb_save.png\" name=\"test\">";  echo "<input type=image src=\"images/tb_save.png\" name=\"test\">";
1151  //".  //".
1152              //          "onclick=\"do_action('commit','');\" ".              //          "onclick=\"do_action('commit','');\" ".
1153              // "ONMOUSEOVER='window.status=\"Commit Changes.\";'>";              // "ONMOUSEOVER='window.status=\"Commit Changes.\";'>";
1154          echo "<input type=image src=\"img/tb_new.png\" ".          echo "<input type=image src=\"images/tb_new.png\" ".
1155              "onclick=\"do_action('new','');\" ".              "onclick=\"do_action('new','');\" ".
1156              "ONMOUSEOVER='window.status=\"New Record.\";'>";              "ONMOUSEOVER='window.status=\"New Record.\";'>";
1157   */   */
# Line 1350  echo "<input type=image src=\"img/tb_sav Line 1163  echo "<input type=image src=\"img/tb_sav
1163    
1164          echo "<TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;</TD><TD>";          echo "<TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;</TD><TD>";
1165          if ($t!=-1) {          if ($t!=-1) {
1166          echo "<input type=image src=\"img/tb_left_arrow.png\"".          echo "<input type=image src=\"images/tb_left_arrow.png\"".
1167              " name=\"ppage\" alt=\"Previous Page\" accesskey=\"p\">";              " name=\"ppage\" alt=\"Previous Page\" accesskey=\"p\">";
1168          }          }
1169          if ($t==1) {          if ($t==1) {
1170              echo "<input type=image src=\"img/tb_save.png\" ".              echo "<input type=image src=\"images/tb_save.png\" ".
1171                  "name=\"commit\" ".                  "name=\"commit\" ".
1172                  "alt=\"Commit\">";                  "alt=\"Commit\">";
1173              echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";              echo "</TD><TD BGCOLOsR=WHITE>&nbsp;</TD><TD>";
1174          } else {          } else {
1175              echo "<input type=image src=\"img/tb_right_arrow.png\"".              echo "<input type=image src=\"images/tb_right_arrow.png\"".
1176                  " name=\"npage\" alt=\"Next Page\" accesskey=\"n\">";             }                  " name=\"npage\" alt=\"Next Page\" accesskey=\"n\">";             }
1177          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;";          echo "</TD><TD BGCOLOsR=WHITE>&nbsp;&nbsp;&nbsp;";
1178          echo "</TD></TR><TABLE><BR><BR>";          echo "</TD></TR><TABLE><BR><BR>";
# Line 1512  echo "<input type=image src=\"img/tb_sav Line 1325  echo "<input type=image src=\"img/tb_sav
1325          $this->sel_block->query();          $this->sel_block->query();
1326      }      }
1327      function commit() {      function commit() {
1328          if ($this->wizard) {          # if ($this->wizard) {
1329              $this->sendMail();          # $this->sendMail();
1330          } else {          #} else {
1331              $this->sel_block->dtsource->commit();          $this->sel_block->dtsource->commit();
1332          }          #}
1333          // commit all datasources          // commit all datasources
1334          // commit database          // commit database
1335      }      }
1336      function rollback() {      function rollback() {
1337            $this->sel_block->dtsource->rollback();
1338          // clear all datasources          // clear all datasources
1339          // rollback the database          // rollback the database
1340      }      }
# Line 1552  echo "<input type=image src=\"img/tb_sav Line 1366  echo "<input type=image src=\"img/tb_sav
1366              }              }
1367          }          }
1368          $mailaddr="mail@jan-ischebeck.de";          $mailaddr="mail@jan-ischebeck.de";
         // $mailaddr="jamest@gnuenterprise.org";  
1369          mail ($mailaddr,"GNU Forms submission",$m);          mail ($mailaddr,"GNU Forms submission",$m);
1370          echo "<H1>MAIL SENT TO ".$mailaddr."</H1>";          echo "<H1>MAIL SENT TO ".$mailaddr."</H1>";
1371          session_destroy();          session_destroy();
# Line 1773  function parseGFDfile($file) { Line 1586  function parseGFDfile($file) {
1586    
1587  function writeHTMLheader() {  function writeHTMLheader() {
1588      global $PHP_SELF;      global $PHP_SELF;
1589        global $showGNUElogo;
1590  ?>  ?>
1591  <HTML>  <HTML>
1592  <HEAD>  <HEAD>
# Line 1785  function writeHTMLheader() { Line 1599  function writeHTMLheader() {
1599    .A { padding=0pt 0pt 0pt }    .A { padding=0pt 0pt 0pt }
1600    INPUT { font-family:monospace; font-size: 12pt }    INPUT { font-family:monospace; font-size: 12pt }
1601  -->  -->
1602  </STYLE>  </STYLE><?php
1603  <CENTER><IMG SRC="img/gnue.png"></CENTER>        if ($showGNUElogo) print "<CENTER><IMG SRC=\"images/gnue.png\"></CENTER>";
1604    ?>
1605  <SCRIPT LANGUAGE="JavaScript"><!--  <SCRIPT LANGUAGE="JavaScript"><!--
1606       function do_action_now(c,a) {       function do_action_now(c,a) {
1607           do_action(c,a)           do_action(c,a)
# Line 1853  function HTTPreloadPage() { Line 1668  function HTTPreloadPage() {
1668    
1669  ############### FILE HELPER.PHP ########## END #############  ############### FILE HELPER.PHP ########## END #############
1670    
 ############### FILE DATABASE.PHP ######## BEGIN ###########  
   
 /*if (!($fior = fopen("/usr/local/var/run/geas-server.ior", "r"))) {  
     die("could not open IOR file");  
 }  
   
 while ($data = fread($fior, 4096)) {  
     echo "loading ior\n<BR>";  
 };  
   
 $obj = new OrbitObject ($ior);  
   
 $obj->SetInfo ("A 2GooD object");  
   
 echo $obj->GetInfo();  
   
 $obj->value = 42;  
   
 echo $obj->value;  
   
 exit(); */  
   
 ############### FILE DATABASE.PHP ######## END #############  
   
1671  ############### FILE SESSION.PHP ######### BEGIN ###########  ############### FILE SESSION.PHP ######### BEGIN ###########
1672    
1673  class UIsession {  class UIsession {
# Line 1930  class UIsession { Line 1721  class UIsession {
1721    
1722    
1723          // check for uploaded form          // check for uploaded form
1724          if (isset($HTTP_POST_FILES['userfile']['name'])) {          if ((isset($HTTP_POST_FILES['userfile']['name'])) &&
1725                ($GLOBALS["allowformsupload"])) {
1726              $tmpfile=$HTTP_POST_FILES['userfile']['tmp_name'];              $tmpfile=$HTTP_POST_FILES['userfile']['tmp_name'];
1727              $this->gfdFileName=$HTTP_POST_FILES['userfile']['name'];              $this->gfdFileName=$HTTP_POST_FILES['userfile']['name'];
1728              exec("rm /tmp/test.gfd");                          exec("rm /tmp/test.gfd");            
# Line 1944  class UIsession { Line 1736  class UIsession {
1736          $this->HTTPinput=$HTTP_POST_VARS;          $this->HTTPinput=$HTTP_POST_VARS;
1737      }        }  
1738      function load() {      function load() {
1739          global $resultform,$PHP_SELF;          global $resultform,$PHP_SELF,$localforms;
1740          $this->loadSessionVars();          $this->loadSessionVars();
1741          $this->checkHTTPinput();          $this->checkHTTPinput();
1742          if ($this->command=="close") {          if ($this->command=="close") {
1743              // show a "do you really want page."              // show a "do you really want to leave" page.
1744                // then jump to $GLOBALS["oncloseformGoto"]
1745              session_destroy();              session_destroy();
1746              $this->gfdFile="";              $this->gfdFile="";
1747          }          }
1748          if ($this->command=="demo") {          if (isset($localforms[$this->command])) {
1749              $this->gfdFile="/home/jan/public_html/intro.gfd";              $this->gfdFile=$localforms[$this->command];
1750              $this->gfdFileName="intro.gfd";              $this->gfdFileName=$localforms[$this->command];
             parseGFDfile($this->gfdFile);          
             $this->form=&$resultform;  
         }  
         if ($this->command=="demo2") {  
             $this->gfdFile="/home/jan/public_html/state_maint.gfd";  
             $this->gfdFileName="state_maint.gfd";  
             parseGFDfile($this->gfdFile);          
             $this->form=&$resultform;  
         }    
         if ($this->command=="demo3") {  
             $this->gfdFile="/home/jan/public_html/contact.gfd";  
             $this->gfdFileName="contact.gfd";  
             // load form data from file  
1751              parseGFDfile($this->gfdFile);                      parseGFDfile($this->gfdFile);        
1752              $this->form=&$resultform;              $this->form=&$resultform;
1753          }          }
1754          if ($this->command=="showsource") {          if (($this->command=="showsource") &&
1755                ($GLOBALS["allowformsSrcshow"])) {
1756              include("print-gfd.inc");              include("print-gfd.inc");
1757              prettyPrintGFDfile($this->gfdFile,$this->gfdFileName);              prettyPrintGFDfile($this->gfdFile,$this->gfdFileName);
1758              echo "<BR><CENTER><A HREF=\"".$PHP_SELF.              echo "<BR><CENTER><A HREF=\"".$PHP_SELF.
# Line 2031  class UIsession { Line 1812  class UIsession {
1812                  $this->form->rollback();                  $this->form->rollback();
1813              }              }
1814          }                  }        
         if (isset($this->form))  
             $this->data=$this->form->getBackupData();              
1815      }      }
1816      function show() {      function show() {
1817          global $PHP_SELF;          global $PHP_SELF;
# Line 2041  class UIsession { Line 1820  class UIsession {
1820              if ($this->command=="help") {              if ($this->command=="help") {
1821                  $this->form->showAbout();                  $this->form->showAbout();
1822              } else {              } else {
1823                    // show Form
1824                  $this->form->showPage();                  $this->form->showPage();
1825                  echo "<P ALIGN=\"RIGHT\">Used GFD file: \"<A HREF=\"".                  if ($GLOBALS["allowformsSrcshow"]) {
1826                      $PHP_SELF."?c=showsource\">".$this->gfdFileName.                      echo "<P ALIGN=\"RIGHT\">Used GFD file: \"<A HREF=\"".
1827                      "</A>\"</P>";                          $PHP_SELF."?c=showsource\">".$this->gfdFileName.
1828                            "</A>\"</P>";
1829                    };
1830                  echo "<FONT COLOR=WHITE>";                  echo "<FONT COLOR=WHITE>";
1831          list($usec, $sec) = explode(' ', microtime());                  // trick to make every page become different
1832          srand((float) $sec + ((float) $usec * 100000));                  list($usec, $sec) = explode(' ', microtime());
1833          echo "x".rand(0,20000)."</FONT>";                  srand((float) $sec + ((float) $usec * 100000));
1834                    echo "x".rand(0,20000)."</FONT>";
1835              }              }
1836          } else {          } else {
1837              //   showQuestionPage              $this->showDemoPage();
             echo "<CENTER><H1>Welcome</H1>\n";  
             echo "<form enctype= \"multipart/form-data\" ".  
                 "action=\"".$PHP_SELF."\" method=\"post\">\n";  
             echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\"".  
                 " value=\"1000000\">\n";  
             echo "Try out your own GFD file:\n";  
             echo "<input name=\"userfile\" type=\"file\">\n";  
             echo "<input type=\"submit\" value=\"Try file\">";  
             echo "</form><BR>";  
             echo "Try a <A HREF=\"".$PHP_SELF."?c=demo\">simple demo</A>, ";  
         echo "<A HREF=\"".$PHP_SELF."?c=demo2\"> a database demo</A>, or<BR>";  
             echo " a <A HREF=\"".$PHP_SELF."?c=demo3\">WIZARD demo with many blocks and pages</A> (try PGUP,PGDN)";  
             echo "<BR><BR>Attention: IE and Konqueror are not supported at the moment. Just mozilla is working ok.";  
             echo "<CENTER>\n";  
1838          }          }
1839          writeHTMLfooter();          writeHTMLfooter();
1840            if (isset($this->form))
1841                $this->data=$this->form->getBackupData();
1842        }
1843        function showDemoPage() {
1844            global $PHP_SELF;
1845            //   showQuestionPage
1846            echo "<CENTER><H1>Welcome</H1>\n";
1847            echo "<form enctype= \"multipart/form-data\" ".
1848                "action=\"".$PHP_SELF."\" method=\"post\">\n";
1849            echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\"".
1850                " value=\"1000000\">\n";
1851            echo "Try out your own GFD file:\n";
1852            echo "<input name=\"userfile\" type=\"file\">\n";
1853            echo "<input type=\"submit\" value=\"Try file\">";
1854            echo "</form><BR>";
1855                echo "Try a <A HREF=\"".$PHP_SELF."?c=demo\">simple demo</A>, ";
1856            echo "<A HREF=\"".$PHP_SELF."?c=demo2\"> a database demo</A>, or<BR>";
1857            echo " a <A HREF=\"".$PHP_SELF."?c=demo3\">WIZARD demo with many blocks and pages</A> (try PGUP,PGDN)";
1858            echo "<BR><BR>Attention: IE and Konqueror are not supported at the moment. Just mozilla is working ok.";
1859            echo "<CENTER>\n";        
1860      }      }
1861      function save() {      function save() {
1862          global $HTTP_SESSION_VARS;          global $HTTP_SESSION_VARS;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26