jQuery email view working OK
This commit is contained in:
parent
d1792506d2
commit
b2ab892253
12
vendors/shells/vault.php
vendored
12
vendors/shells/vault.php
vendored
|
|
@ -25,7 +25,7 @@ class VaultShell extends Shell {
|
||||||
|
|
||||||
if($testing == 1) {
|
if($testing == 1) {
|
||||||
$email_dir = '/Users/karlcordes/Sites/quotenik/app/emails';
|
$email_dir = '/Users/karlcordes/Sites/quotenik/app/emails';
|
||||||
|
|
||||||
$ripmime_path = '/opt/local/bin/ripmime';
|
$ripmime_path = '/opt/local/bin/ripmime';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -39,7 +39,7 @@ class VaultShell extends Shell {
|
||||||
if($number_of_messages == 0) {
|
if($number_of_messages == 0) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Loop through the messages and sort them into ones to be processed or discarded */
|
/* Loop through the messages and sort them into ones to be processed or discarded */
|
||||||
for ($i=30000; $i <= $number_of_messages; $i++) {
|
for ($i=30000; $i <= $number_of_messages; $i++) {
|
||||||
|
|
@ -162,7 +162,7 @@ class VaultShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// $this->rmdirr($email_dir); //delete all attachments from the working directory. Easiest way to stop random files persisting
|
// $this->rmdirr($email_dir); //delete all attachments from the working directory. Easiest way to stop random files persisting
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -327,7 +327,7 @@ class VaultShell extends Shell {
|
||||||
|
|
||||||
if(isset($output[0])) { //Found a valid-looking Enquiry Number
|
if(isset($output[0])) { //Found a valid-looking Enquiry Number
|
||||||
$fetched_enquirynumber = $output[0];
|
$fetched_enquirynumber = $output[0];
|
||||||
// echo $fetched_enquirynumber."\n";
|
// echo $fetched_enquirynumber."\n";
|
||||||
$enquiry = $this->Enquiry->findByTitle($fetched_enquirynumber);
|
$enquiry = $this->Enquiry->findByTitle($fetched_enquirynumber);
|
||||||
if($enquiry) {
|
if($enquiry) {
|
||||||
return $enquiry;
|
return $enquiry;
|
||||||
|
|
@ -387,8 +387,8 @@ class VaultShell extends Shell {
|
||||||
function getUniqId($email_dir) {
|
function getUniqId($email_dir) {
|
||||||
$uniqid = uniqid(null,TRUE);
|
$uniqid = uniqid(null,TRUE);
|
||||||
//while(is_dir($email_dir."/".$uniqid) == TRUE) {
|
//while(is_dir($email_dir."/".$uniqid) == TRUE) {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
return $uniqid;
|
return $uniqid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
|
<?php echo $javascript->link('email_table'); ?>
|
||||||
|
|
||||||
|
<?php // if (!empty($emails)):?>
|
||||||
|
|
||||||
<?php if (!empty($emails)):?>
|
<div id="emailDiv">
|
||||||
<table cellpadding = "0" cellspacing = "0" class="emailtable">
|
|
||||||
<tr>
|
|
||||||
<th><?php __('Email Date'); ?></th>
|
|
||||||
<th><?php echo $html->image('attach.png'); ?></th>
|
|
||||||
<th><?php __('Subject'); ?></th>
|
|
||||||
<th><?php __('To'); ?></th>
|
|
||||||
<th><?php __('CC'); ?></th>
|
|
||||||
<th><?php __('From'); ?></th>
|
|
||||||
|
|
||||||
<th class="actions"><?php __('Actions');?></th>
|
<table cellpadding = "0" cellspacing = "0" class="emailtable">
|
||||||
</tr>
|
<tr>
|
||||||
|
<th><?php __('Email Date'); ?></th>
|
||||||
|
<th><?php echo $html->image('attach.png'); ?></th>
|
||||||
|
<th><?php __('From'); ?></th>
|
||||||
|
<th><?php __('Subject'); ?></th>
|
||||||
|
|
||||||
|
<th><?php __('To'); ?></th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($emails as $email):
|
foreach ($emails as $email):
|
||||||
|
|
@ -26,28 +28,32 @@
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr<?php echo $class;?>>
|
<tr<?php echo $class;?>>
|
||||||
|
|
||||||
<td><?php echo $email['Email']['date'];?></td>
|
<td><?php echo $email['Email']['date'];?></td>
|
||||||
<td><?php if($email['email_attachment_count'] > 0) {
|
<td><?php if($email['Email']['email_attachment_count'] > 0) {
|
||||||
echo $html->image('attach.png');
|
echo $html->image('attach.png');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $text->highlight($ajax->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id']), array('update'=>'showemail')), 'Quotation'); ?></td>
|
<td><?php echo $email['Email']['from']; ?></td>
|
||||||
<td><?php echo $email['Email']['to']; ?></td>
|
<td><?php //echo $text->highlight($html->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id'])), 'Quotation');
|
||||||
<td><?php echo $email['Email']['cc']; ?></td>
|
echo $text->highlight($html->link($email['Email']['subject'], '#', array('class'=>'viewLink', 'id'=>$email['Email']['id'])), 'Quotation');
|
||||||
<td><?php echo $email['Email']['from']; ?></td>
|
?></td>
|
||||||
|
|
||||||
<td class="actions">
|
|
||||||
<?php //echo $html->link(__('View', true), array('controller'=> 'emails', 'action'=>'view/', $email['Email']['id']));
|
<td><?php echo $email['Email']['to']; ?></td>
|
||||||
echo $ajax->link('View', array('controller'=>'emails', 'action'=>'frame/', $email['Email']['id']), array('update' => 'showemail'));
|
|
||||||
echo $html->link('Print', array('controller' => 'emails', 'action'=>'printview/', $email['Email']['id']));
|
|
||||||
?>
|
</tr>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
|
<?php //endif; ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="ViewDialog">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
<div id="emailframe">
|
<div id="emailframe">
|
||||||
<h3>Email</h3>
|
|
||||||
<iframe src ="<?php echo $html->url("show/$id"); ?>" width="100%" height="500px">
|
<iframe src ="<?php echo $html->url("show/$id"); ?>" width="100%" height="500px">
|
||||||
<p>This function only works with a Modern Browser that uses Iframes. Sorry.</p>
|
<p>This function only works with a Modern Browser that uses Iframes. Sorry.</p>
|
||||||
</iframe>
|
</iframe>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
<? Configure::write('debug', 0); ?>
|
||||||
|
|
||||||
<div id="viewemail">
|
<div id="viewemail">
|
||||||
<dl class="mailheaders"><?php $i = 0; $class = ' class="altrow"';?>
|
<dl class="mailheaders"><?php $i = 0; $class = ' class="altrow"';?>
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry'); ?></dt>
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry'); ?></dt>
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
|
|
||||||
<li><?php echo $html->link('Contacts', '/contacts/index'); ?>
|
<li><?php echo $html->link('Contacts', '/contacts/index'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('Contact Index', '/contacts/index'); ?></li>
|
<li class="last"><?php echo $html->link('Contact Index', '/contacts/index'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,9 +286,14 @@ a#mailheaders {
|
||||||
color: #003d4c;
|
color: #003d4c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#viewemail {
|
#viewemail {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
|
clear: both;
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,13 +314,14 @@ a#mailheaders {
|
||||||
}
|
}
|
||||||
|
|
||||||
#emailframe {
|
#emailframe {
|
||||||
float: left;
|
|
||||||
width: 50%;
|
clear: both;
|
||||||
|
display: block;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#emailattachments {
|
#emailattachments {
|
||||||
padding-right: 2em;
|
|
||||||
float: right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dl#showemail {
|
dl#showemail {
|
||||||
|
|
@ -1038,9 +1044,8 @@ div.tipbox {
|
||||||
li.selected { background-color: #ffb; }
|
li.selected { background-color: #ffb; }
|
||||||
|
|
||||||
span {
|
span {
|
||||||
|
|
||||||
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
span.note {
|
span.note {
|
||||||
|
|
|
||||||
58
webroot/js/email_table.js
Normal file
58
webroot/js/email_table.js
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
* file: email_table.js
|
||||||
|
* date: Tue 23 March 2010
|
||||||
|
* author: Karl Cordes
|
||||||
|
*
|
||||||
|
* purpose: uses jQuery to create a mail client-like interface for viewing the emails associated with an enquiry (or contact)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("#ViewDialog").dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
|
||||||
|
width: 900,
|
||||||
|
modal: false,
|
||||||
|
buttons: {
|
||||||
|
|
||||||
|
Close: function() {
|
||||||
|
$(this).dialog('close');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close: function() {
|
||||||
|
//What happens on close goes here.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.viewLink').click(function() {
|
||||||
|
|
||||||
|
var currentID = $(this).attr('id');
|
||||||
|
var subject = $(this).text();
|
||||||
|
|
||||||
|
$("#ViewDialog").dialog("option", "title", subject);
|
||||||
|
|
||||||
|
$.get('/emails/frame/'+currentID, function (data) {
|
||||||
|
$("#ViewDialog").html(data);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#ViewDialog").dialog('open');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
Loading…
Reference in a new issue