Email print view partially done
This commit is contained in:
parent
8d848c7975
commit
868d774c69
|
|
@ -74,6 +74,19 @@ class EmailsController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
function print_frame($id = null) {
|
||||
$this->layout = 'ajax';
|
||||
$email = $this->Email->find('first', array('conditions'=>array('Email.id'=>$id)));
|
||||
|
||||
$body_ID = $this->findBodyID($email['EmailAttachment']);
|
||||
$this->set('body_ID', $body_ID);
|
||||
$this->set('recipients', $this->Email->EmailRecipient->getRecipients($id));
|
||||
|
||||
$this->set('email', $email);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all the Emails that are from, to, cc a User ID
|
||||
*
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class ShipmentsController extends AppController {
|
|||
|
||||
|
||||
if ($this->Shipment->saveAll($this->data)) {
|
||||
|
||||
|
||||
$this->Shipment->Box->updateCounterCache(array('shipment_id'=>$shipment_id));
|
||||
$this->Shipment->ShipmentInvoice->updateCounterCache(array('shipment_id'=>$shipment_id));
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ echo $form->input('id', array('type'=>'hidden'));
|
|||
<?=$form->input('address_id', array('type'=>'hidden', 'id'=>'address_id', 'value'=>$this->data['Shipment']['address_id']));?>
|
||||
|
||||
<div id="freight_forwarder" class="hiddenDefault">
|
||||
<?=$form->input('freight_forwarder_id');?>
|
||||
<?=$form->input('freight_forwarder_id', array('type'=>'select','empty'=>'Choose Freight Forwarder'));?>
|
||||
|
||||
<button class="addFreightForwarder hiddenDefault">Add Freight Forwarder</button>
|
||||
<div id="newFreightForwarderDiv" class="hiddenDefault">
|
||||
|
|
|
|||
94
views/emails/print_frame.ctp
Executable file
94
views/emails/print_frame.ctp
Executable file
|
|
@ -0,0 +1,94 @@
|
|||
<?=$javascript->link('email_frame'); ?>
|
||||
|
||||
<div id="emailHeaders">
|
||||
<dl>
|
||||
|
||||
|
||||
<dt><?php __('From'); ?></dt>
|
||||
<dd>
|
||||
<?php echo $html->link($email['User']['first_name'].' '.$email['User']['last_name'],
|
||||
array('controller'=>'users', 'action'=>'view', $email['User']['id'])); ?>
|
||||
|
||||
<?php echo $html->link($email['User']['email'], array('controller'=>'users','action'=>'view',$email['User']['id'])); ?>
|
||||
</dd>
|
||||
|
||||
|
||||
<?php
|
||||
if(isset($recipients['to'])): ?>
|
||||
|
||||
<dt>To</dt>
|
||||
<?
|
||||
$ddCount = 0;
|
||||
foreach($recipients['to'] as $recipient):
|
||||
$ddCount++;
|
||||
if($ddCount > 1) {
|
||||
$class="additionalDD";
|
||||
}
|
||||
else {
|
||||
$class= "";
|
||||
}
|
||||
?>
|
||||
<dd class="<?=$class?>">
|
||||
<?php
|
||||
if(!empty($recipient['first_name']) && !empty($recipient['last_name'])) {
|
||||
echo $html->link($recipient['first_name'].' '.$recipient['last_name'],
|
||||
array('controller'=>'users', 'action'=>'view', $recipient['id']));
|
||||
} ?>
|
||||
|
||||
<?php echo $html->link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?>
|
||||
</dd>
|
||||
<? endforeach;?>
|
||||
<? endif;?>
|
||||
|
||||
|
||||
<?php
|
||||
if(isset($recipients['cc'])): ?>
|
||||
<dt>cc</dt>
|
||||
<?
|
||||
$ddCount = 0;
|
||||
foreach($recipients['cc'] as $recipient):
|
||||
$ddCount++;
|
||||
if($ddCount > 1) {
|
||||
$class="additionalDD";
|
||||
}
|
||||
else {
|
||||
$class= "";
|
||||
}
|
||||
?>
|
||||
<dd class="<?=$class?>">
|
||||
<?php
|
||||
if(!empty($recipient['first_name']) && !empty($recipient['last_name'])) {
|
||||
echo $html->link($recipient['first_name'].' '.$recipient['last_name'],
|
||||
array('controller'=>'users', 'action'=>'view', $recipient['id']));
|
||||
} ?>
|
||||
<?php echo $html->link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?>
|
||||
</dd>
|
||||
<? endforeach;?>
|
||||
<? endif;?>
|
||||
|
||||
<dt><?php __('Date'); ?></dt>
|
||||
<dd>
|
||||
<?php echo date('j M Y @ G:i', $email['Email']['udate']); ?>
|
||||
|
||||
|
||||
</dd>
|
||||
<dt><?php __('Subject'); ?></dt>
|
||||
<dd>
|
||||
<?php echo $email['Email']['subject']; ?>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="emailframeDiv">
|
||||
<iframe id="emailFrame" src="/email_attachments/view/<?=$body_ID?>" width="100%" height="500px">
|
||||
<p>This function only works with a Modern Browser that uses Iframes. Sorry.</p>
|
||||
</iframe>
|
||||
</div>
|
||||
<div id="emailattachments">
|
||||
<?php echo $this->element('email_attachments', array('attachments' => $email['EmailAttachment'])); ?>
|
||||
</div>
|
||||
|
||||
|
||||
<? //print_r($email); ?>
|
||||
|
|
@ -272,7 +272,7 @@ $(function() {
|
|||
ID = getCakeID(model,invoiceNo, field);
|
||||
name = getCakeName(model, invoiceNo, field);
|
||||
div.children('label').attr('for', ID);
|
||||
div.children('input').attr('id', ID).attr('name', name);
|
||||
div.children(':input').attr('id', ID).attr('name', name);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
$(function () {
|
||||
|
||||
|
||||
|
||||
$("#ViewDialog").dialog({
|
||||
autoOpen: false,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue