Vault now runs forever, watching for new files
This commit is contained in:
parent
b233ead647
commit
e370e1f54e
|
|
@ -93,11 +93,27 @@ class EmailsController extends AppController {
|
|||
return;
|
||||
}
|
||||
else {
|
||||
$fromEmails = $this->Email->find('list', array('fields'=>array('Email.id'), 'recursive'=>0, 'conditions'=>array('Email.user_id'=>$id)));
|
||||
$recEmails = $this->Email->EmailRecipient->find('all', array('fields'=>array('Email.id'),'recursive'=>0, 'conditions'=>array('EmailRecipient.user_id'=>$id)));
|
||||
//$this->set('emails', $this->paginate());
|
||||
$fromMailIDs = $this->Email->find('list', array('conditions'=>array('Email.user_id'=>$id)));
|
||||
$recMailIDs = $this->Email->EmailRecipient->find('list', array('conditions'=>array('EmailRecipient.user_id'=>$id)));
|
||||
|
||||
$this->set('emails', $fromEmails);
|
||||
$this->set('recEmails', $recEmails);
|
||||
$allIDs = $fromMailIDs + $recMailIDs;
|
||||
|
||||
sort($allIDs);
|
||||
|
||||
$this->set('allIDs', $allIDs);
|
||||
|
||||
|
||||
|
||||
$this->paginate = array(
|
||||
'conditions' => array('Email.id'=>$allIDs),
|
||||
'order'=>array('Email.udate DESC')
|
||||
);
|
||||
|
||||
|
||||
$userMail = $this->paginate('Email');
|
||||
//$userMail = $this->Email->find('all', array('conditions'=>array('Email.id'=>$allIDs), 'order'=>array('Email.udate DESC')));
|
||||
$this->set('userMail', $userMail);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,5 +51,7 @@ class Email extends AppModel {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
20
vendors/shells/vault.php
vendored
20
vendors/shells/vault.php
vendored
|
|
@ -44,6 +44,8 @@ class VaultShell extends Shell {
|
|||
$processed_dir = '/var/www/cakephp/app/processed_vaultmsgs';
|
||||
}
|
||||
|
||||
|
||||
while(true) {
|
||||
$emails = scandir($vault_dir);
|
||||
$processed = scandir($processed_dir);
|
||||
$new = array_diff($emails, $processed);
|
||||
|
|
@ -96,6 +98,11 @@ class VaultShell extends Shell {
|
|||
continue;
|
||||
}
|
||||
|
||||
if(!$this->isEmlFile($vault_dir, $email_filename)) {
|
||||
echo "Incorrect file extension. Skipping this file";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*if(file_exists($processed_dir."/".$email_filename)) {
|
||||
continue;
|
||||
|
|
@ -374,8 +381,21 @@ class VaultShell extends Shell {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isEmlFile($vault_dir, $filename) {
|
||||
$info = pathinfo($vault_dir."/".$filename);
|
||||
|
||||
if($info['extension'] == 'eml') {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,12 @@
|
|||
?>
|
||||
</td>
|
||||
<td><?php //echo $text->highlight($html->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id'])), 'Quotation');
|
||||
echo $text->highlight($html->link(Sanitize::clean($email['Email']['subject']), '#', array('class'=>'viewLink', 'id'=>$email['Email']['id'])), 'Quotation');?>
|
||||
echo $text->highlight($html->link($email['Email']['subject'], '#', array('class'=>'viewLink', 'id'=>$email['Email']['id'])), 'Quotation');?>
|
||||
<span class='viewLink' id="<? echo $email['Email']['id']?>">(<? echo $email['Email']['id']?>)</span>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php echo $javascript->link('jquery.jeditable.mini'); ?>
|
||||
|
||||
<?=$javascript->link('ajax_pagination'); ?>
|
||||
<?=$javascript->link('ajax_pagination_enquiry'); ?>
|
||||
|
||||
|
||||
<?php echo $paginator->options(array('url'=>$this->passedArgs)); ?>
|
||||
|
|
|
|||
35
views/emails/view_user_emails.ctp
Normal file
35
views/emails/view_user_emails.ctp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?=$javascript->link('view_user_email'); ?>
|
||||
|
||||
|
||||
<?php echo $paginator->options(array('url'=>$this->passedArgs)); ?>
|
||||
|
||||
<?php
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% Enquiries out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
));
|
||||
?>
|
||||
|
||||
<div class="pagingEmail">
|
||||
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
||||
| <?php echo $paginator->numbers();?>
|
||||
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="related">
|
||||
<h3>
|
||||
User Email<?php echo $html->image('internet-mail.png'); ?>
|
||||
</h3>
|
||||
<?php echo $this->element('email_table_ajax', array('emails' => $userMail)); ?>
|
||||
<?php //echo $this->element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<? //debug($userMail); ?>
|
||||
|
||||
<hr>
|
||||
|
||||
<?// debug($allIDs); ?>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="enquiriesindex">
|
||||
<h2><?php __('Master Enquiry Register');?></h2>
|
||||
|
||||
<? echo $this->element('enquiry_table', $enquiries, $status_list, array('cache'=>'+1 day')); ?>
|
||||
<? echo $this->element('enquiry_table', $enquiries, $status_list); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?=$javascript->link('view_user'); ?>
|
||||
|
||||
<?=$javascript->link('view_user_email'); ?>
|
||||
<span id="userID" style="display: none;"><?=$user['User']['id']?></span>
|
||||
|
||||
<div class="users view">
|
||||
|
|
@ -37,9 +37,22 @@
|
|||
<button id="show" class="showHide">Show</button>
|
||||
<button id="hide" class="showHide">Hide</button>
|
||||
|
||||
<div id="ajaxLoad" style="display:none;"><?php echo $html->image('ajax-loader.gif'); ?></div>
|
||||
<div id="ajaxLoadEnquiry" style="display:none;"><?php echo $html->image('ajax-loader.gif'); ?></div>
|
||||
|
||||
<div id="enquiryTable">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="related">
|
||||
<h3>Email Correspondence with this User.</h3>
|
||||
<button id="showEmail" class="showHide">Show</button>
|
||||
<button id="hideEmail" class="showHide">Hide</button>
|
||||
|
||||
<div id="ajaxLoadEmail" style="display:none;"><?php echo $html->image('ajax-loader.gif'); ?></div>
|
||||
|
||||
<div id="emailTable">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
26
webroot/js/ajax_pagination_email.js
Normal file
26
webroot/js/ajax_pagination_email.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
$(function() {
|
||||
|
||||
/* Everything about this JS violates DRY. But it will work for now */
|
||||
|
||||
|
||||
$(".pagingEmail").find('a').click(function() {
|
||||
|
||||
$('#emailTable').fadeOut('slow');
|
||||
|
||||
$("#ajaxLoadEmail").bind("ajaxSend", function() {
|
||||
$(this).show();
|
||||
}).bind("ajaxComplete", function() {
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
$.get($(this).attr('href'), function(data) {
|
||||
$('#emailTable').html(data);
|
||||
$('#emailTable').fadeIn('slow');
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
$(function() {
|
||||
|
||||
/* Everything about this JS violates DRY. But it will work for now */
|
||||
|
||||
|
||||
$(".paging").find('a').click(function() {
|
||||
|
||||
$('#enquiryTable').fadeOut('slow');
|
||||
|
||||
$("#ajaxLoad").bind("ajaxSend", function() {
|
||||
$("#ajaxLoadEnquiry").bind("ajaxSend", function() {
|
||||
$(this).show();
|
||||
}).bind("ajaxComplete", function() {
|
||||
$(this).hide();
|
||||
|
|
@ -3,8 +3,8 @@ $(function() {
|
|||
$('#show').hide();
|
||||
$('#enquiryTable').hide();
|
||||
|
||||
$("#ajaxLoad").hide();
|
||||
$("#ajaxLoad").bind("ajaxSend", function() {
|
||||
$("#ajaxLoadEnquiry").hide();
|
||||
$("#ajaxLoadEnquiry").bind("ajaxSend", function() {
|
||||
$(this).show();
|
||||
}).bind("ajaxComplete", function() {
|
||||
$(this).hide();
|
||||
|
|
@ -32,7 +32,6 @@ $(function() {
|
|||
$('#show').click(function() {
|
||||
$(this).hide();
|
||||
$('#hide').show();
|
||||
|
||||
$('#enquiryTable').slideDown('fast');
|
||||
|
||||
});
|
||||
|
|
|
|||
41
webroot/js/view_user_email.js
Normal file
41
webroot/js/view_user_email.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
$(function() {
|
||||
|
||||
$('#hideEmail').hide();
|
||||
$('#emailTable').hide();
|
||||
|
||||
$("#ajaxLoadEmail").hide();
|
||||
$("#ajaxLoadEmail").bind("ajaxSend", function() {
|
||||
$(this).show();
|
||||
}).bind("ajaxComplete", function() {
|
||||
$(this).hide();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
var userID = $('#userID').text();
|
||||
|
||||
|
||||
|
||||
|
||||
$('#hideEmail').click(function() {
|
||||
$(this).hide();
|
||||
$('#showEmail').show();
|
||||
|
||||
$('#emailTable').slideUp('fast');
|
||||
});
|
||||
|
||||
|
||||
$('#showEmail').click(function() {
|
||||
$(this).hide();
|
||||
$('#hideEmail').show();
|
||||
$.get('/emails/view_user_emails/'+userID, function(data) {
|
||||
$('#emailTable').html(data);
|
||||
$('#emailTable').slideDown('fast');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue