Merge branch 'master' of github.com:gothfox/Tiny-Tiny-RSS

This commit is contained in:
Andrew Dolgov 2012-12-28 09:39:35 +04:00
commit 43e706238a
9 changed files with 80 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
define('EXPECTED_CONFIG_VERSION', 26); define('EXPECTED_CONFIG_VERSION', 26);
define('SCHEMA_VERSION', 101); define('SCHEMA_VERSION', 102);
$fetch_last_error = false; $fetch_last_error = false;
$pluginhost = false; $pluginhost = false;

View File

@ -349,7 +349,7 @@
$qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit,
$view_mode, $is_cat, $search, $search_mode, $match_on, $view_mode, $is_cat, $search, $search_mode, $match_on,
"score DESC, date_entered DESC", $offset); "score DESC, date_entered ".(mobile_get_pref($link, 'REVERSE_HEADLINES') ? 'ASC' : 'DESC'), $offset);
$result = $qfh_ret[0]; $result = $qfh_ret[0];
$feed_title = $qfh_ret[1]; $feed_title = $qfh_ret[1];

View File

@ -10,7 +10,7 @@ function toggleMarked(id, elem) {
toggled = 0; toggled = 0;
} }
var query = "?op=toggleMarked&id=" + id + "&mark=" + toggled; var query = "op=toggleMarked&id=" + id + "&mark=" + toggled;
new Ajax.Request(backend, { new Ajax.Request(backend, {
parameters: query, parameters: query,
@ -29,7 +29,7 @@ function togglePublished(id, elem) {
toggled = 0; toggled = 0;
} }
var query = "?op=togglePublished&id=" + id + "&pub=" + toggled; var query = "op=togglePublished&id=" + id + "&pub=" + toggled;
new Ajax.Request(backend, { new Ajax.Request(backend, {
parameters: query, parameters: query,
@ -49,7 +49,7 @@ function toggleUnread(id, elem) {
toggled = 0; toggled = 0;
} }
var query = "?op=toggleUnread&id=" + id + "&unread=" + toggled; var query = "op=toggleUnread&id=" + id + "&unread=" + toggled;
new Ajax.Request(backend, { new Ajax.Request(backend, {
parameters: query, parameters: query,
@ -69,7 +69,7 @@ function setPref(elem) {
toggled = 0; toggled = 0;
} }
var query = "?op=setPref&id=" + id + "&to=" + toggled; var query = "op=setPref&id=" + id + "&to=" + toggled;
new Ajax.Request(backend, { new Ajax.Request(backend, {
parameters: query, parameters: query,

View File

@ -46,4 +46,9 @@
<div class="toggle" id="SORT_FEEDS_UNREAD" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "SORT_FEEDS_UNREAD") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div> <div class="toggle" id="SORT_FEEDS_UNREAD" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "SORT_FEEDS_UNREAD") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
</div> </div>
<div class="row">
<label><?php echo __('Reverse headline order (oldest first)') ?></label>
<div class="toggle" id="REVERSE_HEADLINES" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "REVERSE_HEADLINES") ?>"><span class="thumb"></span><span class="toggleOn"><?php echo __('ON') ?></span><span class="toggleOff"><?php echo __('OFF') ?></span></div>
</div>
</fieldset> </fieldset>

View File

@ -16,12 +16,57 @@ class OwnCloud extends Plugin {
$this->host = $host; $this->host = $host;
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); $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() { function get_js() {
return file_get_contents(dirname(__FILE__) . "/owncloud.js"); return file_get_contents(dirname(__FILE__) . "/owncloud.js");
} }
function hook_prefs_tab($args) {
if ($args != "prefPrefs") return;
print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__("Owncloud")."\">";
print "<br/>";
$value = $this->host->get($this, "owncloud");
print "<form dojoType=\"dijit.form.Form\">";
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
evt.preventDefault();
if (this.validate()) {
console.log(dojo.objectToQuery(this.getValues()));
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
notify_info(transport.responseText);
}
});
}
</script>";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"owncloud\">";
print "<table width=\"100%\" class=\"prefPrefsList\">";
print "<tr><td width=\"40%\">".__("Owncloud url")."</td>";
print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"owncloud_url\" regExp='^(http|https)://.*' value=\"$value\"></td></tr>";
print "</table>";
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".__("Save")."</button>";
print "</form>";
print "</div>"; #pane
}
function hook_article_button($line) { function hook_article_button($line) {
return "<img src=\"".theme_image($this->link, "plugins/owncloud/owncloud.png")."\" return "<img src=\"".theme_image($this->link, "plugins/owncloud/owncloud.png")."\"
style=\"cursor : pointer\" style=\"cursor : pointer\" style=\"cursor : pointer\" style=\"cursor : pointer\"
@ -42,10 +87,7 @@ class OwnCloud extends Plugin {
$article_link = db_fetch_result($result, 0, 'link'); $article_link = db_fetch_result($result, 0, 'link');
} }
$own_url = ""; $own_url = $this->host->get($this, "owncloud");
if (defined('OWNCLOUD_URL')) {
$own_url = OWNCLOUD_URL;
}
print json_encode(array("title" => $title, "link" => $article_link, print json_encode(array("title" => $title, "link" => $article_link,
"id" => $id, "ownurl" => $own_url)); "id" => $id, "ownurl" => $own_url));

View File

@ -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; 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, create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null, 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('_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', update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED',
'SORT_HEADLINES_BY_FEED_DATE', 'SORT_HEADLINES_BY_FEED_DATE',
'VFEED_GROUP_BY_FEED', 'VFEED_GROUP_BY_FEED',

View File

@ -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); 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, create table ttrss_enclosures (id serial not null primary key,
content_url text not null, 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('_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', update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED',
'SORT_HEADLINES_BY_FEED_DATE', 'SORT_HEADLINES_BY_FEED_DATE',
'VFEED_GROUP_BY_FEED', 'VFEED_GROUP_BY_FEED',

View File

@ -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;

View File

@ -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;