version 1.7, 2002/08/16 21:54:38 |
version 1.8, 2002/08/23 01:00:01 |
|
|
$qf0,.. value of filter for column 0 |
$qf0,.. value of filter for column 0 |
$qfn value of all filters used during the last pass |
$qfn value of all filters used during the last pass |
$sfn sort field number (- = descending sort order) |
$sfn sort field number (- = descending sort order) |
$operation operation to do: Add, Change, Delete |
$operation operation to do: Add, Change, Delete |
|
$message informational message to print |
$filter filter query |
$filter filter query |
$sw filter display/hide button |
$sw filter display/hide button |
|
|
Line 125 class phpMyEdit { |
|
Line 126 class phpMyEdit { |
|
var $sfn; // sort field number (- = descending sort order) |
var $sfn; // sort field number (- = descending sort order) |
|
|
var $rec; // no. of record selected for editing |
var $rec; // no. of record selected for editing |
var $prev, $next; // navigation buttons |
var $prev; // navigation buttons |
|
var $next; |
var $sw; // filter display/hide button |
var $sw; // filter display/hide button |
var $labels; // labels for buttons, etc (multilingual) |
var $labels; // labels for buttons, etc (multilingual) |
var $operation; // operation to do: Add, Change, Delete |
var $operation; // operation to do: Add, Change, Delete |
|
var $message; // informational message to print |
|
|
var $saveadd; |
var $saveadd; |
var $moreeadd; |
var $moreeadd; |
Line 210 class phpMyEdit { |
|
Line 213 class phpMyEdit { |
|
// default to English-U.S. |
// default to English-U.S. |
$ret = @include($this->dir['lang'].'PME.lang.EN-US.inc'); |
$ret = @include($this->dir['lang'].'PME.lang.EN-US.inc'); |
} |
} |
|
if (!isset($ret['Search'])) $ret['Search'] = 'v'; |
|
if (!isset($ret['Hide'])) $ret['Hide'] = '^'; |
|
if (!isset($ret['Go'])) $ret['Go'] = htmlspecialchars('>'); |
|
if (!isset($ret['of'])) $ret['of'] = '/'; |
return $ret; |
return $ret; |
} /* }}} */ |
} /* }}} */ |
|
|
Line 285 class phpMyEdit { |
|
Line 292 class phpMyEdit { |
|
} |
} |
|
|
// on copy/change always use simple key retrieving |
// on copy/change always use simple key retrieving |
if ($this->copy_operation() || $this->change_operation()) { |
if ($this->add_operation() |
|
|| $this->copy_operation() |
|
|| $this->change_operation()) { |
$ret = 'Table0.'.$this->fds[$field]; |
$ret = 'Table0.'.$this->fds[$field]; |
} else { |
} else { |
if (isset($this->fdd[$field]['expression'])) { |
if (isset($this->fdd[$field]['expression'])) { |
Line 671 class phpMyEdit { |
|
Line 680 class phpMyEdit { |
|
} |
} |
|
|
function view_operation() { |
function view_operation() { |
return $this->operation == $this->labels['Display'] |
return $this->operation == $this->labels['View'] |
and $this->view_enabled(); |
and $this->view_enabled(); |
} |
} |
|
|
|
|
if (isset ($this->fdd[$k]['values'])) { |
if (isset ($this->fdd[$k]['values'])) { |
echo ' <td>' ."\n"; |
echo ' <td>' ."\n"; |
if (isset($this->fdd[$k]['values']['table'])) { |
if (isset($this->fdd[$k]['values']['table'])) { |
$vals = array(''=>'') + $this->set_values_from_table($k); |
$vals = /* array(''=>'') + */ $this->set_values_from_table($k); |
} else { |
} else { |
$vals = array(''=>'') + $this->fdd[$k]['values']; |
$vals = /* array(''=>'') + */ $this->fdd[$k]['values']; |
} |
} |
echo $this->htmlSelect($this->fds[$k],$vals,''); |
echo $this->htmlSelect($this->fds[$k], $vals, '', $this->col_is_set($k)); |
echo ' </td>'."\n"; |
echo ' </td>'."\n"; |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
} elseif (isset ($this->fdd[$k]['textarea'])) { |
echo ' <td><textarea '; |
echo ' <td><textarea '; |
|
|
} /* }}} */ |
} /* }}} */ |
|
|
/* |
/* |
|
* Display buttons at top and bottom of page - sparky |
|
*/ |
|
function display_list_table_buttons($total_recs) /* {{{ */ |
|
{ |
|
// note that <input disabled isn\'t valid HTML but most browsers support it |
|
// TODO: classify this table and cells |
|
echo '<table border=0 cellpadding=0 cellspacing=0 width="100%" summary=nav_buttons>'; |
|
echo '<tr><td align=left nowrap>' . "\n"; |
|
if ($this->fm > 0) { |
|
echo '<input type="submit" name="prev" value="'.$this->labels['Prev'].'"> '; |
|
} else { |
|
echo '<input disabled type="submit" name="dprev" value="'.$this->labels['Prev'].'"> '; |
|
} |
|
if ($this->add_enabled ()) { |
|
echo '<input type="submit" name="operation" value="'.$this->labels['Add'].'"> '; |
|
} |
|
|
|
if ($this->actionStyle == 'button') { |
|
if ($this->view_enabled()) { |
|
echo '<input'; |
|
if (! $total_recs) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['View'].'"> '; |
|
} |
|
if ($this->change_enabled()) { |
|
echo '<input'; |
|
if (! $total_recs) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['Change'].'"> '; |
|
} |
|
if ($this->copy_enabled()) { |
|
echo '<input'; |
|
if (! $total_recs) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['Copy'].'"> '; |
|
} |
|
if ($this->delete_enabled()) { |
|
echo '<input'; |
|
if (! $total_recs) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['Delete'].'"> '; |
|
} // if else |
|
} |
|
|
|
|
|
if (($this->fm+$this->inc) < $total_recs) { |
|
echo '<input type="submit" name="next" value="'.$this->labels['Next'].'">'; |
|
} else { |
|
echo '<input disabled type="submit" name="dnext" value="'.$this->labels['Next'].'">'; |
|
} |
|
|
|
// Message is now written here |
|
echo '</td><td align=center nowrap><b>'.$this->message.'</b></td>'; |
|
|
|
// display page and records statistics |
|
echo '<td align=right nowrap>'."\n"; |
|
if ($listall) { |
|
echo $this->labels['Page'].': 1 of 1'; |
|
} else { |
|
echo $this->labels['Page'].': '; |
|
echo (($this->fm/$this->inc)+1).' '.$this->labels['of']; |
|
echo ' '.max(1,ceil($total_recs/abs($this->inc))); |
|
} |
|
echo ' '.$this->labels['Records'].': '.$total_recs; |
|
echo '</td></tr></table>'."\n"; |
|
} /* }}} */ |
|
|
|
/* |
|
* Display buttons at top and bottom of page - sparky |
|
*/ |
|
function display_record_buttons() /* {{{ */ |
|
{ |
|
// TODO: classify this table and cells |
|
echo '<table border=0 cellpadding=0 cellspacing=0 width="100%" summary=nav_buttons>'; |
|
echo '<tr><td align=left nowrap>'."\n"; |
|
if ($this->change_operation()) { |
|
echo '<input type="submit" name="savechange" value="'.$this->labels['Save'].'" />'."\n"; |
|
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
|
} elseif ($this->add_operation() or $this->more_operation()) { |
|
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
|
echo '<input type="submit" name="moreadd" value="'.$this->labels['More'].'" />'."\n"; |
|
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
|
} elseif ($this->copy_operation()) { |
|
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
|
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
|
} elseif ($this->delete_operation()) { |
|
echo '<input type="submit" name="savedelete" value="'.$this->labels['Delete'].'" />'."\n"; |
|
echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'" />'."\n"; |
|
} elseif ($this->view_operation()) { |
|
if ($this->change_enabled()) { |
|
echo '<input type="submit" name="operation" value="'.$this->labels['Change'].'" />'."\n"; |
|
} |
|
echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'" />'."\n"; |
|
} |
|
echo '</td></tr></table>'."\n"; |
|
} /* }}} */ |
|
|
|
|
|
/* |
* Table Page Listing |
* Table Page Listing |
*/ |
*/ |
function list_table() /* {{{ */ |
function list_table() /* {{{ */ |
|
|
|
|
// filter switch has been pressed |
// filter switch has been pressed |
if (isset ($this->sw)) { |
if (isset ($this->sw)) { |
//if ($this->sw == 'Search') { |
if ($this->sw == $this->labels['Search']) { |
if ($this->sw == 'S') { |
|
$this->fl = 1; |
$this->fl = 1; |
} |
} |
//if ($this->sw == 'Hide') { |
if ($this->sw == $this->labels['Hide']) { |
if ($this->sw == 'H') { |
|
$this->fl = 0; |
$this->fl = 0; |
} |
} |
} |
} |
|
|
echo ' <input type="hidden" name="sfn" value="'; |
echo ' <input type="hidden" name="sfn" value="'; |
echo ($this->sort_asc?'':'-').$this->sfn.'" />'."\n"; |
echo ($this->sort_asc?'':'-').$this->sfn.'" />'."\n"; |
echo ' <input type="hidden" name="fl" value="'.$this->fl.'" />'."\n"; |
echo ' <input type="hidden" name="fl" value="'.$this->fl.'" />'."\n"; |
|
|
|
//display buttons at top of page - sparky |
|
// setup query to get num_rows |
|
$total_recs = 0; |
|
$count_parts = array( |
|
'type' => 'select', |
|
'select' => 'count(*) as num_rows', |
|
'from' => $this->create_join_clause(), |
|
'where' => $this->make_where_from_query_opts() |
|
); |
|
$res = $this->myquery($this->query_make($count_parts),__LINE__); |
|
$row = mysql_fetch_row($res); |
|
$total_recs = $row[0]; |
|
|
|
$this->display_list_table_buttons($total_recs); |
|
echo '<hr>'."\n"; |
|
|
// if the filter input boxes are not displayed, we need to preserve the filter |
// if the filter input boxes are not displayed, we need to preserve the filter |
if (!$this->fl) { |
if (!$this->fl) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
|
|
if ($this->filter_enabled () or $select_recs) { |
if ($this->filter_enabled () or $select_recs) { |
if ($this->filter_enabled ()) { |
if ($this->filter_enabled ()) { |
if ($this->fl) { |
if ($this->fl) { |
echo ' <th align="center"><input type="submit" name="sw" value="H" /></th>'."\n"; |
echo '<th align="center"><input type="submit" name="sw" value="'.$this->labels['Hide'].'"></th>'."\n"; |
} else { |
} else { |
echo ' <th align="center"><input type="submit" name="sw" value="S" /></th>'."\n"; |
echo '<th align="center"><input type="submit" name="sw" value="'.$this->labels['Search'].'"></th>'."\n"; |
} |
} |
} else { |
} else { |
echo ' <th align="center"> </th>'."\n"; |
echo '<th align="center"> </th>'."\n"; |
} |
} |
} |
} |
|
|
|
|
*/ |
*/ |
|
|
if ($this->fl) { |
if ($this->fl) { |
echo ' <td align="center"><input type="submit" name="filter" value="Go!" /></td>'."\n"; |
echo ' <td align="center"><input type="submit" name="filter" value="' |
|
.$this->labels['Go'].'" /></td>'."\n"; |
for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
$this->field_name = $this->fds[$k]; |
$this->field_name = $this->fds[$k]; |
$fd = $this->field_name; |
$fd = $this->field_name; |
|
|
//echo "<h4>".$this->query_make($qparts)."</h4>\n"; |
//echo "<h4>".$this->query_make($qparts)."</h4>\n"; |
$res = $this->myquery($this->query_make($qparts),__LINE__); |
$res = $this->myquery($this->query_make($qparts),__LINE__); |
$first = true; |
$first = true; |
$eot = $this->inc; |
|
$rowCount = 0; |
$rowCount = 0; |
|
|
if ($this->actionStyle == 'link' || $this->actionStyle == 'graphic') { |
if ($this->actionStyle == 'link' || $this->actionStyle == 'graphic') { |
|
|
// do we need to preserve filter (filter query) and sw (filter display/hide button)? |
// do we need to preserve filter (filter query) and sw (filter display/hide button)? |
|
|
$qpview = $qstrparts; |
$qpview = $qstrparts; |
$qpview[] = 'operation='.$this->labels['Display']; |
$qpview[] = 'operation='.$this->labels['View']; |
$qpviewStr = '?'.join('&',$qpview); |
$qpviewStr = '?'.join('&',$qpview); |
|
|
$qpcopy = $qstrparts; |
$qpcopy = $qstrparts; |
|
|
echo '<a class="pme_a_t" href="'; |
echo '<a class="pme_a_t" href="'; |
echo htmlspecialchars($this->page_name.$qviewStr); |
echo htmlspecialchars($this->page_name.$qviewStr); |
echo '"><img src="'.$this->url['images'].'pme-view.png"'; |
echo '"><img src="'.$this->url['images'].'pme-view.png"'; |
echo ' height=15 width=16 border=none alt="'.htmlspecialchars($this->labels['Display']).'"></a> '; |
echo ' height=15 width=16 border=none alt="'.htmlspecialchars($this->labels['View']).'"></a> '; |
} |
} |
if ($this->change_enabled()) { |
if ($this->change_enabled()) { |
echo '<a class="pme_a_t" href="'; |
echo '<a class="pme_a_t" href="'; |
|
|
} // for |
} // for |
|
|
echo ' </tr>'."\n"; |
echo ' </tr>'."\n"; |
$eot--; |
|
} // while |
} // while |
|
|
|
|
|
|
echo ' </table>'."\n"; // end of table rows listing |
echo ' </table>'."\n"; // end of table rows listing |
|
|
|
|
// note that <input disabled isn\'t valid HTML but most browsers support it |
//display buttons at bottom of page - sparky |
echo " <hr />\n <table summary=\"nav buttons\"><tr>\n"; |
echo '<hr>'."\n"; |
if ($this->fm > 0) { |
$this->display_list_table_buttons($total_recs); |
echo ' <td><input type="submit" name="prev" value="'.$this->labels['Prev'].'" /></td>'."\n"; |
|
} else { |
|
echo ' <td><input disabled type="submit" name="dprev" value="'.$this->labels['Prev'].'" /></td>'."\n"; |
|
} |
|
if ($this->add_enabled ()) { |
|
echo ' <td><input type="submit" name="operation" value="'.$this->labels['Add'].'" /></td>'."\n"; |
|
} |
|
|
|
if ($this->actionStyle == 'button') { |
|
if ($this->view_enabled()) { |
|
echo ' <td><input'; |
|
if ($first) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['Display'].'" /></td>'."\n"; |
|
} |
|
if ($this->change_enabled()) { |
|
echo ' <td><input'; |
|
if ($first) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['Change'].'" /></td>'."\n"; |
|
} |
|
if ($this->copy_enabled()) { |
|
echo ' <td><input'; |
|
if ($first) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['Copy'].'" /></td>'."\n"; |
|
} |
|
if ($this->delete_enabled()) { |
|
echo ' <td><input'; |
|
if ($first) { echo ' disabled'; } |
|
echo ' type="submit" name="operation" value="'.$this->labels['Delete'].'" /></td>'."\n"; |
|
} // if else |
|
} |
|
|
|
|
|
if ($eot == 0) { |
|
echo ' <td><input type="submit" name="next" value="'.$this->labels['Next'].'" /></td>'."\n"; |
|
} else { |
|
echo ' <td><input disabled type="submit" name="dnext" value="'.$this->labels['Next'].'" /></td>'."\n"; |
|
} |
|
/* |
|
Display the current page and the total pages |
|
*/ |
|
echo ' <td> </td>'."\n"; |
|
$total = 0; |
|
$count_parts['type'] = 'select'; |
|
$count_parts['select'] = 'count(*) as nbrecno'; |
|
$count_parts['from'] = $qparts['from']; |
|
$count_parts['where'] = $qparts['where']; |
|
$res = $this->myquery($this->query_make($count_parts),__LINE__); |
|
while ($row = mysql_fetch_row($res)) { |
|
$values[] = $row[0]; |
|
} |
|
$total = $values[0]; |
|
if ($listall) |
|
echo ' <td> '.$this->labels['Page'].': 1 of 1'."\n"; |
|
else |
|
echo ' <td> '.$this->labels['Page'].': '.(($this->fm/$this->inc)+1).' of '.Ceil($total/abs($this->inc)).'</td>'."\n"; |
|
echo ' <td> '.$this->labels['Records'].': '.$total.'</td>'."\n"; |
|
echo ' </tr></table>'."\n"; |
|
echo '</form>'."\n"; |
echo '</form>'."\n"; |
//phpinfo(); |
//phpinfo(); |
/* |
/* |
|
|
*/ |
*/ |
} /* }}} */ |
} /* }}} */ |
|
|
|
|
function display_record() /* {{{ */ |
function display_record() /* {{{ */ |
{ |
{ |
$this->create_javascripts(); |
$this->create_javascripts(); |
|
|
|
//sparky |
|
//display buttons at top of page - sparky |
|
$this->display_record_buttons (); |
|
echo " <hr />\n"; |
|
|
echo '<table width="100%" border="1" cellpadding="1" cellspacing="0" summary="'.$this->tb.'">'."\n"; |
echo '<table width="100%" border="1" cellpadding="1" cellspacing="0" summary="'.$this->tb.'">'."\n"; |
echo ' <input type="hidden" name="rec" value="'.($this->copy_operation()?'':$this->rec).'" />'."\n"; |
echo ' <input type="hidden" name="rec" value="'.($this->copy_operation()?'':$this->rec).'" />'."\n"; |
echo ' <input type="hidden" name="fm" value="'.$this->fm.'" />'."\n"; |
echo ' <input type="hidden" name="fm" value="'.$this->fm.'" />'."\n"; |
|
|
} |
} |
|
|
echo '</table>'."\n"; |
echo '</table>'."\n"; |
echo '<hr />'."\n"; |
|
|
|
if ($this->change_operation()) { |
//display buttons at bottom of page - sparky |
echo '<input type="submit" name="savechange" value="'.$this->labels['Save'].'" />'."\n"; |
echo " <hr />\n"; |
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
$this->display_record_buttons (); |
} elseif ($this->add_operation() or $this->more_operation()) { |
|
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
|
echo '<input type="submit" name="moreadd" value="'.$this->labels['More'].'" />'."\n"; |
|
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
|
} elseif ($this->copy_operation()) { |
|
echo '<input type="submit" name="saveadd" value="'.$this->labels['Save'].'" />'."\n"; |
|
echo '<input type="button" name="cancel" value="'.$this->labels['Cancel'].'" onClick="form.submit();" />'."\n"; |
|
} elseif ($this->delete_operation()) { |
|
echo '<input type="submit" name="savedelete" value="'.$this->labels['Delete'].'" />'."\n"; |
|
echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'" />'."\n"; |
|
} elseif ($this->view_operation()) { |
|
if ($this->change_enabled()) { |
|
echo '<input type="submit" name="operation" value="'.$this->labels['Change'].'" />'."\n"; |
|
} |
|
echo '<input type="submit" name="cancel" value="'.$this->labels['Cancel'].'" />'."\n"; |
|
} |
|
echo '</form>'."\n"; |
echo '</form>'."\n"; |
|
|
} /* }}} */ |
} /* }}} */ |
|
|
/* |
/* |
|
|
if ($res) { |
if ($res) { |
$tim = true; |
$tim = true; |
} |
} |
echo '<h5>'.mysql_affected_rows().' '.$this->labels['record added'].'</h5>'."\n"; |
$this->message = mysql_affected_rows().' '.$this->labels['record added']; |
} |
} |
if ( |
if ( |
$tib && |
$tib && |
Line 2333 echo '</pre>'."\n"; |
|
Line 2384 echo '</pre>'."\n"; |
|
echo '<h5>'.mysql_affected_rows ().' '.$this->labels['Change'].'</h5>'."\n"; |
echo '<h5>'.mysql_affected_rows ().' '.$this->labels['Change'].'</h5>'."\n"; |
*/ |
*/ |
|
|
|
$this->message = mysql_affected_rows().' '.$this->labels['record changed']; |
} |
} |
if ( |
if ( |
$tub && |
$tub && |
Line 2418 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
Line 2470 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
if ($res) { |
if ($res) { |
$tdm = true; |
$tdm = true; |
} |
} |
echo '<h5>'.mysql_affected_rows ().' '.$this->labels['record deleted'].'</h5>'."\n"; |
$this->message = mysql_affected_rows().' '.$this->labels['record deleted']; |
} |
} |
if ( |
if ( |
$tdb && |
$tdb && |
Line 2511 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
Line 2563 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
* a save button during Pass 2 |
* a save button during Pass 2 |
* ====================================================================== |
* ====================================================================== |
*/ |
*/ |
$listit = true; |
|
if ($this->saveadd == $this->labels['Save']) { |
if ($this->saveadd == $this->labels['Save']) { |
$this->do_add_record(); |
$this->do_add_record(); |
$listit = false; |
|
} |
} |
if ($this->moreadd == $this->labels['More']) { |
if ($this->moreadd == $this->labels['More']) { |
$this->do_add_record(); |
$this->do_add_record(); |
|
$this->operation = $this->labels['Add']; // to force add operation |
} |
} |
if ($this->savechange == $this->labels['Save']) { |
if ($this->savechange == $this->labels['Save']) { |
$this->do_change_record(); |
$this->do_change_record(); |
$listit = false; |
|
} |
} |
if ($this->savedelete == $this->labels['Delete']) { |
if ($this->savedelete == $this->labels['Delete']) { |
$this->do_delete_record(); |
$this->do_delete_record(); |
$listit = false; |
|
} |
} |
|
|
/* |
/* |
Line 2534 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
Line 2583 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
* selected an editing button on Pass 1 through this page |
* selected an editing button on Pass 1 through this page |
* ====================================================================== |
* ====================================================================== |
*/ |
*/ |
if ( ($this->add_operation() or $this->more_operation() or |
if ($this->add_operation() || $this->more_operation() |
$this->change_operation() or $this->delete_operation() or |
|| $this->change_operation() || $this->delete_operation() |
$this->view_operation() or $this->copy_operation()) |
|| $this->view_operation() || $this->copy_operation()) { |
and ($listit) ) { |
|
$this->display_record(); |
$this->display_record(); |
} |
} |
|
|