$root['type'] = 'category';
if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
+ $show_empty_cats = get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
$result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories
WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title");
$cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
- if (count($cat['items']) > 0)
+ if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
$root['param'] += count($cat['items']);
$cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
- if (count($cat['items']) > 0)
+ if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
$root['param'] += count($cat['items']);
return;
}
+ function togglehiddenfeedcats() {
+ set_pref($this->link, '_PREFS_SHOW_EMPTY_CATS',
+ (get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS') ? 'false' : 'true'));
+ }
+
function savefeedorder() {
$data = json_decode($_POST['payload'], true);
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"editFeedCats()\"
dojoType=\"dijit.MenuItem\">".__('Edit categories')."</div>";
+ print "<div onclick=\"toggleHiddenFeedCats()\"
+ dojoType=\"dijit.MenuItem\">".__('(Un)hide empty categories')."</div>";
print "<div onclick=\"resetCatOrder()\"
dojoType=\"dijit.MenuItem\">".__('Reset sort order')."</div>";
print "</div></div>";
} else {
define('EXPECTED_CONFIG_VERSION', 25);
- define('SCHEMA_VERSION', 89);
+ define('SCHEMA_VERSION', 90);
require_once "config.php";
require_once "sanity_config.php";
}
}
+function toggleHiddenFeedCats() {
+ try {
+ notify_progress("Loading, please wait...");
+
+ new Ajax.Request("backend.php", {
+ parameters: "?op=pref-feeds&method=togglehiddenfeedcats",
+ onComplete: function(transport) {
+ updateFeedList();
+ } });
+
+ } catch (e) {
+ exception_error("toggleHiddenFeedCats");
+ }
+}
+
function editCat(id, item, event) {
try {
var new_name = prompt(__('Rename category to:'), item.name);
create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
-insert into ttrss_version values (89);
+insert into ttrss_version values (90);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_PREFERRED_TIME', 2, '00:00', 'Try to send digests around specified time', 1, 'Uses UTC timezone');
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_SHOW_EMPTY_CATS', 1, 'false', '', 1);
+
create table ttrss_user_prefs (
owner_uid integer not null,
pref_name varchar(250),
create table ttrss_version (schema_version int not null);
-insert into ttrss_version values (89);
+insert into ttrss_version values (90);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_PREFERRED_TIME', 2, '00:00', 'Try to send digests around specified time', 1, 'Uses UTC timezone');
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_SHOW_EMPTY_CATS', 1, 'false', '', 1);
+
create table ttrss_user_prefs (
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
--- /dev/null
+begin;
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_SHOW_EMPTY_CATS', 1, 'false', '', 1);
+
+update ttrss_version set schema_version = 90;
+
+commit;
--- /dev/null
+begin;
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_PREFS_SHOW_EMPTY_CATS', 1, 'false', '', 1);
+
+update ttrss_version set schema_version = 90;
+
+commit;