marco component's builder for Joomla! 1.5

Creating components for Joomla 1.5! is much more complicated than doing so for version 1.0 because you need to write lot of code for controllers, models, views, tables and templates for the view.

However much of this code is just a writing machine ... So why rewrite it every time?

This is why I wrote Marco's Component Maker for Joomla!1.5 (formerly Joomla Component Builder), for me it was useful, I hope it is for you.

This extension is also published on http://extensions.joomla.org , if you like, it vote it or write a review, thank you.

Building components for Joomla!1.5

 

New in version 1.5.2.0: Joomla! 1.6 support

 

Note: because of the work, I'm late with new releases of the program :(

So you can ignore the warning "This version has expired, ..."

Sorry, marco

 

FEATURES

  • generates full working components
  • retrieves the necessary data directly from a MySQL database
  • Create controllers, models, views, tables and templates for any of the selected tables
  • auto determins primary key field (must be numeric)
  • creates the files needed to edit individual records and to display the listing of tables
  • generates installable components
  • is based on customizable templates to generate the php files of Joomla
  • templates are based on the component com_hello so you can refer to the documentation of Joomla!
  • Joomla 1.5 and 1.6 code generation

 

REQUIREMENTS

  • runtime. NET 2.0+ or Mono 2.4.3+
  • MySql Connector-Net 6.2.3 from http://dev.mysql.com/downloads/connector/net/
  • a mysql db access via TCP / IP installed the tables containing the data for the management of which is to create the component
  • a little 'patience as it is still in beta ...

releases prior 1.5.0 only:

  • why is created functioning components, the tables must have these three fields (the default Joomla!): id (primary key), published and ordering. If these fields do not exist will also be edited in the source table and controllers.

releases 1.5.0 +:

  • the fields published and ordering are no more mandatory, anyway these fields have a special role/management (as in Joomla! default).

As you understood, this is a machine translation. Not always I have time to translate the text, so I limit myself to some corrections: sorry...

 

INSTRUCTIONS

Please, read carefully the instructions and the articles about the sample component before asking for help. The program is provided free, but without any support. anyway I try to respond to every mail.

1.

please, READ THIS FOXED PAGE till the end. thanks.

download the package: Joomla!1.5 generator components (downloads are at the end of the page, before comments) and unzip it in a folder.

 

2.

change JoomlaComponentBuilder.exe.config (marcoComponentMaker.exe.config since v 1.1) to meet your MySQL server settings and add the connectionStrings

<?xml version = "1.0" encoding = "utf-8"?>
<configuration>
<connectionStrings>
<add name = "testserver" ProviderName = "MySql.Date.MySqlClient "connectionString =" Server = 192.168.10.76; vmtest1 Database = uid = root; =;"/> Pwd
</ connectionStrings>
</ configuration>

you would enter:

  • mnemonic IP address or server (Server)
  • database name to use (Database)
  • username (UID) [must be able to see the tables needed to component]
  • Password (PWD)

 

Note on MySQL Connector 6.2.2:

This version of the connector has a bug: the insertion of a key without the corresponding value generates a runtime error, so if you wish to access the DB without a password, and you omit the value for password, you have not to insert the Pwd keyword.

the connection string, instead of:

<add name="testServer" providerName="MySql.Data.MySqlClient" connectionString="Server=192.168.10.76;Database=vmtest1;Uid=root;Pwd=;"/>

becomes:

<add name="testServer" providerName="MySql.Data.MySqlClient" connectionString="Server=192.168.10.76;Database=vmtest1;Uid=root;/>

(ip and databases values are just examples)

 

Newer MySQL Connector driver: (since v 1.5)

To use a new MySQL driver with this build of the program open marcoComponentMaker.exe.config and locate the line

<bindingRedirect oldVersion="6.2.3.0" newVersion="6.2.3.0"/>

insert the driver build version as newVersion pararameter.

At the time of writing, the latest version of the mysql connector is 6.3.5, so, if you have downloade this one, change previous line to:

<bindingRedirect oldVersion="6.2.3.0" newVersion="6.3.5.0"/>

3.

run the program.

fill in the fields:

  • Component Name: the name of the component
  • Safe Name: the name (without _ or other strange characters, using only lowercase letters) for use in models. ... Controllers
  • Table prefix: used to install Joomla (Prefix Table) [part of the name to be replaced with'#__', typical 'jos_']
  • License: license for generated files (do do)
  • Render "text" fields as: default renderer for text type(tinytext, text, mediumtext, longtext) fields
    • textarea: default html <textarea>
    • rte editor: Joomla! rte editor
  • Render "datetime" fields as: default renderer for datetime type(date, time, timestamp, datetime) fields
    • calender: Joomla! js calendar
    • string: default html <input>
  • Output Version: targeted Joomla! version
  • Generate translation file: create a translation file for each selected language (you have to translate... of course)

 

4.

and then select the database tables for which will be created models, controllers and views

fill in the fields:

  • Select: Select the tables that will be part of the component
  • FE: not yet implemented
  • FE view: not yet implemented
  • Table Class: The name used to create the table
  • Single record object handler name:The name used to create the objects needed to interact with the table recordset
  • Recordset object handler name: The name used to create the objects needed to interact with the single record

 

5.

the program parses the DB and shows the fields in every table

 

use tab navigation to select the table to edit. These options works only on BE (back end)

  • Field name: (read only)
  • Field type: (read only)
  • Show in list:show field when list records (default: primary key, `id`, `name`, `title`, `publish`, `published`, `ordering`, `access`)
  • Search:use field for search records in table (default: all text type fields)
  • Show in edit:show field in edit form (default: all but primary key)
  • Get Field Data:generate method in record list model to get specific field values (see code comments for help)
  • Foreign key:not implemented yet
  • Render As:use a specific input type for rendering (input, text area, rte, select, boolean radio, calendar)
  • Comment:  (read only)

Please pay attention!
'Get Field Data' doesn't check if method name is valid. so if you select the field 'name' will be generated the getName() method overriding the  JModel->getName(). In doubt add a suffix to auto-generated method! (fixed in 1.5.2.0)

6.

Not yet implemented. Options (preferences) for component. Does'nt work: press 'Next Step'.

 

7.

Create the component for Joomla! in a subdirectory in the folder where you ran the progam (com_ [Safe Name])

 

8.

At this point you will:

  • correct form of editing data in forms of back-end com_[SafeName]/admin/views/[TableClass]/tmpl/default.php
    • fix javascript control
  • designing the layout of views in the front end in com_[SafeName]/site/views/[TableClass]/tmpl/default.php
  • obviously add the logic of the component in the controller;)

releases prior 1.5.1 only:

  • Remove unnecessary fields from the display format for record set in com_[SafeName]/admin/views/[TableClassList]/tmpl/default.php

 

releases prior 1.5.0 only:

  • add routing to indicate the default view of the back-end (comment out the code and add the name of the controller and view) in com_ [Safe Name] / admin / [Safe Name]. php
  • edit com_ [Safe Name] / admin / views / [Table Class] / tmpl / default.php to create the textarea if required editing HTML, and currently they are created only input of type text that can not handle HTML code, in this case must also be changed according to the 'Store ()' fee in the model to allow this type of content.

compacted the component, or load it in the directory / tmp, and install it.

 

9.

let me know what you think: be good, is still in beta;)

 

Notes on Joomla! 1.6 code generation

Joomla! 1.6 support in still in alpha version. Generated code runs, but is a 1.5 porting, not a real 1.6 code. Not all new features are supported.

OK:

  • it runs!!
  • translation files fully compliant
  • basic ACL support on component

KO:

  • no ACL at table / row level
  • do not use new class for models/controllers/forms/fields in admin

 

Supported OSs

Bad news from the front of Mono.
Because a lack of implementation in System.Windows.Forms.DataGridViewCell.GetValue() function call, versions greater than 1.5 are not compatible with the Mono environment.
I hope this will be fixed soon.

The program requires Microsoft. NET 2.0+ or Mono 2.4.3+; therefore can be used on any operating system that supports one of two frameworks:

* Windows: XP, Vista, Windows 7, Windows 2003
* Linux
* Mac OS X Tiger(10.4), Leopard (10.5), and Snow Leopard (10.6)

The installation package contains the library Mysql.Data.dll 6.1.2.0 for Windows (not included since v1.1); to use the program on another OS, delete the library and install the package 'Connector-Net 6.2.2', version '. Net & Mono (Architecture Independent) ', or later, from mysql.com.

For more details, or for troubleshooting installation issues, refer to the support of Mono Mono and your operating system.

 

How to work on Ubuntu

Quick instructions: To use Joomla Component Builder on Ubuntu (tested with Ubuntu 10.4) install the packages 'MonoDevelop' and 'MonoDevelop-database'. After, you have to download the package 'Connector-Net 6.2.2' version '.Net & Mono (Architecture Independent)' From mysql.com. Unzip the package and install the library in the GAC, as root, with

gacutil-i [pathToLib/]mysql.data.dll

After that, copy mysql.data.dll in /usr/lib/mono/2.0/

Bigham (thanks) also informed me that, sometimes, you must rename the file mysq.data.dll to MySql.Data.dll (http://forums.mysql.com/read.php?47,367529,367529).


Important Note: For more details, or for troubleshooting installation issues, refer to the support of Mono and your operating system.

Trouble Shooting

Here I collected some error messages and the explanation of problem. Please do not ask help about MySql Server or .NET / Mono configuration.

Could not load file or assembly 'MySql.Data'

This error means that MySql connector was not properly installed: usually this is not a marcoComponentMaker issue.

  1. Be sure to have full .NET 2.0 (or greater) and MyQql connector installed; refer to Microsoft and/or  MySql documentation/help.
    If you installed the connector properly you should have it listed in Control Panel/Software; if it is not present try again to install it.
  2. Update the reference to library in marcoComponentMaker.exe.config config file
    Should look like: 
    <bindingRedirect oldVersion="6.2.3.0" newVersion="6.3.6.0"/>
    6.3.6.0 is the latest version at time of writing. MUST match the installed version of connector!

Unable to connect to any of the specified MySQL hosts

This errors occurs when Mysql server does not accept connections from remote/local clients.

  1. Ensure socket connections are enabled or bind-address is properly set in my.cnf; check also the port used for connection (usually 3306).
    Configuration options may change: refer to MySql server documentation.
  2. Check (personal) firewalls.
  3. If you are trying to connect to a remote server, ask your provider if you can access the sql server from outside the network (and how). Usually this is not possible.

You can use MySql tool to check connections and analyze network problems.

Access denied for user 'aUser'@'aNetwork' (using password: [YES|NO])

Username and / or password are wrong or a grant is needed for user. Refer to MySql documentation.


History:

planned for next versions (some time in the future, ...but seriously)

  • J1.6 per table ACL
  • move every 'generated code' template in external resource
  • full J1.6 support (support for new J16 admin classes)
  • full xml metadata for menu items
  • full foreign keys support
  • front end editing
  • j1.6 per table-> row ACL (low priority)

 

Jan 13, 2011 - v 1.5.2.0

  • Joomla! 1.6 support
  • generation of multiple translation files
  • no more use of global vars ($mainframe, $option) both J1.5 and J1.6 code
  • minor code improvements

Dec 29, 2010 - v 1.5.1.0

  • support for translation files
  • more input render types (string, text area, rich text editor, calendar, select list, boolean radio button)
  • field by field rendering control
  • minimun support for related tables (foreign keys)
  • selection of fields for list/editing
  • selection of searchable fields

Jun 12, 2010 - v 1.5.0.0

  • no more mandatory fields in table (id, ordering,published)
  • automatic recognition of primary key (no need that there is `id`, but must be numeric)
  • generation of submenu for navigation between controllers, no more need to add navigation manually
  • back end table list with sortable fields list & filter
  • automatic rendering based on DB field type (input/textarea/rte/calendar)
  • input validation, based on DB field type, before saving data
  • configuration file management for generated component
  • more security checks

April 13, 2010

  • maintenance release for mysql connector 6.2.3

April 5, 2010

  • Added checks on the names of objects and on the structure of db
  • Added checks for mandatory fields
  • Improvements in PHP code

 

February 13, 2010

  • no new release: but Linux and Mac OS X tested!

December 17, 2009

  • See Italian Text (sorry...)

December 10, 2009

  • be: moved textbox first order of sliders
  • be: moved pages are included out of the loop
  • BE: fixed bug which delete the fields and ordering published
  • BE: added indentation in view template
  • be: table, correct the comment with bars \ \
  • BE: model, proper initialization of the new object by retrieving the values from table
  • BE: view.html.php, proper inspection new item instead of $ hello $ data
  • BE: view template, aggiuntoscheletro javascript to check
  • BE: model, input methods to sort the records
  • BE: controllers, embedded controllers in the specification of all the entry point redirects

November 20, 2009

  • initial release

Known bugs

  • Poor front end generation
  • 1.5.1+ tab control doen't work: USE only 'next step button'
  • 1.5.1 "Get Field Data" in parse table doesn't check generated method name and can ovverride Joomla! methods.
  • 1.5.1 template beViewList.php: row 43 ($rows[0]->publish) should be ($rows[0]->published) for [un]publish list.

Solved:

  • Prefix problem: fixed in 1.5.0.0
    Driver install.sql contains:
    CREATE TABLE IF NOT EXISTS `jos_mytab`
    should be
    CREATE TABLE IF NOT EXISTS `#__mytab`
    Thanx to ZnakZorro
  • 1.5.0 missing php in opening tag <? when Joomla! calendar is rendered
  • 1.5.0 error in php store() data; in templates/beModel.php replace line 98 with:
    $this->setError( $row->_db->getErrorMsg() );

 

Bugs report

Please, don't  try to submit code by comments or by conctact form, because html/php code is stripped out for security reasons. Mail reports or suggestions to Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo. .

 

DOWLOAD:

Please, read related articles (see: 'example component' and 'manage the back end #1' &  'manage the back end #2') before start to develop.

 

Security Warning

The "front end" code generated by the program versions prior to 1.5 may suffer attacks "lfi" or "SQL injection". You hardly used the "front end" code as it is, but if these are the changes:

feEntryPoint.php
line #29 (LFI vunerability) replace with
if($controller = JRequest::getWord('controller')) {

feModel.php
line #40 (SQL Injection vunerability) replace with
$id = JRequest::getInt('id', 0);

 

Ultimo aggiornamento (Lunedì 08 Agosto 2011 16:08)

 

Commenti  

 
0 #56 Amresh Kumar 2012-02-04 13:48
please Make a relese for Joomla 2.5.x
Citazione
 
 
0 #55 John Wennips 2012-02-01 19:44
Thank's Marco it's working !
Under Windows7 you must install the MySQL connector 6.4.4 under Administrator and not via another user.
This generated code gives me the structure and the boost I needed.
Many thanks for this tool.
Citazione
 
 
0 #54 John Wennips 2012-01-31 19:53
Hi Marco,
Looks like a promising tool.
But I can't connect to Mysql db. Changed the config file. installed the connector driver (6.4.4.0) changed the newer version.
The message is: can't find assemblu MySql.Data. version 6.4.4.0 he can't load the file and his dependencies.
I can see the listed program in Control Panel/Software.
What Iám doing wrong? Thanks in advance

===Answer

Hi John,
version 1.5.2 works with mysql connector 6.4.4, only adjustment required is in bindingRedirect directive:

bindingRedirect oldVersion="6.2.3.0" newVersion="6.4.4.0"

I think the error is a System.IO.FileNotFoundExc eption, usually is an error in the installation the mysql connector, try to reinstall it.

Ensure also that .NET is properly installed, may be you need to update or reinstall the framework.

Good luck,
marco
Citazione
 
 
-1 #53 Samuels dsouza 2012-01-03 12:27
When started its giving an error like this "The version has expired, please check for a new one from www.mmleoni.net/.../" . please help ...i have installed .net 4.0 on winxp, installed the mysql driver aswell..

===Answer
please read carefully ALL the page.

bye,
marco
Citazione
 
 
0 #52 Sloan 2011-11-09 18:55
Citazione Lonnie:
I know it's something you don't want to release but this would be such a great thing to have as a community project.

You've done a stellar job with it but you have time constraints ofcourse.. just imagine where this would be if there were a team effort on developing it? as it stands now it's been expired for a while.. no updates have been coming and lots of features are incomplete.. it's not knocking you at all =) it's just saying I still think this would be the perfect open source project.

I absolutely agree. You've done an awesome job, and it's been the best thing I've found for coming up to speed learning to write Joomla! modules.
Way to go Marco!
Citazione
 
 
0 #51 Sloan 2011-11-09 18:51
Citazione Ramunas:
Can someone help me please with marcoComponentM aker? I downloaded marcoComponentM aker, changed mysql values in marcoComponentM aker.exe, but it doesn't take effect. It still uses , which was in marcoComponentM aker.exe before i changed them. How can i change and make them work?

Did you edit the values in marcoComponentM aker.exe or in marcoComponentM aker.exe.config?
To be sure, copy the line for the db in the XML, and change the name. When you run the MarcoComponentM aker, and get to the second screen, the new DB should appear in the drop-down.
Citazione
 
 
0 #50 Ramunas 2011-11-09 07:17
Can someone help me please with marcoComponentM aker? I downloaded marcoComponentM aker, changed mysql values in marcoComponentM aker.exe, but it doesn't take effect. It still uses , which was in marcoComponentM aker.exe before i changed them. How can i change and make them work?
Citazione
 
 
0 #49 FAbio 2011-10-20 05:48
Su seven smette di funzionare.

===Risposta
io veramente lo uso su seven... assicurati di aver installato .NET (leggi sopra)

ciao,
marco
Citazione
 
 
+1 #48 Piet Momberg 2011-09-27 08:45
Hi, Great tool. I can't wait to use it on my website www.piet-momberg.dk Best regards Piet Momberg
Citazione
 
 
0 #47 Hugo 2011-09-20 23:38
Hi, Great software, I´ve used already in J15 and wotk great, now I'm testing your in J17, and getting this error msg when loading the form to add new data:

Warning: Invalid argument supplied for foreach() in \libraries\joom la\database\dat abase\mysql.php on line 368

Any clue where the problem can be?

Thanks.
Citazione
 

Aggiungi commento


Codice di sicurezza
Aggiorna