page.sheet.report.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. User::check_access('issue','read');
  3. require_once(__DIR__.SLASH.'IssueReport.class.php');
  4. require_once(__DIR__.SLASH.'IssueReportTag.class.php');
  5. $tags = IssueReportTag::tags();
  6. $issuereport = IssueReport::provide();
  7. if(!isset($issuereport->id)) throw new Exception("Impossible d'accéder à un rapport vierge");
  8. $state = IssueReport::states($issuereport->state);
  9. $osIcon = $browserIcon = 'fas fa-question-circle';
  10. if(strlen($issuereport->os)>=3 && substr(strtolower($issuereport->os),0,3) == 'win') $osIcon = 'fab fa-windows text-primary';
  11. if(strlen($issuereport->os)>=5 && substr(strtolower($issuereport->os),0,5) == 'linux') $osIcon = 'fab fa-linux text-danger';
  12. if(strlen($issuereport->os)>=3 && substr(strtolower($issuereport->os),0,3) == 'mac') $osIcon = 'fab fa-apple text-secondary';
  13. switch($issuereport->browser){
  14. case 'firefox': $browserIcon = 'fab fa-firefox text-warning'; break;
  15. case 'ie': $browserIcon = 'fab fa-internet-explorer text-danger'; break;
  16. case 'edge': $browserIcon = 'fab fa-edge text-primary'; break;
  17. case 'chrome': $browserIcon = 'fab fa-chrome text-success'; break;
  18. }
  19. $issueTags = array();
  20. foreach(IssueReportTag::loadAll(array('report'=>$issuereport->id)) as $tag):
  21. $issueTags[] = $tag->tag;
  22. endforeach;
  23. ?>
  24. <div class="issue <?php echo !$myUser->can('issue','edit')?'readonly':''; ?>">
  25. <div id="issuereport-form" class="row issuereport-form justify-content-md-center" data-action="issue_issuereport_save" data-id="<?php echo $issuereport->id; ?>">
  26. <div class="col-md-10">
  27. <div class="row">
  28. <div class="col-md-9 p-3">
  29. <h2 class="d-inline-block mb-0">Ticket #<?php echo $issuereport->id; ?></h2>
  30. </div>
  31. <div class="col-md-3 p-3">
  32. <a href="index.php?module=issue&page=list.issue" class="btn btn-light w-100"><i class="fas fa-reply"></i> Revenir aux tickets</a>
  33. </div>
  34. </div>
  35. <div class="row">
  36. <!-- events -->
  37. <div class="col-md-9 issue-event-bar">
  38. <ul class="issue-events">
  39. <li class="issue-event issue-comment hidden {{classes}}" id="issue-comment-{{id}}" data-id="{{id}}">
  40. <div class="comment-header">
  41. <img class="avatar-medium avatar-rounded" src="{{avatar}}">
  42. <div class="header-infos">
  43. <span class="d-inline-block font-weight-bold"> {{fullName}}</span> <br>
  44. <small class="text-muted">{{createdRelative}}</small>
  45. </div>
  46. <ul class="only-editable right">
  47. <li class="text-muted edit-issue-comment" onclick='issue_issue_event_edit(this);' title="Éditer le commentaire"><i class="fas fa-pencil-alt"></i></li>
  48. <li class="text-danger delete-issue-comment" onclick='issue_issue_event_delete(this);' title="Supprimer le commentaire"><i class="far fa-trash-alt"></i></li>
  49. </ul>
  50. </div>
  51. <div class="comment-message">
  52. {{{comment}}}
  53. </div>
  54. {{#hasfiles}}
  55. <div class="comment-attachments">
  56. <h5 class="text-uppercase">Pièces jointes : </h5>
  57. <div class="attachments">
  58. {{#files}}
  59. <a href="{{url}}" class="comment-attachment attachment-{{type}}" target="_blank">
  60. <img class="attachment-image-view" src="{{url}}">
  61. <div class="attachment-file-view"><i class="{{icon}}"></i> <h6 title="{{label}}">{{labelExcerpt}}</h6></div>
  62. </a>
  63. {{/files}}
  64. </div>
  65. </div>
  66. {{/hasfiles}}
  67. </li>
  68. <li class="issue-event issue-state hidden" data-id="{{id}}">
  69. <img class="avatar-mini avatar-rounded" src="{{avatar}}"> <span class="d-inline-block font-weight-bold"> {{fullName}}</span>
  70. <i> a changé l'état du ticket </i>
  71. <i> de </i><span class="badge badge-secondary" style="background: {{oldstate.color}}"><i class="{{oldstate.icon}}"></i> {{oldstate.label}}</span>
  72. <i> en </i><span class="badge badge-secondary" style="background: {{state.color}}"><i class="{{state.icon}}"></i> {{state.label}}</span>
  73. <small class="text-muted"> - {{createdRelative}}</small>
  74. </li>
  75. <li class="issue-event issue-assignation hidden" data-id="{{id}}">
  76. <img class="avatar-mini avatar-rounded" src="{{avatar}}"> <span class="d-inline-block font-weight-bold"> {{fullName}}</span>
  77. <i> a assigné le ticket à </i><img class="avatar-mini avatar-rounded" src="{{assigned.avatar}}"> <span class="d-inline-block font-weight-bold"> {{assigned.fullName}}</span>
  78. <small class="text-muted"> - {{createdRelative}}</small>
  79. </li>
  80. <li class="issue-event issue-tag hidden" data-id="{{id}}">
  81. <img class="avatar-mini avatar-rounded" src="{{avatar}}"> <span class="d-inline-block font-weight-bold"> {{fullName}}</span>
  82. <i> a {{action}} le tag </i><span class="badge badge-secondary ml-1" style="background: {{tag.color}}"><i class="{{tag.icon}}"></i> {{tag.label}}</span>
  83. <small class="text-muted"> - {{createdRelative}}</small>
  84. </li>
  85. </ul>
  86. <div id="issue-event-form" class="issue-event-form pb-0" data-action="issue_issue_event_save" data-id="">
  87. <div class="post-header">
  88. <div onclick="issue_issue_event_save(this);" class="btn btn-primary right"><i class="far fa-paper-plane"></i> Envoyer</div>
  89. <img class="avatar-mini avatar-rounded mr-1" src="<?php echo $myUser->getAvatar(); ?>">
  90. <span class="font-weight-bold"> <?php echo $myUser->fullName(); ?></span>
  91. <small class="text-muted"><?php echo date('d/m/y - H:i'); ?></small>
  92. <div class="clear"></div>
  93. </div>
  94. <hr>
  95. <textarea id="content" data-type="wysiwyg" data-mention-user="true" data-mention-object='issue_autocomplete' name="content" class="mt-2 mb-0" placeholder="Répondre au sujet..."></textarea>
  96. <!--<div class="mt-1" data-type="dropzone" data-preview data-delete="" data-allowed="" data-label="Ajouter fichiers, images..." ></div>-->
  97. </div>
  98. </div>
  99. <!-- sidebar -->
  100. <div class="col-md-3 issue-sidebar">
  101. <h5 class="text-muted text-uppercase">Tags :</h5>
  102. <input type="text" data-tags='<?php echo json_encode($tags); ?>' value="<?php echo implode(',',$issueTags); ?>" class="issue-modal-tags no-select" data-type="tagcloud" id="tags" onchange="issue_issuereport_meta_save()">
  103. <hr>
  104. <select class="w-100" data-type="dropdown-select" id="reportState" onchange="issue_issuereport_meta_save()">
  105. <?php foreach(IssueReport::states() as $slug=>$state): ?>
  106. <option <?php echo $slug==$issuereport->state ? 'selected="selected"': ''; ?> value="<?php echo $slug; ?>" style="background-color:<?php echo $state['color']; ?>;color:#ffffff;" data-icon="<?php echo $state['icon']; ?>"><?php echo $state['label']; ?></option>
  107. <?php endforeach; ?>
  108. </select>
  109. <hr>
  110. <h5 class="text-muted text-uppercase">Assignation :</h5>
  111. <input type="text" class="form-control" data-type="user" id="assign" value="<?php echo $issuereport->assign; ?>" onchange="issue_issuereport_meta_save()">
  112. <hr>
  113. <h5 class="text-muted text-uppercase">Suivi par :</h5>
  114. <ul class="issue-followers">
  115. <?php foreach($issuereport->followers() as $login):
  116. if(empty($login)) continue;
  117. $user = User::byLogin($login);
  118. ?>
  119. <li data-user="<?php echo $user->login; ?>" title="<?php echo !empty($user->fullName()) ? $user->fullName() : $user->login; ?>"><img class="avatar avatar-mini avatar-rounded d-inline-block" src="<?php echo $user->getAvatar(); ?>" title="<?php echo $user->fullName(); ?>"></li>
  120. <?php endforeach; ?>
  121. </ul>
  122. <div onclick="issue_follow_toggle(this)" class="btn btn-light w-100 btn-following mt-2 <?php echo in_array($myUser->login, $issuereport->followers()) ? 'followed' : '' ?>">
  123. <i class="far"></i> <span></span>
  124. </div>
  125. <hr/>
  126. <h5 class="text-muted text-uppercase">Environnement :</h5>
  127. <ul class="list-group">
  128. <li class="list-group-item">
  129. <i class="far fa-file-code" title="Page"></i>
  130. <a href="<?php echo str_replace(ROOT_URL,'',$issuereport->from); ?>" title="Accéder à la page" class="text-break"><?php echo str_replace(ROOT_URL,'',$issuereport->from); ?></a><br>
  131. </li>
  132. <li class="list-group-item">
  133. <i class="<?php echo $browserIcon; ?>" title="Navigateur"></i>
  134. <strong><?php echo $issuereport->browser; ?></strong><br>
  135. <small class="text-muted"><?php echo $issuereport->browserVersion; ?></small>
  136. </li>
  137. <li class="list-group-item">
  138. <i class="<?php echo $osIcon; ?>" title="Os"></i>
  139. <strong><?php echo $issuereport->os; ?></strong>
  140. </li>
  141. <li class="list-group-item">
  142. <i class="fas fa-tv" title="Écran"></i>
  143. <strong><?php echo $issuereport->width; ?>px * <?php echo $issuereport->height; ?>px</strong>
  144. </li>
  145. <li class="list-group-item">IP :
  146. <strong><?php echo $issuereport->ip; ?></strong>
  147. </li>
  148. </ul>
  149. <?php
  150. $histories = json_decode($issuereport->history,true);
  151. if($histories!=false):
  152. ?>
  153. <hr>
  154. <h5 class="text-muted pointer text-uppercase" title="Déplier/plier" onclick="$(this).next('.list-group').toggleClass('hidden')"><i class="fas fa-chevron-right"></i> 5 Actions AJAX :</h5>
  155. <ul class="list-group hidden">
  156. <?php foreach ($histories as $history):
  157. preg_match("/(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/i", $history['time'], $matches);
  158. $date = isset($matches[1]) ? date("d/m/Y", strtotime($matches[1])) : '-';
  159. ?>
  160. <li class="list-group-item">
  161. <small class="text-muted"><?php echo $date.' - '.(isset($matches[2])? $matches[2]: '-'); ?></small><br>
  162. <pre><?php print_r($history['request']); ?></pre>
  163. </li>
  164. <?php endforeach; ?>
  165. </ul>
  166. <?php endif; ?>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div><br>