Source for file DBMS_FIELD_HTMLSOURCE.phpclass

Documentation is available at DBMS_FIELD_HTMLSOURCE.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_HTMLSOURCE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   blob
  8.   *
  9.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @since pk-04-04-22
  13.   * @version $Id: DBMS_FIELD_HTMLSOURCE.phpclass,v 1.2 2008/08/08 02:00:42 pitlinz Exp $
  14.   */
  15.  
  16.     pcf_require_class('DBMS_FIELD_TEXTAREA',dirname(__FILE__)."/");
  17.  
  18. /**
  19.   * Class DBMS_FIELD_HTMLSOURCE
  20.   *
  21.   * @project    Open CSP-Management
  22.   * @package    dbms_field
  23.   * @category   blob
  24.   *
  25.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  26.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  27.   *
  28.   * @version pk-05-09-28
  29.   * @version $Id: DBMS_FIELD_HTMLSOURCE.phpclass,v 1.2 2008/08/08 02:00:42 pitlinz Exp $
  30.   */
  31. {
  32.     // ---------------------------------------------------------------------------
  33.     // constants
  34.     // ---------------------------------------------------------------------------
  35.     
  36.     /**
  37.      * @constant string CLASS_SRC_FILE
  38.      */
  39.     const CLASS_SRC_FILE = __FILE__;
  40.  
  41.     // ---------------------------------------------------------------------------
  42.     // class (static)
  43.     // ---------------------------------------------------------------------------
  44.     
  45.     /*** class vars ------------------------------------------------------ */
  46.  
  47.     /*** class methods --------------------------------------------------- */    
  48.     
  49.     // ---------------------------------------------------------------------------
  50.     // object vars
  51.     // ---------------------------------------------------------------------------
  52.     
  53.     /*** compostion --------------------------------------------------- */
  54.     
  55.     /*** attributes --------------------------------------------------- */
  56.         
  57.     /**
  58.      * overwrite parent::$isSearchable to False
  59.      * 
  60.      * @var boolean $isSearchable 
  61.      */
  62.     protected $isSearchable  = False;
  63.     
  64.     /**
  65.      * overwrite parent::$allowHTML to True
  66.      * 
  67.      * @var boolean $allowHTML 
  68.      */
  69.     protected $allowHTML = True;
  70.  
  71.  
  72.     /**
  73.       * source file of the class
  74.       *
  75.       * @var string $classSrcFile 
  76.       * @since pk-05-02-19
  77.       ***/
  78.     var $classSrcFile=__FILE__;
  79.  
  80.     /**
  81.       * returns an array of field to bie shown in the edit form
  82.       * by using editTbl_echoForm
  83.       *
  84.       * the array is in the form:
  85.       *
  86.       * <code>
  87.       * [_sectionName_]
  88.       *      [TITLE] -> string
  89.       *      [_rowName_]
  90.       *         [FLDLAB]  (complete html code with <td></td>)
  91.       *         [FLDVAL] (complete html code with <td></td>)
  92.       * </code>
  93.       *
  94.       * @param boolean $debug 
  95.       *
  96.       * @returns array
  97.       *
  98.       * @since pk-06-04-26
  99.       * @version pk-06-04-29
  100.       *
  101.       ***/
  102.     function editTbl_getFieldEditArr($debug=False{
  103.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_FOREIGNKEY::editTbl_getFieldEditArr","",0);
  104.  
  105.         $this->allowHTML=True;
  106.         if (empty($this->helpUrl)) $this->helpUrl="/system/help/templatevars.html";
  107.  
  108.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  109.         unset($a_ret['LAYOUT']['FLDNL2BR']);
  110.         unset($a_ret['LAYOUT']['FLD_INPUTADD']);
  111.  
  112.         return $a_ret;
  113.     }
  114.  
  115.  
  116.     /**
  117.       * saves the field definition from $_POST array
  118.       **/
  119.  
  120.     function save({
  121.         $ret=parent::save();
  122.         $this->allowHTML  =True;
  123.         $this->nlToBr     =False;
  124.         $this->wrap       ="off";
  125.         return $ret;
  126.     }
  127.  
  128.     /**
  129.       * returns a string with the HTML input-tag for the field
  130.       *
  131.       * @param  string  $aValue     the value to show
  132.       * @param  string  $arrName    name of the form array used in name=
  133.       *
  134.       * @return string 
  135.       *
  136.       * @version    pk-03-11-27     layout changed
  137.       ***/
  138.     function getInputTag($aValue,$arrName="DBVAL"{
  139.         $tag="";
  140.  
  141.         $tag .="<a href=\"#\" onClick=\"\n";
  142.         $tag .= "\turl=prompt('Link:','http://');\n";
  143.         $tag .= "\tif (url != '') {\n";
  144.         $tag .= "\t textAreaLinkSelection('".$this->getMyFormName()."','".$arrName."[".$this->myName."]',url);\n";
  145.         $tag .= "\t}\"><img src=\"".OCSP_CONF::getInstance()->getValue('SYSIMGURL')."/icons-16x16/www.gif\" border=\"0\" class=\"button\"></a>";
  146.  
  147.         $tag .= "&nbsp;";
  148.         $tag .= "<a href=\"#\" onClick=\"\n";
  149.         $tag .= "\t textAreaAddTagToSelection('".$this->getMyFormName()."','".$arrName."[".$this->myName."]','<b>','</b>');\n";
  150.         $tag .= "\t}\"><img src=\"".OCSP_CONF::getInstance()->getValue('SYSIMGURL')."/icons-16x16/text_bold.gif\" border=\"0\" alt=\"\" title=\"bold\" class=\"button\"></a>";
  151.  
  152.         $tag .="<a href=\"#\" onClick=\"\n";
  153.         $tag .= "\t textAreaAddTagToSelection('".$this->getMyFormName()."','".$arrName."[".$this->myName."]','<u>','</u>');\n";
  154.         $tag .= "\t}\"><img src=\"".OCSP_CONF::getInstance()->getValue('SYSIMGURL')."/icons-16x16/text_under.gif\" border=\"0\" alt=\"\" title=\"underline\" class=\"button\"></a>";
  155.  
  156.         $tag .="<a href=\"#\" onClick=\"\n";
  157.         $tag .= "\t textAreaAddTagToSelection('".$this->getMyFormName()."','".$arrName."[".$this->myName."]','<i>','</i>');\n";
  158.         $tag .= "\t}\"><img src=\"".OCSP_CONF::getInstance()->getValue('SYSIMGURL')."/icons-16x16/text_italic.gif\" border=\"0\" alt=\"\" title=\"italic\" class=\"button\"></a>";
  159.  
  160.         $tag .= "<br /><textarea ";
  161.         $tag .= "name=\"$arrName"."[".$this->myName."]\" ";
  162.         $tag .= "rows=\"".$this->rows."\" cols=\"".$this->cols."\" ";
  163.         $tag .= "wrap=\"".$this->wrap."\" ";
  164.         $tag .=" >".htmlspecialchars($aValue)."</textarea>";
  165.  
  166.         return $tag;
  167.  
  168.     }
  169.  
  170.     /**
  171.       * returns the value with slashes create use in a db statement
  172.       * do some textreplaces before - because the editors always adds the
  173.       * url - to avoid jumping into a test system
  174.       *
  175.       * calls parent::slashedValue()
  176.       *
  177.       * @param  string  $aValue     the value
  178.       * @param  array   $err        error array
  179.       * @param  string  $arrName    DBVAL
  180.       *
  181.       * @return string 
  182.       *
  183.       * @version pk-03-11-27    DB-Object used instead of DB_.. function
  184.       *
  185.       ***/
  186.     function getValue($aValue,&$err,$arrName="DBVAL",$debug=False{
  187.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_HTMLSOURCE::getValue()","(".get_class($this)." | ".$this->myName.")");
  188.         if ((!empty($aValue)) && ($this->replaceServer)) {
  189.                 $aValue=str_replace("http://".$_SERVER['SERVER_NAME'],"",$aValue);
  190.         }
  191.         return parent::getValue($aValue,$err,$arrName,$debug);
  192.     }
  193.  
  194.     /**
  195.       * returns the value with slashes create use in a db statement
  196.       * do some textreplaces before - because the editors always adds the
  197.       * url - to avoid jumping into a test system
  198.       *
  199.       * calls parent::slashedValue()
  200.       *
  201.       * @param  string  $aValue     the value
  202.       * @param  array   $err        error array
  203.       * @param  string  $arrName    DBVAL
  204.       *
  205.       * @return string 
  206.       *
  207.       * @version pk-03-11-27    DB-Object used instead of DB_.. function
  208.       *
  209.       ***/
  210.     function slashedValue($aValue,&$err,$arrName="DBVAL",$debug=False{
  211.         if ($debugecho "<hr><p><b>DBMS_FIELD_HTMLSOURCE::slashedValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)."/".$this->myName.")</p>";
  212.         return $GLOBALS[$this->getGlobalDBObjIdx()]->qs_getSlashedValue($this->getValue($aValue,$err,$arrName,$debug));
  213.     }
  214.  
  215.  
  216. // end class DBMS_FIELD_SQLSTATEMENT
  217. ?>

Documentation generated on Thu, 08 Jan 2009 17:41:53 +0100 by phpDocumentor 1.4.0a2