comanage-dev - [comanage-dev] r575 - in registry/trunk/app: Model View/CoPetitions
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r575 - in registry/trunk/app: Model View/CoPetitions
- Date: Thu, 15 Aug 2013 04:40:10 -0400
Author: marie
Date: 2013-08-15 04:40:10 -0400 (Thu, 15 Aug 2013)
New Revision: 575
Modified:
registry/trunk/app/Model/CoEnrollmentAttribute.php
registry/trunk/app/View/CoPetitions/petition-attributes.inc
Log:
CO467 - Group Related Petition Attributes Together
Modified: registry/trunk/app/Model/CoEnrollmentAttribute.php
===================================================================
--- registry/trunk/app/Model/CoEnrollmentAttribute.php 2013-08-08 13:08:17
UTC (rev 574)
+++ registry/trunk/app/Model/CoEnrollmentAttribute.php 2013-08-15 08:40:10
UTC (rev 575)
@@ -477,7 +477,9 @@
} else {
// Label
- $attr['label'] = $efAttr['CoEnrollmentAttribute']['label'] .
": " . _txt('fd.' . $attrName . '.' . $k);
+ $attr['group'] = $efAttr['CoEnrollmentAttribute']['label'];
+
+ $attr['label'] = _txt('fd.' . $attrName . '.' . $k);
// Description
$attr['description'] =
$efAttr['CoEnrollmentAttribute']['description'];
Modified: registry/trunk/app/View/CoPetitions/petition-attributes.inc
===================================================================
--- registry/trunk/app/View/CoPetitions/petition-attributes.inc 2013-08-08
13:08:17 UTC (rev 574)
+++ registry/trunk/app/View/CoPetitions/petition-attributes.inc 2013-08-15
08:40:10 UTC (rev 575)
@@ -28,144 +28,217 @@
$l = 1;
?>
-<div>
- <table id="<?php print $this->action; ?>_co_petition_attrs"
class="ui-widget">
- <tbody>
- <?php foreach ($co_enrollment_attributes as $ea): ?>
- <?php if(!$ea['hidden'] && isset($ea['default']) &&
!$ea['modifiable']) {
- // Since disabled values don't submit with the form, convert
them to hidden
- // fields and change the fieldName for the visible attribute
-
- $hfieldName = $ea['model'] . '.' . $ea['field'];
- $fieldName = $hfieldName . "-disabled";
-
- print $this->Form->hidden($hfieldName, array('default' =>
$ea['default'])) . "\n";
- } else {
- $fieldName = $ea['model'] . '.' . $ea['field'];
- }
- ?>
- <?php if($ea['hidden']): ?>
- <?php print $this->Form->hidden($fieldName, array('default' =>
$ea['default'])) . "\n"; ?>
- <?php else: ?>
- <tr class="line<?php print ($l % 2); $l++; ?>">
- <td>
- <?php
- // Emit the label for this field
-
- print "<b>" . $ea['label'] . "</b>";
-
- if($ea['required']) {
- print "<font class=\"required\">*</font>\n";
- }
-
- if(isset($ea['description'])
- && $ea['description'] != "") {
- print "</br>\n<font class=\"desc\">" . $ea['description'] .
"</font>\n";
- }
- ?>
- </td>
- <td>
- <?php
- // Emit the field itself, according to the type of field
-
- // The type of validation rule can influence what we output.
- $ruleType = 'default';
-
- if(isset($ea['validate']['rule'][0]))
- $ruleType = $ea['validate']['rule'][0];
-
- // XXX need to retrieve current values for edit and view
-
- if($e) {
- switch($ruleType) {
- case 'inList':
- // This is a select
- $args = array();
- // Set a default value if provided
- if(isset($ea['default'])) {
- $args['value'] = $ea['default'];
- $args['disabled'] = !$ea['modifiable'];
- }
- $args['empty'] = !$ea['required'];
+<style>
+ .modelbox{
+ border: solid 1px #8dbbdd;
+ margin: 5px;
+ padding: 9px 38px;
+ float: left;
+ border-radius: 10px;
+ width: 90%;
+ }
+
+ .boxtitle{
+ padding: 0 0 5px 0;
+ }
+
+ .modelbox table tr>:first-child{
+ min-width: 200px;
+ text-align: right;
+ }
+
+ .modelbox table tr>:nth-child(2){
+ min-width: 150px;
+ }
+
+ .modelbox table tr>:nth-child(2) input {
+ min-width: 380px;
+ }
+
+ .modelbox table tr>:nth-child(2) select{
+ min-width: 387px;
+ }
+</style>
+
+<div style = "overflow:hidden;">
+ <?php
+ // Sort attributes by model for printing
+ $coea_model = array();
+ $misc_attr = array();
+
+ foreach ($co_enrollment_attributes as $ea){
+ if ($ea['hidden']) { // Sort hidden ones out
+ $hidden_attr[] = $ea;
+ } else {
+ if( isset($ea['group']) ) { // Sort by group
+ $coea_model[ $ea['group'] ][] = $ea;
+ } else {
+ // Has no group
+ $coea_model[$ea['label']][] = $ea;
+ }
+ }
+ }
+
+ // Print the hidden fields
+ foreach ($hidden_attr as $ea) {
+ if($ea['hidden'])
+ $fieldName = $ea['model'] . '.' . $ea['field'];
+
+ print $this->Form->hidden($fieldName, array('default' =>
$ea['default'])) . "\n";
+ }
+
+ // Print the ones not hidden
+ foreach ($coea_model as $m => $coe_attributes):
+ ?>
+ <div class="ui-widget modelbox">
+ <div class = "boxtitle">
+ <b><?php print $m ?></b>
+ </div>
+ <table id="<?php print $this->action; ?>_co_petition_attrs_<?php print
$m?>" class="ui-widget">
+ <tbody>
+ <?php
+ $l = 0; // Reset zebra stripes for each box
+ foreach ($coe_attributes as $ea):
+ if(!$ea['hidden'] && isset($ea['default']) &&
!$ea['modifiable']) {
+ // Since disabled values don't submit with the form, convert
them to hidden
+ // fields and change the fieldName for the visible attribute
- print $this->Form->select($fieldName,
- $ea['select'],
- $args);
+ $hfieldName = $ea['model'] . '.' . $ea['field'];
+ $fieldName = $hfieldName . "-disabled";
- if($this->Form->isFieldError($fieldName)) {
- print $this->Form->error($fieldName);
- }
- break;
- case 'validateTimestamp':
- // Handle dates specially to generate the popup calendar
- $c = 'datepicker';
-
- if($ea['field'] == 'valid_from')
- $c = 'datepicker-f';
- elseif($ea['field'] == 'valid_until')
- $c = 'datepicker-c';
-
- $args = array();
- $args['class'] = $c;
-
- if(isset($ea['default'])) {
- $args['default'] = $ea['default'];
- $args['disabled'] = !$ea['modifiable'];
- }
-
- print $this->Form->text($fieldName, $args);
-
- if($this->Form->isFieldError($fieldName)) {
- print $this->Form->error($fieldName);
- }
- break;
- default:
- // Use default field
-
- $args = array();
- $args['required'] = $ea['required'];
-
- // Use a provided default value, if one specified
- if(isset($ea['default'])) {
- $args['default'] = $ea['default'];
- $args['disabled'] = !$ea['modifiable'];
- }
-
- if($permissions['match']
- && ($fieldName == 'EnrolleeCoPerson.Name.given'
- || $fieldName == 'EnrolleeCoPerson.Name.family')) {
- # XXX Temp hack to enable real-time query. This should
- # instead be enabled for fields with an appropriate flag.
- $args['class'] = 'matchable';
- }
-
- print $this->Form->input($fieldName, $args);
- break;
+ print $this->Form->hidden($hfieldName, array('default' =>
$ea['default'])) . "\n";
+ } else {
+ $fieldName = $ea['model'] . '.' . $ea['field'];
}
-
- print "\n";
- } else {
- // Just emit the current value for this attribute, if set
-
- if(isset($co_petition_attribute_values[ $ea['id'] ][
$ea['field'] ])) {
- switch($ruleType) {
- case 'inList':
- print $ea['select'][ $co_petition_attribute_values[
$ea['id'] ][ $ea['field'] ]];
- break;
- case 'validateTimestamp':
- print $this->Time->nice($co_petition_attribute_values[
$ea['id'] ][ $ea['field'] ]);
- break;
- default:
- print $co_petition_attribute_values[ $ea['id'] ][
$ea['field'] ];
- break;
- }
- }
- }
?>
- </td>
- </tr>
- <?php endif; ?>
- <?php endforeach; ?>
+
+ <tr class="line<?php print ($l % 2); $l++; ?>">
+ <td>
+ <?php
+ // Emit the label for this field
+ print "<b>" . $ea['label'] . "</b>";
+
+ if($ea['required']) {
+ print "<font class=\"required\">*</font>\n";
+ }
+
+ if(isset($ea['description'])
+ && $ea['description'] != "") {
+ print "</br>\n<font class=\"desc\">" .
$ea['description'] . "</font>\n";
+ }
+ ?>
+ </td>
+ <td>
+ <?php
+ // Emit the field itself, according to the type of field
+
+ // The type of validation rule can influence what we
output.
+ $ruleType = 'default';
+
+ if(isset($ea['validate']['rule'][0]))
+ $ruleType = $ea['validate']['rule'][0];
+
+ // XXX need to retrieve current values for edit and view
+
+ if($e) {
+ switch($ruleType) {
+ case 'inList':
+ // This is a select
+ $args = array();
+ // Set a default value if provided
+ if(isset($ea['default'])) {
+ $args['value'] = $ea['default'];
+ $args['disabled'] = !$ea['modifiable'];
+ }
+ $args['empty'] = !$ea['required'];
+
+ print $this->Form->select($fieldName,
+ $ea['select'],
+ $args);
+
+ if($this->Form->isFieldError($fieldName)) {
+ print $this->Form->error($fieldName);
+ }
+ break;
+ case 'validateTimestamp':
+ // Handle dates specially to generate the popup
calendar
+ $c = 'datepicker';
+
+ if($ea['field'] == 'valid_from')
+ $c = 'datepicker-f';
+ elseif($ea['field'] == 'valid_until')
+ $c = 'datepicker-c';
+
+ $args = array();
+ $args['class'] = $c;
+
+ if(isset($ea['default'])) {
+ $args['default'] = $ea['default'];
+ $args['disabled'] = !$ea['modifiable'];
+ }
+
+ print $this->Form->text($fieldName, $args);
+
+ if($this->Form->isFieldError($fieldName)) {
+ print $this->Form->error($fieldName);
+ }
+ break;
+ default:
+ // Use default field
+
+ $args = array();
+ $args['required'] = $ea['required'];
+
+ // Use a provided default value, if one specified
+ if(isset($ea['default'])) {
+ $args['default'] = $ea['default'];
+ $args['disabled'] = !$ea['modifiable'];
+ }
+
+ if($permissions['match']
+ && ($fieldName == 'EnrolleeCoPerson.Name.given'
+ || $fieldName ==
'EnrolleeCoPerson.Name.family')) {
+ # XXX Temp hack to enable real-time query. This
should
+ # instead be enabled for fields with an appropriate
flag.
+ $args['class'] = 'matchable';
+ }
+
+ print $this->Form->input($fieldName, $args);
+ break;
+ }
+
+ print "\n";
+ } else {
+ // Just emit the current value for this attribute, if set
+
+ if(isset($co_petition_attribute_values[ $ea['id'] ][
$ea['field'] ])) {
+ switch($ruleType) {
+ case 'inList':
+ print $ea['select'][ $co_petition_attribute_values[
$ea['id'] ][ $ea['field'] ]];
+ break;
+ case 'validateTimestamp':
$this->Time->nice($co_petition_attribute_values[ $ea['id'] ][ $ea['field'] ]);
+ break;
+ default:
+ print $co_petition_attribute_values[ $ea['id'] ][
$ea['field'] ];
+ break;
+ }
+ }
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
+ endforeach;
+ ?>
+ </tbody>
+ </table>
+ </div>
+ <?php
+ endforeach; // foreach ($coea_model as $m => $coe_attributes):
+ ?>
+ <table id="<?php print $this->action; ?>_co_petition_attrs"
class="ui-widget">
+ <tbody>
<tr>
<td>
<i><font class="required"><?php echo _txt('fd.req');
?></font></i><br />
@@ -213,4 +286,4 @@
<div style="float:right;width:35%" id="results">
</div>
</div>
-//-->
+//-->
\ No newline at end of file
- [comanage-dev] r575 - in registry/trunk/app: Model View/CoPetitions, svnlog, 08/15/2013
Archive powered by MHonArc 2.6.16.