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
define('EXPECTED_CONFIG_VERSION', 26);
define('SCHEMA_VERSION', 101);
define('SCHEMA_VERSION', 102);
$fetch_last_error = false;
$pluginhost = false;

View file

@ -349,7 +349,7 @@
$qfh_ret = queryFeedHeadlines($link, $feed_id, $limit,
$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];
$feed_title = $qfh_ret[1];

View file

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

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

View file

@ -16,12 +16,57 @@ 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 "<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) {
return "<img src=\"".theme_image($this->link, "plugins/owncloud/owncloud.png")."\"
style=\"cursor : pointer\" style=\"cursor : pointer\"
@ -31,21 +76,18 @@ 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 = "";
if (defined('OWNCLOUD_URL')) {
$own_url = OWNCLOUD_URL;
}
$own_url = $this->host->get($this, "owncloud");
print json_encode(array("title" => $title, "link" => $article_link,
"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;
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',

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);
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',

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;