if (!$project_id) {
return false;
}
- $p = DB_DataObject::factory('Projects');
+ $p = DB_DataObject::factory('core_project');
$p->get($project_id);
if (!$this->authUser) {
if ($p->code != '*PUBLIC') {
return true;
}
+ /**
+ * currentProject:
+ *
+ * @param {int} $val set the current project (optional)
+ * @return {int} The current project id.
+ *
+ *
+ *
+ */
function currentProject($val = false)
$_SESSION[__CLASS__] = array();
}
+ if (isset($_SESSION[__CLASS__]['active_project_id'])) {
+ $currentProject = $_SESSION[__CLASS__]['active_project_id'];
+ }
+
if ($val !== false) {
// attempt to set it..
$_SESSION[__CLASS__]['active_project_id'] = $val ;
- $currentProject = false;
+ $currentProject = $val ;
// reset to ensure not cached..
}
+
+
+
+
$ar = $this->userProjects();
+
if (!isset($ar[$currentProject])) {
$currentProject = false;
$_SESSION[__CLASS__]['active_project_id'] = false;
}
if ($currentProject !== false) {
+ // var_dump($currentProject);
return $currentProject;
}
-
-
//print_r($ar);
- if (empty($_SESSION[__CLASS__]['active_project_id']) ||
- !isset($ar[$_SESSION[__CLASS__]['active_project_id']]))
- {
+ if (empty($currentProject)) {
- //$p = DB_DataObject::factory('Projects');
+ //$p = DB_DataObject::factory('core_project');
//$p->get('code', '*PUBLIC');
$id = 0;
foreach($ar as $k=>$v) {
$currentProject = $_SESSION[__CLASS__]['active_project_id'];
return $id; // always allowed..
}
+ //var_dump($currentProject);
$currentProject = $_SESSION[__CLASS__]['active_project_id'];
return $_SESSION[__CLASS__]['active_project_id'];
function userProjects()
{
- $p = DB_DataObject::factory('Projects');
+ $p = DB_DataObject::factory('core_project');
if (!$this->authUser) {
$p->code = '*PUBLIC';
$ar = $p->fetchAll('id', 'name');
} else {
- //DB_DAtaObject::debugLevel(1);
- $p->applyFilters(array(), $this->authUser);
+
+ // DB_DAtaObject::debugLevel(1);
+ $p->applyFilters(array(), $this->authUser, $this);
if (!$this->authUser->hasPerm('Core.Projects_All', 'S')) {
$p->whereAdd("Projects.id in (SELECT ProjectDirectory.project_id FROM ProjectDirectory WHERE
person_id = ". $this->authUser->id . " and role != '')");
}
+ /*
+ * SOME PROJECTS MIGHT NOT HAVE REPO's...
$p->whereAdd('id in (SELECT distinct(project_id) FROM mtrack_repos)');
+ */
// $pd->whereAdd("role != ''");
- $p->orderBy('Projects.name ASC');
+ $p->orderBy('core_project.name ASC');
unset($p->client_id); // default projects serach enforces this..
$ar = $p->fetchAll('id', 'name');
}
function getAuthUser()
{
- $u = DB_DataObject::factory('Person');
+ $u = DB_DataObject::factory('core_person');
if (!$u->isAuth()) {
return false;
}
//MTrackConfig::boot(); // eak.. .remove me...
- $this->authUser = DB_DataObject::factory('Person')->getAuthUser();
+ $this->authUser = DB_DataObject::factory('core_person')->getAuthUser();
$this->loadProjectList();
+
+ $p = DB_DataObject::factory('core_project');
+ $p->get($this->currentProject());
+ $this->currentProject = $p; /// mix up?
+
+
+
if (!$this->authUser) {
return true; // we do allow people in this far..
}
+ // very public??
$this->authUserArray = $this->authUser->toArray();
unset($this->authUserArray['passwd']);
date_default_timezone_set($this->authUser->timezone);
}
-
-
+
/// fixme...
//$this->authUser =
function get($loc='')
{
//
+
+
+ HTML_FlexyFramework::get()->generateDataobjectsCache();
+
+
if (!empty($loc)) {
die ("invalid location". htmlspecialchars($loc));
}
+
+
+
if (!$this->authUser) {
return HTML_FlexyFramework::run('Wiki');
}
+
+
+
return HTML_FlexyFramework::run('Wiki/Today');
}
function post()
{
header("Status: 404 Not Found");
- die("not valid");
+ die("invalid post request? ");
}
function registerClasses()
{
- require_once 'MTrack/Wiki.php';
- require_once 'MTrack/Wiki/Item.php';
- // require_once 'MTrack/Milestone.php';
-
-
+ // wiki rendering is done client side...
+ // require_once 'MTrack/Wiki/HTMLFormatter.php';
require_once 'MTrackWeb/LinkHandler.php';
- require_once 'MTrack/Wiki/HTMLFormatter.php';
-
$this->link = new MTrackWeb_LinkHandler();
- MTrack_Wiki_HTMLFormatter::registerLinkHandler($this->link);
+ //MTrack_Wiki_HTMLFormatter::registerLinkHandler($this->link);
-
- $r = DB_DataObject::factory('mtrack_repos');
- $r->loadFromPath('default/wiki');
- MTrack_Wiki_Item::$repo = $r->impl();
-
-
-
- //MTrack_Wiki::register_macro('MilestoneSummary', array('MTrack_Milestone', 'macro_MilestoneSummary'));
- // MTrack_Wiki::register_macro('BurnDown', array('MTrack_Milestone', 'macro_BurnDown'));
- //MTrack_Wiki::register_macro('RunReport', array('MTrack_Report', 'macro_RunReport')); << fixme how are we to hanlde this..
- //MTrack_Wiki::register_macro('TicketQuery', array('MTrack_Report', 'macro_TicketQuery'));
- MTrack_Wiki::register_macro('IncludeWikiPage', array('MTrack_Wiki', 'macro_IncludeWiki'));
- MTrack_Wiki::register_macro('IncludeHelpPage', array('MTrack_Wiki', 'macro_IncludeHelp'));
- MTrack_Wiki::register_macro('Comment', array('MTrack_Wiki', 'macro_comment'));
- MTrack_Wiki::register_processor('comment', array('MTrack_Wiki', 'processor_comment'));
- MTrack_Wiki::register_processor('html', array('MTrack_Wiki', 'processor_html'));
- MTrack_Wiki::register_processor('dataset', array('MTrack_Wiki', 'processor_dataset'));
-
+ return;
- //MTrackSearchDB::register_indexer('ticket', array('MTrackIssue', 'index_issue'));
- //MTrackSearchDB::register_indexer('wiki', array('MTrack_Wiki_Item', 'index_item'));
-
-
-
- //MTrackWatch::registerEventTypes('ticket', array( 'ticket' => 'Tickets' ));
- //MTrackWatch::registerEventTypes('milestone', array( 'ticket' => 'Tickets', 'changeset' => 'Code changes' ));
- //MTrackWatch::registerEventTypes('repo', array( 'ticket' => 'Tickets', 'changeset' => 'Code changes' ));
-
- // should this get registered here??
- //MTrackCommitChecker::addCheck('Wiki');
-
-
-
}
function favicon()
}
+ function packJS($dir)
+ {
+
+ // target has to be 'aliased'
+ // target filename can be an md5..
+
+ require_once 'Pman/Core/JsCompile.php';
+ $x = new Pman_Core_JsCompile();
+ $x->packScript(dirname(__FILE__).'/MTrackWeb/templates/images',
+ array($dir),
+ $this->rootURL . '/MTrackWeb/templates/images',
+ false // do not compile
+ );
+ //);
+
+
+ }