Author: sevein
Date: Mon Sep 19 12:42:23 2011
New Revision: 9757

Log:
Show restriction bool field as select box (allow, disallow)

Modified:
   trunk/apps/qubit/modules/right/actions/editComponent.class.php
   trunk/apps/qubit/modules/right/actions/indexAction.class.php
   trunk/apps/qubit/modules/right/templates/_edit.php

Modified: trunk/apps/qubit/modules/right/actions/editComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/right/actions/editComponent.class.php      Mon Sep 
19 12:40:58 2011        (r9756)
+++ trunk/apps/qubit/modules/right/actions/editComponent.class.php      Mon Sep 
19 12:42:23 2011        (r9757)
@@ -62,9 +62,11 @@
         break;
 
       case 'restriction':
-        $this->form->setDefault('restriction', true);
+        $choices[1] = $this->context->i18n->__('Allow');
+        $choices[0] = $this->context->i18n->__('Disallow');
+
         $this->form->setValidator('restriction', new sfValidatorBoolean);
-        $this->form->setWidget('restriction', new sfWidgetFormInputCheckbox);
+        $this->form->setWidget('restriction', new 
sfWidgetFormSelect(array('choices' => $choices)));
 
         break;
 

Modified: trunk/apps/qubit/modules/right/actions/indexAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/right/actions/indexAction.class.php        Mon Sep 
19 12:40:58 2011        (r9756)
+++ trunk/apps/qubit/modules/right/actions/indexAction.class.php        Mon Sep 
19 12:42:23 2011        (r9757)
@@ -30,7 +30,7 @@
       $value['act'] = $this->context->routing->generate(null, 
array($this->resource->act, 'module' => 'term'));
     }
 
-    $value['restriction'] = (boolean) $this->resource->restriction;
+    $value['restriction'] = $this->resource->restriction;
 
     $value['startDate'] = Qubit::renderDate($this->resource->startDate);
 

Modified: trunk/apps/qubit/modules/right/templates/_edit.php
==============================================================================
--- trunk/apps/qubit/modules/right/templates/_edit.php  Mon Sep 19 12:40:58 
2011        (r9756)
+++ trunk/apps/qubit/modules/right/templates/_edit.php  Mon Sep 19 12:42:23 
2011        (r9757)
@@ -94,23 +94,11 @@
 Drupal.behaviors.rights$suffix = {
   attach: function (context)
     {
-      // Add special rendering rules
-      var handleFieldRender = function (fname)
-        {
-          if (-1 !== fname.indexOf('restriction'))
-          { alert(this.getField(fname).value);
-            return this.getField(fname).value ? 'Allow' : 'Disallow';
-          }
-
-          return this.renderField(fname);
-        }
-
       // Define dialog
       var dialog = new QubitDialog('updateRights$suffix', {
         'displayTable': 'rightsDisplay$suffix',
         'newRowTemplate': $rowTemplate,
         'height': '400px',
-        'handleFieldRender': handleFieldRender,
         'showEvent': function()
           {
             this.body.scrollTop = 0;

-- 
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.com/group/qubit-commits?hl=en.

Reply via email to