<?php/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    Samuel Blume <sam at blueshoes dot org>
* @author    Andrej Arn <andrej at blueshoes dot org>
*/?><?php
define('BS_FORMFIELDTREE_VERSION',      '4.5.$Revision: 1.4 $');if (!@$APP) require_once($_SERVER['DOCUMENT_ROOT'] . $GLOBALS['APP']['path']['diffFromDocRootToGlobalConf'] . 'global.conf.php');class Bs_FormFieldTree extends Bs_FormField {var $autoCollapse;var $preloadDown;var $captionBgColor;var $showPseudoElement;var $useCheckboxSystem;var $checkboxSystemWalkTree;var $checkboxSystemIfPartlyThenFull;var $checkboxSystemImgDir;var $checkboxSystemGuiNochange;var $useRadioButton;var $radioButtonName;var $imageDir;var $useFolderIcon;var $useLeaf;var $walkTree;var $useAutoSequence;var $treeElementData;function Bs_FormFieldTree() {$this->Bs_FormField(); $this->fieldType = 'tree';$this->persister->setVarSettings(&$this->persisterVarSettings);}
function &getField($explodeKey=NULL, $addEnforceCheckbox=TRUE) {$ret = '';$fieldName = $this->_getFieldNameForHtml($this->name);$value = $this->getValue($explodeKey);switch ($this->getVisibility()) {case 'omit':
return $ret;break;case 'invisible':
$this->_markAsUsed();return $this->getFieldAsHidden();break;case 'read':
case 'readonly':
$this->_markAsUsed();$fieldName .= '_readonly';$ret .= $this->getFieldAsHidden();$ret .= $value;return $ret;break;case 'show':
$ret .= $value;return $ret;break;default: $this->_markAsUsed();}
$this->_form->addIncludeOnce('/_bsJavascript/components/tree/Bs_Tree.class.js');$this->_form->addIncludeOnce('/_bsJavascript/components/tree/Bs_TreeElement.class.js');$this->_form->addIncludeOnce('/_bsJavascript/components/checkbox/Bs_Checkbox.class.js');$jsVarName  = 'bsTre'    . $fieldName;$divVarName = 'bsDiv'    . $fieldName;$aVarName   = 'bsTreArr' . $fieldName;if (!is_null($explodeKey)) {$jsVarName  .= $explodeKey;$divVarName .= $explodeKey;$aVarName   .= $explodeKey;}
$jsDataArr = $this->_Bs_HtmlUtil->arrayToJsArray($this->treeElementData, $aVarName);$aolc  = ''; $aolc .= $jsDataArr . "\n";$aolc .= "{$jsVarName} = new Bs_Tree('{$jsVarName}');\n";if (isSet($this->autoCollapse))                   $aolc .= "{$jsVarName}.autoCollapse                   = " . boolToString($this->autoCollapse) . ";\n";if (isSet($this->preloadDown))                    $aolc .= "{$jsVarName}.preloadDown                    = {$this->preloadDown};\n";if (isSet($this->captionBgColor))                 $aolc .= "{$jsVarName}.captionBgColor                 = '{$this->captionBgColor}';\n";if (isSet($this->showPseudoElement))              $aolc .= "{$jsVarName}.showPseudoElement              = " . boolToString($this->showPseudoElement) . ";\n";if (isSet($this->useCheckboxSystem))              $aolc .= "{$jsVarName}.useCheckboxSystem              = " . boolToString($this->useCheckboxSystem) . ";\n";if (isSet($this->checkboxSystemWalkTree))         $aolc .= "{$jsVarName}.checkboxSystemWalkTree         = {$this->checkboxSystemWalkTree};\n";if (isSet($this->checkboxSystemIfPartlyThenFull)) $aolc .= "{$jsVarName}.checkboxSystemIfPartlyThenFull = " . boolToString($this->checkboxSystemIfPartlyThenFull) . ";\n";if (isSet($this->checkboxSystemImgDir))           $aolc .= "{$jsVarName}.checkboxSystemImgDir           = '{$this->checkboxSystemImgDir}';\n";if (isSet($this->checkboxSystemGuiNochange))      $aolc .= "{$jsVarName}.checkboxSystemGuiNochange      = " . boolToString($this->checkboxSystemGuiNochange) . ";\n";if (isSet($this->useRadioButton))                 $aolc .= "{$jsVarName}.useRadioButton                 = " . boolToString($this->useRadioButton) . ";\n";$radioButtonName = (isSet($this->radioButtonName)) ? $this->radioButtonName : $this->name;if (isSet($radioButtonName))                      $aolc .= "{$jsVarName}.radioButtonName                = '{radioButtonName}';\n";if (isSet($this->imageDir))                       $aolc .= "{$jsVarName}.imageDir                       = '{$this->imageDir}';\n";if (isSet($this->useFolderIcon))                  $aolc .= "{$jsVarName}.useFolderIcon                  = " . boolToString($this->useFolderIcon) . ";\n";if (isSet($this->useLeaf))                        $aolc .= "{$jsVarName}.useLeaf                        = " . boolToString($this->useLeaf) . ";\n";if (isSet($this->walkTree))                       $aolc .= "{$jsVarName}.walkTree                       = " . boolToString($this->walkTree) . ";\n";if (isSet($this->useAutoSequence))                $aolc .= "{$jsVarName}.useAutoSequence                = " . boolToString($this->useAutoSequence) . ";\n";$aolc .= "var status = {$jsVarName}.initByArray({$aVarName});\n";$aolc .= "if (!status) {\n";$aolc .= "  var treeHtml = {$jsVarName}.getLastError();\n";$aolc .= "  document.getElementById('{$divVarName}').innerHTML = treeHtml;\n";$aolc .= "} else {\n";$aolc .= "  {$jsVarName}.drawInto('{$divVarName}');\n";$aolc .= "}\n";$this->_form->addOnLoadCode($aolc);$ret .= '<div id="' . $divVarName . '"></div>';if ($addEnforceCheckbox) $ret .= $this->addEnforceCheckbox();return $this->_doElementStringFormat($ret);}
}
?>