From a98cd5c5264a482bb2d6daf3b3dbedf32c5a1d8e Mon Sep 17 00:00:00 2001 From: Thomas Renard Date: Thu, 27 Dec 2012 13:08:23 +0100 Subject: [PATCH 01/10] OWNCLOUD_URL parameter in config.php-dist --- config.php-dist | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config.php-dist b/config.php-dist index e0949c61e..db6ec661f 100644 --- a/config.php-dist +++ b/config.php-dist @@ -176,6 +176,11 @@ // Displays an URL for users to provide feedback or comments regarding // this instance of tt-rss. Can lead to a forum, contact email, etc. + define('OWNCLOUD_URL', ''); + // owncloud-plugin: + // This is the base url of your owncloud server as called from the browser + // Actually this is a server global parameter only + define('CONFIG_VERSION', 26); // Expected config version. Please update this option in config.php // if necessary (after migrating all new options from this file). From 741ff8f405a8556c6c8be360a10a71b735b7ce41 Mon Sep 17 00:00:00 2001 From: Thomas Renard Date: Thu, 27 Dec 2012 13:35:24 +0100 Subject: [PATCH 02/10] OWNCLOUD_URL-parameter out of config.php-dist Comment in plugins/owncloud/owncloud.php --- config.php-dist | 5 ----- plugins/owncloud/owncloud.php | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config.php-dist b/config.php-dist index db6ec661f..e0949c61e 100644 --- a/config.php-dist +++ b/config.php-dist @@ -176,11 +176,6 @@ // Displays an URL for users to provide feedback or comments regarding // this instance of tt-rss. Can lead to a forum, contact email, etc. - define('OWNCLOUD_URL', ''); - // owncloud-plugin: - // This is the base url of your owncloud server as called from the browser - // Actually this is a server global parameter only - define('CONFIG_VERSION', 26); // Expected config version. Please update this option in config.php // if necessary (after migrating all new options from this file). diff --git a/plugins/owncloud/owncloud.php b/plugins/owncloud/owncloud.php index e63ff959c..d7007e0f0 100644 --- a/plugins/owncloud/owncloud.php +++ b/plugins/owncloud/owncloud.php @@ -1,4 +1,10 @@ Date: Thu, 27 Dec 2012 13:41:29 +0100 Subject: [PATCH 03/10] the '/' is needed for some servers --- plugins/owncloud/owncloud.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/owncloud/owncloud.php b/plugins/owncloud/owncloud.php index d7007e0f0..99b7a37bd 100644 --- a/plugins/owncloud/owncloud.php +++ b/plugins/owncloud/owncloud.php @@ -1,7 +1,7 @@ Date: Thu, 27 Dec 2012 19:57:24 +0100 Subject: [PATCH 04/10] Preferences panel for owncloud (not tested yet) --- plugins/owncloud/owncloud.php | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/plugins/owncloud/owncloud.php b/plugins/owncloud/owncloud.php index 99b7a37bd..06aeda705 100644 --- a/plugins/owncloud/owncloud.php +++ b/plugins/owncloud/owncloud.php @@ -22,12 +22,58 @@ class OwnCloud extends Plugin { $this->host = $host; $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); + $host->add_hook($host::HOOK_PREFS_TAB, $this); + } + + function save() { + $owncloud_url = db_escape_string($_POST["owncloud_url"]); + $this->host->set($this, "owncloud", $owncloud_url); + echo "Value set to $owncloud_url"; } function get_js() { return file_get_contents(dirname(__FILE__) . "/owncloud.js"); } + function hook_prefs_tab($args) { + if ($args != "prefPrefs") return; + + print "
"; + + print "
"; + + $value = $this->host->get($this, "owncloud"); + print "
"; + + print ""; + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "
".__("Owncloud url")."
"; + print "

"; + + print "

"; + + print "
"; #pane + + } + function hook_article_button($line) { return "link, "plugins/owncloud/owncloud.png")."\" style=\"cursor : pointer\" style=\"cursor : pointer\" From bc230f3fde779e7f4b45c2c40ef803061e6e7227 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 28 Dec 2012 00:42:10 +0400 Subject: [PATCH 05/10] change ?op= to op= in mobile/ ajax.request (closes #523) --- mobile/mobile.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mobile/mobile.js b/mobile/mobile.js index 2771a8a40..3fed3a1d7 100644 --- a/mobile/mobile.js +++ b/mobile/mobile.js @@ -10,7 +10,7 @@ function toggleMarked(id, elem) { toggled = 0; } - var query = "?op=toggleMarked&id=" + id + "&mark=" + toggled; + var query = "op=toggleMarked&id=" + id + "&mark=" + toggled; new Ajax.Request(backend, { parameters: query, @@ -29,7 +29,7 @@ function togglePublished(id, elem) { toggled = 0; } - var query = "?op=togglePublished&id=" + id + "&pub=" + toggled; + var query = "op=togglePublished&id=" + id + "&pub=" + toggled; new Ajax.Request(backend, { parameters: query, @@ -49,7 +49,7 @@ function toggleUnread(id, elem) { toggled = 0; } - var query = "?op=toggleUnread&id=" + id + "&unread=" + toggled; + var query = "op=toggleUnread&id=" + id + "&unread=" + toggled; new Ajax.Request(backend, { parameters: query, @@ -69,7 +69,7 @@ function setPref(elem) { toggled = 0; } - var query = "?op=setPref&id=" + id + "&to=" + toggled; + var query = "op=setPref&id=" + id + "&to=" + toggled; new Ajax.Request(backend, { parameters: query, From a6b4518788d623bb2253f982146498af3d72e9ae Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 28 Dec 2012 00:49:54 +0400 Subject: [PATCH 06/10] add _MOBILE_REVERSE_HEADLINES (closes #524) --- include/functions.php | 2 +- mobile/mobile-functions.php | 2 +- mobile/prefs.php | 5 +++++ schema/ttrss_schema_mysql.sql | 4 +++- schema/ttrss_schema_pgsql.sql | 4 +++- schema/versions/mysql/102.sql | 7 +++++++ schema/versions/pgsql/102.sql | 7 +++++++ 7 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 schema/versions/mysql/102.sql create mode 100644 schema/versions/pgsql/102.sql diff --git a/include/functions.php b/include/functions.php index f0bd31831..d3dbfb073 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,6 +1,6 @@ "> +
+ +
">
+
+ diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index d4531308f..10320b5b7 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -309,7 +309,7 @@ create table ttrss_tags (id integer primary key auto_increment, create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8; -insert into ttrss_version values (101); +insert into ttrss_version values (102); create table ttrss_enclosures (id integer primary key auto_increment, content_url text not null, @@ -455,6 +455,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_ENABLED_PLUGINS', 2, '', '', 1); +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1); + update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED', 'SORT_HEADLINES_BY_FEED_DATE', 'VFEED_GROUP_BY_FEED', diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index f52d4191d..33c32d181 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -257,7 +257,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id); create table ttrss_version (schema_version int not null); -insert into ttrss_version values (101); +insert into ttrss_version values (102); create table ttrss_enclosures (id serial not null primary key, content_url text not null, @@ -395,6 +395,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_ENABLED_PLUGINS', 2, '', '', 1); +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1); + update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED', 'SORT_HEADLINES_BY_FEED_DATE', 'VFEED_GROUP_BY_FEED', diff --git a/schema/versions/mysql/102.sql b/schema/versions/mysql/102.sql new file mode 100644 index 000000000..ccf5ef3b3 --- /dev/null +++ b/schema/versions/mysql/102.sql @@ -0,0 +1,7 @@ +begin; + +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1); + +update ttrss_version set schema_version = 102; + +commit; diff --git a/schema/versions/pgsql/102.sql b/schema/versions/pgsql/102.sql new file mode 100644 index 000000000..ccf5ef3b3 --- /dev/null +++ b/schema/versions/pgsql/102.sql @@ -0,0 +1,7 @@ +begin; + +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1); + +update ttrss_version set schema_version = 102; + +commit; From 7278dc0edf3b7b06edb5e3abd301da588f12d128 Mon Sep 17 00:00:00 2001 From: Thomas Renard Date: Fri, 28 Dec 2012 00:57:36 +0100 Subject: [PATCH 07/10] save owncloud url as plugin pref --- plugins/owncloud/owncloud.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plugins/owncloud/owncloud.php b/plugins/owncloud/owncloud.php index 06aeda705..6643d0ae4 100644 --- a/plugins/owncloud/owncloud.php +++ b/plugins/owncloud/owncloud.php @@ -38,7 +38,7 @@ class OwnCloud extends Plugin { function hook_prefs_tab($args) { if ($args != "prefPrefs") return; - print "
"; + print "
"; print "
"; @@ -46,9 +46,9 @@ class OwnCloud extends Plugin { print "
"; print ""; - + print ""; print ""; print ""; print ""; print ""; - print ""; + print ""; print "
".__("Owncloud url")."
"; print "

"; - + print "

"; - + print "
"; #pane } @@ -76,17 +76,17 @@ class OwnCloud extends Plugin { function getOwnCloud() { $id = db_escape_string($_REQUEST['id']); - + $result = db_query($this->link, "SELECT title, link FROM ttrss_entries, ttrss_user_entries WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']); - + if (db_num_rows($result) != 0) { $title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')), 100, '...'); $article_link = db_fetch_result($result, 0, 'link'); } - + $own_url = $this->host->get($this, "owncloud"); print json_encode(array("title" => $title, "link" => $article_link, From e236d8763e6b1c16794668d5897dc797938cd41f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 28 Dec 2012 09:33:18 +0400 Subject: [PATCH 10/10] owncloud: rename placeholder Set value --- plugins/owncloud/owncloud.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/owncloud/owncloud.php b/plugins/owncloud/owncloud.php index 0aaf5ae40..b846241b8 100644 --- a/plugins/owncloud/owncloud.php +++ b/plugins/owncloud/owncloud.php @@ -59,7 +59,7 @@ class OwnCloud extends Plugin { print "".__("Owncloud url").""; print ""; print ""; - print "

"; + print "

"; print "";