1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
4 require_once 'MTrackWeb.php';
7 class MTrackWeb_Milestone extends MTrackWeb
14 var $tid = 0; // or the MD5 rep.
20 if (!isset($_REQUEST['ajax_body'])) {
23 $this->masterTemplate = 'milestone.html';
24 $this->id = $pi ? $pi: (isset($_GET['id']) ? $_GET['id'] : 0);
25 $this->id = (int) $this->id;
27 if (empty($this->id)) { // new!!
30 $m = DB_DataObject::factory('mtrack_milestone');
31 if (!$m->get($this->id) || $m->project_id != $this->currentProject()) {
32 $this->jerr("invalid milestone id");
35 $this->milestone = $m;
40 $m = DB_DataObject::factory('mtrack_milestone');
42 if (!$m->get($pi) || $m->project_id != $this->currentProject()) {
43 $this->jerr("invalid milestone id");
49 // alwasy for force this..
50 $m->project_id = $this->currentProject();
52 // before we insert / update... - check perms..
55 // - we probably need finer grained control here..
56 // - we are piggy backing of issue permission at present..
58 if (!$m->id && !$this->hasPerm('MTrack.Issue','A')) {
59 $this->jerr('Permission denied = no rights to create milestones', array('noperm' => true));
60 //return HTML_FlexyFramework::run('Noperm');
64 if ($m->id && !$this->hasPerm('MTrack.Issue','E') ) {
65 $this->jerr('Permission denied = no rights to edit milestones', array('noperm' => true));
66 return HTML_FlexyFramework::run('Noperm');