Author: sevein
Date: Tue Jul 12 13:55:19 2011
New Revision: 9303
Log:
More progress in the contact information component
Modified:
trunk/apps/qubit/modules/contactinformation/actions/relatedContactInformationComponent.class.php
trunk/apps/qubit/modules/contactinformation/templates/_relatedContactInformation.php
Modified:
trunk/apps/qubit/modules/contactinformation/actions/relatedContactInformationComponent.class.php
==============================================================================
---
trunk/apps/qubit/modules/contactinformation/actions/relatedContactInformationComponent.class.php
Tue Jul 12 13:19:49 2011 (r9302)
+++
trunk/apps/qubit/modules/contactinformation/actions/relatedContactInformationComponent.class.php
Tue Jul 12 13:55:19 2011 (r9303)
@@ -22,13 +22,55 @@
// Arrays not allowed in class constants
public static
$NAMES = array(
- 'resource');
+ 'city',
+ 'contactPerson',
+ 'contactType',
+ 'countryCode',
+ 'email',
+ 'fax',
+ 'note',
+ 'region',
+ 'postalCode',
+ 'primaryContact',
+ 'telephone',
+ 'streetAddress',
+ 'website');
protected function addField($name)
{
switch ($name)
{
- case 'resource':
+ case 'countryCode':
+ $this->form->setValidator('countryCode', new
sfValidatorI18nChoiceCountry);
+ $this->form->setWidget('countryCode', new
sfWidgetFormI18nChoiceCountry(array('add_empty' => true, 'culture' =>
$this->context->user->getCulture())));
+
+ break;
+
+ case 'primaryContact':
+ $this->form->setValidator('primaryContact', new sfValidatorString);
+ $this->form->setWidget('primaryContact', new
sfWidgetFormInputCheckbox);
+
+ break;
+
+ case 'city':
+ case 'contactPerson':
+ case 'contactType':
+ case 'email':
+ case 'fax':
+ case 'postalCode':
+ case 'region':
+ case 'telephone':
+ case 'website':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormInput);
+
+ break;
+
+ case 'streetAddress':
+ case 'note':
+ $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setWidget($name, new sfWidgetFormTextArea(array(),
array('rows' => 2)));
+
break;
}
}
@@ -57,6 +99,6 @@
$this->addField($name);
}
- $this->relatedContactInformation = array();
+ $this->relatedContactInformation =
$this->resource->getContactInformation();
}
}
Modified:
trunk/apps/qubit/modules/contactinformation/templates/_relatedContactInformation.php
==============================================================================
---
trunk/apps/qubit/modules/contactinformation/templates/_relatedContactInformation.php
Tue Jul 12 13:19:49 2011 (r9302)
+++
trunk/apps/qubit/modules/contactinformation/templates/_relatedContactInformation.php
Tue Jul 12 13:55:19 2011 (r9303)
@@ -1,6 +1,5 @@
<?php
$sf_response->addStylesheet('/vendor/yui/container/assets/skins/sam/container',
'first') ?>
-<?php $sf_response->addJavaScript('date') ?>
<?php $sf_response->addJavaScript('/vendor/yui/datasource/datasource-min') ?>
<?php $sf_response->addJavaScript('/vendor/yui/container/container-min') ?>
<?php $sf_response->addJavaScript('dialog') ?>
@@ -46,13 +45,7 @@
$rowTemplate = json_encode(<<<value
<tr id="{{$form->getWidgetSchema()->generateName('id')}}">
<td>
- {{$form->resource->renderName()}}
- </td><td>
- {{$form->type->renderName()}}
- </td><td>
- {{$form->description->renderName()}}
- </td><td>
- {{$form->date->renderName()}}
+ {{$form->contactPerson->renderName()}}
</td><td style="text-align: right">
$editHtml <button class="delete-small" name="delete" type="button"/>
</td>
@@ -65,28 +58,13 @@
echo javascript_tag(<<<content
-// Add special rendering rules
-var handleFieldRender = function (fname)
- {
- if (-1 !== fname.indexOf('date')
- && 1 > this.getField('date').value.length
- && (0 < this.getField('startDate').value.length
- || 0 < this.getField('endDate').value.length))
- {
- return this.getField('startDate').value + ' - ' +
this.getField('endDate').value;
- }
-
- return this.renderField(fname);
- }
-
Drupal.behaviors.relatedContactInformation = {
attach: function (context)
{
// Define dialog
- var dialog = new QubitDialog('functionRelation', {
- 'displayTable': 'relatedFunctions',
+ var dialog = new QubitDialog('contactInformationRelation', {
+ 'displayTable': 'relatedContactInformations',
'newRowTemplate': $rowTemplate,
- 'handleFieldRender': handleFieldRender,
'relationTableMap': function (response)
{
response.resource = response.object;
@@ -99,7 +77,7 @@
} });
// Add edit button to rows
- jQuery('#relatedFunctions tr[id]', context)
+ jQuery('#relatedContactInformations tr[id]', context)
.click(function ()
{
dialog.open(this.id);
@@ -118,9 +96,31 @@
<div>
- <?php /* echo $form->description
- ->help(__('"Record a precise description of the nature of the
relationship between the function being described and the related function."
(ISDF 5.3.3) Note that the text entered in this field will also appear in the
related function.'))
- ->renderRow() */ ?>
+ <?php echo $form->streetAddress->renderRow() ?>
+
+ <?php echo $form->city->renderRow() ?>
+
+ <?php echo $form->region->renderRow() ?>
+
+ <?php echo $form->countryCode->renderRow() ?>
+
+ <?php echo $form->postalCode->renderRow() ?>
+
+ <?php echo $form->telephone->renderRow() ?>
+
+ <?php echo $form->fax->renderRow() ?>
+
+ <?php echo $form->email->renderRow() ?>
+
+ <?php echo $form->website->renderRow() ?>
+
+ <?php echo $form->contactPerson->renderRow() ?>
+
+ <?php // TODO jquery error echo $form->primaryContact->renderRow() ?>
+
+ <?php echo $form->contactType->renderRow() ?>
+
+ <?php echo $form->note->renderRow() ?>
</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.