Administration
The Administration area of Drupal is one of the biggest "Downsides" of the otherwise amazing system. (the other being the source code itself.) While it is not "there yet" one of the ambitions of Zupal is to be a nicer admin areas.
Currently, site and module administration is disjointed; you can add menu items into a module's aministration as part of a module's configuration but there is no real API for tucking a module's administration into the core Administration module.
Because of this, the Administration module covers sitewide tasks - turning optional modules on and off, finding/editing users, roles, resources, and module development tools.
One of the great timesavers of Zupal is the ability to instantly spawn off a domain class using the Administration module. You stil have to manually "finish off" the domain class by pasting creation SQL into the table class. This, it's worth noting, kind of commits you to using MySQL for Zupal at this point.
Module level administration on the other hand has to be manually added into the menu. There is a router that sends commands to module level adminControllers:
routes.admin_mvc.route = "admin/:module/c/:controller/:action/*" (routes to any controller in a module) routes.admin_mv.route = "admin/:module/:action/*" (routes to an AdminController in a module)
but the actual implemenation of a module's administration is up to the module developer at this point.
Autoaspawning of resources
One of the RAD gains from Zupal is the ability to jumpstart resources using the admin layer. The Administration section has the ability to write domain classes, forms and actions using the admin menu. Unser the Administration/Module/Edit Modules command is a tabbed wizard with the below listed functions.
The destination point of the spawned files needs to be chosen carefully; it determines the filename prefix of the resource (and the module in which they can be found). There is usually no harm in accidentally creating resources in the wrong module -- just hunt down and destroy the resulting files and patch your controller if necessary.
Domain Class Creation
Creating domain classes is virtually a one step operation. The only task that remains is for you to open the resulting table class and insert a block of SQL for creation of the table so that if the module is deployed in a new environment the table will autospawn. You can also insert initial data here as well.
<?php
class Ultimatum_Model_DbTable_Ultplayergrouporderresizes extends Zupal_Table_Abstract
{
protected $_name = 'ult_player_group_order_resizes';
public function create_table()
{ // You will have to add the SQL for table creation here:
$sql = <<<SQL
CREATE TABLE `ult_player_group_order_types` (
`name` varchar(45) collate utf8_bin NOT NULL,
`Title` varchar(255) collate utf8_bin NOT NULL,
`description` text collate utf8_bin NOT NULL,
`target_type` enum('self','other','both','none') collate utf8_bin NOT NULL default 'other',
`turns` tinyint(11) unsigned NOT NULL default '1',
`active` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`name`),
FULLTEXT KEY `description` (`description`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
SQL;
$this->getAdapter()->query($sql);;
}
}
Form Creation
You can create a basic Zupal_Domain_Form for an existing table. the resulting form is driven by a config file and is somewhat "dumb" -- just a series of text fields and a submit button -- but it is a good jumping off point for a basic form. You will need to customize the type and possibly order of the resulting elements.
Form creation uses Zupal_Domain_Form_Abstract as its basis -- it has not been updated to use FastForms -- however it is pretty easy to retrofit the resulting class to use FastForms if you wish.
Action Creation
This is one of the riskier spawns -- it actually edits the controller file. Because it is potentially destructive, it backs up the controller file before it edits it, into a folder "mvc_backups" in the root folder.
Because of an error in the reflection class, adding an action to a controller will remove most of the extra returns in the file. This alone may make it too annoying to use for some people.
Once you add the action you are provided with a "before and after" screen. This gives you one last chance to revert the file easily. You can also do a little cut and past to blend the previously existing spacing/code with the new controller and save that.

Post new comment