<?php
/*
* This file is part of the Booby project.
* The booby project is located at the following location:
* http://www.nauta.be/booby/
*
* Copyright (c) 2003 - 2004 Barry Nauta
*
* The Booby project is released under the General Public License
* More detailes in the file 'gpl.html' or on the following
* website: http://www.gnu.org and look for licenses
*
* Enjoy :-)
*/
require_once ("base/util/StringUtils.php");
require_once ("base/view/TreeDelegate.php");
/**
* Used in combination with the Tree renderer class
*
* @author Barry Nauta July 2003
* @package be.nauta.booby.plugins.bookmarks.view
* @copyright
*
* Copyright (c) 2003 - 2004 Barry Nauta
*
* The Booby project is released under the General Public License
* More detailes on the following
* website: <code>http://www.gnu.org</code>
* and look for licenses
*/
class BookmarkYahooTreeDelegate extends TreeDelegate
{
/**
* Default constructor
*/
function BookmarkYahooTreeDelegate ($theConfiguration)
{
parent::TreeDelegate ($theConfiguration);
}
/**
* Builds up html code to display the root of the tree
* @private
*
* @param object item the item that is the root of the tree
*/
function showRoot ($item, $tree)
{
$resultString = '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div><script language="JavaScript" src="base/view/javascript/overlib.js"><!-- overLIB (c) Erik Bosrup --></script>';
if ($item->itemId != 0)
{
$resultString .= '<h2>'.$item->name.'</h2>';
$resultString .= '<a href="'.$this->configuration['callback'];
$resultString .= '?action=show&parentId='.$item->parentId.'">';
$resultString .= $this->configuration['icons']['up'];
$resultString .= '</a><br />';
}
return $resultString;
}
/**
* If the specified item is a folder, draw it
* @private
* @param object item the item to draw
* @param boolean isExpanded whether this folder is expanded (i.e. do the
* children of this folder need to be displayed as well?)
* @param object tree the tree that uses this class as delegate
* @return string the string for this folder
*/
function drawFolder ($item, $isExpanded, $tree, $indentLevel)
{
$resultString = '<a href="';
$resultString .= $this->configuration['callback'];
$resultString .= '?action=modify&itemId=';
$resultString .= $item->itemId . '">';
$resultString .= $this->configuration['icons'] ['folder_closed'];
$resultString .= '</a>';
$resultString .= '<a href="';
$resultString .= $this->configuration['callback'];
$resultString .= '?action=show&parentId=';
$resultString .= $item->itemId . '">';
$resultString .= $item->name;
$resultString .= '</a>';
$resultString .= '<br />';
return $resultString;
}
/**
* If the specified item is a node, draw it
* @private
* @param object item the item to draw
* @param boolean lastNode whether this node is the last one
* @return string the string for this node
*/
function drawNode ($item, $lastNode, $tree, $indentLevel)
{
$resultString = '<a href="';
$resultString .= $this->configuration['callback'];
$resultString .= '?action=modify&itemId=';
$resultString .= $item->itemId . '">';
$resultString .= $this->configuration['icons']['node'];
$resultString .= '</a>';
$resultString .= "<a href='";
$resultString .= $this->configuration['callback'];
$resultString .= '?action=showBookmark&itemId=';
$resultString .= $item->itemId . "' ";
if ($this->configuration['overlib'])
{
$resultString .= $this->overLib ($item->name, $item->locator.'<br />'.$item->description);
}
if (
isset ($this->configuration['bookmarkNewWindowTarget']) &&
($this->configuration['bookmarkNewWindowTarget'] == '_blank')
)
{
$resultString .= ' target="'.$this->configuration['bookmarkNewWindowTarget'].'" ';
}
$resultString .= 'alt="'. $this->stringUtils->urlEncode ($this->stringUtils->gpcAddSlashes ($item->name)) . '">';
$resultString .= $item->name;
$resultString .= '</a>';
$resultString .= '<br />';
/*
$resultString .= '[URL]: '.$item->locator;
$resultString .= ' [VisitCount]: '.$item->visitCount;
$resultString .= ' [Visibility]: '.$item->visibility;
$resultString .= '<br />';
*/
return $resultString;
}
}
?>