I can has sortable feedlist plz?

orig_fof
steveminutillo 2007-07-11 02:55:47 +00:00
parent 94052b834a
commit 8d278c3a6e
4 changed files with 83 additions and 34 deletions

View File

@ -67,6 +67,8 @@ class FoF_Prefs
"direction" => "desc",
"howmany" => 50,
"sharing" => "no",
"feed_order" => "feed_title",
"feed_direction" => "asc",
);
$admin_defaults = array(

15
fof.js
View File

@ -535,6 +535,21 @@ function delete_tag(tag)
return false;
}
function change_feed_order(order, direction)
{
throb();
var url = "set-prefs.php";
var params = "feed_order=" + order + "&feed_direction=" + direction;
var complete = function () { refreshlist(); };
var options = { method: 'post', parameters: params, onComplete: complete };
new Ajax.Request(url, options);
return false;
}
function toggle_favorite(id)
{
throb();

26
set-prefs.php Normal file
View File

@ -0,0 +1,26 @@
<?php
/*
* This file is part of FEED ON FEEDS - http://feedonfeeds.com/
*
* set-prefs.php - interface for changing prefs from javascript
*
*
* Copyright (C) 2004-2007 Stephen Minutillo
* steve@minutillo.com - http://minutillo.com/steve/
*
* Distributed under the GPL - see LICENSE
*
*/
include_once("fof-main.php");
$prefs =& FoF_Prefs::instance();
foreach($_POST as $k => $v)
{
$prefs->set($k, $v);
}
$prefs->save();
?>

View File

@ -38,18 +38,8 @@ fof_set_content_type();
<?php
$order = $_GET['order'];
$direction = $_GET['direction'];
if(!isset($order))
{
$order = "feed_title";
}
if(!isset($direction))
{
$direction = "asc";
}
$order = $fof_prefs_obj->get('feed_order');
$direction = $fof_prefs_obj->get('feed_direction');
if(!isset($_GET['what']))
{
@ -172,30 +162,46 @@ foreach($tags as $tag)
<?php
$title["age"] = "sort by last update time";
$title["unread"] = "sort by number of unread items";
$title["title"] = "sort by feed title";
$title["feed_age"] = "sort by last update time";
$title["max_date"] = "sort by last new item";
$title["feed_unread"] = "sort by number of unread items";
$title["feed_url"] = "sort by feed URL";
$title["feed_title"] = "sort by feed title";
foreach (array("age", "latest", "unread", "feed", "title") as $col)
$name["feed_age"] = "age";
$name["max_date"] = "latest";
$name["feed_unread"] = "#";
$name["feed_url"] = "feed";
$name["feed_title"] = "title";
foreach (array("feed_age", "max_date", "feed_unread", "feed_url", "feed_title") as $col)
{
echo "<td><nobr>";
if($col == "unread")
{
echo "<span class=\"unread\">#</span>";
}
else
{
echo $col;
}
if($col == $order)
{
echo ($direction == "asc") ? "&darr;" : "&uarr;";
}
echo "</nobr></td>";
if($col == $order)
{
$url = "return change_feed_order('$col', '" . ($direction == "asc" ? "desc" : "asc") . "')";
}
else
{
$url = "return change_feed_order('$col', 'asc')";
}
echo "<td><nobr><a href='#' title='$title[$col]' onclick=\"$url\">";
if($col == "feed_unread")
{
echo "<span class=\"unread\">#</span>";
}
else
{
echo $name[$col];
}
if($col == $order)
{
echo ($direction == "asc") ? "&darr;" : "&uarr;";
}
echo "</a></nobr></td>";
}
?>