Commit Graph

1927 Commits

Author SHA1 Message Date
Sean Harvey
db56d17056 Merge pull request #1190 from silverstripe-rebelalliance/feature/shortcodes
NEW Make shortcode parser more clever about placement
2013-02-17 19:00:14 -08:00
Hamish Friedlander
4b54383d68 API change request handling to be more orthogonal
RequestHandler#handleAction now exists. It takes the request, and
the action to call on itself. All calls from handleRequest to call an action
will go through this method

Controller#handleAction has had it's signature changed to
match new RequestHandler#handleAction

RequestHandler#findAction has been added, which extracts the
"match URL to rules to find action" portion of RequestHandler#handleRequest
into a separate, overrideable function

GridField#handleAction has beeen renamed to handleAlterAction and
CMSBatchActionHandler#handleAction has been renamed to handleBatchAction to
avoid name clash with new RequestHandler#handleAction

Reason for change: The exact behaviour of request handling depended heavily
on whether you inherited from RequestHandler or Controller, and whether the
rule extracted it's action directly (like "foo/$ID" => 'foo') or dynamically
(like "$Action/$ID" => "handleAction"). This cleans up behaviour so
all calls follow the same path through handleRequest and handleAction, and
the additional behaviour that Controller adds is clear.
2013-02-18 14:56:04 +13:00
Hamish Friedlander
5fd55a50f2 API Tighten up allowed_actions
allowed_actions is now only allowed to reference public methods defined
on the same Controller as the allowed_actions static, and
the wildcard "*" has been deprecated
2013-02-18 14:53:33 +13:00
Hamish Friedlander
7efae6b95f Merge remote-tracking branch 'origin/3.0' into 3.1 2013-02-18 14:31:57 +13:00
Ingo Schommer
30096ee730 BUGFIX Keep Member.PasswordEncryption setting on empty passwords
This will prevent empty passwords to set the encryption to 'none',
which in turn will store any subsequent password changes in cleartext.
Reproduceable e.g. with ConfirmedPasswordField and setCanBeEmpty(true).
2013-02-17 23:30:41 +01:00
Ingo Schommer
f06ba70fc9 BUG Undefined $allowed_actions overrides parent definitions, stricter handling of $allowed_actions on Extension
Controller (and subclasses) failed to enforce $allowed_action restrictions
on parent classes if a child class didn't have it explicitly defined.

Controllers which are extended with $allowed_actions (through an Extension)
now deny access to methods defined on the controller, unless this class also has them in its own
$allowed_actions definition.
2013-02-17 23:30:36 +01:00
Hamish Friedlander
2335c074b3 NEW Make shortcode parser more clever about placement
Shortcodes have traditionally had a problem that they are inside <p> tags,
but generate block level elements. This breaks HTML compliance.

This makes the shortcode parser now mutate the DOM based on the "class" attribute on
the shortcode to insert the generated block level element at the right place in the DOM

 - for "left" and "right" elements it puts them just before the block level
   element they are inside

 - for "leftAlone" and "center" elements it splits the DOM around the shortcode.

The trade off is that shortcodes are no longer "text level" features. They need
knowledge of the HTML they are in to perform this transformation, so they can
only be used in (valid) HTML
2013-02-18 10:49:52 +13:00
Ingo Schommer
37e10d14f3 Merge pull request #1184 from ajshort/named-services
BUG: Fixed the injection of named services.
2013-02-15 10:46:33 -08:00
Ingo Schommer
6ff1f9050d Merge pull request #1187 from dhensby/restfulservice-improvements
API Restfulservice improvements
2013-02-15 10:45:43 -08:00
Daniel Hensby
920fd71a2f Adding default curl options
Because I removed completely the static setting of SSL_VERIFYPEER I've
added the ability to declare default curl options on the class. This
means that users that really want to one line turn off SSL_VERIFYPEER
can do so without needing to pass a custom option in every request()
call.
2013-02-15 11:45:52 +00:00
Daniel Hensby
f003359047 RestfulService_Response now gets response headers
Before now, the RestfulService_Response object was never sent the
response headers. For APIs that rely on the response headers to send
back information (signatures, pagination info, etc).

This change makes the curl response have the full HTTP response
(including Headers). We then extract the body and the header information
and assign them to relevant vars and then construct the response as
before (with the addition of the headers array).

This change required two new functions:
extractResponse: This extracts the HTTP Headers and the payload from the
curl response and assigns it to the relevany vars that are passed by
reference
parseRawHeaders: This was designed to mimic http_parse_headers (a
non-standard php class). It converts the headers into an associative
array.
2013-02-15 11:45:36 +00:00
Ingo Schommer
f4068371fc Merge pull request #1159 from chillu/pulls/datetimefield-field-setters
DatetimeField->setDateField()/setTimeField()
2013-02-14 11:31:31 -08:00
Julian Seidenberg
f931b8d326 API Data corruption on Versioned due to lazy loading
Lazy loading no longer loads fields from the versions table when querying. This could lead to incorrect data being displayed if the data on the object and the version it pointed to did not match.

API methods to allow setting of the context of the query that generated the DataObject on that object (used by the lazy loading mechanism to correctly query the Stage, Live, or Versions tables)

See https://github.com/silverstripe/sapphire/pull/1178 for context.
2013-02-14 14:18:10 +01:00
Simon Welsh
be8482aa73 Merge pull request #1173 from ajshort/include-object-argument
BUG: Pass named include argument as objects.
2013-02-13 23:44:29 -08:00
ajshort
d3629be344 BUG: Pass named include argument as objects.
This means you can pass objects such as lists as named parameters, not
just strings.
2013-02-14 18:31:40 +11:00
ajshort
ff19f3b11a BUG: Fixed the injection of named services. 2013-02-13 23:06:15 +11:00
Ingo Schommer
b44720179c Merge pull request #1180 from mateusz/css-combining-media
API Add possibility to combine media-targeting stylesheets.
2013-02-12 14:13:45 -08:00
Mateusz Uzdowski
53feb3a5ae API Add possibility to combine media-targeting stylesheets. 2013-02-13 11:04:05 +13:00
Ingo Schommer
14a56c18e9 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	control/Director.php
2013-02-07 21:45:16 +01:00
Ingo Schommer
6c22545639 DatetimeField->setDateField()/setTimeField()
Useful e.g. to override the time field with the
"silverstripe/timefield" dropdown
2013-02-05 11:03:19 +01:00
Ingo Schommer
d77e06d585 Merge pull request #1123 from chillu/pulls/revert-content-length
API Remove Content-Length setting from HTTPResponse (fixes #8010)
2013-01-31 10:19:17 -08:00
Ingo Schommer
634c91c6ff Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	email/Mailer.php
2013-01-30 12:46:24 +01:00
Sam Minnee
1e1df8c43e BUGFIX: Improved detection of empty HTMLText fields. 2013-01-29 18:03:47 +01:00
Sam Minnee
d8bfc0bb48 API CHANGE: Added Security::set_login_url() so that you can define an alternative log-in page if you have made one yourself. 2013-01-29 18:03:47 +01:00
Damian Mooyman
1ca15d0399 API HTTP::urlRewriter with (string)$code deprecated in 3.1. Fixed regressions and CSS urls.
urlRewriter will expect a callable as a second parameter,
but will work with the current api and simply raise a deprecation error.

HTTP::absoluteURLs now correctly rewrites urls into absolute urls. Resolves introduced in c56a80d6ce

HTTP::absoluteURLs now handles additional cases where urls were not translated.

Test cases for HTTP::absoluteURLs added for both css and attribute links.

Cleaned up replacement expression and improved documentation.
2013-01-24 09:49:44 +01:00
Damian Mooyman
657c14fd82 Added test cases for exception error logging 2013-01-24 09:36:42 +01:00
Ingo Schommer
c69381c33e API Remove Content-Length setting from HTTPResponse (fixes #8010)
This reverts commit 356a367eb5.
We can't use headers_sent() to determine an accurate
content length, since PHP defaults to buffering a couple of bytes
even without ob_start() (see "output_buffering" setting).
This makes the patch harmful, since it breaks any responses relying
on more structure data, like removing closing brackets from JSON.
Which in turn breaks the CMS in horrible ways (see #8010).
See #7574 for context.
2013-01-23 15:05:33 +01:00
Ingo Schommer
c11b3918fc Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	admin/css/screen.css
	admin/scss/_style.scss
	core/PaginatedList.php
	email/Mailer.php
2013-01-21 11:14:57 +01:00
Ingo Schommer
27d2f75d9d Added test for DataList filters with array and modifiers (see #8162) 2013-01-15 01:11:35 +01:00
micschk
7f605cfb54 NEW Disable items in DropdownField and GroupedDropdownField 2013-01-11 16:32:20 +01:00
Ingo Schommer
3a1df46743 Merge pull request #1055 from stojg/bug-relField
BUG Calling DataObject::relField() on a object with an empty relation list
2013-01-11 07:09:55 -08:00
Ingo Schommer
4f39af1a85 Merge pull request #1090 from sminnee/fix-get-one-case
FIX: Fix DataObject::get_one() when the classname is passed with imprope...
2013-01-11 01:42:29 -08:00
Ingo Schommer
f3c0669fec Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	_config/uploadfield.yml
	css/UploadField.css
	forms/UploadField.php
	scss/UploadField.scss
	templates/UploadField.ss
	tests/forms/uploadfield/UploadFieldTest.php
2013-01-11 10:02:39 +01:00
Ingo Schommer
9e82d8e857 Fixed line lengths 2013-01-11 09:59:33 +01:00
Ingo Schommer
212c4f1e51 Fixed UploadField regression from 4da1af9c3 2013-01-11 09:30:21 +01:00
Sam Minnee
cc7318fde4 NEW: Added canAttachExisting config option for UploadField.
This is the companion setting to canUpload, letting you control whether existing files from the asset store can be referenced.  It's particularly useful when using UploadField on the front-end.
2013-01-11 09:29:02 +01:00
Ingo Schommer
2dfd42795e NEW Restrict upload abilities in UploadField
Conflicts:
	css/UploadField.css
	templates/UploadField.ss
2013-01-11 09:07:42 +01:00
Sam Minnee
f4efaeefa7 FIX: Fix DataObject::get_one() when the classname is passed with improper casing. 2013-01-11 12:20:57 +13:00
Ingo Schommer
9310b8d86d NEW Restrict upload abilities in UploadField 2013-01-10 00:15:34 +01:00
Ingo Schommer
e8bfc241fd Setting SapphireTest::is_running_test() in PHPUnit bootstrap
Otherwise conditional logic will only succeed
when run through "sake dev/tests", not when
run through phpunit directly (which is the recommended way now)
2013-01-09 23:31:10 +01:00
g4b0
e53280c650 BUG SQLQuery::aggregate() with limit, groupBy and orderBy (fixes #8148) 2012-12-21 15:20:59 +01:00
Ingo Schommer
8ec3641e60 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	admin/javascript/LeftAndMain.FieldHelp.js
	lang/en.yml
	model/URLSegmentFilter.php
2012-12-21 15:04:17 +01:00
Ingo Schommer
f0f83b26a8 BUG Graceful handling of sprintf with too few params in i18n::_t()
Originally discovered as a problem with the 'GridFieldDetailForm.Saved' in nl.yml
2012-12-21 11:46:39 +01:00
Sean Harvey
aa3b358469 Adding test for SortColumn to SQLQueryTest
Mostly for the benefit of MSSQLDatabase which is having problems
with subselects and alias functions.
2012-12-20 15:52:46 +13:00
Kirk Mayo
561e629c16 NEW Show the allowed extensions as a toggle tip as per trac 7993
NEW Added a behat test for showing extension trac 7993
2012-12-19 17:00:39 +01:00
Stig Lindqvist
22efd3848e BUG Calling DataObject::relField() on a object with an empty relation list
This causes a 'Fatal error: Call to a member function hasMethod() on a non-object'.

This can happen when displaying a field in a gridfield on a belongs_to relationship.
2012-12-19 16:47:07 +13:00
Mateusz Uzdowski
d5a1c3d99a BUG SS has problems handling + in URLs. Filter them out.
+ has a special meaning in the URLs so overall it's a good idea to
strip them out. Otherwise they would need to appear in their ugly url
encoded form "%2B".

Refer: http://open.silverstripe.org/ticket/7929
2012-12-18 09:44:47 +01:00
Sam Minnée
e4198de115 Merge pull request #1047 from simonwelsh/ns_class_parse
FIX Handle namespaced classes in Object::parse_class_spec()
2012-12-17 23:55:50 -08:00
Sam Minnée
9460e8704c Merge pull request #1043 from tractorcow/3.1-deleted-pages-fixes
Fix for issue #7975 - Issue with retrieving deleted pages
2012-12-17 19:50:27 -08:00
Simon Welsh
94be5c6d87 FIX Handle namespaced classes in Object::parse_class_spec() 2012-12-18 15:00:45 +13:00