Commit Graph

133 Commits

Author SHA1 Message Date
Jeremy Thomerson
2da48dfd65 FIX: don't re-enable the locale filter if it wasn't enabled before
This breaks code that tries to get all instances of SiteConfig like:

```
Translatable::disable_locale_filter();
$all = SiteConfig::get();
Translatable::enable_locale_filter();
```

What was happening was that our populateSiteConfigDefaults method was
getting called before the actual data list the users uses above is
created, so it was re-enabling the locale filter before the
augmentDataQuery function was called on the data list created for the
user. Thus, they'd get a locale-augmented query and only get the
SiteConfig for the current locale, and not all as clearly intended.
2013-07-24 21:25:42 +00:00
Mark-M
6394f887de Set default field value to current locale 2013-07-17 15:06:42 +01:00
Ingo Schommer
34a171b9dc Fixed coding conventions 2013-07-15 12:12:09 +02:00
Jeremy Thomerson
9771d97e1f ENHANCEMENT: significant speed improvement for many locales
Iterating over an array of locales and querying for each one causes tons
of unnecessary queries. This is especially evident when you get up to
hundreds of translations of a page. It makes the CMS admin UI insufferably
slow.  This is a little tweak to query for all of them at once instead of
individually.
2013-07-14 21:08:53 +00:00
kmayo-ss
5bfc37748b Update LanguageDropdownField.php
BUG: Corrected allowed_actions to be private not public
2013-07-12 16:59:19 +12:00
Kirk Mayo
0d9bee0a64 BUG: with the enforcement of allowed_actions in 3.2 getLocaleForObject was being blocked 2013-07-12 16:08:20 +12:00
Ingo Schommer
c551915745 Merge remote-tracking branch 'origin/1.0' 2013-06-28 10:12:58 +02:00
Jeremy Thomerson
f4e5137392 FIX: make getTranslations work even when translation classes differ
Even though it is an edge-case, some sites may allow translation groups to be
composed of different classes.  In that case, Translatable->getTranslations()
should still work.

Also, this commit adds a helper function for testing two array for equality
where you don't care about the order of the elements.  This cleaned up a lot
of copy and paste boilerplate code that was sorting arrays to test.
2013-06-06 02:59:51 +00:00
Ingo Schommer
51cd0146df Merge branch '1.0'
Conflicts:
	.travis.yml
	code/model/Translatable.php
2013-06-03 12:06:29 +02:00
Jeremy Thomerson
cde0f57c43 FIX support disabled locale filter for delayed querying
Fixes silverstripe/silverstripe-translatable#113
2013-06-01 14:14:54 +00:00
Jeremy Thomerson
929beb216c FIX can not access private static variables of i18n 2013-05-31 19:09:03 +00:00
Ingo Schommer
f7eee8596d Merge pull request #109 from tractorcow/3.1-api-updaterelativelink
API Hook into SiteTreeExtension::updateRelativeLink
2013-05-17 05:04:12 -07:00
Sean Harvey
4c6e41441a Fixing @package declaration to translatable instead of sapphire 2013-05-17 11:09:52 +12:00
Damian Mooyman
22c5098f8e BUG Cleaner handling of querystring arguments when selecting locale 2013-05-13 00:18:45 +02:00
Damian Mooyman
ea4645af24 API Hook into SiteTreeExtension::updateRelativeLink 2013-05-10 12:23:36 +12:00
Ingo Schommer
ae27c5adc1 Merge remote-tracking branch 'origin/1.0' 2013-04-26 00:14:22 +02:00
Ingo Schommer
a8e0782900 Don't redirect CMS POST requests (fixes #107) 2013-04-26 00:13:46 +02:00
g4b0
0dc7b41539 BUG: added VIEW_LANGS permission in Translatable::providePermissions() 2013-04-12 09:30:57 +02:00
Ingo Schommer
ba31412fa8 Merge pull request #101 from tractorcow/master-querystring-fixes
BUG Cleaner handling of querystring arguments when selecting locale
2013-04-11 00:56:46 -07:00
Ingo Schommer
e2c1a7111e Merge branch '1.0'
Conflicts:
	.travis.yml
	composer.json
2013-04-07 14:26:00 +02:00
Steffen Maaß
9579748e13 FIX: getTranslations should not change the locale-filter-state
If the locale-filter was disabled before calling the method, it would be
enabled after calling getTranslations, this commit now only re-enabled
the locale-filter if it was enabled before calling the method...
2013-04-07 14:23:38 +02:00
cam-findlay
232c187850 merged $allCodes returns items with nested array
items from the common_locales in line 1493 return nested array of "name"=>LangName,"native"=>NativeName.
need to make sure to pull the "name" parameter from the array for the $returnMap.
Otherwise was returning:

[Notice] Undefined offset: 0
2013-03-28 15:26:42 +01:00
Ingo Schommer
5c7682013c Misc 3.1 compat changes
Removed nested_urls check, its the only supported mode now
2013-03-26 13:55:21 +01:00
Ingo Schommer
a3ff187938 Using Config API to retrieve core values (fixes #103)
Required for 3.1 compat
2013-03-26 00:49:58 +01:00
Damian Mooyman
ad791ca5d8 BUG Cleaner handling of querystring arguments when selecting locale 2013-03-21 16:01:03 +13:00
Ingo Schommer
20c2e9a190 Fixed add_extension() and add_to_class() usage 2013-03-19 09:59:08 +01:00
Simon Elvery
68188a3ae8 FIX Retrieve list of translatable fields not database fields 2013-03-06 11:46:20 +10:00
Simon Elvery
6460c089ca NEW Better transformation of form fields (specifically CheckboxField) 2013-02-28 00:53:28 +01:00
Simon Elvery
53a7b6a633 BUG Make original field label translatable 2013-02-28 00:52:52 +01:00
Ingo Schommer
17195d4e86 3.0 compatibibility (Object::has_extension)
SiteTree::has_extension() is only available in 3.1,
split off 3.0 compat branch to avoid deprecation warnings.

See https://github.com/silverstripe/silverstripe-translatable/issues/98#issuecomment-14020318
2013-02-27 10:48:57 +01:00
Josua2012
ffecb6553d Fix Object::has_extension deprecated('xx','xx') 2013-02-01 18:42:32 +01:00
Ingo Schommer
cad776c2f8 BUG Refactored updateCMSFields() logic (can be called repeatedly)
This builds on 44f8180110, but reverts most of it.
The changeset had a logical flaw where it stored state
on the Translatable extension where it was specific to a FieldList.
This meant side effects when getCMSFields() was called more than once,
such as in the CMSSettingsController template.

Note: We shouldn't need to call getCMSFields() more than once
because its an expensive call, but that's a missing feature
in the template caching layer rather than a problem with the
Translatable extension.
2013-01-17 12:19:59 +01:00
Simon Elvery
27208655b9 ENHANCEMENT Don't show translations dropdown if all translations have been created. 2013-01-10 00:39:45 +01:00
Simon Elvery
44f8180110 NEW Make it easier to show original values for custom fields. 2013-01-10 00:35:59 +01:00
Ingo Schommer
9454eb31e5 BUGFIX Include URL action when redirecting in CMS
This broke the CMSMain->publishall() action
2013-01-08 19:52:56 +01:00
Roman
061057ca04 Added a callback hook "onTranslatableCreate" that can be used to create translations of dependent objects 2012-12-17 17:24:24 +01:00
Ingo Schommer
f925a4102e BUG dev/build fails to add extra fields to SiteConfig (fixes #65)
Caused by Translatable->populateSiteConfigDefaults()
triggering before newly created fields are available in the
"SiteConfig" database table.
2012-11-15 13:08:14 +01:00
Ingo Schommer
6413eca05d Merge pull request #70 from lrc/create-member-bugfix
BUGFIX Ensure members can be created with individual locale setting.
2012-11-15 03:38:31 -08:00
Ingo Schommer
9032711ea0 Merge pull request #69 from lrc/hasones-translatable
BUGFIX Allow has_one relationships to be translated.
2012-11-15 03:37:12 -08:00
Simon Elvery
a4df078f9a BUGFIX Ensure members can be created with individual locale setting. 2012-11-13 16:39:36 +10:00
Simon Elvery
2422195945 BUGFIX Allow has_one relationships to be translated.
Fixes #63
2012-11-13 16:08:04 +10:00
Niklas Forsdahl
846398d128 Correct translation for language dropdown field in link form 2012-11-12 15:59:06 +02:00
Niklas Forsdahl
616a123ddc ENHANCEMENT: Add language dropdown for link form
Adds a language dropdown to the link form in the html editor, so that linking
to pages in different locales is possible.
2012-11-12 15:48:06 +02:00
s-m
9d9e2fa3d1 BUG fixed possibly undefined variable, fixes #57 2012-10-13 12:15:04 +02:00
Ingo Schommer
51c7d9e2ef Coding conventions fixes (mostly line length) 2012-10-02 22:34:16 +02:00
Ingo Schommer
00dda353e3 BUG Skip SiteConfig->populateDefaults() on first dev/build 2012-09-22 16:44:52 +02:00
Damian Mooyman
a44546bcdd FIXED: Issue with siteconfig translation incorrectly ignoring canTranslate permissions and crashing
UPDATED: Cleanup and refactoring to make more readable
UPDATED: Translation of siteconfig now better handles singleton(SiteConfig)
UPDATED: Renamed populateSiteConfig to populateSiteConfigDefaults to better reflect its purpose

FIXED: Parameter typing on getStagingSiteConfig

bla
2012-09-22 16:41:09 +02:00
Damian Mooyman
67915ea695 FIXED: Simplified code 2012-09-07 17:08:49 +02:00
Damian Mooyman
91596197ee FIXED: Issue where translation of siteconfigs would create additional objects.
ADDED: Test case assertion
FIXED: Coding convention
2012-09-07 17:08:49 +02:00
Damian Mooyman
1120f2974e FIXED: Crash during dev/build on new database construction 2012-09-07 17:08:48 +02:00
Damian Mooyman
a3b3ec8c4e FIXED: Issue where $enable_siteconfig_generation flag was not being set correctly, causing failed test cases_
FIXED: Duplicate entries in test database
2012-09-07 17:08:48 +02:00
Damian Mooyman
405fa7e3cf FIXED: Allowed hidden "Locale" field to exist in the CMS form for SiteConfig (and other data objects) 2012-09-07 17:08:48 +02:00
Damian Mooyman
9978765abc UPDATED: Refactored Translation module specific code out of the SiteConfig 2012-09-07 17:08:48 +02:00
Ingo Schommer
670575c18a Merge pull request #49 from creamarketing/pages-overview-redirect
BUG: redirect to pages overview not working from page edit view
2012-09-06 13:37:14 -07:00
Niklas Forsdahl
451576f36d BUG: redirect to pages overview not working from page edit view
The redirect to pages overview was not working because the pages overview and page edit views
share the same session namespace, and therefore the checks to see if we need to redirect to
pages overview (i.e. if there is a translated record for the current page) matched also for
the redirected request.

Fixed by checking if we already are on the CMSPagesController before redirecting to it.
2012-09-03 14:40:46 +03:00
Niklas Forsdahl
1c40751d51 BUG: double ajax request for page editing in default locale
When editing a page in the default locale, a double ajax request was done for the editing page.
This was caused by no locale-parameter being set in this case, which caused the default locale
parameter to be added and a new ajax request was made due to this. The extra ajax request caused
the loading-animation to appear after the edit page was loaded, which looks weird.
Fixed by doing a redirect immediately the CMSPagesController is loaded and no locale is set, so
that the default locale parameter gets set at this stage.
2012-09-03 11:10:54 +03:00
Ingo Schommer
c3c9f1f83f BUG Correct GET param name on context menu page add (fixes #45) 2012-08-23 23:06:06 +02:00
Ingo Schommer
f404ad3325 Correct CSS classes for LanguageDropdownField
Chosen wasn't applying because the field holder
didn't have ".dropdown" on it
2012-08-16 23:30:31 +02:00
Ingo Schommer
1eb107bbaf BUG Setting locale on new pages form
Previously creating a new page in non-default locale wasn't
allowed due to this bug.
2012-08-16 09:30:59 +02:00
Ingo Schommer
7d9a802073 BUG Use new ORM methods (fixes #42)
This subtly changes the caching behaviour
where get_one() calls are replaced, results
will be no longer cached. There's no built-in core
way to cache DataList results, so for now we accept
that there's less caching due to this internal change.
2012-08-14 11:25:00 +02:00
Ingo Schommer
6d7700f8f6 BUG Fix admin/myprofile saving
Ignore the extension's init() method being called on
LeftAndMain base class,
which is the case when requests are first routed through
AdminRootController
as an intermediary rather than the endpoint controller
2012-08-14 11:22:42 +02:00
Ingo Schommer
4f433155f1 BUG Check for extensions on record in CMS (fixes #41) 2012-08-13 10:06:12 +02:00
Roland Lehmann
6d7647787e replaced DataObjectSet with DataList as a default value of a function argument 2012-08-11 23:02:35 +02:00
Roland Lehmann
06bb08b594 Added translations for en, en_GB and german 2012-08-11 06:44:33 +02:00
Damian Mooyman
d846a72d39 FIXED: Error where uninitialised Locale field would crash queries. This is noticeable during full text search, when full model fields might not be initialised. 2012-08-09 15:40:11 +12:00
Ingo Schommer
c80f366dd6 BUG Avoid redirecting with duplicate ?locale param 2012-08-07 23:01:39 +02:00
Ingo Schommer
13002cef9f Merge pull request #38 from creamarketing/create-translation-redirect
BUG: Site tree sidebar not updated when creating a new translation
2012-08-07 13:58:40 -07:00
Ruud Arentsen
5b38cc31b8 Translation of SiteConfig
Fixed editing of translated configs, and added a link for the 'add
translation' not working for siteconfigs
2012-08-06 09:39:46 +02:00
Niklas Forsdahl
eaa5555dfc BUG: Site tree sidebar not updated when creating a new translation
The site tree sidebar was not updated when creating a new translation,
due to only CurrentForm and Breadcrumbs fragments being updated by default.

Fixed by explicitly setting the X-Pjax response header to Content on
translation creation.
2012-08-03 13:31:47 +03:00
BLU42 Media
de3e0b0590 remove PR_MEDIUM from _t() call in providePermissions() function 2012-07-18 15:11:25 -07:00
Ingo Schommer
7e1b7a6240 BUG Redirect on mixed locale/record URLs
Avoids e.g. the pages tree showing two languages at once.
2012-07-16 23:35:28 +02:00
Ingo Schommer
1a4b284b32 Fixed deprecated function usage (#33) 2012-07-04 18:00:45 +02:00
BLU42 Media
01a61f48a4 fixed typo in function call 2012-07-02 16:03:36 -07:00
Ingo Schommer
f1deebe975 BUG New add_to_class() ext registration compat with 3.0 2012-06-29 15:00:11 +02:00
pasinter
2662571607 bugfix - use $form->getName() instead of deprecated $form->Name() 2012-06-14 22:54:25 +12:00
Ingo Schommer
610874755c BUGFIX 3.0 compatibility: Query manipulation, CMS links, separation of settings fields, new place for language selector on tree 2012-05-15 23:04:57 +02:00
Chris Bryer
baa7566933 modified MetaTags function to provide absolute links instead of using normal Link() method. This improves compatibility with the Translatable-Domains module and would provide accurate alternate href's to other locales that use different subdomains or TLD's. 2012-02-22 22:44:03 -05:00
Sebastian Mares
658cac4df6 Copy values to keys in updateCMSFields' $alreadyTranslatedLocales since it's later used by LanguageDropdownField to exclude languages for which a translation already exists and LanguageDropdownField operates on array keys.
Also removed unused index/key variable $i from foreach loop that displays the existing translations.
2012-02-12 21:58:28 +01:00
Ingo Schommer
edcb9ae582 BUGFIX Added Translatable->updateSettingsFields(), fixed related unit test 2011-05-02 08:30:40 +12:00
Ingo Schommer
7348ce7077 MINOR Subclassing from DataExtension instead of DataObjectDecorator 2011-05-01 22:29:20 +12:00
Ingo Schommer
181bb07f4c BUGFIX Fixed createtranslation action (broken after moving to extension) 2011-03-23 10:15:49 +13:00
Ingo Schommer
e40b5f909b MINOR Fixed @package 2011-03-23 10:15:23 +13:00
Ingo Schommer
2a3cc650dc MINOR Initial commit, moved files from 'sapphire' and 'cms' modules 2011-03-22 22:18:48 +13:00