Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  post data preservation

phpMyEdit Features     post data preservation
Post new topic   Reply to topic    
 
michal     Joined: 17 Jun 2003   Posts: 537   Location: Slovakia
Post Posted: 2004-01-10 00:52
Back to top  Reply with quote     

i need to jump away from pme page to another and after a while return back to the first one with the same settings. solution is by storing all necessary POST data into a session.

the problem is that i don't know which data i want to save. i want to save filter settings, page number, sorting, record id and mode. i definetly don't want to save some old add data (to preserve doble inserting of a record, like with back button in IE).

has anyone coped with this ?
which variables are floating around ?

 
nepto     Joined: 06 Jan 2003   Posts: 381   Location: Phoenix, Arizona (USA)
Post Posted: 2004-01-12 07:34
Back to top  Reply with quote     

Uh, they are too many...

But however. I completelly agree with hbernard about prefixing PME control variables and PME data variables. I have this idea in mind for over a year.

Once PME control variables will be prefixed with default or used-defined prefix, it will be easy to located which variables has to be preserved.

Btw. this topic more appropriate for "Features" forum.

_________________
Ondrej Jombik (Nepto)
Visit my homepage , review my recent CV or projects and give me some feedback .
 
michal     Joined: 17 Jun 2003   Posts: 537   Location: Slovakia
Post Posted: 2004-01-13 22:12
Back to top  Reply with quote     

the problem is that i don't want to save all variable that are to pme. definetly i don't want to save 'saveadd'. but maybe there are more.

the 'url' variable in 'url' option looks like what i need. but how do i make an array of it ?

 
hbernard     Joined: 23 Mar 2003   Posts: 159   Location: FRANCE
Post Posted: 2004-01-30 10:51
Back to top  Reply with quote     

Did you uncomment this (in the execute() func)

/*
//phpinfo();
$this->print_get_vars();
$this->print_post_vars();
$this->print_vars();
echo "<pre>query opts:\n";
echo print_r($this->query_opts);
echo "</pre>\n";
echo "<pre>get vars:\n";
echo print_r($this->get_opts);
echo "</pre>\n";
*/

and play with your form ?

 
michal     Joined: 17 Jun 2003   Posts: 537   Location: Slovakia
Post Posted: 2004-02-15 21:18
Back to top  Reply with quote     

so the code that might be wokring is

Code:

function return_hidden_vars($fm = 'NA') /* {{{ */
   {
      // persist
      $persist = explode('&',$this->cgi['persist']);
      foreach ($persist as $param) {
                    $parts = explode('=', $param, 2);
                    if (! isset($parts[1])) {
                        $parts[1] = $default_value;
                    }
                    if (strlen($parts[0]) <= 0) {
                        continue;
                    }
                    $ret[$parts[0]] = $parts[1];
      }
      // sfn
      $ret['sfn'] = $this->get_sfn_cgi_vars();
      // qfn
      $ret['qfn'] = $this->qfn;;
      // rec
      $ret['rec'] = $this->rec;
      // fm
      if($fm == 'NA') $fm = $this->fm;
      $ret['fm'] = $this->fm;
      // fl
      $ret['fl'] = $this->fl;
      return $ret;
   } /* }}} */

   function input_hidden_vars($fm = 'NA')
   {
      $hid = $this->return_hidden_vars($fm);
      foreach($hid as $name => $value) {
         $ret .= $this->htmlHidden($name, $value);
         }
      return $ret;
   }

   function href_hidden_vars($fm = 'NA')
   {
      $hid = $this->return_hidden_vars($fm);
      foreach($hid as $name => $value) {
         $ret .= '&'.$name.'='.$value;
         }
      return $ret;
   }

first function just returns an array which can later be used for $opts['cgi']['append']. second one returns html hidden elements. third one returns part to be used in href links (identical to url vairable in URL option).

i will test the second function in list_table() and display_record() instead of manual html elements.

 
michal     Joined: 17 Jun 2003   Posts: 537   Location: Slovakia
Post Posted: 2004-02-21 14:36
Back to top  Reply with quote     

so another version is here. previous version (sometimes) ignored filters/sorting because variable representing them are (sometimes) arrays.
if $rec is speciefied, it is added to the output, othervise, there is no $rec variable returned.

Code:

   function return_hidden_vars($rec = '') /* {{{ */
   {
      // persist
      $persist = explode('&',$this->cgi['persist']);
      foreach ($persist as $param) {
                    $parts = explode('=', $param, 2);
                    if (! isset($parts[1])) {
                        continue;
                    }
                    if (strlen($parts[0]) <= 0) {
                        continue;
                    }
                    $ret[$parts[0]] = $parts[1];
      }
      // sfn
      $sfn = explode('&',$this->get_sfn_cgi_vars());
      foreach ($sfn as $param) {
                    $parts = explode('=', $param, 2);
                    if (! isset($parts[1])) {
                        continue;
                    }
          $parts[0] = strtr($parts[0], array('sfn[' => '', ']' => ''));
                    if (strlen($parts[0]) <= 0) {
                        continue;
                    }
                    $ret['sfn'][$parts[0]] = $parts[1];
      }
      // qfn
      $ret['qfn'] = $this->qfn;
      $qfn = explode('&',$this->qfn);
      if(is_array($qfn))
         foreach ($qfn as $param) {
                       $parts = explode('=', $param, 2);
                       if (! isset($parts[1])) {
                                continue;
                       }
                       if (strlen($parts[0]) <= 0) {
                           continue;
                       }
                       $ret[$parts[0]] = $parts[1];
          }
      // rec
      if($rec != '') $ret['rec'] = $rec;
      // fm
      $ret['fm'] = $this->fm;
      // fl
      $ret['fl'] = $this->fl;
      return $ret;
   } /* }}} */

   function input_hidden_vars($rec = '')
   {
      $hid = $this->return_hidden_vars($rec);
      foreach($hid as $name => $value) {
         if(is_array($value))
            foreach($value as $name2 => $value2)
               $ret .= $this->htmlHidden($name.'['.$name2.']' , $value2);
         else $ret .= $this->htmlHidden($name, $value);
         }
      return $ret;
   }

   function href_hidden_vars($rec = '')
   {
      $hid = $this->return_hidden_vars($rec);
      foreach($hid as $name => $value) {
         if(is_array($value))
            foreach($value as $name2 => $value2)
               $ret .= '&'.$name.'['.$name2.']'.'='.$value2;
         else $ret .= '&'.$name.'='.$value;
         }
      return $ret;
   }


 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy