/**
 * Lists all bookmarked directories in a dropdown list.
 *
 * @param string $dir
 */
function list_bookmarks($dir)
{
    $bookmarks = read_bookmarks();
    $bookmarks = array_flip($bookmarks);
    foreach ($bookmarks as $bookmark) {
        $len = strlen($bookmark);
        if ($len > 40) {
            $first_part = substr($bookmark, 0, 20);
            $last_part = substr($bookmark, -20);
            $bookmarks[$bookmark] = $first_part . '...' . $last_part;
        }
    }
    $html = $GLOBALS['messages']['quick_jump'] . ': ';
    $html .= nx_selectList('dirselector', $dir, $bookmarks, 1, '', 'onchange="document.location=\'' . make_link('list', null) . '&dir=\' + this.options[this.options.selectedIndex].value;" style="max-width: 100px;"');
    $img_add = '<img src="' . _QUIXPLORER_URL . '/images/award_star_add.png" border="0" alt="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" align="absmiddle" />';
    $img_remove = '<img src="' . _QUIXPLORER_URL . '/images/award_star_delete.png" border="0" alt="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '" align="absmiddle" />';
    $addlink = $removelink = '';
    if (!isset($bookmarks[$dir]) && $dir != '' && $dir != '/') {
        $addlink = '<a href="' . make_link('modify_bookmark', $dir) . '&task=add" onclick="var alias = prompt(\'' . $GLOBALS['messages']['enter_alias_name'] . ':\', \'' . $dir . '\');if( alias==\'\' || alias == null )return false; adder = new Ajax(\'' . make_link('modify_bookmark', $dir) . '&task=add&alias=\' + alias, { method: \'get\', postBody: \'action=modify_bookmark&task=add&dir=' . $dir . '&alias=\' + alias + \'&option=com_osefileman\', evalScripts:true, update: \'quick_jumpto\' } );adder.request(); return false;" title="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" >' . $img_add . '</a>';
    } elseif ($dir != '' && $dir != '/') {
        $removelink = '<a href="' . make_link('modify_bookmark', $dir) . '&task=remove" onclick="remover = new Ajax(\'' . make_link('modify_bookmark', $dir) . '&task=remove\', { method: \'get\', update: \'quick_jumpto\', postBody: \'action=modify_bookmark&task=remove&dir=' . $dir . '&option=com_osefileman\', evalScripts:true } );remover.request(); return false;"  title="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '">' . $img_remove . '</a>';
    }
    $html .= $addlink . '&nbsp;' . $removelink;
    return $html;
}
Beispiel #2
0
function get_dir_selects($dir)
{
    $dirs = explode("/", $dir);
    $subdirs = get_dir_list();
    if (empty($dirs[0])) {
        array_shift($dirs);
    }
    $dirsCopy = $dirs;
    $implode = '';
    $selectedDir = @$dirs[0];
    $dir_links = nx_selectList('dirselect1', $selectedDir, $subdirs, 1, '', 'onchange="theDir=this.options[this.selectedIndex].value;if(theDir!=\'nx_disabled\' ) chDir(theDir);"');
    $i = 2;
    foreach ($dirs as $directory) {
        if ($directory != "") {
            $implode .= $directory;
            $next = next($dirsCopy);
            $subdirs = get_dir_list($implode);
            if ($next !== false) {
                $selectedDir .= '/' . $next;
            } else {
                if (sizeof($subdirs) > 0) {
                    $subdirs = array_merge(array('nx_disabled' => '-'), $subdirs);
                }
            }
            $dir_links .= ' / ' . nx_selectList('dirselect' . $i++, $selectedDir, $subdirs, 1, '', 'onchange="theDir=this.options[this.selectedIndex].value;if(theDir!=\'nx_disabled\' ) chDir(theDir);"');
            $implode .= '/';
        }
    }
    return $dir_links;
}