project.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. // Expecting the context to be a project or nothing at all
  3. global $context;
  4. $ctx = $context;
  5. ($ctx?$ctx->permission('read'):Bugs::permission('project.read')&&Bugs::permission('project.create')) or trigger_error('You are not allowed to view this project');
  6. $update = $ctx?$ctx->permission('update'):Bugs::permission('project.create');
  7. $delete = $ctx?$ctx->permission('delete'):Bugs::permission('project.delete');
  8. ?>
  9. <!doctype html>
  10. <head>
  11. <meta charset="utf8"/>
  12. <title>Project <?=($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/project.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-project" 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>User:</label>
  51. <a href="<?=Router::url(Router::$base.'/~'.($ctx?$ctx->user->name:null))?>">
  52. <?=($ctx?$ctx->user->name:null)?>
  53. </a>
  54. </div>
  55. <div>
  56. <label>Date Registered:</label>
  57. <time datetime="<?=date('c',($ctx?$ctx->date_created:null));?>"><?=date('Y-m-d',($ctx?$ctx->date_created:null));?></time>
  58. </div>
  59. <div>
  60. <label>Date Modified:</label>
  61. <time datetime="<?=date('c',($ctx?$ctx->date_modified:null));?>"><?=date('Y-m-d',($ctx?$ctx->date_modified:null));?></time>
  62. </div>
  63. <input type="hidden" name="id" value="<?=($ctx?$ctx->id:null)?>"/>
  64. <?php
  65. }
  66. if($update){
  67. ?>
  68. <input type="submit" value="<?=$ctx?'Update':'Create'?>"/>
  69. <?php
  70. }
  71. ?>
  72. </form>
  73. <?php
  74. if($ctx){
  75. echo Bugs::template('subs/issues')
  76. ->run($ctx);
  77. }
  78. ?>
  79. </body>
  80. </html>