DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Auto Accesskeys

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Ernesto Baschny
Changed:2005-08-10T13:00:33
Author:Ernesto Baschny
Email:ernst@cron-it.de
Info 3:cron IT GmbH
Info 4:

EXT: Auto Accesskeys

Extension Key: cron_printlink

Copyright 2005, Ernesto Baschny, <ernst@cron-it.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: Auto Accesskeys 1

Introduction 1

What does it do? 1

Users manual 1

Adminstration 1

Configuration 2

Known problems 2

To-Do list 3

Changelog 3

Introduction

What does it do?

With this extention you can automatically generate “accesskeys” to the navigational <A> Tags for your TMENU's based on the title of the menu item.

The first not yet used character of the title will be used as an accesskey. Optionally you can wrap something around the first occurence of the accesskey in the title, so you can easily simulate Windows-like menus (underlined accesskey).

This also works together with gov_accesskey, in that if an accesskey is defined for an page (field “accesskey”), it will be used instead of auto-generating one.

Screenshots

img-1

Users manual

The user don't need to do anything.

If the gov_accesskey extention is installed, the user that adds content should fill the “accesskey” for a page only if he wants the accesskey to be statically set (i.e. not automatically generated from the title). Otherwise, just leave that field empty.

Adminstration

If you want users to be able to override accesskeys manually, install gov_accesskey. The user will be able to override the accesskey per page.

To use the auto-generation, just install the cron_autoaccesskeys extention and add a call to “user_cronautoaccesskeys->addAccessKeys” on the TMENU's IProcFunc.

((generated))

EXAMPLE

Generates a nested list menu:

temp.listMenu = TMENU
temp.listMenu {
  wrap = <ul> | </ul>
  noBlur = 1
  IProcFunc = user_cronautoaccesskeys->addAccessKeys
  NO {
    allWrap = <li> | </li>
    stdWrap.htmlSpecialChars = 1
    ATagParams = accesskey="{field:tx_govaccesskey_accesskey}" tabindex="{field:tx_govaccesskey_tabindex}"
    ATagParams.insertData = 1
  }
  ACT = 1
  ACT {
    wrapItemAndSub = <li class="act"> | </li>
  }
  RO = 0
}

This will generate a menu. Each A-Tag will get an “accesskey”. First the accesskey from gov_accesskey will get used. If this is empty (“”), the cron_autoaccesskey extention will generate the accesskey on its own.

Configuration

The IProcFunc can be configured with the following options:

accessKeyWrap

Property

accessKeyWrap

Data type

wrap

Description

The first occurrence of the accesskey in the title will get this wrap wrapped around it. Useful to highlight the accesskey of a menu item.

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronautoaccesskeys->addAccessKeys
  IProcFunc.accessKeyWrap = <span class="accessKey"> | </span>
  ..
}

Default

appendWrap

Property

appendWrap

Data type

wrap

Description

This will get appended to the title, wrapping around the used accesskey.

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronautoaccesskeys->addAccessKeys
  IProcFunc.appendWrap = <span class=”hidden”>&nbsp;(ALT- | )</span>
  ..
}

Default

forbiddenKeys

Property

forbiddenKeys

Data type

string

Description

A comma separated list of characters that should never be used in auto-generated accesskeys. This is useful if you already have a couple of accesskeys being used in your main template and don't want other menu items to use them (e.g. ALT-0 to go to the start page).

Example:

temp.listMenu = TMENU
temp.listMenu {
  ..
  IProcFunc = user_cronautoaccesskeys->addAccessKeys
  IProcFunc.forbiddenKeys = 0,D,B,A,F,X
  ..
}

Default

((generated))

((generated))
Examples

This will generate a simple page with a link to its print version:

temp.listMenu = TMENU
temp.listMenu {
  wrap = <ul> | </ul>
  noBlur = 1
  IProcFunc = user_cronautoaccesskeys->addAccessKeys
  IProcFunc.accessKeyWrap = <span class="accessKey"> | </span>
  IProcFunc.appendWrap = <span class=”hidden”>&nbsp;(ALT- | )</span>
  IProcFunc.forbiddenKeys = 0,D,B,A,F,X
  NO {
    allWrap = <li> | </li>
    stdWrap.htmlSpecialChars = 1
    ATagParams = accesskey="{field:tx_govaccesskey_accesskey}" tabindex="{field:tx_govaccesskey_tabindex}"
    ATagParams.insertData = 1
  }
  ACT = 1
  ACT {
    wrapItemAndSub = <li class="act"> | </li>
  }
  RO = 0
}

Here, the current accesskey will be highlighted in the title (CSS- class “accessKey”) and an accessible text will be appended to the title (ALT-<accesskey>). The keys 0, D, B, A, F, X will never be used for auto-generating, only if the user explicitly set them with gov_accesskey.

Known problems

If you override an accesskey with gov_accesskey later in the menu, it might already have been used, so it will be double-booked.

To-Do list

Nothing so far

Changelog

  • 0.1.0: First public version
  • 0.2.0:
  • Added forbiddenKeys option
  • Will now render the accesskey provided by gov_accesskey, if one is set. So you now don't need to patch TYPO3 anymore to get accesskeys working.

img-2 EXT: Auto Accesskeys - 3