Author: peter
Date: Tue Sep 22 17:25:07 2009
New Revision: 3471
Log:
restrict note types on ISAAR and ISDIAH templates to 'maintenance notes' only
as per standards. Fixes issue #773. Switch notes to multi-select and
multi-delete contorls. Move all common note set() and get() functions to
QubitObject to avoid repetition, including moving QubitTerm note functionality
to avoid namespace clashes with QubitObject methods.
Modified:
trunk/apps/qubit/modules/actor/actions/editAction.class.php
trunk/apps/qubit/modules/actor/config/view.yml
trunk/apps/qubit/modules/actor/templates/editIsaarSuccess.php
trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php
trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
trunk/apps/qubit/modules/repository/actions/editAction.class.php
trunk/apps/qubit/modules/repository/actions/showAction.class.php
trunk/apps/qubit/modules/repository/templates/editIsdiahSuccess.php
trunk/apps/qubit/modules/repository/templates/showIsdiahSuccess.php
trunk/apps/qubit/modules/term/actions/editAction.class.php
trunk/apps/qubit/modules/term/actions/showAction.class.php
trunk/data/fixtures/taxonomyTerms.yml
trunk/lib/model/QubitActor.php
trunk/lib/model/QubitInformationObject.php
trunk/lib/model/QubitObject.php
trunk/lib/model/QubitTerm.php
Modified: trunk/apps/qubit/modules/actor/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/editAction.class.php Tue Sep 22
15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/actor/actions/editAction.class.php Tue Sep 22
17:25:07 2009 (r3471)
@@ -59,8 +59,7 @@
$this->scriptCodes = $this->actor->getProperties($name =
'script_of_actor_description');
//Notes
- $this->notes = $this->actor->getActorNotes();
- $this->noteTypes =
QubitTerm::getOptionsForSelectList(QubitTaxonomy::NOTE_TYPE_ID);
+ $this->maintenanceNotes = $this->actor->getNotesByType(array('noteTypeId'
=> QubitTerm::MAINTENANCE_NOTE_ID));
//Actor Relations
$this->actorRelations = $this->actor->getActorRelations();
@@ -100,15 +99,14 @@
$this->updateOtherNames();
$this->updateTermOneToManyRelations();
$this->updateProperties();
- //$this->updateObjectTermRelations();
- $this->updateActorNotes();
- //$this->updateInformationObjectRelations();
- //$this->updateRecursiveRelations();
- //$this->updateContactInformation();
$this->updateActorRelations();
$this->deleteActorRelations();
$this->updateEvents();
$this->deleteEvents();
+ $this->updateNotes();
+ $this->deleteNotes();
+
+ $this->actor->save();
//set redirect if actor edit was called from another module
if ($this->getRequestParameter('repositoryReroute'))
@@ -143,7 +141,6 @@
$this->actor->setSources($this->getRequestParameter('sources'));
$this->actor->setRevisionHistory($this->getRequestParameter('revision_history'));
- $this->actor->save();
}
public function updateOtherNames()
@@ -154,14 +151,6 @@
}
}
- public function updateActorNotes()
- {
- if ($this->getRequestParameter('note'))
- {
- $this->actor->setActorNote($this->getUser()->getAttribute('user_id'),
$this->getRequestParameter('note'), $this->getRequestParameter('note_type_id'));
- }
- }
-
public function updateTermOneToManyRelations()
{
if ($this->getRequestParameter('entity_type_id'))
@@ -449,4 +438,37 @@
return $this;
}
+ public function updateNotes()
+ {
+ // Update maintenance notes (multiple)
+ foreach ((array) $this->getRequestParameter('new_maintenance_note') as
$newNote)
+ {
+ if (0 < strlen($newNote))
+ {
+ $this->actor->setNote(array('userId' => $userId, 'note' => $newNote,
'noteTypeId' => QubitTerm::MAINTENANCE_NOTE_ID));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Delete related notes marked for deletion.
+ *
+ * @param sfRequest request object
+ */
+ public function deleteNotes()
+ {
+ if (is_array($deleteNotes = $this->request->getParameter('delete_notes'))
&& count($deleteNotes))
+ {
+ foreach ($deleteNotes as $noteId => $doDelete)
+ {
+ if ($doDelete == 'delete' && !is_null($deleteNote =
QubitNote::getById($noteId)))
+ {
+ $deleteNote->delete();
+ }
+ }
+ }
+ }
+
}
Modified: trunk/apps/qubit/modules/actor/config/view.yml
==============================================================================
--- trunk/apps/qubit/modules/actor/config/view.yml Tue Sep 22 15:25:45
2009 (r3470)
+++ trunk/apps/qubit/modules/actor/config/view.yml Tue Sep 22 17:25:07
2009 (r3471)
@@ -11,7 +11,7 @@
javascripts: [/sfDrupalPlugin/vendor/drupal/misc/collapse,
/sfDrupalPlugin/vendor/drupal/misc/textarea]
editIsaarSuccess:
- javascripts: [/sfDrupalPlugin/vendor/drupal/misc/collapse,
/sfDrupalPlugin/vendor/drupal/misc/textarea, multiDelete]
+ javascripts: [/sfDrupalPlugin/vendor/drupal/misc/collapse,
/sfDrupalPlugin/vendor/drupal/misc/textarea, multiDelete, multiInstanceSelect,
multiInstanceInput]
listSuccess:
javascripts:
Modified: trunk/apps/qubit/modules/actor/templates/editIsaarSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/actor/templates/editIsaarSuccess.php Tue Sep
22 15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/actor/templates/editIsaarSuccess.php Tue Sep
22 17:25:07 2009 (r3471)
@@ -410,27 +410,26 @@
</div>
<div class="form-item">
- <label for="notes"><?php echo __('notes'); ?></label>
<table class="inline">
<tr>
- <td class="headerCell" style="width: 65%;"><?php echo __('note');
?></td>
- <td class="headerCell" style="width: 30%"><?php echo __('note
type'); ?></td>
- <td class="headerCell" style="width: 5%;"></td>
+ <th style="width: 90%;"><?php echo __('Maintenance Notes') ?></th>
+ <th style="width: 10%; text-align: right"><?php echo
image_tag('delete', array('align' => 'top', 'class' => 'deleteIcon')) ?></th>
+ </tr>
+ <?php if ($maintenanceNotes): ?>
+ <?php foreach ($maintenanceNotes as $maintenanceNote): ?>
+ <tr class="<?php echo 'related_obj_'.$maintenanceNote->getId() ?>">
+ <td><div class="animateNicely">
+ <?php echo $maintenanceNote->getContent(array('cultureFallback' =>
'true')) ?>
+ </div></td>
+ <td style="text-align: right;"><div class="animateNicely">
+ <input type="checkbox" name="delete_notes[<?php echo
$maintenanceNote->getId() ?>]" value="delete" class="multiDelete" />
+ </div></td>
</tr>
-
- <?php if (count($notes) > 0): ?>
- <?php foreach ($notes as $note): ?>
- <tr>
- <td><?php echo $note->getContent(array('cultureFallback' => true))
?><br/><span class="note"><?php echo $note->getUser() ?>, <?php echo
$note->getUpdatedAt() ?></span></td>
- <td><?php echo $note->getType() ?></td>
- <td style="text-align: center;"><?php echo
link_to(image_tag('delete', 'align=top'), array('module' => 'actor', 'action'
=> 'deleteNote', 'noteId' => $note->getId(), 'returnTemplate' => 'isaar'))
?></td>
- </tr>
<?php endforeach; ?>
<?php endif; ?>
-
- <tr valign="top">
- <td><?php echo input_tag('note')?></td>
- <td><?php echo select_tag('note_type_id',
options_for_select($noteTypes))?></td>
+ <tr>
+ <td><?php echo textarea_tag('new_maintenance_note', '',
array('class' => 'multiInstanceTr', 'size' => '30x2')) ?></td>
+ <td style="text-align: right"> </td>
</tr>
</table>
</div>
Modified: trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php Tue Sep
22 15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/actor/templates/showIsaarSuccess.php Tue Sep
22 17:25:07 2009 (r3471)
@@ -200,13 +200,10 @@
<?php endif; ?>
<?php if (count($notes) > 0): ?>
- <tr><th><?php echo __('notes')?>:
- </th><td>
<?php foreach ($notes as $note): ?>
- <?php echo $note->getType()->getName(array('cultureFallback' => true)).':
'.$note->getContent(array('cultureFallback' => true)) ?>
- <br />
+ <tr><th><?php echo $note->getType()->getName(array('cultureFallback' =>
true)) ?></th>
+ <td><?php echo $note->getContent(array('cultureFallback' => true))
?></td></tr>
<?php endforeach; ?>
- </td></tr>
<?php endif; ?>
</tbody>
Modified:
trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
Tue Sep 22 15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
Tue Sep 22 17:25:07 2009 (r3471)
@@ -162,24 +162,6 @@
{
$userId = $this->getUser()->getAttribute('user_id');
- // Update publication notes (multiple)
- foreach ((array) $this->getRequestParameter('new_publication_note') as
$newPublicationNote)
- {
- if (0 < strlen($newPublicationNote))
- {
- $this->informationObject->setNote(array('userId' => $userId, 'note' =>
$newPublicationNote, 'noteTypeId' => QubitTerm::PUBLICATION_NOTE_ID));
- }
- }
-
- // Update general notes (multiple)
- foreach ((array) $this->getRequestParameter('new_note') as $newNote)
- {
- if (0 < strlen($newNote))
- {
- $this->informationObject->setNote(array('userId' => $userId, 'note' =>
$newNote, 'noteTypeId' => QubitTerm::GENERAL_NOTE_ID));
- }
- }
-
// Update archivist's notes (multiple)
foreach ((array) $this->getRequestParameter('new_archivist_note') as
$newArchivistNote)
{
Modified: trunk/apps/qubit/modules/repository/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/editAction.class.php Tue Sep
22 15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/repository/actions/editAction.class.php Tue Sep
22 17:25:07 2009 (r3471)
@@ -67,8 +67,7 @@
$this->scriptCodes = $this->repository->getProperties($name =
'script_of_repository_description');
//Notes
- $this->notes = $this->repository->getRepositoryNotes();
- $this->noteTypes =
QubitTerm::getOptionsForSelectList(QubitTaxonomy::NOTE_TYPE_ID);
+ $this->maintenanceNotes =
$this->repository->getNotesByType(array('noteTypeId' =>
QubitTerm::MAINTENANCE_NOTE_ID));
// Add javascript libraries to allow multiple instance select boxes
$this->getResponse()->addJavaScript('/vendor/jquery');
@@ -92,7 +91,12 @@
$this->updateTermOneToManyRelations();
$this->updateProperties();
$this->updateContactInformation();
- $this->updateRepositoryNotes();
+ $this->updateNotes();
+
+ $this->repository->save();
+
+ // delete related objects marked for deletion
+ $this->deleteNotes();
}
public function updateActorAttributes()
@@ -101,7 +105,6 @@
$this->repository->setHistory($this->getRequestParameter('history'));
$this->repository->setMandates($this->getRequestParameter('mandates'));
$this->repository->setInternalStructures($this->getRequestParameter('internal_structures'));
- $this->repository->save();
}
public function updateRepositoryAttributes()
@@ -123,8 +126,6 @@
$this->repository->setDescRules($this->getRequestParameter('desc_rules'));
$this->repository->setDescSources($this->getRequestParameter('desc_sources'));
$this->repository->setDescRevisionHistory($this->getRequestParameter('desc_revision_history'));
-
- $this->repository->save();
}
public function updateTermOneToManyRelations()
@@ -155,8 +156,6 @@
{
$this->repository->setDescDetailId(null);
}
-
- $this->repository->save();
}
public function updateProperties()
@@ -244,11 +243,34 @@
}
}
- public function updateRepositoryNotes()
+ public function updateNotes()
{
- if ($this->getRequestParameter('note'))
+ // Update maintenance notes (multiple)
+ foreach ((array) $this->getRequestParameter('new_maintenance_note') as
$newNote)
{
-
$this->repository->setRepositoryNote($this->getUser()->getAttribute('user_id'),
$this->getRequestParameter('note'), $this->getRequestParameter('note_type_id'));
+ if (0 < strlen($newNote))
+ {
+ $this->repository->setNote(array('userId' => $userId, 'note' =>
$newNote, 'noteTypeId' => QubitTerm::MAINTENANCE_NOTE_ID));
+ }
+ }
+ }
+
+ /**
+ * Delete related notes marked for deletion.
+ *
+ * @param sfRequest request object
+ */
+ public function deleteNotes()
+ {
+ if (is_array($deleteNotes = $this->request->getParameter('delete_notes'))
&& count($deleteNotes))
+ {
+ foreach ($deleteNotes as $noteId => $doDelete)
+ {
+ if ($doDelete == 'delete' && !is_null($deleteNote =
QubitNote::getById($noteId)))
+ {
+ $deleteNote->delete();
+ }
+ }
}
}
}
Modified: trunk/apps/qubit/modules/repository/actions/showAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/showAction.class.php Tue Sep
22 15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/repository/actions/showAction.class.php Tue Sep
22 17:25:07 2009 (r3471)
@@ -28,8 +28,6 @@
$this->scriptCodes = $this->repository->getProperties($name =
'script_of_repository_description');
$this->otherNames = $this->repository->getOtherNames();
-
- //Notes
$this->notes = $this->repository->getRepositoryNotes();
$this->contactInformation = $this->repository->getContactInformation();
Modified: trunk/apps/qubit/modules/repository/templates/editIsdiahSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/repository/templates/editIsdiahSuccess.php Tue Sep
22 15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/repository/templates/editIsdiahSuccess.php Tue Sep
22 17:25:07 2009 (r3471)
@@ -379,30 +379,26 @@
</div>
<div class="form-item">
- <label for="notes"><?php echo __('notes'); ?></label>
<table class="inline">
<tr>
- <td class="headerCell" style="width: 65%;"><?php echo __('note');
?></td>
- <td class="headerCell" style="width: 30%"><?php echo __('note
type'); ?></td>
- <td class="headerCell" style="width: 5%;"></td>
+ <th style="width: 90%;"><?php echo __('Maintenance Notes') ?></th>
+ <th style="width: 10%; text-align: right"><?php echo
image_tag('delete', array('align' => 'top', 'class' => 'deleteIcon')) ?></th>
+ </tr>
+ <?php if ($maintenanceNotes): ?>
+ <?php foreach ($maintenanceNotes as $maintenanceNote): ?>
+ <tr class="<?php echo 'related_obj_'.$maintenanceNote->getId() ?>">
+ <td><div class="animateNicely">
+ <?php echo $maintenanceNote->getContent(array('cultureFallback' =>
'true')) ?>
+ </div></td>
+ <td style="text-align: right;"><div class="animateNicely">
+ <input type="checkbox" name="delete_notes[<?php echo
$maintenanceNote->getId() ?>]" value="delete" class="multiDelete" />
+ </div></td>
</tr>
-
- <?php if(count($notes) > 0): ?>
- <?php foreach ($notes as $note): ?>
- <tr>
- <td><?php echo $note->getContent(array('cultureFallback' => true))
?><br/><span class="note"><?php echo $note->getUser() ?>, <?php echo
$note->getUpdatedAt() ?></span></td>
- <td><?php echo $note->getType() ?></td>
- <td style="text-align: center;"><?php echo
link_to(image_tag('delete', 'align=top'),
- array('module' => 'actor', 'action' => 'deleteNote', 'noteId' =>
$note->getId()),
- array('query_string' => 'next='.url_for(array('module' =>
'repository', 'action' => 'edit', 'id' => $repository->getId())))
- ) ?></td>
- </tr>
<?php endforeach; ?>
<?php endif; ?>
-
- <tr valign="top">
- <td><?php echo input_tag('note')?></td>
- <td><?php echo select_tag('note_type_id',
options_for_select($noteTypes))?></td>
+ <tr>
+ <td><?php echo textarea_tag('new_maintenance_note', '',
array('class' => 'multiInstanceTr', 'size' => '30x2')) ?></td>
+ <td style="text-align: right"> </td>
</tr>
</table>
</div>
Modified: trunk/apps/qubit/modules/repository/templates/showIsdiahSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/repository/templates/showIsdiahSuccess.php Tue Sep
22 15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/repository/templates/showIsdiahSuccess.php Tue Sep
22 17:25:07 2009 (r3471)
@@ -245,13 +245,10 @@
<?php endif; ?>
<?php if (count($notes) > 0): ?>
- <tr><th><?php echo __('notes')?>:
- </th><td>
<?php foreach ($notes as $note): ?>
- <?php echo $note->getType()->getName(array('cultureFallback' => true)).':
'.$note->getContent(array('cultureFallback' => true)) ?>
- <br />
+ <tr><th><?php echo $note->getType()->getName(array('cultureFallback' =>
true)) ?></th>
+ <td><?php echo $note->getContent(array('cultureFallback' => true))
?></td></tr>
<?php endforeach; ?>
- </td></tr>
<?php endif; ?>
</tbody>
Modified: trunk/apps/qubit/modules/term/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/editAction.class.php Tue Sep 22
15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/term/actions/editAction.class.php Tue Sep 22
17:25:07 2009 (r3471)
@@ -80,9 +80,9 @@
$this->parent = $this->term->getParent();
}
- $this->scopeNotes = $this->term->getNotesByType($noteTypeId =
QubitTerm::SCOPE_NOTE_ID, $exclude = null);
- $this->sourceNotes = $this->term->getNotesByType($noteTypeId =
QubitTerm::SOURCE_NOTE_ID, $exclude = null);
- $this->displayNotes = $this->term->getNotesByType($noteTypeId =
QubitTerm::DISPLAY_NOTE_ID, $exclude = null);
+ $this->scopeNotes = $this->term->getNotesByType($options =
array('noteTypeId' => QubitTerm::SCOPE_NOTE_ID));
+ $this->sourceNotes = $this->term->getNotesByType($options =
array('noteTypeId' => QubitTerm::SOURCE_NOTE_ID));
+ $this->displayNotes = $this->term->getNotesByType($options =
array('noteTypeId' => QubitTerm::DISPLAY_NOTE_ID));
$this->termRelations =
QubitRelation::getRelationsBySubjectOrObjectId($this->term->getId());
@@ -104,21 +104,7 @@
$this->updateRelations();
$this->deleteRelations();
-
- if (0 < strlen($this->getRequestParameter('new_scope_note')))
- {
- $this->addNote($this->getRequestParameter('new_scope_note'),
QubitTerm::SCOPE_NOTE_ID);
- }
-
- if (0 < strlen($this->getRequestParameter('new_source_note')))
- {
- $this->addNote($this->getRequestParameter('new_source_note'),
QubitTerm::SOURCE_NOTE_ID);
- }
-
- if ($this->getRequestParameter('new_display_note'))
- {
- $this->addNote($this->getRequestParameter('new_display_note'),
QubitTerm::DISPLAY_NOTE_ID);
- }
+ $this->updateNotes();
$this->term->save();
@@ -127,16 +113,6 @@
$this->updateInfoObjectPreferredTerms();
}
- public function addNote($content, $typeId)
- {
- $newNote = new QubitNote;
- $newNote->setUserId($this->getUser()->getAttribute('user_id'));
- $newNote->setTypeId($typeId);
- $newNote->setContent($content);
-
- $this->term->notes[] = $newNote;
- }
-
public function updateRelations()
{
$deletedRelations = $this->getRequestParameter('deleteRelation');
@@ -225,6 +201,26 @@
}
}
+ public function updateNotes()
+ {
+ $userId = $this->getUser()->getAttribute('user_id');
+
+ if (0 < strlen($this->getRequestParameter('new_scope_note')))
+ {
+ $this->term->setNote($options = array('note' =>
$this->getRequestParameter('new_scope_note'), 'noteTypeId' =>
QubitTerm::SCOPE_NOTE_ID, 'userId' => $userId));
+ }
+
+ if (0 < strlen($this->getRequestParameter('new_source_note')))
+ {
+ $this->term->setNote($options = array('note' =>
$this->getRequestParameter('new_source_note'), 'noteTypeId' =>
QubitTerm::SOURCE_NOTE_ID, 'userId' => $userId));
+ }
+
+ if ($this->getRequestParameter('new_display_note'))
+ {
+ $this->term->setNote($options = array('note' =>
$this->getRequestParameter('new_display_note'), 'noteTypeId' =>
QubitTerm::DISPLAY_NOTE_ID, 'userId' => $userId));
+ }
+ }
+
public function updateParent()
{
// If broad term field is empty
Modified: trunk/apps/qubit/modules/term/actions/showAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/showAction.class.php Tue Sep 22
15:25:45 2009 (r3470)
+++ trunk/apps/qubit/modules/term/actions/showAction.class.php Tue Sep 22
17:25:07 2009 (r3471)
@@ -25,9 +25,9 @@
$this->forward404Unless($this->term);
$request->setAttribute('term', $this->term);
- $this->scopeNotes = $this->term->getNotesByType($noteTypeId =
QubitTerm::SCOPE_NOTE_ID, $exclude = null);
- $this->sourceNotes = $this->term->getNotesByType($noteTypeId =
QubitTerm::SOURCE_NOTE_ID, $exclude = null);
- $this->displayNotes = $this->term->getNotesByType($noteTypeId =
QubitTerm::DISPLAY_NOTE_ID, $exclude = null);
+ $this->scopeNotes = $this->term->getNotesByType($options =
array('noteTypeId' => QubitTerm::SCOPE_NOTE_ID));
+ $this->sourceNotes = $this->term->getNotesByType($options =
array('noteTypeId' => QubitTerm::SOURCE_NOTE_ID));
+ $this->displayNotes = $this->term->getNotesByType($options =
array('noteTypeId' => QubitTerm::DISPLAY_NOTE_ID));
$this->children = $this->term->getChildren(array('sortBy' => 'name'));
Modified: trunk/data/fixtures/taxonomyTerms.yml
==============================================================================
--- trunk/data/fixtures/taxonomyTerms.yml Tue Sep 22 15:25:45 2009
(r3470)
+++ trunk/data/fixtures/taxonomyTerms.yml Tue Sep 22 17:25:07 2009
(r3471)
@@ -843,6 +843,19 @@
source_culture: en
name:
en: published
+ QubitTerm_maintenance_note:
+ taxonomy_id: QubitTaxonomy_7
+ parent_id: QubitTerm_110
+ id: <?php echo QubitTerm::MAINTENANCE_NOTE_ID."\n" ?>
+ source_culture: en
+ name:
+ de: 'Anmerkung zur Instandhaltung(?)'
+ en: 'Maintenance note'
+ fr: 'Notes relatives à la mise à jour de la description'
+ it: 'Nota sulla manutenzione'
+ nl: Onderhoudsaantekening
+ pt: 'Nota de manutenção'
+ sl: 'Opombe obdelave'
QubitTerm_146:
taxonomy_id: QubitTaxonomy_10
parent_id: QubitTerm_110
@@ -1227,18 +1240,6 @@
nl: Stuk
pt: Item
sl: Kos
- QubitTerm_182:
- taxonomy_id: QubitTaxonomy_7
- parent_id: QubitTerm_110
- source_culture: en
- name:
- de: 'Anmerkung zur Instandhaltung(?)'
- en: 'Maintenance note'
- fr: 'Notes relatives à la mise à jour de la description'
- it: 'Nota sulla manutenzione'
- nl: Onderhoudsaantekening
- pt: 'Nota de manutenção'
- sl: 'Opombe obdelave'
QubitTerm_183:
taxonomy_id: QubitTaxonomy_11
parent_id: QubitTerm_110
Modified: trunk/lib/model/QubitActor.php
==============================================================================
--- trunk/lib/model/QubitActor.php Tue Sep 22 15:25:45 2009 (r3470)
+++ trunk/lib/model/QubitActor.php Tue Sep 22 17:25:07 2009 (r3471)
@@ -348,17 +348,6 @@
return QubitProperty::get($criteria);
}
- public function setActorNote($userId, $note, $noteTypeId)
- {
- $newNote = new QubitNote;
- $newNote->setObjectId($this->getId());
- $newNote->setScope('QubitActor');
- $newNote->setUserId($userId);
- $newNote->setContent($note);
- $newNote->setTypeId($noteTypeId);
- $newNote->save();
- }
-
public function getActorNotes()
{
$criteria = new Criteria;
Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php Tue Sep 22 15:25:45 2009
(r3470)
+++ trunk/lib/model/QubitInformationObject.php Tue Sep 22 17:25:07 2009
(r3471)
@@ -868,58 +868,6 @@
return $this;
}
- /********************
- Notes
- *********************/
-
- public function setNote(array $options = array())
- {
- $newNote = new QubitNote;
- $newNote->setObject($this);
- $newNote->setScope('QubitInformationObject');
- $newNote->setUserId($options['userId']);
- $newNote->setContent($options['note']);
- $newNote->setTypeId($options['noteTypeId']);
-
- $this->notes[] = $newNote;
- }
-
- public function getNotesByType(array $options = array())
- {
- $criteria = new Criteria;
- $criteria->addJoin(QubitNote::TYPE_ID, QubitTerm::ID);
- $criteria->add(QubitNote::OBJECT_ID, $this->getId());
- if (isset($options['noteTypeId']))
- {
- $criteria->add(QubitNote::TYPE_ID, $options['noteTypeId']);
- }
- if (isset($options['exclude']))
- {
- // Turn exclude string into an array
- $excludes = (is_array($options['exclude'])) ? $options['exclude'] :
array($options['exclude']);
-
- foreach ($excludes as $exclude)
- {
- $criteria->addAnd(QubitNote::TYPE_ID, $exclude, Criteria::NOT_EQUAL);
- }
- }
-
- return QubitNote::get($criteria);
- }
-
- public function getNotesByTaxonomy(array $options = array())
- {
- $criteria = new Criteria;
- $criteria->addJoin(QubitNote::TYPE_ID, QubitTerm::ID);
- $criteria->add(QubitNote::OBJECT_ID, $this->getId());
- if (isset($options['taxonomyId']))
- {
- $criteria->add(QubitTerm::TAXONOMY_ID, $options['taxonomyId']);
- }
-
- return QubitNote::get($criteria);
- }
-
/*****************************************
Generate Strings for Search Index
******************************************/
Modified: trunk/lib/model/QubitObject.php
==============================================================================
--- trunk/lib/model/QubitObject.php Tue Sep 22 15:25:45 2009 (r3470)
+++ trunk/lib/model/QubitObject.php Tue Sep 22 17:25:07 2009 (r3471)
@@ -70,6 +70,10 @@
return $this;
}
+ /********************
+ Status
+ *********************/
+
public function setStatus($options = array())
{
$status = $this->getStatus(array('typeId' => $options['typeId']));
@@ -93,4 +97,58 @@
return QubitStatus::getOne($criteria);
}
+
+
+ /********************
+ Notes
+ *********************/
+
+ public function setNote(array $options = array())
+ {
+ $newNote = new QubitNote;
+ $newNote->setObject($this);
+ $newNote->setScope($this->getClassName());
+ $newNote->setUserId($options['userId']);
+ $newNote->setContent($options['note']);
+ $newNote->setTypeId($options['noteTypeId']);
+
+ $this->notes[] = $newNote;
+ }
+
+ public function getNotesByType(array $options = array())
+ {
+ $criteria = new Criteria;
+ $criteria->addJoin(QubitNote::TYPE_ID, QubitTerm::ID);
+ $criteria->add(QubitNote::OBJECT_ID, $this->getId());
+ if (isset($options['noteTypeId']))
+ {
+ $criteria->add(QubitNote::TYPE_ID, $options['noteTypeId']);
+ }
+ if (isset($options['exclude']))
+ {
+ // Turn exclude string into an array
+ $excludes = (is_array($options['exclude'])) ? $options['exclude'] :
array($options['exclude']);
+
+ foreach ($excludes as $exclude)
+ {
+ $criteria->addAnd(QubitNote::TYPE_ID, $exclude, Criteria::NOT_EQUAL);
+ }
+ }
+
+ return QubitNote::get($criteria);
+ }
+
+ public function getNotesByTaxonomy(array $options = array())
+ {
+ $criteria = new Criteria;
+ $criteria->addJoin(QubitNote::TYPE_ID, QubitTerm::ID);
+ $criteria->add(QubitNote::OBJECT_ID, $this->getId());
+ if (isset($options['taxonomyId']))
+ {
+ $criteria->add(QubitTerm::TAXONOMY_ID, $options['taxonomyId']);
+ }
+
+ return QubitNote::get($criteria);
+ }
+
}
Modified: trunk/lib/model/QubitTerm.php
==============================================================================
--- trunk/lib/model/QubitTerm.php Tue Sep 22 15:25:45 2009 (r3470)
+++ trunk/lib/model/QubitTerm.php Tue Sep 22 17:25:07 2009 (r3471)
@@ -51,8 +51,9 @@
const ARCHIVIST_NOTE_ID = 124;
const GENERAL_NOTE_ID = 125;
const OTHER_DESCRIPTIVE_DATA_ID = 126;
+ const MAINTENANCE_NOTE_ID = 127;
//CollectionType taxonomy
- const ARCHIVAL_MATERIAL_ID = 127;
+ const ARCHIVAL_MATERIAL_ID = 128;
const PUBLISHED_MATERIAL_ID = 129;
const ARTEFACT_MATERIAL_ID = 130;
//ActorEntityType taxonomy
@@ -117,6 +118,7 @@
$this->getId() == QubitTerm::ARCHIVIST_NOTE_ID ||
$this->getId() == QubitTerm::GENERAL_NOTE_ID ||
$this->getId() == QubitTerm::OTHER_DESCRIPTIVE_DATA_ID ||
+ $this->getId() == QubitTerm::MAINTENANCE_NOTE_ID ||
$this->getId() == QubitTerm::ARCHIVAL_MATERIAL_ID ||
$this->getId() == QubitTerm::PUBLISHED_MATERIAL_ID ||
$this->getId() == QubitTerm::ARTEFACT_MATERIAL_ID ||
@@ -208,37 +210,9 @@
parent::delete($connection);
}
- public function setNote($userId, $note, $noteTypeId)
- {
- $newNote = new QubitNote;
- $newNote->setObjectId($this->getId());
- $newNote->setScope('QubitTerm');
- $newNote->setUserId($userId);
- $newNote->setContent($note);
- $newNote->setTypeId($noteTypeId);
- $newNote->save();
- }
-
- public function getNotesByType($noteTypeId = null, $excludeNoteTypeId = null)
- {
- $criteria = new Criteria;
- $criteria->addJoin(QubitNote::TYPE_ID, QubitTerm::ID);
- $criteria->add(QubitNote::OBJECT_ID, $this->getId());
- if ($noteTypeId)
- {
- $criteria->add(QubitNote::TYPE_ID, $noteTypeId);
- }
- if ($excludeNoteTypeId)
- {
- $criteria->add(QubitNote::TYPE_ID, $excludeNoteTypeId,
Criteria::NOT_EQUAL);
- }
-
- return QubitNote::get($criteria);
- }
-
public function getRole()
{
- $notes = $this->getNotesByType($noteTypeId = QubitTerm::DISPLAY_NOTE_ID);
+ $notes = $this->getNotesByType($options = array('noteTypeId' =>
QubitTerm::DISPLAY_NOTE_ID));
if (count($notes) > 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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---