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

Commit

Permalink
Add scssphp and remove smart optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Oct 6, 2014
1 parent 6d6e43e commit d309d81
Show file tree
Hide file tree
Showing 35 changed files with 5,824 additions and 843 deletions.
26 changes: 10 additions & 16 deletions .htaccess
Expand Up @@ -2,21 +2,15 @@

Options -Indexes

<IfModule deflate_module>
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

<IfModule php_module>
php_flag magic_quotes_gpc off
php_flag register_globals off
php_flag short_open_tag on
</IfModule>

<IfModule rewrite_module>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} ^(.*/)?(core|(modules|privateModules)/.*)/public/.*$ [OR]
RewriteCond %{REQUEST_FILENAME} ^(.*/)?library/SwaggerUI/.*$ [OR]
RewriteCond %{REQUEST_FILENAME} ^(.*/)?favicon.ico$
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ index.php [NC,L]
</IfModule>
1 change: 0 additions & 1 deletion core/AppController.php
Expand Up @@ -60,7 +60,6 @@ public function preDispatch()

$this->view->title = Zend_Registry::get('configGlobal')->application->name;
$this->view->metaDescription = Zend_Registry::get('configGlobal')->application->description;
$this->view->metaKeywords = Zend_Registry::get('configGlobal')->application->keywords;

// Set the version
$this->view->version = '3.2.8';
Expand Down
36 changes: 36 additions & 0 deletions core/Bootstrap.php
Expand Up @@ -186,6 +186,42 @@ protected function _initFrontModules()
}
}

/** Initialize the SASS compiler */
protected function _initSass()
{
$this->bootstrap('Config');
$config = Zend_Registry::get('configGlobal');
if($config->environment == 'development')
{
$directory = new RecursiveDirectoryIterator(BASE_PATH);
$iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
$regex = new RegexIterator($iterator, '#(?:core|(?:modules|privateModules)/.*)/public/scss/(?!mixins).*\.scss$#', RegexIterator::GET_MATCH);
$scssPaths = array();
foreach($regex as $scssPath)
{
$scssPaths = array_merge($scssPaths, $scssPath);
}
require 'scssphp/scss.inc.php';
$scssc = new Leafo\ScssPhp\Compiler();
$scssc ->setFormatter('Leafo\ScssPhp\Formatter\Compressed');
foreach($scssPaths as $scssPath)
{
$cssPath = preg_replace('#((?:core|(?:modules|privateModules)/.*)/public)/scss/(.*)\.scss$#', '\1/css/\2.css', $scssPath);
if(!file_exists($cssPath) || filemtime($cssPath) < filemtime($scssPath))
{
$cssDirectoryName = pathinfo($cssPath, PATHINFO_DIRNAME);
if(!file_exists($cssDirectoryName))
{
mkdir($cssDirectoryName, 0755, true);
}
$scss = file_get_contents($scssPath);
$css = $scssc->compile($scss).PHP_EOL;
file_put_contents($cssPath, $css);
}
}
}
}

/** init routes */
protected function _initRouter()
{
Expand Down
4 changes: 0 additions & 4 deletions core/configs/application.ini
Expand Up @@ -5,12 +5,8 @@ environment = production
application.name = Midas Platform - Digital Archiving System
; description of the application
application.description =
; keywords of the application
application.keywords = upload, manage, share
; language of the application (en or fr)
application.lang = en
; optimize JS and CSS
smartoptimizer = 0
; session lifetime (minute)
session.lifetime = 20
; path to md5sum
Expand Down
4 changes: 0 additions & 4 deletions core/controllers/AdminController.php
Expand Up @@ -94,10 +94,8 @@ function indexAction()
$formArray = $this->getFormAsArray($configForm);
$formArray['description']->setValue($config->global->application->description);
$formArray['environment']->setValue($config->global->environment);
$formArray['keywords']->setValue($config->global->application->keywords);
$formArray['lang']->setValue($config->global->application->lang);
$formArray['name']->setValue($config->global->application->name);
$formArray['smartoptimizer']->setValue($config->global->smartoptimizer);
$formArray['timezone']->setValue($config->global->default->timezone);
$formArray['smtpserver']->setValue($config->global->smtpserver);
$formArray['smtpuser']->setValue($config->global->smtpuser);
Expand Down Expand Up @@ -152,10 +150,8 @@ function indexAction()
{
$config->global->application->name = $this->getParam('name');
$config->global->application->description = $this->getParam('description');
$config->global->application->keywords = $this->getParam('keywords');
$config->global->application->lang = $this->getParam('lang');
$config->global->environment = $this->getParam('environment');
$config->global->smartoptimizer = $this->getParam('smartoptimizer');
$config->global->default->timezone = $this->getParam('timezone');
$config->global->defaultlicense = $this->getParam('licenseSelect');
$config->global->dynamichelp = $this->getParam('dynamichelp');
Expand Down
4 changes: 0 additions & 4 deletions core/controllers/InstallController.php
Expand Up @@ -244,10 +244,8 @@ function step3Action()
$formArray = $this->getFormAsArray($form);
$formArray['description']->setValue($config->global->application->description);
$formArray['environment']->setValue($config->global->environment);
$formArray['keywords']->setValue($config->global->application->keywords);
$formArray['lang']->setValue($config->global->application->lang);
$formArray['name']->setValue($config->global->application->name);
$formArray['smartoptimizer']->setValue($config->global->smartoptimizer);
$formArray['timezone']->setValue($config->global->default->timezone);
$this->view->form = $formArray;
$this->view->databaseType = Zend_Registry::get('configDatabase')->database->adapter;
Expand All @@ -266,13 +264,11 @@ function step3Action()
}

$config->global->application->description = $form->getValue('description');
$config->global->application->keywords = $form->getValue('keywords');
$config->global->application->lang = $form->getValue('lang');
$config->global->application->name = $form->getValue('name');
$config->global->default->timezone = $form->getValue('timezone');
$config->global->defaultassetstore->id = $assetstores[0]->getKey();
$config->global->environment = $form->getValue('environment');
$config->global->smartoptimizer = $form->getValue('smartoptimizer');

$writer = new Zend_Config_Writer_Ini();
$writer->setConfig($config);
Expand Down
3 changes: 1 addition & 2 deletions core/controllers/components/ApisystemComponent.php
Expand Up @@ -79,8 +79,7 @@ public function info($args)
{
$appFields = Zend_Registry::get('configGlobal')->application;
$serverFields = array('name' => $appFields->name,
'description' => $appFields->description,
'keywords' => $appFields->keywords);
'description' => $appFields->description);
return array_merge($this->version($args),
$serverFields,
$this->modulesList($args),
Expand Down
1 change: 0 additions & 1 deletion core/controllers/components/DemoComponent.php
Expand Up @@ -87,7 +87,6 @@ public function reset()
$description = 'Midas Platform integrates multimedia server technology with Kitware\'s open-source data analysis and';
$description .= ' visualization clients. The server follows open standards for data storage, access and harvesting';
$config->global->application->description = $description;
$config->global->application->keywords = 'demonstration, data management, visualization';

$enabledModules = array('visualize', 'oai', 'metadataextractor', 'api', 'scheduler', 'thumbnailcreator', 'statistics');
foreach($enabledModules as $module)
Expand Down
7 changes: 2 additions & 5 deletions core/controllers/forms/AdminForm.php
Expand Up @@ -36,8 +36,6 @@ public function createConfigForm()

$description = new Zend_Form_Element_Textarea('description');

$keywords = new Zend_Form_Element_Textarea('keywords');

$timezone = new Zend_Form_Element_Select('timezone');
$timezone->addMultiOptions(array(
'America/Anchorage' => 'America/Anchorage',
Expand All @@ -60,7 +58,6 @@ public function createConfigForm()
$name->setRequired(true)
->addValidator('NotEmpty', true);

$smartoptimizer = new Zend_Form_Element_Checkbox('smartoptimizer');
$dynamichelp = new Zend_Form_Element_Checkbox('dynamichelp');
$gravatar = new Zend_Form_Element_Checkbox('gravatar');
$closeRegistration = new Zend_Form_Element_Checkbox('closeregistration');
Expand All @@ -78,8 +75,8 @@ public function createConfigForm()
$submit ->setLabel('Save configuration');

$form->addElements(
array($dynamichelp, $keywords, $description, $timezone, $environment, $gravatar,
$lang, $name, $smartoptimizer, $closeRegistration, $submit, $logtrace, $httpProxy,
array($dynamichelp, $description, $timezone, $environment, $gravatar,
$lang, $name, $closeRegistration, $submit, $logtrace, $httpProxy,
$smtpServer, $smtpUser, $smtpPassword, $smtpFromAddress, $verifyEmail));
return $form;
}
Expand Down
7 changes: 1 addition & 6 deletions core/controllers/forms/InstallForm.php
Expand Up @@ -121,19 +121,14 @@ public function createConfigForm()

$description = new Zend_Form_Element_Textarea('description');

$keywords = new Zend_Form_Element_Textarea('keywords');

$name = new Zend_Form_Element_Text('name');
$name->setRequired(true)
->addValidator('NotEmpty', true);

$smartoptimizer = new Zend_Form_Element_Checkbox("smartoptimizer");
$smartoptimizer->setChecked(true);

$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Create configuration');

$form->addElements(array($keywords, $description, $process, $timezone, $environment, $lang, $name, $smartoptimizer, $submit));
$form->addElements(array($description, $process, $timezone, $environment, $lang, $name, $submit));
return $form;
}
}
65 changes: 12 additions & 53 deletions core/layouts/empty.phtml
Expand Up @@ -17,52 +17,27 @@
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/

echo $this->doctype()
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo $this->title ?></title>

<meta name="description" content="<?php echo htmlentities($this->metaDescription)?>" />
<meta name="keywords" content="<?php echo htmlentities($this->metaKeywords)?>" />
<meta name="robots" content="index, follow, all" />
<noscript>
<meta http-equiv="refresh" content="1; URL=<?php echo $this->webroot?>/index/nojs">
</noscript>

<!--[if lte IE 6]>
<meta http-equiv="refresh" content="1; URL=<?php echo $this->webroot?>/index/nobrowser">
<![endif]-->

<!-- Import CSS -->
<link rel="shortcut icon" href="<?php echo $this->coreWebroot ?>/public/images/icons/favicon.ico" />
<link rel="icon" href="<?php echo $this->coreWebroot ?>/public/images/icons/favicon.ico" />
<?php
if(Zend_Registry::get("configGlobal")->smartoptimizer == 1)
{
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/view.css,'.
'midas.empty.css,'.
'jquery-ui.css,'.
'form.css,'.
'loginForm.css,'.
'jquery.treeTable.css,'.
'jquery.qtip.min.css" />';
}
else
{
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/midas.empty.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/view.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/jquery-ui.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/form.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/loginForm.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/jquery.treeTable.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/jquery.qtip.min.css" />';
}
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/midas.empty.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/view.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/jquery-ui.min.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/form.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/loginForm.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/jquery.treeTable.css" />';
echo '<link type="text/css" rel="stylesheet" href="'.$this->coreWebroot.'/public/css/layout/jquery.qtip.min.css" />';

echo $this->headLink();
echo $this->headStyle();
?>

<?php echo $this->headLink(); // import the css ?>
<?php echo $this->headStyle(); // import the css ?>

</head>
<body>
<div class="MainDialog" style="display:none;">
Expand All @@ -86,21 +61,6 @@ echo $this->doctype()
</div>

<?php
if(Zend_Registry::get('configGlobal')->smartoptimizer == 1)
{
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/layout/jquery.js,'.
'jquery-ui.js,'.
'midas.common.js,'.
'midas.empty.js,'.
'midas.callback.js,'.
'midas.dialog.js,'.
'midas.progress.js,'.
'midas.notice.js,'.
'jquery.treeTable.js,'.
'jquery.qtip.min.js"></script>';
}
else
{
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/layout/jquery.js"></script>';
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/layout/jquery-ui.js"></script>';
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/layout/midas.common.js"></script>';
Expand All @@ -111,7 +71,6 @@ echo $this->doctype()
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/layout/midas.progress.js"></script>';
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/layout/jquery.treeTable.js"></script>';
echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/layout/jquery.qtip.min.js"></script>';
}
?>
<?php echo $this->headScript() ?>
<input type="hidden" class="webroot" value="<?php echo $this->webroot ?>" />
Expand Down

0 comments on commit d309d81

Please sign in to comment.