Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 99e9c07

Browse files
author
Charles Ma
committed
ENH: fixed bug #225 Demo mode will now use modules
ENH: Added qtip library. Remove jgrowl library BUG: fixed bug #229 (dashboard was misspelled BUG: fixed bug #227 Ldap Error ENH: Scheduler: Added tasks list in the configuration page ENH: Scheduler: Added job logs
1 parent eb11429 commit 99e9c07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+557
-967
lines changed

core/controllers/AdminController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ function init()
2626
$config = Zend_Registry::get('configGlobal'); //set admin part to english
2727
$config->application->lang = 'en';
2828
Zend_Registry::get('configGlobal', $config);
29+
if($this->isDemoMode())
30+
{
31+
$this->disableView();
32+
$this->render('unavailable');
33+
}
2934
}
3035

3136
/** reset Demo*/

core/controllers/UserController.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,14 @@ function loginAction()
174174
$previousUri = $this->_getParam('previousuri');
175175
if($form->isValid($this->getRequest()->getPost()))
176176
{
177-
$notifications = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_AUTHENTIFICATION", array('email' => $form->getValue('email'), 'password' => $form->getValue('password')));
177+
try
178+
{
179+
$notifications = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_AUTHENTIFICATION", array('email' => $form->getValue('email'), 'password' => $form->getValue('password')));
180+
}
181+
catch (Zend_Exception $exc)
182+
{
183+
$this->getLogger()->crit($exc->getMessage());
184+
}
178185

179186
if(!empty($notifications['ldap']) && $notifications['ldap'] != false)
180187
{
@@ -188,9 +195,8 @@ function loginAction()
188195
}
189196

190197
$passwordPrefix = Zend_Registry::get('configGlobal')->password->prefix;
191-
if($authLdap || $userDao != false && md5($passwordPrefix.$form->getValue('password')) == $userDao->getPassword())
192-
{
193-
198+
if($authLdap || $userDao !== false && md5($passwordPrefix.$form->getValue('password')) == $userDao->getPassword())
199+
{
194200
$remember = $form->getValue('remerberMe');
195201
if(isset($remember) && $remember == 1)
196202
{
@@ -280,9 +286,16 @@ public function validentryAction()
280286
{
281287
echo 'false';
282288
return;
289+
}
290+
291+
try
292+
{
293+
$notifications = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_AUTHENTIFICATION", array('email' => $entry, 'password' => $password));
294+
}
295+
catch (Zend_Exception $exc)
296+
{
297+
$this->getLogger()->crit($exc->getMessage());
283298
}
284-
285-
$notifications = Zend_Registry::get('notifier')->callback("CALLBACK_CORE_AUTHENTIFICATION", array('email' => $entry, 'password' => $password));
286299
if(!empty($notifications['ldap']) && $notifications['ldap'] != false)
287300
{
288301
echo "true";

core/controllers/components/DemoComponent.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,24 @@ public function reset()
7373
$applicationConfig = parse_ini_file(BASE_PATH.'/core/configs/application.ini', true);
7474
$applicationConfig['global']['defaultassetstore.id'] = $assetstoreDao->getKey();
7575
$applicationConfig['global']['demomode'] = true;
76-
77-
if(file_exists(BASE_PATH.'/core/configs/visualize.demo.local.ini'))
76+
$applicationConfig['global']['environment'] = 'development';
77+
$applicationConfig['global']['application.name'] = 'MIDAS - Demo';
78+
$applicationConfig['global']['application.description'] = '';
79+
$applicationConfig['global']['application.keywords'] = '';
80+
81+
$enabledModules = array('visualize', 'oai', 'metadataextractor', 'api', 'scheduler', 'thumbnailcreator');
82+
83+
foreach($enabledModules as $module)
7884
{
79-
copy(BASE_PATH.'/core/configs/visualize.demo.local.ini', BASE_PATH.'/core/configs/visualize.local.ini');
80-
$applicationConfig['module']['visualize'] = true;
85+
if(file_exists(BASE_PATH.'/core/configs/'.$module.'.demo.local.ini'))
86+
{
87+
copy(BASE_PATH.'/core/configs/'.$module.'.demo.local.ini', BASE_PATH.'/core/configs/'.$module.'.local.ini');
88+
$applicationConfig['module'][$module] = true;
89+
}
90+
else
91+
{
92+
unlink(BASE_PATH.'/core/configs/'.$module.'.local.ini');
93+
}
8194
}
8295

8396
require_once BASE_PATH.'/core/controllers/components/UtilityComponent.php';

core/layouts/layout.phtml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,17 @@ echo $this->doctype()
3333
<?php
3434
if (Zend_Registry::get("configGlobal")->smartoptimizer == 1)
3535
{
36-
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/main.css,view.css,jquery-ui.css,form.css,loginForm.css,jquery.treeTable.css,jquery.cluetip.css,jquery.jgrowl.css" />';
36+
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/main.css,view.css,jquery-ui.css,form.css,loginForm.css,jquery.treeTable.css,jquery.qtip.min.css" />';
3737
}
3838
else
3939
{
4040
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/main.css" />';
41-
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/jquery.cluetip.css" />';
4241
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/view.css" />';
4342
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/jquery-ui.css" />';
4443
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/form.css" />';
4544
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/loginForm.css" />';
4645
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/jquery.treeTable.css" />';
47-
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/jquery.jgrowl.css" />';
46+
echo '<link type="text/css" rel="stylesheet" href="' . $this->coreWebroot . '/public/css/layout/jquery.qtip.min.css" />';
4847
}
4948
?>
5049
<!--[if IE]>
@@ -206,7 +205,7 @@ echo $this->doctype()
206205
}
207206
if($this->highNumberError)
208207
{
209-
echo '<span style="color:red;">More than 5 errors occured in the last 24 hours. <a href="'.$this->webroot.'/admin/#ui-tabs-2">Check the logs</a></span><br/><br/>';
208+
echo '<span style="color:red;">More than 5 errors occured in the last 24 hours. <a href="'.$this->webroot.'/admin/#ui-tabs-3">Check the logs</a></span><br/><br/>';
210209
}
211210
?>
212211
<div class="SubWrapper">
@@ -240,7 +239,7 @@ echo $this->doctype()
240239
{
241240
if(is_array($item))
242241
{
243-
echo "<li onclick=\"location.replace('{$this->webroot}/item/{$item['item_id']}');\" class='recentItem' title='". str_replace("'", '"', $item['name'])."'><a href='{$this->webroot}/item/{$item['item_id']}'>".$this->slicename($item['name'],20)."</a></li>";
242+
echo "<li onclick=\"location.replace('{$this->webroot}/item/{$item['item_id']}');\" class='recentItem' qtip='". str_replace("'", '"', $item['name'])."'><a href='{$this->webroot}/item/{$item['item_id']}'>".$this->slicename($item['name'],20)."</a></li>";
244243
}
245244
}
246245
echo '</ul>';
@@ -276,16 +275,15 @@ echo $this->doctype()
276275
<?php
277276
if (Zend_Registry::get("configGlobal")->smartoptimizer == 1)
278277
{
279-
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery.js,jquery-ui.js,main.js,jquery.treeTable.js,jquery.cluetip.js,jquery.jgrowl.js"></script>';
278+
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery.js,jquery-ui.js,main.js,jquery.treeTable.js,jquery.qtip.min.js"></script>';
280279
}
281280
else
282281
{
283282
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery.js"></script>';
284-
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery.cluetip.js"></script>';
285283
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery-ui.js"></script>';
286284
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/main.js"></script>';
287285
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery.treeTable.js"></script>';
288-
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery.jgrowl.js"></script>';
286+
echo '<script type="text/javascript" src="' . $this->coreWebroot . '/public/js/layout/jquery.qtip.min.js"></script>';
289287
}
290288
?>
291289
<?php echo $this->headScript() ?>

core/models/MIDASDatabasePdo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getValue($var, $key, $dao)
8585
require_once BASE_PATH . '/core/models/ModelLoader.php';
8686
$this->ModelLoader = new MIDAS_ModelLoader();
8787
$module = '';
88-
if(isset($this->_mainData[$var]['module']) && $this->_mainData[$var]['module'] == 'core')
88+
if(isset($this->_mainData[$var]['module']) && $this->_mainData[$var]['module'] != 'core')
8989
{
9090
$module = $this->_mainData[$var]['module'];
9191
}

core/models/MIDASModel.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function initialize()
4747
public function save($dao)
4848
{
4949
$instance = $this->_name."Dao";
50+
if(isset($this->_daoName) && isset($this->moduleName))
51+
{
52+
$instance = ucfirst($this->moduleName).'_'.$this->_daoName;
53+
}
5054
if(!$dao instanceof $instance)
5155
{
5256
throw new Zend_Exception("Should be an object (".$instance.").");
@@ -227,6 +231,11 @@ public function findBy($var, $value)
227231
}
228232
else
229233
{
234+
$module = '';
235+
if(isset($this->moduleName) )
236+
{
237+
$module = $this->moduleName;
238+
}
230239
$rowset = $this->database->findBy($var, $value);
231240
$return = array();
232241
foreach($rowset as $row)
@@ -236,7 +245,7 @@ public function findBy($var, $value)
236245
{
237246
$daoName = substr($this->_daoName, 0, strlen($this->_daoName)-3);
238247
}
239-
$tmpDao = $this->initDao($daoName, $row);
248+
$tmpDao = $this->initDao($daoName, $row, $module);
240249
$return[] = $tmpDao;
241250
unset($tmpDao);
242251
}
File renamed without changes.

core/public/css/layout/jquery.jgrowl.css

Lines changed: 0 additions & 135 deletions
This file was deleted.

0 commit comments

Comments
 (0)