Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lfeditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TYPO3
lfeditor
Commits
e2a12ace
Commit
e2a12ace
authored
Mar 20, 2015
by
damjan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE] File Edit - Adding reference language selector
For reference languages are chosen only translated languages.
parent
f8b38898
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
10 deletions
+29
-10
Classes/Controller/AbstractController.php
Classes/Controller/AbstractController.php
+6
-1
Classes/Controller/EditFileController.php
Classes/Controller/EditFileController.php
+11
-4
Classes/Service/ConfigurationService.php
Classes/Service/ConfigurationService.php
+7
-1
Resources/Private/Partials/SelectReferenceLanguage.html
Resources/Private/Partials/SelectReferenceLanguage.html
+4
-4
Resources/Private/Templates/EditFile/EditFile.html
Resources/Private/Templates/EditFile/EditFile.html
+1
-0
No files found.
Classes/Controller/AbstractController.php
View file @
e2a12ace
...
...
@@ -81,11 +81,13 @@ abstract class AbstractController extends ActionController {
* @param string $constantSelection
* @param string $languageSelection
* @param string $constantTypeSelection
* @param string $bottomReferenceLanguageSelection
* @return void
*/
protected
function
saveSelectionsInSession
(
$extensionSelection
=
NULL
,
$languageFileSelection
=
NULL
,
$referenceLanguageSelection
=
NULL
,
$constantSelection
=
NULL
,
$languageSelection
=
NULL
,
$constantTypeSelection
=
NULL
$constantSelection
=
NULL
,
$languageSelection
=
NULL
,
$constantTypeSelection
=
NULL
,
$bottomReferenceLanguageSelection
=
NULL
)
{
/* Extension/language file select box can't be unselected.
Only situation when $extensionSelection === NULL is when the form is submitted by
...
...
@@ -108,6 +110,9 @@ abstract class AbstractController extends ActionController {
if
(
$constantTypeSelection
)
{
$this
->
session
->
setDataByKey
(
'constantTypeSelection'
,
$constantTypeSelection
);
}
if
(
$bottomReferenceLanguageSelection
)
{
$this
->
session
->
setDataByKey
(
'bottomReferenceLanguageSelection'
,
$bottomReferenceLanguageSelection
);
}
}
/**
...
...
Classes/Controller/EditFileController.php
View file @
e2a12ace
...
...
@@ -69,6 +69,11 @@ class EditFileController extends AbstractBackendController {
);
$this
->
assignViewWidthMenuVariables
(
'referenceLanguage'
,
$referenceLanguageOptions
);
$bottomReferenceLanguageOptions
=
$this
->
configurationService
->
menuLangList
(
$langData
,
''
,
$this
->
backendUser
,
TRUE
);
$this
->
assignViewWidthMenuVariables
(
'bottomReferenceLanguage'
,
$bottomReferenceLanguageOptions
);
$constantTypeOptions
=
$this
->
getConstantTypeOptions
();
$this
->
assignViewWidthMenuVariables
(
'constantType'
,
$constantTypeOptions
);
...
...
@@ -88,16 +93,17 @@ class EditFileController extends AbstractBackendController {
* @param string $languageSelection
* @param string $referenceLanguageSelection
* @param string $constantTypeSelection
* @param string $bottomReferenceLanguageSelection
* @throws UnsupportedRequestTypeException
* @return void
*/
public
function
changeSelectionAction
(
$extensionSelection
=
NULL
,
$languageFileSelection
=
NULL
,
$languageSelection
=
NULL
,
$referenceLanguageSelection
=
NULL
,
$constantTypeSelection
=
NULL
$referenceLanguageSelection
=
NULL
,
$constantTypeSelection
=
NULL
,
$bottomReferenceLanguageSelection
=
NULL
)
{
$this
->
saveSelectionsInSession
(
$extensionSelection
,
$languageFileSelection
,
$referenceLanguageSelection
,
NULL
,
$languageSelection
,
$constantTypeSelection
$constantTypeSelection
,
$bottomReferenceLanguageSelection
);
$this
->
redirect
(
'editFile'
,
NULL
,
NULL
,
array
(
'buttonType'
=>
0
));
}
...
...
@@ -130,8 +136,9 @@ class EditFileController extends AbstractBackendController {
$langEdit
=
is_array
(
$langData
[
$langList
])
?
$langData
[
$langList
]
:
array
();
$langPattern
=
is_array
(
$langData
[
$patternList
])
?
$langData
[
$patternList
]
:
array
();
$langDefault
=
is_array
(
$langData
[
$extConfig
[
'defaultLanguage'
]])
?
$langData
[
$extConfig
[
'defaultLanguage'
]]
:
array
();
$bottomReferenceLanguageSelection
=
$this
->
session
->
getDataByKey
(
'bottomReferenceLanguageSelection'
);
$langDefault
=
is_array
(
$langData
[
$bottomReferenceLanguageSelection
])
?
$langData
[
$bottomReferenceLanguageSelection
]
:
array
();
if
(
empty
(
$langDefault
))
{
$langDefault
=
is_array
(
$langData
[
'en'
])
?
$langData
[
'en'
]
:
array
();
}
...
...
Classes/Service/ConfigurationService.php
View file @
e2a12ace
...
...
@@ -276,9 +276,12 @@ class ConfigurationService extends AbstractService {
* @param array $langData language data
* @param string $default optional default value (if you dont want a default let it empty)
* @param BackendUserAuthentication $backendUser
* @param bool $translatedLanguagesOnly looks only for translated languages
* @return array
* @throws LFException
*/
public
function
menuLangList
(
$langData
,
$default
=
''
,
BackendUserAuthentication
$backendUser
=
NULL
)
{
public
function
menuLangList
(
$langData
,
$default
=
''
,
BackendUserAuthentication
$backendUser
=
NULL
,
$translatedLanguagesOnly
=
FALSE
)
{
// build languages
$languageArray
=
$this
->
getLangArray
(
$backendUser
);
$langList
=
array
();
...
...
@@ -287,6 +290,9 @@ class ConfigurationService extends AbstractService {
if
(
is_array
(
$langData
[
$lang
]))
{
$constCount
=
count
(
$langData
[
$lang
]);
}
if
(
$translatedLanguagesOnly
&&
$constCount
<=
0
)
{
continue
;
}
$langList
[
$lang
]
=
$lang
.
' ('
.
$constCount
.
' '
.
LocalizationUtility
::
translate
(
'const.consts'
,
'lfeditor'
)
.
')'
;
}
...
...
Resources/Private/Partials/SelectReferenceLanguage.html
View file @
e2a12ace
{namespace lfe=SGalinski\Lfeditor\ViewHelpers}
<lfe:extendedIf
condition=
"{languageFileSelection}"
and=
"{
r
eferenceLanguageOptions}"
>
<lfe:extendedIf
condition=
"{languageFileSelection}"
and=
"{
bottomR
eferenceLanguageOptions}"
>
<h2
class=
"uppercase"
>
<f:translate
key=
"select.referenceLanguage"
/>
</h2>
<f:form.select
name=
"
r
eferenceLanguageSelection"
value=
"{
r
eferenceLanguageSelection}"
options=
"{
r
eferenceLanguageOptions}"
<f:form.select
name=
"
bottomR
eferenceLanguageSelection"
value=
"{
bottomR
eferenceLanguageSelection}"
options=
"{
bottomR
eferenceLanguageOptions}"
additionalAttributes=
"{onchange: 'submitForm(\'mainMenuForm\')'}"
/>
</lfe:extendedIf>
\ No newline at end of file
Resources/Private/Templates/EditFile/EditFile.html
View file @
e2a12ace
...
...
@@ -6,6 +6,7 @@
<f:render
partial=
"SelectExtensionAndLanguageFile"
arguments=
"{_all}"
/>
<f:form
id=
"mainMenuForm"
action=
"changeSelection"
>
<f:render
partial=
"SelectLanguageAndReference"
arguments=
"{_all}"
/>
<f:render
partial=
"SelectReferenceLanguage"
arguments=
"{_all}"
/>
<f:if
condition=
"{constantTypeOptions}"
>
<h2
class=
"uppercase"
>
<f:translate
key=
"select.constantType"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment