JdevTools aims to help developers create components. A lot of tasks during extension development are very repetitive tasks such as setting up files, creating database tables and writing classes for the mcv structure. With JDevTools, it will be easy to automate this process, either by creating simple scripts taking care of the process, or by using scripts that are already made. JDevTools will include tools for:

  • Setting up files
  • Create mcv boilerplate code
  • Setting up tables and registering the component in the database
  • Creating common functions for getting and displaying data
  • Creating Admin tables and forms
  • Creating pagination
  • Creating language files
  • Package extensions

How it will work

The purpose of JDevTools is to create an environment where developers easily can execute scripts, make their own scripts and use other peoples scripts. There will continuesly be new scripts added, but anyone should with ease be able to write their own.

The base of JDevTools will be an application (like the joomla installer) which will take the user through 4 steps in order to create the component:

  • Select script, or create new script: Here the user will se a list of scritps, which is in fact php files collected in the script directory of JDevTools
  • Verify and run script: Here a short warning about trusting the provider of the script will appear. The script will be shown in a text-field where the user can check it's ok and modifying it if they want to. A button will be placed, executing the script. The reason for providing this step is to make users aware that creating scripts or changing scripts is a pretty easy affair
  • [optional] Script input: If the script requires user input, it will be shown in a form on this page, where the user can fill out details and press ok
  • Page showing any errors in the script execution or saying that the script executed without problems

This will enable a developer to create the base for a component by clicking a couple of times, providing some input and click run. It's important to notice that this will not create a working component on it's own. It just creates an easily extendable base for developing a component.

The scripts

A script is a set of tasks, like creating all the files for a component, or registering a component in the database. With the project I will create some basic scripts, but the main goal is to leave the scripting process transparent so developers easily can extend existing scripts or create their own.

Each script that can be run in JDevTools is basically a collection of tasks we provide with an api. The tasks are simple, atomic and cover every single aspect of creating a component.

File creation (These functions doesn't really do anything than creating the file with the right name in the right place)

  • create controller
  • create view
  • create model
  • create template
  • create options xml-file
  • create module
  • create plugin

Code creation (adds code to a file)


  • Add controller boilerplate code
  • Add view boilerplate code
  • Add model boilerplate code
  • Create pagination
  • Create getter (get's a row of data from some table)
  • Create list (Get rows from the database and display them)
  • Create Table

Database setup


  • Create database table
  • Setup component with joomla

Packaging


  • Package Component
  • Package Module
  • Package Plugin

It's important to understand that this is not neccesarily an exhaustive list. During the development, some tasks might be split in to two atomic tasks, if this make more sense, or gathered to one. The important part is to make a solid foundation for the scripts. Not so much exactly which tasks are included or not, as new ones always can be added later on. I will be open to suggestions under the development process, and I expect to gain a lot of inspiration for new tasks the moment I get my hands dirty.



The AdminList library

As an addition to the scripts, JDevTools will also provide and use a library for making admin tables easier to create. The library will make it easier to create tables by integrating data filtering, ajax processing of common tasks like publish/unpublish and quick edit to change data on the fly. To construct an admin table should be a question of specifying the content of each collumn, and then letting joomla take care of the rest. Practically speaking a possible way of doing it could look like this:



    $table = new Table($items,$pagination)
    $table->col("name")->edit()
    $table->col("area_id")->db("#__areas","name")->label("Area");
    $table->col("description")->truncate(50);

And then in the tmpl:



    echo $table

This would create a table with 3 collumns (besides id and checkbox),



  • One column displaying the name (that is, accessing $item[n]->name) for all n's) and being a link to the edit page (that's what the edit() method does)
  • One column showing the area name and sending an sql request to the #__areas table to get the name with that specific area_id, and finally having the heading as "Area" instead of "Area_id"
  • One column showing the description truncated down to around 50 characters

Then a __toString method would render the table, filling in the


information.



Final thoughts

The main focus with this project is to provide a base that's flexible and extensible. Nothing get's complety right the first time around, but with JDevTools I hope that a strong foundation will make it possible for us to gradually achieve something very useful. This means practically speaking that everything must be coded with extensibility in mind. Tasks must follow common procedures and be easy and intuitive to add. Scripts must be simple to understand and easy to create. Libraries and apis must be straightfoward to use and easy to extend. With a strong foundation I'm very confident this can be a very valuable tool for web developers using joomla.