Merge remote-tracking branch 'origin/3.1'

This commit is contained in:
Damian Mooyman 2014-05-12 11:33:44 +12:00
commit 6a69134fb0
7 changed files with 84 additions and 3 deletions

View File

@ -1,3 +1,6 @@
LeftAndMain:
extensions:
- LeftAndMainPageIconsExtension
Security:
extensions:
- ErrorPageControllerExtension

View File

@ -0,0 +1,17 @@
<?php
/**
* Enhances error handling for a controller with ErrorPage generated output
*
* @package cms
* @subpackage controller
*/
class ErrorPageControllerExtension extends Extension {
public function onBeforeHTTPError($statusCode, $request) {
$response = ErrorPage::response_for($statusCode);
if($response) {
throw new SS_HTTPResponse_Exception($response, $statusCode);
}
}
}

View File

@ -201,6 +201,8 @@ class ErrorPage extends Page {
415 => _t('ErrorPage.415', '415 - Unsupported Media Type'),
416 => _t('ErrorPage.416', '416 - Request Range Not Satisfiable'),
417 => _t('ErrorPage.417', '417 - Expectation Failed'),
422 => _t('ErrorPage.422', '422 - Unprocessable Entity'),
429 => _t('ErrorPage.429', '429 - Too Many Requests'),
500 => _t('ErrorPage.500', '500 - Internal Server Error'),
501 => _t('ErrorPage.501', '501 - Not Implemented'),
502 => _t('ErrorPage.502', '502 - Bad Gateway'),

45
javascript/lang/nb.js Normal file
View File

@ -0,0 +1,45 @@
// This file was generated by GenerateJavaScriptI18nTask from javascript/lang/src/nb.js.
// See https://github.com/silverstripe/silverstripe-buildtools for details
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
} else {
ss.i18n.addDictionary('nb', {
"CMSMAIN.ALERTCLASSNAME": "Sidetypen vil bare bli oppdatert når siden blir lagret",
"CMSMain.RollbackToVersion": "Vil du virkelig rulle tilbake til versjon #%s av denne siden?",
"CMSMAIN.CANTADDCHILDREN": "You can't add children to the selected node",
"CMSMAIN.PUBLISHINGPAGES": "Publiserer sider ...",
"CMSMAIN.SELECTMOREPAGES": "Du har valgt %s sider.\n\nVil du virkelig utføre denne handlingen?",
"CMSMAIN.SAVING": "lagrer ...",
"CMSMAIN.ERRORDELETINGPAGES": "Feil ved sletting av sider",
"URLSEGMENT.Edit": "Rediger",
"CMSMAIN.WARNINGSAVEPAGESBEFOREADDING": "Du må lagre siden før du kan legge til undersider.",
"CMSMAIN.PUBLISHING": "Publiserer ...",
"CMSMAIN.URLSEGMENTVALIDATION": "URLs can only be made up of letters, digits and hyphens.",
"URLSEGMENT.Cancel": "Avbryt",
"Tree.ShowAsList": "Vis undersider som en liste",
"CMSMAIN.ERRORREVERTING": "Error reverting to live content",
"Tree.ThisPageOnly": "Bare denne siden",
"CMSMain.ConfirmRestoreFromLive": "Vil du virkelig kopiere den publiserte siden til utkastsiden?",
"CMSMAIN.ERRORPUBLISHING": "Feil ved publisering av sider",
"CMSMAIN.ERRORADDINGPAGE": "Feil ved opprettelse av side",
"AssetTableField.REALLYDELETE": "Vil du virkelig slette de merkede filene?",
"CMSMAIN.RESTORING": "Gjenoppretter ...",
"AssetTableField.MOVING": "Flytter %s file(r)",
"Tree.EditPage": "Rediger",
"URLSEGMENT.OK": "OK",
"CMSMAIN.ERRORUNFILTER": "Unfiltered tree",
"CMSMAIN.FILTEREDTREE": "Filtered tree to only show changed pages",
"AssetAdmin.ConfirmDelete": "Vil du virkelig slette denne mappen og alle filer som ligger i den?",
"AssetAdmin.BATCHACTIONSDELETECONFIRM": "Vil du virkelig slette %s mapper?",
"CMSMAIN.AddSearchCriteria": "Legg til kriterie",
"Tree.Duplicate": "Dupliser",
"Tree.ThisPageAndSubpages": "Denne siden og undersider",
"WidgetAreaEditor.TOOMANY": "Beklager, du har for mange \"widgets\" i dette området",
"CMSMAIN.DELETINGPAGES": "Sletter sider ...",
"Folder.Name": "Mappenavn",
"CMSMAIN.REALLYDELETEPAGES": "Vil du virkelig slette de %s merkede sidene?",
"CMSMAIN.SELECTONEPAGE": "Vennligst velg minst én side.",
"Tree.AddSubPage": "Legg til ny side her",
"CMSMAIN.ERRORFILTERPAGES": "Could not filter tree to only show changed pages<br />%s"
});
}

View File

@ -200,6 +200,8 @@ en:
415: '415 - Unsupported Media Type'
416: '416 - Request Range Not Satisfiable'
417: '417 - Expectation Failed'
422: '422 - Unprocessable Entity'
429: '429 - Too Many Requests'
500: '500 - Internal Server Error'
501: '501 - Not Implemented'
502: '502 - Bad Gateway'

View File

@ -3,7 +3,7 @@ nb:
ADDFILES: 'Legg til filer'
ActionAdd: 'Legg til mappe'
AppCategoryArchive: Arkiv
AppCategoryAudio: Audio
AppCategoryAudio: Lyd
AppCategoryDocument: Dokument
AppCategoryFlash: Flash
AppCategoryImage: Bilde

View File

@ -70,4 +70,16 @@ class ErrorPageTest extends FunctionalTest {
$this->assertEquals($response->getStatusCode(), '403');
$this->assertNotNull($response->getBody(), 'We have body text from the error page');
}
public function testSecurityError() {
// Generate 404 page
$page = $this->objFromFixture('ErrorPage', '404');
$page->publish('Stage', 'Live');
// Test invalid action
$response = $this->get('Security/nosuchaction');
$this->assertEquals($response->getStatusCode(), '404');
$this->assertNotNull($response->getBody());
$this->assertContains('text/html', $response->getHeader('Content-Type'));
}
}