ExternalShareMenuAction.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
  4. *
  5. * @author Daniel Calviño Sánchez <danxuliu@gmail.com>
  6. * @author John Molakvoæ <skjnldsv@protonmail.com>
  7. * @author Julius Härtl <jus@bitgrid.net>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\AppFramework\Http\Template;
  27. use OCP\Util;
  28. /**
  29. * Class LinkMenuAction
  30. *
  31. * @since 14.0.0
  32. */
  33. class ExternalShareMenuAction extends SimpleMenuAction {
  34. /** @var string */
  35. private $owner;
  36. /** @var string */
  37. private $displayname;
  38. /** @var string */
  39. private $shareName;
  40. /**
  41. * ExternalShareMenuAction constructor.
  42. *
  43. * @param string $label
  44. * @param string $icon
  45. * @param string $owner
  46. * @param string $displayname
  47. * @param string $shareName
  48. * @since 14.0.0
  49. */
  50. public function __construct(string $label, string $icon, string $owner, string $displayname, string $shareName) {
  51. parent::__construct('save', $label, $icon);
  52. $this->owner = $owner;
  53. $this->displayname = $displayname;
  54. $this->shareName = $shareName;
  55. }
  56. /**
  57. * @since 14.0.0
  58. */
  59. public function render(): string {
  60. return '<li>' .
  61. ' <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>' .
  62. '</li>' .
  63. '<li id="external-share-menu-item" class="hidden">' .
  64. ' <span class="menuitem">' .
  65. ' <form class="save-form" action="#">' .
  66. ' <input type="text" id="remote_address" placeholder="user@yourNextcloud.org">' .
  67. ' <input type="submit" value=" " id="save-button-confirm" class="icon-confirm" disabled="disabled"></button>' .
  68. ' </form>' .
  69. ' </span>' .
  70. '</li>';
  71. }
  72. }