page.sheet.report.php 10 KB

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