Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r636 - in registry/trunk/app: Controller Lib View/CoPetitions

Subject: COmanage Developers List

List archive

[comanage-dev] r636 - in registry/trunk/app: Controller Lib View/CoPetitions


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r636 - in registry/trunk/app: Controller Lib View/CoPetitions
  • Date: Sun, 8 Dec 2013 21:52:03 -0500

Author: benno
Date: 2013-12-08 21:52:03 -0500 (Sun, 08 Dec 2013)
New Revision: 636

Modified:
registry/trunk/app/Controller/CoPetitionsController.php
registry/trunk/app/Lib/lang.php
registry/trunk/app/View/CoPetitions/petition-attributes.inc
Log:
Fix rerendering of T&C on petition submit failure (CO-733)

Modified: registry/trunk/app/Controller/CoPetitionsController.php
===================================================================
--- registry/trunk/app/Controller/CoPetitionsController.php 2013-12-07
20:43:58 UTC (rev 635)
+++ registry/trunk/app/Controller/CoPetitionsController.php 2013-12-09
02:52:03 UTC (rev 636)
@@ -218,61 +218,62 @@
// Set the enrollment flow ID to make it easier to carry forward
through failed submissions
$this->set('co_enrollment_flow_id', $this->enrollmentFlowID());

- if(($this->action == 'add' || $this->action == 'edit' || $this->action
== 'view')
- && $this->request->is('get')) {
- // If we processed a post, this will have already been set.
-
- $defaultValues = array();
-
+ if(($this->action == 'add' || $this->action == 'edit' || $this->action
== 'view')) {
$enrollmentFlowID = $this->enrollmentFlowID();

- if($enrollmentFlowID) {
- // Provide default values for name for self enrollment.
+ if($this->request->is('get')) {
+ // If we processed a post, this will have already been set.

- $p['match_policy'] =
$this->CoPetition->CoEnrollmentFlow->field('match_policy',
-
array('CoEnrollmentFlow.id' => $enrollmentFlowID));
+ $defaultValues = array();

- if($p['match_policy'] == EnrollmentMatchPolicyEnum::Self) {
- $defName = $this->Session->read('Auth.User.name');
+ if($enrollmentFlowID) {
+ // Provide default values for name for self enrollment.

- if(!empty($defName)) {
- // Populate select attributes only
- $defaultValues['EnrolleeOrgIdentity.Name']['honorific'] =
$defName['honorific'];
- $defaultValues['EnrolleeOrgIdentity.Name']['given'] =
$defName['given'];
- $defaultValues['EnrolleeOrgIdentity.Name']['middle'] =
$defName['middle'];
- $defaultValues['EnrolleeOrgIdentity.Name']['family'] =
$defName['family'];
- $defaultValues['EnrolleeOrgIdentity.Name']['suffix'] =
$defName['suffix'];
+ $p['match_policy'] =
$this->CoPetition->CoEnrollmentFlow->field('match_policy',
+
array('CoEnrollmentFlow.id' => $enrollmentFlowID));
+
+ if($p['match_policy'] == EnrollmentMatchPolicyEnum::Self) {
+ $defName = $this->Session->read('Auth.User.name');
+
+ if(!empty($defName)) {
+ // Populate select attributes only
+ $defaultValues['EnrolleeOrgIdentity.Name']['honorific'] =
$defName['honorific'];
+ $defaultValues['EnrolleeOrgIdentity.Name']['given'] =
$defName['given'];
+ $defaultValues['EnrolleeOrgIdentity.Name']['middle'] =
$defName['middle'];
+ $defaultValues['EnrolleeOrgIdentity.Name']['family'] =
$defName['family'];
+ $defaultValues['EnrolleeOrgIdentity.Name']['suffix'] =
$defName['suffix'];
+ }
}
}
- }
-
- $this->loadModel('CmpEnrollmentConfiguration');
-
- $envValues = false;
- $enrollmentAttributes = $this->CoPetition
- ->CoEnrollmentFlow
- ->CoEnrollmentAttribute
-
->enrollmentFlowAttributes($this->enrollmentFlowID(),
-
$defaultValues);
-
- if($this->CmpEnrollmentConfiguration->orgIdentitiesFromCOEF()) {
- // If enrollment flows can populate org identities, then see if
we're configured
- // to pull environment variables. If so, for this configuration
they simply
- // replace modifiable default values.
+
+ $this->loadModel('CmpEnrollmentConfiguration');

- $envValues =
$this->CmpEnrollmentConfiguration->enrollmentAttributesFromEnv();
+ $envValues = false;
+ $enrollmentAttributes = $this->CoPetition
+ ->CoEnrollmentFlow
+ ->CoEnrollmentAttribute
+
->enrollmentFlowAttributes($this->enrollmentFlowID(),
+
$defaultValues);

- if($envValues) {
- $enrollmentAttributes = $this->CoPetition
- ->CoEnrollmentFlow
- ->CoEnrollmentAttribute
-
->mapEnvAttributes($enrollmentAttributes,
- $envValues);
+ if($this->CmpEnrollmentConfiguration->orgIdentitiesFromCOEF()) {
+ // If enrollment flows can populate org identities, then see if
we're configured
+ // to pull environment variables. If so, for this configuration
they simply
+ // replace modifiable default values.
+
+ $envValues =
$this->CmpEnrollmentConfiguration->enrollmentAttributesFromEnv();
+
+ if($envValues) {
+ $enrollmentAttributes = $this->CoPetition
+ ->CoEnrollmentFlow
+ ->CoEnrollmentAttribute
+
->mapEnvAttributes($enrollmentAttributes,
+ $envValues);
+ }
}
+
+ $this->set('co_enrollment_attributes', $enrollmentAttributes);
}

- $this->set('co_enrollment_attributes', $enrollmentAttributes);
-
// Pull any relevant Terms and Conditions that must be agreed to. We
only do this
// if authentication is required (otherwise we can't really assert
who agreed),
// and only for CO-wide T&C (ie: those without a COU ID specified).
There's not

Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-12-07 20:43:58 UTC (rev 635)
+++ registry/trunk/app/Lib/lang.php 2013-12-09 02:52:03 UTC (rev 636)
@@ -635,7 +635,7 @@
'fd.sponsor' => 'Sponsor',
'fd.sponsor.desc' =>'(for continued membership)',
'fd.status' => 'Status',
- 'fd.tc.agree.desc' => 'You must agree to the following Terms and
Conditions before continuing',
+ 'fd.tc.agree.desc' => 'You must agree to the following Terms and
Conditions before continuing.<br />You must review the T&C before you can
click <i>I Agree</i>, and you must agree before you can submit.',
'fd.tc.agree.no' => 'Not Agreed',
'fd.tc.agree.yes' => 'Agreed',
'fd.tc.cou.desc' => 'If set, this T&C only applies to members of the
specified COU',

Modified: registry/trunk/app/View/CoPetitions/petition-attributes.inc
===================================================================
--- registry/trunk/app/View/CoPetitions/petition-attributes.inc 2013-12-07
20:43:58 UTC (rev 635)
+++ registry/trunk/app/View/CoPetitions/petition-attributes.inc 2013-12-09
02:52:03 UTC (rev 636)
@@ -118,7 +118,7 @@
if(allagreed) {
$(":submit").removeAttr('disabled');
} else {
- // Reset disabled in case "I Agree" was unchecked
+ // Reset disabled in case "I Agree" was unchecked or on initial form
rendering
$(":submit").attr('disabled', true);
}
}
@@ -130,11 +130,15 @@

// Disable checkboxes until individual T&C are reviewed
for(var i = 0;i < tandcids.length;i++) {
- document.getElementById('CoTermsAndConditions'+tandcids[i]).disabled =
true;
+ // If the box is already ticked (eg: if the form re-renders), make
sure it remains enabled
+
if(!document.getElementById('CoTermsAndConditions'+tandcids[i]).checked) {
+ document.getElementById('CoTermsAndConditions'+tandcids[i]).disabled
= true;
+ }
}

// Disable submit button until all T&C are agreed to
- $(":submit").attr('disabled', true);
+ maybe_enable_submit();
+ //$(":submit").attr('disabled', true);
}
<?php endif; ?>




  • [comanage-dev] r636 - in registry/trunk/app: Controller Lib View/CoPetitions, svnlog, 12/08/2013

Archive powered by MHonArc 2.6.16.

Top of Page