SshPublicKeyDownloadModal.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /* * ********************************************************************
  3. * ProxmoxVPS Product developed. (27.03.19)
  4. * *
  5. *
  6. * CREATED BY MODULESGARDEN -> http://modulesgarden.com
  7. * CONTACT -> contact@modulesgarden.com
  8. *
  9. *
  10. * This software is furnished under a license and may be used and copied
  11. * only in accordance with the terms of such license and with the
  12. * inclusion of the above copyright notice. This software or any other
  13. * copies thereof may not be provided or otherwise made available to any
  14. * other person. No title to and ownership of the software is hereby
  15. * transferred.
  16. *
  17. *
  18. * ******************************************************************** */
  19. namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\ServiceInformation\Modals;
  20. use ModulesGarden\ProxmoxAddon\App\Services\UrlService;
  21. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Home\Buttons\RedirectButton;
  22. use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\ServiceInformation\Forms\SshPublicKeyDownloadForm;
  23. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\ClientArea;
  24. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Buttons\ModalActionButtons\BaseCancelButton;
  25. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Modals\BaseModal;
  26. /**
  27. * @deprecated
  28. */
  29. class SshPublicKeyDownloadModal extends BaseModal implements ClientArea
  30. {
  31. public function initContent()
  32. {
  33. $this->initIds('sshPublicKeyDownloadModal');
  34. $this->addForm(new SshPublicKeyDownloadForm());
  35. }
  36. protected function initActionButtons()
  37. {
  38. if (!empty($this->actionButtons))
  39. {
  40. return $this;
  41. }
  42. $vmId = \ModulesGarden\ProxmoxAddon\Core\Helper\sl('Vm')->getVmModel()->id;
  43. //URL
  44. $urlService = new UrlService();
  45. $rd = new RedirectButton("sshPrivateKeyDownloadButton");
  46. $rd->replaceClasses(['lu-btn lu-btn--success closeModal']);
  47. $rd->setHref($urlService->getUrl("sshKey", "sshPrivateKeyDownload",['vm'=> $vmId]));
  48. $rd->setIcon(null);
  49. $rd->setShowTitle();
  50. $rd->deleteHtmlAttribute('data-toggle');
  51. $rd->addHtmlAttribute('@click', 'closeModal($event)');
  52. $this->addActionButton($rd);
  53. $this->addActionButton(new BaseCancelButton());
  54. return $this;
  55. }
  56. }