Skip to content
Snippets Groups Projects
Commit e1f6a4ce authored by Jared Hancock's avatar Jared Hancock
Browse files

Fix non-local images on client interface

parent 9478ccb8
Branches
Tags
No related merge requests found
...@@ -27,3 +27,19 @@ ...@@ -27,3 +27,19 @@
.pull-right { .pull-right {
float: right; float: right;
} }
.non-local-image {
display: inline-block;
border: 5px dashed #eee;
}
.non-local-image:after {
background: url(../assets/default/images/logo.png) center left no-repeat;
background-size: cover;
content: "";
z-index: -1;
width: 100%;
height: 100%;
display: block;
opacity: 0.3;
}
...@@ -71,9 +71,9 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) { ...@@ -71,9 +71,9 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) {
if($entry['thread_type']=='R' && ($cfg->hideStaffName() || !$entry['staff_id'])) if($entry['thread_type']=='R' && ($cfg->hideStaffName() || !$entry['staff_id']))
$poster = ' '; $poster = ' ';
?> ?>
<table class="<?php echo $threadType[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="800" border="0"> <table class="thread-entry <?php echo $threadType[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="800" border="0">
<tr><th><?php echo Format::db_datetime($entry['created']); ?> &nbsp;&nbsp;<span><?php echo $poster; ?></span></th></tr> <tr><th><?php echo Format::db_datetime($entry['created']); ?> &nbsp;&nbsp;<span class="textra"></span><span><?php echo $poster; ?></span></th></tr>
<tr><td class="thread-body"><?php echo Format::display($entry['body']); ?></td></tr> <tr><td class="thread-body"><?php echo Format::viewableImages(Format::display($entry['body'])); ?></td></tr>
<?php <?php
if($entry['attachments'] if($entry['attachments']
&& ($tentry=$ticket->getThreadEntry($entry['id'])) && ($tentry=$ticket->getThreadEntry($entry['id']))
...@@ -105,7 +105,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) { ...@@ -105,7 +105,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) {
<h2>Post a Reply</h2> <h2>Post a Reply</h2>
<input type="hidden" name="id" value="<?php echo $ticket->getExtId(); ?>"> <input type="hidden" name="id" value="<?php echo $ticket->getExtId(); ?>">
<input type="hidden" name="a" value="reply"> <input type="hidden" name="a" value="reply">
<table border="0" cellspacing="0" cellpadding="3" width="800"> <table border="0" cellspacing="0" cellpadding="3" style="width:100%">
<tr> <tr>
<td colspan="2"> <td colspan="2">
<?php <?php
......
...@@ -130,4 +130,60 @@ showImagesInline = function(urls, thread_id) { ...@@ -130,4 +130,60 @@ showImagesInline = function(urls, thread_id) {
e.appendTo(caption); e.appendTo(caption);
} }
}); });
var showNonLocalImage = function(div) {
var $div = $(div),
$img = $div.append($('<img>')
.attr('src', $div.data('src'))
.attr('alt', $div.attr('alt'))
.attr('title', $div.attr('title'))
.attr('style', $div.data('style'))
);
if ($div.attr('width'))
$img.width($div.attr('width'));
if ($div.attr('height'))
$img.height($div.attr('height'));
};
// Optionally show external images
$('.thread-entry').each(function(i, te) {
var extra = $(te).find('.textra'),
imgs = $(te).find('div.non-local-image[data-src]');
if (!extra) return;
if (!imgs.length) return;
extra.append($('<a>')
.addClass("action-button show-images")
.css({'font-weight':'normal'})
.text(' Show Images')
.click(function(ev) {
imgs.each(function(i, img) {
showNonLocalImage(img);
$(img).removeClass('non-local-image')
// Remove placeholder sizing
.css({'display':'inline-block'})
.width('auto')
.height('auto')
.removeAttr('width')
.removeAttr('height');
extra.find('.show-images').hide();
});
})
.prepend($('<i>')
.addClass('icon-picture')
)
);
imgs.each(function(i, img) {
var $img = $(img);
// Save a copy of the original styling
$img.data('style', $img.attr('style'));
$img.removeAttr('style');
// If the image has a 'height' attribute, use it, otherwise, use
// 40px
$img.height(($img.attr('height') || '40') + 'px');
// Ensure the image placeholder is visible width-wise
if (!$img.width())
$img.width(($img.attr('width') || '80') + 'px');
// TODO: Add a hover-button to show just one image
});
});
} }
...@@ -76,7 +76,6 @@ RedactorPlugins.draft = { ...@@ -76,7 +76,6 @@ RedactorPlugins.draft = {
var self = this; var self = this;
getConfig().then(function(c) { getConfig().then(function(c) {
console.log(c);
if (c.allow_attachments) { if (c.allow_attachments) {
self.opts.clipboardUploadUrl = self.opts.clipboardUploadUrl =
self.opts.imageUpload = self.opts.imageUpload =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment