Permalink
Browse files

Massive UI update

  • Loading branch information...
1 parent 868ba52 commit 55096cc986f3076481b92205438253398f030c24 @stefancrain stefancrain committed Jan 25, 2013
@@ -146,6 +146,8 @@ public static function unifiedMessageInfo($email) {
'body' => $body,
'date_clean' => self::cleanDate($email->date,'short'),
'date_long' => self::cleanDate($email->date,'long'),
+ 'date_u' => self::cleanDate($email->date,'u'),
+
'status' => $status,
);
@@ -256,6 +258,7 @@ public static function getUnmatchedMessages() {
'uid' => $header->uid,
'date' => $output['header']['date_clean'],
'date_long' => $output['header']['date_long'],
+ 'date_u' => $output['header']['date_u'],
'format' => $output['header']['format'],
'from_email' => $output['forwarded']['origin_email'],
'from_name' => $output['forwarded']['origin_name'],
@@ -380,6 +383,7 @@ public static function getMessageDetails() {
'origin_lookup' => $output['forwarded']['origin_lookup'],
'header_subject' => $output['header']['subject'],
'date' => $output['header']['date_clean'],
+ 'date_long' => $output['header']['date_long'],
'forwarder_time' => $output['forwarded']['date_clean']);
}else{
$returnMessage = array('code' => 'ERROR','message'=>"It's likely that message #{$id} has not be proccessed by the processMailboxes script, wait a few mins");
@@ -408,6 +412,8 @@ public static function cleanDate($date_string, $type){
// reformat the date to something standard here.
if($type=='long'){
+ return date("M d, Y h:i A", strtotime($date_string_short));
+ }if($type=='u'){
return date("U", strtotime($date_string_short));
}else{
// check if the message is from last year
@@ -876,6 +882,8 @@ public static function getMatchedMessages() {
$date = self::cleanDate($activity_node['activity_date_time'],'short');
$date_long = self::cleanDate($activity_node['activity_date_time'],'long');
+ $date_u = self::cleanDate($activity_node['activity_date_time'],'u');
+
// message to return
if ($debug){
var_dump($activity_node);
@@ -895,7 +903,9 @@ public static function getMatchedMessages() {
'match_type' => $activity_node['is_auto'],
'original_id' => $activity_node['original_id'],
'date' => $date,
- 'date_long' => $date_long
+ 'date_long' => $date_long,
+ 'date_u' => $date_u
+
);
}
$returnMessage['count'] = count($returnMessage);
@@ -937,6 +947,7 @@ public static function getActivityDetails() {
$forwarder_node = $forwarder['values'][$activity_node['source_contact_id']];
$date = self::cleanDate($activity_node['activity_date_time'],'short');
+ $date_long = self::cleanDate($activity_node['activity_date_time'],'long');
$returnMessage = array('uid' => $activitId,
'fromName' => $contact_node['display_name'],
@@ -949,7 +960,8 @@ public static function getActivityDetails() {
'match_type' => $activity_node['is_auto'],
'original_id' => $activity_node['original_id'],
'email_user' => self::$imap_accounts[0]['user'], // not ideal for the hardcoded 0
- 'date' => $date);
+ 'date' => $date,
+ 'date_long' =>$date_long);
echo json_encode($returnMessage);
CRM_Utils_System::civiExit();
@@ -86,7 +86,6 @@
</div>
<div id="tagging-popup" title="Tagging" style="display:none;">
<div id="tagging-popup-header"> </div>
- <hr/>
<div id="tagging">
<ul>
<li><a href="#tab1">Tag Contact</a></li>
@@ -74,13 +74,21 @@ a.tag-selected:hover { color: #fff!important; background-color: red; }
/* hide dialogues on page load */
#delete-confirm,#loading-popup{ display: none;}
.ui-dialog #find-match-popup.ui-dialog-content {padding:0; }
-#message_left {float:left; margin:10px 10px 0 10px ; }
+#message_left {float:left; }
#message_left .debug_info {display: none; }
#message_left .debug_on,#message_left .debug_off {color: #336699!important; }
-.debug_sumit{ border:1px solid #ccc; background: #e1e1e1; padding: 4px; margin-bottom: 10px;}
-#message_left_header{ width:640px; height:100px; border-bottom: 1px solid #ccc; }
-#message_left_email{ width:640px; height:350px; overflow:auto; }
-#message_right{ width:270px; float:left; border-left: 1px solid #ccc; padding:0 0 0 10px; height:455px;}
+.debug_sumit{ border:1px solid #e5e5e5; background: #f1f1f1; padding: 4px; margin-bottom: 10px;}
+
+#message_left_header{ padding:10px ; background: #f1f1f1; border-bottom: 1px solid #e5e5e5; height: 90px;line-height: 23px;width: 640px; }
+
+
+
+#message_left_header.crmdev,#message_left_header.crmtest{height: 110px;}
+
+#message_left_email{ padding:10px ;width:640px; height:340px; overflow:auto; }
+
+#message_left_email.crmdev,#message_left_email.crmtest{height: 320px;}
+#message_right{ width:285px; float:left; border-left: 1px solid #ccc; padding:0 0 0 10px; height:455px;}
#find-match-popup .ui-tabs-panel { padding:0;}
/*.first_name,.last_name {width:46%;}*/
.hidden{display:none;}
@@ -92,7 +100,7 @@ a.tag-selected:hover { color: #fff!important; background-color: red; }
.imapper-contact-box {background-color: #f8f8f8;margin-bottom: 4px;padding: 4px 0;float:left;}
.imapper-contact-box:hover {cursor: pointer; background-color: #eeeeee}
.imapper-address-select-box {height: 16px;width: 20px;float: left;padding: 15px 0px;}
-.imapper-address-box {float: left;width: 215px;padding-left: 5px;}
+.imapper-address-box {float: left;width: 230px;padding-left: 5px;}
.clear {clear: both;}
.emailbubble,.matchbubble {padding: 2px 4px;}
.marginL10 {margin-left: 10px;}
@@ -122,8 +130,19 @@ a.tag-selected:hover { color: #fff!important; background-color: red; }
}
.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;}
-#message_right label input {width: 150px; }
-#tagging #BBTreeContainer .BBTree, #BBDialog .BBTree{height: 200px;}
+.label_def{width: 100px;font-weight: bold;float: left;margin: 0.4em 0 0.02em;}
+#message_right label input {width: 165px; }
+#tagging #BBTreeContainer .BBTree, #BBDialog .BBTree{height: 200px; width: 250px; float: left;}
.loading_message{ margin: 0px auto; background: #fff; padding:5px; width: 200px}
-
+.popup_def{ color: #777777;
+ float: left;
+ margin: 0 10px 0 0;
+ text-align: right;
+ width: 100px;}
+
+.ui-tabs .ui-tabs-nav {background-color: #f8f8f8!important;}
+.ui-tabs .ui-state-hover a{background-color: #bbcbdf!important;}
+.ui-tabs .ui-state-active a{background-color: #d1deef!important;}
+
+#tagging-popup-header{ padding:10px 0; background: #f1f1f1; border-bottom: 1px solid #e5e5e5; height: 90px; line-height: 23px;width: 960px; }
+#tagging-popup{ padding: 0; margin: 0;}
@@ -546,21 +546,21 @@ cj(document).ready(function(){
success: function(data,status) {
cj("#loading-popup").dialog('close');
messages = cj.parseJSON(data);
- cj('#tagging-popup-header').append("<strong>From: </strong>"+messages.fromName +" <i>&lt;"+ messages.fromEmail+"&gt;</i><br/><strong>Subject: </strong>"+messages.subject+"<br/><strong>Date: </strong>"+messages.date+"<br/>");
+
- cj('#tagging-popup-header').html('').append("<strong>From: </strong>"+messages.fromName +" <i>&lt;"+ messages.fromEmail+"&gt;</i><br/><strong>Subject: </strong>"+messages.subject+"<br/><strong>Date: </strong>"+messages.date+"<br/>");
+ cj('#tagging-popup-header').html('').append("<span class='popup_def'>From: </span>"+messages.fromName +" <span class='emailbubble'>"+ messages.fromEmail+"</span><br/><span class='popup_def'>Subject: </span>"+messages.subject+"<br/><span class='popup_def'>Date: </span>"+messages.date+"<br/>");
cj('#tagging-popup-header').append("<input class='hidden' type='hidden' id='activityId' value='"+activityId+"'><input class='hidden' type='hidden' id='contactId' value='"+contactId+"'>");
if ((messages.forwardedEmail != '')){
- cj('#tagging-popup-header').append("<strong>Forwarded by: </strong>"+messages.forwardedName+" <i>&lt;"+ messages.forwardedEmail+"&gt;</i><br/>");
- }
- if ((messages.fromAddress)){
- cj('#tagging-popup-header').append("<strong>Address by: </strong>"+messages.fromAddress);
+ cj('#tagging-popup-header').append("<span class='popup_def'>Forwarded by: </span>"+messages.forwardedName+" <span class='emailbubble'>"+ messages.forwardedEmail+"</span><br/>");
}
+ // if ((messages.fromAddress)){
+ // cj('#tagging-popup-header').append("<span class='popup_def'>Address by: </strong>"+messages.fromAddress);
+ // }
cj("#tagging-popup").dialog({ title: "Tagging: "+ short_subject(messages.subject,50) });
cj("#tagging-popup").dialog('open');
-
+ cj("#tagging").tabs();
},
error: function(){
alert('unable to find activity');
@@ -699,17 +699,20 @@ cj(document).ready(function(){
if(messages.attachmentname ){var name = messages.attachmentname}else{var name = messages.attachmentfilename};
icon = '<div class="ui-icon ui-icon-link attachment" title="'+name+'"></div>'
}
+ cj('#message_left_header').addClass(messages.email_user);
+ cj('#message_left_email').addClass(messages.email_user);
+
cj('#message_left_header').html('');
- if(messages.fromName) cj('#message_left_header').append("<strong>From: </strong>"+messages.fromName +" ");
+ if(messages.fromName) cj('#message_left_header').append("<span class='popup_def'>From: </span>"+messages.fromName +" ");
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/>");
+ cj('#message_left_header').append("<br/><span class='popup_def'>Subject: </span>"+short_subject(messages.subject,70)+" "+ icon+"<br/><span class='popup_def'>Date: </span>"+messages.date_long+"<br/>");
if ((messages.forwardedEmail != '')){
- cj('#message_left_header').append("<strong>"+messages.status+" from: </strong>"+messages.forwardedName+" <i>&lt;"+ messages.forwardedEmail+"&gt;</i><br/>");
+ cj('#message_left_header').append("<span class='popup_def'>"+messages.status+" from: </span>"+messages.forwardedName+" <span class='emailbubble'>"+ messages.forwardedEmail+"</span><br/>");
}
// add some debug info to the message body on toggle
if(messages.email_user == 'crmdev' || messages.email_user == 'crmtest' ){
- var debugHTML ="<div class='debug_on'>Show Debug info</div><div class='debug_info'><div class='debug_remove'><i>UnMatched Message Header ("+messages.status+"):</i><br/><strong>Forwarder: </strong>"+messages.forwardedFull+"<br/><strong>Subject: </strong>"+messages.header_subject+"<br/><strong>Date: </strong>"+messages.date+"<br/><strong>Id: </strong>"+messages.uid+"<br/><strong>ImapId: </strong>"+messages.imapId+"<br/><strong>Format: </strong>"+messages.format+"<br/><strong>Mailbox: </strong>"+messages.email_user+"<br/><strong>Attachment Count: </strong>"+messages.attachment+"<br/>";
+ var debugHTML ="<span class='popup_def'>Dev & Test only</span><div class='debug_on'>Show Debug info</div><div class='debug_info'><div class='debug_remove'><i>UnMatched Message Header ("+messages.status+"):</i><br/><strong>Forwarder: </strong>"+messages.forwardedFull+"<br/><strong>Subject: </strong>"+messages.header_subject+"<br/><strong>Date: </strong>"+messages.date+"<br/><strong>Id: </strong>"+messages.uid+"<br/><strong>ImapId: </strong>"+messages.imapId+"<br/><strong>Format: </strong>"+messages.format+"<br/><strong>Mailbox: </strong>"+messages.email_user+"<br/><strong>Attachment Count: </strong>"+messages.attachment+"<br/>";
if(messages.status !== 'direct'){
debugHTML +="<br/><i>Parsed email body (origin):</i><br/><strong>Subject: </strong>"+messages.subject+"<br/><strong>Fristname: </strong>"+firstName+"<br/><strong>Lastname: </strong>"+lastName+"<br/><strong>Email: </strong>"+messages.fromEmail+"<br/><strong>Address lookup: </strong>"+messages.origin_lookup+"<br/><strong>Date: </strong>"+messages.forwarder_time+"";
@@ -767,18 +770,20 @@ cj(document).ready(function(){
cj("#loading-popup").dialog('close');
messages = cj.parseJSON(data);
cj('#message_left_header').html('');
- if(messages.fromName) cj('#message_left_header').html('').append("<strong>From: </strong>"+messages.fromName +" ");
- if(messages.fromEmail) cj('#message_left_header').append("<i>&lt;"+ messages.fromEmail+"&gt;</i>");
- cj('#message_left_header').append("<br/><strong>Subject: </strong>"+messages.subject+"<br/><strong>Date: </strong>"+messages.date+"<br/>");
+ if(messages.fromName) cj('#message_left_header').html('').append("<span class='popup_def'>From: </span>"+messages.fromName +" ");
+ if(messages.fromEmail) cj('#message_left_header').append("<span class='emailbubble '>"+ messages.fromEmail+"</span>");
+ cj('#message_left_header').append("<br/><span class='popup_def'>Subject: </span>"+short_subject(messages.subject,70) +"<br/><span class='popup_def'>Date: </span>"+messages.date_long+"<br/>");
cj('.email_address').val(messages.fromEmail);
if ((messages.forwardedEmail != '')){
- cj('#message_left_header').append("<strong>Forwarded by: </strong>"+messages.forwardedName+" <i>&lt;"+ messages.forwardedEmail+"&gt;</i><br/>");
+ cj('#message_left_header').append("<span class='popup_def'>Forwarded by: </span>"+messages.forwardedName+" <span class='emailbubble marginL5'>"+ messages.fromEmail+"</span><br/>");
}
// if we are on crmdev or crmtest show a debug window
+ cj('#message_left_header').addClass(messages.email_user);
+ cj('#message_left_email').addClass(messages.email_user);
if( messages.email_user == 'crmdev' || messages.email_user == 'crmtest' ){
var match_type = (messages.match_type == 0) ? "Manually matched by user" : "Process Mailbox Script " ;
- var debugHTML ="<div class='debug_on'>Show Debug info</div><div class='debug_info'><div class='debug_remove'><i>Matched Message Info:</i><br/><strong>Match Type: </strong>"+match_type+" ("+messages.match_type+")<br/><strong>Activty id: </strong>"+messages.uid+"<br/><strong>Assigned by: </strong>"+messages.forwardedName+"<br/><strong>Assigned To: </strong>"+messages.fromId+"<br/><strong>Created from message Id: </strong>"+messages.original_id+"<br/>";
+ var debugHTML ="<span class='popup_def'>Dev & Test only</span><div class='debug_on'>Show Debug info</div><div class='debug_info'><div class='debug_remove'><i>Matched Message Info:</i><br/><strong>Match Type: </strong>"+match_type+" ("+messages.match_type+")<br/><strong>Activty id: </strong>"+messages.uid+"<br/><strong>Assigned by: </strong>"+messages.forwardedName+"<br/><strong>Assigned To: </strong>"+messages.fromId+"<br/><strong>Created from message Id: </strong>"+messages.original_id+"<br/>";
debugHTML +="<span class='search_info'></span></div></div>";
cj('#message_left_header').append(debugHTML);
// we can create redmine issues with message details and assign to stefan from a url !
@@ -903,9 +908,7 @@ function makeListSortable(){
"bAutoWidth": false,
"bInfo": false,
});
- // unbind the sort on the checkbox and actions
- cj("th.checkbox").removeClass('sorting').unbind('click');
- cj("th.Actions").removeClass('sorting').unbind('click');
+
checks();
@@ -969,7 +972,7 @@ function buildMessageList() {
// messagesHtml += '<td class="email"></td>';
messagesHtml += '<td class="subject">'+short_subject(value.subject,40) +' '+icon+'</td>';
- messagesHtml += '<td class="date"><span data="'+value.date_long+'">'+value.date +'</span></td>';
+ messagesHtml += '<td class="date"><span data="'+value.date_u+'">'+value.date +'</span></td>';
// check for direct messages & not empty forwarded messages
if((value.status == 'direct' ) && (value.forwarder_email != '')){
@@ -1018,7 +1021,7 @@ function buildActivitiesList() {
messagesHtml += '<span class="emailbubble marginL5">'+short_subject(value.fromEmail,14)+'</span>';
messagesHtml +='</td>';
messagesHtml += '<td class="subject">'+short_subject(value.subject,40) +'</td>';
- messagesHtml += '<td class="date"><span data="'+value.date_long+'">'+value.date +'</span></td>';
+ messagesHtml += '<td class="date"><span data="'+value.date_u+'">'+value.date +'</span></td>';
messagesHtml += '<td class="forwarder">'+short_subject(value.forwarder,14)+'</td>';
messagesHtml += '<td class="Actions"> <span class="edit_match"><a href="#">Edit</a></span> | <span class="add_tag"><a href="#">Tag</a></span> | <span class="clear_activity"><a href="#">Clear</a></span> | <span class="delete"><a href="#">Delete</a></span></td> </tr>';
}

0 comments on commit 55096cc

Please sign in to comment.