Permalink
Browse files

More email bubbles, Date updates

  • Loading branch information...
1 parent 96f492e commit 9525267793d33143dde9f5cca88ae6faaef7bfbe @stefancrain stefancrain committed Jan 24, 2013
Showing with 48 additions and 40 deletions.
  1. +30 −29 civicrm/custom/php/CRM/IMAP/AJAX.php
  2. +4 −3 modules/nyss_imapper/nyss_imapper.css
  3. +14 −8 modules/nyss_imapper/nyss_imapper.js
@@ -218,37 +218,38 @@ public static function getUnmatchedMessages() {
$email = $imap->getmsg_uid($header->uid);
$output = self::unifiedMessageInfo($email);
- if($output['forwarded']['origin_email']){
- // Don't double check email addresses
- if(!$checked[$output['forwarded']['origin_email']] ){
- // leaving civi here for records, it was really really slow
- // $params = array('version' => 3, 'contact' => 'get', 'email' => $output['forwarded']['origin_email'] );
- // $contact = civicrm_api('contact', 'get', $params);
-
- // lets reuse the search function
- $email = $output['forwarded']['origin_email'];
- $Query="SELECT contact.id, email.email FROM civicrm_contact contact
- LEFT JOIN civicrm_email email ON (contact.id = email.contact_id)
-WHERE contact.is_deleted=0
- AND email.email LIKE '$email'
-GROUP BY contact.id
-ORDER BY contact.id ASC, email.is_primary DESC";
-
- $result = mysql_query($Query, self::db());
- $results = array();
- while($row = mysql_fetch_assoc($result)) {
- $results[] = $row;
- }
-
+ if ($output['code'] == "SUCCESS"){
- $checked[$output['forwarded']['origin_email']] = count($results);
+ if($output['forwarded']['origin_email']){
+ // Don't double check email addresses
+ if(!$checked[$output['forwarded']['origin_email']] ){
+ // leaving civi here for records, it was really really slow
+ // $params = array('version' => 3, 'contact' => 'get', 'email' => $output['forwarded']['origin_email'] );
+ // $contact = civicrm_api('contact', 'get', $params);
+
+ // lets reuse the search function
+ $email = $output['forwarded']['origin_email'];
+ $Query="SELECT contact.id, email.email FROM civicrm_contact contact
+ LEFT JOIN civicrm_email email ON (contact.id = email.contact_id)
+ WHERE contact.is_deleted=0
+ AND email.email LIKE '$email'
+ GROUP BY contact.id
+ ORDER BY contact.id ASC, email.is_primary DESC";
+
+ $result = mysql_query($Query, self::db());
+ $results = array();
+ while($row = mysql_fetch_assoc($result)) {
+ $results[] = $row;
+ }
+
+
+ $checked[$output['forwarded']['origin_email']] = count($results);
+ }
+ }else{
+ $checked[''] = 0;
}
- }else{
- $checked[''] = 0;
- }
- if ($output['code'] == "SUCCESS"){
$returnMessage[$header->uid] = array(
'subject' => $output['forwarded']['subject'],
'from' => $output['forwarded']['origin_name'].' '.$output['forwarded']['origin_email'],
@@ -414,9 +415,9 @@ public static function cleanDate($date_string, $type){
return date("M d, Y", strtotime($date_string_short));
}else{
if ( (date("d", strtotime($date_string_short)) - date("d")) < 0 ){
- return date("M d h:iA", strtotime($date_string_short));
+ return date("M d h:i A", strtotime($date_string_short));
}else{
- return 'Today '.date("h:iA", strtotime($date_string_short));
+ return 'Today '.date("h:i A", strtotime($date_string_short));
}
}
}
@@ -47,7 +47,7 @@
.imapperbox .full h1 small{ color:#999; font-size: 20px;}
.imapperbox .full .list_header{ font-weight: bold;}
.imapperbox .full .checkboxieout{ left:5px; }
-.imapperbox .full .subject { width:330px;}
+.imapperbox .full .subject { width:320px;}
.name{min-width: 285px !important}
.forwarder,.Forwarder{ overflow: hidden;width: 100px;}
.date{width: 100px !important; overflow: hidden; display: block; height: 32px;}
@@ -96,9 +96,10 @@ a.tag-selected:hover { color: #fff!important; background-color: red; }
.clear {clear: both;}
.emailbubble,.matchbubble {padding: 2px 4px;border-radius: 3px 3px 3px 3px;}
.marginL10 {margin-left: 10px;}
+.marginL5 {margin-left: 5px;}
.emailbubble, .name .badge,.matchbubble {background-color: #999999; color: #FFFFFF;display: inline-block;font-size: 11.844px;font-weight: bold; line-height: 14px;padding: 2px 4px; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); vertical-align: baseline;white-space: nowrap;}
-.matchbubble {background-color: #457AA4; color: #FFFFFF;}
-
+.matchbubble {background-color: #88BBC8; color: #FFFFFF;}
+.warn {background-color: #ED7A53;}
.imapper-message-box td { vertical-align: middle!important; }
#message_right label{float: left;display: block;}
.label_def{width: 95px;font-weight: bold;float: left;margin: 0.4em 0 0.02em;}
@@ -701,7 +701,7 @@ cj(document).ready(function(){
}
cj('#message_left_header').html('');
if(messages.fromName) cj('#message_left_header').append("<strong>From: </strong>"+messages.fromName +" ");
- if(messages.fromEmail) cj('#message_left_header').append("<i>&lt;"+ messages.fromEmail+"&gt;</i>");
+ if(messages.fromEmail) cj('#message_left_header').append("<span class='emailbubble'>"+short_subject(messages.fromEmail)+"</span>");
cj('#message_left_header').append("<br/><strong>Subject: </strong>"+short_subject(messages.subject,70)+" "+ icon+"<br/><strong>Date: </strong>"+messages.date+"<br/>");
if ((messages.forwardedEmail != '')){
@@ -897,7 +897,6 @@ function makeListSortable(){
"aaSorting": [[ 3, "desc" ]],
"aoColumnDefs": [ { "sType": "title-string", "aTargets": [ 3 ] }],
// "aoColumnDefs": [ { "bSearchable": true, "bVisible": false, "aTargets": [ 3 ] } ],
- "iDisplayLength": 50,
"bStateSave": true,
'aTargets': [ 1 ],
"bPaginate": false,
@@ -944,17 +943,24 @@ function buildMessageList() {
messagesHtml += '<td class="name" data-firstName="'+firstName(value.from_name)+'" data-lastName="'+lastName(value.from_name)+'">'+short_subject(value.from_name,20);
if( value.from_email != '' && value.from_email != null){
- messagesHtml += '<span class="emailbubble marginL10">'+short_subject(value.from_email,15)+'</span>';
- messagesHtml += '<span class="matchbubble marginL10" title="This email address matches '+value.match_count+' Records in bluebird ">'+value.match_count+'</span>';
+ messagesHtml += '<span class="emailbubble marginL5">'+short_subject(value.from_email,15)+'</span>';
+ if(value.match_count == 1){
+ messagesHtml += '<span class="matchbubble warn marginL5" title="This Record Should have Automatched as it matches '+value.match_count+' Record in bluebird ">'+value.match_count+'</span>';
+ }else{
+ messagesHtml += '<span class="matchbubble marginL5" title="This email address matches '+value.match_count+' Records in bluebird ">'+value.match_count+'</span>';
+
+ }
+ }else{
+ messagesHtml += '<span class="emailbubble warn marginL5" title="We could not find the email address of this record">No email found!</span>';
}
messagesHtml +='</td>';
}else if( value.from_email != '' && value.from_email != null ){
messagesHtml += '<td class="name"><span class="emailbubble">'+short_subject(value.from_email,25)+'</span>';
- messagesHtml += '<span class="matchbubble marginL10" title="This email address matches '+value.match_count+' Records in bluebird ">'+value.match_count+'</span></td>';
+ messagesHtml += '<span class="matchbubble marginL5" title="This email address matches '+value.match_count+' Records in bluebird ">'+value.match_count+'</span></td>';
}else {
- messagesHtml += '<td class="name">N/A</td>';
+ messagesHtml += '<td class="name"><span class="matchbubble warn" title="There was no info found in regard to the source of this message">No source info found</span></td>';
}
if( value.attachmentfilename || value.attachmentname || value.attachment){
if(value.attachmentname ){var name = value.attachmentname}else{var name = value.attachmentfilename};
@@ -974,7 +980,7 @@ function buildMessageList() {
messagesHtml += '<td class="forwarder"> N/A </td>';
}
- messagesHtml += '<td class="Actions"><span class="find_match"><a href="#">Find match </a></span> | <span class="delete"><a href="#">Delete</a></span></td> </tr>';
+ messagesHtml += '<td class="Actions"><span class="find_match"><a href="#">Find match</a></span> | <span class="delete"><a href="#">Delete</a></span></td> </tr>';
}
});
cj('#imapper-messages-list').html(messagesHtml);
@@ -1009,7 +1015,7 @@ function buildActivitiesList() {
messagesHtml += '<td class="name">N/A ';
}
- messagesHtml += '<span class="emailbubble marginL10">'+short_subject(value.fromEmail,14)+'</span>';
+ messagesHtml += '<span class="emailbubble marginL5">'+short_subject(value.fromEmail,14)+'</span>';
messagesHtml +='</td>';
messagesHtml += '<td class="subject">'+short_subject(value.subject,50) +'</td>';
messagesHtml += '<td class="date"><span data="'+value.date_long+'">'+value.date +'</span></td>';

0 comments on commit 9525267

Please sign in to comment.