Source for file DBMS_FIELD_HTMLCODE.phpclass
Documentation is available at DBMS_FIELD_HTMLCODE.phpclass
  * Class file DBMS_FIELD_HTMLCODE.phpclass  
  * @project    Open CSP-Management  
  * @author     Peter Krebs <pitlinz@users.sourceforge.net>  
  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License  
  * @version $Id: DBMS_FIELD_HTMLCODE.phpclass,v 1.11 2008/12/12 17:35:14 pitlinz Exp $  
  * Class DBMS_FIELD_HTMLCODE  
  * @project    Open CSP-Management  
  * @author     <pitlinz@users.sourceforge.net>  
  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License  
  * @version $Id: DBMS_FIELD_HTMLCODE.phpclass,v 1.11 2008/12/12 17:35:14 pitlinz Exp $  
    // ---------------------------------------------------------------------------  
    // ---------------------------------------------------------------------------  
     * @constant string CLASS_SRC_FILE  
    // ---------------------------------------------------------------------------  
    // ---------------------------------------------------------------------------  
    /*** class vars ------------------------------------------------------ */  
    /*** class methods --------------------------------------------------- */      
    // ---------------------------------------------------------------------------  
    // ---------------------------------------------------------------------------  
    /*** compostion --------------------------------------------------- */  
      * source file of the class  
      * @var string $classSrcFile   
      * @var    bool    $isSearchable   overwrite parent set to FALSE  
      * @var bool $allowHTML  overwrite parent set to TRUE  
      * @var    bool    $nlToBr         overwrite parent set to FALSE  
      * @var    string  $editorUrl      which editor url to start with edit button  
      * @var    bool    $replaceServer  replace http://server/ with /  
      * @var string $imgRootDir         rootPath where images are stored (filebrowse is jailed to this dir)  
      * @var string $imgDefaultDir      default path (subpath in $imgRootDir)  
      * @var int $fb_allowMkDir_Grp     members of this group are allowed to create new directories on the server  
      * @var int $fb_allowCd_Grp        members of this group are allowed to change directories within the rootPath  
      * @var int $fb_overWrite_Grp      members of this group are allowed to overwrite existing files on the server  
      * @var int $fb_upload_Grp         members of this group are allowed to upload new files to the server  
      * @var boolean $fb_uploadOnly     if true only new fiels can be uploaded to the server  
      * @var string $ocspModuleKey      the module key  
    protected $fb_upload_Grp      =-
82; //$GLOBALS['GROUPS']['PROJ_AUTHOR_GRP'];  
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
     * returns the base path (DOCUMENTROOT or PROJECT PATH)  
      * @param boolean $fullPath include the linux path from /  
      * @returns string NULL in case of $this->imgRootDir is empty  
            // as we should not have the document or project root in imgRootDir we just return it  
     * @param string $aRootDir   
    public function setRootDir($aRootDir,$debug=
False)  
     * returns the root dir (without base path)  
      * @param boolean $fullPath include the imgRootPath  
      * @returns string NULL in case of $this->imgDefaultDir is empty  
            // ensure that imgDefaultDir can be added to imgRootDir  
            // as we should not have the document or project root in imgRootDir we just return it  
        $s_defPath=
str_replace("//","/",$this->getRootPath().
"/".
$s_defPath);  
        if (is_dir($s_defPath)) return $s_defPath;  
    // ###########################################################  
    // OBJECT SETTINGS METHODS  
    // ###########################################################  
      * returns an array of field to be shown in the edit form  
      * by using editTbl_echoForm  
      * the array is in the form:  
      *         [FLDLAB]  (complete html code with <td></td>)  
      *         [FLDVAL] (complete html code with <td></td>)  
        $a_ret['VALCHECKS']['FLD_REPLURL']=
array(  
            'FLDLAB'=>
"URL ersetzen",  
            'FLDVAL'=>
"<input name=\"replaceServer\" type=\"checkbox\" value=\"1\" ".
($this->replaceServer ? 
"checked" : 
"").
" /> ja http://".
$_SERVER['SERVER_NAME'].
" durch / ersetzen."  
        $dirSelArgs['SEC_REQ']['PUBLIC']=
FALSE;  
        $dirSelArgs['SEC_REQ']['DBCONN']=
FALSE;  
        $dirSelArgs['allowMkDir']=
TRUE;  
        $str_dirSelPopup = 
OCSP_CONF::getInstance()->getValue('SYSTEMURL') . 
"forms/directory_selectList.php";  
        $str_dirSelPopup .= 
"&fldDom=" . 
$str_fldDomId;           
        $a_ret['WYSIWG_EDITOR']=
array(  
            'TITLE'=>
"WYSIWG Editor",  
                'FLDVAL'=>
"<input name=\"editorUrl\" size=\"50\" value=\"".
$this->editorUrl.
"\" />"  
                'FLDLAB'=>
"Image Root Dir:",  
                        <input name=\"imgRootDir\" id=\"{$str_fldDomId}\" value=\"".
$this->imgRootDir.
"\" size=\"45\" />  
                            alt=\"" . 
t_admin("Ordner wählen") .
"\"  
                            onClick=\"popup_window('" . 
$str_dirSelPopup .
"&useDocRoot=1&rootDir=' + document.getElementById('{$str_fldDomId}').value,350,500);\"  
                'FLDLAB'=>
"Nur Dateien hochladen:",  
                'FLDVAL'=>
"<input type=\"checkbox\" name=\"fb_uploadOnly\" value=\"1\"".
($this->fb_uploadOnly ? 
" checked" : 
"").
" />"  
                'FLDLAB'=>
"Verzeichnis anlegen durch",  
                'FLDVAL'=>
"<select name=\"fb_allowMkDir_Grp\" size=\"1\"><optgroup label=\"Projekt Gruppen\" />\n"  
                'FLDLAB'=>
"Verzeichnis wechseln durch",  
                'FLDVAL'=>
"<select name=\"fb_allowCd_Grp\" size=\"1\"><optgroup label=\"Projekt Gruppen\" />\n"  
                'FLDLAB'=>
"Datei hochladen durch",  
                'FLDVAL'=>
"<select name=\"fb_upload_Grp\" size=\"1\"><optgroup label=\"Projekt Gruppen\" />\n"  
            'FLD_OVERWRITEGRP'=>
array(  
                'FLDLAB'=>
"Datei berschreiben durch",  
                'FLDVAL'=>
"<select name=\"fb_overWrite_Grp\" size=\"1\"><optgroup label=\"CMS Gruppen\" />\n"  
            array('GRP_ID'=>
$GLOBALS['GROUPS']['LOGGEDIN'] ,        'GRP_NAME'=>
'angemeldete Benutzer'),  
            array('GRP_ID'=>
$GLOBALS['GROUPS']['PUBLIC'],           'GRP_NAME'=>
'Public'),  
            array('GRP_ID'=>
$GLOBALS['GROUPS']['PROJ_ADMINGRP'],    'GRP_NAME'=>
'Project Administartoren'),  
            array('GRP_ID'=>
$GLOBALS['GROUPS']['PROJ_EDITOR_GRP'],  'GRP_NAME'=>
'Project Redakteure'),  
            array('GRP_ID'=>
$GLOBALS['GROUPS']['PROJ_AUTHOR_GRP'],  'GRP_NAME'=>
'Project Autoren'),  
            array('GRP_ID'=>
$GLOBALS['GROUPS']['PROJ_USRGRP'],      'GRP_NAME'=>
'Project Benutzer')  
        foreach($a_grps as $a_group) {  
            $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].=
"<option value=\"".
$a_group['GRP_ID'].
"\"".
(($this->fb_allowMkDir_Grp==
$a_group['GRP_ID']) ? 
" selected" : 
"").
">";  
            $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].=
$a_group['GRP_NAME'].
" (ID: ".
$a_group['GRP_ID'].
")</option>\n";  
            $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].=
"<option value=\"".
$a_group['GRP_ID'].
"\"".
(($this->fb_allowCd_Grp==
$a_group['GRP_ID']) ? 
" selected" : 
"").
">";  
            $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].=
$a_group['GRP_NAME'].
" (ID: ".
$a_group['GRP_ID'].
")</option>\n";  
            $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].=
"<option value=\"".
$a_group['GRP_ID'].
"\"".
(($this->fb_upload_Grp==
$a_group['GRP_ID']) ? 
" selected" : 
"").
">";  
            $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].=
$a_group['GRP_NAME'].
" (ID: ".
$a_group['GRP_ID'].
")</option>\n";  
            $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].=
"<option value=\"".
$a_group['GRP_ID'].
"\"".
(($this->fb_overWrite_Grp==
$a_group['GRP_ID']) ? 
" selected" : 
"").
">";  
            $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].=
$a_group['GRP_NAME'].
" (ID: ".
$a_group['GRP_ID'].
")</option>\n";  
            'TABLE'         => 
"T_SYS_GROUP",  
            'SHOWFIELD'     => 
"GRP_NAME",  
            'PARENTFIELD'   => 
"GRP_PARENT",  
            'SORTFIELD'     => 
"GRP_SORTORDER"  
        $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].=
"</optgroup><optgroup label=\"Benutzer Gruppen\">";  
        $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].=
"</optgroup><optgroup label=\"Benutzer Gruppen\">";  
        $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].=
"</optgroup><optgroup label=\"Benutzer Gruppen\">";  
        $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].=
"</optgroup><optgroup label=\"Benutzer Gruppen\">";  
        $a_ret['WYSIWG_EDITOR']['FLD_MKDIRGRP']['FLDVAL'].=
"</optgroup></select>";  
        $a_ret['WYSIWG_EDITOR']['FLD_CDGRP']['FLDVAL'].=
"</optgroup></select>";  
        $a_ret['WYSIWG_EDITOR']['FLD_UPLOADGRP']['FLDVAL'].=
"</optgroup></select>";  
        $a_ret['WYSIWG_EDITOR']['FLD_OVERWRITEGRP']['FLDVAL'].=
"</optgroup></select>";  
      * echos input form for field definition  
      * @param bool $showSize show size and maxlength input  
    function editTblForm($showSize=
FALSE,$allowHTML=
TRUE) {  
      * saves the field definition from $_POST array  
        $this->editorUrl  = 
((isset
($_POST['editorUrl']) && 
(!empty($_POST['editorUrl']))) ? 
$_POST['editorUrl'] : 
OCSP_CONF::getInstance()->getValue('SYSTEMURL') . 
"editors/FCKeditor2/ocspEditor.php");  
        $this->imgRootDir      = 
(isset
($_POST['imgRootDir']) ? 
$_POST['imgRootDir'] : 
"");  
        $this->imgDefaultDir   = 
(isset
($_POST['imgDefaultDir']) ? 
$_POST['imgDefaultDir'] : 
"");  
      * returns a string with the HTML input-tag for the field  
      * @param string $aValue the value to show  
      * @param string $arrName name of the form array used in name=  
      * @param string $nameAdd add string to the field name  
      * @global array $OCSP_CONF   
      * @version pk-03-11-27 layout changed  
      * @version pk-05-02-08 $nameAdd added  
      * @version pk-07-01-11 check imgRootDir as template for FCKeditor  
      * @version pk-07-02-14 append session to editorUrl  
      * @version pk-08-01-15 fixed editor url to FCKeditor  
    function getInputTag($aValue,$arrName=
"DBVAL",$nameAdd=
"",$debug=
FALSE) {          
        if ($debug) echo 
"<p><b>DBMS_FIELD_HTMLCODE::getInputTag(\$aValue,$arrName,$nameAdd,...)</b> (".
get_class($this).
"/".
$this->myName.
")</p>";  
                name=\"{$arrName}[{$this->getName()}" . 
trim($nameAdd) . 
"]\"  
                rows=\"{$this->rows}\" 
cols=\"{
$this->cols}\"
  
        $str_tag .= htmlspecialchars($aValue)."</textarea>";  
                if (obj_form = jOCSP.getFormByHash('" . $this->myControll->jOCSP_getfrmHash() . 
"'))   
                    if (obj_field = obj_form.getFieldByDomId('" . 
$this->getDOMId() . 
"'))   
            \"><img src=\"".
OCSP_CONF::getInstance()->getValue('SYSIMGURL').
"icons-16x16/wysiwyg.gif\" border=\"0\" class=\"button\"> WYSIWG-Editor</a>";  
       // --------------------------------------------------------  
    // --------------------------------------------------------  
     * returns an array of jOCSP/jQuery Modules which are required  
     * $arr_ret[]="script url";  
    public function jOCSP_getRequiredModules($debug=False)  
        if ($debug) echoDebugMethod(__FILE__,get_classe($this),"DBMS_FIELD::jOCSP_getRequiredModules()");  
        $arr_ret = parent::jOCSP_getRequiredModules($debug);  
        $arr_ret['fldClass'] = "'FLDOBJ_fckEditor'";  
     * returns additional object elements of the field object  
     * array definition: [elemName] = value  
     * NOTE: do not js_escapte value this is done when building the json object   
    protected function jOCSP_getAdditonalFieldObjElems($debug=False)  
        if ($debug) echoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_FILESELECT::jOCSP_getAdditonalFieldObjElems()");  
        $arr_ret = parent::jOCSP_getAdditonalFieldObjElems($debug);          
        $arr_ret['fldClass'] = "'FLDOBJ_fckEditor'";  
        //$arr_ret['debug'] = True;  
     * retuns a js command to change the directory  
    public function jOCSP_openEditor($request,$debug)  
            $this->editorUrl=
OCSP_CONF::getInstance()->getValue('SYSTEMURL').
"editors/FCKeditor2/ocspEditor.php";  
        $this->editorUrl=
OCSP_CONF::getInstance()->getValue('SYSTEMURL').
"editors/FCKeditor2/ocspEditor.php";  
        $str_url.= 
(strstr($str_url,'?') ? 
"&" : 
"?") . 
"SecReq=";  
                'USER_ID' => 
OCSP_OBJ::currentUser(True)->getId(),  
                'PUBLIC'  => 
OCSP_OBJ::currentUser()->isPublic()  
        $str_url .= 
OCSP_SESSION::getInstance(True)->encrypt(serialize($arr_sec));        
        $str_url .= 
"&fldDOMId=" . 
$this->getDOMId();  
        $_SESSION['OCSP_FCK_DOCROOT'] = 
$_SERVER['DOCUMENT_ROOT'] . 
_OCSP_DIRSEP_ . 
$this->imgRootDir;  
            if (wnd=openWindow('wysiwyg','".
$str_url.
"',600,400))  
                wnd.document.ocsp_fldDOMId = '" . 
$this->getDOMId() . 
"';           
      * returns the value with slashes create use in a db statement  
      * do some textreplaces before - because the editors always adds the  
      * url - to avoid jumping into a test system  
      * calls parent::slashedValue()  
      * @param  string  $aValue     the value  
      * @param  array   $err        error array  
      * @param  string  $arrName    DBVAL  
      * @version pk-03-11-27 DB-Object used instead of DB_.. function  
      * @version pk-06-12-04 replace HTMLspecialChars  
    function getValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE) {  
        if ($debug) echo "<hr><p><b>DBMS_FIELD_HTMLCODE::getValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)." | ".$this->myName.
")</p>";  
                $aValue=str_replace("http://".$_SERVER['SERVER_NAME'],"",$aValue);  
            $aValue=pcf_gerHTMLspecialChars($aValue); // <pk-06-12-04 />  
        return parent::getValue($aValue,$err,$arrName,$debug);  
      * returns the value with slashes create use in a db statement  
      * do some textreplaces before - because the editors always adds the  
      * url - to avoid jumping into a test system  
      * calls parent::slashedValue()  
      * @param  string  $aValue     the value  
      * @param  array   $err        error array  
      * @param  string  $arrName    DBVAL  
      * @version pk-03-11-27    DB-Object used instead of DB_.. function  
    function slashedValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE) {  
        if ($debug) echo "<hr><p><b>DBMS_FIELD_HTMLCODE::slashedValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)."/".$this->myName.
")</p>";  
        return $GLOBALS[$this->getGlobalDBObjIdx()]->qs_getSlashedValue($this->getValue($aValue,$err,$arrName,$debug));  
      * gets a htmltag for the value  
      * this is mainly used in CMS Module  
    function getHtmlTag($aValue,$arrName="DBVAL",$debug=FALSE) {  
        if ($debug) echoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_HTMLCODE::getHtmlTag()",htmlspecialchars(substr($avalue,30))."....");  
} // end class DBMS_FIELD_HTMLCODE  
 
 
	
		Documentation generated on Thu, 08 Jan 2009 17:41:50 +0100 by phpDocumentor 1.4.0a2