From 89d7f22e4a47fbac3ece2c542208dd5670c27848 Mon Sep 17 00:00:00 2001 From: abijah Date: Sun, 23 Aug 2009 19:23:12 +0000 Subject: [PATCH 01/45] Small tweak to prevent the render error when looking at a debug grid query. git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@749 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/app_controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/app_controller.php b/site/app_controller.php index 50b242a..4481d0f 100644 --- a/site/app_controller.php +++ b/site/app_controller.php @@ -511,6 +511,7 @@ class AppController extends Controller { $xml = preg_replace("//", ">", $xml); echo ("\n
\n$xml\n
\n"); + $this->render_empty(); } } @@ -1019,9 +1020,8 @@ class AppController extends Controller { } function gridDataOutputHeader(&$params, &$model) { - if (!$params['debug']) { + if (!$params['debug']) header("Content-type: text/xml;charset=utf-8"); - } } function gridDataOutputXMLHeader(&$params, &$model) { From 5ad28c809b2da4224f0ce46a299ccfa18a03f170 Mon Sep 17 00:00:00 2001 From: abijah Date: Sun, 23 Aug 2009 19:23:49 +0000 Subject: [PATCH 02/45] Fixed the relationship field for customer and contact grids. git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@750 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/controllers/contacts_controller.php | 13 +++++++++ site/controllers/customers_controller.php | 34 +++++++++++++++-------- site/views/contacts/view.ctp | 1 + site/views/customers/view.ctp | 2 +- site/views/elements/contacts.ctp | 13 ++++----- site/views/elements/customers.ctp | 7 +---- 6 files changed, 44 insertions(+), 26 deletions(-) diff --git a/site/controllers/contacts_controller.php b/site/controllers/contacts_controller.php index 8d24e38..10cd928 100644 --- a/site/controllers/contacts_controller.php +++ b/site/controllers/contacts_controller.php @@ -23,6 +23,19 @@ class ContactsController extends AppController { * to jqGrid. */ + function gridDataFilterTablesConfig(&$params, &$model, $table) { + $config = parent::gridDataFilterTablesConfig($params, $model, $table); + + // Special case for Customer; We need the Contact/Customer relationship + if ($table == 'Customer') + $config = array('fields' => array('ContactsCustomer.type', + 'ContactsCustomer.active'), + 'conditions' => array('ContactsCustomer.active' => true), + ); + + return $config; + } + function gridDataOrder(&$params, &$model, $index, $direction) { $order = parent::gridDataOrder($params, $model, $index, $direction); diff --git a/site/controllers/customers_controller.php b/site/controllers/customers_controller.php index b5d423c..fca37d9 100644 --- a/site/controllers/customers_controller.php +++ b/site/controllers/customers_controller.php @@ -92,19 +92,29 @@ class CustomersController extends AppController { return $conditions; } - function gridDataOrder(&$params, &$model, $index, $direction) { - $order = array(); - $order[] = parent::gridDataOrder($params, $model, $index, $direction); + function gridDataFilterTablesConfig(&$params, &$model, $table) { + $config = parent::gridDataFilterTablesConfig($params, $model, $table); - if ($index !== 'PrimaryContact.last_name') - $order[] = parent::gridDataOrder($params, $model, - 'PrimaryContact.last_name', $direction); - if ($index !== 'PrimaryContact.first_name') - $order[] = parent::gridDataOrder($params, $model, - 'PrimaryContact.first_name', $direction); - if ($index !== 'Customer.id') - $order[] = parent::gridDataOrder($params, $model, - 'Customer.id', $direction); + // Special case for Contact; We need the Contact/Customer relationship + if ($table == 'Contact') + $config = array('fields' => array('ContactsCustomer.type', + 'ContactsCustomer.active'), + 'conditions' => array('ContactsCustomer.active' => true), + ); + + return $config; + } + + function gridDataOrder(&$params, &$model, $index, $direction) { + $order = parent::gridDataOrder($params, $model, $index, $direction); + + // After sorting by whatever the user wants, add these + // defaults into the sort mechanism. If we're already + // sorting by one of them, it will only be redundant, + // and should cause no harm (possible a longer query?) + $order[] = 'PrimaryContact.last_name ' . $direction; + $order[] = 'PrimaryContact.first_name ' . $direction; + $order[] = 'Customer.id ' . $direction; return $order; } diff --git a/site/views/contacts/view.ctp b/site/views/contacts/view.ctp index 0803999..55ac199 100644 --- a/site/views/contacts/view.ctp +++ b/site/views/contacts/view.ctp @@ -135,6 +135,7 @@ echo $this->element('customers', array 'config' => array ('caption' => 'Related Customers', 'filter' => array('Contact.id' => $contact['id']), + 'include' => array('Relationship'), ))); diff --git a/site/views/customers/view.ctp b/site/views/customers/view.ctp index 8a0bb48..a5d9456 100644 --- a/site/views/customers/view.ctp +++ b/site/views/customers/view.ctp @@ -61,7 +61,7 @@ echo $this->element('contacts', array 'config' => array ('caption' => 'Customer Contacts', 'filter' => array('Customer.id' => $customer['Customer']['id']), - 'include' => array('Type', 'Active'), + 'include' => array('Relationship'), ))); diff --git a/site/views/elements/contacts.ctp b/site/views/elements/contacts.ctp index 92c36a7..7267642 100644 --- a/site/views/elements/contacts.ctp +++ b/site/views/elements/contacts.ctp @@ -2,12 +2,11 @@ // Define the table columns $cols = array(); -$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'name'); -$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'name'); -$cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname'); -$cols['Type'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum'); -$cols['Active'] = array('index' => 'ContactsCustomer.active', 'formatter' => 'enum'); -$cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment'); +$cols['Relationship'] = array('index' => 'ContactsCustomer.type', 'formatter' => 'enum'); +$cols['Last Name'] = array('index' => 'Contact.last_name', 'formatter' => 'longname'); +$cols['First Name'] = array('index' => 'Contact.first_name', 'formatter' => 'longname'); +$cols['Company'] = array('index' => 'Contact.company_name', 'formatter' => 'longname'); +$cols['Comment'] = array('index' => 'Contact.comment', 'formatter' => 'comment'); // Render the grid $grid @@ -16,4 +15,4 @@ $grid ->defaultFields(array('Last Name', 'First Name')) ->searchFields(array('Last Name', 'First Name', 'Company')) ->render($this, isset($config) ? $config : null, - array_diff(array_keys($cols), array('Type', 'Active', 'Comment'))); + array_diff(array_keys($cols), array('Relationship', 'Comment'))); diff --git a/site/views/elements/customers.ctp b/site/views/elements/customers.ctp index b0d2702..2dbfb86 100644 --- a/site/views/elements/customers.ctp +++ b/site/views/elements/customers.ctp @@ -10,11 +10,6 @@ $cols['Leases'] = array('index' => 'current_lease_count', 'formatt $cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency'); $cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment'); - -// Certain fields are only valid with a particular context -if (!isset($config['filter']['Contact.id'])) - $grid->invalidFields('Relationship'); - // Render the grid $grid ->columns($cols) @@ -22,4 +17,4 @@ $grid ->defaultFields(array('Name')) ->searchFields(array('Name', 'Last Name', 'First Name')) ->render($this, isset($config) ? $config : null, - array_diff(array_keys($cols), array('Comment'))); + array_diff(array_keys($cols), array('Relationship', 'Comment'))); From a9410b1351fc1ed01b863b438e351686b1639a4a Mon Sep 17 00:00:00 2001 From: abijah Date: Sun, 23 Aug 2009 20:23:13 +0000 Subject: [PATCH 03/45] Moved 'New Deposit' to the correct menu section git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@751 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/controllers/transactions_controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/controllers/transactions_controller.php b/site/controllers/transactions_controller.php index e80085c..93130f2 100644 --- a/site/controllers/transactions_controller.php +++ b/site/controllers/transactions_controller.php @@ -33,7 +33,7 @@ class TransactionsController extends AppController { $this->sideMenuEnable('CONTROLLER', $this->std_area, false); $this->addSideMenuLink('New Deposit', array('controller' => 'tenders', 'action' => 'deposit'), null, - 'ACTION'); + 'ACTION', $this->new_area); $this->gridView('Deposits'); } From ee9ff354b22348f4727fb32afd9ce8b41dc53446 Mon Sep 17 00:00:00 2001 From: abijah Date: Sun, 23 Aug 2009 20:23:44 +0000 Subject: [PATCH 04/45] Added functionality to pre-activate a specific area/subarea of the menu. git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@752 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/app_controller.php | 66 ++++++++++++++++++++++---------- site/views/elements/sidemenu.ctp | 27 ++++++++++--- 2 files changed, 68 insertions(+), 25 deletions(-) diff --git a/site/app_controller.php b/site/app_controller.php index 4481d0f..ea4b9a1 100644 --- a/site/app_controller.php +++ b/site/app_controller.php @@ -38,7 +38,7 @@ class AppController extends Controller { var $helpers = array('Html', 'Form', 'Javascript', 'Format', 'Time', 'Grid'); var $components = array('DebugKit.Toolbar'); - var $sidemenu_areas = array('SITE' => false, 'CONTROLLER' => false, 'ACTION' => false); + var $sidemenu = array('areas' => array('SITE' => false, 'CONTROLLER' => false, 'ACTION' => false)); var $std_area = 10; var $new_area = 20; var $op_area = 30; @@ -61,7 +61,7 @@ class AppController extends Controller { function sideMenuAreaVerify(&$area, $subarea, $priority = null) { $area = strtoupper($area); - if (!array_key_exists($area, $this->sidemenu_areas)) + if (!array_key_exists($area, $this->sidemenu['areas'])) $this->INTERNAL_ERROR("Sidemenu link '{$area}': Unknown"); if ($area == 'SITE') @@ -71,9 +71,9 @@ class AppController extends Controller { elseif ($area == 'ACTION') $name = Inflector::humanize(Inflector::singularize($this->params['controller'])); - if (empty($this->sidemenu_areas[$area])) - $this->sidemenu_areas[$area] - = array('enable' => true, 'name' => $name, 'subarea' => array()); + if (empty($this->sidemenu['areas'][$area])) + $this->sidemenu['areas'][$area] + = array('enable' => true, 'name' => $name, 'subareas' => array()); if (empty($subarea)) return; @@ -94,15 +94,15 @@ class AppController extends Controller { else $subname .= '-' . $subarea; - if (empty($this->sidemenu_areas[$area]['subarea'][$subarea])) - $this->sidemenu_areas[$area]['subarea'][$subarea] + if (empty($this->sidemenu['areas'][$area]['subareas'][$subarea])) + $this->sidemenu['areas'][$area]['subareas'][$subarea] = array('enable' => true, 'name' => $subname, 'priorities' => array()); if (empty($priority)) return; - if (empty($this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority])) - $this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority] + if (empty($this->sidemenu['areas'][$area]['subareas'][$subarea]['priorities'][$priority])) + $this->sidemenu['areas'][$area]['subareas'][$subarea]['priorities'][$priority] = array(); } @@ -117,9 +117,22 @@ class AppController extends Controller { function sideMenuAreaName($name, $area, $subarea = null) { $this->sideMenuAreaVerify($area, $subarea); if (empty($subarea)) - $this->sidemenu_areas[$area]['name'] = $name; + $this->sidemenu['areas'][$area]['name'] = $name; else - $this->sidemenu_areas[$area]['subarea'][$subarea]['name'] = $name; + $this->sidemenu['areas'][$area]['subareas'][$subarea]['name'] = $name; + } + + + /************************************************************************** + ************************************************************************** + ************************************************************************** + * function: sideMenuAreaActivate + * - Sets the selected area/subarea to be active when the + * page is first loaded. + */ + + function sideMenuAreaActivate($area, $subarea = null) { + $this->sidemenu['active'] = compact('area', 'subarea'); } @@ -133,9 +146,9 @@ class AppController extends Controller { function sideMenuEnable($area, $subarea = null, $enable = true) { $this->sideMenuAreaVerify($area, $subarea); if (isset($subarea)) - $this->sidemenu_areas[$area]['subarea'][$subarea]['enable'] = $enable; + $this->sidemenu['areas'][$area]['subareas'][$subarea]['enable'] = $enable; else - $this->sidemenu_areas[$area]['enable'] = $enable; + $this->sidemenu['areas'][$area]['enable'] = $enable; } @@ -150,7 +163,7 @@ class AppController extends Controller { if (empty($subarea)) $subarea = $this->std_area; $this->sideMenuAreaVerify($area, $subarea); - $this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority][] + $this->sidemenu['areas'][$area]['subareas'][$subarea]['priorities'][$priority][] = array('name' => $name, 'url' => $url) + (empty($extra) ? array() : $extra); } @@ -280,24 +293,36 @@ class AppController extends Controller { $this->params['admin'] = false; } - foreach ($this->sidemenu_areas AS &$area) { + foreach ($this->sidemenu['areas'] AS &$area) { if (empty($area['enable'])) $area = array(); - if (empty($area['subarea'])) + if (empty($area['subareas'])) continue; - ksort($area['subarea']); + ksort($area['subareas']); - foreach ($area['subarea'] AS &$subarea) { + foreach ($area['subareas'] AS &$subarea) { if (empty($subarea['enable'])) $subarea = array(); if (empty($subarea['priorities'])) continue; ksort($subarea['priorities']); } + unset($subarea); + } + unset($area); + + // Activate a default section (unless already specified) + foreach (array_reverse($this->sidemenu['areas']) AS $area_name => $area) { + if (empty($area)) + continue; + + if (empty($this->sidemenu['active']) || + empty($this->sidemenu['areas'][$this->sidemenu['active']['area']])) + $this->sideMenuAreaActivate($area_name); } - //pr($this->sidemenu_areas); - $this->set('sidemenu', $this->sidemenu_areas); + //pr($this->sidemenu); + $this->set('sidemenu', $this->sidemenu); } @@ -375,6 +400,7 @@ class AppController extends Controller { function gridView($title, $action = null, $element = null) { $this->sideMenuEnable('SITE', $this->op_area); + $this->sideMenuAreaActivate('CONTROLLER'); $this->set('title', $title); // The resulting page will contain a grid, which will // use ajax to obtain the actual data for this action diff --git a/site/views/elements/sidemenu.ctp b/site/views/elements/sidemenu.ctp index 2bc94be..3273cca 100644 --- a/site/views/elements/sidemenu.ctp +++ b/site/views/elements/sidemenu.ctp @@ -13,15 +13,29 @@ echo('
' . "\n"); -foreach ($menu AS $area) { - if (empty($area['subarea'])) +$section = 0; +$active_section = null; +foreach ($menu['areas'] AS $area_name => $area) { + if (empty($area['subareas'])) continue; - foreach ($area['subarea'] AS $subarea) { + foreach ($area['subareas'] AS $subarea_name => $subarea) { if (empty($subarea['priorities'])) continue; - echo('

' . $subarea['name'] . "

\n"); + if (!isset($active_section) && + !empty($menu['active']['area']) && $area_name == $menu['active']['area'] && + (empty($menu['active']['subarea']) || $subarea_name == $menu['active']['subarea'])) + $active_section = $section; + + ++$section; + + echo('' . + $subarea['name'] . + "\n"); + echo('
' . "\n"); foreach ($subarea['priorities'] AS $priority) { foreach ($priority AS $item) { @@ -40,13 +54,16 @@ foreach ($menu AS $area) { } echo('
' . "\n"); +//pr(compact('section', 'active_section')); + ?> @@ -247,8 +296,12 @@ echo($this->element array('class' => 'item customer detail', 'caption' => isset($this->data['Customer']) ? 'Edit Customer' : 'New Customer', 'fields' => array - ('name' => true, - 'comment' => true, + ('name' => array('label_attributes' => array('class' => 'optional empty'), + 'after' => ("Optional: If this field is left blank, the" . + " customer name will be set to the name of" . + " the primary contact, below.")), + 'comment' => array('label_attributes' => array('class' => 'optional empty'), + 'after' => 'Optional: Comments about this customer.'), ))) . "\n"); echo $form->submit(isset($this->data['Customer']) ? 'Update' : 'Add New Customer') . "\n"; diff --git a/site/views/elements/form_table.ctp b/site/views/elements/form_table.ctp index 7394f83..e8a8ab6 100644 --- a/site/views/elements/form_table.ctp +++ b/site/views/elements/form_table.ctp @@ -32,8 +32,8 @@ foreach ($fields AS $field => $config) { $include_after = true; } - -$column_class = array(); +if (empty($column_class)) + $column_class = array(); if ($include_before) $column_class[] = 'before'; $column_class[] = 'field'; @@ -79,7 +79,13 @@ foreach ($fields AS $field => $config) { $cells[] = null; } - $name = $config['name']; + if (empty($config['opts']['label'])) + $name = $form->label($field, $config['name'], + empty($config['label_attributes']) + ? null : $config['label_attributes']); + else + $name = $config['name']; + if (isset($config['with_name_before'])) $name = $config['with_name_before'] . $name; elseif (isset($with_name_before)) diff --git a/site/views/elements/table.ctp b/site/views/elements/table.ctp index aef240a..3af46a8 100644 --- a/site/views/elements/table.ctp +++ b/site/views/elements/table.ctp @@ -52,8 +52,8 @@ if (isset($rows) && is_array($rows) && count($rows)) { foreach ($rows AS $r => &$row) { foreach ($row AS $c => $col) { - $cell_class = implode(" ", array_merge(isset( $row_class[$r]) ? $row_class[$r] : array(), - isset($column_class[$c]) ? $column_class[$c] : array())); + $cell_class = implode(" ", array_merge(empty( $row_class[$r]) ? array() : $row_class[$r], + empty($column_class[$c]) ? array() : $column_class[$c])); if ($cell_class) $row[$c] = array($col, array('class' => $cell_class)); } @@ -65,11 +65,11 @@ if (isset($rows) && is_array($rows) && count($rows)) { // OK, output the table HTML echo('' . "\n"); - if (isset($caption)) + if (!empty($caption)) echo(' ' . $caption . '' . "\n"); if (isset($headers) && is_array($headers)) { diff --git a/site/webroot/css/layout.css b/site/webroot/css/layout.css index d6392af..047e071 100644 --- a/site/webroot/css/layout.css +++ b/site/webroot/css/layout.css @@ -46,7 +46,7 @@ span.fmt-age.delinquent { color: #f00; } table.item th , table.item td { padding: 0.1em 0.4em 0.1em 0.4em; } -table.item td { white-space: nowrap; } +table.item td.name { white-space: nowrap; } /* table.item { border-spacing: 0 0; /\*IE*\/border-collapse: collapse; empty-cells: show } */ table.item { border-spacing: 0 0; empty-cells: show } table.item { border:1px solid #ccc; @@ -122,6 +122,11 @@ div.detail.supporting { clear : both; .edit table.detail { width : 80%; float : none; } +table.item td { vertical-align: top; } +.edit .item td.field .required { color: #33f } +.edit .item td.field .recommended { color: #35d } +.edit .item td.field .recommended.empty { color: #f5d } +.edit .item td.field .required.empty { color: #f33 } /************************************************************ From 73eeba04fe782c950eba424bc2415df5d4f14acc Mon Sep 17 00:00:00 2001 From: abijah Date: Mon, 24 Aug 2009 06:53:51 +0000 Subject: [PATCH 06/45] As with last checkin for customer, we now have special coloration for required fields, as well as blank required fields. git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@754 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/views/contacts/edit.ctp | 117 +++++++++++++++++++++++++--------- site/views/customers/edit.ctp | 2 +- 2 files changed, 89 insertions(+), 30 deletions(-) diff --git a/site/views/contacts/edit.ctp b/site/views/contacts/edit.ctp index 163af2f..3d1fc26 100644 --- a/site/views/contacts/edit.ctp +++ b/site/views/contacts/edit.ctp @@ -45,6 +45,7 @@ function contactMethodDiv($obj, $type, $legend, $values = null) { ' CLASS="'.$type.'-method-%{id}-source" ' . "\n" . ' ID="'.$type.'-method-%{id}-source-'.$stype.'"' . "\n" . ' VALUE="'.$stype.'"' . "\n" . + ($stype == 'new' ? ' CHECKED' . "\n" : '') . ' />' . "\n" . ' ' . "\n" . ' '; @@ -76,21 +77,30 @@ function contactMethodDiv($obj, $type, $legend, $values = null) { 'fields' => array ( 'preference' => array - ('opts' => array + ('label_attributes' => array('class' => 'required'), + 'opts' => array ('options' => $obj->varstore['methodPreferences'], 'selected' => (isset($values) ? $values['ContactsMethod']['preference'] : null), - )), + ), + 'after' => "Intended purpose for using this method of communication.", + ), 'type' => array - ('opts' => array + ('label_attributes' => array('class' => 'required'), + 'opts' => array ('options' => $obj->varstore['methodTypes'], 'selected' => (isset($values) ? $values['ContactsMethod']['type'] : null), - )), + ), + 'after' => "How / Where this communication reaches the contact.", + ), 'comment' => array - ('opts' => array + ('label_attributes' => array('class' => 'optional empty'), + 'opts' => array ('value' => (isset($values) ? $values['ContactsMethod']['comment'] : null), - )), + ), + 'after' => "Optional: Comments on how this form of communication relates to the contact.", + ), ))) . "\n" . @@ -113,16 +123,23 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) { if ($type === 'phone') { if ($stype === 'existing') { $fields = array - ('id' => array('name' => 'Phone/Ext', + ('id' => array('label_attributes' => array('class' => 'required empty'), + 'name' => 'Phone/Ext', 'opts' => array('options' => $obj->varstore['contactPhones'])), ); } elseif ($stype === 'new') { $fields = array - ('type' => array('opts' => array('options' => $obj->varstore['phoneTypes'])), - 'phone' => true, - 'ext' => array('name' => "Extension"), - 'comment' => true, + ('type' => array('label_attributes' => array('class' => 'required'), + 'opts' => array('options' => $obj->varstore['phoneTypes']), + 'after' => "Physical type of the phone."), + 'phone' => array('label_attributes' => array('class' => 'required empty'), + 'after' => "Required: Phone number."), + 'ext' => array('name' => "Extension", + 'label_attributes' => array('class' => 'optional empty'), + 'after' => "Optional: Extension number."), + 'comment' => array('label_attributes' => array('class' => 'optional empty'), + 'after' => "Optional: Comments about this phone number."), ); } elseif ($stype === 'show') { @@ -149,12 +166,19 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) { } elseif ($stype === 'new') { $fields = array - ('address' => true, - 'city' => true, - 'state' => true, - 'postcode' => array('name' => 'Zip Code'), - 'country' => true, - 'comment' => true, + ('address' => array('label_attributes' => array('class' => 'required empty'), + 'after' => "Required: First line of mailing address."), + 'city' => array('label_attributes' => array('class' => 'required empty'), + 'after' => "Required."), + 'state' => array('label_attributes' => array('class' => 'required empty'), + 'after' => "Required."), + 'postcode' => array('name' => 'Zip Code', + 'label_attributes' => array('class' => 'required empty'), + 'after' => "Required."), + 'country' => array('label_attributes' => array('class' => 'optional empty'), + 'after' => "Optional: USA is presumed."), + 'comment' => array('label_attributes' => array('class' => 'optional empty'), + 'after' => "Optional: Comments about this mailing address."), ); } elseif ($stype === 'show') { @@ -177,13 +201,16 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) { if ($stype === 'existing') { $fields = array ('id' => array('name' => 'Email', + 'label_attributes' => array('class' => 'required'), 'opts' => array('options' => $obj->varstore['contactEmails'])), ); } elseif ($stype === 'new') { $fields = array - ('email' => true, - 'comment' => true, + ('email' => array('label_attributes' => array('class' => 'required empty'), + 'after' => "Required: E-mail address."), + 'comment' => array('label_attributes' => array('class' => 'optional empty'), + 'after' => "Optional: Comments about this email address."), ); } elseif ($stype === 'show') { @@ -204,7 +231,7 @@ function contactMethodTypeDiv($obj, $type, $stype, $values = null) { '