1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
5 * This is alot simpler now...
7 * In our horrifically simple version...
9 * We could just use a database, and go from there.
10 * ... that looses the diff feature... although we can use the mtrack_change stuff....
12 * ... That sounds alot better in our context as we can show data on the changelog..
13 * -----> It will mean that the change log will have to honour our privacy settings..
16 * oK - uses new mtrack_wiki table..
21 require_once 'MTrack/Attachment.php';
22 require_once 'MTrackWeb.php';
24 class MTrackWeb_Wiki extends MTrackWeb
29 var $hasHistory = false;
33 return parent::getAuth();
38 // non 'json' request...
39 if (!isset($_REQUEST['ajax_body'])) {
40 $this->title = "Browse: " . $pi;
44 DB_DataObject::debugLevel(1);
45 $p = DB_DataObject::Factory('Mtrack_wiki');
46 $p->project_id = $this->currentProject();
50 // we add stuff on the end..
52 $px = DB_DataObject::Factory('Mtrack_wiki');
53 $px->project_id = $this->currentProject();
56 $pr = DB_DataObject::factory('Projects');
57 $pr->get($px->project_id);
59 $ar = $px->fetchAll('path');
60 $wikidata = "## Index of pages in Wiki - {$pr->name} \n\n";
62 $wikidata .= " * [$pp](wiki:$pp)\n";
64 $p->wikidata = $wikidata;
65 $this->jdata($p->toArray());
73 if (!$p->find(true)) {
75 $this->jdata($p->toArray());
77 $this->jdata($p->toArray());
79 //echo '<PRE>';print_r($this);echo '</PRE>';
83 function returnNotFound($p) {
94 $au = $this->getAuthUser();
97 $this->jerr("permission denied");
100 $p = DB_DataObject::factory('mtrack_wiki');
101 $p->project_id = $this->currentProject();
103 $id = empty($_REQUEST['id']) ? 0 : $_REQUEST['id'] * 1;
104 if (!empty($id) && !$p->get($id)) {
106 $this->jerr('invalid id');
111 if ($o->project_id != $p->project_id) {
112 $this->jerr("changing project id not permitted");
115 // check change of path...
116 if (!$o->id || ($o->path != $p->path)) {
117 $c = DB_DataObject::factory('mtrack_wiki');
118 $c->project_id = $p->project_id;
121 $this->jerr("Path is not valid - that path already exists");
126 call_user_func(array($p, $o->id ? 'update' : 'insert'), $o);
128 $this->jok($p->toArray());