Commit Graph

284 Commits

Author SHA1 Message Date
Ingo Schommer
4c94455a4d ENHANCEMENT Improved TranslatableTest->testCreateTranslationTranslatesUntranslatedParents() to translate two grandchildren - this used to be an issue in branches/2.3 (see #4016)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76594 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-12 00:46:57 +00:00
Sam Minnee
ed06eb37c0 BUGFIX: Created Versioned's Version field as a proper Dataobject field.
API CHANGE: DataObject's internal $this->record array doesn't import null values, so that they don't get written back out.
API CHANGE: DataObject queries explicitly list columns, rather than using *.  This means that extraneous columns won't be included.
MINOR: Updated tests for db abstraction.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76372 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-07 06:00:50 +00:00
Sean Harvey
b20b6e0f95 Merged from 2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76269 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-06 06:36:16 +00:00
Ingo Schommer
5e8e47ef77 FEATURE Added Money class for managing monetary amounts with currencies through the Money design pattern. Uses the CompositeDBField interface to contain multiple database columns in a single DBField
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76100 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-05 08:10:51 +00:00
Ingo Schommer
3fcb2a336a BUGFIX Fixed TranslatableTest URLSegment detection
BUGFIX Removed URLSegment detection from Translatable->onBeforeWrite() - it was always preceeded by SiteTree->onBeforeWrite() which already alters the URL, so the appending of locale values to disambiguate the URL was pointless (never triggered)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75983 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-04 08:48:14 +00:00
Ingo Schommer
4f90da4fa3 BUGFIX Resetting default language in TranslatableTest - this was breaking VirtualPageTest before
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75936 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-04 04:28:09 +00:00
Ingo Schommer
681380424a BUGFIX Fixed empty ErrorPage types in output by setting status code in init() instead of index() and checking for "index" action - introduced in r75096 (see #3960)
BUGIFX Changed ErrorPage->publish() to doPublish->doPublish() - the publication of static HTML into the /assets directory was lagging one version behind the actual published content
BUGFIX Fixed wrong parameter in ErrorPage::get_static_filepath()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75915 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-04 02:20:57 +00:00
Sean Harvey
f4eecd4d0d Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75903 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-04 01:20:12 +00:00
Sean Harvey
9b75cb1987 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75845 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-01 03:49:34 +00:00
Ingo Schommer
c28c90b708 MINOR Re-added Translatable->extendWithSuffix()
BUGFIX Fixed DBLocaleTest

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75745 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-30 08:39:49 +00:00
Ingo Schommer
c1c920cca0 ENHANCEMENT Added DBLocale class for Translatable extension
API CHANGE Deprecated Translatable::get_langs_by_id() - use getTranslations()
MINOR Removed Translatable::is_default_locale() - no deprecation necessary, was recently added
MINOR Removed commented out methods in Translatable: augmentNumChildrenCountQuery(), augmentAllChildrenIncludingDeleted() and augmentStageChildren()
MINOR Removed fieldsInExtraTables() and extendWithSuffix()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75742 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-30 07:37:09 +00:00
Ingo Schommer
332e231529 ENHANCEMENT Added Versioned support to Translatable::getTranslation() and getTranslations()
ENHANCEMENT Marking 2.1-style "_lang" tables obsolete in Translatable::requireDefaultRecords()
ENHANCEMENT Added override flag to Translatable::addTranslationGroups()
MINOR Disabled Translatable->TranslationMasterID - not implemented yet

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75677 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-29 23:18:17 +00:00
Ingo Schommer
3d0c4a1615 BUGFIX Fixed i18n::get_locale_from_lang() to return original parameter if it detects a fully qualified locale that shouldn't be converted
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75675 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-29 23:15:38 +00:00
Sean Harvey
4615fd74b3 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75591 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-29 01:21:38 +00:00
Sean Harvey
a5e82ddff1 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75590 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-29 01:20:24 +00:00
Sean Harvey
13b358a8dd Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75582 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-29 00:07:39 +00:00
Sean Harvey
76b5adc979 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75579 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-28 23:52:15 +00:00
Ingo Schommer
99c1fe9f93 BUGFIX Allowing translated homepages in RootUrlController
BUGFIX Limiting RootURLController to just trigger Translatable if no DomainForHomepage value is found
BUGFIX Using $locale parameter in Translatable::get_homepage_urlsegment_by_locale()
BUGFIX Updated enabling mechanism in Translatable->alternateGetByUrl()
MINOR Removed HTTP_HOST setting in TranslatableTest, wasn't necessary
API CHANGE Deprecated Translatable::get_homepage_urlsegment_by_language(), use get_homepage_urlsegment_by_locale()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75328 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-27 23:08:39 +00:00
Ingo Schommer
ca24365c6f BUGFIX Fixed Translatable->onBeforeWrite() to change ClassNames on all translations when the "master page" (default language) changes its class to avoid inconsistencies with saving translations (see #3487)
BUGFIX Correctly showing the available languages dropdown in Translatable->getCMSFields()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75249 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-27 05:57:11 +00:00
Ingo Schommer
e55f3126fa BUGFIX Changed DataObject->newClassInstance() to only force changes if a differing classname was set. Setting ClassName property on new instance to trigger change detection (required for Translatable->onBeforeWrite())
BUGFIX Only force DataObject->forceChange() on fields which aren't already marked as changed

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75248 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-27 05:55:25 +00:00
Sam Minnee
b165bde578 BUGFIX #3919: Fix DataObject::dbObject() for decorated fields
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75150 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-27 00:44:10 +00:00
Ingo Schommer
bac89fd2c5 BUGFIX Setting the correct ParentID for children with existing parents in Translatable->createTranslation() - see #3861
BUGFIX Fixed Locale duplication detection for queries in Translatable->augmentSQL()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75027 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-23 04:41:49 +00:00
Ingo Schommer
235ce958b8 BUGFIX Fixed TranslatableSearchFormTest->setUp() method
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74942 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-22 03:24:50 +00:00
Ingo Schommer
228b976ce1 ENHANCEMENT Adding SapphireTest::set_up_once() and SapphireTest::tear_down_once() for better test performance with state that just needs to be initialized once per test case (not per test method). Added new SapphireTestSuite to support this through PHPUnit.
ENHANCEMENT Using set_up_once() in TranslatableTest and TranslatableSearchFormTest for better test run performance

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74941 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-22 03:22:09 +00:00
Ingo Schommer
50fc4959a2 ENHANCEMENT Improved deprecated fallbacks in Translatable by auto-converting short language codes to long locales and vice versa through i18n::get_lang_from_locale()/i18n::get_locale_from_lang()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74017 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-02 21:49:40 +00:00
Ingo Schommer
d1a9e2b3f6 BUGFIX Fixed DateTest timestamp->date testing - was assuming a NZ timezone environment setting, hence failing in other timezones
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74011 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-02 17:16:34 +00:00
Ingo Schommer
93a931edbb MINOR Fixed DateTest to be more expressive (no iteration on test values)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74010 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-02 16:45:10 +00:00
Ingo Schommer
e0ec30dcc8 ENHANCEMENT Allowing usage of global settings via asterisk (*) in RequestHandler->$allowed_actions
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@74009 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-02 16:34:27 +00:00
Ingo Schommer
e482ada014 API CHANGE Deprecated Translatable::enable() and i18n::enable()- use Object::add_extension('SiteTree','Translatable'), Deprecated Translatable::disable() and i18n::disable() - use Object::remove_extension('SiteTree','Translatable'), Deprecated Translatable::enabled() - use $myPage->hasExtension('Translatable')
API CHANGE Removed Translatable::creating_from() - doesn't apply any longer
ENHANCEMENT Translatable extension is no longer hooked up to SiteTree by default, which should improve performance and memory usage for sites not using Translatable. Please use Object::add_extension('SiteTree','Translatable') in your _config.php instead. Adjusted several classes (Image, ErrorPage, RootURLController) to the new behaviour.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73951 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-04-01 16:35:32 +00:00
Ingo Schommer
9f0be3eb7b API CHANGE Deprecated Object->extInstance(), use getExtensionInstance() instead
ENHANCEMENT Added Object->getExtensionInstances()
ENHANCEMENT Added Object::get_extensions()
ENHANCEMENT Unsetting class caches when using Object::add_extension() to avoid problems with defineMethods etc.
BUGFIX Fixed extension comparison with case sensitivity and stripping arguments in Object::has_extension()
BUGFIX Unsetting all cached singletons in Object::remove_extension() to avoid outdated extension_instances
MINOR Documentation in Object

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73900 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-31 22:27:53 +00:00
Ingo Schommer
ea9ce082e2 BUGFIX Fixed SoapModelAccessTest to conform to new 401 returns in RestfulServer
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73835 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-30 05:20:08 +00:00
Ingo Schommer
ec42a12162 BUGFIX RestfulServer->permissionFailiure() returns correct HTTP status code if authentication is possible: 401 Unauthrized instead of 403 Forbidden (patch #3803, thanks DoubleClique)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73820 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-30 03:12:58 +00:00
Sam Minnee
6cbeeb9e03 MINOR: Fixed test to get previous change to work
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73765 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-29 21:50:47 +00:00
Ingo Schommer
40910f9f71 ENHANCEMENT RestfulServer now accepts form-encoded HTTP requests for PUT and POST with new FormEncodedDataFormatter class (#3792, thanks camspiers)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73747 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-29 00:51:38 +00:00
Sam Minnee
131316e57a MINOR: Fixed syntax error in test source file
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73483 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-22 00:29:47 +00:00
Sam Minnee
ef4c5019a6 Added a syntax checking test that will use short_tags on and off and asp_tags on
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73481 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-22 00:25:09 +00:00
Sam Minnee
a28ea0a69e ENHANCEMENT: Added Object::combined_static(), which gets all values of a static property from each class in the hierarchy
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73473 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-21 05:10:05 +00:00
Ingo Schommer
16a012dfa1 MINOR fixed typo
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73470 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-20 08:56:57 +00:00
Ingo Schommer
7ad7f8dcf2 ENHANCEMENT Adjusted SearchForm, Debug, ErrorPage, SiteTree to using locales instead of lang codes
API CHANGE Changed Translatable datamodel to use locales ("en_US") instead of lang values ("en).
API CHANGE Changed Translatable::$default_lang to $default_locale, Translatable::$reading_lang to $reading_locale
API CHANGE Using "locale" instead of "lang" in Translatable::choose_site_lang() to auto-detect language from cookies or GET parameters
API CHANGE Deprecated Translatable::is_default_lang(), set_default_lang(), get_default_lang(), current_lang(), set_reading_lang(), get_reading_lang(), get_by_lang(), get_one_by_lang()
API CHANGE Removed Translatable::get_original() - with the new "translation groups" concept there no longer is an original for a translation
BUGFIX Updated MigrateTranslatableTask to new Locale based datamodel

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73468 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-20 08:47:06 +00:00
Ingo Schommer
25b19f0ae4 BUGFIX Fixed Hierarchy->Children() testing in TranslatableTest - with the new datamodel you can't call Children() in a different language regardless of Translatable::set_reading_lang(), the Children() call has to be made from a parent in the same language
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73465 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-20 07:58:52 +00:00
Ingo Schommer
103c6e8d68 API CHANGE Added concept of "translation groups" to Translatable- every page can belong to a group of related translations, rather than having an explicit "original", meaning you can have pages in "non-default" languages which have no representation in other language trees. This group is recorded in a new table "<classname>_translationgroups". Translatable->createTranslation() and Translatable->onBeforeWrite() will automatically associate records in this groups. Added Translatable->addTranslationGroup(), Translatable->removeTranslationGroup(), Translatable->getTranslationGroup()
API CHANGE Removed Translatable->isTranslation() - after the new "translation group" model, every page is potentially a translation
API CHANGE Translatable->findOriginalIDs(), Translatable->setOriginalPage(), Translatable->getOriginalPage()
ENHANCEMENT Translatable->getCMSFields() will now always show the "create translation" option, not only on default languages - meaning you can create translations based on other translations
ENHANCEMENT Translatable language dropdown in CMS will always show all available languages, rather than filtering by already existing translations
ENHANCEMENT Added check for an existing record in Translatable->createTranslation()
BUGFIX Removed Translatable->getLang() which overloaded the $db property - it was causing side effects during creation of SiteTree default records.
BUGFIX Added check in Translatable->augmentSQL() to avoid reapplying "Lang = ..." filter twice
BUGFIX Removed bypass in Translatable->AllChildrenIncludingDeleted()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73338 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-18 16:13:40 +00:00
Ingo Schommer
47f2deee7f BUGFIX Fixed Director::makeRelative() to accept https:// protocol
BUGFIX Fixed GET-parameter replacement in Director::is_absolute_url()
ENHANCEMENT Added Director::is_relative_url() and Director::is_site_url()
BUGFIX Validating $_FILES array in Director::direct()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73250 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-17 22:22:55 +00:00
Ingo Schommer
76c114f270 MINOR Added DataObjectDecoratorTest->testPopulateDefaults()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73132 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-16 13:47:52 +00:00
Ingo Schommer
88359b1ba5 MINOR Added DataObjectTest->testPopulateDefaults()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73131 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-16 13:43:03 +00:00
Sam Minnee
14c37bf510 MINOR: Commented out problematic caching test :-(
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73123 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-16 06:49:05 +00:00
Sam Minnee
67a1c6cda3 ENHANCEMENT: Added Object::clearCache() to clear a cache
BUGFIX: Make object cache testing more robust

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73059 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-15 01:09:59 +00:00
Sam Minnee
08e2fc15ef Improved object cache testing
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73058 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-15 00:48:33 +00:00
Sam Minnee
41fb93b344 ENHANCEMENT #3032 ajshort: Use static methods for accessing static data
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73036 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-14 00:16:32 +00:00
Sam Minnee
3e596ba66c BUGFIX: Fixed dates in DateTest so that they don't trip up on timezone quirks, since those are more to do with our buildslave than bugs in SilverStripe
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72679 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-09 07:32:51 +00:00
Sam Minnee
ca5825e52c BUGFIX: Fixed dates in DateTest so that they don't trip up on timezone quirks, since those are more to do with our buildslave than bugs in SilverStripe.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72461 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-03-04 05:33:08 +00:00