Yii Framework Forum: iCrud - CRUD with i18n support - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

iCrud - CRUD with i18n support Standard CRUD plus i18n support and some extra improvements. Rate Topic: -----

#1 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 11 February 2010 - 01:57 AM

Greetings from Colombia.
I've developed a new CRUD that I called iCRUD (i18n crud). It is already prepared for i18n messages and also It has some improvements over standard CRUD command.
Referenced input fields are automatically created as Comboboxes instead of textbox (if it is nullable, then a 'Please select' option is added). In view, admin and index views, referenced fields are loaded from master table instead of showing id value only.
Also, Controllers are extended from SBaseController (SRBAC Controller), nevertheless, It works perfectly without it.

Comments and suggestions are welcome.

If you wanna give it a try, you just have to:
  • Download icrud.zip from extensions.
  • Unzip icrud.zip into any directory.
  • Copy all files from shell directory to protected/shell directory.
  • Copy all files from messages directory to protected/messages directory.
  • Setup config/main.php file with i18n support:
    'language'=>'es',
    'charset'=>'utf-8',
    and into components block:
    'messages'=>array(
    'class'=>'CPhpMessageSource',
    ),
  • Ready to use.
I hope all you enjoy it.

Best regards.
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#2 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 13 February 2010 - 07:04 PM

Hi,

nice Extension, but i have two urgent and one normal bug Reports/Enhancements i needed to do to get it working:

1.)

please add an ucfirst($modelClass) to shell/iCrudCommand.php in line 36, 39, 83 & 86 since the tablename of the Database doesn't need to be identical to the Model Classname. (like this:)

  public function generateActiveField($modelClass,CDbColumnSchema $column)
        {
                if($column->isForeignKey){
                        $model=CActiveRecord::model(ucfirst($modelClass));
                        $table=$model->getTableSchema();
                        $fk = $table->foreignKeys[$column->name];
                        $fmodel=CActiveRecord::model(ucfirst($fk[0]));
                        $fmodeltable = ucfirst($fmodel->tableName());
                        $ftable=$fmodel->getTableSchema();
                        $fcolumns=$fmodel->attributeNames();

                        if($column->allowNull)
                                return("echo CHtml::activeDropDownList(\$model,'{$column->name}',CHtml::listData({$fmodeltable}::model()->findAll(), '{$ftable->primaryKey}', '{$fcolumns[1]}'),array('prompt'=>Yii::t('App', 'Choose...')))");
                        return("echo CHtml::activeDropDownList(\$model,'{$column->name}',CHtml::listData({$fmodeltable}::model()->findAll(), '{$ftable->primaryKey}', '{$fcolumns[1]}'))");
                }



(and so on)

2.)

please update the Controller Code to be compatible with yii-1.1-dev this way:

shell/icrud/controller.php

at line 20:


        public $menu = array();
        
        public $breadcrumbs = array();


(this is missing in the SBaseController of SRBAC, too at the moment...)


Nevertheless: really good Idea and good implementation so far.


3.)

In your generated Controller line 137:

   throw new CHttpException(404,Yii::t('The requested page does not exist.'));


should be

   throw new CHttpException(404,Yii::t('App', 'The requested page does not exist.'))

4.) I have made a german App message string collection for you to include in the next version, if you want to collect some default i18n message strings. I can send it by mail (this forum doesnt allow attaching files for me)
0

#3 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 14 February 2010 - 01:06 PM

Thanks for your feedback.

View Postthyseus, on 13 February 2010 - 07:04 PM, said:

1.)

please add an ucfirst($modelClass) to shell/iCrudCommand.php in line 36, 39, 83 & 86 since the tablename of the Database doesn't need to be identical to the Model Classname. (like this:)


Could you give me more details? I undertand your position, but I've not found and/or experienced problems without ucfirst statement. iCRUD has being developed for working with Yii 1.1 (my test have been on Yii 1.1 lastest svn), also, $modelClass var is loaded with model name exactly same to CRUD standard command. Nevertheless I'm gonna do more tests to verify this bug.

View Postthyseus, on 13 February 2010 - 07:04 PM, said:

2.)
please update the Controller Code to be compatible with yii-1.1-dev this way:
shell/icrud/controller.php
at line 20:

        public $menu = array();
        
        public $breadcrumbs = array();

(this is missing in the SBaseController of SRBAC, too at the moment...)

Fixed, generated Controller is not being extended from SBaseController anymore, since Yii 1.1 has a default Controller. This way iCRUD will be more usable and can be work with or without SRBAC. However, in srbac svn this bug has been already fixed.

View Postthyseus, on 13 February 2010 - 07:04 PM, said:

3.)
In your generated Controller line 137:
   throw new CHttpException(404,Yii::t('The requested page does not exist.'));

should be
   throw new CHttpException(404,Yii::t('App', 'The requested page does not exist.'))


Fixed.

View Postthyseus, on 13 February 2010 - 07:04 PM, said:

4.) I have made a german App message string collection for you to include in the next version, if you want to collect some default i18n message strings. I can send it by mail (this forum doesnt allow attaching files for me)

I added you to Skype, that way we can chat about and you can send me your i18n messages file.

I'm going to upload the new version with this little fixes. And if some one wants to send a language messages file will be very helpful to all.

Again, thanks for your feedback, I hope this extension let us to do our work easier, faster, more extendable, more reliable, etc, etc, etc. We should concentrate on what is really important, not in little details.

Best regards.
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#4 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 14 February 2010 - 05:00 PM

I've uploaded a new version, also SVN is working now.
http://code.google.com/p/icrud/
Feedback, suggestions and new ideas are welcome.
Regards
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#5 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 21 February 2010 - 01:04 PM

I've published a new Beta version of iCRUD. The new version have some improvements:
  • French messages added.
  • Datatype TINYINT(1) is evaluated as BOOLEAN when MySQL databases are used.
  • Also, some minor bugs and messages fixed.
New languages and improvements are welcome.
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#6 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 22 February 2010 - 11:26 AM

A new version of iCRUD has been published. Several improvements and bugs fixed. Give it a try. This version is the first candidate to be stable version.
Some of the new features (and bugs fixed) are:
  • Fixed bugs in index view and controller.
  • Default view is admin (index is not anymore)
  • Breadcrumbs are using a text value (with i18n support too)
  • Foreign keys now can be filtered by combo-boxes (no bugs)
  • Fixed bugs when showing foreign keys in list, view and main views.
  • Spanish and French translations updated.
  • Some other minor optimizations and some minor fixed bugs.
I hope you enjoy this extension, and I'll wait for your feedback. New message languages are welcome (e.g. Chinese, Portuguese), current languages are: English (default in Yii), German(thnx to thyseus)(need to be updated), Spanish and French (needs to be revised by a native, this is not my mature tongue).

Best regards.
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#7 User is offline   Francois Allard 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 26-February 10
  • Location:Montreal, Canada

Posted 26 February 2010 - 03:27 PM

I revised your french translation. I added the last two and modified one of them. French is my native language :)

Attached File(s)

  • Attached File  App.php (1.18K)
    Number of downloads: 10

0

#8 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 28 February 2010 - 11:16 AM

View Postfrancois.allard, on 26 February 2010 - 03:27 PM, said:

I revised your french translation. I added the last two and modified one of them. French is my native language :)


Thanks Francois. French messages has been already updated to svn repo.
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#9 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 28 February 2010 - 01:19 PM

Updated German messages to svn repo. Thanks to thyseus
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#10 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 01 March 2010 - 06:43 PM

Last updates: Added Portuguese messages to SVN Repo.
Revision by a native is needed (I speak portuguese but a native can do it better)
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#11 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 09 March 2010 - 07:04 PM

I uploaded a new version of iCRUD, it has some minor bugs fixed and the addition (and fixes) of Portuguese message.
Also, It includes and extended version of FormCommand that I called iFormCommand (for testing purposes only because it is not a definitive version). FormCommand is only available since Yii 1.1.1-dev, so if you want to try this command you must download the last Yii version from SVN repository.
Feedback, suggestions and comments are welcome.

Regards.
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#12 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 05 April 2010 - 10:39 AM

Does anybody tried iCRUD with PostgreSQL databases?
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#13 User is offline   robregonm 

  • Expert Yii Developer
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 595
  • Joined: 30-July 09
  • Location:Colombia

Posted 28 April 2010 - 09:16 AM

Good News: Support for multiple languages in GiiModule is being added to iCRUD, suggestions and ideas are welcome.
Regards.
Ricardo Obregón

YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#14 User is offline   CoLT 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 246
  • Joined: 22-November 09

Posted 30 April 2010 - 02:04 PM

[solved]

Tried to test it out but got this error:
CException
Description

Property "CPhpMessageSource.enabled" is not defined.


[edit]
Typo in config :) placed 'messages'=>array('class'=>'CPhpMessageSource'), in log component :D

Lithuanian translation file bellow:
Attached File  App.php (1.31K)
Number of downloads: 4

Best regards,
CoLT
0

#15 User is offline   CoLT 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 246
  • Joined: 22-November 09

Posted 05 May 2010 - 05:27 PM

Hey,

I have tried iCRUD rather successful until one relation one-many admin filter value:

Table WebUser has many Clients, and in Client admin view one value is WebUser(it's filter works ok):
admin.php
		array(
            'name'=>'Web_user_id',
            'value'=>'$data->WebUser->name', //does not work, see error
            'filter'=>CHtml::listData(Web_user::model()->findAll(), 'id', 'name'),
        ),

Error:
PHP Error
Description

Trying to get property of non-object
Source File

C:\wamp\www\p2b8d\lib\yii\base\CComponent.php(587) : eval()'d code(1)

No source code available.

Stack Trace

#0 C:\wamp\www\p2b8d\lib\yii\base\CComponent.php(587): eval()
#1 C:\wamp\www\p2b8d\lib\yii\zii\widgets\grid\CDataColumn.php(125): CDataColumn->evaluateExpression()
#2 C:\wamp\www\p2b8d\lib\yii\zii\widgets\grid\CGridColumn.php(135): CDataColumn->renderDataCellContent()
#3 C:\wamp\www\p2b8d\lib\yii\zii\widgets\grid\CGridView.php(447): CDataColumn->renderDataCell()
#4 C:\wamp\www\p2b8d\lib\yii\zii\widgets\grid\CGridView.php(420): CGridView->renderTableRow()
#5 C:\wamp\www\p2b8d\lib\yii\zii\widgets\grid\CGridView.php(333): CGridView->renderTableBody()
#6 C:\wamp\www\p2b8d\lib\yii\zii\widgets\CBaseListView.php(152): CGridView->renderItems()
#7 unknown(0): CGridView->renderSection()
#8 C:\wamp\www\p2b8d\lib\yii\zii\widgets\CBaseListView.php(135): preg_replace_callback()
#9 C:\wamp\www\p2b8d\lib\yii\zii\widgets\CBaseListView.php(121): CGridView->renderContent()
#10 C:\wamp\www\p2b8d\lib\yii\web\CBaseController.php(174): CGridView->run()
#11 C:\wamp\www\p2b8d\views\client\admin.php(79): ClientController->widget()
#12 C:\wamp\www\p2b8d\lib\yii\web\CBaseController.php(119): require()
#13 C:\wamp\www\p2b8d\lib\yii\web\CBaseController.php(88): ClientController->renderInternal()
#14 C:\wamp\www\p2b8d\lib\yii\web\CController.php(748): ClientController->renderFile()
#15 C:\wamp\www\p2b8d\lib\yii\web\CController.php(687): ClientController->renderPartial()
#16 C:\wamp\www\p2b8d\controllers\ClientController.php(128): ClientController->render()
#17 C:\wamp\www\p2b8d\lib\yii\web\actions\CInlineAction.php(32): ClientController->actionAdmin()
#18 C:\wamp\www\p2b8d\lib\yii\web\CController.php(300): CInlineAction->run()
#19 C:\wamp\www\p2b8d\lib\yii\web\filters\CFilterChain.php(129): ClientController->runAction()
#20 C:\wamp\www\p2b8d\lib\yii\web\filters\CFilter.php(41): CFilterChain->run()
#21 C:\wamp\www\p2b8d\lib\yii\web\CController.php(999): CAccessControlFilter->filter()
#22 C:\wamp\www\p2b8d\lib\yii\web\filters\CInlineFilter.php(59): ClientController->filterAccessControl()
#23 C:\wamp\www\p2b8d\lib\yii\web\filters\CFilterChain.php(126): CInlineFilter->filter()
#24 C:\wamp\www\p2b8d\lib\yii\web\CController.php(283): CFilterChain->run()
#25 C:\wamp\www\p2b8d\lib\yii\web\CController.php(257): ClientController->runActionWithFilters()
#26 C:\wamp\www\p2b8d\lib\yii\web\CWebApplication.php(320): ClientController->run()
#27 C:\wamp\www\p2b8d\lib\yii\web\CWebApplication.php(120): CWebApplication->runController()
#28 C:\wamp\www\p2b8d\lib\yii\base\CApplication.php(135): CWebApplication->processRequest()
#29 C:\wamp\www\p2b8d\www\index.php(13): CWebApplication->run()

2010-05-06 01:22:08 Apache/2.2.11 (Win32) PHP/5.3.0 Yii Framework/1.1.2


Where could the problem be?

[edit] Enhancement

In _view solved the labelling problem with:
if (isset($data->Web_user_id)) echo CHtml::encode($data->WebUser->name); 


Thanks

CoLT

This post has been edited by CoLT: 05 May 2010 - 06:08 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users