Author: david
Date: Mon Sep 14 11:46:50 2009
New Revision: 3264
Log:
Switch to symfony form design pattern for aclGroup. Copy implementation from
informationobject/actions/editAction.class.php and
informationobject/templates/editIsadSuccess.php
Modified:
trunk/plugins/qbAclPlugin/modules/aclGroup/actions/editAction.class.php
trunk/plugins/qbAclPlugin/modules/aclGroup/templates/editSuccess.php
Modified:
trunk/plugins/qbAclPlugin/modules/aclGroup/actions/editAction.class.php
==============================================================================
--- trunk/plugins/qbAclPlugin/modules/aclGroup/actions/editAction.class.php
Mon Sep 14 11:24:46 2009 (r3263)
+++ trunk/plugins/qbAclPlugin/modules/aclGroup/actions/editAction.class.php
Mon Sep 14 11:46:50 2009 (r3264)
@@ -24,13 +24,41 @@
'description'
);
+ protected function addField($name)
+ {
+ switch ($name)
+ {
+ case 'name':
+ $this->form->setDefault($name, $this->group[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
+ break;
+ case 'description':
+ $this->form->setDefault($name, $this->group[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
+ break;
+ }
+ }
+
public function execute($request)
{
$this->group = QubitAclGroup::getById($this->getRequestParameter('id'));
$this->forward404If(null == $this->group);
+ $this->form = new sfForm;
+ $this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
+
$this->permissions = $this->group->getAclPermissions();
+ // HACK: Use static::$NAMES in PHP 5.3,
+ // http://php.net/oop5.late-static-bindings
+ $class = new ReflectionClass($this);
+ foreach ($class->getStaticPropertyValue('NAMES') as $name)
+ {
+ $this->addField($name);
+ }
+
$this->isAdministrator = false;
if ($this->getUser()->hasCredential('administrator'))
{
Modified: trunk/plugins/qbAclPlugin/modules/aclGroup/templates/editSuccess.php
==============================================================================
--- trunk/plugins/qbAclPlugin/modules/aclGroup/templates/editSuccess.php
Mon Sep 14 11:24:46 2009 (r3263)
+++ trunk/plugins/qbAclPlugin/modules/aclGroup/templates/editSuccess.php
Mon Sep 14 11:46:50 2009 (r3264)
@@ -21,15 +21,10 @@
<fieldset class="collapsible" id="definitionArea">
<legend><?php echo __('definition')?></legend>
- <div class="form-item">
- <label for="dates"><?php echo __('name') ?></label>
- <input type="text" name="name" value="<?php echo
$group->getName(array('cultureFallback' => true)) ?>" size="20" />
- </div>
- <div class="form-item">
- <label for="dates"><?php echo __('description') ?></label>
- <textarea name="description" class="resizable" style="height: 4em; width:
30em"><?php echo $group->getDescription(array('cultureFallback' => true))
?></textarea>
- </div>
+ <?php echo render_field($form->name, $group) ?>
+
+ <?php echo render_field($form->description, $group, array('class' =>
'resizable')) ?>
<tr><td>
<table class="inline">
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---