More preparation for persistent cookies

This commit is contained in:
Matthew Exon 2019-07-21 19:32:30 +01:00 committed by Matthew Exon
parent 8b6a9c017a
commit eb61f8f09a
2 changed files with 29 additions and 7 deletions

View file

@ -587,7 +587,7 @@ function retriever_content($a) {
if (!empty($_POST["id"])) { if (!empty($_POST["id"])) {
$retriever = get_retriever($a->argv[1], local_user(), true); $retriever = get_retriever($a->argv[1], local_user(), true);
$retriever["data"] = array(); $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])) { if (!empty($_POST['retriever_' . $setting])) {
$retriever["data"][$setting] = $_POST['retriever_' . $setting]; $retriever["data"][$setting] = $_POST['retriever_' . $setting];
} }
@ -643,11 +643,16 @@ function retriever_content($a) {
L10n::t('Retrospectively Apply'), L10n::t('Retrospectively Apply'),
'0', '0',
L10n::t('Reapply the rules to this number of posts')), L10n::t('Reapply the rules to this number of posts')),
'$cookies' => array( 'storecookies' => array(
'retriever_cookies', 'retriever_storecookies',
L10n::t('Cookies'), L10n::t('Store cookies'),
$retriever['data']['cookies'], $retriever['data']['storecookies'],
L10n::t("Persistent cookies for this feed. Netscape cookie file format.")), 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( '$customxslt' => array(
'retriever_customxslt', 'retriever_customxslt',
L10n::t('Custom XSLT'), L10n::t('Custom XSLT'),

View file

@ -40,6 +40,22 @@ function retriever_remove_row(id, number)
var row = document.getElementById(id + '-' + number); var row = document.getElementById(id + '-' + number);
tbody.removeChild(row); 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);
</script> </script>
<h2>{{$title}}</h2> <h2>{{$title}}</h2>
<p><a href="{{$help}}">{{$help_t}}</a></p> <p><a href="{{$help}}">{{$help_t}}</a></p>
@ -106,8 +122,9 @@ function retriever_remove_row(id, number)
</table> </table>
<input type="button" onclick="retriever_add_row('retriever-exclude')" value="{{$add_t}}"> <input type="button" onclick="retriever_add_row('retriever-exclude')" value="{{$add_t}}">
</div> </div>
{{include file="field_textarea.tpl" field=$cookies}}
{{include file="field_textarea.tpl" field=$customxslt}} {{include file="field_textarea.tpl" field=$customxslt}}
{{include file="field_checkbox.tpl" field=$storecookies}}
{{include file="field_textarea.tpl" field=$cookiedata}}
<input type="submit" size="70" value="{{$submit_t}}"> <input type="submit" size="70" value="{{$submit_t}}">
</form> </form>
</div> </div>