typo3 text and media open images as lightbox - typo3

is it possible to open a text and media image in a lightbox?
What I want is that all linked images in text & media automaticall open as a lightbox
thanks in advance

You have a constant for it in fluid_styled_content : styles.content.textmedia.linkWrap.lightboxEnabled = 1.

Class and rel attributes can be also helpful.
In your constans add falowing code:
styles.content {
textmedia {
linkWrap.newWindow = 0
linkWrap.lightboxEnabled = 1
linkWrap.lightboxCssClass = class--name
linkWrap.lightboxRelAttribute = lightbox[{field:uid}]
}
}

To globally enable Lightbox ("Enlarge on Click" checkbox which is
available in the content element text & media), You can set default values for backend forms using UserTS or PageTS configurations.
You just need to write the below code there :
TCAdefaults.tt_content.image_zoom = 1
This enables each new "text & media" content element's checkbox "Enlarge on Click" will be checked by default. So whenever any new text & media content added from backend have lightbox option is set by default.

Related

TYPO3 Powermail - Methods to add a link in a checkbox label or title

Since powermail 6.0. it's possible to add a link in a checkbox label (for GDPR) as per the docu:
https://docs.typo3.org/typo3cms/extensions/powermail/ForAdministrators/Privacy/Index.html#add-a-link-in-a-checkbox-label.
It says:
Just use an option in your FlexForm like (with an example link to page 123 where the privacy terms are located):
I accept the <f:link.page pageUid="123">privacy terms</f:link.page> | privacy terms accepted
After that you have to enable html in labels (this feature is turned off for security reasons). Example TypoScript constants:
plugin.tx_powermail.settings.misc.htmlForLabels = 1
... yet it also says that '(this feature is turned off for security reasons)'.
What other options are there to accomplish this? (with no security loss?)
We add a normal content element with the link above the checkbox. For example to accept the terms and conditions. Then the content element is included in the form. See https://docs.typo3.org/typo3cms/extensions/powermail/ForEditors/AddANewForm/FieldContentElement/Index.html
You can enable it in:
Template - > Constant Editor - > Powermail_Aditional - > Allow html in html fields/ Allow html in field labels
Then you can use HTML-Code. Or better:
<f:link.page pageUid="123">Privacy Policy</f:link.page>
1) The solution with the content element is a good thing - that should also be described
2) It's wrong that powermail version 6.0 is needed to disable the IP-storing. This feature is available for years now but 6.0 turns it off by default
3) If you trust your editors or if you already allow your editors to add content elements of type HTML it's really also no problem to allow HTML in powermail field labels for your editors
Maybe I should update the privacy documenation to clearify this points
This solution appears again and again at the top of Google. But the name is edit!
here for the new Powermail Version:
plugin {
tx_powermail {
settings {
misc {
htmlForHtmlFields = 1
htmlForLabels = 1
}
}
}
}
You can set link in checkbox lable or title like,
I accept the privacy terms
in powermail/Resources/Private/Partials/Form/Field/Check.html
Change code
<vh:string.RawAndRemoveXss>{setting.label}</vh:string.RawAndRemoveXss>
to
<f:format.raw>{setting.label}</f:format.raw>

AEM Forms (PDF Type) File Attachments

I am trying to implement file attachment to my AEM Form. The idea is to embed the attachment to the PDF; Upon submission of the PDF, the backend system will be able to extract the attached file from the PDF.
I can't seem to find any example on how I can go about doing it, which make me wonder is it a limitation. However, on adobe site below, it is actually stated "Support for file attachments" for all AEM form types.
https://helpx.adobe.com/aem-forms/6/introduction-aem-forms.html
Please advice! Thanks!
You can upload, preview, and submit attachments with HTML5 forms. By default, the attachment support is disabled. To enable the attachment support:
1- Create a custom profile with mutiselect string property mfAttachmentOptions.
2- In the custom profile, specify properties fileSizeLimit, multiSelect, and buttonText to configure options of the file attachment widget. As required, you can also specify more custom properties.
3- In the custom profile, use the following configurations:
multiSelect -> true or false (true by default)
fileSizeLimit -> value_in_mb (say 5) (2 MBs by default)
buttonText -> Button text for pop-up window ("Attach" by default)
accept -> file types to accept ("audio/, video/, image/, text/, .pdf" by default)
4- Use the metadata editor to select the custom profile that you have created above for HTML 5 forms.
5- Render your form template with custom profile and the attachments icon would appear on the forms toolbar.
6- Click the attachment icon, an attachment selection dialog box appears. Browse and select the attachment and click Attach.
When attachments are enabled, HTML5 form submits multipart data. The mutli-part submission data has two parts dataXml and attachments.
Reference: https://helpx.adobe.com/aem-forms/6-1/html5-forms/enabling-attachments-html5-form.html
Below is the code for "Add Attachment" button.
var oDoc = event.target;
var doccount = parseInt(colhead.attcount.rawValue);
colhead.attcount.rawValue = doccount + 1;
Trusted_ImportDataObject(oDoc, doccount);
var oAttachment = oDoc.getDataObject("attachment_" + doccount);
var DOsize = oAttachment.size;
var DOmimeType = oAttachment.MIMEType;
if (DOmimeType == null) DOmimeType = "reject";
if ((DOsize > 1100000) || (DOmimeType.indexOf("image/") != 0)) {
xfa.host.messageBox("Attachemtns must be an image and smaller than 1 Megabyte");
oDoc.removeDataObject("attachment_" + doccount);
} else {
var attachPath = oAttachment.path;
AttachFileName.rawValue = attachPath;
AttachMIMEType.rawValue = oAttachment.MIMEType;
AttachHref.rawValue = oAttachment.name;
}
Do note that Reader Extension is needed to enable file attachment. Else you will be getting this error:
NotAllowedError: Security settings prevent access to this property or method.
Doc.importDataObject:6:XFA:CTR[0]:Page6[0]:part6[0]:body[0]:attachitem[0]:AddAttachment[0]:click

TYPO3 Remove "Select & Upload Files" button

Removing the "Select & Upload Files" button from Page properties works with the following line in PageTSConfig:
TCEFORM.pages.media.config.appearance.fileUploadAllowed = 0
Now I want to remove the "Select & Upload Files" button within content elements (for example with CType "textmedia"), too.
I tried out several things, but with no success. I found no working PageTSConfig "rule" for this case. Does somebody know how the "Select & Upload Files" button can be removed for content elements like textmedia elements?
Using TYPO3 8.7.1
The code you use is always the same.
In PageTsConfig you have to use:
TCEFORM.[TABLE].[COLUMN].config.appearance.fileUploadAllowed = 0
In TCA you have to use:
$GLOBALS['TCA']['TABLE']['columns']['COLUMN']['config']['appearance']['fileUploadAllowed'] = 0;
You have to replace TABLE with the table you want to modify and COLUMN with the column you want to modify.
In page properties you have pages as TABLE and media as COLUMN.
In textmedia you have tt_content as TABLE and assets (i think) as COLUMN.
You can set for each field separately, see post from Kevin Appelt. In this case you need to remember for any further field in future to add this setting too.
To adapt file upload for all fields globaly, you can use UserTSConfig edit_docModuleUpload. See https://docs.typo3.org/typo3cms/TSconfigReference/singlehtml/Index.html#document-UserTsconfig/Setup/Index
To avoid file upload for all fields simple add to ext_localconf.php of your customer extension (sitepackage):
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('setup.override.edit_docModuleUpload = 0');
If you want use a separate configuration file for UserTSConfig, which I recommend add to ext_localconf.php
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:sitepackage/Configuration/TypoScript/User/Default.ts">');
and in your extension /Configuration/TypoScript/User/Default.ts
setup.override.edit_docModuleUpload = 0
If you also want exclude file upload and folder creation in file element browser (popup window) add following code to your extension /Configuration/TypoScript/User/Default.ts
# Hide 'file upload' and 'create folder' in link- and element browser
options.folderTree.uploadFieldsInLinkBrowser = 0
options.folderTree.hideCreateFolder = 1
options.createFoldersInEB = 1
This is a very simple way to remove "Select & Upload Files" button
User settings -> Edit and Advanced functions -> File upload directly
in Doc-module(uncheck this checkbox)

tt_news: fancybox for images inserted in RTE

Users should be able to insert images on a news. If they are inserted they should open with fancybox. Therefore I installed jqfancybox. Now the images added as media opens in the fancybox and the user is able to click through all images (like a gallery). What do I have to do to also open images inserted by the RTE?
I tried the following typoscript:
plugin.tt_news.displaySingle.image.imageLinkWrap {
JSwindow = 0
directImageLink = 1
linkParams.ATagParams {
dataWrap = class="jqfancybox" rel="fancybox"
}
}
The idea is if an user inserts an image with the option "click enlarge" the above shown class should be added as well as the rel attribute. The rest should do the fancybox. But for existing images no class is added and fancybox doesn't pop up. What I'm missing?
Edit:
Now I tried it with:
plugin.tt_news.displaySingle.content_stdWrap.parseFunc {
postUserFunc.imageLinkWrap.typolink{
ATagParams {
dataWrap = class="jqfancybox" rel="fancybox"
}
}
}
but the link is not wrapped.
RTE content is parsed via parseFunc < lib.parseFunc_RTE. So if you want to change the config, you need to configure plugin.tt_news.displaySingle.content.parseFunc.* (i am not sure, if the field is content or bodytext or whatever)
lib.parseFunc_RTE is a default Config for parsing RTE content. It is quite powerful, but you need to lookup a lot of TypoScript functions.

Watin - How to set value of textarea (HTML editor)?

I'm trying to set the value of a textfield using the following code:
if (ie.TextField(Find.ById("testField")).Exists)
ie.TextField(Find.ById("testField")).Value = "Test";
The code passes without raising an error, however the textfield is not filled with the value.
I get an exception when I execute the following line:
ie.TextField(Find.ById("testField")).Focus()
The textarea is a tiny_mce editor and one of the html attributes is: style="display: none;"...
Any ideas how I can modify the value of such a field using Watin?
Thanks.
First tinymce is not a textarea. tinymce hides your textarea on initialization and creates a contenteditable iframe which is then used to allow text editing, styling aso...
Second if you want to write the editors content back to the hidden textarea you may do this using
tinymce.get('testField').triggerSave();.
Another way to set the value of your textarea is:
tinymce.get('testField').getDocumentById('testField').value = 'new value';
In case you want to write content directly to your tinymce editor you may choose on of the following
tinymce.get('testField').setContent('my_new_content'); // replaces the editors content
or
tinymce.get('testField').execCommand('mceInsertContent',false, 'my_content_to_be_added'); // adds the content at the carat postion
Here is a simple way to handle this using the Watin Eval function:
var js = "tinyMCE.get('body').setContent('" + bodyCont + "')";
var s = ie.Eval(js);
'body' needs to replaced with the id of the textarea that is hidden by tinymce - do a "view source" in your browser window to find this id.