class Pman extends HTML_FlexyFramework_Page
{
var $appName= "";
+ var $appLogo= "";
var $appShortName= "";
var $appVersion = "1.8";
var $version = 'dev';
// echo'<PRE>';print_R($boot);exit;
$this->appName= $boot->appName;
$this->appNameShort= $boot->appNameShort;
+
+
$this->appModules= $boot->enable;
$this->isDev = empty($boot->Pman['isDev']) ? false : $boot->Pman['isDev'];
$this->appDisable = $boot->disable;
$this->isDev = true;
}
+
+
+
}
function get($base)
HTML_FlexyFramework::get()->generateDataobjectsCache($this->isDev);
//header('Content-type: application/xhtml+xml; charset=utf-8');
+
+
+
+ if ($this->company->logo_id) {
+ $im = DB_DataObject::Factory('Images');
+ $im->get($this->company->logo_id);
+ $this->appLogo = $this->baseURL . '/Images/Thumb/400x100/'. $this->company->logo_id .'/' . $im->filename;
+ }
+
header('Content-type: text/html; charset=utf-8');
}
{
$this->company = DB_DataObject::Factory('Companies');
- if ($this->company) { // non-core pman projects
- return;
+ if (!is_a($this->company, 'DB_DataObject')) { // non-core pman projects
+ return false;
}
$this->company->get('comptype', 'OWNER');
-
+ return $this->company;
}
*/
function jerrAuth()
{
+ $au = $this->authUser();
+ if ($au) {
+ // is it an authfailure?
+ $this->jerr("Permission denied to view this resource", array('authFailure' => true));
+ }
$this->jerr("Not authenticated", array('authFailure' => true));
}
*/
function moduleJavascriptFilesInfo($mod)
{
+
+ static $cache = array();
+
+ if (isset($cache[$mod])) {
+ return $cache[$mod];
+ }
+
+
$ff = HTML_FlexyFramework::get();
$base = dirname($_SERVER['SCRIPT_FILENAME']);
$tmtime = file_exists($this->rootDir.'/_translations_/'. $smod.'.js')
? filemtime($this->rootDir.'/_translations_/'. $smod.'.js') : 0;
- return (object) array(
- 'smod' => $smod,
- 'files' => $files,
- 'filesmtime' => $arfiles,
- 'maxtime' => $maxtime,
- 'compile' => $compile,
+ $cache[$mod] = (object) array(
+ 'smod' => $smod, // module name without '/'
+ 'files' => $files, // list of all files.
+ 'filesmtime' => $arfiles, // map of mtime=>file
+ 'maxtime' => $maxtime, // max mtime
+ 'compile' => $this->isDev ? false : $compile,
'translation_file' => $base .'/_translations_/' . $smod . '.js',
- 'translation_mtime' => $tmtime,
- 'output' => $output,
- 'translation_data' => preg_replace('/\.js$/', '.__translation__.js', $output),
- 'translation_base' => dirname($dir) . '/',
- 'basedir' => $basedir,
- 'baseurl' => $baseurl,
+ 'translation_mtime' => $tmtime,
+ 'output' => $output,
+ 'translation_data' => preg_replace('/\.js$/', '.__translation__.js', $output),
+ 'translation_base' => $dir .'/', //prefix of filename (without moudle name))
+ 'basedir' => $basedir,
+ 'baseurl' => $baseurl,
+ 'module_dir' => $dir,
);
+ return $cache[$mod];
}
-
-
-
+
/**
* moduleJavascriptList: list the javascript files in a module
}
$info = $this->moduleJavascriptFilesInfo($mod);
- print_R($info);
+
if (empty($info->files)) {
// suggestions...
// public_cache_dir = /var/www/myproject_cache
// public_cache_url = /myproject_cache (with Alias apache /myproject_cache/ /var/www/myproject_cache/)
-
-
+
+ // bit of debugging
+ if (!$info->compile) {
+ echo "<!-- Javascript compile turned off (isDev on, or public_cache_dir not set) -->\n";
+ return $info->files;
+ }
// where are we going to write all of this..
// This has to be done via a
- if ( $info->compile && !file_exists($info->basedir.'/'.$info->output)) {
+ if (!file_exists($info->basedir.'/'.$info->output)) {
require_once 'Pman/Core/JsCompile.php';
$x = new Pman_Core_JsCompile();
$x->pack($info->filesmtime,$info->basedir.'/'.$info->output, $info->translation_base);
}
- if ($info->compile && file_exists($info->basedir.'/'.$info->output) && filesize($info->basedir.'/'.$info->output)) {
+ if (file_exists($info->basedir.'/'.$info->output) &&
+ filesize($info->basedir.'/'.$info->output)) {
+
$ret =array(
$info->baseurl.'/'. $info->output,
// give up and output original files...
- return $files;
+ return $info->files;
}
*
* @param {String} action - group/name of event
* @param {DataObject|false} obj - dataobject action occured on.
- * @param {String} any remarks
+ * @param {String} any remarks
+ * @return {false|DB_DataObject} Event object.,
*/
function addEventOnce($act, $obj = false, $remarks = '')
{
- $au = $this->getAuthUser();
+
$e = DB_DataObject::factory('Events');
$e->init($act,$obj,$remarks);
if ($e->find(true)) {
- return;
+ return false;
}
return $this->addEvent($act, $obj, $remarks);
}
* @param {String} action - group/name of event
* @param {DataObject|false} obj - dataobject action occured on.
* @param {String} any remarks
- * @return {Number} Event id.,
+ * @return {DB_DataObject} Event object.,
*/
function addEvent($act, $obj = false, $remarks = '')
{
$au = $this->getAuthUser();
+
$e = DB_DataObject::factory('Events');
$e->init($act,$obj,$remarks);
$e->event_when = date('Y-m-d H:i:s');
$eid = $e->insert();
+
+ $wa = DB_DataObject::factory('core_watch');
+ $wa->notifyEvent($e); // trigger any actions..
+
+
$ff = HTML_FlexyFramework::get();
if (empty($ff->Pman['event_log_dir'])) {
- return $eid;
+ return $e;
}
$file = $ff->Pman['event_log_dir']. date('/Y/m/d/'). $eid . ".php";
if (!file_exists(dirname($file))) {
'GET' => empty($_GET) ? array() : $_GET,
'POST' => empty($_POST) ? array() : $_POST,
), true));
-
- return $eid;
+
+ return $e;
}
// ------------------ DEPERCIATED ---