Permalink
Browse files

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

Conflicts:
	control/Director.php
  • Loading branch information...
chillu committed Feb 7, 2013
2 parents 2e77e87 + 2b05951 commit 14a56c18e9180e22b3495b746f2f2d89bc7346c8
@@ -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();
@@ -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
@@ -189,17 +189,19 @@ public function outputToBrowser() {
$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);
}
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
@@ -141,18 +141,7 @@ public static function direct($url, DataModel $model) {
$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();
+ $response->output();
} else {
// @TODO Proper response here.
throw new SS_HTTPResponse_Exception("Invalid response");
View
@@ -160,6 +160,9 @@ public function isError() {
*/
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');
}
/**
@@ -275,14 +278,6 @@ public function output() {
public function isFinished() {
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');
- }
}
@@ -421,6 +421,7 @@ public function Field($properties = array()) {
$field = new LookupField($this->name, $this->title, $source);
$field->setValue($this->value);
$field->setForm($this->form);
+ $field->dontEscape = true;
return $field->Field();
}
}
View
@@ -210,9 +210,38 @@ function getExtraData($componentName, $itemID) {
}
/**
- * @return Array Map of field => fieldtype
+ * Gets the join table used for the relationship.
+ *
+ * @return string the name of the table
+ */
+ 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
*/
- function getExtraFields() {
+ public function getExtraFields() {
return $this->extraFields;
}
@@ -32,6 +32,19 @@ public function __construct($name = null, $size = 50, $options = array()) {
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
@@ -373,7 +373,7 @@ public function canEdit($member = null) {
// 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;
@@ -15,7 +15,6 @@ public function testStatusDescriptionStripsNewlines() {
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 @@ public function testContentLengthHeader() {
);
$r->setBody('1234ü');
- $r->fixContentLength();
$this->assertEquals(
6,
$r->getHeader('Content-Length'),
View
@@ -1109,7 +1109,7 @@ public function themedCSS($name, $module = null, $media = null) {
$this->css($path.$css, $media);
}
else if ($module) {
- $this->css($module.$css);
+ $this->css($module.$css, $media);
}
}

0 comments on commit 14a56c1

Please sign in to comment.