Author: david
Date: Thu Sep 10 17:22:03 2009
New Revision: 3224

Log:
Add ACL group/edit action and template.

Added:
   trunk/plugins/qbAclPlugin/modules/aclGroup/actions/editAction.class.php   
(contents, props changed)
      - copied, changed from r3219, 
trunk/apps/qubit/modules/user/actions/editAction.class.php
   trunk/plugins/qbAclPlugin/modules/aclGroup/templates/editSuccess.php   
(contents, props changed)
      - copied, changed from r3219, 
trunk/apps/qubit/modules/user/templates/editSuccess.php
Modified:
   trunk/plugins/qbAclPlugin/modules/aclGroup/config/view.yml
   trunk/plugins/qbAclPlugin/modules/aclGroup/templates/listSuccess.php

Copied and modified: 
trunk/plugins/qbAclPlugin/modules/aclGroup/actions/editAction.class.php (from 
r3219, trunk/apps/qubit/modules/user/actions/editAction.class.php)
==============================================================================
--- trunk/apps/qubit/modules/user/actions/editAction.class.php  Thu Sep 10 
10:46:35 2009        (r3219, copy source)
+++ trunk/plugins/qbAclPlugin/modules/aclGroup/actions/editAction.class.php     
Thu Sep 10 17:22:03 2009        (r3224)
@@ -17,21 +17,24 @@
  * along with Qubit Toolkit.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class UserEditAction extends sfAction
+class AclGroupEditAction extends sfAction
 {
+  public static $NAMES = array(
+    'name',
+    'description'
+  );
+
   public function execute($request)
   {
-    $this->user = QubitUser::getById($this->getRequestParameter('id'));
-    $this->forward404Unless($this->user);
+    $this->group = QubitAclGroup::getById($this->getRequestParameter('id'));
+    $this->forward404If(null == $this->group);
 
-    $this->newRoleRelation = new QubitUserRoleRelation;
+    $this->permissions = $this->group->getAclPermissions();
 
     $this->isAdministrator = false;
     if ($this->getUser()->hasCredential('administrator'))
-      {
+    {
       $this->isAdministrator = true;
-      }
-
-   $this->credentials = $this->user->getUserCredentials();
+    }
   }
 }

Modified: trunk/plugins/qbAclPlugin/modules/aclGroup/config/view.yml
==============================================================================
--- trunk/plugins/qbAclPlugin/modules/aclGroup/config/view.yml  Thu Sep 10 
17:21:59 2009        (r3223)
+++ trunk/plugins/qbAclPlugin/modules/aclGroup/config/view.yml  Thu Sep 10 
17:22:03 2009        (r3224)
@@ -1,3 +1,6 @@
 all:
   components:
     sidebar: []
+
+editSuccess:
+  javascripts: [autocomplete, /sfDrupalPlugin/vendor/drupal/misc/collapse, 
/sfDrupalPlugin/vendor/drupal/misc/textarea]
\ No newline at end of file

Copied and modified: 
trunk/plugins/qbAclPlugin/modules/aclGroup/templates/editSuccess.php (from 
r3219, trunk/apps/qubit/modules/user/templates/editSuccess.php)
==============================================================================
--- trunk/apps/qubit/modules/user/templates/editSuccess.php     Thu Sep 10 
10:46:35 2009        (r3219, copy source)
+++ trunk/plugins/qbAclPlugin/modules/aclGroup/templates/editSuccess.php        
Thu Sep 10 17:22:03 2009        (r3224)
@@ -1,66 +1,87 @@
-<div class="pageTitle"><?php echo __('edit user'); ?></div>
-
-<?php echo form_tag('user/update') ?>
-
-<?php echo object_input_hidden_tag($user, 'getId') ?>
+<div class="pageTitle">
+  <?php echo __('Edit group') ?>
+</div>
 
-<table class="detail">
-<tbody>
+<form method="post" action="<?php echo url_for(array('module' => 'aclGroup', 
'action' => 'edit')) ?>">
+<input type="hidden" name="id" value="<?php echo $group->id ?>" />
 
-<tr><td colspan="2" class="headerCell"><?php echo link_to(__('%1% profile', 
array('%1%' => $user)), array('module' => 'user', 'action' => 'show', 'id' => 
$user->id)) ?></td></tr>
-<tr>
-
-<tr>
-  <th><?php echo __('user name'); ?></th>
-  <td>
-      <?php echo object_input_tag($user, 'getUsername', array ('size' => 20)) 
?>
-   </td>
-</tr>
-
-<tr>
-  <th><?php echo __('email'); ?></th>
-  <td><?php echo object_input_tag($user, 'getEmail', array ('size' => 20)) 
?></td>
-</tr>
-
-<tr>
-  <th><?php echo __('password'); ?></th>
-<td><?php echo link_to(__('reset password'), 
'user/passwordEdit?id='.$user->getId()) ?></td>
-</tr>
-
-<tr><th><?php echo __('user roles'); ?></th><td style="font: normal 12px/12px 
Verdana, Arial, Sans-Serif;">
-      <?php foreach ($user->getUserRoleRelations() as $roleRelation): ?>
-      <?php echo $roleRelation->getRole() ?>&nbsp;
-      <?php echo link_to(image_tag('delete', 'align=top'), 
'user/deleteRoleRelation?role_relation_id='.$roleRelation->getId()) ?>
-      <br />
-      <?php endforeach; ?>
+<div class="formHeader">
+  <?php echo $group->getName(array('cultureFallback' => true)) ?>
+</div>
 
-     <?php echo object_select_tag($newRoleRelation, 'getRoleId', 
array('related_class' => 'QubitRole', 'include_blank' => true, 'peer_method' => 
'getAll')) ?>
-</td></tr>
+<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>
+
+  <tr><td>
+    <table class="inline">
+      <caption><?php echo __('Permissions'); ?></caption>
+      <thead>
+        <tr>
+          <th style="width: 15%"><?php echo __('action') ?></th>
+          <th style="width: 15%"><?php echo __('grant/deny') ?></th>
+          <th style="width: 30%"><?php echo __('collection') ?></th>
+          <th style="width: 30%"><?php echo __('repository') ?></th>
+          <th style="width: 5%"><?php echo image_tag('delete', array('align' 
=> 'top', 'class' => 'deleteIcon')) ?></th>
+        </tr>
+      </thead>
+      <tbody>
+        <?php foreach ($permissions as $permission): ?>
+          <?php $parameters = array() ?>
+          <?php $infoObject = 
QubitInformationObject::getById($permission->objectId) ?>
+          <tr>
+            <td><?php echo 
$permission->getAction()->getName(array('cultureFallback' => true)) ?></td>
+            <td>
+              <ul class="radio">
+                <li><?php echo 
radiobutton_tag('grantDeny['.$permission->id.']', '1', 1 == 
$permission->grantDeny) ?>&nbsp;<label><?php echo __('grant')?></label></li>
+                <li><?php echo 
radiobutton_tag('grantDeny['.$permission->id.']', '0', 1 != 
$permission->grantDeny) ?>&nbsp;<label><?php echo __('deny')?></label></li>
+              </ul>
+            </td>
+            <td><?php echo $infoObject->getTitle(array('cultureFallback' => 
true)) ?></td>
+            <td>
+              <?php if (isset($parameters['repositoryId'])): ?>
+                <?php echo $parameters['repositoryId'] ?>
+              <?php else: ?>
+                <?php echo __('all')?>
+              <?php endif; ?>
+            </td>
+            <td>&nbsp;</td>
+          </tr>
+        <?php endforeach; ?>
+      </tbody>
+    </table>
+  </td></tr>
 
+  </fieldset>
 </tbody>
 </table>
 
 <!-- include empty div at bottom of form to bump the fixed button-block and 
allow user to scroll past it -->
-<div id="button-block-bump"></div>
+<div id="button-block-bump" />
 
 <div id="button-block">
-<div class="menu-action">
-<?php if (SecurityCheck::HasPermission($sf_user, array('module' => 'user', 
'action' => 'delete'))): ?>
-  <?php if ($user->getId()): ?>
-  &#160;<?php echo link_to(__('delete'), 'user/delete?id='.$user->getId(), 
'post=true&confirm='.__('are you sure?')) ?>
+  <div class="menu-action">
+  <?php if (isset($sf_request->id)): ?>
+    <?php echo submit_tag(__('save')) ?>
+    <?php if (SecurityCheck::HasPermission($sf_user, array('module' => 
'aclGroup', 'action' => 'delete'))): ?>
+      &#160;<?php echo link_to(__('delete'),
+        array('module' => 'aclGroup', 'action' => 'delete', 'id' => 
$group->id),
+        array('post' => true, 'confirm' => __('are you sure?'))) ?>
+    <?php endif; ?>
+  <?php else: ?>
+    <?php echo submit_tag(__('create')) ?>
   <?php endif; ?>
-<?php endif; ?>
-&#160;<?php echo link_to(__('cancel'), 'user/show?id='.$user->getId()) ?>
-<?php if ($user->getId()): ?>
-  <?php echo submit_tag(__('save')) ?>
-<?php else: ?>
-  <?php echo submit_tag(__('create')) ?>
-<?php endif; ?>
-</div>
-</form>
 
-<div class="menu-extra">
-  <?php echo link_to(__('add new'), 'user/create'); ?>
-  <?php echo link_to(__('list all users'), 'user/list'); ?>
-</div>
+  <?php echo link_to(__('cancel'), array('module' => 'aclGroup', 'action' => 
'list')) ?>
+  </div>
 </div>
+</form>
+</div>
\ No newline at end of file

Modified: trunk/plugins/qbAclPlugin/modules/aclGroup/templates/listSuccess.php
==============================================================================
--- trunk/plugins/qbAclPlugin/modules/aclGroup/templates/listSuccess.php        
Thu Sep 10 17:21:59 2009        (r3223)
+++ trunk/plugins/qbAclPlugin/modules/aclGroup/templates/listSuccess.php        
Thu Sep 10 17:22:03 2009        (r3224)
@@ -4,7 +4,7 @@
 <thead>
 <tr>
   <th>
-    <?php echo __('group name'); ?>
+    <?php echo __('group'); ?>
     <span class="th-link"><?php echo link_to(__('add new'), array('module' => 
'aclGroup', 'action' => 'create')) ?></span>
   </th>
   <th><?php echo __('members'); ?></th>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to