implement instances tab
This commit is contained in:
parent
afb875ccd7
commit
373266eb03
5 changed files with 207 additions and 8 deletions
14
backend.php
14
backend.php
|
@ -121,6 +121,7 @@
|
||||||
require_once "modules/pref-filters.php";
|
require_once "modules/pref-filters.php";
|
||||||
require_once "modules/pref-labels.php";
|
require_once "modules/pref-labels.php";
|
||||||
require_once "modules/pref-users.php";
|
require_once "modules/pref-users.php";
|
||||||
|
require_once "modules/pref-instances.php";
|
||||||
|
|
||||||
$error = sanity_check($link);
|
$error = sanity_check($link);
|
||||||
|
|
||||||
|
@ -435,6 +436,10 @@
|
||||||
module_pref_feed_browser($link);
|
module_pref_feed_browser($link);
|
||||||
break; // pref-feed-browser
|
break; // pref-feed-browser
|
||||||
|
|
||||||
|
case "pref-instances":
|
||||||
|
module_pref_instances($link);
|
||||||
|
break; // pref-instances
|
||||||
|
|
||||||
case "rss":
|
case "rss":
|
||||||
$feed = db_escape_string($_REQUEST["id"]);
|
$feed = db_escape_string($_REQUEST["id"]);
|
||||||
$key = db_escape_string($_REQUEST["key"]);
|
$key = db_escape_string($_REQUEST["key"]);
|
||||||
|
@ -504,6 +509,7 @@
|
||||||
header("Content-type: text/html");
|
header("Content-type: text/html");
|
||||||
print __("Loading, please wait...") . " " .
|
print __("Loading, please wait...") . " " .
|
||||||
"<img src='images/indicator_tiny.gif'>";
|
"<img src='images/indicator_tiny.gif'>";
|
||||||
|
break; // loading
|
||||||
|
|
||||||
case "getProfiles":
|
case "getProfiles":
|
||||||
$login = db_escape_string($_REQUEST["login"]);
|
$login = db_escape_string($_REQUEST["login"]);
|
||||||
|
@ -528,7 +534,7 @@
|
||||||
|
|
||||||
$_SESSION = array();
|
$_SESSION = array();
|
||||||
}
|
}
|
||||||
break;
|
break; // getprofiles
|
||||||
|
|
||||||
case "pubsub":
|
case "pubsub":
|
||||||
$mode = db_escape_string($_REQUEST['hub_mode']);
|
$mode = db_escape_string($_REQUEST['hub_mode']);
|
||||||
|
@ -570,17 +576,17 @@
|
||||||
header('HTTP/1.0 404 Not Found');
|
header('HTTP/1.0 404 Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break; // pubsub
|
||||||
|
|
||||||
case "logout":
|
case "logout":
|
||||||
logout_user();
|
logout_user();
|
||||||
header("Location: tt-rss.php");
|
header("Location: tt-rss.php");
|
||||||
break;
|
break; // logout
|
||||||
|
|
||||||
default:
|
default:
|
||||||
header("Content-Type: text/plain");
|
header("Content-Type: text/plain");
|
||||||
print json_encode(array("error" => array("code" => 7)));
|
print json_encode(array("error" => array("code" => 7)));
|
||||||
break;
|
break; // fallback
|
||||||
} // Select action according to $op value.
|
} // Select action according to $op value.
|
||||||
|
|
||||||
// We close the connection to database.
|
// We close the connection to database.
|
||||||
|
|
86
modules/pref-instances.php
Normal file
86
modules/pref-instances.php
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<?php
|
||||||
|
function module_pref_instances($link) {
|
||||||
|
|
||||||
|
$subop = $_REQUEST['subop'];
|
||||||
|
|
||||||
|
if ($subop == "edit") {
|
||||||
|
|
||||||
|
print "TODO: function not implemented.";
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<div id=\"pref-instance-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
|
||||||
|
print "<div id=\"pref-instance-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
|
||||||
|
|
||||||
|
print "<div id=\"pref-instance-toolbar\" dojoType=\"dijit.Toolbar\">";
|
||||||
|
|
||||||
|
$sort = db_escape_string($_REQUEST["sort"]);
|
||||||
|
|
||||||
|
if (!$sort || $sort == "undefined") {
|
||||||
|
$sort = "access_url";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<div dojoType=\"dijit.form.DropDownButton\">".
|
||||||
|
"<span>" . __('Select')."</span>";
|
||||||
|
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
|
||||||
|
print "<div onclick=\"selectTableRows('prefInstanceList', 'all')\"
|
||||||
|
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
|
||||||
|
print "<div onclick=\"selectTableRows('prefInstanceList', 'none')\"
|
||||||
|
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
|
||||||
|
print "</div></div>";
|
||||||
|
|
||||||
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"addInstance()\">".__('Link instance')."</button>";
|
||||||
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"editSelectedInstance()\">".__('Edit')."</button>";
|
||||||
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedInstances()\">".__('Remove')."</button>";
|
||||||
|
|
||||||
|
print "</div>"; #toolbar
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT * FROM ttrss_linked_instances
|
||||||
|
ORDER BY $sort");
|
||||||
|
|
||||||
|
print "<p class=\"insensitive\" style='margin-left : 1em;'>" . __("You can connect other instances of Tiny Tiny RSS to this one to share Popular feeds. Link to this instance of Tiny Tiny RSS by using this URL:");
|
||||||
|
|
||||||
|
print " <a href=\"#\" onclick=\"alert('".htmlspecialchars(get_self_url_prefix())."')\">(display url)</a>";
|
||||||
|
|
||||||
|
print "<p><table width='100%' id='prefInstanceList' class='prefInstanceList' cellspacing='0'>";
|
||||||
|
|
||||||
|
print "<tr class=\"title\">
|
||||||
|
<td align='center' width=\"5%\"> </td>
|
||||||
|
<td width=''><a href=\"#\" onclick=\"updateInstanceList('access_url')\">".__('Instance URL')."</a></td>
|
||||||
|
<td width='20%'><a href=\"#\" onclick=\"updateUsersList('last_connected')\">".__('Last connected')."</a></td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
$lnum = 0;
|
||||||
|
|
||||||
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
$class = ($lnum % 2) ? "even" : "odd";
|
||||||
|
|
||||||
|
$id = $line['id'];
|
||||||
|
$this_row_id = "id=\"LIRR-$id\"";
|
||||||
|
|
||||||
|
$line["last_connected"] = make_local_datetime($link, $line["last_connected"], false);
|
||||||
|
|
||||||
|
print "<tr class=\"$class\" $this_row_id>";
|
||||||
|
|
||||||
|
print "<td align='center'><input onclick='toggleSelectRow(this);'
|
||||||
|
type=\"checkbox\" id=\"LICHK-$id\"></td>";
|
||||||
|
|
||||||
|
$onclick = "onclick='editInstance($id, event)' title='".__('Click to edit')."'";
|
||||||
|
|
||||||
|
print "<td $onclick>" . htmlspecialchars($line['access_url']) . "</td>";
|
||||||
|
print "<td $onclick>" . htmlspecialchars($line['last_connected']) . "</td>";
|
||||||
|
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
++$lnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print "</div>"; #pane
|
||||||
|
print "</div>"; #container
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
94
prefs.js
94
prefs.js
|
@ -5,6 +5,16 @@ var hotkey_prefix_pressed = false;
|
||||||
|
|
||||||
var seq = "";
|
var seq = "";
|
||||||
|
|
||||||
|
function instancelist_callback2(transport) {
|
||||||
|
try {
|
||||||
|
dijit.byId('instanceConfigTab').attr('content', transport.responseText);
|
||||||
|
selectTab("instanceConfig", true);
|
||||||
|
notify("");
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("instancelist_callback2", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function feedlist_callback2(transport) {
|
function feedlist_callback2(transport) {
|
||||||
try {
|
try {
|
||||||
dijit.byId('feedConfigTab').attr('content', transport.responseText);
|
dijit.byId('feedConfigTab').attr('content', transport.responseText);
|
||||||
|
@ -61,6 +71,14 @@ function updateFeedList(sort_key) {
|
||||||
} });
|
} });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateInstanceList(sort_key) {
|
||||||
|
new Ajax.Request("backend.php", {
|
||||||
|
parameters: "?op=pref-instances&sort=" + param_escape(sort_key),
|
||||||
|
onComplete: function(transport) {
|
||||||
|
instancelist_callback2(transport);
|
||||||
|
} });
|
||||||
|
}
|
||||||
|
|
||||||
function updateUsersList(sort_key) {
|
function updateUsersList(sort_key) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1755,3 +1773,79 @@ function insertSSLserial(value) {
|
||||||
exception_error("insertSSLcerial", e);
|
exception_error("insertSSLcerial", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSelectedInstances() {
|
||||||
|
return getSelectedTableRowIds("prefInstanceList");
|
||||||
|
}
|
||||||
|
|
||||||
|
function addInstance() {
|
||||||
|
try {
|
||||||
|
alert("TODO: function not implemented.");
|
||||||
|
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("addInstance", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function editInstance(id, event) {
|
||||||
|
try {
|
||||||
|
if (!event || !event.ctrlKey) {
|
||||||
|
|
||||||
|
selectTableRows('prefInstanceList', 'none');
|
||||||
|
selectTableRowById('LIRR-'+id, 'LICHK-'+id, true);
|
||||||
|
|
||||||
|
var query = "backend.php?op=pref-instances&subop=edit&id=" +
|
||||||
|
param_escape(id);
|
||||||
|
|
||||||
|
if (dijit.byId("instanceEditDlg"))
|
||||||
|
dijit.byId("instanceEditDlg").destroyRecursive();
|
||||||
|
|
||||||
|
dialog = new dijit.Dialog({
|
||||||
|
id: "instanceEditDlg",
|
||||||
|
title: __("Edit Instance"),
|
||||||
|
style: "width: 600px",
|
||||||
|
href: query,
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
} else if (event.ctrlKey) {
|
||||||
|
var cb = $('LICHK-' + id);
|
||||||
|
cb.checked = !cb.checked;
|
||||||
|
toggleSelectRow(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("editInstance", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeSelectedInstances() {
|
||||||
|
try {
|
||||||
|
alert("TODO: function not implemented.");
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("removeInstance", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function editSelectedInstance() {
|
||||||
|
var rows = getSelectedInstances();
|
||||||
|
|
||||||
|
if (rows.length == 0) {
|
||||||
|
alert(__("No instances are selected."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rows.length > 1) {
|
||||||
|
alert(__("Please select only one instance."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
notify("");
|
||||||
|
|
||||||
|
editInstance(rows[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,11 @@
|
||||||
<div id="userConfigTab" dojoType="dijit.layout.ContentPane"
|
<div id="userConfigTab" dojoType="dijit.layout.ContentPane"
|
||||||
href="backend.php?op=pref-users"
|
href="backend.php?op=pref-users"
|
||||||
title="<?php echo __('Users') ?>"></div>
|
title="<?php echo __('Users') ?>"></div>
|
||||||
|
<div id="instanceConfigTab" dojoType="dijit.layout.ContentPane"
|
||||||
|
href="backend.php?op=pref-instances"
|
||||||
|
title="<?php echo __('Linked') ?>"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="footer" dojoType="dijit.layout.ContentPane" region="bottom">
|
<div id="footer" dojoType="dijit.layout.ContentPane" region="bottom">
|
||||||
|
|
17
tt-rss.css
17
tt-rss.css
|
@ -350,7 +350,11 @@ table.prefUserList tr.oddSelected,
|
||||||
table.prefFeedList tr.even,
|
table.prefFeedList tr.even,
|
||||||
table.prefFeedList tr.odd,
|
table.prefFeedList tr.odd,
|
||||||
table.prefFeedList tr.evenSelected,
|
table.prefFeedList tr.evenSelected,
|
||||||
table.prefFeedList tr.oddSelected
|
table.prefFeedList tr.oddSelected,
|
||||||
|
table.prefInstanceList tr.even,
|
||||||
|
table.prefInstanceList tr.odd,
|
||||||
|
table.prefInstanceList tr.evenSelected,
|
||||||
|
table.prefInstanceList tr.oddSelected
|
||||||
{
|
{
|
||||||
cursor : pointer;
|
cursor : pointer;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +374,11 @@ table.prefUserList tr.oddSelected:hover td,
|
||||||
table.prefFeedList tr.even:hover td,
|
table.prefFeedList tr.even:hover td,
|
||||||
table.prefFeedList tr.odd:hover td,
|
table.prefFeedList tr.odd:hover td,
|
||||||
table.prefFeedList tr.evenSelected:hover td,
|
table.prefFeedList tr.evenSelected:hover td,
|
||||||
table.prefFeedList tr.oddSelected:hover td
|
table.prefFeedList tr.oddSelected:hover td,
|
||||||
|
table.prefInstanceList tr.even:hover td,
|
||||||
|
table.prefInstanceList tr.odd:hover td,
|
||||||
|
table.prefInstanceList tr.evenSelected:hover td,
|
||||||
|
table.prefInstanceList tr.oddSelected:hover td
|
||||||
{
|
{
|
||||||
color : #88b0f0;
|
color : #88b0f0;
|
||||||
}
|
}
|
||||||
|
@ -1472,13 +1480,14 @@ div#pref-tabs .dijitContentPane h3 {
|
||||||
|
|
||||||
#pref-filter-wrap, #pref-filter-header, #pref-filter-content,
|
#pref-filter-wrap, #pref-filter-header, #pref-filter-content,
|
||||||
#pref-label-wrap, #pref-label-header, #pref-label-content,
|
#pref-label-wrap, #pref-label-header, #pref-label-content,
|
||||||
#pref-user-wrap, #pref-user-header, #pref-user-content {
|
#pref-user-wrap, #pref-user-header, #pref-user-content,
|
||||||
|
#pref-instance-wrap, #pref-instance-header, #pref-instance-content {
|
||||||
margin : 0px;
|
margin : 0px;
|
||||||
padding : 0px;
|
padding : 0px;
|
||||||
border-width : 0px;
|
border-width : 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#userConfigTab, #labelConfigTab, #filterConfigTab, #pref-feeds-feeds {
|
#userConfigTab, #labelConfigTab, #filterConfigTab, #pref-feeds-feeds, #instanceConfigTab {
|
||||||
padding : 0px;
|
padding : 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue