function parametersDidLoad($page, $params) { new WFYAHOO_widget_Logger('logger', $page); // static $treeItemsAll = array('Portals' => new WFYAHOO_widget_TreeViewNode('Portals'), 'Search Engines' => new WFYAHOO_widget_TreeViewNode('Search Engines')); $treeItemsAll['Portals']->addChild(new WFYAHOO_widget_TreeViewNode('Yahoo', '<a href="http://www.yahoo.com">Yahoo</a>')); $treeItemsAll['Portals']->addChild(new WFYAHOO_widget_TreeViewNode('MSN', '<a href="http://www.msn.com">MSN</a>')); $n31 = new WFYAHOO_widget_TreeViewNode('Google', '<a href="http://www.Google.com">Google</a>'); $treeItemsAll['Search Engines']->addChild($n31); $n31->addChild(new WFYAHOO_widget_TreeViewNode('Local', '<a href="http://www.google.com/local">Google Local</a>')); $n31->addChild(new WFYAHOO_widget_TreeViewNode('Froogle', '<a href="http://froogle.google.com">Google Froogle</a>')); $treeItemsAll['Search Engines']->addChild(new WFYAHOO_widget_TreeViewNode('Ask Jeeves', '<a href="http://www.ask.com">Ask Jeeves</a>')); $treeView = new WFYAHOO_widget_TreeView('yuiTreeStatic', $page); $treeView->setValue($treeItemsAll); // dynamic $treeView = new WFYAHOO_widget_TreeView('yuiTreeDynamic', $page); $treeView->setDynamicDataLoader('randomNodes'); }
function render($blockContent = NULL) { if ($this->hidden or $this->dieselSearchHelper->isFilteringOnAttribute($this->attributeID)) { return NULL; } else { // set up stuff we'll use while rendering if ($this->class) { $classHTML = " class=\"{$this->class}\" "; } // output facet nav try { $Array = new JavaClass("java.lang.reflect.Array"); $facets = $this->prepareFacets(); if (gettype($facets) == 'array') { if ($this->facetStyle == WFDieselFacet::STYLE_TREE and $this->treeDataPath) { // no items, but means specifically "no kids" thus need to deal with this for the Tree callback // ajax callback -- send data WFYAHOO_widget_TreeView::sendTree(array()); } return NULL; } if (gettype($facets) == 'object' and $Array->getLength($facets) == 0) { return NULL; } // also no items // sanity check if ($this->facetStyle == WFDieselFacet::STYLE_MENU and $this->isTaxonomyAttribute()) { throw new Exception("STYLE_MENU does not support taxonomy attributes."); } if ($this->facetStyle == WFDieselFacet::STYLE_MENU and $this->rangeCount) { throw new Exception("STYLE_MENU does not support range display."); } // output! $html = ''; if ($this->label) { $html .= "<span style=\"font-weight: bold; white-space: nowrap;\">{$this->label}</span><br />\n"; } $width = $this->width ? "width: {$this->width};" : NULL; $height = $this->isPopup ? '300px' : ($this->height ? $this->height : $this->parent()->facetNavHeight()); // NOTE: Safari seems to have a bug where even tho the content fits within the width, it still puts a scroll bar. Works in FF, not sure about IE yet. $html .= '<div style="max-height: ' . $height . '; overflow: auto; padding-right: 4px;' . $width . '">' . "\n"; // actual facets switch ($this->facetStyle) { case WFDieselFacet::STYLE_MENU: $html .= $this->facetMenuHTML($facets); break; case WFDieselFacet::STYLE_TREE: // set up "root" YUITree $tree = new WFYAHOO_widget_TreeView('tree_' . $this->id(), $this->page); $items = array(); foreach ($facets as $facet) { $label = str_replace("\n", '', $this->facetHTML($facet)); $item = new WFYAHOO_widget_TreeViewNode(java_values($facet->getAttributeValue()), $label); $fkids = $facet->getChildren(); if ($fkids === null) { $item->setCouldHaveChildren(false); } $items[] = $item; } $tree->setValue($items); $tree->setDynamicCallback($this->parent()->baseURL() . '/' . urlencode($this->dieselSearchHelper->getQueryState($this->attributeID())) . '//' . $this->id() . '|'); if ($this->treeDataPath) { // ajax callback -- send data WFYAHOO_widget_TreeView::sendTree($items); } else { // initial display of first row of items $html .= $tree->render(); } break; default: foreach ($facets as $facet) { $html .= $this->facetHTML($facet); } if ($this->maxRows != WFDieselFacet::UNLIMITED_ROWS and $Array->getLength($facets) == $this->maxRows) { $html .= $this->editFacetLink('More...', $this->class); } else { if ($this->maxRows == WFDieselFacet::UNLIMITED_ROWS and $Array->getLength($facets) == $this->maxRows) { $html .= "<p>There are too many choices to dislpay at this time. Please narrow your search by other criteria and try again.</p>"; } } break; } $html .= '</div>'; return $html; } catch (JavaException $e) { $trace = new java("java.io.ByteArrayOutputStream"); $e->printStackTrace(new java("java.io.PrintStream", $trace)); throw new Exception("java stack trace:<pre> {$trace} </pre>\n"); } } }