Author: david
Date: Wed Nov 18 15:07:11 2009
New Revision: 3915
Log:
Switch straight-forward function form fields to standardized rendering
functions.
Modified:
trunk/apps/qubit/modules/function/actions/editAction.class.php
trunk/apps/qubit/modules/function/config/view.yml
trunk/apps/qubit/modules/function/templates/editSuccess.php
Modified: trunk/apps/qubit/modules/function/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/editAction.class.php Wed Nov
18 15:03:43 2009 (r3914)
+++ trunk/apps/qubit/modules/function/actions/editAction.class.php Wed Nov
18 15:07:11 2009 (r3915)
@@ -43,6 +43,8 @@
'descriptionStatus',
'descriptionDetail',
'revisionHistory',
+ 'language',
+ 'script',
'sources'
//'maintainance_note'
);
@@ -51,23 +53,6 @@
{
switch ($name)
{
- case 'authorizedFormOfName':
- case 'classification':
- case 'dates':
- case 'description':
- case 'history':
- case 'legislation':
- case 'descriptionIdentifier':
- case 'institutionIdentifier':
- case 'rules':
- case 'revisionHistory':
- case 'sources':
- $this->form->setDefault($name, $this->user[$name]);
- $this->form->setValidator($name, new sfValidatorString);
- $this->form->setWidget($name, new sfWidgetFormInput);
-
- break;
-
case 'type':
if (null !== $this->func->type)
{
@@ -122,6 +107,44 @@
$this->form->setWidget('descriptionDetail', new
sfWidgetFormSelect(array('choices' => $choices)));
break;
+
+ case 'language':
+ $this->form->setDefault($name, $this->func[$name]);
+ $this->form->setValidator($name, new
sfValidatorI18nChoiceLanguage(array('multiple' => true)));
+ $this->form->setWidget($name, new
sfWidgetFormI18nSelectLanguage(array('culture' =>
$this->context->user->getCulture(), 'multiple' => true)));
+
+ break;
+
+ case 'script':
+ $this->form->setDefault($name, $this->func[$name]);
+ $c = sfCultureInfo::getInstance($this->context->user->getCulture());
+ $this->form->setValidator($name, new sfValidatorChoice(array('choices'
=> array_keys($c->getScripts()), 'multiple' => true)));
+ $this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> $c->getScripts(), 'multiple' => true)));
+
+ break;
+
+ case 'authorizedFormOfName':
+ case 'classification':
+ case 'dates':
+ case 'descriptionIdentifier':
+ case 'institutionIdentifier':
+ $this->form->setDefault($name, $this->func[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
+
+ break;
+
+ case 'history':
+ case 'description':
+ case 'legislation':
+ case 'rules':
+ case 'revisionHistory':
+ case 'sources':
+ $this->form->setDefault($name, $this->func[$name]);
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextarea);
+
+ break;
}
}
Modified: trunk/apps/qubit/modules/function/config/view.yml
==============================================================================
--- trunk/apps/qubit/modules/function/config/view.yml Wed Nov 18 15:03:43
2009 (r3914)
+++ trunk/apps/qubit/modules/function/config/view.yml Wed Nov 18 15:07:11
2009 (r3915)
@@ -6,8 +6,14 @@
SearchBox: []
editSuccess:
+ stylesheets:
+ /vendor/yui/autocomplete/assets/skins/sam/autocomplete: { position: first }
javascripts:
- /vendor/jquery
+ - /vendor/yui/datasource/datasource-min
+ - /vendor/yui/connection/connection-min
+ - /vendor/yui/autocomplete/autocomplete-min
+ - autocomplete
- /sfDrupalPlugin/vendor/drupal/misc/drupal
- /sfDrupalPlugin/vendor/drupal/misc/collapse
- /sfDrupalPlugin/vendor/drupal/misc/textarea
Modified: trunk/apps/qubit/modules/function/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/function/templates/editSuccess.php Wed Nov 18
15:03:43 2009 (r3914)
+++ trunk/apps/qubit/modules/function/templates/editSuccess.php Wed Nov 18
15:07:11 2009 (r3915)
@@ -3,7 +3,7 @@
<?php // write functionRelationDialog yui dialog object to DOM via javascript
// echo include_partial('functionRelationDialog'); ?>
-<div class="pageTitle"><?php echo __('edit %1% - ISAAR', array('%1%' =>
sfConfig::get('app_ui_label_function'))) ?></div>
+<div class="pageTitle"><?php echo __('edit function', array('%1%' =>
sfConfig::get('app_ui_label_function'))) ?></div>
<?php if (isset($sf_request->id)): ?>
<?php echo $form->renderFormTag(url_for(array('module' => 'function',
'action' => 'edit', 'id' => $sf_request->id)), array('id' => 'editForm')) ?>
@@ -18,69 +18,29 @@
</div>
<fieldset class="collapsible collapsed" id="identityArea">
+ <legend><?php echo __('identity area'); ?></legend>
- <legend><?php echo __('identity area'); ?></legend>
+ <?php echo $form->type->renderRow() ?>
- <?php echo $form->type->renderRow() ?>
+ <?php echo $form->authorizedFormOfName->label('authorized form(s) of
name')->renderRow() ?>
- <div class="form-item">
- <label for="authorized_form_of_name"><?php echo __('authorized form of
name'); ?></label>
- <?php if (strlen($sourceCultureValue =
$func->getAuthorizedFormOfName(array('sourceCulture' => 'true'))) > 0 &&
$sf_user->getCulture() != $func->getSourceCulture()): ?>
- <div class="default-translation"><?php echo nl2br($sourceCultureValue)
?></div>
- <?php endif; ?>
- <?php echo object_input_tag($func, 'getAuthorizedFormOfName', array('size'
=> 20)) ?>
- </div>
-
- <div class="form-item">
- <label for="other_name"><?php echo __('other names'); ?></label>
- <table class="inline"><tr>
- <td class="headerCell" style="width: 40%;"><?php echo __('name'); ?></td>
- <td class="headerCell" style="width: 20%;"><?php echo __('type'); ?></td>
- <td class="headerCell" style="width: 35%;"><?php echo __('note'); ?></td>
- <td class="headerCell" style="width: 5%;"></td>
- </tr>
- <?php if ($otherNames): ?>
- <?php foreach ($otherNames as $otherName): ?>
- <tr><td><?php echo $otherName->getName() ?></td><td><?php echo
$otherName->getType() ?></td>
- <td><?php echo $otherName->getNote() ?></td>
- <td style="text-align: center;"><?php echo
link_to(image_tag('delete', 'align=top'), array('module' => 'function',
'action' => 'deleteOtherName', 'otherNameId' => $otherName->getId(),
'returnTemplate' => 'isaar')) ?></td></tr>
- <?php endforeach; ?>
- <?php endif; ?>
- <tr>
- <td><?php echo input_tag('new_name', null, array('size' => 10))?></td>
- <td><?php echo object_select_tag($newName, 'getTypeId', array(
- 'name' => 'new_name_type_id',
- 'id' => 'new_name_type_id',
- 'related_class' => 'QubitTerm',
- 'include_blank' => true,
- 'peer_method' => 'getActorNameTypes',
- 'style' => 'width: 95px;'
- )) ?></td>
- <td><?php echo input_tag('new_name_note', null, array('size' =>
10))?></td>
- </tr>
- </table>
- </div>
+ <?php //echo $form->parallelNames->renderRow() ?>
+
+ <?php //echo $form->otherNames->renderRow() ?>
+ <?php echo $form->classification->renderRow() ?>
</fieldset>
<fieldset class="collapsible collapsed" id="descriptionArea">
<legend><?php echo __('context area'); ?></legend>
- <div class="form-item">
- <label for="dates"><?php echo __('dates'); ?></label>
- <?php if (strlen($sourceCultureValue =
$func->getDates(array('sourceCulture' => 'true'))) > 0 &&
$sf_user->getCulture() != $func->getSourceCulture()): ?>
- <div class="default-translation"><?php echo nl2br($sourceCultureValue)
?></div>
- <?php endif; ?>
- <?php echo object_input_tag($func, 'getDates', array('size' => 20)) ?>
- </div>
+ <?php echo $form->dates->renderRow() ?>
+
+ <?php echo $form->description->renderRow(array('class' => 'resizable')) ?>
- <div class="form-item">
- <label for="history"><?php echo __('history'); ?></label>
- <?php if (strlen($sourceCultureValue =
$func->getHistory(array('sourceCulture' => 'true'))) > 0 &&
$sf_user->getCulture() != $func->getSourceCulture()): ?>
- <div class="default-translation"><?php echo nl2br($sourceCultureValue)
?></div>
- <?php endif; ?>
- <?php echo object_textarea_tag($func, 'getHistory', array('class' =>
'resizable', 'size' => '30x10')) ?>
- </div>
+ <?php echo $form->history->renderRow(array('class' => 'resizable')) ?>
+
+ <?php echo $form->legislation->renderRow(array('class' => 'resizable')) ?>
</fieldset>
<fieldset class="collapsible collapsed" id="relationshipsArea">
@@ -194,115 +154,29 @@
<fieldset class="collapsible collapsed" id="controlArea">
<legend><?php echo __('control area'); ?></legend>
- <div class="form-item">
- <label for="description_identifier"><?php echo __('authority record
identifier'); ?></label>
- <?php echo object_input_tag($func, 'getDescriptionIdentifier',
array('size' => 20)) ?>
- </div>
-
- <div class="form-item">
- <label for="institution_identifier"><?php echo __('institution
identifier'); ?></label>
- <?php if (strlen($sourceCultureValue =
$func->getInstitutionIdentifier(array('sourceCulture' => 'true'))) > 0 &&
$sf_user->getCulture() != $func->getSourceCulture()): ?>
- <div class="default-translation"><?php echo nl2br($sourceCultureValue)
?></div>
- <?php endif; ?>
- <?php echo object_input_tag($func, 'getInstitutionIdentifier',
array('size' => 20)) ?>
- </div>
-
- <div class="form-item">
- <label for="rules"><?php echo __('rules and/or conventions'); ?></label>
- <?php if (strlen($sourceCultureValue =
$func->getRules(array('sourceCulture' => 'true'))) > 0 &&
$sf_user->getCulture() != $func->getSourceCulture()): ?>
- <div class="default-translation"><?php echo nl2br($sourceCultureValue)
?></div>
- <?php endif; ?>
- <?php echo object_textarea_tag($func, 'getRules', array('class' =>
'resizable', 'size' => '30x3')) ?>
- </div>
-
- <div class="form-item">
- <label for="status_id"><?php echo __('status'); ?></label>
- <?php echo object_select_tag($func, 'getDescriptionStatusId',
array('related_class' => 'QubitTerm', 'include_blank' => true, 'peer_method' =>
'getDescriptionStatuses')) ?>
- </div>
+ <?php echo $form->descriptionIdentifier->label('function description
identifier')->renderRow() ?>
- <div class="form-item">
- <label for="level_of_detail_id"><?php echo __('level of detail');
?></label>
- <?php echo object_select_tag($func, 'getDescriptionDetailId',
array('related_class' => 'QubitTerm', 'include_blank' => true, 'peer_method' =>
'getDescriptionDetailLevels')) ?>
- </div>
+ <?php echo $form->institutionIdentifier->label('institution
identifiers')->renderRow() ?>
- <div class="form-item">
- <label for="dates"><?php echo __('dates of creation, revision and
deletion'); ?></label>
- <?php if (strlen($sourceCultureValue =
$func->getRevisionHistory(array('sourceCulture' => 'true'))) > 0 &&
$sf_user->getCulture() != $func->getSourceCulture()): ?>
- <div class="default-translation"><?php echo nl2br($sourceCultureValue)
?></div>
- <?php endif; ?>
- <?php echo object_textarea_tag($func, 'getRevisionHistory',
array('class' => 'resizable', 'size' => '30x3')) ?>
- </div>
+ <?php echo $form->rules->label('Rules and/or conventions
used')->renderRow(array('class' => 'resizable')) ?>
- <div class="form-item">
- <label for="language_code"><?php echo __('languages of authority
record'); ?></label>
+ <?php echo $form->descriptionStatus->label('status')->renderRow() ?>
- <?php if (count($languageCodes) > 0): ?>
- <?php foreach ($languageCodes as $languageCode): ?>
- <div style="margin-top: 5px; margin-bottom: 5px;">
- <?php echo
format_language($languageCode->getValue(array('sourceCulture' => true)))
?> <?php echo link_to(image_tag('delete', 'align=top'), array('module' =>
'function', 'action' => 'deleteProperty', 'Id' => $languageCode->getId(),
'returnTemplate' => 'isaar')) ?><br/>
- </div>
- <?php endforeach; ?>
- <?php endif; ?>
+ <?php echo $form->descriptionDetail->label('level of detail')->renderRow()
?>
- <?php echo select_language_tag('language_code', null,
array('include_blank' => true, 'class'=>'multiInstance')) ?>
- </div>
+ <?php echo $form->revisionHistory->label('dates of creation, revision or
deletion')->renderRow(array('class' => 'resizable')) ?>
- <div class="form-item">
- <label for="script_id"><?php echo __('scripts of authority record');
?></label>
+ <?php echo $form->language->label('language(s)')->renderRow(array('class'
=> 'form-autocomplete')) ?>
- <?php if (count($scriptCodes) > 0): ?>
- <?php foreach ($scriptCodes as $scriptCode): ?>
- <div style="margin-top: 5px; margin-bottom: 5px;">
- <?php echo format_script($scriptCode->getValue(array('sourceCulture'
=> true))) ?> <?php echo link_to(image_tag('delete', 'align=top'),
array('module' => 'function', 'action' => 'deleteProperty', 'Id' =>
$scriptCode->getId(), 'returnTemplate' => 'isaar')) ?><br/>
- </div>
- <?php endforeach; ?>
- <?php endif; ?>
+ <?php echo $form->script->label('script(s)')->renderRow(array('class' =>
'form-autocomplete')) ?>
- <?php echo select_script_tag('script_code', null, array('include_blank'
=> true, 'class'=>'multiInstance')) ?>
- </div>
-
- <div class="form-id">
- <label for="sources"><?php echo __('sources'); ?></label>
- <?php if (strlen($sourceCultureValue =
$func->getSources(array('sourceCulture' => 'true'))) > 0 &&
$sf_user->getCulture() != $func->getSourceCulture()): ?>
- <div class="default-translation"><?php echo nl2br($sourceCultureValue)
?></div>
- <?php endif; ?>
- <?php echo object_textarea_tag($func, 'getSources', array('class' =>
'resizable', 'size' => '30x3')) ?>
- </div>
-
- <div class="form-item">
- <table class="inline">
- <tr>
- <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 endforeach; ?>
- <?php endif; ?>
- <tr>
- <td><?php echo textarea_tag('new_maintenance_note', '',
array('class' => 'multiInstanceTr', 'size' => '30x2')) ?></td>
- <td style="text-align: right"> </td>
- </tr>
- </table>
- </div>
+ <?php echo $form->sources->renderRow(array('class' => 'resizable')) ?>
</fieldset>
<ul class="actions">
<?php if (isset($sf_request->id)): ?>
- <?php if($repositoryReroute): ?>
- <li><?php echo link_to(__('Cancel'), array('module' => 'repository',
'action' => 'show', 'id' => $repositoryReroute)) ?>
- <?php else: ?>
<li><?php echo link_to(__('Cancel'), array('module' => 'function',
'action' => 'show', 'id' => $func->id)) ?></li>
- <?php endif; ?>
<li><?php echo submit_tag(__('Save')) ?></li>
<?php else: ?>
<li><?php echo link_to(__('Cancel'), array('module' => 'function',
'action' => 'list')) ?></li>
--
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=.