SshPublicKeyDownloadModal.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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\ProxmoxVps\App\UI\ServiceInformation\Modals;
  20. use ModulesGarden\ProxmoxAddon\App\Services\Vps\ProductService;
  21. use ModulesGarden\ProxmoxAddon\App\Services\Vps\UrlService;
  22. use ModulesGarden\Servers\ProxmoxVps\App\UI\Home\Buttons\RedirectButton;
  23. use ModulesGarden\Servers\ProxmoxVps\App\UI\ServiceInformation\Forms\SshPublicKeyDownloadForm;
  24. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\ClientArea;
  25. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Traits\WhmcsParams;
  26. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Buttons\ModalActionButtons\BaseCancelButton;
  27. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Modals\BaseModal;
  28. class SshPublicKeyDownloadModal extends BaseModal implements ClientArea
  29. {
  30. use WhmcsParams;
  31. use ProductService;
  32. public function initContent()
  33. {
  34. $this->initIds('sshPublicKeyDownloadModal');
  35. $this->addForm(new SshPublicKeyDownloadForm());
  36. }
  37. protected function initActionButtons()
  38. {
  39. if (!empty($this->actionButtons))
  40. {
  41. return $this;
  42. }
  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("home", "sshPrivateKeyDownload"));
  48. $rd->setIcon(null);
  49. $rd->setShowTitle();
  50. if($this->configuration()->isSshDeletePrivateKey()){
  51. $rd->addClass("sshPrivateKeyDownloadButton");
  52. }
  53. $rd->deleteHtmlAttribute('data-toggle');
  54. $rd->addHtmlAttribute('@click', 'closeModal($event)');
  55. $this->addActionButton($rd);
  56. $this->addActionButton(new BaseCancelButton());
  57. return $this;
  58. }
  59. }