--- phpMyEdit.class.-output-7-v115.php	Tue Feb 24 13:28:28 2004
+++ phpMyEdit.class.-output-8-v115.php	Wed Feb 25 19:35:39 2004
@@ -1459,9 +1462,10 @@
 	 * @param	js_validation	if add JavaScript validation subroutine to button
 	 * @param	disabled		if mark the button as disabled
 	 */
-	function htmlSubmit($name, $label, $css_class_name, $js_validation = true, $disabled = false) /* {{{ */
+	function htmlSubmit($name, $label, $css_class_name, $js_validation = true, $disabled = false, $order_disabled = 1) /* {{{ */
 	{
 		// Note that <input disabled> isn't valid HTML, but most browsers support it
+		if($disabled && $this->display['disabled'] < $order_disabled) return;
 		$markdisabled = $disabled ? ' disabled' : '';
 		$ret = '<input'.$markdisabled.' type="submit" class="'.$css_class_name
 			.'" name="'.ltrim($markdisabled).$name
@@ -1758,6 +1762,7 @@
 	 */
 	function display_list_table_buttons($total_recs, $position) /* {{{ */
 	{
+		echo $this->display_buttons($position); return;
 		echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
 		echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
 		echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
@@ -1819,6 +1824,7 @@
 	 */
 	function display_record_buttons($position) /* {{{ */
 	{
+		echo $this->display_buttons($position); return;
 		echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
 		echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
 		echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
@@ -1849,7 +1855,76 @@
 		}
 		echo '</tr></table>',"\n";
 	} /* }}} */
-
+	function display_button($name, $up) /* {{{ */
+	{
+		if($name == 'cancel') {
+			return $this->htmlSubmit($name.$this->page_types[$this->page_type], ucfirst($name), $this->getCSSclass($name, $up), false,0)."\n";
+			}
+		$total_recs = $this->total_recs;
+		if(in_array($name, array('add','view','change','copy','delete'))) {
+			$enabled = $name.'_enabled';
+			$dis = !($this->$enabled()); if($name != 'add' && !$total_recs) $dis = true;
+			return $this->htmlSubmit('operation', ucfirst($name), $this->getCSSclass($name, $up), false, $dis,2)."\n"; // total_recs
+			}
+		if(in_array($name, array('save','more'))) {
+			if($this->page_type == 'D' && $name == 'save' ) $value = 'Delete';
+			elseif($this->page_type == 'C' && $name == 'more' ) $value = 'Apply';
+			else $value = ucfirst($name);
+			return $this->htmlSubmit($name.$this->page_types[$this->page_type], $value, $this->getCSSclass($name, $up), true, false, 0)."\n";
+			}
+		$listall      = $this->inc <= 0; // Are we doing a listall?
+		$disabledprev = !($this->fm > 0 && !$listall);
+		$disabledfirst = $disabledprev;
+		$disablednext = !($this->fm + $this->inc < $total_recs && ! $listall);
+		$disabledlast = $disablednext;
+		$disabledgoto = !($listall || ($disablednext && $disabledprev)) ? '' : ' disabled';
+		//$current_page = intval($this->fm / $this->inc) + 1;
+		$total_pages  = max(1, ceil($total_recs / abs($this->inc)));
+		if(in_array($name, array('first','prev','next','last'))) {
+			$dis = 'disabled'.$name;
+			return $this->htmlSubmit('navop', ucfirst($name), $this->getCSSclass($name, $up), false, $$dis, 1)."\n";
+			}
+		if($name == 'drop_down') {
+			if($disablegoto == 'disabled' && $this->display['disabled'] ==0 ) return;
+			$ret = '<select'.$disabledgoto.' class="'.$this->getCSSclass('goto', $up);
+			$ret .= '" name="'.ltrim($disabledgoto).'navfm'.$up.'" onChange="return this.form.submit();">'."\n";
+			for ($i = 0; $i < $total_pages; $i++) {
+				$ret .= '<option';
+				$ret .= ($this->fm == $this->inc * $i) ? ' selected' : '';
+				$ret .= ' value="'.$this->inc * $i.'">'.($i + 1).'</option>'."\n";
+				}
+			$ret .= '</select>';
+			return $ret;
+			}
+		if($name == 'goto') {
+			return $this->htmlSubmit('navop', 'Go to', $this->getCSSclass('goto', $up), false,
+				($listall || ($disablednext && $disabledprev)), 1)."\n";
+				}
+		return $name."\n";;
+	} /* }}} */
+	function display_buttons($up) /* {{{ */
+	{
+		$page = $this->page_types[$this->page_type];
+		if(is_array($this->display['buttons'][$page][$up]))
+			$buttons = $this->display['buttons'][$page][$up];
+		else { $nav = 'nav_'.$up;
+			if($this->$nav()) {
+				$def_buttons = array (
+					'L' => array ('first','prev','add','view','change','copy','delete','next','last','goto','drop_down'),
+					'F' => array ('first','prev','add','view','change','copy','delete','next','last','goto','drop_down'),
+					'A' => array ('save','more','cancel'),
+					'C' => array ('save','more','cancel'),
+					'P' => array ('save', 'cancel'),
+					'D' => array ('save','cancel'),
+					'V' => array ('change','cancel')
+					);
+				$buttons = $def_buttons[$this->page_type];
+				}
+				else return NULL; // nothing should be displayed in this part
+			}
+		foreach($buttons as $name) $ret .= $this->display_button($name, $up);
+		return $ret;
+	} /* }}} */
 	/*
 	 * Table Page Listing
 	 */
@@ -1920,6 +1995,7 @@
 		$res = $this->myquery($this->query_make($count_parts), __LINE__);
 		$row = @mysql_fetch_array($res, MYSQL_NUM);
 		$total_recs = $row[0];
+		$this->total_recs = $total_recs;
 		if ($this->last_operation()) {
 			$this->fm = (int)(($total_recs-1)/$this->inc)*$this->inc;
 		}
@@ -2406,7 +2482,7 @@
 			return;
 		}
 		$this->form_begin();
-		echo $this->input_hidden_vars();
+		echo $this->input_hidden_vars($this->rec);
 		if ($this->nav_up()) {
 			$this->display_record_buttons('up');
 			echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n";
@@ -3052,6 +3130,13 @@
 		if (! $this->nav_up() && ! $this->nav_down()) {
 			$this->navigation .= 'D'; // down position is default
 		}
+
+		//[display][buttons][ope][up/down]
+		// operation: list/filter/add/view/change/delete/copy
+		// up or down
+		$this->display['buttons'] = $opts['display']['buttons'];
+		$this->display['disabled'] = isset($opts['display']['disabled'])
+			? $opts['display']['disabled'] : 1; // 0 -don't show disabled, 1-current (show dis prev/next),2-show all disabled(change)
 		// Language labels (must go after navigation)
 		$this->labels = $this->make_language_labels(isset($opts['language'])
 				? $opts['language'] : $this->get_server_var('HTTP_ACCEPT_LANGUAGE'));
