You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.5 KiB

  1. <?php $this->layout('layout-loggedin', ['title' => $title, 'accounts' => $accounts, 'user' => $user]); ?>
  2. <div class="ui main text container" style="margin-top: 80px;">
  3. <div class="ui top attached tabular menu">
  4. <a class="item active" data-tab="send-from-source">Find Links</a>
  5. <a class="item" data-tab="send-source-target">Send Webmention</a>
  6. </div>
  7. <div class="ui bottom attached tab segment active" data-tab="send-from-source">
  8. <form action="/dashboard/send" method="get" class="ui form">
  9. <div class="ui fluid action input">
  10. <input type="url" name="url" placeholder="http://example.com/">
  11. <button class="ui button">Find Links</button>
  12. </div>
  13. <input type="hidden" name="account" value="<?= $site->id ?>">
  14. </form>
  15. <div style="padding: 6px;">Enter a URL above to preview and send webmentions from all the links found on the page.</div>
  16. </div>
  17. <div class="ui bottom attached tab segment" data-tab="send-source-target">
  18. <form class="ui form" id="send-webmention-form">
  19. <div class="two fields">
  20. <div class="field"><label>Source URL</label><input type="url" placeholder="Source URL" id="send-source"></div>
  21. <div class="field"><label>Target URL</label><input type="url" placeholder="Target URL" id="send-target"></div>
  22. </div>
  23. <div class="ui error message"></div>
  24. <button class="ui button right floated" id="send-webmention-btn">Send Webmention</button>
  25. <div style="clear:both;"></div>
  26. </form>
  27. </div>
  28. <table class="ui striped single line table">
  29. <thead>
  30. <th>Status</th>
  31. <th>Date</th>
  32. <th>Source &amp; Target</th>
  33. </thead>
  34. <tbody>
  35. <?php foreach($webmentions as $mention): ?>
  36. <tr<?= $mention['status'] == 'pending' ? ' class="warning"' : '' ?>>
  37. <td>
  38. <div class="popup" data-content="<?= $mention['status'] ?>">
  39. <a href="/webmention/<?= $mention['webmention']->token ?>/details">
  40. <i class="circular inverted <?= $mention['icon'] ?> icon"></i>
  41. </a>
  42. </div>
  43. </td>
  44. <td>
  45. <a href="/webmention/<?= $mention['webmention']->token ?>/details">
  46. <?= date('M j, g:ia', strtotime($mention['webmention']->created_at)) ?>
  47. </a>
  48. </td>
  49. <td>
  50. source=<a href="<?= $this->e($mention['webmention']->source) ?>"><?= $this->e($mention['webmention']->source) ?></a><br>
  51. target=<a href="<?= $this->e($mention['webmention']->source) ?>"><?= $this->e($mention['webmention']->target) ?></a>
  52. </td>
  53. </tr>
  54. <?php endforeach; ?>
  55. </tbody>
  56. </table>
  57. </div>
  58. <script>
  59. $(function(){
  60. var token = "<?= $role->token ?>";
  61. $(".tabular.menu .item").tab();
  62. $(".popup").popup();
  63. $("#send-webmention-btn").click(function(){
  64. $("#send-webmention-btn").addClass("loading");
  65. $("#send-webmention-form").removeClass("error");
  66. // Send the request to the API now, and then redirect to the status page
  67. $.ajax({
  68. url: "/webmention",
  69. method: "POST",
  70. data: {
  71. token: token,
  72. source: $("#send-source").val(),
  73. target: $("#send-target").val()
  74. },
  75. success: function(data){
  76. $("#send-webmention-btn").removeClass("loading");
  77. window.location = data.location+"/details";
  78. },
  79. error: function(data){
  80. $("#send-webmention-btn").removeClass("loading");
  81. $("#send-webmention-form").addClass("error");
  82. $("#send-webmention-form .error.message").text(data.responseJSON.error_description);
  83. }
  84. });
  85. return false;
  86. });
  87. });
  88. </script>