# You must use a tab-size of 4 spaces to edit this file.
---
zenario_admin: &admin
    key:
        id: ""
        authtype: ""
        global_id: ""
        view_profile: ""
    identifier:
        css_class: admin_item
        label: Admin ID
    tabs:
        details:
            label: Details
            edit_mode:
                enabled: false
            notices:
                is_trashed:
                    show: false
                    type: warning
                    message: This administrator account is trashed and they cannot log in.
                is_inactive:
                    show: false
                    type: warning
                    message: ''
            fields:
                desc:
                    full_width: true
                    snippet:
                        html: ''
                first_name:
                    label: 'First name:'
                    type: text
                    maxlength: "100"
                    style: 'width: 25em;'
                    onchange: |
                        if (zenarioAB.tuix.key && !zenarioAB.tuix.key.id) {
                            var fName = $(lib.get('first_name')).val();
                            var lName = $(lib.get('last_name')).val();
                            var lastChar = lName.charAt(0)
                            var userFName = fName.toLowerCase();
                            var userLName = lastChar.toLowerCase();
                            $(lib.get('username')).val(userFName + userLName);
                        }
                    validation:
                        required: |
                            Please enter the administrator's first name.
                last_name:
                    label: 'Last name:'
                    type: text
                    maxlength: "100"
                    style: 'width: 25em;'
                    onchange: |
                        if (zenarioAB.tuix.key && !zenarioAB.tuix.key.id) {
                            var fName = $(lib.get('first_name')).val();
                            var lName = $(lib.get('last_name')).val();
                            var lastChar = lName.charAt(0)
                            var userFName = fName.toLowerCase();
                            var userLName = lastChar.toLowerCase();
                            $(lib.get('username')) .val(userFName + userLName);
                        }
                    validation:
                        required: |
                            Please enter the administrator's last name.
                username:
                    label: 'Administrator username:'
                    type: text
                    maxlength: "50"
                    style: 'width: 25em;'
                    validation:
                        required: Please enter a username.
                        username: The admin username may not contain any special characters.
                        no_spaces: >
                            The admin username may not contain any spaces. Please use
                            underscores or remove the spaces.
                        screen_name: The admin username may not contain any special characters.
                      
                email:
                    label: 'Email address:'
                    type: text
                    maxlength: "200"
                    validation:
                        required: Please enter an email address.
                        email: That email address doesn't look valid.
                inform_by_email:
                    visible_if: '!zenarioAB.tuix.key.id'
                    label: 'Inform by email'
                    type: checkbox
                    disabled: true
                    value: 1
                    note_below: >
                        If checked, Zenario will send the administrator an email with the update. 
                is_client_account:
                    label: 'Is client account'
                    type: checkbox
                
        permissions:
            label: Permissions
            edit_mode:
                enabled: false
                format_on_revert: true
                format_on_cancel_edit: true
            notices:
                is_trashed:
                    show: false
                    type: warning
                    message: This administrator's account has been trashed and they cannot log in.
            fields:
                desc:
                    full_width: true
                    snippet:
                        html: ""
                permissions:
                    type: select
                    values:
                        all_permissions:
                            label: "Grant every possible permission"
                        specific_actions:
                            label: "Grant specific permissions..."
                            side_note: |
                                This administrator will be able to make changes on this entire site,
                                subject to the permissions specified in the checkboxes.
                        specific_areas:
                            label: "Grant by content type and/or specific content items"
                            side_note: |
                                This administrator will be allowed to edit content items if they match one of the rules below.
                                They will not be allowed to access other parts of Zenario (e.g. users, emails, etc.)
                    value: specific_actions
                    format_onchange: true
                
                
                specific_actions:
                    type: grouping
                    name: specific_actions
                
                
                specific_content_types:
                    indent: 1
                    visible_if: |
                        zenarioAB.value('permissions') == 'specific_areas'
                    label: 'Grant author/publish on items of these content types:'
                    type: checkboxes
                    cols: 2
                    side_note: |
                        This administrator will be allowed to create and edit content items if they are of one of these types.
                
                specific_content_items:
                    indent: 1
                    visible_if: |
                        zenarioAB.value('permissions') == 'specific_areas'
                    label: 'Grant author/publish on the following specific content items:'
                    pick_items:
                        path: zenario__content/panels/content
                        min_path: zenario__content/panels/content
                        target_path: zenario__content/panels/content
                        max_path: zenario__content/panels/content
                        #one_to_one_choose_phrase:
                        multiple_select: true
                        #one_to_many_choose_phrase:
                        select_phrase: Select content items...
                        #nothing_selected_phrase:
                        disallow_refiners_looping_on_min_path: true
                
                desc_at_bottom:
                    ord: 200000
                    visible_if: |
                        zenarioAB.value('permissions') &&
                        zenarioAB.value('permissions') != 'all_permissions'
                    note_below: |
                        Administrators without specific permissions can view ALL content items,
                        irrespective of publishing status or user permission.
        password:
            priv: _PRIV_CHANGE_ADMIN_PASSWORD
            label: Password
            edit_mode:
                enabled: true
                use_view_and_edit_mode: true
            notices:
                new_admin:
                    show: false
                    type: information
                    message: Zenario will send the administrator an email with a link to where they can set a password.
                is_trashed:
                    show: false
                    type: warning
                    message: This administrator's account has been trashed and they cannot log in.
            fields:
                desc:
                    full_width: true
                    snippet:
                        html: ""
                    visible_if: zenarioAB.tuix.key.id
                password:
                    label: 'Password:'
                    type: password
                    style: 'width: 20em;'
                    visible_if: zenarioAB.tuix.key.id
                password_confirm:
                    label: 'Re-confirm password:'
                    type: password
                    style: 'width: 20em;'
                    visible_if: zenarioAB.tuix.key.id
                password_needs_changing:
                    label: 'Password needs changing'
                    type: checkbox
                    note_below: >
                        If checked, the administrator will be prompted to change their password when they next log in.
                    visible_if: zenarioAB.tuix.key.id
                    
zenario_admin_edit_self: *admin
