Merge remote-tracking branch 'origin/3.0' into 3.1

Conflicts:
	admin/javascript/LeftAndMain.js
	tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php
	tests/control/ControllerTest.php
This commit is contained in:
Ingo Schommer 2013-06-19 14:03:43 +02:00
commit 2160fb8000
7 changed files with 97 additions and 58 deletions

View File

@ -5,10 +5,23 @@ jQuery.noConflict();
*/ */
(function($) { (function($) {
window.onresize = function(e) { var windowWidth, windowHeight;
$(window).bind('resize.leftandmain', function(e) {
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event. // Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
$('.cms-container').trigger('windowresize'); var cb = function() {$('.cms-container').trigger('windowresize');};
};
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
});
// setup jquery.entwine // setup jquery.entwine
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE; $.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
@ -650,8 +663,8 @@ jQuery.noConflict();
} else if(sessionStates) { } else if(sessionStates) {
$.each(sessionStates, function(i, sessionState) { $.each(sessionStates, function(i, sessionState) {
if(tabset.is('#' + sessionState.id)) index = sessionState.selected; if(tabset.is('#' + sessionState.id)) index = sessionState.selected;
}); });
} }
if(index !== null) tabset.tabs('select', index); if(index !== null) tabset.tabs('select', index);
}); });
}, },
@ -671,7 +684,7 @@ jQuery.noConflict();
} else { } else {
for(var i=0;i<s.length;i++) { for(var i=0;i<s.length;i++) {
if(s.key(i).match(/^tabs-/)) s.removeItem(s.key(i)); if(s.key(i).match(/^tabs-/)) s.removeItem(s.key(i));
} }
} }
}, },
@ -818,18 +831,18 @@ jQuery.noConflict();
$('.cms-content .Actions').entwine({ $('.cms-content .Actions').entwine({
onmatch: function() { onmatch: function() {
this.find('.ss-ui-button').click(function() { this.find('.ss-ui-button').click(function() {
var form = this.form; var form = this.form;
// forms don't natively store the button they've been triggered with // forms don't natively store the button they've been triggered with
if(form) { if(form) {
form.clickedButton = this; form.clickedButton = this;
// Reset the clicked button shortly after the onsubmit handlers // Reset the clicked button shortly after the onsubmit handlers
// have fired on the form // have fired on the form
setTimeout(function() { setTimeout(function() {
form.clickedButton = null; form.clickedButton = null;
}, 10); }, 10);
} }
}); });
this.redraw(); this.redraw();
this._super(); this._super();
@ -980,7 +993,7 @@ jQuery.noConflict();
form.clearForm(); form.clearForm();
form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated"); // Reset chosen.js form.find(".dropdown select").prop('selectedIndex', 0).trigger("liszt:updated"); // Reset chosen.js
form.submit(); form.submit();
} }
}) })
/** /**

View File

@ -17,6 +17,8 @@
* - SS_DATABASE_SUFFIX: A suffix to add to the database name. * - SS_DATABASE_SUFFIX: A suffix to add to the database name.
* - SS_DATABASE_PREFIX: A prefix to add to the database name. * - SS_DATABASE_PREFIX: A prefix to add to the database name.
* - SS_DATABASE_TIMEZONE: Set the database timezone to something other than the system timezone. * - SS_DATABASE_TIMEZONE: Set the database timezone to something other than the system timezone.
* - SS_DATABASE_MEMORY: Use in-memory state if possible. Useful for testing, currently only
* supported by the SQLite database adapter.
* *
* There is one more setting that is intended to be used by people who work on SilverStripe. * There is one more setting that is intended to be used by people who work on SilverStripe.
* - SS_DATABASE_CHOOSE_NAME: Boolean/Int. If set, then the system will choose a default database name for you if * - SS_DATABASE_CHOOSE_NAME: Boolean/Int. If set, then the system will choose a default database name for you if
@ -110,6 +112,10 @@ if(defined('SS_DATABASE_USERNAME') && defined('SS_DATABASE_PASSWORD')) {
// For schema enabled drivers: // For schema enabled drivers:
if(defined('SS_DATABASE_SCHEMA')) if(defined('SS_DATABASE_SCHEMA'))
$databaseConfig["schema"] = SS_DATABASE_SCHEMA; $databaseConfig["schema"] = SS_DATABASE_SCHEMA;
// For SQlite3 memory databases (mainly for testing purposes)
if(defined('SS_DATABASE_MEMORY'))
$databaseConfig["memory"] = SS_DATABASE_MEMORY;
} }
if(defined('SS_SEND_ALL_EMAILS_TO')) { if(defined('SS_SEND_ALL_EMAILS_TO')) {

View File

@ -173,7 +173,7 @@ the markup in the `else` clause is used, if that clause is present.
:::ss :::ss
<% if $MyDinner=="quiche" %> <% if $MyDinner=="quiche" %>
Real men don't eat quiche Real men don't eat quiche
<% else_if $MyDinner=$YourDinner %> <% else_if $MyDinner==$YourDinner %>
We both have good taste We both have good taste
<% else %> <% else %>
Can I have some of your chips? Can I have some of your chips?

View File

@ -4,8 +4,22 @@
* On resize of any close the open treedropdownfields * On resize of any close the open treedropdownfields
* as we'll need to redo with widths * as we'll need to redo with widths
*/ */
$(window).resize(function() { var windowWidth, windowHeight;
$('.TreeDropdownField').closePanel(); $(window).bind('resize.treedropdownfield', function() {
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
var cb = function() {$('.TreeDropdownField').closePanel();};
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
windowWidth = newWindowWidth;
windowHeight = newWindowHeight;
cb();
}
} else {
cb();
}
}); });
var strings = { var strings = {

View File

@ -422,7 +422,7 @@ class CmsUiContext extends BehatContext
) { ) {
if($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class')))) { if($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class')))) {
return $container; return $container;
} }
$container = $container->getParent(); $container = $container->getParent();
} }

View File

@ -110,6 +110,12 @@ class ControllerTest extends FunctionalTest {
'if action is not a method but rather a template discovered by naming convention' 'if action is not a method but rather a template discovered by naming convention'
); );
$response = $this->get("ControllerTest_AccessSecuredController/templateaction");
$this->assertEquals(403, $response->getStatusCode(),
'Access denied on action with $allowed_actions on defining controller, ' .
'if action is not a method but rather a template discovered by naming convention'
);
$this->session()->inst_set('loggedInAs', $adminUser->ID); $this->session()->inst_set('loggedInAs', $adminUser->ID);
$response = $this->get("ControllerTest_AccessSecuredController/templateaction"); $response = $this->get("ControllerTest_AccessSecuredController/templateaction");
$this->assertEquals(200, $response->getStatusCode(), $this->assertEquals(200, $response->getStatusCode(),
@ -391,7 +397,7 @@ class ControllerTest_UnsecuredController extends Controller implements TestOnly
// Granted for all // Granted for all
public function method2() {} public function method2() {}
} }
class ControllerTest_AccessBaseController extends Controller implements TestOnly { class ControllerTest_AccessBaseController extends Controller implements TestOnly {
@ -402,7 +408,7 @@ class ControllerTest_AccessBaseController extends Controller implements TestOnly
// Denied for all // Denied for all
public function method2() {} public function method2() {}
} }
class ControllerTest_AccessSecuredController extends ControllerTest_AccessBaseController implements TestOnly { class ControllerTest_AccessSecuredController extends ControllerTest_AccessBaseController implements TestOnly {
@ -427,7 +433,7 @@ class ControllerTest_AccessWildcardSecuredController extends ControllerTest_Acce
"*" => "ADMIN", // should throw exception "*" => "ADMIN", // should throw exception
); );
} }
class ControllerTest_IndexSecuredController extends ControllerTest_AccessBaseController implements TestOnly { class ControllerTest_IndexSecuredController extends ControllerTest_AccessBaseController implements TestOnly {
@ -435,7 +441,7 @@ class ControllerTest_IndexSecuredController extends ControllerTest_AccessBaseCon
"index" => "ADMIN", "index" => "ADMIN",
); );
} }
class ControllerTest_AccessBaseControllerExtension extends Extension implements TestOnly { class ControllerTest_AccessBaseControllerExtension extends Extension implements TestOnly {
@ -457,7 +463,7 @@ class ControllerTest_AccessBaseControllerExtension extends Extension implements
public function internalextensionmethod() {} public function internalextensionmethod() {}
} }
class ControllerTest_HasAction extends Controller { class ControllerTest_HasAction extends Controller {