B2C custom UI based,on parameter - user-interface

Perhaps I am missing something but here is my problem.
Say I create multiple containers for custom UI.
https://your-storage-account.blob.core.windows.net/container1/customize-ui.html
https://your-storage-account.blob.core.windows.net/container2/customize-ui.html
...
https://your-storage-account.blob.core.windows.net/containerN/customize-ui.html
then i define in custom policy extension file the following
<ContentDefinitions>
<ContentDefinition Id="api.signuporsignin">
<LoadUri>https://your-storage-account.blob.core.windows.net/templates/{oauth-kv:containerName}/customize-ui.html</LoadUri>
<RecoveryUri>~/common/default_page_error.html</RecoveryUri>
<DataUri>urn:com:microsoft:aad:b2c:elements:unifiedssp:1.0.0</DataUri>
<Metadata>
<Item Key="DisplayName">Signin and Signup</Item>
</Metadata>
</ContentDefinition>
</ContentDefinitions>
when parameter is passed say 'containerName=container1' all is good and my UI looks like the one defined by files from container1
https://your-storage-account.blob.core.windows.net/templates/container1/customize-ui.html
but if parameter is not specified i want to use some default container say 'default', is there a way to do that?
as of now if parameter is not specified i get error since the resulting url would look like this:
https://your-storage-account.blob.core.windows.net/templates//customize-ui.html
having '//' is a culprit.
anyone had to deal with similar challenge? am i approaching it entirely wrong?
thank you
Mark

Related

Configure sonar.issue.ignore.multicriteria for multiple paths

I want to disable a SonarQube rule for multiple files at different paths. Also I want to make this configuration within the pom.xml and to through the Sonar UI.
I couldn't find any clue on how to do this. My best guess is that I have to create multiple rules:
<sonar.issue.ignore.multicriteria>e1,e2</sonar.issue.ignore.multicriteria>
<!-- disable rule on naming convention -->
<sonar.issue.ignore.multicriteria.e1.ruleKey>
java:S117
</sonar.issue.ignore.multicriteria.e1.ruleKey>
<sonar.issue.ignore.multicriteria.e1.resourceKey>
firstPath
</sonar.issue.ignore.multicriteria.e1.resourceKey>
<sonar.issue.ignore.multicriteria.e2.ruleKey>
java:S117
</sonar.issue.ignore.multicriteria.e2.ruleKey>
<sonar.issue.ignore.multicriteria.e2.resourceKey>
secondPath
</sonar.issue.ignore.multicriteria.e2.resourceKey>
I was wondering if there was a more compact way to do this. I was thinking of something like this:
<sonar.issue.ignore.multicriteria>e1</sonar.issue.ignore.multicriteria>
<!-- disable rule on naming convention -->
<sonar.issue.ignore.multicriteria.e1.ruleKey>
java:S117
</sonar.issue.ignore.multicriteria.e1.ruleKey>
<sonar.issue.ignore.multicriteria.e1.resourceKey>
firstPath, secondPath
</sonar.issue.ignore.multicriteria.e1.resourceKey>
However I have no idea if this syntax will be accepted or not. I guess I should try it, but I'd rather not since in order to test it I would need to push the change to my CI server.
This seems not to be supported according to config in answer https://stackoverflow.com/a/63632140/7251133
I agree it would be really nice when lists would be allowed in rule and resource.

In Spring boot, I'm trying to create another .property file that functions like messages.property, Is that possible?

So I'm trying to create another .property file (called labels.properties) that i can use in Thymeleaf like this:
<div th:text=#{property.from.labels}></div>
Right now I just add labels.properties in the root of resource folder, for now its not working. The purpose of this is I want to separate the property file that handles the error messages from texts for labels & buttons.
Is that possible?
if yes, how to do it?
if yes again, can I do internationalization like adding labels_ja.properties (Japanese)?
You can customize the naming (and location) of the message bundles by configuring the spring.messages.basename property. For example:
spring.messages.basename=labels
By doing so, Spring will look for messages within classpath:labels.properties and classpath:labels_{locale}.properties, such as classpath:labels_ja.properties.
If you want to use this in addition to the regular messages.properties, you can use a comma separated value:
spring.messages.basename=messages,labels
The first one within that comma separated list will take priority over the other ones. If you have a property.from.labels in both messages.properties and labels.properties, the one within messages.properties would be chosen in this example.
This can also be found within the documentation about internationalization.

How do I access this variable from a different blueprint?

I have found loads of stuff like this on the Internet, but none of it is helping me and I would just love a direct response for this situation.
I have a text UI for my ammo which I simply want to access from the blueprint that handles firing. The text UI has a variable associated with it (At least, I assume this is my text UI):
But for unknown reasons won't let me make it public. That doesn't seem to matter though, because I have experimented with other public variables and I can't access them from my blueprint either!
How can I get access to my variable here so I can do what I wish?
I found your other questions so I assume you're using 4.12, like myself.
So I can use the variable declared in UMG as follows:
Step 1, make a text block, enable it as Is Variable:
Step 2, check it from the Graph part:
Step 3, some other Blueprint, use it:

Bitrix CMS, how to get cached data based on GET parameter in template of standart component?

I'm working with a component bitrix:catalog (which is standard one) and faced an issue. I want to add some extra GET parameters to switch view mode. I think there is no need to rewrite whole component to make such switcher, so I added extra keys in result_modifier in a way similar to:
$this->__component->arResultCacheKeys = array_merge($this->__component->arResultCacheKeys, array('key1', "key2"));
Earlier in the same result_modifier I perform adding those extra keys in $arResult['key1'] etc. They seem to be correctly saved, but only for current inquiry such as ?view=list or view=card, that means only one variable value is saved and it does not react on changing of GET parameter. Is there simple and correct way to make that component to cache and to output data based on GET variable? The only idea which came to my mind is to rewrite component by adding extra parameter and checking of GET, but I think there must more simple and correct solution to make in via template. Human Readable Links are turned on. And I want to have auto-cash being turned on as well. If I turn it off it starts working as planned.
One of possible solutions is to rewrite it cache by SetTemplateCachedData but it still seems to me rough and incorrect way for such simple task.
Bitrix masters please help me to find correct solution, google can't help at the moment.
If you use standard bitrix:catalog component, you may be use standart bitrix:catalog.section. In that component.php used standart component cache.
That means you can describe additional parametr in you custom .parameters.php, and set it in bitrix:catalog.section params.
Standart component cache set cacheId based on arParams.
So you include component should look like this:
$APPLICATION->IncludeComponent(
"bitrix:catalog.section",
"",
array(
"IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
"IBLOCK_ID" => $arParams["IBLOCK_ID"],
"ELEMENT_SORT_FIELD" => $arParams["ELEMENT_SORT_FIELD"],
"ELEMENT_SORT_ORDER" => $arParams["ELEMENT_SORT_ORDER"],
....
....
"NEW_ADDITIONAL_GET_PARAMS"=> $_GET['view']
),
$component
);
Of course better way somethink like
"NEW_ADDITIONAL_GET_PARAMS"=> (in_array($_GET['view'],array('list','card'))?$_GET['view']:'list')
But may be you need just set right catalog params: SEF_MODE SEF_FOLDER SEF_URL_TEMPLATES

Symfony translation inside validation won't work

If I try to use translations inside validation like described here
http://inchoo.net/tools-frameworks/symfony2-translating-validator-messages/
I get always
not.blank.username
as output on Error. It seems like symfony didn't find the message-translation. I placed all my translationfiles inside app/ressources/translations and they are named as
messages.de.yml
....
What am I doing wrong? Do I have to place the translationfiles insde each Bundle?
Kind regards
EDIT: Problem ist clear and fixed, but when I try to use "MinLength" I get an strange error:
Attempted to load class "MinLength" from namespace
"Symfony\Component\Validator\Constraints" in /var/www/symfony/webprojekt/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php line 64.
Do you need to "use" it from another namespace?
I already included
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\MinLength;
use Symfony\Component\Validator\Constraints\MaxLength;
AM I missing something?
To translate validation messages you need to create files with the following name structure inside translations folder:
validators.LANG.yml
Also, you can check in your config.yml, inside framework, if exists the translator:
framework:
translator: { fallback: %locale% }
This is required.
The accepted answer applies to using the magical default translation domain for the validator config. You can also override this in config/packages/validator.yaml
framework:
validation:
enable_annotations: true
translation_domain: 'validations'
Then in translations/ make a file validations.LANG.yaml, for example translations/validations.en.yaml. You don't need to do this but sometimes it's better to explicitly set these magical bit and know where they're coming from.

Resources