Danp feajax

From TYPO3Wiki

Jump to: navigation, search

<< Back to Extension manuals page

[edit]

Author: Daniel Pötzinger
Extension key: danp_feajax (danp_feajax) (contact: danp)
Document status: draft
Major revision: 0.0.0
Minor revision: See page's Last modified date
Prerequisites:

This document is published under

the Open Content License

The content is related to TYPO3 - a GNU/GPL
CMS/Framework available from www.typo3.com

Contents

Introduction

fe Ajax Framework for barrierfree Webapplications

What does it do?

This extension is a Framework to build clean and barrierefree Ajaxapplications,
meant to be helpful for extensiondevelopers. It is neccessary to understand the principle, which is explained in this document.

For an example use danp_feajaxexample

Screenshots

Example Frontend plugin see extension "fe ajax framework example": Image:feajaxexample.png

Abstrakt View of a Website

Contains Contentelements (=CE). CE can be a interaktive CE (=ICE) or a dynamic CE (=DCE).

Properties:

  • CE: have a unique name (Id)
  • ICE: they have links or forms to interact with the user
  • DCE: they change content depending on useractions

Image:feajax_uml1.jpg

In terms of MVC Patter this means:

  • View: Contentelements
  • Control: Interactive CE, controls which parts of view changes
  • Model: application-logic (Part of Plugin)

Framework Introduction

Users manual

Image:feajax_uml.jpg


FAQ

Adminstration

FAQ

Configuration

FAQ

Typoscript Reference

Common configuration of elementloader

Property: Data type: Description: Default:
config.ajaxElementloaders.<key>

config.ajaxElementloaders.default

Elementloader configuration Define the elementloaders (defined by key. Default Elementloader defined in key default)

[config.ajaxElementloaders]

Property: Data type: Description: Default:
path string Path to the Elementloader File.
className string The classname of the elmentloader (defined in path)

[Elementloader configurations]

Example Typoscript
config.ajaxElementloaders {
 danp_fonds {
  path=EXT:danp_fonds/class.tx_danpfonds_elementloader.php
  className=tx_danpfonds_elementloader
 }
 default {
  path=EXT:danp_fonds/class.tx_danpfonds_elementloader.php
  className=tx_danpfonds_elementloader
 }
}

FE Services

Property: Data type: Description: Default:
ceId string Name (Identifier) of the ContentElement which should be shown
piVarsPrefix string prefix Id, used to set the piVars from GET/POST

[getContentElement Service]

Example: Tricky: Use uncached Contentelements

It is very useful to include CE's where you want to output something independently from site cache. So you can use the _INT TS-Objects to get uncached content:

test=USER_INT
test {
 userFunc=tx_danpfeajax_service->getContentElement
 ceId=note
 piVarsPrefix=tx_danpfonds_pi1
}

you can use this also to fill a marker with uncached content (while the rest of the output is cached)

$marker['###REMEMBER###']=$GLOBALS['TSFE']->cObj->cObjGetSingle('USER_INT',$conf);

Tutorial

How does a ajax link look like

There are some parameters which are passed:

  • name of the ICE class which should be instanciated (and which controls the actions)
  • name of the elementloader (optional) "elname" (see configuration)

Using more than one Elementloader

Two possible ways:

  1. just use independent Elementloaders by using elname and defining them in config.ajaxElementloaders...
  2. To extend a existing elementloader you can use this concept:

Just define new CE in your new extension and add a new "definitions.php" file. Now only the existing elementloader have to know them. You can do this by:

$this->addCEDefinitions(t3lib_extMgm::extPath('fonds_rememberlist').'ce/definitions.php');

(You can add your own hook for that in your elementloader)

Using Forms

The Framework is ready to work with GET or POST. A POST call with parameters from the form with id "noteform" can be called with:

xajaxCall('notecontrol','POST:noteform',true,'note') >

Use this example code in your CE:

$content .=$this->linkHelperObj->getHiddenFields();
if ($this->isAjax) 
 $content .='<input type="button" onclick="'."xajaxCall('notecontrol','POST:noteform',true,'note')".'" value="Notiz speichern">';
else
 $content .='<input type="submit" value="Notiz speichern">';

MVC ?

This Framework helps to easily programm in MVC Pattern:

  • use DCE as View
  • use ICE as Controler

Known problems

To-Do list

Changelog

0.1.0 * Initial release

0.1.1 * fix BUG with logout of users

0.1.2. * add basic support for forms

0.1.3 * add support for more than one elementloader * bugfixes * getLink allows to return only A tag parameters now (thanks Markus Thiele for the hint)

Whishlist

Personal tools