Commit Graph

65 Commits

Author SHA1 Message Date
Andrew O'Neil
f02e8803b1 ENHANCEMENT: Only run a single query per class for Hierarchy::numChildren()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89999 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-22 22:18:02 +00:00
Ingo Schommer
e1a47de20e BUGFIX Fixing regression in TranslatableTest due to outdated singleton caching.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89911 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-22 00:30:21 +00:00
Ingo Schommer
11d5ce0274 BUGFIX Moved SINGLETON resetting for test runs from SiteTreeTest/ObjectTest into SapphireTest - there should be no caching between all test invocations to avoid side effects
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89893 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-21 23:09:14 +00:00
Sam Minnee
f792d16c01 MINOR: Ensure that tests work by giving the test executor admin rights (from r89124)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89217 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-15 22:41:55 +00:00
Sean Harvey
559bbfcca8 BUGFIX #4605 DataObject::newClassInstance() should repopulate it's defaults after changing to an instance of a different class, otherwise databases will complain of NULL values being written to columns that don't accept NULL values.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88956 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-14 06:35:45 +00:00
Andrew Short
ea906a50a8 FEATURE: Implemented Translatable::get_homepage_link_by_locale() to enable translated home pages to function.
FEATURE: Updated SiteTree::get_by_link() to integrate with translatable, and allow it to work across languages by implementing Translatable->alternateGetByLink().
API CHANGE: Moved lang_filter enabling & disabling into static methods on Translatable, and renamed to locale_filter.
BUGFIX: Fixed viewing a translatable page by URL without explicitly setting a Locale in ContentController->handleRequest().

From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88503 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-11 00:07:22 +00:00
Andrew Short
ad7194cc40 FEATURE: Refactored RootURLController to allow nested home pages.
MINOR: Deprecated RootURLController::get_homepage_urlsegment() in favour of get_homepage_link().
MINOR: Updated SiteTree->RelativeLink() to return a link to the site root for the home page.

From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88496 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-11 00:07:17 +00:00
Ingo Schommer
2506816ad6 ENHANCEMENT Added Translatable->getAllowedLocalesForMember()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88125 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-05 20:07:03 +00:00
Ingo Schommer
0faf03ee4e API CHANGE Requiring TRANSLATE_ALL or TRANSLATE_<locale> permission for authors without administrative access to edit translations
ENHANCEMENT Added Translatable->providePermissions()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88123 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-05 10:33:36 +00:00
Geoff Munn
e603bb8915 MINOR: Dataobject now has enforced ordering
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@87769 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-09-30 21:54:49 +00:00
Geoff Munn
fbe610ae13 MINOR FIX: column names escaped properly, plus ordering now on the query results
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@87571 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-09-29 22:04:32 +00:00
Geoff Munn
84e4d7fee1 MINOR FIX: columns quoted properly
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86533 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-09-17 00:27:16 +00:00
Geoff Munn
7a392bd91b MINOR FIX: columns quoted properly
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86530 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-09-17 00:19:32 +00:00
Sam Minnee
dfbd16e140 BUGFIX: Fixed querying of composite fields (broken due to inappropriate optimisation of hasField)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84796 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-19 04:59:40 +00:00
Ingo Schommer
26ff1f9264 MINOR Added test for SiteTree::get_by_url() in TranslatableTest
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84576 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-17 22:46:39 +00:00
Sam Minnee
5790ddf708 API CHANGE: Added DataObject::is_composite_field() and DataObject::composite_fields() to efficiently keep track of which fields are composite.
API CHANGE: Deprecated DataObject::databaseFields() in favour of the static DataObject::database_fields()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84161 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-08-11 08:49:52 +00:00
Ingo Schommer
f3959b038d API CHANGE Deprecated use of SapphireTest->fixture to access YML fixtures, please use gateway methods on SapphireTest instead (e.g. $this->objFromFixture() instead of $this->fixture->objFromFixture())
ENHANCEMENT Allowing multiple fixtures to be defined in SapphireTest::$fixture_file through array notation. 
BUGFIX Disabling DataObject validation in YamlFixture->saveIntoDatabase() instead of SapphireTest->setUp()
MINOR Adapted sapphire unit tests to deprecated $this->fixture usage

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81286 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-07-08 00:06:16 +00:00
Ingo Schommer
aaef41a122 MINOR renamed case sensitive SSDatetimeTest for filename to match classname
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@80666 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-07-01 00:36:57 +00:00
Sam Minnee
e0fbc7ac83 BUGFIX: Added explicit DataObjectDecorator::load_extra_statics() calls as a workaround for issues with extensions defined directly in-object.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79720 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-22 02:42:42 +00:00
Ingo Schommer
6fa83caae6 ENHANCEMENT Making SSDatetime mockable through SSDatetime::set_mock_now()
ENHANCEMENT SSDatetime::now()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79503 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-18 00:10:02 +00:00
Sam Minnee
0540bec71f BUGFIX #4255 sharvey: Fix application of extra db fields by DataObjectDecorators.
API CHANGE #4255 sharvey: DataObjectDecorator::extraStatics() can no longer refer to $this because it's called staticly


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79430 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-17 07:01:28 +00:00
Ingo Schommer
14abe5a2e2 BUGFIX Fixed TranslatableTest->testSavePageInCMS(), needed admin login to edit ViewersGroups field
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79278 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-15 23:49:17 +00:00
Ingo Schommer
da2291c297 MINOR Added TranslatableTest->testSavePageInCMS()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79273 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-15 23:34:43 +00:00
Ingo Schommer
20ada72b4d BUGFIX Don't remove translation groups in Translatable->onBeforeDelete() if the decorated record uses Versioned, as other representations of the record might still exist in other tables (e.g. SiteTree_Live) (see #4219)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79208 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-15 05:02:43 +00:00
Sam Minnee
b2460de140 ENHANCEMENT: Removed circular references from extensions to improve garbage collection.
API CHANGE: The result of any extension returned by Object::extInstance() should have setOwner() called on it before calling a method, and clearOwner() after.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78414 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-04 06:48:44 +00:00
Ingo Schommer
4d02ee68d0 MINOR Added CompositeDBFieldTest
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78237 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-02 03:45:38 +00:00
Ingo Schommer
dfa44c055c API CHANGE Changing DataObject::$changed to private visiblity. Please use getChangedFields() and isChanged()
ENHANCEMENT Added DataObject->isChanged() to detect if a field has been changed in this object instance
MINOR Changing call to CompositeDBField->compositeDatabaseFields() in DataObject->hasOwnDatabaseField()
BUGFIX Unsettig "Version" property in DataObject->getChangedField() to allow versioned to write a new version after a call to forceChange()
BUGFIX Introduced $markChanged in Money class
BUGFIX Casting Money->__toString() return value as string
MINOR Changing Member class to use new DataObject->isChanged() API
BUGFIX Using new $markChanged API for CompositeDBFields in DBField::create()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77893 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-27 00:09:23 +00:00
Ingo Schommer
4d55f1e5d7 BUGFIX Fixed Money->Nice() to provide symbol and currency shortname based on Money->getCurrency()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77754 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-25 06:03:06 +00:00
Saophalkun Ponlu
ce6402f8d0 ENHANCEMENT: use image file name (without file path and extension) for alt attribute when title is not provided
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77668 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-24 12:16:17 +00:00
Ingo Schommer
9f7bbc57d0 BUGFIX Inspecting the change status of all CompositeDBFields when invoking DataObject->getChangedFields(), as their value setting is not performed through DataObject->setField(), it doesn't trigger the built-in change detection.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77667 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-23 05:32:16 +00:00
Ingo Schommer
825362bf00 MINOR Added MoneyTest->testLoadFromFixture()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77633 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-22 04:45:07 +00:00
Ingo Schommer
a2a507f73c BUGFIX Fixed Money->writeToManipulation() to correctly overwrite with NULL values
ENHANCEMENT Added Money->NiceWithName()
ENHANCEMENT Changed Money->NiceWithShortname() to use Zend_Currency options
BUGFIX Setting isChanged flag on Money individual setters
MINOR Added Money->__toString()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77548 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-21 04:46:58 +00:00
Ingo Schommer
336bce8bf8 ENHANCEMENT Added DataObject::$create_table_options to pass through special options to Database->requireTable(). Contains a keyed array by database driver. Example use is specifying different storage engines for MySQL: array('MySQLDatabase'=>'ENGINE=InnoDB')
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77160 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-19 03:55:14 +00:00
Ingo Schommer
104470006e API CHANGE Deprecated Translatable::set_reading_lang(), use Translatable::set_current_locale().
MINOR Renamed internal property Translatable::$reading_lang to $current_lang

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77006 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-17 05:36:01 +00:00
Sean Harvey
b1018f5864 Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76846 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-14 05:26:47 +00:00
Ingo Schommer
5b0ee9678f API CHANGE Deprecated Translatable->getTranslatedLangs(), use getTranslatedLocales()
ENHANCEMENT Added Translatable::$allowed_locales to limit the available locales in the CMS for page translations. Added Translatable->canTranslate() and Translatable->canEdit() to determine if a translation is allowed.
ENHANCEMENT Added $instance parameter to LanguageDropdownField to call instance-specific canTranslate() on it (optionally)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76839 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-14 05:16:49 +00:00
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
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
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
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
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
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
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
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