1
0

ExternalShareMenuAction.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\AppFramework\Http\Template;
  7. use OCP\Util;
  8. /**
  9. * Class LinkMenuAction
  10. *
  11. * @since 14.0.0
  12. */
  13. class ExternalShareMenuAction extends SimpleMenuAction {
  14. /** @var string */
  15. private $owner;
  16. /** @var string */
  17. private $displayname;
  18. /** @var string */
  19. private $shareName;
  20. /**
  21. * ExternalShareMenuAction constructor.
  22. *
  23. * @param string $label
  24. * @param string $icon
  25. * @param string $owner
  26. * @param string $displayname
  27. * @param string $shareName
  28. * @since 14.0.0
  29. */
  30. public function __construct(string $label, string $icon, string $owner, string $displayname, string $shareName) {
  31. parent::__construct('save', $label, $icon);
  32. $this->owner = $owner;
  33. $this->displayname = $displayname;
  34. $this->shareName = $shareName;
  35. }
  36. /**
  37. * @since 14.0.0
  38. */
  39. public function render(): string {
  40. return '<li>' .
  41. ' <button id="save-external-share" class="icon ' . Util::sanitizeHTML($this->getIcon()) . '" data-protected="false" data-owner-display-name="' . Util::sanitizeHTML($this->displayname) . '" data-owner="' . Util::sanitizeHTML($this->owner) . '" data-name="' . Util::sanitizeHTML($this->shareName) . '">' . Util::sanitizeHTML($this->getLabel()) . '</button>' .
  42. '</li>' .
  43. '<li id="external-share-menu-item" class="hidden">' .
  44. ' <span class="menuitem">' .
  45. ' <form class="save-form" action="#">' .
  46. ' <input type="text" id="remote_address" placeholder="user@yourNextcloud.org">' .
  47. ' <input type="submit" value=" " id="save-button-confirm" class="icon-confirm" disabled="disabled"></button>' .
  48. ' </form>' .
  49. ' </span>' .
  50. '</li>';
  51. }
  52. }