{% import 'macros/form.html' as form %} {% set preset_labels = { 'strict': _('Strict: static HTML, no scripts'), 'interactive': _('Interactive: scripts, forms, popups and downloads, no storage'), 'external': _('External: a trusted third-party site, no sandbox') if isolated else _('External: a trusted third-party site, no sandbox (runs as Interactive for now)'), 'data-schematic': _('Data Schematic: qsv Data Schematics'), } %} {# TRANSLATORS: how the embedded page's height is set; "Auto" means the page reports its own height. #} {% set height_labels = { 'auto': _('Auto'), 'fixed': _('Fixed (px)'), 'viewport': _('Share of the window height, in percent'), 'aspect': _('Aspect ratio (e.g. 16/9)'), } %} {# TRANSLATORS: names of security presets, as in "the External preset". #} {% set preset_names = { 'strict': _('Strict'), 'interactive': _('Interactive'), 'external': _('External'), 'data-schematic': _('Data Schematic'), } %} {% asset 'webpageviewplus/webpageviewplus-css' %} {% asset 'webpageviewplus/webpageviewplus-js' %}
{% call form.input('page_url', id='field-page_url', label=_('Web Page url'), placeholder=_('eg. https://example.com (if blank uses resource url)'), value=data.page_url, error=errors.page_url, classes=['control-full', 'control-large'], attrs={'class': 'form-control', 'aria-describedby': 'help-page_url'}) %}

{# TRANSLATORS: {services} is a comma-separated list of service names, such as "YouTube, Vimeo, Datawrapper". #} {{ _('Leave blank to show this resource\'s own address. Paste a link from {services} and the form suggests its embed address and settings.').format(services=service_names | join(', ')) }} {% if allowed_hosts %}{{ _('This site accepts pages from these hosts only: {hosts}.').format(hosts=allowed_hosts | join(', ')) }}{% endif %}

{% endcall %} {% if pdf_sandboxed %}
{{ _('In Chrome and Edge, this PDF stays blank with this preset: they don\'t show PDFs in a sandbox.') }} {% if suggest_pdf_view %} {{ _('Use a PDF (Plus) view instead.') }} {% elif pdf_sandboxed == 'external' and 'external' in presets and isolated %} {{ _('If you trust the site the PDF comes from, the External preset shows it.') }} {% else %} {{ _('Link to the PDF instead, or ask your site administrator about the PDF (Plus) view.') }} {% endif %}
{% elif suggest_pdf_view %}
{{ _('This resource is a PDF: the PDF (Plus) view shows it better, on phones too.') }}
{% endif %} {% set problem_texts = { 'needs_content_origin': _('{service} only works with the {preset} preset, which this site runs as Interactive until it has a separate domain for uploads, so it won\'t play here yet. Ask your site administrator.'), 'needs_sandboxed_downloads': _('{service} only works with the {preset} preset, which this site runs as Interactive while it doesn\'t sandbox downloads, so it won\'t play here. Ask your site administrator.'), 'preset_not_allowed': _('{service} only works with the {preset} preset, which this site doesn\'t allow.'), 'host_not_allowed': _('{service} embeds come from {host}, which isn\'t on this site\'s list of allowed hosts.'), 'private_dataset': _('{service}\'s viewer fetches the file from its own servers, so it can\'t show a file in a private dataset.'), 'refuses_framing': _('{service} doesn\'t let its pages show inside other sites, so this view would stay blank. Use the page\'s embed or share address if it has one, or link to it instead.'), } %} {# Well-known services (YouTube, Datawrapper...): offers the embed address and the settings the embed needs. Filled in by the script; a problem is rendered here too, so it shows without the script. #}
{%- if service_hint -%} {{ problem_texts[service_hint.problem].format(service=service_hint.service, preset=preset_names.get(service_hint.preset, service_hint.preset), host=service_hint.host) }} {%- endif -%}
{% if frameability_check %}
{% endif %}
{% if errors.preset %}{{ errors.preset | join(', ') }}{% endif %}

{{ _('Choose the most restrictive preset that works: if the page stays blank or broken, try the next one.') }} {% if 'external' in presets %}{{ _('External turns the sandbox off, so use it only for sites you trust.') }}{% endif %}

{% if frame and 'degraded' in frame.notices %}
{% if upload_not_served %} {{ _('This upload is kept where the separate domain for uploads can\'t serve it from, so the view runs as Interactive.') }} {% elif (data.preset or default_preset) == 'external' %} {{ _('External needs this site to sandbox downloads, which it has turned off, so the view runs as Interactive. Ask your site administrator if you need it.') }} {% else %} {{ _('This preset needs a separate domain for uploads, which this site doesn\'t have yet, so the view runs as Interactive. Ask your site administrator if you need it.') }} {% endif %} {% if (data.preset or default_preset) == 'data-schematic' %}{{ _('Charts, the Tour and Explore work. Maps work only in Data Schematics made with qsv 29.0.0 or later.') }}{% endif %}
{% endif %} {% if frame and 'same_origin_fallback' in frame.notices %}
{{ _('These sandbox settings could let the page use visitors\' logins on this site, which isn\'t allowed, so the view runs as Strict.') }}
{% endif %} {% if frame and 'credentialless' in frame.notices %}
{{ _('In Chrome and Edge, this site loads pages with this preset without the visitor\'s cookies or saved data, so logins inside the page and sign-in popups won\'t work.') }}
{% endif %}
{% if errors.height_mode %}{{ errors.height_mode | join(', ') }}{% endif %}

{{ _('Auto fits pages that report their own height, such as qsv Data Schematics. Other pages keep a fixed fallback height.') }}

{% call form.input('height_value', id='field-height_value', label=_('Height value'), placeholder=_('eg. 600, 80 or 16/9'), value=data.height_value, error=errors.height_value, classes=['control-medium'], attrs={'class': 'form-control', 'aria-describedby': 'help-height_value'}) %}

{{ _('Pixels for Fixed, a number from 1 to 100 for a share of the window, or a ratio such as 16/9. Auto and the preset\'s default need no value.') }}

{% endcall %} {% if thumbnail_choices is not none %}
{% if errors.thumbnail_resource %}{{ errors.thumbnail_resource | join(', ') }}{% endif %} {% if thumbnail_fetch %}

{{ _('An image in this dataset (PNG, JPEG, WebP or GIF), uploaded or linked, shown small beside this resource in the dataset\'s list. With None, the page\'s own preview image, a well-known service\'s logo or the format icon shows.') }}

{% else %}

{{ _('An image uploaded to this dataset (PNG, JPEG, WebP or GIF), shown small beside this resource in the dataset\'s list. With None, a well-known service\'s logo or the format icon shows.') }}

{% endif %}
{% if thumbnail_fetch %}

{{ _('Otherwise, when no image is chosen above, this site fetches the image the page names for link previews, once when the view is saved, and shows a small copy.') }}

{% else %}

{{ _('Otherwise, when no image is chosen above, an Office file uploaded to this dataset shows the preview picture saved inside it.') }}

{% endif %} {% if screenshots_on %}

{{ _('It also stops screenshots of a page that refuses to be shown here, and saving with it ticked deletes any screenshot already taken.') }}

{% endif %}
{% endif %} {% if screenshot_panel %} {% set sp = screenshot_panel %} {% set reasons = { 'page_failed': _("the page didn't load"), 'unreachable': _("the page couldn't be reached"), 'backend_error': _('the screenshot service refused the request'), 'rate_limited': _("the screenshot service's allowance is used up for now"), 'no_image': _("the answer wasn't an image"), 'unsafe_backend': _("the screenshot service isn't set up safely"), } %}

{{ _('Screenshot') }}

{% if sp.image %} {{ _('Screenshot of {host}').format(host=sp.host) }} {% endif %}

{%- if sp.state in ('new', 'after_save') -%} {{ _("A screenshot is taken after you save, if this page can't be shown in a frame.") }} {%- elif sp.state == 'other_url' -%} {{ _("The screenshot is of {url}. A new one is taken after you save, if the new page can't be shown in a frame.").format(url=sp.old_url) }} {%- elif sp.state == 'not_in_use' and sp.reason == 'frameable' -%} {{ _("This page can now be shown in a frame, so the screenshot isn't used.") }} {%- elif sp.state == 'not_in_use' and sp.reason == 'picked' -%} {{ _('You picked a thumbnail, so the screenshot isn\'t used.') }} {%- elif sp.state in ('not_in_use', 'private') -%} {{ _("This dataset is private, so screenshots aren't taken.") }} {%- elif sp.state == 'pending' -%} {% if sp.jobs %}{{ _('A screenshot will be taken in the background. Reload this form later to see it.') }}{% else %}{{ _('This site takes screenshots on a schedule. Reload this form later to see it.') }}{% endif %} {%- elif sp.state == 'failed' -%} {{ _('The last attempt on {date} failed: {reason}.').format(date=h.render_datetime(sp.attempted), reason=reasons.get(sp.error, sp.error)) }} {%- elif sp.state == 'in_use' -%} {% if sp.final_host %}{{ _('Taken {date}, of {host}.').format(date=h.render_datetime(sp.taken), host=sp.final_host) }}{% else %}{{ _('Taken {date}.').format(date=h.render_datetime(sp.taken)) }}{% endif %} {% if sp.list_other %}{{ _("Shown on this view's card. The resource list shows the page's own thumbnail instead.") }}{% else %}{{ _("Shown on this view's card and as its thumbnail in the resource list.") }}{% endif %} {%- endif -%}

{% if sp.button %}

{% if sp.cooldown %} {{ ungettext('You can take a new screenshot in {seconds} second.', 'You can take a new screenshot in {seconds} seconds.', sp.cooldown).format(seconds=sp.cooldown) }} {% endif %}

{% endif %}
{% endif %}

{{ _('On phones and at high zoom, Open in new tab still shows, so visitors can always reach the page.') }}

{% if view_counting %}
{% if view_counts and data.count_views in (true, 'true', 'True') %} {% set t = view_counts.totals %}

{# TRANSLATORS: view counts as "label: number" pairs, so no plural forms are needed. #} {{ _('Last 30 days. Shown: {impressions}. Seen: {seen}. Loaded: {loaded}. Used: {engaged}. Failed: {failed}.').format(**t) }}

{% endif %} {% endif %}
{% if can_set_advanced %}
{# TRANSLATORS: heading of the advanced (sysadmin-only) settings. #} {{ _('Advanced') }}

{{ _('Each field replaces the preset\'s value; leave it blank to keep the preset\'s. A sandbox with both allow-scripts and allow-same-origin is refused wherever it could let a page act as this site.') }}

{{ form.input('sandbox', id='field-sandbox', label=_('Sandbox tokens (replace the preset\'s)'), placeholder=_('eg. allow-scripts allow-popups'), value=data.sandbox, error=errors.sandbox, classes=['control-full']) }} {{ form.input('allow', id='field-allow', label=_('Allowed features (replace the preset\'s)'), placeholder=_('eg. fullscreen; clipboard-write'), value=data.allow, error=errors.allow, classes=['control-full']) }}
{% if errors.referrer_policy %}{{ errors.referrer_policy | join(', ') }}{% endif %}
{% endif %}