Source for file DBMS_FIELD_WYMEDITOR.phpclass

Documentation is available at DBMS_FIELD_WYMEDITOR.phpclass

  1. <?php
  2. /**
  3.   * openCSP class file DBMS_FIELD_WYMEDITOR.phpclass
  4.   *
  5.   * @project Open CSP-Management
  6.   * @package default
  7.   *
  8.   * @author Peter Krebs <pitlinz@users.sourceforge.net>
  9.   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.   *
  11.   * @since pk-07.10.2008
  12.   * @version $Id: DBMS_FIELD_WYMEDITOR.phpclass,v 1.3 2008/10/12 14:55:25 pitlinz Exp $
  13.   */
  14.  
  15.     // ---------------------------------------------------------
  16.     // requirements
  17.     // ---------------------------------------------------------
  18.  
  19.     pcf_require_class('DBMS_FIELD_TEXTAREA',dirname(__FILE__)."/");
  20.  
  21. /**
  22.   * openCSP class DBMS_FIELD_WYMEDITOR
  23.   *
  24.   * @project Open CSP-Management
  25.   * @package default
  26.   *
  27.   * @author Peter Krebs <pitlinz@users.sourceforge.net>
  28.   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  29.   *
  30.   * @since pk-07.10.2008
  31.   * @version $Id: DBMS_FIELD_WYMEDITOR.phpclass,v 1.3 2008/10/12 14:55:25 pitlinz Exp $
  32.   */
  33. {
  34.     // ---------------------------------------------------------------------------
  35.     // constants
  36.     // ---------------------------------------------------------------------------
  37.     
  38.     /**
  39.      * @constant string CLASS_SRC_FILE
  40.      */
  41.     const CLASS_SRC_FILE = __FILE__;
  42.  
  43.     // ---------------------------------------------------------------------------
  44.     // class (static)
  45.     // ---------------------------------------------------------------------------
  46.     
  47.     /*** class vars ------------------------------------------------------ */
  48.     
  49.     /*** class methods --------------------------------------------------- */
  50.     
  51.     // ---------------------------------------------------------------------------
  52.     // object vars
  53.     // ---------------------------------------------------------------------------
  54.     
  55.     /*** compostion --------------------------------------------------- */
  56.     
  57.     /*** attributes  -------------------------------------------------- */
  58.     
  59.     /**
  60.       * source file of the class
  61.       *
  62.       * @var string $classSrcFile 
  63.       * @since pk-05-02-08
  64.       ***/
  65.     protected $classSrcFile = __FILE__;    
  66.     
  67.     /**
  68.       * @var    bool    $isSearchable   overwrite parent set to FALSE
  69.       ***/
  70.     protected $isSearchable  = False;
  71.     /**
  72.       * @var bool $allowHTML  overwrite parent set to TRUE
  73.       ***/
  74.     protected $allowHTML     = True;
  75.     /**
  76.       * @var    bool    $nlToBr         overwrite parent set to FALSE
  77.       ***/
  78.     protected $nlToBr        = False;    
  79.     
  80.     // ---------------------------------------------------------------------------
  81.     // factory / construct
  82.     // ---------------------------------------------------------------------------
  83.     
  84.     // ---------------------------------------------------------------------------
  85.     // getter / setter
  86.     // ---------------------------------------------------------------------------    
  87.  
  88.     /**
  89.       * returns the html code for a editable formular element
  90.       *
  91.       * @param mixed $aValue the value to set
  92.       * @param string $arrName 
  93.       * @param string $nameAdd  append something to name like "[VALUE]" for search forms
  94.       *
  95.       * @returns string
  96.       *
  97.       * @since pk-04-09-09
  98.       * @version pk-06-01-19
  99.       * @version pk-07-09-24
  100.       *
  101.       ***/
  102.     function getInputTag($aValue,$arrName="DBVAL",$nameAdd="",$debug=FALSE{
  103.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_TEXTAREA::getInputTag(\$aValue,$arrName,$nameAdd,...) [".$this->getKey()."]");
  104.  
  105.         $tag  "<textarea ";
  106.         $tag .= "name=\"$arrName"."[".$this->myName."]\" ";
  107.         $tag .= "id=\"".$this->getDOMId()."\" ";
  108.         $tag .= " >".htmlspecialchars($aValue)."</textarea>";
  109.         $tag .= "<br />ID: ".$this->getDOMId();
  110.         return $tag;
  111.     }
  112.     
  113.     
  114.        // --------------------------------------------------------
  115.     // jOCSP
  116.     // --------------------------------------------------------
  117.  
  118.    /**
  119.      * returns an array of jOCSP/jQuery Modules which are required
  120.      * 
  121.      * $arr_ret[]="script url";
  122.      *
  123.      * @param boolean $debug 
  124.      * 
  125.      * @return string 
  126.      * 
  127.      * @version pk-08-10-07
  128.      */
  129.     public function jOCSP_getRequiredModules($debug=False)
  130.     {        
  131.         if ($debugechoDebugMethod(__FILE__,get_classe($this),"DBMS_FIELD::jOCSP_getRequiredModules()");
  132.         
  133.         $arr_ret parent::jOCSP_getRequiredModules($debug);
  134.         $arr_ret[array(
  135.             'CLASS' => 'jQuery.fn.wymeditor',
  136.             'SRC'    => OCSP_OBJ::getConf('SYSTEMURL')."javascript/jquery/wymeditor/jquery.wymeditor.js"
  137.         );
  138.         return $arr_ret;
  139.     }
  140.     
  141.     
  142.     /**
  143.      * returns additional object elements of the field object
  144.      * 
  145.      * array definition: [elemName] = value
  146.      * 
  147.      * NOTE: do not js_escapte value this is done when building the json object
  148.      *
  149.      * @param boolean $debug 
  150.      * 
  151.      * @return array 
  152.      * 
  153.      * @since pk-08-10-08
  154.      */
  155.     protected function jOCSP_getAdditonalFieldObjElems($debug=FALSE)
  156.     {
  157.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_WYMEDITOR::jOCSP_getAdditonalFieldObjElems()");
  158.         $arr_ret parent::jOCSP_getAdditonalFieldObjElems($debug);
  159.         
  160.         //$arr_ret['debug'] = "true";
  161.         $arr_ret['wym']   'null';        
  162.         $arr_ret['init']  "function() {
  163.                 var options={
  164.                     lang:'de',
  165.                     postInit: function(wym) {
  166.                         jOCSP.getFormByHash('" $this->getControll()->jOCSP_getfrmHash("').wym=wym;                       
  167.                     }
  168.                 };
  169.                 if (typeof(WYMeditor.WymClassSafari) == 'undefined')
  170.                 {
  171.                     var html_doc = document.getElementsByTagName('head').item(0);
  172.                     var jscript = document.createElement('script');
  173.                     jscript.setAttribute('language', 'javascript');
  174.                     jscript.setAttribute('type', 'text/javascript');
  175.                     jscript.setAttribute('src', '" OCSP_OBJ::getConf('SYSTEMURL')."javascript/jquery/wymeditor/jquery.wymeditor.js');
  176.                     jscript.onload = function() {
  177.                         alert('script loaded');
  178.                         jQuery('#" $this->getDOMId("').wymeditor(options);                    
  179.                     }
  180.                     html_doc.appendChild(jscript);        
  181.                 } else {
  182.                     jQuery('#" $this->getDOMId("').wymeditor(options);
  183.                 }
  184.             }";
  185.  
  186.         $arr_ret['beforeSubmit'"function() {jOCSP.getFormByHash('" $this->getControll()->jOCSP_getfrmHash("').wym.update();}";
  187.  
  188.         return $arr_ret;
  189.     }
  190.     
  191. }
  192.  
  193. ?>

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