Source for file DBMS_FIELD_HTMLCODE.phpclass

Documentation is available at DBMS_FIELD_HTMLCODE.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_HTMLCODE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   text
  8.   *
  9.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   * 
  12.   * @version $Id: DBMS_FIELD_HTMLCODE.phpclass,v 1.11 2008/12/12 17:35:14 pitlinz Exp $
  13.   */
  14.  
  15. pcf_require_class('DBMS_FIELD_TEXTAREA',dirname(__FILE__)."/");
  16. pcf_require_class('OCSP_DIRECTORY',"common/");
  17.  
  18.  
  19. /**
  20.   * Class DBMS_FIELD_HTMLCODE
  21.   *
  22.   * @project    Open CSP-Management
  23.   * @package    dbms_field
  24.   * @category   text
  25.   *
  26.   * @author     <pitlinz@users.sourceforge.net>
  27.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  28.   *
  29.   * @version $Id: DBMS_FIELD_HTMLCODE.phpclass,v 1.11 2008/12/12 17:35:14 pitlinz Exp $
  30.   */
  31.  
  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.     /**
  58.       * source file of the class
  59.       *
  60.       * @var string $classSrcFile 
  61.       * @since pk-05-02-08
  62.       ***/
  63.     var $classSrcFile=__FILE__;
  64.         
  65.     var $className     = "HTML-Code";
  66.     
  67.     
  68.     /**
  69.       * @var    bool    $isSearchable   overwrite parent set to FALSE
  70.       ***/
  71.     protected $isSearchable  = FALSE;
  72.     /**
  73.       * @var bool $allowHTML  overwrite parent set to TRUE
  74.       ***/
  75.     protected $allowHTML     = TRUE;
  76.     /**
  77.       * @var    bool    $nlToBr         overwrite parent set to FALSE
  78.       ***/
  79.     protected $nlToBr        = FALSE;
  80.     /**
  81.       * @var    string  $editorUrl      which editor url to start with edit button
  82.       */
  83.     protected $editorUrl     = "";
  84.     /**
  85.       * @var    bool    $replaceServer  replace http://server/ with /
  86.       ***/
  87.     protected $replaceServer = TRUE;
  88.  
  89.  
  90.     /**
  91.       * FCKeditor definition
  92.       *
  93.       * @var string $imgRootDir         rootPath where images are stored (filebrowse is jailed to this dir)
  94.       * @var string $imgDefaultDir      default path (subpath in $imgRootDir)
  95.       * @var int $fb_allowMkDir_Grp     members of this group are allowed to create new directories on the server
  96.       * @var int $fb_allowCd_Grp        members of this group are allowed to change directories within the rootPath
  97.       * @var int $fb_overWrite_Grp      members of this group are allowed to overwrite existing files on the server
  98.       * @var int $fb_upload_Grp         members of this group are allowed to upload new files to the server
  99.       * @var boolean $fb_uploadOnly     if true only new fiels can be uploaded to the server
  100.       * @var string $ocspModuleKey      the module key
  101.       *
  102.       * @since pk-06-11-09
  103.       *
  104.       ***/
  105.     protected $imgRootDir         ="";
  106.     protected $imgDefaultDir      ="";
  107.     protected $fb_allowMkDir_Grp  =-80//$GLOBALS['GROUPS']['PROJ_ADMINGRP'];
  108.     protected $fb_allowCd_Grp     =-1;  //$GLOBALS['GROUPS']['LOGGEDIN'];
  109.     protected $fb_overWrite_Grp   =-81//$GLOBALS['GROUPS']['PROJ_EDITOR_GRP'];
  110.     protected $fb_upload_Grp      =-82//$GLOBALS['GROUPS']['PROJ_AUTHOR_GRP'];
  111.     protected $fb_uploadOnly      =False;
  112.     protected $ocspModuleKey      ='CMS';
  113.  
  114.  
  115.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  116.     // path methods
  117.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118.  
  119.     /**
  120.      * returns the base path (DOCUMENTROOT or PROJECT PATH)
  121.      *
  122.      * @return string 
  123.      */
  124.     protected function getBasePath()
  125.     {
  126.         return $_SERVER['DOCUMENT_ROOT'_OCSP_DIRSEP_;
  127.     }    
  128.     
  129.     /**
  130.       * @param boolean $fullPath include the linux path from /
  131.       * @param boolean $debug 
  132.       *
  133.       * @returns string NULL in case of $this->imgRootDir is empty
  134.       *
  135.       * @since pk-06-12-04
  136.       *
  137.       ***/
  138.     function getImgRootPath($fullPath=TRUE,$debug=FALSE{
  139.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_HTMLCODE::getImgRootPath()");
  140.  
  141.         if (empty($this->imgRootDir)) {
  142.            return NULL;
  143.         }
  144.         if (!$fullPath{
  145.             // as we should not have the document or project root in imgRootDir we just return it
  146.             return $this->imgRootDir;
  147.         }
  148.         
  149.         $str_return $_SERVER['DOCUMENT_ROOT'_OCSP_DIRSEP_ .$this->imgRootDir;
  150.         return OCSP_DIRECTORY::checkDirName($str_return,_OCSP_DIRSEP_,1);
  151.         
  152.     }
  153.  
  154.     /**
  155.      * sets the root dir
  156.      *
  157.      * @param string $aRootDir 
  158.      * @param boolean $debug 
  159.      */
  160.     public function setRootDir($aRootDir,$debug=False)
  161.     {        
  162.         $this->imgRootDir = str_replace($_SERVER['DOCUMENT_ROOT'_OCSP_DIRSEP_,"",$aRootDir);
  163.     }
  164.     
  165.     /**
  166.      * returns the root dir (without base path)
  167.      *
  168.      * @return string 
  169.      */
  170.     public function getRootDir()
  171.     {
  172.         return $this->imgRootDir;
  173.     }    
  174.     
  175.     /**
  176.       * @param boolean $fullPath include the imgRootPath
  177.       * @param boolean $debug 
  178.       *
  179.       * @returns string NULL in case of $this->imgDefaultDir is empty
  180.       *
  181.       * @since pk-06-12-04
  182.       *
  183.       ***/
  184.     function getImgDefaultPath($fullPath=FALSE,$debug=FALSE{
  185.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_HTMLCODE::getImgRootPath()");
  186.  
  187.         if (empty($this->imgDefaultDir)) {
  188.            return NULL;
  189.         }
  190.  
  191.         $s_defPath=$this->imgDefaultDir;
  192.         if (substr($s_defPath,0,strlen($this->imgRootDir)) ==$this->imgRootDir{
  193.             // ensure that imgDefaultDir can be added to imgRootDir
  194.             $s_defPath=str_replace($this->imgRootDir,"",$this->imgDefaultDir);
  195.         }
  196.  
  197.         if (!$fullPath{
  198.             // as we should not have the document or project root in imgRootDir we just return it
  199.             return $s_defPath;
  200.         }
  201.  
  202.         $s_defPath=str_replace("//","/",$this->getRootPath()."/".$s_defPath);
  203.         if (is_dir($s_defPath)) return $s_defPath;
  204.         return NULL;
  205.     }
  206.  
  207.     // ###########################################################
  208.     // OBJECT SETTINGS METHODS
  209.     // ###########################################################
  210.  
  211.     /**
  212.       * returns an array of field to be shown in the edit form
  213.       * by using editTbl_echoForm
  214.       *
  215.       * the array is in the form:
  216.       *
  217.       * <code>
  218.       * [_sectionName_]
  219.       *      [TITLE] -> string
  220.       *      [_rowName_]
  221.       *         [FLDLAB]  (complete html code with <td></td>)
  222.       *         [FLDVAL] (complete html code with <td></td>)
  223.       * </code>
  224.       *
  225.       * @param boolean $debug 
  226.       *
  227.       * @returns array
  228.       *
  229.       * @since pk-06-04-26
  230.       * @version pk-06-04-29
  231.       * @version pk-06-11-09
  232.       *
  233.       ***/
  234.     function editTbl_getFieldEditArr($debug=FALSE{
  235.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_FOREIGNKEY::editTbl_getFieldEditArr","",0);
  236.  
  237.         require_once __OCSP_PHPINCPATH__."common/pcf_directory.phpinc";
  238.         require_once __OCSP_PHPINCPATH__."common/pcf_md5.phpinc";
  239.  
  240.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  241.  
  242.         $a_ret['VALCHECKS']['FLD_REPLURL']=array(
  243.             'FLDLAB'=>"URL ersetzen",
  244.             'FLDVAL'=>"<input name=\"replaceServer\" type=\"checkbox\" value=\"1\" ".($this->replaceServer ? "checked" "")." /> ja http://".$_SERVER['SERVER_NAME']." durch / ersetzen."
  245.         );
  246.  
  247.         $dirSelArgs=array();
  248.         $dirSelArgs['SEC_REQ']['PUBLIC']=FALSE;
  249.         $dirSelArgs['SEC_REQ']['DBCONN']=FALSE;
  250.         $dirSelArgs['allowMkDir']=TRUE;
  251.         $dirSelACrypt=pcfmd5_encrypt(serialize($dirSelArgs),$_SESSION['MD5PWD']);
  252.  
  253.         if (empty($this->editorUrl)) {
  254.             $this->editorUrl=OCSP_CONF::getInstance()->getValue('SYSTEMURL')."editors/FCKeditor2/editor.php";
  255.         }
  256.  
  257.         $str_dirSelPopup OCSP_CONF::getInstance()->getValue('SYSTEMURL'"forms/directory_selectList.php";
  258.         $arr_sec array(
  259.             'USER'     => OCSP_OBJ::currentUser(True)->getId(),
  260.             'GROUP'    => _OCSP_GROUP_DBMS_
  261.         );        
  262.         $str_dirSelPopup .= "?SecReq=" OCSP_SESSION::getInstance()->encrypt(serialize($arr_sec));
  263.         $str_fldDomId "imgRootDir_" md5($this->myFrmId . $this->getName($this->myTable)
  264.         $str_dirSelPopup .= "&fldDom=" $str_fldDomId;         
  265.         
  266.         $a_ret['WYSIWG_EDITOR']=array(
  267.             'TITLE'=>"WYSIWG Editor",
  268.             'FLD_EDITOR'=>array(
  269.                 'FLDLAB'=>"Editor",
  270.                 'FLDVAL'=>"<input name=\"editorUrl\" size=\"50\" value=\"".$this->editorUrl."\" />"
  271.             ),
  272.             'FLD_IMG_RP'=>array(
  273.                 'FLDLAB'=>"Image Root Dir:",
  274.                 'FLDVAL'=>"
  275.                         <input name=\"imgRootDir\" id=\"{$str_fldDomId}\" value=\"".$this->imgRootDir."\" size=\"45\" />
  276.                         <img
  277.                             src=\"" OCSP_CONF::getInstance()->getValue('SYSIMGURL'"icons-16x16/folderopen.gif\"
  278.                             alt=\"" t_admin("Ordner w&auml;hlen"."\"
  279.                             class=\"button\"
  280.                             onClick=\"popup_window('" $str_dirSelPopup ."&useDocRoot=1&rootDir=' + document.getElementById('{$str_fldDomId}').value,350,500);\"
  281.                         />                        
  282.                     "
  283.             ),
  284.  
  285.             'FLD_UPLOADONLY'=>array(
  286.                 'FLDLAB'=>"Nur Dateien hochladen:",
  287.                 'FLDVAL'=>"<input type=\"checkbox\" name=\"fb_uploadOnly\" value=\"1\"".($this->fb_uploadOnly ? " checked" "")." />"
  288.             ),
  289.             'FLD_MKDIRGRP'=>array(
  290.                 'FLDLAB'=>"Verzeichnis anlegen durch",
  291.                 'FLDVAL'=>"<select name=\"fb_allowMkDir_Grp\" size=\"1\"><optgroup label=\"Projekt Gruppen\" />\n"
  292.             ),
  293.             'FLD_CDGRP'=>array(
  294.                 'FLDLAB'=>"Verzeichnis wechseln durch",
  295.                 'FLDVAL'=>"<select name=\"fb_allowCd_Grp\" size=\"1\"><optgroup label=\"Projekt Gruppen\" />\n"
  296.             ),
  297.             'FLD_UPLOADGRP'=>array(
  298.                 'FLDLAB'=>"Datei hochladen durch",
  299.                 'FLDVAL'=>"<select name=\"fb_upload_Grp\" size=\"1\"><optgroup label=\"Projekt Gruppen\" />\n"
  300.             ),
  301.             'FLD_OVERWRITEGRP'=>array(
  302.                 'FLDLAB'=>"Datei berschreiben durch",
  303.                 'FLDVAL'=>"<select name=\"fb_overWrite_Grp\" size=\"1\"><optgroup label=\"CMS Gruppen\" />\n"
  304.             )
  305.         );
  306.  
  307.         $a_grps=array(
  308.             array('GRP_ID'=>$GLOBALS['GROUPS']['LOGGEDIN',        'GRP_NAME'=>'angemeldete Benutzer'),
  309.             array('GRP_ID'=>$GLOBALS['GROUPS']['PUBLIC'],           'GRP_NAME'=>'Public'),
  310.             array('GRP_ID'=>$GLOBALS['GROUPS']['PROJ_ADMINGRP'],    'GRP_NAME'=>'Project Administartoren'),
  311.             array('GRP_ID'=>$GLOBALS['GROUPS']['PROJ_EDITOR_GRP'],  'GRP_NAME'=>'Project Redakteure'),
  312.             array('GRP_ID'=>$GLOBALS['GROUPS']['PROJ_AUTHOR_GRP'],  'GRP_NAME'=>'Project Autoren'),
  313.             array('GRP_ID'=>$GLOBALS['GROUPS']['PROJ_USRGRP'],      'GRP_NAME'=>'Project Benutzer')
  314.         );
  315.  
  316.         foreach($a_grps as $a_group{
  317.             $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].="<option value=\"".$a_group['GRP_ID']."\"".(($this->fb_allowMkDir_Grp==$a_group['GRP_ID']" selected" "").">";
  318.             $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].=$a_group['GRP_NAME']." (ID: ".$a_group['GRP_ID'].")</option>\n";
  319.  
  320.             $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].="<option value=\"".$a_group['GRP_ID']."\"".(($this->fb_allowCd_Grp==$a_group['GRP_ID']" selected" "").">";
  321.             $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].=$a_group['GRP_NAME']." (ID: ".$a_group['GRP_ID'].")</option>\n";
  322.  
  323.             $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].="<option value=\"".$a_group['GRP_ID']."\"".(($this->fb_upload_Grp==$a_group['GRP_ID']" selected" "").">";
  324.             $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].=$a_group['GRP_NAME']." (ID: ".$a_group['GRP_ID'].")</option>\n";
  325.  
  326.             $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].="<option value=\"".$a_group['GRP_ID']."\"".(($this->fb_overWrite_Grp==$a_group['GRP_ID']" selected" "").">";
  327.             $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].=$a_group['GRP_NAME']." (ID: ".$a_group['GRP_ID'].")</option>\n";
  328.  
  329.         }
  330.  
  331.         $a_grpTreeDesc=array(
  332.             'TABLE'         => "T_SYS_GROUP",
  333.             'SHOWFIELD'     => "GRP_NAME",
  334.             'KEYFIELD'      => "GRP_ID",
  335.             'PARENTFIELD'   => "GRP_PARENT",
  336.             'SORTFIELD'     => "GRP_SORTORDER"
  337.         );
  338.         require_once __OCSP_PHPINCPATH__."common/pcf_tree.phpinc";
  339.  
  340.         $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].="</optgroup><optgroup label=\"Benutzer Gruppen\">";
  341.         $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].="</optgroup><optgroup label=\"Benutzer Gruppen\">";
  342.         $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].="</optgroup><optgroup label=\"Benutzer Gruppen\">";
  343.         $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].="</optgroup><optgroup label=\"Benutzer Gruppen\">";
  344.  
  345.         $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].=pcf_getTreeOptionLst($a_grpTreeDesc,0,"","GRP_ID > 0",$this->fb_allowMkDir_Grp,$debug);
  346.         $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].=pcf_getTreeOptionLst($a_grpTreeDesc,0,"","GRP_ID > 0",$this->fb_allowCd_Grp,$debug);
  347.         $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].=pcf_getTreeOptionLst($a_grpTreeDesc,0,"","GRP_ID > 0",$this->fb_upload_Grp,$debug);
  348.         $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].=pcf_getTreeOptionLst($a_grpTreeDesc,0,"","GRP_ID > 0",$this->fb_overWrite_Grp,$debug);
  349.  
  350.  
  351.         $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].="</optgroup></select>";
  352.         $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].="</optgroup></select>";
  353.         $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].="</optgroup></select>";
  354.         $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].="</optgroup></select>";
  355.  
  356.         return $a_ret;
  357.     }
  358.  
  359.     /**
  360.       * echos input form for field definition
  361.       *
  362.       * @param bool $showSize show size and maxlength input
  363.       * @version pk-03-10-10
  364.       ***/
  365.     function editTblForm($showSize=FALSE,$allowHTML=TRUE{
  366.         $a_FieldEditArr=$this->editTbl_getFieldEditArr($debug);
  367.         $this->editTbl_echoForm($a_FieldEditArr,$debug);       $this->allowHTML=TRUE;
  368.     }
  369.  
  370.     /**
  371.       * saves the field definition from $_POST array
  372.       *
  373.       * @returns boolean
  374.       *
  375.       * @version pk-06-11-09
  376.       *
  377.       ***/
  378.     function save(
  379.     {
  380.         $ret=parent::save();
  381.         $this->allowTHML  =True;
  382.         $this->nlToBr     =False;
  383.         $this->editorUrl  = ((isset($_POST['editorUrl']&& (!empty($_POST['editorUrl']))) $_POST['editorUrl'OCSP_CONF::getInstance()->getValue('SYSTEMURL'"editors/FCKeditor2/ocspEditor.php");
  384.         $this->replaceServer = (intval($_POST['replaceServer']True False);
  385.  
  386.         $this->imgRootDir      = (isset($_POST['imgRootDir']$_POST['imgRootDir'"");
  387.         $this->imgDefaultDir   = (isset($_POST['imgDefaultDir']$_POST['imgDefaultDir'"");
  388.         if ((!empty($this->imgRootDir)) && (strpos($this->imgDefaultDir,$this->imgRootDir!== 0)) {
  389.             $this->imgDefaultDir = $this->imgRootDir;
  390.         }
  391.  
  392.         $this->fb_allowMkDir_Grp=intval($_POST['fb_allowMkDir_Grp']);
  393.         $this->fb_allowCd_Grp   =intval($_POST['fb_allowCd_Grp']);
  394.         $this->fb_upload_Grp    =intval($_POST['fb_upload_Grp']);
  395.         $this->fb_overWrite_Grp =intval($_POST['fb_overWrite_Grp']);
  396.         $this->fb_uploadOnly    =(intval($_POST['fb_uploadOnly']TRUE FALSE);
  397.  
  398.         return $ret;
  399.     }
  400.  
  401.     /**
  402.       * returns a string with the HTML input-tag for the field
  403.       *
  404.       * @param string $aValue the value to show
  405.       * @param string $arrName name of the form array used in name=
  406.       * @param string $nameAdd add string to the field name
  407.       * 
  408.       * @global array $OCSP_CONF 
  409.       *
  410.       * @return string 
  411.       *
  412.       * @version pk-03-11-27 layout changed
  413.       * @version pk-05-02-08 $nameAdd added
  414.       * @version pk-07-01-11 check imgRootDir as template for FCKeditor
  415.       * @version pk-07-02-14 append session to editorUrl
  416.       * @version pk-08-01-15 fixed editor url to FCKeditor
  417.       * 
  418.       */
  419.     function getInputTag($aValue,$arrName="DBVAL",$nameAdd="",$debug=FALSE{        
  420.         $debug=($debug || $this->fldDebug);
  421.         if ($debugecho "<p><b>DBMS_FIELD_HTMLCODE::getInputTag(\$aValue,$arrName,$nameAdd,...)</b> (".get_class($this)."/".$this->myName.")</p>";
  422.  
  423.         if (!intval($this->rows)) $this->rows = 4;
  424.         if (!intval($this->cols)) $this->cols = 50;
  425.         
  426.         $str_tag "
  427.             <textarea
  428.                 name=\"{$arrName}[{$this->getName()}trim($nameAdd"]\"
  429.                 id=\"{$this->getDOMId()}\"
  430.                 rows=\"{$this->rows}\" cols=\"{$this->cols}\"
  431.                 wrap=\"off\"
  432.             >";
  433.         $str_tag .= htmlspecialchars($aValue)."</textarea>";
  434.  
  435.         $str_tag .="<br />
  436.             <a href=\"#\" onclick=\"
  437.                 if (obj_form = jOCSP.getFormByHash('" . $this->myControll->jOCSP_getfrmHash("')) 
  438.                 {
  439.                     if (obj_field = obj_form.getFieldByDomId('" $this->getDOMId("')) 
  440.                     {
  441.                         obj_field.openEditor();
  442.                     }
  443.                 }
  444.             \"><img src=\"".OCSP_CONF::getInstance()->getValue('SYSIMGURL')."icons-16x16/wysiwyg.gif\" border=\"0\" class=\"button\"> WYSIWG-Editor</a>";
  445.         
  446.            return $str_tag;
  447.  
  448.     }
  449.  
  450.        // --------------------------------------------------------
  451.     // jOCSP
  452.     // --------------------------------------------------------
  453.    /**
  454.      * returns an array of jOCSP/jQuery Modules which are required
  455.      * 
  456.      * $arr_ret[]="script url";
  457.      *
  458.      * @param boolean $debug
  459.      * 
  460.      * @return string
  461.      * 
  462.      * @version pk-08-10-07
  463.      */
  464.     public function jOCSP_getRequiredModules($debug=False)
  465.     {        
  466.         if ($debug) echoDebugMethod(__FILE__,get_classe($this),"DBMS_FIELD::jOCSP_getRequiredModules()");
  467.         
  468.         $arr_ret = parent::jOCSP_getRequiredModules($debug);
  469.         $arr_ret['fldClass'] = "'FLDOBJ_fckEditor'";
  470.  
  471.         return $arr_ret;
  472.     }    
  473.     
  474.    /**
  475.      * returns additional object elements of the field object
  476.      * 
  477.      * array definition: [elemName] = value
  478.      * 
  479.      * NOTE: do not js_escapte value this is done when building the json object 
  480.      *
  481.      * @param boolean $debug
  482.      * 
  483.      * @return array
  484.      * 
  485.      * @since pk-08-02-06
  486.      */
  487.     protected function jOCSP_getAdditonalFieldObjElems($debug=False)
  488.     {  
  489.         if ($debug) echoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_FILESELECT::jOCSP_getAdditonalFieldObjElems()");
  490.         $arr_ret = parent::jOCSP_getAdditonalFieldObjElems($debug);        
  491.         $arr_ret['fldClass'] = "'FLDOBJ_fckEditor'";
  492.         //$arr_ret['debug'] = True;
  493.         return $arr_ret;          
  494.     }       
  495.     
  496.    /**
  497.      * retuns a js command to change the directory
  498.      * 
  499.      * @param array $request
  500.      * @param boolean $debug
  501.      * 
  502.      * @return string (js)
  503.      */  
  504.     public function jOCSP_openEditor($request,$debug)
  505.     {
  506.         if (empty($this->editorUrl))
  507.         {
  508.             $this->editorUrl=OCSP_CONF::getInstance()->getValue('SYSTEMURL')."editors/FCKeditor2/ocspEditor.php";
  509.         }
  510.         $this->editorUrl=OCSP_CONF::getInstance()->getValue('SYSTEMURL')."editors/FCKeditor2/ocspEditor.php";
  511.         
  512.         $str_url $this->editorUrl;
  513.         $str_url.= (strstr($str_url,'?'"&" "?""SecReq=";
  514.         
  515.         $arr_sec array(
  516.                 'USER_ID' => OCSP_OBJ::currentUser(True)->getId(),
  517.                 'PUBLIC'  => OCSP_OBJ::currentUser()->isPublic()
  518.             );
  519.         
  520.         $str_url .= OCSP_SESSION::getInstance(True)->encrypt(serialize($arr_sec));      
  521.         $str_url .= "&fldDOMId=" $this->getDOMId();
  522.         
  523.         $_SESSION['OCSP_FCK_DOCROOT'$_SERVER['DOCUMENT_ROOT'_OCSP_DIRSEP_ $this->imgRootDir;
  524.         
  525.         
  526.         
  527.         $str_ret "
  528.             if (wnd=openWindow('wysiwyg','".$str_url."',600,400))
  529.             {
  530.                 wnd.document.ocsp_fldDOMId = '" $this->getDOMId("';         
  531.             }
  532.         ";
  533.         
  534.         return $str_ret;
  535.     }
  536.     
  537.     
  538.     /**
  539.       * returns the value with slashes create use in a db statement
  540.       * do some textreplaces before - because the editors always adds the
  541.       * url - to avoid jumping into a test system
  542.       *
  543.       * calls parent::slashedValue()
  544.       *
  545.       * @param  string  $aValue     the value
  546.       * @param  array   $err        error array
  547.       * @param  string  $arrName    DBVAL
  548.       *
  549.       * @return string
  550.       *
  551.       * @version pk-03-11-27 DB-Object used instead of DB_.. function
  552.       * @version pk-06-12-04 replace HTMLspecialChars
  553.       *
  554.       **/
  555.     function getValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE) {
  556.         if ($debug) echo "<hr><p><b>DBMS_FIELD_HTMLCODE::getValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)." | ".$this->myName.")</p>";
  557.         if (!empty($aValue)) {
  558.             if ($this->replaceServer{
  559.                 $aValue=str_replace("http://".$_SERVER['SERVER_NAME'],"",$aValue);
  560.             }
  561.             $aValue=pcf_gerHTMLspecialChars($aValue); // <pk-06-12-04 />
  562.         }
  563.         return parent::getValue($aValue,$err,$arrName,$debug);
  564.     }
  565.  
  566.     /**
  567.       * returns the value with slashes create use in a db statement
  568.       * do some textreplaces before - because the editors always adds the
  569.       * url - to avoid jumping into a test system
  570.       *
  571.       * calls parent::slashedValue()
  572.       *
  573.       * @param  string  $aValue     the value
  574.       * @param  array   $err        error array
  575.       * @param  string  $arrName    DBVAL
  576.       *
  577.       * @return string
  578.       *
  579.       * @version pk-03-11-27    DB-Object used instead of DB_.. function
  580.       *
  581.       **/
  582.     function slashedValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE) {
  583.         if ($debug) echo "<hr><p><b>DBMS_FIELD_HTMLCODE::slashedValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)."/".$this->myName.")</p>";
  584.         return $GLOBALS[$this->getGlobalDBObjIdx()]->qs_getSlashedValue($this->getValue($aValue,$err,$arrName,$debug));
  585.     }
  586.  
  587.  
  588.     /**
  589.       * gets a htmltag for the value
  590.       *
  591.       * this is mainly used in CMS Module
  592.       *
  593.       * @param mixed $aValue
  594.       * @param string $arrName
  595.       * @param boolean $debug
  596.       *
  597.       * @returns string
  598.       *
  599.       * @since pk-06-09-29
  600.       *
  601.       **/
  602.     function getHtmlTag($aValue,$arrName="DBVAL",$debug=FALSE) {
  603.         if ($debug) echoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_HTMLCODE::getHtmlTag()",htmlspecialchars(substr($avalue,30))."....");
  604.         return $aValue;
  605.     }
  606.  
  607.  
  608. } // end class DBMS_FIELD_HTMLCODE

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