Author: sevein
Date: Mon Aug 8 15:38:23 2011
New Revision: 9461
Log:
Add new rights fields, multiple fieldsets and js behavior to toggle based in
basis combo value
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 Aug
8 15:37:38 2011 (r9460)
+++ trunk/apps/qubit/modules/right/actions/editComponent.class.php Mon Aug
8 15:38:23 2011 (r9461)
@@ -24,9 +24,23 @@
$NAMES = array(
'act',
'basis',
- 'copyrightNote',
'endDate',
- 'startDate');
+ 'startDate',
+ 'restriction',
+ // 'rightsHolder',
+ // 'rightsNote',
+ 'copyrightStatus',
+ 'copyrightStatusDate',
+ 'copyrightJurisdiction',
+ 'copyrightNote',
+ 'licenseIdentifier',
+ 'licenseTerms',
+ 'licenseNote',
+ 'statuteJurisdiction',
+ 'statuteCitation',
+ 'statuteDeterminationDate',
+ 'statuteNote'
+);
protected function addField($name)
{
@@ -48,6 +62,13 @@
break;
+ case 'statuteDeterminationDate':
+ case 'copyrightStatusDate':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
+
+ break;
+
case 'act':
foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::RIGHT_ACT_ID) as
$item)
@@ -72,9 +93,37 @@
break;
+ case 'copyrightStatus':
+
+ foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::RIGHT_BASIS_ID) as
$item)
+ {
+ $choices[$this->context->routing->generate(null, array($item,
'module' => 'term'))] = $item->__toString();
+ }
+
+ $this->form->setValidator('copyrightStatus', new sfValidatorString);
+ $this->form->setWidget('copyrightStatus', new
sfWidgetFormSelect(array('choices' => $choices)));
+
+ break;
+
+ case 'copyrightJurisdiction':
+ $this->form->setValidator('copyrightJurisdiction', new
sfValidatorI18nChoiceCountry);
+ $this->form->setWidget('copyrightJurisdiction', new
sfWidgetFormI18nChoiceCountry(array('add_empty' => true, 'culture' =>
$this->context->user->getCulture())));
+
case 'copyrightNote':
- $this->form->setValidator('copyrightNote', new sfValidatorString);
- $this->form->setWidget('copyrightNote', new sfWidgetFormTextarea);
+ case 'licenseNote':
+ case 'restriction':
+ case 'statuteJurisdiction':
+ case 'statuteCitation':
+ case 'statuteNote':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
+
+ break;
+
+ case 'licenseIdentifier':
+ case 'licenseTerms':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
break;
}
Modified: trunk/apps/qubit/modules/right/actions/indexAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/right/actions/indexAction.class.php Mon Aug
8 15:37:38 2011 (r9460)
+++ trunk/apps/qubit/modules/right/actions/indexAction.class.php Mon Aug
8 15:38:23 2011 (r9461)
@@ -25,14 +25,20 @@
$value = array();
- $value['endDate'] = Qubit::renderDate($this->resource->endDate);
- $value['startDate'] = Qubit::renderDate($this->resource->startDate);
-
if (isset($this->resource->act))
{
$value['act'] = $this->context->routing->generate(null,
array($this->resource->act, 'module' => 'term'));
}
+ if (isset($this->resource->restriction))
+ {
+ $value['restriction'] = $this->resource->restriction;
+ }
+
+ $value['endDate'] = Qubit::renderDate($this->resource->endDate);
+
+ $value['startDate'] = Qubit::renderDate($this->resource->startDate);
+
if (isset($this->resource->basis))
{
$value['basis'] = $this->context->routing->generate(null,
array($this->resource->basis, 'module' => 'term'));
Modified: trunk/apps/qubit/modules/right/templates/_edit.php
==============================================================================
--- trunk/apps/qubit/modules/right/templates/_edit.php Mon Aug 8 15:37:38
2011 (r9460)
+++ trunk/apps/qubit/modules/right/templates/_edit.php Mon Aug 8 15:38:23
2011 (r9461)
@@ -73,7 +73,7 @@
{
$editButtonJs = <<<editButtonJs
// Add edit button to rows
-jQuery('#rightDisplay tr[id]', context)
+jQuery('#rightsDisplay tr[id]', context)
.click(function ()
{
dialog.open(this.id);
@@ -91,9 +91,33 @@
// Define dialog
var dialog = new QubitDialog('updateRights', {
'displayTable': 'rightsDisplay',
- 'newRowTemplate': $rowTemplate });
+ 'newRowTemplate': $rowTemplate,
+ 'height': '400px',
+ 'showEvent': function()
+ {
+ this.body.scrollTop = 0;
+
+ jQuery('fieldset', this.body)
+ .hide()
+ .filter('[route="' + jQuery('select#editRight_basis').val() +
'"]').show();
+ }
+ });
$editButtonJs
+
+ // Hide form areas based in basis select box value
+ (function ($)
+ {
+ $(document).ready(function()
+ {
+ $('select#editRight_basis').change(function()
+ {
+ $(this)
+ .parent().nextAll('fieldset').hide()
+ .filter('[route="' + $(this).val() + '"]').show();
+ });
+ });
+ })(jQuery);
} }
content
@@ -104,15 +128,59 @@
<h3><?php echo __('Rights') ?></h3>
+ <?php echo $form->act->renderRow() ?>
+
+ <?php echo $form->restriction->renderRow() ?>
+
<?php echo $form->startDate->renderRow() ?>
<?php echo $form->endDate->renderRow() ?>
- <?php echo $form->act->renderRow() ?>
-
<?php echo $form->basis->renderRow() ?>
- <?php echo $form->copyrightNote->renderRow() ?>
+ <?php // rights_holder ?>
+
+ <?php // rights_note ?>
+
+ <fieldset route="<?php echo $sf_context->routing->generate(null,
array(QubitTerm::getById(QubitTerm::RIGHT_BASIS_COPYRIGHT_ID), 'module' =>
'term')) ?>">
+
+ <legend><?php echo __('Copyright information') ?></legend>
+
+ <?php echo $form->copyrightStatus->renderRow() ?>
+
+ <?php echo $form->copyrightStatusDate->renderRow() ?>
+
+ <?php echo $form->copyrightJurisdiction->renderRow() ?>
+
+ <?php echo $form->copyrightNote->renderRow() ?>
+
+ </fieldset>
+
+ <fieldset route="<?php echo $sf_context->routing->generate(null,
array(QubitTerm::getById(QubitTerm::RIGHT_BASIS_LICENSE_ID), 'module' =>
'term')) ?>">
+
+ <legend><?php echo __('License information') ?></legend>
+
+ <?php echo $form->licenseIdentifier->renderRow() ?>
+
+ <?php echo $form->licenseTerms->renderRow() ?>
+
+ <?php echo $form->licenseNote->renderRow() ?>
+
+ </fieldset>
+
+ <fieldset route="<?php echo $sf_context->routing->generate(null,
array(QubitTerm::getById(QubitTerm::RIGHT_BASIS_STATUTE_ID), 'module' =>
'term')) ?>">
+
+ <legend><?php echo __('Statute information') ?></legend>
+
+ <?php echo $form->statuteJurisdiction->renderRow() ?>
+
+ <?php echo $form->statuteCitation->renderRow() ?>
+
+ <?php echo $form->statuteDeterminationDate->renderRow() ?>
+
+ <?php echo $form->statuteNote->renderRow() ?>
+
+ </fieldset>
</div>
--
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.