]> git.wh0rd.org - tt-rss.git/commitdiff
rework the way DEFAULT_ARTICLE_LIMIT works, remove limit toolbar dropdown (bump schema)
authorAndrew Dolgov <fox@bah.org.ru>
Mon, 4 Jan 2010 09:12:31 +0000 (12:12 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Mon, 4 Jan 2010 09:12:31 +0000 (12:12 +0300)
backend.php
modules/pref-prefs.php
sanity_check.php
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql
schema/versions/mysql/61.sql [new file with mode: 0644]
schema/versions/pgsql/61.sql [new file with mode: 0644]
tt-rss.js
tt-rss.php
viewfeed.js

index e1cc82a1280bde611be93f63f1966ad5c749e050..f1b9cd34370e5873b8bc061a45310a48f0dc4bcb 100644 (file)
                        $feed = db_escape_string($_REQUEST["feed"]);
                        $subop = db_escape_string($_REQUEST["subop"]);
                        $view_mode = db_escape_string($_REQUEST["view_mode"]);
-                       $limit = db_escape_string($_REQUEST["limit"]);
+                       $limit = (int) get_pref($link, "DEFAULT_ARTICLE_LIMIT");
                        $cat_view = db_escape_string($_REQUEST["cat"]);
                        $next_unread_feed = db_escape_string($_REQUEST["nuf"]);
                        $offset = db_escape_string($_REQUEST["skip"]);
index 8159f0f01282e8006d0f09eec5b8fbf593a153e7..7d1c95d491c82585d80bf4f3eff85eb03faa7932 100644 (file)
 
 //                                     print "$pref_name : $type_name : $value<br>";
 
+                                       if ($pref_name == 'DEFAULT_ARTICLE_LIMIT' && $value == 0) {
+                                               $value = 30;
+                                       }
+
                                        db_query($link, "UPDATE ttrss_user_prefs SET value = '$value' 
                                                WHERE pref_name = '$pref_name' AND owner_uid = ".$_SESSION["uid"]);
 
index b8384a61a834fd3c52e6b1cae16600f1981688b5..00c7925c4873d587de86d28a28cbdd83348f2668 100644 (file)
@@ -2,7 +2,7 @@
        require_once "functions.php";
 
        define('EXPECTED_CONFIG_VERSION', 18);
-       define('SCHEMA_VERSION', 60);
+       define('SCHEMA_VERSION', 61);
 
        if (!file_exists("config.php")) {
                print "<b>Fatal Error</b>: You forgot to copy 
index 68611c94e13c890cbf25afafdf536177f3b4dbac..878f5a9005cdba6a1e7b1c852385a81edb64096e 100644 (file)
@@ -238,7 +238,7 @@ create table ttrss_tags (id integer primary key auto_increment,
 
 create table ttrss_version (schema_version int not null) TYPE=InnoDB;
 
-insert into ttrss_version values (60);
+insert into ttrss_version values (61);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
@@ -282,8 +282,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
    'Experimental support for virtual feeds based on user crafted SQL queries. This feature is highly experimental and at this point not user friendly. Use with caution.');
 
 insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 'Default interval between feed updates (in minutes)',1);
-insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DEFAULT_ARTICLE_LIMIT', 3, '0', 'Default article limit',2,
-   'Default limit for articles to display, any custom number you like (0 - disables).');
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 'Amount of articles to display at once',2);
 
 insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ALLOW_DUPLICATE_POSTS', 1, 'true', 'Allow duplicate posts',1,
        'This option is useful when you are reading several planet-type aggregators with partially colliding userbase. When disabled, it forces same posts from different feeds to appear only once.');
index f2b0e808dd5b61b78d3ea41d7ec595735235f5d3..93791ebb2c3f4ccf838cd20825be4b85e308da73 100644 (file)
@@ -210,7 +210,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
 
 create table ttrss_version (schema_version int not null);
 
-insert into ttrss_version values (60);
+insert into ttrss_version values (61);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
@@ -248,8 +248,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
        'Experimental support for virtual feeds based on user crafted SQL queries. This feature is highly experimental and at this point not user friendly. Use with caution.');
        
 insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DEFAULT_UPDATE_INTERVAL', 3, '30', 'Default interval between feed updates (in minutes)',1);
-insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DEFAULT_ARTICLE_LIMIT', 3, '0', 'Default article limit',2,
-       'Default limit for articles to display, any custom number you like (0 - disables).');
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('DEFAULT_ARTICLE_LIMIT', 3, '30', 'Amount of articles to display at once',2);
 
 insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ALLOW_DUPLICATE_POSTS', 1, 'true', 'Allow duplicate posts',1,
        'This option is useful when you are reading several planet-type aggregators with partially colliding userbase. When disabled, it forces same posts from different feeds to appear only once.');
diff --git a/schema/versions/mysql/61.sql b/schema/versions/mysql/61.sql
new file mode 100644 (file)
index 0000000..209a7ba
--- /dev/null
@@ -0,0 +1,9 @@
+begin;
+
+update ttrss_prefs set short_desc = 'Amount of articles to display at once', help_text = '', def_value = '30' where pref_name = 'DEFAULT_ARTICLE_LIMIT';
+
+update ttrss_user_prefs set value = '30' where pref_name = 'DEFAULT_ARTICLE_LIMIT' and value = '0';
+
+update ttrss_version set schema_version = 61;
+
+commit;
diff --git a/schema/versions/pgsql/61.sql b/schema/versions/pgsql/61.sql
new file mode 100644 (file)
index 0000000..209a7ba
--- /dev/null
@@ -0,0 +1,9 @@
+begin;
+
+update ttrss_prefs set short_desc = 'Amount of articles to display at once', help_text = '', def_value = '30' where pref_name = 'DEFAULT_ARTICLE_LIMIT';
+
+update ttrss_user_prefs set value = '30' where pref_name = 'DEFAULT_ARTICLE_LIMIT' and value = '0';
+
+update ttrss_version set schema_version = 61;
+
+commit;
index 82472729138534a40f1b52d78e100e7fd210e798..27432be752a58ceea760faf254e919046a6df6bc 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -514,7 +514,6 @@ function init_second_stage() {
                var toolbar = document.forms["main_toolbar_form"];
 
                dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode"));
-               dropboxSelect(toolbar.limit, getInitParam("default_view_limit"));
                dropboxSelect(toolbar.order_by, getInitParam("default_view_order_by"));
 
                daemon_enabled = getInitParam("daemon_enabled") == 1;
index de08e7a9cff5a5b0c7d8eb50fd0d99ded069aec2..eb607a20d8c9ed85090ccea701c5bc54e7c70486 100644 (file)
 
                <?php } ?>
 
-               <select name="view_mode" onchange="viewModeChanged()">
+               <select name="view_mode" title="<?php echo __('Show articles') ?>" 
+                               onchange="viewModeChanged()">
                        <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
                        <option value="all_articles"><?php echo __('All Articles') ?></option>
                        <option value="marked"><?php echo __('Starred') ?></option>
                        <option value="updated"><?php echo __('Updated') ?></option>
                </select>
 
-               <?php echo __('Order:') ?>
+               &nbsp;
 
-               <select name="order_by" onchange="viewModeChanged()">
+               <select title="<?php echo __('Sort articles') ?>" 
+                               name="order_by" onchange="viewModeChanged()">
                        <option selected="selected" value="default"><?php echo __('Default') ?></option>
                        <option value="date"><?php echo __('Date') ?></option>
                        <option value="title"><?php echo __('Title') ?></option>
                        <option value="score"><?php echo __('Score') ?></option>
                </select>
 
-               <?php echo __('Limit:') ?>
-               <?php
-               $limits = array(15 => 15, 30 => 30, 60 => 60, 0 => __("All"));
-                       
-               $def_art_limit = get_pref($link, 'DEFAULT_ARTICLE_LIMIT');
-
-               if ($def_art_limit >= 0 && !array_key_exists($def_art_limit, $limits)) {
-                       $limits[$def_art_limit] = $def_art_limit; 
-               }
-
-               asort($limits);
-
-               if (!$def_art_limit) {
-                       $def_art_limit = 30;
-               }
-
-               print_select_hash("limit", $def_art_limit, $limits, 
-                       'onchange="viewLimitChanged()"');
-
-               ?>              
-
                &nbsp;
 
                <input class="button" type="submit" name="update"
index 99bab234e13ef66bf85b0b2498d29d445e74958b..ad7e14553aaf2383778858db9f39236e3e0ed165 100644 (file)
@@ -2011,21 +2011,15 @@ function headlines_scroll_handler() {
 
                var e = $("headlinesInnerContainer");
 
-               // don't do infinite scrolling when Limit == All
-
                var toolbar_form = document.forms["main_toolbar_form"];
 
-               var limit = toolbar_form.limit[toolbar_form.limit.selectedIndex];
-               if (limit.value != 0) {
-               
-                       debug((e.scrollTop + e.offsetHeight) + " vs " + e.scrollHeight + " dis? " +
-                               _infscroll_disable);
+               debug((e.scrollTop + e.offsetHeight) + " vs " + e.scrollHeight + " dis? " +
+                       _infscroll_disable);
 
-                       if (e.scrollTop + e.offsetHeight > e.scrollHeight - 100) {
-                               if (!_infscroll_disable) {
-                                       debug("more cowbell!");
-                                       viewNextFeedPage();
-                               }
+               if (e.scrollTop + e.offsetHeight > e.scrollHeight - 100) {
+                       if (!_infscroll_disable) {
+                               debug("more cowbell!");
+                               viewNextFeedPage();
                        }
                }