Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, April 19, 2024

Diff for phpMyEdit/phpMyEdit.class.php between version 1.113 and 1.114

version 1.113, 2004/01/12 05:42:38 version 1.114, 2004/01/12 05:52:55
Line 19 
Line 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.112 2004/01/03 02:51:07 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.113 2004/01/12 05:42:38 nepto Exp $ */
   
 /*  This is a generic table editing program. The table and fields to be  /*  This is a generic table editing program. The table and fields to be
         edited are defined in the calling program.          edited are defined in the calling program.
Line 118  class phpMyEdit
Line 118  class phpMyEdit
         var $sfn;               // sort field number (- = descending sort order)          var $sfn;               // sort field number (- = descending sort order)
   
         // Operation          // Operation
         var $prev;              // "Prev" navigation button          var $navop;             // navigation buttons/operations
         var $next;              // "Next" navigation button  
         var $sw;                // filter display/hide/clear button          var $sw;                // filter display/hide/clear button
         var $operation; // operation to do: Add, Change, Delete          var $operation; // operation to do: Add, Change, Delete
         var $saveadd;          var $saveadd;
Line 208  class phpMyEdit
Line 207  class phpMyEdit
         function delete_operation() { return $this->operation == $this->labels['Delete'] && $this->delete_enabled(); }          function delete_operation() { return $this->operation == $this->labels['Delete'] && $this->delete_enabled(); }
         function view_operation()   { return $this->operation == $this->labels['View']   && $this->view_enabled();   }          function view_operation()   { return $this->operation == $this->labels['View']   && $this->view_enabled();   }
         function filter_operation() { return $this->fl && $this->filter_enabled(); }          function filter_operation() { return $this->fl && $this->filter_enabled(); }
         function next_operation()       { return $this->next == $this->labels['Next']; }          function next_operation()       { return $this->navop == $this->labels['Next']; }
         function prev_operation()       { return $this->prev == $this->labels['Prev']; }          function prev_operation()       { return $this->navop == $this->labels['Prev']; }
           function first_operation()      { return $this->navop == $this->labels['First']; }
           function last_operation()       { return $this->navop == $this->labels['Last']; }
           function goto_operation()       { return $this->navop == $this->labels['Go to']; }
         function clear_operation()      { return $this->sw == $this->labels['Clear'];  }          function clear_operation()      { return $this->sw == $this->labels['Clear'];  }
   
         function add_canceled()    { return $this->canceladd    == $this->labels['Cancel']; }          function add_canceled()    { return $this->canceladd    == $this->labels['Cancel']; }
Line 1294  function phpMyEdit_filter_handler(theFor
Line 1296  function phpMyEdit_filter_handler(theFor
          * @param       label                   key in the language hash used as label           * @param       label                   key in the language hash used as label
          * @param       css_class_name  CSS class name           * @param       css_class_name  CSS class name
          * @param       js_validation   if add JavaScript validation subroutine to button           * @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) /* {{{ */          function htmlSubmit($name, $label, $css_class_name, $js_validation = true, $disabled = false) /* {{{ */
         {          {
                 $ret = '<input type="submit" class="'.$css_class_name                  // Note that <input disabled> isn't valid HTML, but most browsers support it
                         .'" name="'.$name.'" value="'.$this->labels[$label];                  $markdisabled = $disabled ? ' disabled' : '';
                   $ret = '<input'.$markdisabled.' type="submit" class="'.$css_class_name
                           .'" name="'.ltrim($markdisabled).$name
                           .'" value="'.(isset($this->labels[$label]) ? $this->labels[$label] : $label);
                 if ($js_validation) {                  if ($js_validation) {
                         $ret .= '" onClick="return phpMyEdit_form_control(this.form);';                          $ret .= '" onClick="return phpMyEdit_form_control(this.form);';
                 }                  }
Line 1572  function phpMyEdit_filter_handler(theFor
Line 1578  function phpMyEdit_filter_handler(theFor
                 echo 'qfn=',$this->qfn,'   ';                  echo 'qfn=',$this->qfn,'   ';
                 echo 'sw=',$this->sw,'   ';                  echo 'sw=',$this->sw,'   ';
                 echo 'rec=',$this->rec,'   ';                  echo 'rec=',$this->rec,'   ';
                 echo 'prev=',$this->prev,'   ';                  echo 'navop=',$this->navop,'   ';
                 echo 'next=',$this->next,'   ';  
                 echo 'saveadd=',$this->saveadd,'   ';                  echo 'saveadd=',$this->saveadd,'   ';
                 echo 'moreadd=',$this->moreadd,'   ';                  echo 'moreadd=',$this->moreadd,'   ';
                 echo 'canceladd=',$this->canceladd,'   ';                  echo 'canceladd=',$this->canceladd,'   ';
Line 1592  function phpMyEdit_filter_handler(theFor
Line 1597  function phpMyEdit_filter_handler(theFor
          */           */
         function display_list_table_buttons($total_recs, $position) /* {{{ */          function display_list_table_buttons($total_recs, $position) /* {{{ */
         {          {
                 $listall = $this->inc <= 0; // Are we doing a listall?  
                 echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";                  echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
                 echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";                  echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
                 echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";                  echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
                 // Note that <input disabled isn't valid HTML, but most browsers support it                  $listall      = $this->inc <= 0; // Are we doing a listall?
                 $disabled = ($this->fm > 0 && ! $listall) ? '' : ' disabled';                  $disabledprev = !($this->fm > 0 && !$listall);
                 echo '<input',$disabled,' class="',$this->getCSSclass('prev', $position);                  $disablednext = !($this->fm + $this->inc < $total_recs && ! $listall);
                 echo '" type="submit" name="',ltrim($disabled),'prev" value="',$this->labels['Prev'],'">&nbsp;';                  $disabledgoto = !($listall || ($disablednext && $disabledprev)) ? '' : ' disabled';
                   $current_page = intval($this->fm / $this->inc) + 1;
                   $total_pages  = max(1, ceil($total_recs / abs($this->inc)));
                   echo $this->htmlSubmit('navop', 'First', $this->getCSSclass('first', $position), false, $disabledprev), '&nbsp;';
                   echo $this->htmlSubmit('navop', 'Prev', $this->getCSSclass('prev', $position), false, $disabledprev), '&nbsp;';
                 if ($this->add_enabled()) {                  if ($this->add_enabled()) {
                         echo '<input class="',$this->getCSSclass('prev', $position);                          echo $this->htmlSubmit('operation', 'Add', $this->getCSSclass('add', $position), false, false), '&nbsp;';
                         echo '" type="submit" name="operation" value="',$this->labels['Add'],'">&nbsp;';  
                 }                  }
                 if ($this->nav_buttons()) {                  if ($this->nav_buttons()) {
                         if ($this->view_enabled()) {                          if ($this->view_enabled()) {
                                 echo '<input class="',$this->getCSSclass('view', $position),'"';                                  echo $this->htmlSubmit('operation', 'View', $this->getCSSclass('view', $position), false, !$total_recs), '&nbsp;';
                                 if (! $total_recs) { echo ' disabled'; }  
                                 echo ' type="submit" name="operation" value="',$this->labels['View'],'">&nbsp;';  
                         }                          }
                         if ($this->change_enabled()) {                          if ($this->change_enabled()) {
                                 echo '<input class="',$this->getCSSclass('change', $position),'"';                                  echo $this->htmlSubmit('operation', 'Change', $this->getCSSclass('change', $position), false, !$total_recs), '&nbsp;';
                                 if (! $total_recs) { echo ' disabled'; }  
                                 echo ' type="submit" name="operation" value="',$this->labels['Change'],'">&nbsp;';  
                         }                          }
                         if ($this->copy_enabled()) {                          if ($this->copy_enabled()) {
                                 echo '<input class="',$this->getCSSclass('copy', $position),'"';                                  echo $this->htmlSubmit('operation', 'Copy', $this->getCSSclass('copy', $position), false, !$total_recs), '&nbsp;';
                                 if (! $total_recs) { echo ' disabled'; }  
                                 echo ' type="submit" name="operation" value="',$this->labels['Copy'],'">&nbsp;';  
                         }                          }
                         if ($this->delete_enabled()) {                          if ($this->delete_enabled()) {
                                 echo '<input class="',$this->getCSSclass('delete', $position),'"';                                  echo $this->htmlSubmit('operation', 'Delete', $this->getCSSclass('delete', $position), false, !$total_recs), '&nbsp;';
                                 if (! $total_recs) { echo ' disabled'; }  
                                 echo ' type="submit" name="operation" value="',$this->labels['Delete'],'">&nbsp;';  
                         }                          }
                 }                  }
                 $disabled = ($this->fm + $this->inc < $total_recs && ! $listall) ? '' : ' disabled';                  echo $this->htmlSubmit('navop', 'Next', $this->getCSSclass('next', $position), false, $disablednext), '&nbsp;';
                 echo '<input',$disabled,' class="',$this->getCSSclass('next', $position);                  echo $this->htmlSubmit('navop', 'Last', $this->getCSSclass('last', $position), false, $disablednext), '&nbsp;';
                 echo '" type="submit" name="',ltrim($disabled),'next" value="',$this->labels['Next'],'">';                  echo $this->htmlSubmit('navop', 'Go to', $this->getCSSclass('goto', $position), false,
                 // Message is now written here                                  ($listall || ($disablednext && $disabledprev)));
                   echo '<select',$disabledgoto,' class="',$this->getCSSclass('goto', $position);
                   echo '" name="',ltrim($disabledgoto),'navfm',$position,'" onChange="return this.form.submit();">',"\n";
                   for ($i = 0; $i < $total_pages; $i++) {
                           echo '<option',($this->fm == $this->inc * $i) ? ' selected' : '';
                           echo ' value="',$this->inc * $i,'">',$i + 1,'</option>',"\n";
                   }
                   echo '</select>';
                 echo '</td>',"\n";                  echo '</td>',"\n";
                   // Message is now written here
                 if (strlen(@$this->message) > 0) {                  if (strlen(@$this->message) > 0) {
                         echo '<td class="',$this->getCSSclass('message', $position),'">',$this->message,'</td>',"\n";                          echo '<td class="',$this->getCSSclass('message', $position),'">',$this->message,'</td>',"\n";
                 }                  }
Line 1639  function phpMyEdit_filter_handler(theFor
Line 1646  function phpMyEdit_filter_handler(theFor
                 if ($listall) {                  if ($listall) {
                         echo $this->labels['Page'],':&nbsp;1&nbsp;',$this->labels['of'],'&nbsp;1';                          echo $this->labels['Page'],':&nbsp;1&nbsp;',$this->labels['of'],'&nbsp;1';
                 } else {                  } else {
                         echo $this->labels['Page'],':&nbsp;',($this->fm / $this->inc) + 1;                          echo $this->labels['Page'],':&nbsp;',$current_page;
                         echo '&nbsp;',$this->labels['of'],'&nbsp;',max(1, ceil($total_recs / abs($this->inc)));                          echo '&nbsp;',$this->labels['of'],'&nbsp;',$total_pages;
                 }                  }
                 echo '&nbsp; ',$this->labels['Records'],':&nbsp;',$total_recs;                  echo '&nbsp; ',$this->labels['Records'],':&nbsp;',$total_recs;
                 echo '</td></tr></table>',"\n";                  echo '</td></tr></table>',"\n";
Line 1709  function phpMyEdit_filter_handler(theFor
Line 1716  function phpMyEdit_filter_handler(theFor
                                 $this->fm = 0;                                  $this->fm = 0;
                         }                          }
                 }                  }
                   if ($this->first_operation()) {
                           $this->fm = 0;
                   } // last operation must be performed below, after retrieving total_recs
                 if ($this->next_operation()) {                  if ($this->next_operation()) {
                         $this->fm += $this->inc;                          $this->fm += $this->inc;
                 }                  }
                   if ($this->goto_operation()) {
                           $this->fm = $this->navfm;
                   }
                 // If sort sequence has changed, restart listing                  // If sort sequence has changed, restart listing
                 $this->qfn != $this->prev_qfn && $this->fm = 0;                  $this->qfn != $this->prev_qfn && $this->fm = 0;
                 if (0) { // DEBUG                  if (0) { // DEBUG
Line 1746  function phpMyEdit_filter_handler(theFor
Line 1759  function phpMyEdit_filter_handler(theFor
                 $res = $this->myquery($this->query_make($count_parts), __LINE__);                  $res = $this->myquery($this->query_make($count_parts), __LINE__);
                 $row = @mysql_fetch_array($res, MYSQL_NUM);                  $row = @mysql_fetch_array($res, MYSQL_NUM);
                 $total_recs = $row[0];                  $total_recs = $row[0];
                   if ($this->last_operation()) {
                           $this->fm = (int)(($total_recs-1)/$this->inc)*$this->inc;
                   }
                 if ($this->nav_up()) {                  if ($this->nav_up()) {
                         $this->display_list_table_buttons($total_recs, 'up');                          $this->display_list_table_buttons($total_recs, 'up');
                         echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n";                          echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n";
Line 2908  function phpMyEdit_filter_handler(theFor
Line 2924  function phpMyEdit_filter_handler(theFor
                 $this->qfn  = $this->get_cgi_var('qfn');                  $this->qfn  = $this->get_cgi_var('qfn');
                 $this->sw   = $this->get_cgi_var('sw');                  $this->sw   = $this->get_cgi_var('sw');
                 $this->rec  = $this->get_cgi_var('rec', '');                  $this->rec  = $this->get_cgi_var('rec', '');
                 $this->prev = $this->get_cgi_var('prev');                  $this->navop = $this->get_cgi_var('navop');
                 $this->next = $this->get_cgi_var('next');                  if (($this->navfm = $this->get_cgi_var('navfmup', $this->fm)) != $this->fm) {
                           $this->navop = $this->labels['Go to'];
                   } else if (($this->navfm = $this->get_cgi_var('navfmdown', $this->navfm)) != $this->fm) {
                           $this->navop = $this->labels['Go to'];
                   }
                 $this->operation    = $this->get_cgi_var('operation');                  $this->operation    = $this->get_cgi_var('operation');
                 $this->saveadd      = $this->get_cgi_var('saveadd');                  $this->saveadd      = $this->get_cgi_var('saveadd');
                 $this->moreadd      = $this->get_cgi_var('moreadd');                  $this->moreadd      = $this->get_cgi_var('moreadd');

Legend:
Removed from v.1.113  
changed lines
  Added in v.1.114

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top