1
0

Added the possibility to sort bookmarks either by name or by date.

This commit is contained in:
Stefan Frech
2008-06-28 09:32:21 +00:00
committed by Jonas Kattendick
parent 5b8f25c80f
commit 7724caf7ff
6 changed files with 73 additions and 48 deletions

View File

@@ -3,7 +3,7 @@ if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
die ("no direct access allowed");
}
function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $show_link, $show_desc, $show_date, $show_edit, $show_move, $show_delete, $show_share) {
function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $show_link, $show_desc, $show_date, $show_edit, $show_move, $show_delete, $show_share, $show_header) {
global $folderid,
$expand,
$settings,
@@ -14,7 +14,60 @@ function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $
$delete_image,
$folder_opened,
$folder_opened_public,
$date_formats;
$date_formats,
$order;
# print the bookmark header if enabled.
# Yes, it's ugly PHP code, but beautiful HTML code.
if ($show_header) {
$order[0] == 'titleasc' ? $sort_t = 'titledesc' : $sort_t = 'titledasc';
$order[0] == 'dateasc' ? $sort_d = 'datedesc' : $sort_d = 'dateasc';
echo '<div class="bookmarkcaption">' . "\n";
if ($show_folder) {
echo "\t" . '<div style="width:' . $column_width_folder . '; float: left;">&nbsp;</div>' . "\n";
}
if ($show_checkbox) {
echo "\t\t" . '<div class="bmleft">' . "\n";
echo "\t\t\t" . '<input type="checkbox" name="CheckAll" onClick="selectthem(\'checkall\', this.checked)">' . "\n";
echo "\t\t" . '</div>' . "\n";
}
if ($show_date) {
$query_data = array (
'folderid' => $folderid,
'expand' => implode (",", $expand),
'order' => $sort_d,
);
if (isset ($GLOBALS['user']) && $GLOBALS['user'] != '') {
$query_data ['user'] = $GLOBALS['user'];
}
$query_string = assemble_query_string ($query_data);
echo "\t\t" . '<div class="bmright">' . "\n";
echo "\t\t\t" . '<span class="date">' . "\n";
echo "\t\t\t\t" . '<a href="' . $_SERVER['SCRIPT_NAME'] . '?' . $query_string . '" class="f">Date <img src="./images/ascending.gif" alt=""></a>' . "\n";
echo "\t\t\t" . '</span>' . "\n";
if ($show_edit) {
echo "\t\t\t" . '<img src="./images/edit.gif" alt="" class="invisible">' . "\n";
}
if ($show_move) {
echo "\t\t\t" . '<img src="./images/move.gif" alt="" class="invisible">' . "\n";
}
if ($show_delete) {
echo "\t\t\t" . '<img src="./images/delete.gif" alt="" class="invisible">' . "\n";
}
echo "\t\t" . '</div>' . "\n";
}
echo "\t\t" . '<div class="link">' . "\n";
if ($show_icon) {
echo "\t\t\t" . '<img src="./images/bookmark_image.gif" alt="" class="invisible">' . "\n";
}
$query_data ['order'] = $sort_t;
$query_string = assemble_query_string ($query_data);
echo "\t\t\t" . '<a href="' . $_SERVER['SCRIPT_NAME'] . '?' . $query_string . '" class="f">Title <img src="./images/ascending.gif" alt=""></a>' . "\n";
echo "\t\t" . '</div>' . "\n";
echo "\t" . '</div>' . "\n\n";
}
if ($show_folder) {
require_once (ABSOLUTE_PATH . "folders.php");