function te_admin_toolbox()
{
    global $thinkedit;
    if ($thinkedit->user->isAdmin()) {
        $out = '';
        // todo move style sheet somewhere, but this one is common to all designs, and designs author can what they want
        $out .= '
				<style>
				.admin_toolbox
				{
						position: absolute;
						position: fixed;
						top: 1em;
						right: 1em;
						width: 8em;
						background-color : white;
						padding: 1em;
				}
				
				.admin_toolbox_button
				{
						background-color : #0080ff;
						/*margin: 5px;*/
						padding: 5px;
						display: block;
						text-decoration: none;
						color: white;
				}
				
				</style>
				';
        $out .= '<div class="admin_toolbox">';
        $url = new url();
        $url->keep('node_id');
        $url->set('refresh', 1);
        $out .= '<br/>';
        $out .= '<a href="' . $url->render() . '" class="admin_toolbox_button">' . te_translate('refresh') . '</a>';
        $url = new url();
        $url->keep('node_id');
        $url->set('clear_cache', 1);
        $out .= '<br/>';
        $out .= '<a href="' . $url->render() . '" class="admin_toolbox_button">' . te_translate('clear_cache') . '</a>';
        $url = new url();
        $url->keep('node_id');
        $out .= '<br/>';
        $out .= '<a href="' . $url->render('./edit/structure.php') . '" target="_blank" class="admin_toolbox_button">' . te_translate('edit') . '</a>';
        $out .= '</div>';
        $out .= 'Total Queries : ' . $thinkedit->db->getTotalQueries();
        $out .= '<br/>';
        $out .= 'Total time : ' . $thinkedit->timer->render();
        global $db_debug;
        if (isset($db_debug)) {
            if (!$thinkedit->isInProduction()) {
                foreach ($db_debug as $sql) {
                    $out .= "<li>{$sql}</li>";
                }
            } else {
                $out .= "<li>SQL not shown in production mode</li>";
            }
        }
        return $out;
    } else {
        return false;
    }
}
        $url = new url();
        $url->keep('path');
        $url->set('file_to_delete', $child->getPath());
        $url->set('action', 'delete');
        $file['delete_url'] = $url->render();
        $out['files'][] = $file;
    }
}
// handle add folder
// handle remove folder
// handle sync with folder
// define action buttons urls
$url = new url();
$url->keep('path');
$url->set('action', 'add_folder');
$out['add_folder_url'] = $url->render();
$url = new url();
$url->keep('path');
$url->set('action', 'upload_file');
$out['upload_file_url'] = $url->render();
// add breadcrumb
$url = new url();
$out['breadcrumb'][1]['title'] = translate('filemanager_title');
$out['breadcrumb'][1]['url'] = $url->render();
debug($out, 'OUT');
//print_a($out);
// include template :
include 'header.template.php';
include 'file_manager.template.php';
//include('list.template.php');
include 'footer.template.php';
function te_admin_toolbox()
{
    global $te_admin_toolbox_written;
    if (!isset($te_admin_toolbox_written)) {
        $te_admin_toolbox_written = true;
        global $thinkedit;
        if ($thinkedit->user->isAdmin()) {
            $out = '';
            // add jquery code
            $out = te_jquery();
            // todo move style sheet somewhere, but this one is common to all designs, and designs author can do what they want with it
            // done, file is in /edit/toolbar.css
            $out .= '<link type="text/css" href="' . ROOT_URL . '/edit/ressource/css/toolbar.css" rel="stylesheet" media="screen"/>';
            $out .= '<div class="te_tools">';
            $out .= '<div class="te_toolbar">';
            $out .= '<div class="te_toolbar_logo">';
            $out .= '<b>ThinkEDIT</b>';
            // todo add version number automagically
            $out .= '</div>';
            // logout
            $url = $thinkedit->newUrl();
            $out .= '<a href="' . ROOT_URL . '/edit/logout.php" class="te_toolbar_button">' . translate('logout') . '</a>';
            // refresh page link
            $url = new url();
            $url->keep('node_id');
            $url->set('refresh', 1);
            $out .= '<a href="' . $url->render() . '" class="te_toolbar_button">' . translate('refresh_page') . '</a>';
            // refresh site link
            $url = new url();
            $url->keep('node_id');
            $url->set('clear_cache', 1);
            $out .= '<a href="' . $url->render() . '" class="te_toolbar_button">' . translate('refresh_site') . '</a>';
            // edit page link
            $url = new url();
            $url->keep('node_id');
            $out .= '<a href="' . $url->render('./edit/structure.php') . '" target="_blank" class="te_toolbar_button">' . translate('edit') . '</a>';
            // show hide profiling
            $out .= '<a class="te_toolbar_button" onclick="$(\'.te_profiling\').toggle()">' . translate('toggle_profiling') . '</a>';
            // show hide errors
            if (isset($thinkedit->errors)) {
                $out .= '<a class="te_toolbar_button te_toolbar_error_button" onclick="$(\'.te_error_log\').toggle()">' . translate('toggle_errors') . '</a>';
            }
            $out .= '</div>';
            // end of toolbar
            $out .= '<div class="te_profiling te_console" style="display: none">';
            $out .= 'Total Queries : ' . $thinkedit->db->getTotalQueries();
            $out .= '<br/>';
            $out .= 'Total time : ' . $thinkedit->timer->render();
            global $db_debug;
            if (isset($db_debug)) {
                if (!$thinkedit->isInProduction()) {
                    foreach ($db_debug as $sql) {
                        $out .= "<li>{$sql}</li>";
                    }
                } else {
                    $out .= "<li>SQL not shown in production mode</li>";
                }
            }
            $out .= '</div>';
            // end of profiling
            // include error log
            $out .= te_error_log();
            $out .= '</div>';
            // end of tools
            return $out;
        } else {
            return false;
        }
    }
}
    // if we are in root
    if ($we_are_root) {
        $nodes[] = $current_node;
    } else {
        if ($current_node->hasChildren()) {
            $nodes = $current_node->getChildren();
        }
    }
    if (isset($nodes) && is_array($nodes)) {
        $i = 0;
        foreach ($nodes as $node_item) {
            $content = $node_item->getContent();
            $content->load();
            $item['title'] = te_short($content->getTitle(), 40);
            $item['icon'] = $content->getIcon();
            $url = new url();
            $url->keep('class');
            $url->keep('mode');
            $url->set('node_id', $node_item->getId());
            $item['visit_url'] = $url->render();
            if ($mode == 'relation') {
                $url->addObject($node_item, 'target_');
                $url->set('action', 'relate');
                $item['url'] = $url->render('relation.php');
            }
            $out['items'][] = $item;
        }
    }
}
debug($out, 'OUT');
include 'browser.template.php';
            $out['data'][$item->getId()]['field'][$field->getName()] = substr($field->get(), 0, 20);
            // $out['data'][$item['id']][$item['locale']][$key] = substr($val, 0, 15);
        }
    }
    $i++;
}
// -----------------------------
//handle pagination
// -----------------------------
if ($record_count > 25) {
    // find number of pages
    $number_of_pages = intval($record_count / 25) + 1;
    for ($i = 0; $i < $number_of_pages; $i++) {
        $out['pagination'][$i]['title'] = $i + 1;
        $url = new url();
        $url->keep('class');
        $url->keep('type');
        $url->keep('sort');
        $url->set('page', $i);
        $out['pagination'][$i]['url'] = $url->render();
        $url = new url();
        if ($url->get('page') == $i) {
            $out['pagination'][$i]['current'] = true;
        }
    }
    //echo $number_of_pages;
    // create pages array
}
/*
echo '<pre>';
print_r($out['pagination']);