Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026

Diff for phpMyEdit/extensions/Attic/phpMyEdit-htmlarea.class.php between version 1.4 and 1.5

version 1.4, 2003/11/20 11:52:30 version 1.5, 2003/11/20 11:53:05
Line 1 
Line 1 
 <?php  <?php
   
 /*  /*
  * phpMyEdit - instant MySQL table editor and code generator   * phpMyEdit - instant MySQL table editor and code generator
  *   *
  * extensions/phpMyEdit-htmlarea.class.php - phpMyEdit htmlArea extension   * extensions/phpMyEdit-htmlarea.class.php - phpMyEdit htmlArea extension
  * ____________________________________________________________   * ____________________________________________________________
  *   *
  * Contribution of Ezudin Kurtowich <ekurtovic@ieee.org>, Sarajevo   * Contribution of Ezudin Kurtowich <ekurtovic@ieee.org>, Sarajevo
  * Copyright (c) 2003 Platon SDG, http://platon.sk/   * Copyright (c) 2003 Platon SDG, http://platon.sk/
  * All rights reserved.   * All rights reserved.
  *   *
  * See README file for more information about this software.   * See README file for more information about this software.
  * See COPYING file for license information.   * See COPYING file for license information.
  *   *
  * Download the latest version from   * Download the latest version from
  * http://platon.sk/projects/phpMyEdit/   * http://platon.sk/projects/phpMyEdit/
  */   */
   
 /* $Platon: phpMyEdit/extensions/phpMyEdit-htmlarea.class.php,v 1.3 2003/06/02 17:29:02 nepto Exp $ */  /* $Platon: phpMyEdit/extensions/phpMyEdit-htmlarea.class.php,v 1.4 2003/11/20 11:52:30 nepto Exp $ */
   
 /*  /*
         OVERVIEW          OVERVIEW
         --------          --------
   
         htmlArea is a free WYSIWYG textarea replacement from          htmlArea is a free WYSIWYG textarea replacement from
         http://www.interactivetools.com/ website.          http://www.interactivetools.com/ website.
   
         REQUIREMENTS          REQUIREMENTS
         ------------          ------------
     
         The extension requires a properly installed htmlArea script          The extension requires a properly installed htmlArea script
         as described on the http://www.interactivetools.com/ site.          as described on the http://www.interactivetools.com/ site.
   
         USAGE          USAGE
         -----          -----
   
         This extension enables WYSIWYG editing of a textarea field.          This extension enables WYSIWYG editing of a textarea field.
         In order to use it, you should:          In order to use it, you should:
       
     1. Load htmlArea script in the <head>...</head> section of your      1. Load htmlArea script in the <head>...</head> section of your
        phpMyEdit calling program as described in the htmlarea manual.         phpMyEdit calling program as described in the htmlarea manual.
       
            NOTE: To avoid an unwanted side effect in css style produced             NOTE: To avoid an unwanted side effect in css style produced
            by phpMyEditSetup.php, delete 'table-width:100%' property.             by phpMyEditSetup.php, delete 'table-width:100%' property.
   
     2. Call to phpMyEdit-htmlarea.class.php instead      2. Call to phpMyEdit-htmlarea.class.php instead
            of phpMyEdit.class.php.             of phpMyEdit.class.php.
   
        Example:         Example:
   
                 require_once 'extensions/phpMyEdit-htmlarea.class.php';                  require_once 'extensions/phpMyEdit-htmlarea.class.php';
                 new phpMyEdit-htmlarea($opts);                  new phpMyEdit-htmlarea($opts);
   
     3. Add 'html'=>true parameter to the textarea field definition      3. Add 'html'=>true parameter to the textarea field definition
        in your phpMyEdit calling program.         in your phpMyEdit calling program.
   
        Example:         Example:
       
                 $opts['fdd']['body'] = array(                  $opts['fdd']['body'] = array(
                   'name'     => 'Content',                    'name'     => 'Content',
                   'select'   => 'T',                    'select'   => 'T',
                   'options'  => 'ACPVD',                    'options'  => 'ACPVD',
                   'maxlen'   => 65535,                    'maxlen'   => 65535,
                   'required' => true,                    'required' => true,
                   'textarea' => array(                    'textarea' => array(
                         'html' => true,                          'html' => true,
                         'rows' => 11,                          'rows' => 11,
                         'cols' => 81)                          'cols' => 81)
                 );                  );
 */  */
   
 require_once dirname(__FILE__).'/../phpMyEdit.class.php';  require_once dirname(__FILE__).'/../phpMyEdit.class.php';
   
 class phpMyEdit_htmlearea extends phpMyEdit  class phpMyEdit_htmlearea extends phpMyEdit
 {  {
   
         /*          /*
          * Display functions overriding           * Display functions overriding
          */           */
   
         function display_add_record() /* {{{ */          function display_add_record() /* {{{ */
         {          {
                 for ($k = 0; $k < $this->num_fds; $k++) {                  for ($k = 0; $k < $this->num_fds; $k++) {
                         if ($this->hidden($k)) {                          if ($this->hidden($k)) {
                                 echo $this->htmlHidden($this->fds[$k], $row["qf$k"]);                                  echo $this->htmlHidden($this->fds[$k], $row["qf$k"]);
                                 continue;                                  continue;
                         }                          }
                         if (! $this->displayed[$k]) {                          if (! $this->displayed[$k]) {
                                 continue;                                  continue;
                         }                          }
                         $css_postfix    = @$this->fdd[$k]['css']['postfix'];                          $css_postfix    = @$this->fdd[$k]['css']['postfix'];
                         $css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix);                          $css_class_name = $this->getCSSclass('input', null, 'next', $css_postfix);
                         echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n";                          echo '<tr class="',$this->getCSSclass('row', null, true, $css_postfix),'">',"\n";
                         echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">',$this->fdd[$k]['name'],'</td>',"\n";                          echo '<td class="',$this->getCSSclass('key', null, true, $css_postfix),'">',$this->fdd[$k]['name'],'</td>',"\n";
                         echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">'."\n";                          echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">'."\n";
                         if ($this->col_has_values($k)) {                          if ($this->col_has_values($k)) {
                                 $vals     = $this->set_values($k);                                  $vals     = $this->set_values($k);
                                 $selected = @$this->fdd[$k]['default'];                                  $selected = @$this->fdd[$k]['default'];
                                 $multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];                                  $multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];
                                 $readonly = $this->readonly($k);                                  $readonly = $this->readonly($k);
                                 echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $selected, $multiple,$readonly);                                  echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $selected, $multiple,$readonly);
                         } elseif (isset ($this->fdd[$k]['textarea'])) {                          } elseif (isset ($this->fdd[$k]['textarea'])) {
                                 echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"';                                  echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"';
                                 echo ($this->readonly($k) ? ' disabled' : '');                                  echo ($this->readonly($k) ? ' disabled' : '');
                                 if (intval($this->fdd[$k]['textarea']['rows']) > 0) {                                  if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
                                         echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';                                          echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
                                 }                                  }
                                 if (intval($this->fdd[$k]['textarea']['cols']) > 0) {                                  if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
                                         echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';                                          echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
                                 }                                  }
                                 if (isset($this->fdd[$k]['textarea']['wrap'])) {                                  if (isset($this->fdd[$k]['textarea']['wrap'])) {
                                         echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';                                          echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
                                 } else {                                  } else {
                                         echo ' wrap="virtual"';                                          echo ' wrap="virtual"';
                                 }                                  }
                                 echo '>',htmlspecialchars($this->fdd[$k]['default']),'</textarea>',"\n";                                  echo '>',htmlspecialchars($this->fdd[$k]['default']),'</textarea>',"\n";
   
                 //EK code modification is here                  //EK code modification is here
                 if (isset($this->fdd[$k]['textarea']['html'])) {                  if (isset($this->fdd[$k]['textarea']['html'])) {
                     echo '<script language="javascript1.2">editor_generate("';                      echo '<script language="javascript1.2">editor_generate("';
                     echo $this->fds[$k];                      echo $this->fds[$k];
                     echo '");</script>';                      echo '");</script>';
                                 }                                  }
   
   
                         } else {                          } else {
                                 // Simple edit box required                                  // Simple edit box required
                                 $size_ml_props = '';                                  $size_ml_props = '';
                                 $maxlen = intval($this->fdd[$k]['maxlen']);                                  $maxlen = intval($this->fdd[$k]['maxlen']);
                                 //$maxlen > 0 || $maxlen = 300;                                  //$maxlen > 0 || $maxlen = 300;
                                 $size   = min($maxlen, 60);                                  $size   = min($maxlen, 60);
                                 $size   && $size_ml_props .= ' size="'.$size.'"';                                  $size   && $size_ml_props .= ' size="'.$size.'"';
                                 $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';                                  $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
                                 echo '<input class="',$css_class_name,'" type="text" ';                                  echo '<input class="',$css_class_name,'" type="text" ';
                                 echo ($this->readonly($k) ? 'disabled ' : ''),' name="',$this->fds[$k],'"';                                  echo ($this->readonly($k) ? 'disabled ' : ''),' name="',$this->fds[$k],'"';
                                 echo $size_ml_props,' value="';                                  echo $size_ml_props,' value="';
                                 echo htmlspecialchars($this->fdd[$k]['default']),'">';                                  echo htmlspecialchars($this->fdd[$k]['default']),'">';
                         }                          }
                         echo '</td>',"\n";                          echo '</td>',"\n";
                         if ($this->guidance) {                          if ($this->guidance) {
                                 $css_class_name = $this->getCSSclass('help', null, true, $css_postfix);                                  $css_class_name = $this->getCSSclass('help', null, true, $css_postfix);
                                 $cell_value     = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';                                  $cell_value     = $this->fdd[$k]['help'] ? $this->fdd[$k]['help'] : '&nbsp;';
                                 echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";                                  echo '<td class="',$css_class_name,'">',$cell_value,'</td>',"\n";
                         }                          }
                         echo '</tr>',"\n";                          echo '</tr>',"\n";
                 }                  }
         } /* }}} */          } /* }}} */
   
         function display_change_field($row, $k) /* {{{ */          function display_change_field($row, $k) /* {{{ */
         {          {
                 $css_postfix    = @$this->fdd[$k]['css']['postfix'];                  $css_postfix    = @$this->fdd[$k]['css']['postfix'];
                 $css_class_name = $this->getCSSclass('input', null, true, $css_postfix);                  $css_class_name = $this->getCSSclass('input', null, true, $css_postfix);
                 echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">',"\n";                  echo '<td class="',$this->getCSSclass('value', null, true, $css_postfix),'">',"\n";
                 if ($this->col_has_values($k)) {                  if ($this->col_has_values($k)) {
                         $vals     = $this->set_values($k);                          $vals     = $this->set_values($k);
                         $multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];                          $multiple = $this->fdd[$k]['select'] == 'M' && ! $this->fdd[$k]['values']['table'];
                         $readonly = $this->readonly($k);                          $readonly = $this->readonly($k);
                         echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $row["qf$k"], $multiple, $readonly);                          echo $this->htmlSelect($this->fds[$k], $css_class_name, $vals, $row["qf$k"], $multiple, $readonly);
                 } elseif (isset($this->fdd[$k]['textarea'])) {                  } elseif (isset($this->fdd[$k]['textarea'])) {
                         echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"';                          echo '<textarea class="',$css_class_name,'" name="'.$this->fds[$k].'"';
                         echo ($this->readonly($k) ? ' disabled' : '');                          echo ($this->readonly($k) ? ' disabled' : '');
                         if (intval($this->fdd[$k]['textarea']['rows']) > 0) {                          if (intval($this->fdd[$k]['textarea']['rows']) > 0) {
                                 echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';                                  echo ' rows="',$this->fdd[$k]['textarea']['rows'],'"';
                         }                          }
                         if (intval($this->fdd[$k]['textarea']['cols']) > 0) {                          if (intval($this->fdd[$k]['textarea']['cols']) > 0) {
                                 echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';                                  echo ' cols="',$this->fdd[$k]['textarea']['cols'],'"';
                         }                          }
                         if (isset($this->fdd[$k]['textarea']['wrap'])) {                          if (isset($this->fdd[$k]['textarea']['wrap'])) {
                                 echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';                                  echo ' wrap="',$this->fdd[$k]['textarea']['wrap'],'"';
                         } else {                          } else {
                                 echo ' wrap="virtual"';                                  echo ' wrap="virtual"';
                         }                          }
                         echo '>',htmlspecialchars($row["qf$k"]),'</textarea>',"\n";                          echo '>',htmlspecialchars($row["qf$k"]),'</textarea>',"\n";
   
             //EK code modification here              //EK code modification here
             if (isset($this->fdd[$k]['textarea']['html'])) {              if (isset($this->fdd[$k]['textarea']['html'])) {
                     echo '<script language="javascript1.2">editor_generate("';                      echo '<script language="javascript1.2">editor_generate("';
                     echo $this->fds[$k];                      echo $this->fds[$k];
                     echo '");</script>';                      echo '");</script>';
             }              }
   
                 } else {                  } else {
                         $size_ml_props = '';                          $size_ml_props = '';
                         $maxlen = intval($this->fdd[$k]['maxlen']);                          $maxlen = intval($this->fdd[$k]['maxlen']);
                         //$maxlen > 0 || $maxlen = 300;                          //$maxlen > 0 || $maxlen = 300;
                         $size   = min($maxlen, 60);                          $size   = min($maxlen, 60);
                         $size   && $size_ml_props .= ' size="'.$size.'"';                          $size   && $size_ml_props .= ' size="'.$size.'"';
                         $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';                          $maxlen && $size_ml_props .= ' maxlength="'.$maxlen.'"';
                         echo '<input class="',$css_class_name,'" type="text" ';                          echo '<input class="',$css_class_name,'" type="text" ';
                         echo ($this->readonly($k) ? 'disabled ' : ''),'name="',$this->fds[$k],'" value="';                          echo ($this->readonly($k) ? 'disabled ' : ''),'name="',$this->fds[$k],'" value="';
                         echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,'>',"\n";                          echo htmlspecialchars($row["qf$k"]),'" ',$size_ml_props,'>',"\n";
                 }                  }
                 echo '</td>',"\n";                  echo '</td>',"\n";
         } /* }}} */          } /* }}} */
   
 }  }
   
 /* Modeline for ViM {{{  /* Modeline for ViM {{{
  * vim:set ts=4:   * vim:set ts=4:
  * vim600:fdm=marker fdl=0 fdc=0:   * vim600:fdm=marker fdl=0 fdc=0:
  * }}} */   * }}} */
   
 ?>  ?>

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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