issue.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. // Expecting the context to be a issue or nothing at all
  3. global $context;
  4. $ctx = $context;
  5. ($ctx?$ctx->permission('read'):Bugs::permission('issue.read')) or trigger_error('You are not allowed to view this issue');
  6. $update = $ctx?$ctx->permission('update'):Bugs::permission('issue.create');
  7. $delete = $ctx?$ctx->permission('delete'):Bugs::permission('issue.delete');
  8. ?>
  9. <!doctype html>
  10. <head>
  11. <meta charset="utf8"/>
  12. <title>Issue <?=($ctx?$ctx->name:null);?></title>
  13. <script src="<?=Router::url(Router::$base)?>/js/juju/core.js"></script>
  14. <script src="<?=Router::url(Router::$base)?>/js/juju/page.js"></script>
  15. <script src="<?=Router::url(Router::$base)?>/js/juju/dom.js"></script>
  16. <script src="<?=Router::url(Router::$base)?>/js/juju/keyboard.js"></script>
  17. <script src="<?=Router::url(Router::$base)?>/js/juju/mouse.js"></script>
  18. <script src="<?=Router::url(Router::$base)?>/js/issue.js"></script>
  19. <script>
  20. BASE_URL = '<?=Router::url(Router::$base)?>';
  21. </script>
  22. <link rel="stylesheet" href="<?=Router::url(Router::$base)?>/css/main.css"></link>
  23. </head>
  24. <body>
  25. <a href="<?=Router::url(Router::$base)?>">Home</a>
  26. <form id="form-issue" method="post">
  27. <div>
  28. <label for="name">Name:</label>
  29. <input value="<?=($ctx?$ctx->name:null);?>" <?=$update?'name="name"':'disabled="disabled"';?>/>
  30. </div>
  31. <div>
  32. <label for="description">Description:</label>
  33. <input type="description" value="<?=($ctx?$ctx->description:null);?>" <?=$update?'name="description"':'disabled="disabled"';?>/>
  34. </div>
  35. <?php
  36. if($ctx){
  37. ?>
  38. <div>
  39. <label>Status:</label>
  40. <?=
  41. Bugs::template("subs/dropdown")
  42. ->run(array(
  43. 'value'=> $ctx?$ctx->s_id:null,
  44. 'options'=> Bugs::options_statuses(),
  45. 'name'=> 'status'
  46. ))
  47. ?>
  48. </div>
  49. <div>
  50. <label>Priority:</label>
  51. <?=
  52. Bugs::template("subs/dropdown")
  53. ->run(array(
  54. 'value'=> $ctx?$ctx->pr_id:null,
  55. 'options'=> Bugs::options_priorities(),
  56. 'name'=> 'priority'
  57. ))
  58. ?>
  59. </div>
  60. <div>
  61. <label>User:</label>
  62. <a href="<?=Router::url(Router::$base.'/~'.($ctx?$ctx->user->name:null))?>">
  63. <?=$ctx?$ctx->user->name:null;?>
  64. </a>
  65. </div>
  66. <?php
  67. if($ctx->project){
  68. ?>
  69. <div>
  70. <label>Project:</label>
  71. <a href="<?=Router::url(Router::$base.'/project/'.($ctx?$ctx->project->name:null))?>">
  72. <?=($ctx?$ctx->project->name:null);?>
  73. </a>
  74. </div>
  75. <?php
  76. }
  77. ?>
  78. <div>
  79. <label>Date Registered:</label>
  80. <time datetime="<?=date('c',($ctx?$ctx->date_created:null));?>"><?=date('Y-m-d',($ctx?$ctx->date_created:null));?></time>
  81. </div>
  82. <div>
  83. <label>Date Modified:</label>
  84. <time datetime="<?=date('c',($ctx?$ctx->date_modified:null));?>"><?=date('Y-m-d',($ctx?$ctx->date_modified:null));?></time>
  85. </div>
  86. <input type="hidden" name="id" value="<?=($ctx?$ctx->id:null)?>"/>
  87. <?php
  88. }
  89. if($update){
  90. ?>
  91. <input type="submit" value="<?=$ctx?'Update':'Create'?>"/>
  92. <?php
  93. }
  94. ?>
  95. </form>
  96. </body>
  97. </html>