Author: sevein
Date: Wed Aug 10 16:13:34 2011
New Revision: 9480
Log:
First changes to make dialog.js capable to work with multi-value auto-complete
fields
Modified:
trunk/apps/qubit/modules/right/actions/editComponent.class.php
trunk/js/dialog.js
Modified: trunk/apps/qubit/modules/right/actions/editComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/right/actions/editComponent.class.php Wed Aug
10 13:18:38 2011 (r9479)
+++ trunk/apps/qubit/modules/right/actions/editComponent.class.php Wed Aug
10 16:13:34 2011 (r9480)
@@ -103,13 +103,9 @@
break;
case 'rightsHolder':
- foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::RIGHT_BASIS_ID) as
$item)
- {
- $choices[$this->context->routing->generate(null, array($item,
'module' => 'term'))] = $item->__toString();
- }
-
- $this->form->setValidator('rightsHolder', new sfValidatorString);
- $this->form->setWidget('rightsHolder', new
sfWidgetFormSelect(array('choices' => $choices, 'multiple' => true)));
+ // $this->form->setValidator('resource', new
sfValidatorBlacklist(array(
+ // 'forbidden_values' =>
array($this->context->routing->generate(null, $this->resource)))));
+ $this->form->setWidget('rightsHolder', new
sfWidgetFormSelect(array('choices' => array(), 'multiple' => true)));
break;
@@ -158,6 +154,11 @@
break;
+ case 'rightsHolder':
+
+
+ break;
+
default:
$this->right[$field->getName()] =
$this->form->getValue($field->getName());
}
Modified: trunk/js/dialog.js
==============================================================================
--- trunk/js/dialog.js Wed Aug 10 13:18:38 2011 (r9479)
+++ trunk/js/dialog.js Wed Aug 10 16:13:34 2011 (r9480)
@@ -346,19 +346,8 @@
this.save = function (yuiDialogData)
{
- $('input.form-autocomplete', thisDialog.table).each(function ()
+ var process = function (input)
{
- $hidden = $(this).prev('input:hidden');
-
- // Test for existing <iframe/>
- for (var i in thisDialog.iframes)
- {
- if (thisDialog.id === thisDialog.iframes[i].dialogId &&
$hidden.attr('name') === thisDialog.iframes[i].inputName)
- {
- var index = i;
- }
- }
-
// Test if autocomplete has a value
if (0 < this.value.length)
{
@@ -394,12 +383,23 @@
}
}
}
+ };
+ };
- // Remove <iframe/> if selecting a pre-existing value
- else if (undefined !== index && this.value !==
thisDialog.iframes[index].iframe.value)
- {
- delete thisDialog.iframes[index];
- }
+ $('input.form-autocomplete', thisDialog.table).each(function ()
+ {
+ // It is multivalue if exists a <ul> element between its
siblings
+ var $ul = $('~ ul', this);
+ if ($ul.length)
+ {
+ $ul.find('li > input').each(function()
+ {
+ // Call process()
+ });
+ }
+ else
+ {
+ // Call process()
}
});
--
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.