ExternalShareMenuAction.php 2.4 KB

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