发表文章

[PHP] 被 osTicket PR#3920 阻止 blocked by osTicket PR#3920[attachment_preview]

perryk 2017-10-9 53

此 osTicket PR 看起来与此插件不兼容: osTicket/osTicket#3920

我收到了一个 "未能加载 pdf 文档" 的错误 pdf 的和其他没有显示, 直到我恢复了这个公关。

欢呼.

原文:

This osTicket PR looks to be incompatible with this plugin: osTicket/osTicket#3920

I received a "failed to load pdf document" error on PDF's and others didn't display either until I reverted this PR.

Cheers.

相关推荐
最新评论 (14)
clonemeagain 2017-10-9
1

只要我们有 javascript, 我们可以做到这一点, 检查这个黑客:

var=newXMLHttpRequest();
req.open("GET","url-to-file"true)
req.responseType="arraybuffer";
req.onload=function(e){
	var=req.response;
	var=newBlob([ab], {type:"application/pdf"});
	var=URL.createObjectURL(blob);
	var=document.getElementsById('pdf-object-id');
        var=el.cloneNode();
        hack.setAttribute('data',url);
        hack.setAttribute('src',url);
        el.parentNode.replaceChild(hack,el);
};
req.send();

显然需要整理, 但它的工作。
我一直在进行升级与管理定义的最大内联附件, 这使用 ajax, 所以, 它不是一个拉伸, 以吸引和插入 blob。https://github.com/clonemeagain/attachment_preview/tree/feature/toggle-number-of-attachments

原文:

As long as we have javascript, we can do it, check this hack out:

var req = new XMLHttpRequest();
req.open("GET","url-to-file", true)
req.responseType = "arraybuffer";
req.onload = function(e){
	var ab = req.response;
	var blob = new Blob([ab], {type: "application/pdf"});
	var url = URL.createObjectURL(blob);
	var el = document.getElementsById('pdf-object-id');
        var hack = el.cloneNode();
        hack.setAttribute('data',url);
        hack.setAttribute('src',url);
        el.parentNode.replaceChild(hack,el);
};
req.send();

Obviously needs tidying, but it works.
I've been working on an upgrade with admin defined max-inlined attachments, which uses ajax, so, it's not a stretch to pull blobs and insert them.. https://github.com/clonemeagain/attachment_preview/tree/feature/toggle-number-of-attachments

perryk 2017-10-9
2

哦, 太好了, 我不会假装我完全理解它, 但我会检查出来, 并给它一个镜头。

不错的插件顺便说一下, 我认为它增加了一些天才的 osTicket 票的看法。

原文:

Oh great, I won't pretend I entirely understand it, but I'll check it out and give it a shot.

Nice plugin btw, I think it adds some flair to the osTicket ticket view.

clonemeagain 2017-10-9
3

基本上, ajax 可以进行二进制传输, 而对象 url 可以引用二进制数据的 Blob, 这样我们就可以像上面那样一起加入它们, 而不管配置如何。:-)
这可能解决了我所得到的 mime 问题。所以这是双倍的好。

原文:

Basically, ajax can make binary transfers, and object urls can refer to Blob's of binary data, so we can join those together like the above and it works regardless of the disposition. :-)
This likely fixes the mime issues I was getting as well. So it's double good.

perryk 2017-10-9
4

这是现在为我工作的 PDF 与您的最新提交和 osTicket PR#3920 应用, 谢谢。

也许我只是注意到它但是预览 youtube 链接的选项: "将 youtube/视频转换为播放器", 不起作用。 我可以看到它试图添加的框架的轮廓, 但是框架中没有内容。如果你愿意, 我可以发布一个截图。

我猜你可能知道这一点, 但是, 我只是测试的事情, 所以没有什么大不了的, 只是让你知道。

欢呼.

原文:

This is now working for me with PDF's with your latest commits and osTicket PR#3920 applied, thanks.

Perhaps I have only just noticed it however the option to preview youtube links: "Convert Youtube/video to Player", doesn't work. I can see an outline of a frame that it is trying to add, but there is no content inside the frame. I could post a screenshot if you wish.

I'm guessing you are likely aware of this, however, and I'm only testing out things so not a big deal, just letting you know.

Cheers.

clonemeagain 2017-10-9
5

哦其实不是我会尽快检查

原文:

Ooh, wasn't actually. I'll check it ASAP

clonemeagain 2017-10-9
6

我看不到错误伴侣, 你能告诉我你是如何发布的吗?也许我做的不一样

原文:

I can't see the error mate, can you share how you're posting them? Maybe I do it differently.

perryk 2017-10-9
7

我可以用一个 youtube url 在票上发电子邮件, 或者我可以从代理 web 界面创建一个新的票证, 并使用 "插入链接" 添加一个 url。 我无法将 url 直接复制并粘贴到文本区域, 因为减速器接管并将 url 转换为一些 html 嵌入的 youtube 剪辑代码。

下面是一些屏幕截图:

这里是 "转换 Youtube" 选项设置的门票视图。

screenshot from 2017-08-31 22-51-55

请注意, 这是一个薄蓝色框架, 这是玩家至少试图设置到位。

以下是关闭选项时的票证视图。
screenshot from 2017-08-31 22-53-56

我将加载一个实例, 只是股票 v1.10, 看看是否恢复这个功能, 我的安装有一堆不同的拉请求等现在。

原文:

I can either email in ticket with just a youtube url, or I can create a new ticket from the agent web interface and use "insert link" to add in a url. n.b I can't copy and paste the url directly into the text area as redactor takes over and converts the url to some html embedded youtube clip code.

Here are some screen shots:

Here is the ticket view when the option for "Convert Youtube" is set.

screenshot from 2017-08-31 22-51-55

note the thin blue frame which is where the player is at least trying to be set into place.

Here is the ticket view when the option is turned off.
screenshot from 2017-08-31 22-53-56

I'll load up an instance with just stock v1.10 and see if that restores this function, my install has a bunch of different pull requests etc in it now.

perryk 2017-10-9
8

嗯, 我仍然有同样的问题使用股票 v1.10, 我甚至试图回去一堆提交的插件。然而, 我在页面源中找到了这一点:

<div class="thread-body no-pjax">
        <div><a href="https://www.youtube.com/watch?v=Pjw2A3QU8Qg">https://www.youtube.com/watch?v=Pjw2A3QU8Qg</a><div class="embedded" style="max-width: 100%; height: auto; padding: 4px; border: 1px solid #C3D9FF; margin-top: 10px; margin-bottom: 10px !important;"><iframe width="560" height="349" src="http://www.youtube.com/embed/Pjw2A3QU8Qg?rel=0&amp;hd=1" frameborder="0" allowfullscreen="1"></iframe></div></div>
        <div class="clear"></div>
    </div>

当我回到这个插件的最新提交, 我发现一个更大的部分在页面源。

它以一些 css < 样式名 = "附件预览样式表" >, 然后包括一些 javascript < 脚本类型 = "文本/javascript" 名称 = "附件预览切换脚本" >, 最后与以下:

<div id="ap-file-1" class="embedded"><iframe width="560" height="349" src="http://www.youtube.com/embed/Pjw2A3QU8Qg?rel=0&amp;hd=1" frameborder="0" allowfullscreen="1" id="ap-file-1-c"></iframe></div></div>

所以也许插件工作正常, 它是我身边的东西?

我已经测试了一些不同的浏览器/os 组合虽然。

我确实在 httpd 错误日志中看到了这一点, 但它似乎没有提到问题:

AttachmentPreviewPlugin: pjax 操作中的前缀技巧., 引用: https://

还有什么地方可以阻止我对这些 iframe 的看法吗?

欢呼.

原文:

Hmm, I still have the same problem using stock v1.10 and I even tried going back a bunch of commits on the plugin. I found this in the page source however:

<div class="thread-body no-pjax">
        <div><a href="https://www.youtube.com/watch?v=Pjw2A3QU8Qg">https://www.youtube.com/watch?v=Pjw2A3QU8Qg</a><div class="embedded" style="max-width: 100%; height: auto; padding: 4px; border: 1px solid #C3D9FF; margin-top: 10px; margin-bottom: 10px !important;"><iframe width="560" height="349" src="http://www.youtube.com/embed/Pjw2A3QU8Qg?rel=0&amp;hd=1" frameborder="0" allowfullscreen="1"></iframe></div></div>
        <div class="clear"></div>
    </div>

When I go back to the latest commits on this plugin I find a much bigger section in the page source.

It starts with some css <style name="Attachments Preview Stylesheet">, then includes some javascript <script type="text/javascript" name="Attachments Preview Toggle Script"> and finally follows with:

<div id="ap-file-1" class="embedded"><iframe width="560" height="349" src="http://www.youtube.com/embed/Pjw2A3QU8Qg?rel=0&amp;hd=1" frameborder="0" allowfullscreen="1" id="ap-file-1-c"></iframe></div></div>

So perhaps the plugin is working ok and it is something on my side ?

I've tested with a few different browser/os combos though.

I do see this in the httpd error log but it doesn't seem to refer to a problem:

AttachmentPreviewPlugin: pjax prefix trick in operation.., referer: https://

Is there somewhere else I can check for what might be blocking my view of these iframes ?

Cheers.

clonemeagain 2017-10-9
9

如果我复制并粘贴你放在那里的 html, 进入一个裸的 html 文件, 打开它在浏览器中, 它的工作原理。插件也可以在我的服务器上工作。

所以。我真的没看到问题伴侣

screenshot_2017-09-01_10-09-21

你的电脑真的可以访问 youtube 吗?
您的浏览器/分机/AV 限制 iframe?
你使用的是特别有效的 "adblocker" 吗?

原文:

If I copy and paste the HTML you've put there, into a bare HTML file, open it in a browser, it works. The plugin also works on my prod server..

So.. I'm literally not seeing the problem mate.

screenshot_2017-09-01_10-09-21

Does your computer actually have access to youtube?
Is your browser/extensions/AV restricting iframes?
Are you using an "adblocker" that is being particularly efficient?

perryk 2017-10-9
10

好的, 我和你在一起, 认为你的代码工作正常, 这只是我的事情。我有一个公平的 vm 阵列我的测试, 但高兴地考虑到这一点, 原来的问题都关闭和确定。

如果将来还有其他人遇到这样的麻烦, 让我知道, 我会很乐意进一步测试。

谢谢你的帮助。

原文:

All good, I'm with you and think your code is working fine, it is just something on my end. I have a fair array of VMs I'm testing on but happy to consider this and the original issue all closed and ok.

Perhaps if anyone else encounters any trouble like this in the future, let me know and I'll be happy to test further.

Thanks for your help with this.

clonemeagain 2017-10-9
11
原文:
perryk 2017-10-9
12

啊哈, 我一个人离得不够远, 还在这上面找到了一些东西。

我禁用了 https 和 youtube 链接预览开始工作。

因此, 快速编辑到569行的类。AttachmentPreviewPlugin 使用 https 而不是 http 作为 iframe 的 src 属性, 当我的 osticket 安装被设置回使用 https 时, 这就启用了工作。

也许我的安装有点太多的启用 HSTS 也因此, 没有多少其他人可能会遇到这一点。

原文:

Aha, I couldn't leave well enough alone and have found something further on this.

I disabled https and the youtube link previews started working.

So a quick edit to line 569 of class.AttachmentPreviewPlugin.php to use https instead of http for the src attribute of the iframe and this enabled working when my osticket install was set back to using https only.

Maybe my install goes a little too far with enabling of HSTS also so not many other people would likely run into this.

clonemeagain 2017-10-9
13

我能支持你

原文:

I can get behind that.

perryk 2017-10-9
14

太棒了谢谢

原文:

Fantastic, thanks.

返回
发表文章
perryk
文章数
1
评论数
7
注册排名
60844