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

Conflicts:
	control/Director.php
This commit is contained in:
Ingo Schommer 2013-02-07 21:45:16 +01:00
commit 14a56c18e9
11 changed files with 60 additions and 34 deletions

View File

@ -286,10 +286,9 @@
// Copy attributes. We can't replace the node completely
// without removing or detaching its children nodes.
for(var i=0; i<newNode[0].attributes.length; i++){
var attr = newNode[0].attributes[i];
node.attr(attr.name, attr.value);
}
$.each(['id', 'style', 'class', 'data-pagetype'], function(i, attrName) {
node.attr(attrName, newNode.attr(attrName));
});
// Replace inner content
var origChildren = node.children('ul').detach();

View File

@ -7,6 +7,6 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
'ModelAdmin.DELETED': "Gelöscht",
'ModelAdmin.VALIDATIONERROR': "Validationsfehler",
'LeftAndMain.PAGEWASDELETED': "Diese Seite wurde gelöscht.",
'LeftAndMain.CONFIRMUNSAVED': "Sind Sie sicher, dasß Sie die Seite verlassen möchten?\n\nWARNUNG: Ihre Änderungen werden nicht gespeichert.\n\nDrücken Sie \"OK\" um fortzufahren, oder \"Abbrechen\" um auf dieser Seite zu bleiben."
'LeftAndMain.CONFIRMUNSAVED': "Sind Sie sicher, dass Sie die Seite verlassen möchten?\n\nWARNUNG: Ihre Änderungen werden nicht gespeichert.\n\nDrücken Sie \"OK\" um fortzufahren, oder \"Abbrechen\" um auf dieser Seite zu bleiben."
});
}

View File

@ -189,9 +189,11 @@ class RSSFeed extends ViewableData {
$prevState = SSViewer::get_source_file_comments();
SSViewer::set_source_file_comments(false);
$response = Controller::curr()->getResponse();
if(is_int($this->lastModified)) {
HTTP::register_modification_timestamp($this->lastModified);
header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $this->lastModified) . ' GMT');
$response->addHeader("Last-Modified", gmdate("D, d M Y H:i:s", $this->lastModified) . ' GMT');
}
if(!empty($this->etag)) {
HTTP::register_etag($this->etag);
@ -199,7 +201,7 @@ class RSSFeed extends ViewableData {
if(!headers_sent()) {
HTTP::add_cache_headers();
header("Content-type: text/xml");
$response->addHeader("Content-Type", "application/rss+xml");
}
SSViewer::set_source_file_comments($prevState);

View File

@ -141,17 +141,6 @@ class Director implements TemplateGlobalProvider {
$res = Injector::inst()->get('RequestProcessor')->postRequest($req, $response, $model);
if ($res !== false) {
// Set content length (according to RFC2616)
if(
!headers_sent()
&& $response->getBody()
&& $req->httpMethod() != 'HEAD'
&& $response->getStatusCode() >= 200
&& !in_array($response->getStatusCode(), array(204, 304))
) {
$response->fixContentLength();
}
$response->output();
} else {
// @TODO Proper response here.

View File

@ -160,6 +160,9 @@ class SS_HTTPResponse {
*/
public function setBody($body) {
$this->body = $body;
// Set content-length in bytes. Use mbstring to avoid problems with mb_internal_encoding() and mbstring.func_overload
$this->headers['Content-Length'] = mb_strlen($this->body,'8bit');
}
/**
@ -276,14 +279,6 @@ class SS_HTTPResponse {
return in_array($this->statusCode, array(301, 302, 401, 403));
}
/**
* Set content-length in bytes. Should be called right before {@link output()}.
*/
public function fixContentLength() {
// Use mbstring to avoid problems with mb_internal_encoding() and mbstring.func_overload
$this->headers['Content-Length'] = mb_strlen($this->body,'8bit');
}
}
/**

View File

@ -421,6 +421,7 @@ class TreeDropdownField_Readonly extends TreeDropdownField {
$field = new LookupField($this->name, $this->title, $source);
$field->setValue($this->value);
$field->setForm($this->form);
$field->dontEscape = true;
return $field->Field();
}
}

View File

@ -210,9 +210,38 @@ class ManyManyList extends RelationList {
}
/**
* @return Array Map of field => fieldtype
* Gets the join table used for the relationship.
*
* @return string the name of the table
*/
function getExtraFields() {
public function getJoinTable() {
return $this->joinTable;
}
/**
* Gets the key used to store the ID of the local/parent object.
*
* @return string the field name
*/
public function getLocalKey() {
return $this->localKey;
}
/**
* Gets the key used to store the ID of the foreign/child object.
*
* @return string the field name
*/
public function getForeignKey() {
return $this->foreignKey;
}
/**
* Gets the extra fields included in the relationship.
*
* @return array a map of field names to types
*/
public function getExtraFields() {
return $this->extraFields;
}

View File

@ -32,6 +32,19 @@ class Varchar extends StringField {
parent::__construct($name, $options);
}
/**
* Allow the ability to access the size of the field programatically. This
* can be useful if you want to have text fields with a length limit that
* is dictated by the DB field.
*
* TextField::create('Title')->setMaxLength(singleton('SiteTree')->dbObject('Title')->getSize())
*
* @return int The size of the field
*/
public function getSize() {
return $this->size;
}
/**
* (non-PHPdoc)
* @see DBField::requireField()

View File

@ -373,7 +373,7 @@ class Group extends DataObject {
// without this check, a user would be able to add himself to an administrators group
// with just access to the "Security" admin interface
Permission::checkMember($member, "CMS_ACCESS_SecurityAdmin") &&
!DataObject::get("Permission", "GroupID = $this->ID AND Code = 'ADMIN'")
!Permission::get()->filter(array('GroupID' => $this->ID, 'Code' => 'ADMIN'))->exists()
)
) {
return true;

View File

@ -15,7 +15,6 @@ class HTTPResponseTest extends SapphireTest {
public function testContentLengthHeader() {
$r = new SS_HTTPResponse('123ü');
$r->fixContentLength();
$this->assertNotNull($r->getHeader('Content-Length'), 'Content-length header is added');
$this->assertEquals(
5,
@ -24,7 +23,6 @@ class HTTPResponseTest extends SapphireTest {
);
$r->setBody('1234ü');
$r->fixContentLength();
$this->assertEquals(
6,
$r->getHeader('Content-Length'),

View File

@ -1109,7 +1109,7 @@ class Requirements_Backend {
$this->css($path.$css, $media);
}
else if ($module) {
$this->css($module.$css);
$this->css($module.$css, $media);
}
}