-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
321 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
|
||
namespace ShyimMailCatcher\Models; | ||
|
||
use Shopware\Components\Model\ModelEntity; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Table(name="s_plugin_mailcatcher_attachments") | ||
* @ORM\Entity | ||
*/ | ||
class Attachment extends ModelEntity | ||
{ | ||
/** | ||
* @var int | ||
* | ||
* @ORM\Column(name="id", type="integer", nullable=false) | ||
* @ORM\Id | ||
* @ORM\GeneratedValue(strategy="AUTO") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* OWNING SIDE | ||
* | ||
* @var Mails | ||
* | ||
* @ORM\ManyToOne(targetEntity="ShyimMailCatcher\Models\Mails") | ||
* @ORM\JoinColumn(name="mail_id", referencedColumnName="id") | ||
*/ | ||
protected $mail; | ||
|
||
/** | ||
* @ORM\Column(name="file_name", type="string", nullable=false) | ||
*/ | ||
private $fileName; | ||
|
||
/** | ||
* @ORM\Column(name="content", type="text", nullable=false) | ||
*/ | ||
private $content; | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @param int $id | ||
*/ | ||
public function setId($id) | ||
{ | ||
$this->id = $id; | ||
} | ||
|
||
/** | ||
* @return Mails | ||
*/ | ||
public function getMail() | ||
{ | ||
return $this->mail; | ||
} | ||
|
||
/** | ||
* @param Mails $mail | ||
*/ | ||
public function setMail(Mails $mail) | ||
{ | ||
$this->mail = $mail; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getFileName() | ||
{ | ||
return $this->fileName; | ||
} | ||
|
||
/** | ||
* @param mixed $fileName | ||
*/ | ||
public function setFileName($fileName) | ||
{ | ||
$this->fileName = $fileName; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getContent() | ||
{ | ||
return $this->content; | ||
} | ||
|
||
/** | ||
* @param mixed $content | ||
*/ | ||
public function setContent($content) | ||
{ | ||
$this->content = $content; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Ext.define('Shopware.apps.Mailcatcher.model.Attachment', { | ||
extend: 'Ext.data.Model', | ||
|
||
fields: [ | ||
{ | ||
name: 'id', | ||
type: 'integer' | ||
}, | ||
{ | ||
name: 'fileName', | ||
type: 'string' | ||
} | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Ext.define('Shopware.apps.Mailcatcher.store.Attachment', { | ||
extend:'Ext.data.Store', | ||
model: 'Shopware.apps.Mailcatcher.model.Attachment', | ||
|
||
autoLoad: true, | ||
remoteSort: true, | ||
remoteFilter: true, | ||
|
||
proxy:{ | ||
type:'ajax', | ||
|
||
url: '{url controller=Mailcatcher action=getAttachments}', | ||
|
||
reader:{ | ||
type:'json', | ||
root:'data', | ||
totalProperty:'total' | ||
} | ||
} | ||
}); |
42 changes: 42 additions & 0 deletions
42
Resources/views/backend/mailcatcher/view/list/attachment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Ext.define('Shopware.apps.Mailcatcher.view.list.Attachment', { | ||
extend: 'Ext.grid.Panel', | ||
title: 'Attachments', | ||
height: '100%', | ||
layout: 'fit', | ||
|
||
initComponent: function () { | ||
var me = this; | ||
|
||
me.store = Ext.create('Shopware.apps.Mailcatcher.store.Attachment'); | ||
me.store.getProxy().extraParams.mailId = me.mailId; | ||
|
||
me.store.on('load', function () { | ||
me.setTitle('Attachments (' + me.store.count().toString() + ')'); | ||
}); | ||
|
||
me.columns = [ | ||
{ | ||
text: 'Name', | ||
dataIndex: 'fileName', | ||
flex: 1 | ||
}, | ||
Ext.create('Ext.grid.column.Action', { | ||
width: 30, | ||
items: [ | ||
{ | ||
iconCls: 'sprite-drive-download', | ||
tooltip: 'Download', | ||
handler: function (view, rowIndex, colIndex, item) { | ||
var store = view.getStore(), | ||
record = store.getAt(rowIndex); | ||
|
||
window.open('{url action=downloadAttachment}?id=' + record.get('id')); | ||
} | ||
} | ||
] | ||
}) | ||
]; | ||
|
||
me.callParent(arguments); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.