Author: sevein
Date: Wed Aug 22 12:27:05 2012
New Revision: 12164
Log:
Make languageNotes a single-value note field in RAD (like r12103), fixes issue
2310
Modified:
trunk/plugins/sfRadPlugin/lib/sfRadPlugin.class.php
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
Modified: trunk/plugins/sfRadPlugin/lib/sfRadPlugin.class.php
==============================================================================
--- trunk/plugins/sfRadPlugin/lib/sfRadPlugin.class.php Wed Aug 22 10:47:10
2012 (r12163)
+++ trunk/plugins/sfRadPlugin/lib/sfRadPlugin.class.php Wed Aug 22 12:27:05
2012 (r12164)
@@ -108,6 +108,11 @@
case 'sourceCulture':
return $this->resource->sourceCulture;
+
+ case 'languageNotes':
+
+ return $this->resource->getNotesByType(array('noteTypeId' =>
QubitTerm::LANGUAGE_NOTE_ID))->offsetGet(0);
+
}
}
@@ -134,6 +139,28 @@
$this->property($name)->value = $value;
return $this;
+
+ case 'languageNotes':
+
+ // Stop if the string is empty
+ if (0 == strlen($value))
+ {
+ break;
+ }
+
+ if (0 == count($note =
$this->resource->getNotesByType(array('noteTypeId' =>
QubitTerm::LANGUAGE_NOTE_ID))->offsetGet(0)))
+ {
+ $note = new QubitNote;
+ $note->typeId = QubitTerm::LANGUAGE_NOTE_ID;
+ $note->userId =
sfContext::getInstance()->user->getAttribute('user_id');
+
+ $this->resource->notes[] = $note;
+ }
+
+ $note->content = $value;
+
+ return $this;
+
}
}
Modified:
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
==============================================================================
--- trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
Wed Aug 22 10:47:10 2012 (r12163)
+++ trunk/plugins/sfRadPlugin/modules/sfRadPlugin/actions/editAction.class.php
Wed Aug 22 12:27:05 2012 (r12164)
@@ -47,6 +47,7 @@
'institutionResponsibleIdentifier',
'issuingJurisdictionAndDenomination',
'language',
+ 'languageNotes',
'languageOfDescription',
'levelOfDescription',
'locationOfCopies',
@@ -148,6 +149,13 @@
break;
+ case 'languageNotes':
+ $this->form->setDefault($name, $this->rad[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
+
+ break;
+
case 'type':
$criteria = new Criteria;
$this->resource->addObjectTermRelationsRelatedByObjectIdCriteria($criteria);
@@ -185,6 +193,7 @@
{
case 'editionStatementOfResponsibility':
case 'issuingJurisdictionAndDenomination':
+ case 'languageNotes':
case 'noteOnPublishersSeries':
case 'numberingWithinPublishersSeries':
case 'otherTitleInformation':
Modified:
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
==============================================================================
--- trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
Wed Aug 22 10:47:10 2012 (r12163)
+++ trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/editSuccess.php
Wed Aug 22 12:27:05 2012 (r12164)
@@ -274,49 +274,10 @@
->label(__('Script of material'))
->renderRow(array('class' => 'form-autocomplete')) ?>
- <div class="form-item">
-
- <table>
- <thead>
- <tr>
- <th style="width: 90%">
- <?php echo __('Language and script notes') ?>
- </th><th style="width: 10%; text-align: right">
- <?php echo image_tag('delete', array('align' => 'top', 'class'
=> 'deleteIcon')) ?>
- </th>
- </tr>
- </thead><tbody>
-
- <?php foreach ($resource->getNotesByType(array('noteTypeId' =>
QubitTerm::LANGUAGE_NOTE_ID)) as $item): ?>
- <tr class="<?php echo 'related_obj_'.$item->id ?>">
- <td>
- <div class="animateNicely">
- <?php echo $item->getContent(array('cultureFallback' =>
'true')) ?>
- </div>
- </td><td style="text-align: right">
- <div class="animateNicely">
- <input type="checkbox" name="delete_notes[<?php echo
$item->id ?>]" value="delete" class="multiDelete"/>
- </div>
- </td>
- </tr>
- <?php endforeach; ?>
-
- <tr>
- <td>
- <textarea name="rad_language_note" class="multiInstanceTr
resizable" size="30x2"></textarea>
- </td><td style="text-align: right">
-
- </td>
- </tr>
-
- </tbody>
- </table>
-
- <div class="description">
- <?php echo __('"[N]ote any distinctive alphabets or symbol systems
employed." (RAD 1.8.B14).') ?>
- </div>
-
- </div>
+ <?php echo $form->languageNotes
+ ->help(__('"[N]ote any distinctive alphabets or symbol systems
employed." (RAD 1.8.B14).'))
+ ->label(__('Language and script notes'))
+ ->renderRow() ?>
<?php echo render_field($form->locationOfOriginals
->help(__('"If the unit being described is a reproduction and the
location of the original material is known, give that location. Give, in
addition, any identifying numbers that may help in locating the original
material in the cited location. If the originals are known to be no longer
extant, give that information." (RAD 1.8B15a)')), $resource, array('class' =>
'resizable')) ?>
--
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.