Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r653 - in registry/trunk/app: Lib Model View/EmailAddresses

Subject: COmanage Developers List

List archive

[comanage-dev] r653 - in registry/trunk/app: Lib Model View/EmailAddresses


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r653 - in registry/trunk/app: Lib Model View/EmailAddresses
  • Date: Thu, 26 Dec 2013 14:11:12 -0500

Author: benno
Date: 2013-12-26 14:11:12 -0500 (Thu, 26 Dec 2013)
New Revision: 653

Modified:
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/EmailAddress.php
registry/trunk/app/View/EmailAddresses/fields.inc
Log:
Unverify verified email address on edit (CO-463)

Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-12-26 19:05:54 UTC (rev 652)
+++ registry/trunk/app/Lib/lang.php 2013-12-26 19:11:12 UTC (rev 653)
@@ -569,6 +569,7 @@
'fd.email_address.mail' => 'Email',
'fd.email_address.verified' => 'Verified',
'fd.email_address.unverified' => 'Unverified',
+ 'fd.email_address.verified.warn' => 'Editing a verified email address will
make it unverified',
'fd.enrollee' => 'Enrollee',
'fd.false' => 'False',
'fd.group.desc.adm' => '%1$s Administrators',

Modified: registry/trunk/app/Model/EmailAddress.php
===================================================================
--- registry/trunk/app/Model/EmailAddress.php 2013-12-26 19:05:54 UTC (rev
652)
+++ registry/trunk/app/Model/EmailAddress.php 2013-12-26 19:11:12 UTC (rev
653)
@@ -119,6 +119,42 @@
}

/**
+ * Actions to take before a save operation is executed.
+ *
+ * @since COmanage Registry v0.9
+ */
+
+ public function beforeSave($options = array()) {
+ // Make sure verified is set appropriately
+
+ if(!empty($this->data['EmailAddress']['id'])) {
+ // We have an existing record. Pull the current values.
+
+ $args = array();
+ $args['conditions']['EmailAddress.id'] =
$this->data['EmailAddress']['id'];
+ $args['contain'] = false;
+
+ $curdata = $this->find('first', $args);
+
+ if(!empty($curdata['EmailAddress']['mail'])
+ && !empty($this->data['EmailAddress']['mail'])
+ && $curdata['EmailAddress']['mail'] !=
$this->data['EmailAddress']['mail']) {
+ // Email address was changed, flag as unverified
+ $this->data['EmailAddress']['verified'] = false;
+ } else {
+ // Use prior setting
+ $this->data['EmailAddress']['verified'] =
$curdata['EmailAddress']['verified'];
+ }
+ } else {
+ // Adding a new address should default to not verified
+
+ $this->data['EmailAddress']['verified'] = false;
+ }
+
+ return true;
+ }
+
+ /**
* Mark an address as verified.
*
* @since COmanage Registry v0.7

Modified: registry/trunk/app/View/EmailAddresses/fields.inc
===================================================================
--- registry/trunk/app/View/EmailAddresses/fields.inc 2013-12-26 19:05:54
UTC (rev 652)
+++ registry/trunk/app/View/EmailAddresses/fields.inc 2013-12-26 19:11:12
UTC (rev 653)
@@ -46,16 +46,26 @@

if(isset($cur_co))
print $this->Form->hidden('co_id', array('default' =>
$cur_co['Co']['id'])) . "\n";
+
+ // Is the current email address verified?
+ $isVerified = (isset($email_addresses[0]['EmailAddress']['verified'])
+ && $email_addresses[0]['EmailAddress']['verified']);
?>
<table id="<?php echo $this->action; ?>_email_address" class="ui-widget">
<tbody>
<tr class="line1">
<td>
- <?php echo _txt('fd.email_address.mail'); ?>
+ <?php print _txt('fd.email_address.mail'); ?>
</td>
<td>
- <?php echo ($e ? $this->Form->input('mail') :
Sanitize::html($email_addresses[0]['EmailAddress']['mail'])); ?>
+ <?php print ($e ? $this->Form->input('mail') :
Sanitize::html($email_addresses[0]['EmailAddress']['mail'])); ?>
</td>
+ <?php if($e && $isVerified): ?>
+ <td>
+ <span class="ui-icon ui-icon-info" style="float: left; margin-right:
.3em;"></span>
+ <i><?php print _txt('fd.email_address.verified.warn'); ?></i>
+ </td>
+ <?php endif; ?>
</tr>
<tr class="line2">
<td>
@@ -90,9 +100,7 @@
// For an add, verified is by definition no and can't (currently,
anyway) be set manually.
// This will be caught by $email_addresses being null.

- print (isset($email_addresses[0]['EmailAddress']['verified'])
- && $email_addresses[0]['EmailAddress']['verified']
- ? _txt('fd.yes') : _txt('fd.no'));
+ print ($isVerified ? _txt('fd.yes') : _txt('fd.no'));
?>
</td>
</tr>



  • [comanage-dev] r653 - in registry/trunk/app: Lib Model View/EmailAddresses, svnlog, 12/26/2013

Archive powered by MHonArc 2.6.16.

Top of Page