Permalink
Browse files

First import. From Google Code: http://code.google.com/p/giix/

  • Loading branch information...
1 parent 5f1f01a commit 8115c03dc7bf06e4b9abe1c96328f98d0272d16f @rcoelho committed Jun 6, 2012
Showing with 3,355 additions and 0 deletions.
  1. +90 −0 CHANGELOG
  2. +33 −0 FAQ
  3. +53 −0 INSTALL
  4. +31 −0 LICENSE
  5. +105 −0 README
  6. +71 −0 UPGRADE
  7. +39 −0 components/GxActiveForm.php
  8. +715 −0 components/GxActiveRecord.php
  9. +200 −0 components/GxController.php
  10. +190 −0 components/GxHtml.php
  11. +357 −0 generators/giixCrud/GiixCrudCode.php
  12. +44 −0 generators/giixCrud/GiixCrudGenerator.php
  13. +46 −0 generators/giixCrud/templates/default/_form.php
  14. +32 −0 generators/giixCrud/templates/default/_search.php
  15. +39 −0 generators/giixCrud/templates/default/_view.php
  16. +67 −0 generators/giixCrud/templates/default/admin.php
  17. +25 −0 generators/giixCrud/templates/default/auth/auth_filter_default.php
  18. +21 −0 generators/giixCrud/templates/default/auth/auth_filter_strict.php
  19. 0 generators/giixCrud/templates/default/auth/auth_none.php
  20. +25 −0 generators/giixCrud/templates/default/auth/auth_yum.php
  21. +107 −0 generators/giixCrud/templates/default/controller.php
  22. +27 −0 generators/giixCrud/templates/default/create.php
  23. +26 −0 generators/giixCrud/templates/default/index.php
  24. +29 −0 generators/giixCrud/templates/default/update.php
  25. +49 −0 generators/giixCrud/templates/default/view.php
  26. +108 −0 generators/giixCrud/views/index.php
  27. +377 −0 generators/giixModel/GiixModelCode.php
  28. +35 −0 generators/giixModel/GiixModelGenerator.php
  29. +131 −0 generators/giixModel/templates/default/_base/basemodel.php
  30. +26 −0 generators/giixModel/templates/default/model.php
  31. +108 −0 generators/giixModel/views/index.php
  32. +94 −0 helpers/GxCoreHelper.php
  33. +19 −0 messages/config.php
  34. +6 −0 vendors/gii-template-collection/LICENSE
  35. +30 −0 vendors/yii/LICENSE
View
@@ -0,0 +1,90 @@
+giix Change Log
+===============
+
+Version 1.10, to be released
+----------------------------
+Chg: Better directory organization. Now giix have its own root directory.
+Bug: Fixes issue 23: Removed undefined variables from GxActiveRecord::saveRelated.
+Chg: Removed the message translation from the generated view files.
+Enh: Added a message category to the Yii::t calls.
+Enh: Added the configuration file for generating message translations.
+Enh: Added instructions and details about the patch and messages directory configuration.
+Bug: GxActiveRecord::pkSeparator and GxActiveRecord::repColumnsSeparator shouldn't be static.
+Bug: Now generating the proper label for the relation in the view "_view".
+
+Version 1.9, 2011-07-06
+----------------------------
+Bug: GxActiveRecord::getRelationLabel supported only relations and (table-based) attributes. Support for class properties has been added.
+Chg: The method attributeLabels in the generated base model now have the FK fields set to null by default.
+Chg: The method attributeLabels in the generated base model now have the relations of the model. They are set to null by default.
+Chg: The method GxActiveRecord::label doesn't have the second parameter "ucwords" anymore. The same happens when it is overriden on the generated base model.
+Chg: The method GxActiveRecord::getRelationLabel doesn't have the third parameter "ucwords" anymore.
+Chg: Now the method GxActiveRecord::getRelationLabel gives priority to the explicitly defined label in the model.
+
+Version 1.8, 2011-06-20
+----------------------------
+Enh: Added support to active record labels.
+
+Version 1.7, 2011-06-02
+----------------------------
+Enh: Updated the code from Yii to version 1.1.7 (r3135).
+Enh: Updated the code from Yii in the default template files and generator's index views to version 1.1.7 (r3135).
+Bug: Fixed bug #10. Added proper support to 'uncheckValue'.
+Bug: Fixes issue #11. Now the generated model::search method uses the current instance of the model and allows the use of custom criteria.
+
+Version 1.6, 2011-05-09
+----------------------------
+Bug: Wrong pivot class name was generated when there were table prefixes.
+Enh: Better support to boolean values: formatted display in view "view".
+Bug: Added proper parameter checks in GxActiveRecord::__toString.
+Chg: Raised Yii version in "requirements".
+Enh: Added support for entering PK values. See http://code.google.com/p/yii/issues/detail?id=1770.
+Chg: New default value for GxActiveRecord::saveMultiple: 'detectRelations' option is now false by default.
+Enh: Added GxActiveRecord::fillPkColumnNames.
+Enh: Now GxController::loadModel supports composite PK, has autodetection features and can be used with any attribute (column).
+
+Version 1.5, 2011-05-06
+----------------------------
+Chg: GxController extends again from Controller (reverted from version 1.2).
+Enh: Now GxController::performAjaxValidation supports multiple models.
+Bug: Removed the code for saving the main model and committing the transaction from the loop in GxActiveRecord::saveWithRelated.
+Bug: Fixed a bug where the function would return instead of continue iterating in the loop in GxActiveRecord::saveWithRelated.
+Bug: Do not swallow exceptions anymore in GxActiveRecord::saveWithRelated.
+Bug: Now more code is wrapped in the try-catch block to protect the integrity of the transaction in GxActiveRecord::saveWithRelated.
+Bug: Fixed issue 5.
+Enh: Introduced GxActiveRecord::saveMultiple.
+Chg: Removed the "cancel" button from the _form view.
+
+Version 1.4, 2010-12-30
+----------------------------
+Bug: Saving related MANY_MANY relations could delete or insert wrong data since the check on current relations was not necessarily made against the database.
+
+Version 1.3, 2010-12-23
+----------------------------
+New: Added native support for saving MANY_MANY relations with the new method GxActiveRecord::saveWithRelated.
+New: Added method GxActiveRecord::pivotModels.
+New: Added automatic detection of HAS_MANY and MANY_MANY relations in the POST with the new method GxController::getRelatedData.
+New: The generated model now have the pivot class names in its pivotModels method.
+New: The generated controller now have support for saving MANY_MANY relations automatically.
+
+Version 1.2, 2010-12-14
+----------------------------
+Enh: More inline styling and formatting is removed from the generated code.
+Enh: Now the breadcrumb will contain the string representation of the model instance instead of the primary key value, when appropriate.
+Enh: Now the page heading will contain the string representation of the model instance instead of the primary key value, when appropriate.
+Bug: Fixed a bug were the action name were translated in the breadcrumb link.
+Chg: Now GxController extends directly from CController. Class Controller is no longer necessary.
+Enh: I18n support added to some messages.
+
+Version 1.1.1, 2010-12-10
+----------------------------
+Enh: All inline styling and formatting is removed from the generated code.
+Bug: GxActiveForm::enableAjaxValidation value was passed as a string instead of as a boolean in _form.php, causing it to ever evaluate to true. This caused a new record to be added in every ajax validation post (There weren't a call to GxController::performAjaxValidation).
+Chg: Removed support for enum fields.
+Bug: Now all the output data is HTML encoded.
+New: Added method GxHtml::encodeEx.
+
+Version 1.0, 2010-11-12
+----------------------------
+Initial release, based on gii-template-collection (gtc).
+Updated up to gtc r107 and yii/gii 1.1.3 r2247.
View
@@ -0,0 +1,33 @@
+giix FAQ: Frequently Asked Questions
+====================================
+
+How to install giix?
+--------------------
+
+See the README file before installing giix.
+See INSTALL file for instructions.
+Read the Yii guide at <http://www.yiiframework.com/doc/guide>.
+Read the gii documentation at <http://www.yiiframework.com/doc/api/GiiModule>.
+
+How to use giix?
+----------------
+
+See the README file before using giix.
+
+After installing, you will see the giix generators on the gii page.
+The giix generators' names start with "giix".
+
+Read the Yii guide at <http://www.yiiframework.com/doc/guide>.
+Read the gii documentation at <http://www.yiiframework.com/doc/api/GiiModule>.
+
+I need help! Where should I go?
+-------------------------------
+
+You can ask you question in the forum discussion for giix at
+<http://www.yiiframework.com/forum/index.php?/topic/13154-giix-%E2%80%94-gii-extended/>.
+Please notice that support is given mainly by the community.
+
+giix is not working. How do I report a bug?
+-------------------------------------------
+
+You can report bugs at <http://code.google.com/p/giix/issues/list>.
View
@@ -0,0 +1,53 @@
+Installing giix
+===============
+
+Before installing
+-----------------
+
+1) Make sure you read the Yii guide at <http://www.yiiframework.com/doc/guide>.
+2) Read the Gii documentation at <http://www.yiiframework.com/doc/api/GiiModule>.
+3) Read giix README file. Please give special attention to the "requirements" section.
+
+Installing
+----------
+
+1) Extract the directory "giix" from the
+downloaded archive into your application's protected/extensions directory.
+
+2) Configure the gii generator path in your application, like:
+'modules' => array(
+ 'gii' => array(
+ 'class' => 'system.gii.GiiModule',
+ 'generatorPaths' => array(
+ 'ext.giix.generators', // giix generators
+ ),
+ ),
+),
+
+3) Configure your application to automatically load the giix component classes
+when needed, like:
+'import' => array(
+ ...
+ 'ext.giix.components.*', // giix components
+),
+
+4) Register the giix messages directory, like the example below.
+Note: This feature is pending on Yii core (as of Yii 1.1.8 revision 3364). You will need to patch your Yii instalation.
+See <http://code.google.com/p/yii/issues/detail?id=2624> for details and the patch.
+'components' => array(
+ ...
+ 'messages' => array (
+ // Pending on core: http://code.google.com/p/yii/issues/detail?id=2624
+ 'extensionBasePaths' => array(
+ 'giix' => 'ext.giix.messages', // giix messages directory.
+ ),
+ ),
+),
+
+It is recommended to set at least the 'password' and 'ipFilters' properties
+in gii for security.
+For more information see the gii documentation at <http://www.yiiframework.com/doc/api/GiiModule>.
+
+Additionaly, you may remove the entire 'generators' directory and generator
+configuration (step 2 above) when releasing your Web application for improved
+security.
View
@@ -0,0 +1,31 @@
+giix is free software.
+It is dual-licensed under the terms of the following BSD License and under the
+terms of GNU General Public License v3 <http://www.gnu.org/licenses/gpl.html>.
+
+Copyright (c) 2010-2011, Rodrigo Coelho <rodrigo@giix.org>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+ * Neither the name of Rodrigo Coelho nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -0,0 +1,105 @@
+giix Readme
+===========
+
+giix version 1.10
+
+giix official website: http://giix.org/
+
+giix on...
+Yii Extension Repository: http://www.yiiframework.com/extension/giix/
+Yii Forum: http://www.yiiframework.com/forum/index.php?/topic/13154-giix-%E2%80%94-gii-extended/
+Google Code: http://giix.googlecode.com/
+Ohloh: http://www.ohloh.net/p/giix
+
+giix is gii Extended, a code generator for Yii PHP framework.
+giix is inspired and based on gii-template-collection (gtc), by Herbert Maschke (thyseus).
+
+giix is free software and is dual-licensed under the terms of the new BSD License and under the terms of GNU GPL v3. See the LICENSE file.
+
+ACKNOWLEDGEMENTS
+----------------
+
+giix is inspired and uses code from Yii PHP framework and gii-template-collection.
+Many thanks to Qiang Xue, Herbert Maschke and the contributors of these software.
+
+Also, thanks for the huge help from:
+Thiago Talma (Athos)
+Gustavo Salomé Silva (Gustavo)
+
+FEATURES
+--------
+
+giix extends Yii's gii by providing:
+- Proper handling of related model attributes, rendering appropriate form fields based on relation type.
+- More support for HAS_MANY and MANY_MANY relations.
+- Native support for saving MANY_MANY relations with the new method GxActiveRecord::saveWithRelated.
+- Native support for saving multiple (related or not) records with the new method GxActiveRecord::saveMultiple.
+- Automatic string representation for a model via GxActiveRecord::representingColumn() and GxActiveRecord::__toString().
+- Better i18n support and easier to maintain: support to active record labels. You change the label once in the model and it is automatically updated in the views. This is especially useful for plurals.
+- Out-of-the box i18n support by using Yii::t().
+- Bundled translations (pending support on Yii core as of Yii 1.1.8. See <http://code.google.com/p/yii/issues/detail?id=2624> for details).
+- Appropriate form fields are rendered based on model attribute/table field data type.
+- Separated model and basemodel. Basemodel can be regenerated without overwriting your code in the model.
+- Smart methods can query your database for just the needed data (usually the primary key and the field with the string representantion), avoiding manual setup or a "select *".
+- Extensive use of default method parameters. Appropriate data is found automatically.
+- Some (incipient) support for tables with composite primary keys.
+- Generated code is completely free from styling and formatting. Your CSS controls the presentation.
+- Generated code is (almost) free of comments.
+- Well documented and commented source code. Ohloh says that 40% of the lines in the code are comments! You can understand and modify anything you want.
+
+And a lot more! Read the CHANGELOG file and the (richly commented) source code to fully leverage giix's power.
+
+Some of these features come from gtc.
+
+WARNINGS
+--------
+
+giix is not fully tested now, so please test your application and be careful using it.
+giix is still in development. Some changes may break backwards compatibility.
+
+Are you upgrading? Please don't forget to read the UPGRADE file for instructions!
+
+REQUIREMENTS
+------------
+
+Yii 1.1.9+ is required.
+
+giix should run with:
+- Yii 1.1.8+ (tested with revision 3364 + patch*)
+- Linux
+- Apache 2.2 or nginx 0.8+
+- MySQL 5.x
+- PHP 5.2+
+
+giix may run on other setups, but there is no official suppport for them.
+There is no planned official support for other setups, including Windows/IIS, XAMPP/etc or other DBMS.
+
+* You can use giix with Yii 1.1.8 if you patch your Yii installation with the patch provided in the issue 2624:
+<http://code.google.com/p/yii/issues/detail?id=2624>.
+
+INSTALLATION AND UPGRADING
+--------------------------
+
+Please see INSTALL and UPGRADE files for instructions.
+
+USING
+-----
+
+After installing, you will see the giix generators on the gii page.
+The giix generators' names start with "giix".
+Read the gii doumentation on how to use it
+<http://www.yiiframework.com/doc/api/GiiModule>.
+
+If you want to use the GxActiveRecord::saveWithRelated method, you must first generate
+the pivot model for the cross-reference table of the relationship.
+The pivot model class is the active record between two other active records that have
+a MANY_MANY relationship.
+If you have already generated models for every table in your schema, you are ready to
+use the method to save your MANY_MANY relations.
+If you use the support for saving MANY_MANY relations as generated, you will need to
+manually write code to support scenarios. This is an important security concern.
+
+DONATE
+------
+
+Go to <http://giix.org/> and donate via Flattr or via Paypal.
View
@@ -0,0 +1,71 @@
+Upgrading Instructions for giix
+===============================
+
+IMPORTANT
+
+The following upgrading instructions are cumulative. That is,
+if you want to upgrade from version A to version C and there is
+version B between A and C, you need to follow the instructions
+for both versions A and B.
+
+General upgrade intructions
+---------------------------
+- Make a backup.
+- Clean up your assets directory.
+- Clean up your cache directory.
+- Remove the "giix" diretory from your application's extensions directory.
+- Check the requirements of the new version in the README file.
+- Then follow the install instructions for the new release in the INSTALL file.
+
+Upgrading from 1.9
+---------------------
+giix's directory layout has changed. Please review the installation instructions in INSTALL and change your configurations accordingly.
+
+The message translation was removed from the generated view files. The translation of the view files should be done via file translation.
+See <http://www.yiiframework.com/doc/guide/1.1/en/topics.i18n#file-translation> for more information.
+
+GxActiveRecord::pkSeparator isn't declared as static anymore. You should check your code and make any necessary changes accordingly.
+
+Upgrading from 1.8
+---------------------
+The method GxActiveRecord::label doesn't have the second parameter "ucwords" anymore. The same happens when it is overriden on the generated base model.
+You will need to remove the parameter from the method on your base models.
+You will have to check your code and fix any calls to the method that have the parameter.
+
+The method GxActiveRecord::getRelationLabel doesn't have the third parameter "ucwords" anymore.
+You will have to check your code and fix any calls to the method that have the parameter.
+
+Upgrading from 1.7
+---------------------
+You must implement the "label" method on each AR that extends from GxActiveRecord.
+
+Upgrading from 1.6
+---------------------
+No modification required.
+
+Upgrading from 1.5
+---------------------
+The new default value for the option 'detectRelations' in the method GxActiveRecord::saveMultiple is false.
+
+Upgrading from 1.4
+---------------------
+No modification required.
+
+Upgrading from 1.3
+---------------------
+No modification required.
+
+Upgrading from 1.2
+---------------------
+giix now has native support for saving MANY_MANY relations with the new method GxActiveRecord::saveWithRelated. You may remove any related extensions if you will use giix's native support.
+If you want to use the new GxActiveRecord::saveWithRelated method, you must first generate the pivot model for the cross-reference table of the relationship. See README file for details.
+
+Upgrading from 1.1.1
+---------------------
+More inline styling and formatting was removed from the generated code. Now you need to style your pages with your own css rules.
+Class Controller (generated by "yiic webapp") is no longer necessary. You can remove it if it isn't used.
+
+Upgrading from 1.0
+---------------------
+All inline styling and formatting is removed from the generated code. Now you need to style your pages with your own css rules.
+Removed support for enum fields. If you need this, you will have to implement it in your code.
Oops, something went wrong.

0 comments on commit 8115c03

Please sign in to comment.