Upgraded Website to TYPO3 V. 10. With this changed from rtehtmlarea to ckeditor. Works well. But I used data from REGISTER as Variable in the RTE text: {REGISTER:heute}. But now there is no output. The corresponding Typoscript-Setup was(is)
lib.parseFunc_RTE.nonTypoTagStdWrap.encapsLines.innerStdWrap_all.insertData = 1
tt_content.text.12 = LOAD_REGISTER
tt_content.text.12.heute = TEXT
tt_content.text.12.heute {
data = date:U
strftime = %d.%m.%Y
}
tt_content.text.21 = RESTORE_REGISTER
tt_content.text.22 = RESTORE_REGISTER
Is there a similar easy solution with ckeditor?
Related
I'm developing a multi language website with Typo3 v10.4.32.
Everything works fine. Except image metadata translation feature.
I uploaded an image, and I added translation for metadata (German is default)
After then I added page translation. In backend I see that images have default language metadata in both languages
If I click the image element to edit I see the correct behaviour: Typo3 is aware that the image has translation of metadata
In frontend unfortunately I see the problem: the default language metadata is shown
Typoscript template is simple:
config {
linkVars = L
sys_language_mode = content_fallback
sys_language_overlay = 1
sys_language_softExclude = tt_content:image
sys_language_softMergeIfNotBlank = tt_content:image
sys_language_uid = 0
}
# Default PAGE object:
page = PAGE
page.10 = TEXT
page.10.value = HELLO WORLD!
page.20 = CONTENT
page.20.table = tt_content
page.20.select {
orderBy = sorting
where = {#colPos} = 0
}
[siteLanguage("languageId") == 1]
config.sys_language_uid = 1
config.htmlTag_langKey = en
config.language = en
config.locale_all = en_US
[end]
Is the code below necessary ? since it is configured in yaml file
config.sys_language_uid = 1
config.htmlTag_langKey = en
config.language = en
config.locale_all = en_US
I could add translation in content elements, but images are supposed to be used in many places, so it becomes annoying to add the same text
I tried to search a solution, but I found very old similar issue with Typo3 v7 and the issue was supposed to be fixed in the next version Typo3 v8.
I suppose that the problem does not connect to NGINX ?
Maybe I need to add some code in LocalConfiguration ?
Kendo UI 2015.2.805 Kendo UI Editor for Jacascript
I want to extend the kendo ui editor by adding a custom tool that will convert a user selected block that spans two or more paragraphs into block of single spaced text. This can be done by locating all interior p tags and converting them into br tags, taking care not to change the first or last tag.
My problem is working with the range object.
Getting the range is easy:
var range = editor.getRange();
The range object has a start and end container, and a start and end offset (within that container). I can access the text (without markup)
console.log(range.toString());
Oddly, other examples I have seen, including working examples, show that
console.log(range);
will dump the text, however that does not work in my project, I just get the word 'Range', which is the type of the object. This concerns me.
However, all I really need however is a start and end offset in the editor's markup (editor.value()) then I can locate and change the p's to br's.
I've read the telerik documentation and the referenced quirksmode site's explanation of html ranges, and while informative nothing shows how to locate the range withing the text (which seems pretty basic to me).
I suspect I'm overlooking something simple.
Given a range object how can I locate the start and end offset within the editor's content?
EDIT: After additional research it appears much more complex than I anticipated. It seems I must deal with the range and/or selection objects rather than directly with the editor content. Smarter minds than I came up with the range object for reasons I cannot fathom.
Here is what I have so far:
var range = letterEditor.editor.getRange();
var divSelection;
divSelection = range.cloneRange();
//cloning may be needless extra work...
//here manipulate the divSelection to how I want it.
//divSeletion is a range, not sure how to manipulate it
var sel = letterEditor.editor.getSelection()
sel.removeAllRanges();
sel.addRange(divSelection);
EDIT 2:
Based on Tim Down's Solution I came up with this simple test:
var html;
var sel = letterEditor.editor.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
html = container.innerHTML;
}
html = html.replace("</p><p>", "<br/>")
var range = letterEditor.editor.getRange();
range.deleteContents();
var div = document.createElement("div");
div.innerHTML = html;
var frag = document.createDocumentFragment(), child;
while ((child = div.firstChild)) {
frag.appendChild(child);
}
range.insertNode(frag);
The first part, getting the html selection works fine, the second part also works however the editor inserts tags around all lines so the result is incorrect; extra lines including fragments of the selection.
The editor supports a view html popup which shows the editor content as html and it allows for editing the html. If I change the targeted p tags to br's I get the desired result. (The editor does support br as a default line feed vs p, but I want p's most of the time). That I can edit the html with the html viewer tool lets me know this is possible, I just need identify the selection start and end in the editor content, then a simple textual replacement via regex on the editor value would do the trick.
Edit 3:
Poking around kendo.all.max.js I discovered that pressing shift+enter creates a br instead of a p tag for the line feed. I was going to extend it to do just that as a workaround for the single-space tool. I would still like a solution to this if anyone knows, but for now I will instruct users to shift-enter for single spaced blocks of text.
This will accomplish it. Uses Tim Down's code to get html. RegEx could probably be made more efficient. 'Trick' is using split = false in insertHtml.
var sel = letterEditor.editor.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
var block = container.innerHTML;
var rgx = new RegExp(/<br class="k-br">/gi);
block = block.replace(rgx, "");
rgx = new RegExp(/<\/p><p>/gi);
block = block.replace(rgx, "<br/>");
rgx = new RegExp(/<\/p>|<p>/gi);
block = block.replace(rgx, "");
letterEditor.editor.exec("insertHtml", { html: block, split: false });
}
I have a Model that stores a FileReference. And now I want to create an Image with a Watermark in the Extbase Controller. Does anybody know where I have to look for? I only found solutions with typoscript.
I choosed the TypoScript way and it worked pretty well.
Fluid:
<f:cObject typoscriptObjectPath="lib.tx_myext.watermarkedImage" data="{imageUid:'{image.uid}',copyright:'{image.copyright}')}'}"/>
TypoScript:
lib.tx_myext.watermarkedImage = IMAGE
lib.tx_myext.watermarkedImage {
file = GIFBUILDER
file {
XY = [10.w],[10.h]
format = jpg
10 = IMAGE
10 {
file {
import.field = imageUid
treatIdAsReference = 1
width = 1162
height = 580c
}
}
20 = BOX
20 {
color = #FFFFFF
opacity = 70
dimensions = [10.w]-[30.w]-10,[10.h]-20,[30.w]+20,[30.h]+20
}
30 = TEXT
30 {
text.data = field:copyright
fontSize = 15
fontColor = #000000
fontFile = path/to/my/font.ttf
offset = [10.w]-[30.w]-5,[10.h]-5
}
}
}
The result is an image with a white box and the copyright text on it at the right bottom corner.
I think the easiest way will be to use a typoscript solution. This must not be as pure typoscript, but the datastructure of the typoscript might be needed as parameter to the core functions of the GifBuilder class. TYPO3 7.6 API
The GifBuilder class is inherited from the class GraphicalFunctions which can be used also, as there are only a few additions and the main functionality is here.
The last problem are the examples in the net according this task: they are pibased and all of them end up in something like
$img = $this->cObj->IMAGE($typoScriptArray);
in modern (namespaced) notation using current API this would be:
$gifCreator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\GifBuilder::class);
$gifCreator->init();
$theImage='';
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
$gifCreator->start($fileArray, $typoScriptArray);
$theImage = $gifCreator->gifBuild();
}
I want to change the style / the theme of my report based on the User.
All my User have a UserGroup. My UserGroup has custom style.
All this information are in the DB.
UserStyle: ID | ID UserGroup | LOGO | Style 1 | Color 1 | ect..
I want change my report style with those informations.
I know it is possible to give my item a style name.
But Can i define it in the main report Code behind.
Bonus: Can I do this Only once for the Main Report?
Basically using Style Name as a CssClass.
1. The programmer solution
If you have an aversion for the GUI, This is made for you !
The 1rst is the worst, but the 1rst work around I came up with.
Style in a telerik report can be define in a StyleRules.
In order to manage the theme based on the user you can use a ReportParameter.
Telerik.Reporting.Drawing.StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();
styleRule1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
new Telerik.Reporting.Drawing.StyleSelector("MyStyle")});
if( reportParameter1.Value == "StyleUser1")
{
styleRule1.Style.Padding.Left = Telerik.Reporting.Drawing.Unit.Point(2D);
styleRule1.Style.Padding.Right = Telerik.Reporting.Drawing.Unit.Point(2D);
styleRule1.Style.BackgroundColor = System.Drawing.Color.Blue;
styleRule1.Style.Color = System.Drawing.Color.White;
styleRule1.Style.Font.Bold = true;
styleRule1.Style.Font.Name = "Segoe UI";
}
else {
//default style
}
You can add the Style name to you element from the designer or from the constructor.
this way:
this.textBox2.StyleName = "MyStyle";
You can create your style rules in the designer and only assign the style to the component in your initialise component.
if( reportParameter1.Value == "StyleUser1")
{
this.textBox1.StyleName = "MyStyle";
this.textBox2.StyleName = "MyStyle";
this.textBox3.StyleName = "MyStyle";
}
else {
//default style
}
2. The Designer GUI
Design all your style rules
Export them using.
Exporting and Reusing Style Sheets
You can bind them in your code behind , filtering on a parameter.
Or just add them in your calling apps.
TYPO3 7.6.4
I have several backendlayouts and also one gridelement for 2col.
Now I limit the available cTypes for each column like this:
(just an example)
mod {
web_layout {
BackendLayouts {
Home {
title = Home
config {
backend_layout {
colCount = 1
rowCount = 3
rows {
1 {
columns {
1 {
name = Slider
colPos = 1
colspan = 1
allowed = custom_slider
}
}
}
2 {
columns {
1 {
name = Content
colPos = 0
colspan = 1
allowed = header, html, shortcut
}
}
}
}
}
}
icon = icon/path
}
...
For the columns slider it works just fine.
FOr column content the NewContentWizard shows this 3 Elements, but when I add one, the only element that is allowed (listed in the cType dropdown) is "header" - in that case - so in general its the first cType from allowed.
Does anyone can reproduce or now what's the problem? Otherwise it could be a bug and I'll report it.
Thanks for any feedback or solution!
Kind regards
Tobi
Here's a compact way to manage the "New Content Element Wizard" via the core / Page TSConfig:
// remove everything
mod.wizards.newContentElement.wizardItems.common.show =
mod.wizards.newContentElement.wizardItems.special.show =
mod.wizards.newContentElement.wizardItems.forms.show =
mod.wizards.newContentElement.wizardItems.plugins.show =
// add additional tabs like mask if available
// add specific - by colPos and backend_layout (if needed)
[globalVar = GP:colPos==0]&&[page|backend_layout = 0]
mod.wizards.newContentElement.wizardItems.common.show := addToList(header)
[end]
The problem was that I put whitespaces into the list...
so changing
allowed = header, html, shortcut
into
allowed = header,html,shortcut
works like expacted.
You could also use this code, which only keeps the selected items. This also removes plugins and items in other tabs
[globalVar = GP:colPos==0]&&[page|backend_layout = 0]
TCEFORM.tt_content.CType.keepItems := addToList(header)
[end]