analyse of the com localise component -...
TRANSCRIPT
Analyse of the com_localise component
Tasks to do to recode it using Joomla!1.6 framework
Table of contents1. Identify views...................................................................................................................................2
1.1. The “languages” views.............................................................................................................21.2. The “language” view................................................................................................................31.3. The “translations” view............................................................................................................31.4. The “translation” view..............................................................................................................4
2. Identify controllers...........................................................................................................................52.1. The “main” controller...............................................................................................................52.2. The “languages” controller.......................................................................................................6
The “display” task.......................................................................................................................6The “remove” task......................................................................................................................6
2.3. The “language” controller.........................................................................................................6The “add” task.............................................................................................................................6The “edit” task............................................................................................................................7The “package” task.....................................................................................................................7The “setdefault” task...................................................................................................................7The “save” task...........................................................................................................................7The “apply” task..........................................................................................................................8The “cancel” task........................................................................................................................8The “display” task.......................................................................................................................8
2.4. The “translations” controller.....................................................................................................8The “display” task.......................................................................................................................8The “unpublish” task...................................................................................................................9The “publish” task.......................................................................................................................9The “remove” task......................................................................................................................9
2.5. The “translation” controller....................................................................................................10The “edit” task..........................................................................................................................10The “add” task...........................................................................................................................10The “save” task.........................................................................................................................10The “apply” task........................................................................................................................11The “cancel” task......................................................................................................................11The “display” task.....................................................................................................................11
3. Identify models...............................................................................................................................113.1. The “languages” models.........................................................................................................11
States.........................................................................................................................................11Methods.....................................................................................................................................11
3.2. The “language” model............................................................................................................11States.........................................................................................................................................12Methods.....................................................................................................................................12
3.3. The “translations” model........................................................................................................12States.........................................................................................................................................12Methods.....................................................................................................................................12
3.4. The “translation” model..........................................................................................................12States.........................................................................................................................................12Methods.....................................................................................................................................13
4. Identify tables.................................................................................................................................135. Identify helpers...............................................................................................................................136. Identify elements............................................................................................................................13
1. Identify views4 views are actually present in this component:
• the “languages” view
• the “language” view
• the “translations” view
• the “translation” view
1.1. The “languages” views
This view display all languages files and permits 6 tasks + access to the component parameters.
The 6 tasks
• “language.add” (managed by the “language” controller)
• “language.edit” (managed by the “language” controller)
• “languages.remove” (managed by the “languages” controller)
• “language.package” (managed by the “language” controller)
• “language.setdefault” (managed by the “language” controller)
• “translations.display” (managed by the “translations” controller)
We suggest to divide this view into 4 views using JSubMenuHelper::addEntry function
• “site” (display languages for the public site)• “administrator” (display languages for the administrator site)• “installation” (display languages for the installation site)• “languages” (display all languages)
This view must have a drop-down list for selecting a particular language
1.2. The “language” view
The “language” view edits or creates an xml file
It permits 3 tasks:
• “language.save” (managed by the “language” controller)
• “language.apply” (managed by the “language” controller)
• “language.cancel” (managed by the “language” controller)
This view must use the new JForm class of the Joomla!1.6 framework
1.3. The “translations” view
The “translations” view display all translations linked to a specific language/client
It permits 6 tasks• “translations.publish” (managed by the “translations” controller) • “translations.unpublish” (managed by the “translations” controller) • “translations.remove” (managed by the “translations” controller) • “translation.edit” (managed by the “translation” controller) • “translation.add” (managed by the “translation” controller) • “languages.display” (managed by the “languages” controller)
1.4. The “translation” view
The “translation” view permits editing of an ini language translation
It permits 3 tasks
• “translation.save” (managed by the “translation” controller)
• “translation.apply” (managed by the “translation” controller)
• “translation.cancel” (managed by the “translation” controller)
It actually has 3 javascript behaviors
• copy a reference string
• create a new row
• propose to save after a period
2. Identify controllersThere are 5 controllers
• “main” controller
• “languages” controller
• “language” controller
• “translations” controller
• “translation” controller
2.1. The “main” controller
Its default task (“redirect”) redirects the display to the “languages” controller
2.2. The “languages” controller
The “languages” controller manages a list of languages.
It permits two tasks
The “display” task
This task displays a list of languages
Input from the user • filter_order: column used to filter the order
• filter_order_Dir: direction of the order (asc or desc)
• limit: number of languages to display
• limit_start: initial number
• client: administrator, site or installation or none
States affected • filter_order (“languages” model)
• filter_order_Dir (“languages” model)
• limit (“languages” model)
• limit_start (“languages” model)
• client (“languages” model)
Action Create the “languages” view, attach the “languages” model to the view and display the view
The “remove” task
The remove task removes a list of languages
Input from the user • cid: selected languages (list of tags of the form aa-AA)
States affected • selected (“languages” model)
Action Call the “languages” model remove method and redirect to the view displaying languages
2.3. The “language” controller
The “language” controller manages 8 tasks:
The “add” task
The “add” task adds a new language
Input from the user • client: installation, site, administrator or none
States affected
Action it redirects the display to the display task of the “language” controller using the “create” layout
The “edit” task
The “edit” task edits an existing language
Input from the user • client: installation, site, administrator or none
• tag: language iso tag
States affected
Action it redirects the display to the display task of the “language” controller using the “edit” layout
The “package” task
Actually it creates a package for a core language for a particular client
Input from the user • client: installation, site, administrator or none
• tag: language iso tag
States affected • client (“language” model)
• tag (“language” model)
Action it asks to the “language” model to create the package and redirect to the “languages” view
The “setdefault” task
It assigns a language to be the default language for a particular client
Input from the user • client: installation, site, administrator or none
• tag: language iso tag
States affected • client (“language” model)
• tag (“language” model)
Action it asks to the “language” model to set the default and redirect to the “languages” view
The “save” task
It saves an xml language file
Input from the user • client: installation, site, administrator or none
• tag: language iso tag
• fields: information for the xml language file (description, backwardLang, locale, winCodePage, rtl, author, authorEmail, authorUrl, version, creationDate, copyright, copyright2, licence)
States affected • client (“language” model)
• tag (“language” model)
• fields (“language” model)
Action it asks to the “language” model to save the file and redirect to the “languages” view
The “apply” task
The “apply” task is the same than the “save” task except it redirects to the actual “language” view
The “cancel” task
It redirects to the “languages” view
The “display” task
Input from the user • client: installation, site, administrator or none
• tag: language iso tag
States affected • client (“language” model)
• tag (“language” model)
Action it creates the “language” view, attaches the “language” model to the view and display it using the layout passed in the request
2.4. The “translations” controller
It manages 4 tasks:
• “display” • “publish” • “unpublish” • “remove”
The “display” task
Input from the user • filter_order: column used to filter the order
• filter_order_Dir: direction of the order (asc or desc)
• limit: number of languages to display
• limit_start: initial number
• client: installation, site, administrator
• tag: language iso tag
States affected • filter_order (“translations” model)
• filter_order_Dir (“translations” model)
• limit (“translations” model)
• limit_start (“translations” model)
• client (“translations” model)
• tag (“translations” model)
Action it creates the “translations” view, attaches the “translations” model to the view and display it
The “unpublish” task
Input from the user • client: installation, site, administrator
• tag: language iso tag
• cid: selected translations
States affected • client (“translations” model)
• tag (“translations” model)
• selected (“translations” model)
Action it asks to the “translations” model to unpublish the selected translations and redirect to the “display” view of “translations” controller
The “publish” task
Input from the user • client: installation, site, administrator
• tag: language iso tag
• cid: selected translations
States affected • client (“translations” model)
• tag (“translations” model)
• selected (“translations” model)
Action it asks to the “translations” model to publish the selected translations and redirect to the “display” view of “translations” controller
The “remove” task
Input from the user • client: installation, site, administrator
• tag: language iso tag
• cid: selected translations
States affected • client (“translations” model)
• tag (“translations” model)
• selected (“translations” model)
Action it asks to the “translations” model to remove the selected translations and redirect to the “display” view of “translations” controller
2.5. The “translation” controller
It manages 6 tasks:
• “edit”
• “add”
• “save”
• “apply”
• “cancel”
• “display”
The “edit” task
The “edit” task edits an existing translation file
Input from the user • client: installation, site, administrator
• tag: language iso tag
• path: path to the file
States affected
Action it redirects the display to the display task of the “translation” controller using the “edit” layout
The “add” task
The “add” task adds a new translation file
Input from the user • client: installation, site, administrator
• tag: language iso tag
• name: extension name
States affected
Action it redirects the display to the display task of the “translation” controller using the “create” layout
The “save” task
It saves an translation file
Input from the user • client: installation, site, administrator
• tag: language iso tag
• strings: array of translated string
States affected • client (“translation” model)
• tag (“translation” model)
• strings (“translation” model)
Action it asks to the “translation” model to save the file and redirect to the “translations” view
The “apply” task
The “apply” task is the same than the “save” task except it redirects to the actual “translation” view
The “cancel” task
It redirects to the “translations” view
The “display” task
Input from the user • client: installation, site, administrator
• tag: language iso tag
• path: path to the file
States affected • client (“translation” model)
• tag (“translation” model)
• path (“translation” model)
Action it creates the “translation” view, attaches the “translation” model to the view and display it using the layout passed in the request
3. Identify models
3.1. The “languages” models
The “languages” models manages a list of languages
States
• “client”: administrator, site, installation or none• “filter_order”• “filter_order_Dir”• “limit”• “limit_start”• “selected”
Methods
• “remove”: removes the selected languages • “getLanguages”: get the list of languages
3.2. The “language” model
The “language” model manage a language
States
• “client”
• “tag”
• “fields”: array of fields for the xml file
Methods
• “package”: creates the package file
• “setdefault”: set the language by default
• “save”: save the xml file
• “getLanguage”: get the fields from an xml file (it must use the JForm class)
3.3. The “translations” model
States
• “filter_order”
• “filter_order_Dir”
• “limit”
• “limit_start”
• “client”
• “tag”
• “selected”
Methods
• “publish”
• “unpublish”
• “remove”
• “getTranslations”
3.4. The “translation” model
States
• “client”
• “tag”
• “path”
• “strings”