page.sheet.machine.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. global $_,$myUser;
  3. User::check_access('host','read');
  4. require_once(__DIR__.SLASH.'Machine.class.php');
  5. $machine = Machine::provide();
  6. if($machine->id==0){
  7. $machine->manager = $myUser->login;
  8. $machine->label = 'Nouvel hébergement';
  9. $machine->ram = 2;
  10. $machine->cpu = 2;
  11. $machine->ip = '10.172.20.';
  12. }
  13. ?>
  14. <div class="plugin-host">
  15. <div id="machine-form" class="row justify-content-md-center machine-form" data-action="host_machine_save" data-id="<?php echo $machine->id; ?>">
  16. <div class="col-md-12 shadow-sm bg-white p-3">
  17. <div class="row">
  18. <div class="col-md-12">
  19. <div class="left py-2 host-preloader hidden"><small class="text-muted"><i class="fas fa-circle-notch fa-spin"></i> Enregistrement</small></div>
  20. <div class="btn btn-small btn-info mb-2 btn-success right" onclick="window.location = 'action.php?action=host_machine_open_with&tool=winscp&id='+$('#machine-form').attr('data-id');"><i class="fas fa-external-link-alt"></i> WinSCP</div>
  21. <div class="btn btn-small btn-info mb-2 btn-dark mx-2 right" onclick="window.location = 'action.php?action=host_machine_open_with&tool=putty&id='+$('#machine-form').attr('data-id');"><i class="fas fa-external-link-alt"></i> Putty</div>
  22. <!-- on ne specifie pas d'ui, le composant prendra $.urlParam('id') par defaut -->
  23. <div class="btn btn-small btn-light mb-2 right noReadOnly no-embedded" data-type="right"
  24. data-scope = "host_sheet"><i class="fas fa-user-lock"></i> Permissions</div>
  25. <div class="btn btn-small btn-info mb-2 btn-dark mx-2 right no-embedded" data-scope="host_machine" data-uid="<?php echo $machine->id; ?>" data-show-important="true" data-type="history" data-tooltip title="Ouvrir l'historique de la vm"> <i class="far fa-comment-dots"></i></div>
  26. <div class="clear"></div>
  27. </div>
  28. </div>
  29. <div class="row mb-2">
  30. <div class="col-md-6 host-sheet">
  31. <?php
  32. global $myFirm;
  33. if($myFirm->has_plugin('fr.core.dynamicform')){
  34. Plugin::need('dynamicform/DynamicForm');
  35. echo Dynamicform::show('host-sheet',array(
  36. 'scope'=>'host',
  37. 'uid'=>$machine->id
  38. ));
  39. }
  40. ?>
  41. </div>
  42. </div>
  43. <div class="row">
  44. <div class="col-md-6">
  45. <div class="input-group input-group-sm">
  46. <div class="input-group-prepend"><div class="input-group-text">Type</div></div>
  47. <select class="form-control select-control form-control" type="text" id="type">
  48. <?php foreach(Machine::types() as $slug=>$item): ?>
  49. <option <?php echo $machine->type == $slug ? 'selected="selected"' : '' ?> value="<?php echo $slug ?>" ><?php echo $item['label']; ?></option>
  50. <?php endforeach; ?>
  51. </select>
  52. </div>
  53. </div>
  54. <div class="col-md-6">
  55. <div class="input-group input-group-sm">
  56. <div class="input-group-prepend"><div class="input-group-text">Responsable</div></div>
  57. <input value="<?php echo $machine->manager; ?>" class="form-control" type="text" data-type="user" id="manager" >
  58. </div>
  59. </div>
  60. </div>
  61. <div class="row">
  62. <div class="col-md-6">
  63. <div class="input-group input-group-sm mt-2">
  64. <div class="input-group-prepend"><div class="input-group-text">Libellé</div></div>
  65. <input value="<?php echo $machine->label; ?>" class="form-control" type="text" id="label" >
  66. </div>
  67. </div>
  68. <div class="col-md-6">
  69. <div class="p-2">
  70. <span class="text-muted">Créé le</span> <?php echo date('d/m/Y',$machine->created); ?> <span class="text-muted">par</span> <?php echo $machine->creator; ?>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="row">
  75. <div class="col-md-6">
  76. <div class="input-group input-group-sm mt-2">
  77. <div class="input-group-prepend"><div class="input-group-text">IP LAN</div></div>
  78. <input value="<?php echo $machine->ip; ?>" class="form-control" type="text" id="ip" >
  79. </div>
  80. </div>
  81. <div class="col-md-6">
  82. <div class="input-group input-group-sm mt-2">
  83. <div class="input-group-prepend"><div class="input-group-text">Os</div></div>
  84. <select class="form-control form-control-sm" type="text" data-type="dictionary" data-slug="host_machine_os" data-depth="1" key=data-disable-label data-value="<?php echo $machine->os; ?>" id="os" ></select>
  85. </div>
  86. </div>
  87. </div>
  88. <div class="row mb-3">
  89. <div class="col-md-4">
  90. <div class="input-group input-group-sm mt-2">
  91. <div class="input-group-prepend"><div class="input-group-text">MAC</div></div>
  92. <input value="<?php echo $machine->mac; ?>" class="form-control" type="text" id="mac" >
  93. </div>
  94. </div>
  95. <div class="col-md-4">
  96. <div class="input-group input-group-sm mt-2">
  97. <div class="input-group-prepend"><div class="input-group-text">RAM</div></div>
  98. <input value="<?php echo $machine->ram; ?>" class="form-control" type="number" id="ram" >
  99. </div>
  100. </div>
  101. <div class="col-md-4">
  102. <div class="input-group input-group-sm mt-2">
  103. <div class="input-group-prepend"><div class="input-group-text">Nb. CPU</div></div>
  104. <input value="<?php echo $machine->cpu; ?>" class="form-control" type="number" id="cpu" >
  105. </div>
  106. </div>
  107. </div>
  108. <div class="row bg-light machine-application-container">
  109. <div class="col-md-6">
  110. <?php require_once(__DIR__.SLASH.'page.list.machine.application.php'); ?>
  111. </div>
  112. <div class="col-md-6 host-application-container p-2">
  113. </div>
  114. </div>
  115. <h5>Commentaires</h5>
  116. <textarea class="pt-0" type="text" data-type="wysiwyg" data-simple id="comment"><?php echo $machine->comment; ?></textarea>
  117. </div>
  118. </div>
  119. </div>