allow setting update interval in subcribe to feed dialog
This commit is contained in:
@@ -567,8 +567,16 @@ class Feeds extends Handler_Protected {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function subscribeToFeed(): void {
|
function subscribeToFeed(): void {
|
||||||
|
global $update_intervals;
|
||||||
|
|
||||||
|
$local_update_intervals = $update_intervals;
|
||||||
|
$local_update_intervals[0] .= sprintf(" (%s)", $update_intervals[Prefs::get(Prefs::DEFAULT_UPDATE_INTERVAL, $_SESSION['uid'])]);
|
||||||
|
|
||||||
print json_encode([
|
print json_encode([
|
||||||
"cat_select" => \Controls\select_feeds_cats("cat")
|
"cat_select" => \Controls\select_feeds_cats("cat"),
|
||||||
|
"intervals" => [
|
||||||
|
"update" => $local_update_intervals
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,8 +989,9 @@ class Feeds extends Handler_Protected {
|
|||||||
$need_auth = isset($_REQUEST['need_auth']);
|
$need_auth = isset($_REQUEST['need_auth']);
|
||||||
$login = $need_auth ? clean($_REQUEST['login']) : '';
|
$login = $need_auth ? clean($_REQUEST['login']) : '';
|
||||||
$pass = $need_auth ? clean($_REQUEST['pass']) : '';
|
$pass = $need_auth ? clean($_REQUEST['pass']) : '';
|
||||||
|
$update_interval = (int) clean($_REQUEST['update_interval'] ?? 0);
|
||||||
|
|
||||||
$rc = Feeds::_subscribe($feed, $cat, $login, $pass);
|
$rc = Feeds::_subscribe($feed, $cat, $login, $pass, $update_interval);
|
||||||
|
|
||||||
print json_encode(array("result" => $rc));
|
print json_encode(array("result" => $rc));
|
||||||
}
|
}
|
||||||
@@ -1002,7 +1011,7 @@ class Feeds extends Handler_Protected {
|
|||||||
* 7 - Error while creating feed database entry.
|
* 7 - Error while creating feed database entry.
|
||||||
* 8 - Permission denied (ACCESS_LEVEL_READONLY).
|
* 8 - Permission denied (ACCESS_LEVEL_READONLY).
|
||||||
*/
|
*/
|
||||||
static function _subscribe(string $url, int $cat_id = 0, string $auth_login = '', string $auth_pass = ''): array {
|
static function _subscribe(string $url, int $cat_id = 0, string $auth_login = '', string $auth_pass = '', int $update_interval = 0): array {
|
||||||
|
|
||||||
$user = ORM::for_table("ttrss_users")->find_one($_SESSION['uid']);
|
$user = ORM::for_table("ttrss_users")->find_one($_SESSION['uid']);
|
||||||
|
|
||||||
@@ -1067,6 +1076,7 @@ class Feeds extends Handler_Protected {
|
|||||||
'auth_login' => (string)$auth_login,
|
'auth_login' => (string)$auth_login,
|
||||||
'auth_pass' => (string)$auth_pass,
|
'auth_pass' => (string)$auth_pass,
|
||||||
'update_method' => 0,
|
'update_method' => 0,
|
||||||
|
'update_interval' => $update_interval,
|
||||||
'auth_pass_encrypted' => false,
|
'auth_pass_encrypted' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,15 @@ const CommonDialogs = {
|
|||||||
${App.getInitParam('enable_feed_cats') ?
|
${App.getInitParam('enable_feed_cats') ?
|
||||||
`
|
`
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label class='inline'>${__('Place in category:')}</label>
|
<label>${__('Place in category:')}</label>
|
||||||
${reply.cat_select}
|
${reply.cat_select}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
` : ''}
|
` : ''}
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<label>${__("Update interval:")}</label>
|
||||||
|
${App.FormFields.select_hash("update_interval", 0, reply.intervals.update)}
|
||||||
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div id="feedDlg_feedsContainer" style="display : none">
|
<div id="feedDlg_feedsContainer" style="display : none">
|
||||||
|
|||||||
Reference in New Issue
Block a user