| Index
» Projekty
» phpMyEdit
» Fórum
» post data preservation |
 |
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-01-10 00:52
Návrat hore
Odpovedať s citátom
|
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
Založený: 06.01.2003
Príspevky: 381
Bydlisko: Phoenix, Arizona (USA)
Zaslal: 2004-01-12 07:34
Návrat hore
Odpovedať s citátom
|
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
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-01-13 22:12
Návrat hore
Odpovedať s citátom
|
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
Založený: 23.03.2003
Príspevky: 159
Bydlisko: FRANCE
Zaslal: 2004-01-30 10:51
Návrat hore
Odpovedať s citátom
|
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
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-02-15 21:18
Návrat hore
Odpovedať s citátom
|
so the code that might be wokring is
| Kód: |
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
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-02-21 14:36
Návrat hore
Odpovedať s citátom
|
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.
| Kód: |
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;
}
|
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|