Beispiel #1
0
/**
 * 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'] . ': ';
    if (!empty($dir[0]) && @$dir[0] == '/') {
        $dir = substr($dir, 1);
    }
    $html .= ext_selectList('favourites', $dir, $bookmarks, 1, '', 'onchange="chDir( this.options[this.options.selectedIndex].value);" style="max-width: 200px;"');
    $img_add = '<img src="' . _EXT_URL . '/images/_bookmark_add.png" border="0" alt="' . $GLOBALS['messages']['lbl_add_bookmark'] . '" align="absmiddle" />';
    $img_remove = '<img src="' . _EXT_URL . '/images/_remove.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="' . 'Ext.Msg.prompt(\'' . ext_Lang::msg('lbl_add_bookmark', true) . '\', \'' . ext_Lang::msg('enter_alias_name', true) . ':\', ' . 'function(btn, text){ ' . 'if (btn == \'ok\') { ' . 'Ext.get(\'bookmark_container\').load({ ' . 'url: \'' . basename($GLOBALS['script_name']) . '\', ' . 'scripts: true, ' . 'params: { ' . 'action:\'modify_bookmark\', ' . 'task: \'add\', ' . 'requestType: \'xmlhttprequest\', ' . 'alias: text, ' . 'dir: \'' . $dir . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); 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="' . 'Ext.Msg.confirm(\'' . ext_Lang::msg('lbl_remove_bookmark', true) . '\',\'' . ext_Lang::msg('lbl_remove_bookmark', true) . '?\', ' . 'function(btn, text){ ' . 'if (btn == \'yes\') { ' . 'Ext.get(\'bookmark_container\').load({ ' . 'url: \'' . basename($GLOBALS['script_name']) . '\', ' . 'scripts: true, ' . 'params: { ' . 'action:\'modify_bookmark\', ' . 'task: \'remove\', ' . 'dir: \'' . $dir . '\', ' . 'option: \'com_extplorer\' ' . '} ' . '}); ' . '}' . '}); return false;" title="' . $GLOBALS['messages']['lbl_remove_bookmark'] . '">' . $img_remove . '</a>';
    }
    $html .= $addlink . '&nbsp;' . $removelink;
    return $html;
}
/**
 * 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;
}