summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-04-20 14:11:15 +0400
committerAndrew Dolgov <[email protected]>2011-04-20 14:11:15 +0400
commit9104a3e65afdb884dd2a6289ac62161d8176c555 (patch)
treefa7f068fe93cd35bc2368f34c8011af3c7808aba /modules
parent16270276cf27620d72974eb7e71f089ea8bc3bd5 (diff)
implement instance edit & save
Diffstat (limited to 'modules')
-rw-r--r--modules/backend-rpc.php7
-rw-r--r--modules/pref-instances.php64
2 files changed, 70 insertions, 1 deletions
diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php
index 8b4fb04c7..2ff9a6312 100644
--- a/modules/backend-rpc.php
+++ b/modules/backend-rpc.php
@@ -866,6 +866,13 @@
return;
}
+ if ($subop == "genHash") {
+ $hash = sha1(uniqid(rand(), true));
+
+ print json_encode(array("hash" => $hash));
+ return;
+ }
+
print json_encode(array("error" => array("code" => 7,
"message" => "Unknown method: $subop")));
}
diff --git a/modules/pref-instances.php b/modules/pref-instances.php
index 0671944d3..c57b46f35 100644
--- a/modules/pref-instances.php
+++ b/modules/pref-instances.php
@@ -5,8 +5,70 @@
if ($subop == "edit") {
- print "TODO: function not implemented.";
+ $id = db_escape_string($_REQUEST["id"]);
+ $result = db_query($link, "SELECT * FROM ttrss_linked_instances WHERE
+ id = '$id'");
+
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$id\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"editSave\">";
+
+ print "<div class=\"dlgSec\">".__("Instance")."</div>";
+
+ print "<div class=\"dlgSecCont\">";
+
+ /* URL */
+
+ $access_url = htmlspecialchars(db_fetch_result($result, 0, "access_url"));
+
+ print __("URL:") . " ";
+
+ print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
+ placeHolder=\"".__("Instance URL")."\"
+ regExp='^(http|https)://.*'
+ style=\"font-size : 16px; width: 20em\" name=\"access_url\"
+ value=\"$access_url\">";
+
+ print "<hr/>";
+
+ $access_key = htmlspecialchars(db_fetch_result($result, 0, "access_key"));
+
+ /* Access key */
+
+ print __("Access key:") . " ";
+
+ print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"
+ placeHolder=\"".__("Access key")."\"
+ style=\"width: 20em\" name=\"access_key\" id=\"instance_edit_key\"
+ value=\"$access_key\">";
+
+ print "</div>";
+
+ print "<div class=\"dlgButtons\">
+ <div style='float : left'>
+ <button dojoType=\"dijit.form.Button\"
+ onclick=\"return dijit.byId('instanceEditDlg').regenKey()\">".
+ __('Generate new key')."</button>
+ </div>
+ <button dojoType=\"dijit.form.Button\"
+ onclick=\"return dijit.byId('instanceEditDlg').execute()\">".
+ __('Save')."</button>
+ <button dojoType=\"dijit.form.Button\"
+ onclick=\"return dijit.byId('instanceEditDlg').hide()\"\">".
+ __('Cancel')."</button></div>";
+
+ return;
+ }
+
+ if ($subop == "editSave") {
+ $id = db_escape_string($_REQUEST["id"]);
+ $access_url = db_escape_string($_REQUEST["access_url"]);
+ $access_key = db_escape_string($_REQUEST["access_key"]);
+
+ db_query($link, "UPDATE ttrss_linked_instances SET
+ access_key = '$access_key', access_url = '$access_url'
+ WHERE id = '$id'");
return;
}