From 9395990ab85ef1705460b895dc153d2c909574f4 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Sun, 21 Jul 2019 19:32:30 +0100 Subject: [PATCH] More preparation for persistent cookies --- retriever/retriever.php | 17 +++++++++++------ retriever/templates/rule-config.tpl | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/retriever/retriever.php b/retriever/retriever.php index 78a79a0e6..bb3460a1a 100644 --- a/retriever/retriever.php +++ b/retriever/retriever.php @@ -587,7 +587,7 @@ function retriever_content($a) { if (!empty($_POST["id"])) { $retriever = get_retriever($a->argv[1], local_user(), true); $retriever["data"] = array(); - foreach (array('pattern', 'replace', 'enable', 'images', 'customxslt') as $setting) { + foreach (array('pattern', 'replace', 'enable', 'images', 'customxslt', 'storecookies', 'cookiedata') as $setting) { if (!empty($_POST['retriever_' . $setting])) { $retriever["data"][$setting] = $_POST['retriever_' . $setting]; } @@ -643,11 +643,16 @@ function retriever_content($a) { L10n::t('Retrospectively Apply'), '0', L10n::t('Reapply the rules to this number of posts')), - '$cookies' => array( - 'retriever_cookies', - L10n::t('Cookies'), - $retriever['data']['cookies'], - L10n::t("Persistent cookies for this feed. Netscape cookie file format.")), + 'storecookies' => array( + 'retriever_storecookies', + L10n::t('Store cookies'), + $retriever['data']['storecookies'], + L10n::t("Preserve cookie data across fetches.")), + '$cookiedata' => array( + 'retriever_cookiedata', + L10n::t('Cookie Data'), + $retriever['data']['cookiedata'], + L10n::t("Latest cookie data for this feed. Netscape cookie file format.")), '$customxslt' => array( 'retriever_customxslt', L10n::t('Custom XSLT'), diff --git a/retriever/templates/rule-config.tpl b/retriever/templates/rule-config.tpl index 847d9c3fc..9061d1ff6 100644 --- a/retriever/templates/rule-config.tpl +++ b/retriever/templates/rule-config.tpl @@ -40,6 +40,22 @@ function retriever_remove_row(id, number) var row = document.getElementById(id + '-' + number); tbody.removeChild(row); } + +function retriever_toggle_cookiedata_block() +{ + var div = document.querySelector("#id_retriever_cookiedata").parentNode; + if (document.querySelector("#id_retriever_storecookies").checked) { + div.style.display = "block"; + } + else { + div.style.display = "none"; + } +} + +document.addEventListener('DOMContentLoaded', function() { + retriever_toggle_cookiedata_block(); + document.querySelector("#id_retriever_storecookies").addEventListener('change', retriever_toggle_cookiedata_block, false); +}, false);

{{$title}}

{{$help_t}}

@@ -106,8 +122,9 @@ function retriever_remove_row(id, number) -{{include file="field_textarea.tpl" field=$cookies}} {{include file="field_textarea.tpl" field=$customxslt}} +{{include file="field_checkbox.tpl" field=$storecookies}} +{{include file="field_textarea.tpl" field=$cookiedata}}