# You must use a tab-size of 4 spaces to edit this file.
---
zenario__library:
    panels:
        image_library:
            title: Image library
            no_items_message: There are no images in the library.
            
            notice:
                show: false
                type: ''
                html: true
                message: ''
            
            db_items:
                table: |
                    [[DB_PREFIX]]files AS f
                id_column: f.id
                where_statement: |
                    WHERE f.`usage` = 'image'
                      AND f.mime_type IN ('image/gif', 'image/png', 'image/jpeg', 'image/svg+xml')
            
            panel_type: multi_line_list_or_grid
            css_class: two_line_list_panels
            use_tall_rows: true
            
            grid_view_microtemplate: zenario_grid_view_image
            slidedown_view_microtemplate: zenario_slidedown_view_image
            
            refiners:
                tag:
                    table_join: |
                        INNER JOIN [[DB_PREFIX]]image_tag_link AS rtitl
                           ON rtitl.image_id = f.id
                          AND rtitl.tag_id = 
                    #n.b. this code needs to be completed by preFillOrganizerPanel() before it can work!
                
                images_for_content_item:
                    table_join: |
                        INNER JOIN [[DB_PREFIX]]content_items AS c
                           ON c.tag_id = [[REFINER_ID]]
                        INNER JOIN [[DB_PREFIX]]content_item_versions AS v
                           ON v.id = c.id
                          AND v.type = c.type
                          AND v.version = c.admin_version
                        INNER JOIN [[DB_PREFIX]]inline_images AS ii
                           ON ii.image_id = f.id
                          AND ii.foreign_key_to = 'content'
                          AND ii.foreign_key_id = c.id
                          AND ii.foreign_key_char = c.type
                          AND ii.foreign_key_version = c.admin_version
                
                images_for_newsletter:
                    table_join: |
                        INNER JOIN [[DB_PREFIX]]inline_images AS ii
                         ON ii.image_id = f.id
                        AND ii.foreign_key_to = 'newsletter'
                        AND ii.foreign_key_id = [[REFINER_ID]]
                
                images_for_menu_node_linked_content_item:
                    table_join: |
                        INNER JOIN [[DB_PREFIX]]menu_nodes AS m
                           ON m.id = [[REFINER_ID]]
                        INNER JOIN [[DB_PREFIX]]content_items AS c
                           ON c.equiv_id = m.equiv_id
                          AND c.type = m.content_type
                          AND c.language_id = [[REFINER__LANGUAGE]]
                        INNER JOIN [[DB_PREFIX]]content_item_versions AS v
                           ON v.id = c.id
                          AND v.type = c.type
                          AND v.version = c.admin_version
                        INNER JOIN [[DB_PREFIX]]inline_images AS ii
                           ON ii.image_id = f.id
                          AND ii.foreign_key_to = 'content'
                          AND ii.foreign_key_id = c.id
                          AND ii.foreign_key_char = c.type
                          AND ii.foreign_key_version = c.admin_version
                
                from_email_template_admin_box:
                    sql: ''
                
                images_for_misc_picker:
                    sql: ''
            
            
            columns:
                id:
                    title: ID
                    searchable: true
                    db_column: f.id
                    show_by_default: false
                    align_right: true
                    width: xxsmall
                filename:
                    title: Filename
                    width: large
                    searchable: true
                    db_column: f.filename
                    always_show: true
                    get_tags_from_column: tags
                
                tags:
                    db_column: |
                        (
                            SELECT GROUP_CONCAT(DISTINCT it.name ORDER BY it.name SEPARATOR ',')
                            FROM [[DB_PREFIX]]image_tag_link AS itl
                            INNER JOIN [[DB_PREFIX]]image_tags AS it
                               ON itl.tag_id = it.id
                            WHERE itl.image_id = f.id
                            GROUP BY itl.image_id
                        )
                    searchable: false
                    disallow_sorting: true
                
                is_featured_image:
                    title: Featured image
                    db_column: v.feature_image_id = f.id
                    always_show: true
                    parent: filename
                    format: yes_or_no
                    yes_phrase: Featured image
                    no_phrase: ''
                
                in_use_here:
                    title: In use here
                    db_column: ii.in_use
                    always_show: true
                    parent: filename
                    format: yes_or_no
                    yes_phrase: ''
                    no_phrase: Attached but not used
                
                
                duplicate_filename:
                    title: Name not unique 
                    always_show: true
                    hidden_in_view_options: true
                    parent: filename
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]files AS df
                            WHERE df.`usage` = f.`usage`
                              AND df.filename = f.filename
                              AND df.archived = 0
                              AND df.id != f.id
                            LIMIT 1
                        )
                    filter_format: yes_or_no
                    microtemplate: |
                        <% if (m.item.duplicate_filename) { %>
                            <span class="zenario_inline_warning">
                                Name not unique
                            </span>
                        <% } %>
                
                
                
                alt_tag:
                    title: Default alt-tag
                    searchable: true
                    db_column: f.alt_tag
                    show_by_default: true
                title:
                    db_column: f.title
                checksum:
                    db_column: f.checksum
                short_checksum:
                    title: Checksum (short)
                    searchable: true
                    ascii_only: true
                    db_column: f.short_checksum
                    width: small
                    show_by_default: false
                mime_type:
                    server_side_only: true
                    db_column: f.mime_type
                uploaded_datetime:
                    title: Uploaded on
                    format: datetime
                    width: medium
                    searchable: true
                    db_column: f.created_datetime
                    show_by_default: true
                size:
                    title: Size
                    format: filesize
                    db_column: f.size
                    always_show: true
                    width: small
                
                width:
                    db_column: f.width
                height:
                    db_column: f.height
                dimensions:
                    parent: size
                    always_show: true
                    hidden_in_view_options: true
                    title: Dimensions
                    microtemplate: |
                        <% if (m.item.width && m.item.height) { %>
                            <% if (m.item.mime_type == 'image/svg+xml') { %>
                                {{m.item.width|e}} × {{m.item.height|e}}px; scalable
                            <% } else { %>
                                {{m.item.width|e}} × {{m.item.height|e}}px
                            <% } %>
                        <% } else { %>
                            {{'No dimensions; scalable'}}
                        <% } %>
                
                privacy:
                    title: Privacy
                    db_column: f.privacy
                    always_show: true
                    width: small
                    format: enum
                    values:
                        auto: Will auto-detect
                        public: Public
                        private: Private
                    tooltip: |
                        <table>
                            <tr>
                                <th style="text-align: left;">Public (green border):</th>
                                <td style="vertical-align: text-top;">
                                    Accessible by any visitor via a friendly URL. Can be used in WYSIWYG editors and may be indexed by search engines.
                                </td>
                            </tr>
                            <tr>
                                <th style="text-align: left;">Private (blue border):</th>
                                <td style="vertical-align: text-top;">
                                    Private images have a URL that is unguessable and keeps changing. Generated URLs will be taken down after roughly two hours.
                                    They cannot be used in WYSIWYG editors and will not be indexed by search engines.
                                    
                                    When a plugin uses a private image, the plugin will only output the image if it finds itself on a private page.
                                </td>
                            </tr>
                            <tr>
                                <th style="text-align: left;">Will auto-detect (orange border):</th>
                                <td style="vertical-align: text-top;">
                                    When next displayed, will be set to Public if on a public content item, or Private if on a private content item.
                                </td>
                            </tr>
                        </table>
                    
                in_use_anywhere:
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]inline_images
                            WHERE image_id = f.id
                              AND in_use = 1
                              AND archived = 0
                              AND foreign_key_to IN ('content', 'library_plugin', 'menu_node', 'email_template', 'newsletter', 'newsletter_template', 'standard_email_template') 
                              AND foreign_key_id != 0
                            LIMIT 1
                        )
                    format: yes_or_no
                    hidden: true
                
                where_used:
                    show_by_default: true
                    width: xlarge
                    title: Where it's used
                    html: true
                    empty_value: Not used
                
                
                usage_content:
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]inline_images
                            WHERE image_id = f.id
                              AND foreign_key_to = 'content'
                              AND foreign_key_id != 0
                              AND archived = 0
                            LIMIT 1
                        )
                    format: yes_or_no
                    hidden: true
                
                usage_plugins:
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]inline_images
                            WHERE image_id = f.id
                              AND foreign_key_to = 'library_plugin'
                              AND foreign_key_id != 0
                              AND is_nest = 0
                            LIMIT 1
                        )
                    format: yes_or_no
                    hidden: true
                
                usage_nests:
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]inline_images
                            WHERE image_id = f.id
                              AND foreign_key_to = 'library_plugin'
                              AND foreign_key_id != 0
                              AND is_nest = 1
                              AND is_slideshow = 0
                            LIMIT 1
                        )
                    format: yes_or_no
                    hidden: true
                
                usage_slideshows:
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]inline_images
                            WHERE image_id = f.id
                              AND foreign_key_to = 'library_plugin'
                              AND foreign_key_id != 0
                              AND is_slideshow = 1
                            LIMIT 1
                        )
                    format: yes_or_no
                    hidden: true
                
                usage_menu_nodes:
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]inline_images
                            WHERE image_id = f.id
                              AND foreign_key_to = 'menu_node'
                              AND foreign_key_id != 0
                            LIMIT 1
                        )
                    format: yes_or_no
                    hidden: true
                
                usage_email_templates:
                    db_column: |
                        (
                            SELECT 1
                            FROM [[DB_PREFIX]]inline_images
                            WHERE image_id = f.id
                              AND foreign_key_to = 'email_template'
                              AND foreign_key_id != 0
                            LIMIT 1
                        )
                    format: yes_or_no
                    hidden: true
            
            default_sort_column: filename
            label_format_for_popouts: |
                [[filename]]
                [[[width]] × [[height]]px]
            label_format_for_picked_items: |
                [[filename]]
                [[[width]] × [[height]]px]
            
            # Initial failed attempt at T12723
            #label_format_for_picked_items: |
            #    [[filename]] [[privacy]]
            #    [[[width]] × [[height]]px]
            
            
            quick_filter_buttons:
                usage_dropdown:
                    label: Usage
                tags:
                    label: Tags
                    hidden: true
                in_use_anywhere:
                    parent: usage_dropdown
                    clear_all: true
                    label: In use
                    column: in_use_anywhere
                #not_in_use_anywhere:
                #    parent: usage_dropdown
                #    clear_all: true
                #    label: Not in use
                #    column: in_use_anywhere
                #    invert: true
                usage_content:
                    parent: usage_dropdown
                    clear_all: true
                    label: Attached to a content item
                    column: usage_content
                    value: 1
                #not_usage_content:
                #    parent: usage_dropdown
                #    clear_all: true
                #    label: Not attached to a content item
                #    column: usage_content
                #    value: 1
                #    invert: true
                usage_plugins:
                    parent: usage_dropdown
                    clear_all: true
                    label: Used by a library plugin
                    column: usage_plugins
                    value: 1
                #not_usage_plugins:
                #    parent: usage_dropdown
                #    clear_all: true
                #    label: Not used by a library plugin
                #    column: usage_plugins
                #    value: 1
                #    invert: true
                usage_nests:
                    parent: usage_dropdown
                    clear_all: true
                    label: Used by a nest
                    column: usage_nests
                    value: 1
                usage_slideshows:
                    parent: usage_dropdown
                    clear_all: true
                    label: Used by a slideshow
                    column: usage_slideshows
                    value: 1
                usage_email_templates:
                    parent: usage_dropdown
                    clear_all: true
                    label: Used by an email template
                    column: usage_email_templates
                    value: 1
                
                usage_menu_node:
                    parent: usage_dropdown
                    clear_all: true
                    label: Used by a menu node
                    column: usage_menu_nodes
                    value: 1
                
                #not_usage_email_templates:
                #    parent: usage_dropdown
                #    clear_all: true
                #    label: Not used by an email template
                #    column: usage_email_templates
                #    value: 1
                #    invert: true
                duplicate_filename:
                    ord: 99
                    parent: usage_dropdown
                    clear_all: true
                    label: Duplicate file names
                    column: duplicate_filename
                    value: 1
                
                clear_all_usage:
                    ord: 100
                    parent: usage_dropdown
                    clear_all: true
                    visible_if: zenarioO.checkIfClearAllAvailable('clear_all_usage');
                    label: Clear filter
                
                clear_all_tags:
                    ord: 99999
                    parent: tags
                    clear_all: true
                    visible_if: zenarioO.checkIfClearAllAvailable('clear_all_tags');
                    label: Clear filter
            
            
            item:
                name: Image
                names: Images
                css_class: media_image
            collection_buttons:
                upload:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Upload
                    css_class: zenario_create_a_new
                    hide_on_filter: true
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.collectionButtonClick('upload');
                    upload:
                        fileExt: '*.gif;*.jpg;*.png;*.jpe;*.jpeg;*.pjpeg'
                        fileDesc: Images
                        multi: true
                        drag_and_drop: true
                        request:
                            upload: true
                tags:
                    label: Manage tags
                    link:
                        path: zenario__content/panels/image_tags
                
                add_to_content_item:
                    label: Add image from image library
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.collectionButtonClick('add_to_content_item');
                    pick_items:
                        path: zenario__library/panels/image_library
                        target_path: zenario__library/panels/image_library
                        min_path: zenario__library/panels/image_library
                        disallow_refiners_looping_on_min_path: true
                        one_to_one_choose_phrase: Use
                        multiple_select: true
                        visible_if_for_all_selected_items: |
                            item.privacy == 'public'
                        request:
                            add: 1
            
            
            
            item_buttons:
                edit:
                    label: Image properties and link
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.itemButtonClick('edit');
                    admin_box:
                        path: zenario_image
                actions_dropdown:
                    label: Actions
                    multiple_select: true
                    hide_when_children_are_not_visible: true
                view:
                    parent: actions_dropdown
                    label: View image
                    popout:
                        href: zenario/file.php?popout=1
                        type: image
                download:
                    parent: actions_dropdown
                    hide_in_select_mode: true
                    label: Download original
                    ajax:
                        confirm:
                            download: true
                            message: 'Are you sure you wish to download the image "[[filename]]"?'
                            message_type: warning
                            button_message: Download
                            cancel_button_message: Cancel
                        request:
                            download_image: 1
                
                
                mark_as_public: &mark_as_public
                    parent: actions_dropdown
                    priv: _PRIV_MANAGE_MEDIA
                    label: Make image public
                    multiple_select_label: Make images public
                    multiple_select: true
                    hide_in_select_mode: true
                    visible_if_for_any_selected_items: >
                        item.privacy != 'public'
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.itemButtonClick('mark_as_public');
                    ajax:
                        confirm:
                            message: >
                                Make the image "[[filename]]" public?
                                
                                
                                Public images are accessible by any visitor via a friendly URL,
                                can be used in WYSIWYG editors, and may be indexed by search engines.
                                
                            multiple_select_message: >
                                Make the selected images public?
                                
                                
                                Public images are accessible by any visitor via a friendly URL,
                                can be used in WYSIWYG editors, and may be indexed by search engines.

                            button_message: Make public
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            mark_as_public: 1
                
                mark_as_public_while_selecting: *mark_as_public
                    parent: null
                    hide_in_select_mode: false
                    select_mode_only: true
                
                mark_as_private: &mark_as_private
                    parent: actions_dropdown
                    priv: _PRIV_MANAGE_MEDIA
                    label: Make image private
                    multiple_select_label: Make images private
                    multiple_select: true
                    hide_in_select_mode: true
                    visible_if_for_any_selected_items: >
                        item.privacy != 'private'
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.itemButtonClick('mark_as_private');
                    ajax:
                        confirm:
                            message: >
                                Make the image "[[filename]]" private?
                                
                                
                                Private images have a URL that is unguessable and keeps changing. Generated URLs will be taken down after roughly two hours.
                                They cannot be used in WYSIWYG editors and will not be indexed by search engines.

                                
                                If a plugin uses a private image, the plugin will only output
                                the image if it finds itself on a private page.
                                You should not link to an image you want to be private using a managed link (e.g. in a Banner or Multiple Image Container),
                                unless it's on a private content item.
                                
                            multiple_select_message: >
                                Are you sure you wish to make the selected images private?
                                
                                
                                Private images have a URL that is unguessable and keeps changing. Generated URLs will be taken down after roughly two hours.
                                They cannot be used in WYSIWYG editors and will not be indexed by search engines.
                                
                                
                                If a plugin uses a private image, the plugin will only output
                                the image if it finds itself on a private page.
                                You should not link to an image you want to be private using a managed link (e.g. in a Banner or Multiple Image Container),
                                unless it's on a private content item.
                            
                            button_message: Make private
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            mark_as_private: 1
                
                mark_as_private_while_selecting: *mark_as_private
                    parent: null
                    hide_in_select_mode: false
                    select_mode_only: true
                
                edit_tags:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Add/remove tags
                    multiple_select: true
                    hide_in_select_mode: true
                    admin_box:
                        path: zenario_change_tags
                        
                copy_to_special_images_library:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Copy to special images library
                    parent: actions_dropdown
                    hide_in_select_mode: true
                    multiple_select: true
                    disabled_if_for_any_selected_items: item.privacy != 'public'
                    disabled_tooltip: 'Only public images may be copied to the special images library.'
                    ajax:
                        confirm:
                            message: >
                                Are you sure you wish to copy the selected image "[[filename]]" to the special images library?
                            multiple_select_message: >
                                Are you sure you wish to copy the selected images to the special images library?
                            button_message: Copy to special images library
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            copy_to_special_images_library: 1
                
                send_to_documents:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Copy to document library
                    parent: actions_dropdown
                    hide_in_select_mode: true
                    ajax:
                        confirm:
                            message: >
                                Are you sure you wish to send the selected image "[[filename]]" to the document library?
                            button_message: Copy to document library
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            send_to_documents: 1
                
                copy_to_mic_images:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Copy to MIC images
                    parent: actions_dropdown
                    hide_in_select_mode: true
                    multiple_select: true
                    ajax:
                        confirm:
                            message: >
                                Are you sure you wish to copy the selected image "[[filename]]" to MIC images?
                            multiple_select_message: >
                                Are you sure you wish to copy the selected images to MIC images?
                            button_message: Copy to MIC images
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            copy_to_mic_images: 1
                    visible_if: zenarioA.module.zenario_multiple_image_container && zenarioA.module.zenario_multiple_image_container.running
                
                
                
                
                flag_as_feature:
                    priv: _PRIV_EDIT_DRAFT
                    label: Flag as featured image
                    hide_in_select_mode: false
                    visible_if: |
                        !zenario.engToBoolean(item.is_featured_image)
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.itemButtonClick('flag_as_feature');
                    ajax:
                        confirm:
                            message: |
                                Do you wish to use "[[filename]]" as the featured image for this content item?
                                
                                The featured image can appear automatically in banners, content summary lists and other plugins that have managed links to this content item.
                            button_message: Flag as featured image
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            flag_as_feature: true
                unflag_as_feature:
                    priv: _PRIV_EDIT_DRAFT
                    label: Unflag as featured image
                    hide_in_select_mode: false
                    visible_if_for_all_selected_items: |
                        item.is_featured_image
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.itemButtonClick('unflag_as_feature');
                    ajax:
                        confirm:
                            message: 'Are you sure you wish to stop using the image "[[filename]]" as the featured image?'
                            button_message: Unflag as featured image
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            unflag_as_feature: true
                
                remove_from_content:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Detach from content item
                    multiple_select: true
                    hide_in_select_mode: false
                    disabled_if_for_any_selected_items: |
                        item.in_use_here || item.is_featured_image
                    disabled_tooltip: |
                        You can't detach an image that's in use. You should make sure the image is not the featured image
                        for this content item, nor in use within a WYSIWYG area, and then it can be detached.
                    ajax:
                        confirm:
                            message: |
                                Are you sure you wish to detach the image "[[filename]]" from this content item?
                            multiple_select_message: |
                                Are you sure you wish to detach these images from this content item?
                            button_message: Detach
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            remove: 1
                    
                delete:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Delete
                    multiple_select: true
                    visible_if_for_all_selected_items: >
                        !item.in_use_anywhere
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.itemButtonClick('delete');
                    ajax:
                        confirm:
                            message: 'Are you sure you wish to delete the unused image "[[filename]]"?'
                            multiple_select_message: Are you sure you wish to delete these unused images?
                            button_message: Delete
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            delete: 1
                    
                delete_in_use:
                    priv: _PRIV_MANAGE_MEDIA
                    label: Delete
                    multiple_select: true
                    hide_in_select_mode: true
                    visible_if_for_any_selected_items: >
                        item.in_use_anywhere
                    onclick: |
                        if (window.zenarioOQuickMode) {
                            zenario.reloadPageWhenOrganizerQuickCloses = true;
                        }
                        zenarioO.itemButtonClick('delete_in_use');
                    ajax:
                        confirm:
                            html: true
                            button_message: Delete
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            delete_in_use: 1
            
            hidden_nav:
                plugins_using_image:
                    link:
                        path: zenario__modules/panels/plugins
                        refiner: plugins_using_image
                nests_using_image:
                    link:
                        path: zenario__modules/panels/plugins
                        refiner: nests_using_image
                slideshows_using_image:
                    link:
                        path: zenario__modules/panels/plugins
                        refiner: slideshows_using_image
                content_items_using_image:
                    link:
                        path: zenario__content/panels/content
                        refiner: content_items_using_image
                menu_nodes_using_image:
                    link:
                        path: zenario__menu/panels/menu_nodes
                        refiner: menu_nodes_using_image
