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

Commit a13f8e8

Browse files
author
Charles Marion
committed
0009637: Improve meta tag generation
1 parent e51eb7c commit a13f8e8

File tree

18 files changed

+105
-18
lines changed

18 files changed

+105
-18
lines changed

core/AppController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public function preDispatch()
2828
$this->view->coreWebroot = $this->coreWebroot;
2929

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

3234
// init notifier
3335
Zend_Registry::set('notifier', new MIDAS_Notifier());
@@ -228,7 +230,7 @@ public function postDispatch()
228230
parent::postDispatch();
229231
$this->view->json = JsonComponent::encode($this->view->json);
230232
$this->view->generatedTimer = round((microtime(true) - START_TIME), 3);
231-
if(Zend_Registry::get('config')->mode->test != 1)
233+
if(Zend_Registry::get('config')->environment != 'testing')
232234
{
233235
header('Content-Type: text/html; charset=ISO-8859-1');
234236
}

core/Bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected function _initConfig()
9797
'datetime' => 'timestamp',
9898
'module' => 'module');
9999
$writerDb = new Zend_Log_Writer_Db($db, 'errorlog', $columnMapping);
100-
if($config->error->php == 1)
100+
if($config->environment == 'production')
101101
{
102102
$formatter = new Zend_Log_Formatter_Simple();
103103
Zend_Loader_Autoloader::getInstance()->suppressNotFoundWarnings(false);

core/configs/application.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
environment=development
44
;name of the application
55
application.name=MIDAS - Digital Archiving System
6+
;description of the application
7+
application.description=
8+
;keywords of the application
9+
application.keywords=upload, manage, share
610
;language of the application (en or fr)
711
application.lang=en
812
;Optimize JS and CSS

core/controllers/AdminController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ function indexAction()
3737
$formArray = $this->getFormAsArray($configForm);
3838

3939
$formArray['name']->setValue($applicationConfig['global']['application.name']);
40+
$formArray['keywords']->setValue($applicationConfig['global']['application.keywords']);
41+
$formArray['description']->setValue($applicationConfig['global']['application.description']);
4042
$formArray['environment']->setValue($applicationConfig['global']['environment']);
4143
$formArray['lang']->setValue($applicationConfig['global']['application.lang']);
4244
$formArray['smartoptimizer']->setValue($applicationConfig['global']['smartoptimizer']);
@@ -61,6 +63,8 @@ function indexAction()
6163
}
6264
rename(BASE_PATH.'/core/configs/application.local.ini', BASE_PATH.'/core/configs/application.local.ini.old');
6365
$applicationConfig['global']['application.name'] = $this->_getParam('name');
66+
$applicationConfig['global']['application.description'] = $this->_getParam('description');
67+
$applicationConfig['global']['application.keywords'] = $this->_getParam('keywords');
6468
$applicationConfig['global']['application.lang'] = $this->_getParam('lang');
6569
$applicationConfig['global']['environment'] = $this->_getParam('environment');
6670
$applicationConfig['global']['smartoptimizer'] = $this->_getParam('smartoptimizer');

core/controllers/CommunityController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ function viewAction()
283283
{
284284
$this->view->shareItems = $this->Item->getSharedToCommunity($communityDao);
285285
}
286+
287+
$this->view->title .= ' - '.$communityDao->getName();
288+
$this->view->metaDescription = substr($communityDao->getDescription(), 0, 160);
286289
}//end view
287290

288291
/** Delete a community*/

core/controllers/FolderController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ public function viewAction()
128128

129129
$this->view->isModerator = $this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE);
130130
$this->view->isAdmin = $this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN);
131+
132+
$this->view->title .= ' - '.$folder->getName();
133+
$this->view->metaDescription = substr($folder->getDescription(), 0, 160);
131134
}// end View Action
132135

133136

core/controllers/InstallController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
/**
43
* InstallController
54
*/
@@ -234,8 +233,10 @@ function step3Action()
234233
$form = $this->Form->Install->createConfigForm();
235234
$formArray = $this->getFormAsArray($form);
236235
$formArray['name']->setValue($applicationConfig['global']['application.name']);
236+
$formArray['keywords']->setValue($applicationConfig['global']['application.keywords']);
237237
$formArray['environment']->setValue($applicationConfig['global']['environment']);
238238
$formArray['lang']->setValue($applicationConfig['global']['application.lang']);
239+
$formArray['description']->setValue($applicationConfig['global']['application.description']);
239240
$formArray['smartoptimizer']->setValue($applicationConfig['global']['smartoptimizer']);
240241
$formArray['timezone']->setValue($applicationConfig['global']['default.timezone']);
241242
$formArray['process']->setValue($applicationConfig['global']['processing']);
@@ -256,6 +257,8 @@ function step3Action()
256257
}
257258
}
258259
$applicationConfig['global']['application.name'] = $form->getValue('name');
260+
$applicationConfig['global']['application.description'] = $form->getValue('description');
261+
$applicationConfig['global']['application.keywords'] = $form->getValue('keywords');
259262
$applicationConfig['global']['application.lang'] = $form->getValue('lang');
260263
$applicationConfig['global']['environment'] = $form->getValue('environment');
261264
$applicationConfig['global']['defaultassetstore.id'] = $assetstrores[0]->getKey();

core/controllers/ItemController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ function viewAction()
8888

8989
$this->view->itemSize = $this->Component->Utility->formatSize($itemDao->getSizebytes());
9090

91+
$this->view->title .= ' - '.$itemDao->getName();
92+
$this->view->metaDescription = substr($itemDao->getDescription(), 0, 160);
93+
9194
$this->view->json['item'] = $itemDao->toArray();
9295
$this->view->json['item']['message']['delete'] = $this->t('Delete');
9396
$this->view->json['item']['message']['deleteMessage'] = $this->t('Do you really want to delete this item? It cannot be undo.');

core/controllers/forms/AdminForm.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ public function createConfigForm()
1616
'fr' => 'French'
1717
));
1818

19+
$description = new Zend_Form_Element_Textarea('description');
20+
21+
$keywords = new Zend_Form_Element_Textarea('keywords');
22+
1923
$timezone = new Zend_Form_Element_Select('timezone');
2024
$timezone ->addMultiOptions(array(
2125
'America/New_York' => 'America/New_York',
@@ -38,7 +42,7 @@ public function createConfigForm()
3842
$submit = new Zend_Form_Element_Submit('submitConfig');
3943
$submit ->setLabel('Save configuration');
4044

41-
$form->addElements(array($timezone, $environment, $lang, $name, $smartoptimizer, $submit));
45+
$form->addElements(array($keywords, $description, $timezone, $environment, $lang, $name, $smartoptimizer, $submit));
4246
return $form;
4347
}
4448
} // end class

core/controllers/forms/InstallForm.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ public function createConfigForm()
100100
$environment ->addMultiOptions(array(
101101
'production' => 'Production',
102102
'development' => 'Development'
103-
));
103+
));
104+
105+
$description = new Zend_Form_Element_Textarea('description');
106+
107+
$keywords = new Zend_Form_Element_Textarea('keywords');
104108

105109
$name = new Zend_Form_Element_Text('name');
106110
$name ->setRequired(true)
@@ -112,7 +116,7 @@ public function createConfigForm()
112116
$submit = new Zend_Form_Element_Submit('submit');
113117
$submit ->setLabel('Create configuration');
114118

115-
$form->addElements(array($process, $timezone, $environment, $lang, $name, $smartoptimizer, $submit));
119+
$form->addElements(array($keywords, $description, $process, $timezone, $environment, $lang, $name, $smartoptimizer, $submit));
116120
return $form;
117121
}
118122
} // end class

0 commit comments

Comments
 (0)