Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 24. október 2026

Rozdiely pre phpMyEdit/phpMyEdit.class.php medzi verziami 1.129 a 1.130

verzia 1.129, 2004/03/31 15:46:26 verzia 1.130, 2004/04/04 21:02:57
Riadok 19 
Riadok 19 
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.128 2004/03/31 15:35:40 nepto Exp $ */  /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.129 2004/03/31 15:46:26 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.
Riadok 694  class phpMyEdit
Riadok 694  class phpMyEdit
   
         function form_begin() /* {{{ */          function form_begin() /* {{{ */
         {          {
                 /*  
                    Need a lot of work in here  
                    using something like:  
                    $fdd['fieldname']['validate']['js_regex']='/something/';  
                    $fdd['fieldname']['validate']['php_regex']='something';  
                  */  
                 $page_name = htmlspecialchars($this->page_name);                  $page_name = htmlspecialchars($this->page_name);
   
                 if ($this->add_operation() || $this->change_operation() || $this->copy_operation()                  if ($this->add_operation() || $this->change_operation() || $this->copy_operation()
                                 || $this->view_operation() || $this->delete_operation()) {                                  || $this->view_operation() || $this->delete_operation()) {
                         $field_to_tab = '';                          $field_to_tab = '';
Riadok 757  function phpMyEdit_show_tab(tab_name)
Riadok 750  function phpMyEdit_show_tab(tab_name)
                 }                  }
   
                 if ($this->add_operation() || $this->change_operation() || $this->copy_operation()) {                  if ($this->add_operation() || $this->change_operation() || $this->copy_operation()) {
                         $required_ar = array();                          $first_required = true;
                         for ($k = 0; $k < $this->num_fds; $k++) {                          for ($k = 0; $k < $this->num_fds; $k++) {
                                 if ($this->displayed[$k] && $this->fdd[$k]['required']                                  if ($this->displayed[$k] && ! $this->readonly($k) && ! $this->hidden($k)
                                                 && ! $this->readonly($k) && ! $this->hidden($k)) {                                                  && ($this->fdd[$k]['required'] || isset($this->fdd[$k]['js']['regexp']))) {
                                         $required_ar[] = $k;                                          if ($first_required) {
                                         if (isset($this->fdd[$k]['regex']['js'])) {                                                  $first_required = false;
                                                 /* TODO: Use a javascript regex to validate it */                                                  echo '<script type="text/javascript"><!--',"\n";
                                         }                                                  echo '
                                 }  
                         }  
   
                         if (count($required_ar) > 0) {  
                                 echo '<script type="text/javascript"><!--',"\n";  
                                 echo '  
 function phpMyEdit_trim(str)  function phpMyEdit_trim(str)
 {  {
         while (str.substring(0, 1) == " "          while (str.substring(0, 1) == " "
Riadok 790  function phpMyEdit_trim(str)
Riadok 777  function phpMyEdit_trim(str)
   
 function phpMyEdit_form_control(theForm)  function phpMyEdit_form_control(theForm)
 {',"\n";  {',"\n";
                                 foreach ($required_ar as $field_num) {                                          }
                                         if ($this->col_has_values($field_num)) {                                          if ($this->col_has_values($k)) {
                                                 $condition = 'theForm.%s.selectedIndex == -1';                                                  $condition = 'theForm.'.$this->fds[$k].'.selectedIndex == -1';
                                                 $multiple  = $this->col_has_multiple_select($field_num);                                                  $multiple  = $this->col_has_multiple_select($k);
                                         } else {                                          } else {
                                                 $condition = 'phpMyEdit_trim(theForm.%s.value) == ""';                                                  $condition = '';
                                                 $multiple  = false;                                                  $multiple  = false;
                                                   if ($this->fdd[$k]['required']) {
                                                           $condition = 'phpMyEdit_trim(theForm.'.$this->fds[$k].'.value) == ""';
                                                   }
                                                   if (isset($this->fdd[$k]['js']['regexp'])) {
                                                           $condition .= (strlen($condition) > 0 ? ' || ' : '');
                                                           $condition .= sprintf('!(%s.test(phpMyEdit_trim(theForm.%s.value)))',
                                                                           $this->fdd[$k]['js']['regexp'], $this->fds[$k]);
                                                   }
                                         }                                          }
   
                                         /* Multiple selects have their name like ``name[]''.                                          /* Multiple selects have their name like ``name[]''.
Riadok 809  function phpMyEdit_form_control(theForm)
Riadok 804  function phpMyEdit_form_control(theForm)
                                                 echo '                                                  echo '
         multiple_select = null;          multiple_select = null;
         for (i = 0; i < theForm.length; i++) {          for (i = 0; i < theForm.length; i++) {
                 if (theForm.elements[i].name == "',$this->fds[$field_num],'[]") {                  if (theForm.elements[i].name == "',$this->fds[$k],'[]") {
                         multiple_select = theForm.elements[i];                          multiple_select = theForm.elements[i];
                         break;                          break;
                 }                  }
         }          }
         if (multiple_select != null && multiple_select.selectedIndex == -1) {          if (multiple_select != null && multiple_select.selectedIndex == -1) {';
                 alert("',$this->labels['Please enter'],' ',$this->fdd[$field_num]['name'],'.");';  
                                                 if ($this->tabs_enabled()) {  
                                                         echo '  
                 phpMyEdit_show_tab("phpMyEdit_tab"+phpMyEdit_field_to_tab['.$field_num.']);';  
                                                 }  
                                                 echo '  
                 return false;  
         }',"\n";  
                                         } else {                                          } else {
                                                 echo '                                                  echo '
         if (',sprintf($condition, $this->fds[$field_num]),') {          if (',$condition,') {';
                 alert("',$this->labels['Please enter'],' ',$this->fdd[$field_num]['name'],'.");';                                          }
                                                 if ($this->tabs_enabled()) {                                          echo '
                                                         echo '                  alert("',$this->labels['Please enter'],' ',$this->fdd[$k]['name'],'.';
                 phpMyEdit_show_tab("phpMyEdit_tab"+phpMyEdit_field_to_tab['.$field_num.']);';                                          echo isset($this->fdd[$k]['js']['hint']) ? '\n'.$this->fdd[$k]['js']['hint'] : '';
                                                 }                                          echo '");';
                                           if ($this->tabs_enabled()) {
                                                 echo '                                                  echo '
                 theForm.',$this->fds[$field_num],'.focus();                  phpMyEdit_show_tab("phpMyEdit_tab"+phpMyEdit_field_to_tab['.$k.']);';
                                           }
                                           echo '
                   theForm.',$this->fds[$k],'.focus();
                 return false;                  return false;
         }',"\n";          }',"\n";
                                         }  
                                 }                                  }
                           }
                           if (! $first_required) {
                                 echo '                                  echo '
         return true;          return true;
 }',"\n\n";  }',"\n\n";

Legend:
Odstranené z verzie1.129  
zmenené riadky
  Pridané vo verzii1.130

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok