Typo3 6.0.2 Add RTE Class - typo3

how can i add new classes to TYPO3 RTE (version 6.0.2)
i tried the same way as with Typo3 4 :
- created a css file in fileadmin folder (fileadmin/css/rte.css)
- add style in this css file
- add those lines in page TSConfig :
RTE.default {
classesParagraph >
classesTable >
classesTD >
classesLinks >
classesCharacter >
classesAnchor >
classesImage >
ignoreMainStyleOverride=1
showTagFreeClasses=1
contentCSS = /fileadmin/css/rte.css
showButtons = *
showTagFreeClasses = 1
proc.allowedClasses >
}
RTE.classes {
left.name=Float left
}
but nothing change, my added classes won't show in RTE...
thanks in advance.

I think some configuration options have changed in newer versions of TYPO3.
Deprecated property => Use instead
disableRightClick => contextMenu.disable
disableContextMenu => contextMenu.disable
hidePStyleItems => buttons.formatblock.removeItems
hideFontFaces => buttons.fontstyle.removeItems
fontFace => buttons.fontstyle.addItems
hideFontSizes => buttons.fontsize.removeItems
fontSize => buttons.fontsize.addItems
classesCharacter => buttons.textstyle.tags.span.allowedClasses
classesParagraph => buttons.blockstyle.tags.div.allowedClasses
classesTable => buttons.blockstyle.tags.table.allowedClasses
classesTD => buttons.blockstyle.tags.td.allowedClasses
classesImage => buttons.image.properties.class.allowedClasses
classesLinks => buttons.link.properties.class.allowedClasses
blindImageOptions => buttons.image.options.removeItems
blindLinkOptions => buttons.link.options.removeItems
defaultLinkTarget => buttons.link.properties.target.default
RTE.default.classesAnchor => RTE.default.buttons.link.properties.class.allowedClasses
RTE.default.classesAnchor.default.[link-type] => RTE.default.buttons.link.[link-type].properties.class.default
mainStyleOverride => contentCSS
mainStyleOverride_add.[key] => contentCSS
mainStyle_font => contentCSS
mainStyle_size => contentCSS
mainStyle_color => contentCSS
mainStyle_bgcolor => contentCSS
inlineStyle.[any-keystring] => contentCSS
ignoreMainStyleOverride => n.a.
disableTYPO3Browsers => buttons.image.TYPO3Browser.disabled and buttons.link.TYPO3Browser.disabled
showTagFreeClasses => buttons.blockstyle.showTagFreeClasses and buttons.textstyle.showTagFreeClasses
disablePCexamples => buttons.blockstyle.disableStyleOnOptionLabel and buttons.textstyle.disableStyleOnOptionLabel
See here: http://forge.typo3.org/issues/28325

In case you still need help: Here is another question with a helpful answer:
Cannot choose text style in RTE
I had the same problem with TYPO3 6.0.2 and many tutorials or forum entries I found contained deprecated properties. With the answer to the aforemetnioned question it worked.

css file rte.css
a.youtube-vintage, a.fb-vintage, a.www-vintage {
color: #9A3811;
}
pagets config
/////////////////////////////////////////////////////////////
// RTE
/////////////////////////////////////////////////////////////
RTE.classes{
youtube-vintage{
name = youtube
value = color:#636466; font-size:15px;
}
fb-vintage{
name = fb
value = color:#9A3811;
}
www-vintage{
name = www
value = color:#9A3811;
}
}
RTE.default{
ignoreMainStyleOverride = 1
useCSS = 1
showTagFreeClasses = 1
contentCSS = fileadmin/templates/css/rte.css
buttons {
blockstyle.tags.div.allowedClasses := addToList(youtube-vintage, fb-vintage, www-vintage)
blockstyle.tags.p.allowedClasses := addToList(youtube-vintage, fb-vintage, www-vintage)
textstyle.tags.span.allowedClasses := addToList(youtube-vintage, fb-vintage, www-vintage)
}
proc.allowedClasses := addToList(youtube-vintage, fb-vintage, www-vintage)
}

Related

How to show navigation bar options to specific users in moodle lms?

Below is my code for showing an extra option in navigation-drawer of Moodle LMS account.
function local_report_extend_navigation(global_navigation $navigation)
{
$main_node = $navigation->add(get_string('pluginname', 'local_report'), '/local/report/');
$main_node->nodetype = 1;
$main_node->collapse = false;
$main_node->force_open = true;
$main_node->isexpandable = false;
$main_node->showinflatnavigation = true;
// $main_node->icon = new pix_icon('i/settings', get_string('pluginname', 'local_report'));
$main_node->icon = new pix_icon('i/files', get_string('pluginname', 'local_report'));
}
The output for it is :
This is the navigation-drawer. I want to show the Reports option to only admin, teacher and manager
Can anyone let me know how to make this done?
You will need to create a capability in your local plugin. In local/report/db/access.php
$capabilities = array(
'local/report:canview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
),
),
);
Then use something like this in your function.
if (!has_capability('local/report:canview', \context_system::instance())) {
return;
}

pg_search_scope: chaining scopes seems impossible

I have a search form for searching "documents", that have a small dozen of search criterions, including "entire_text", "keywords" and "description".
I'm using pg_search_scope, but I have 2 different scopes.
This is in my document.rb:
pg_search_scope :search_entire_text,
:against => :entire_text,
:using => {
:tsearch => {
:prefix => true,
:dictionary => "french"
}
}
pg_search_scope :search_keywords,
:associated_against => {
:keywords => [:keyword]
},
:using => {
:tsearch => {
:any_word => true
}
}
Each separately works fine. But I can't do this:
#resultats = Document.search_keywords(params[:ch_document][:keywords]).search_entire_text(params[:ch_document][:entire_text])
Is there any way to work around this?
Thanks
I've never used pg_search_scope but it looks like you indeed can't combine two pg_search_scope's.
What you could do is use :search_entire_text with a pg_search_scope and use the resulting id's in a Document.where([1,2,3]) that way you can use standard rails scope's for the remaining keyword searches.
Example:
# If pluck doesn't work you can also use map(&:id)
txt_res_ids = Document.search_entire_text(params[:ch_document][:entire_text]).pluck(:id)
final_results = Document.where(id: txt_res_ids).some_keyword_scope.all
It works. Here's the entire code ... if ever this could help someone :
Acte.rb (I didn't translate to english, the explanations are commented to correspond to the question above)
pg_search_scope :cherche_texte_complet, #i.e. find entire text
:against => :texte_complet,
:using => {
:tsearch => {
:prefix => true,
:dictionary => "french"
}
}
pg_search_scope :cherche_mots_clefs, #find keywords
:associated_against => {
:motclefs => [:motcle]
},
:using => {
:tsearch => {
:any_word => true
}
}
def self.cherche_date(debut, fin) #find date between
where("acte_date BETWEEN :date_debut AND :date_fin", {date_debut: debut, date_fin: fin})
end
def self.cherche_mots(mots)
if mots.present? #the if ... else is necessary, see controller.rb
cherche_mots_clefs(mots)
else
order("id DESC")
end
end
def self.ids_texte_compl(ids)
if ids.any?
where("id = any (array #{ids})")
else
where("id IS NOT NULL")
end
end
and actes_controller.rb
ids = Acte.cherche_texte_complet(params[:ch_acte][:texte_complet]).pluck(:id)
#resultats = Acte.cherche_date(params[:ch_acte][:date_debut],params[:ch_acte][:date_fin])
.ids_texte_compl(ids)
.cherche_mots(params[:ch_acte][:mots])
Thanks !
chaining works in pg_search 2.3.2 at least
SomeModel.pg_search_based_scope("abc").pg_search_based_scope("xyz")

SysFolder Icons with TYPO3 Icon-API

Till TYPO3 CMS 6.2 i've been using the following code in extTables.php to provide sysfolder icons:
$TCA['pages']['columns']['module']['config']['items'][] = array('Templates', 'templates', '/fileadmin/icons/application_side_list.png');
\TYPO3\CMS\Backend\Sprite\SpriteManager::addTcaTypeIcon('pages', 'contains-templates', '/fileadmin/icons/application_side_list.png');
As since 7.6 the code is obsolete and icons are provided by the Icon-API. Am I right? So my question is, if it's still possible to provide sysfolder icons to the backend using BitmapIconProvider, SvgIconProvider or the FontawesomeIconProvider?
Yes, this should work using the IconRegistry core class:
ext_localconf.php:
if (TYPO3_MODE === 'BE') {
/** #var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon(
'apps-pagetree-folder-contains-templates',
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
['source' => 'EXT:myext/Resources/Public/Icons/application_side_list.png']
);
}
ext_tables.php:
if (TYPO3_MODE === 'BE') {
$GLOBALS['TCA']['pages']['columns']['module']['config']['items'][] = [
0 => 'Templates',
1 => 'templates',
2 => 'apps-pagetree-folder-contains-templates'
];
}
The TYPO3 extension must be modified to fit the needs of TYPO3 7.5 and higher. Replace myextkey by the extension key of your extension.
ext_localconf.php:
if (TYPO3_MODE == 'BE') {
$pageType = 'myext10'; // a maximum of 10 characters
$icons = array(
'apps-pagetree-folder-contains-' . $pageType => 'apps-pagetree-folder-contains-myextkey.svg'
);
/** #var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
foreach ($icons as $identifier => $filename) {
$iconRegistry->registerIcon(
$identifier,
$iconRegistry->detectIconProvider($filename),
array('source' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/' . $filename)
);
}
}
Configuration/TCA/Overrides/pages.php:
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
// add folder icon
$pageType = 'myext10'; // a maximum of 10 characters
$iconReference = 'apps-pagetree-folder-contains-' . $pageType;
$addToModuleSelection = TRUE;
foreach ($GLOBALS['TCA']['pages']['columns']['module']['config']['items'] as $item) {
if ($item['1'] == $pageType) {
$addToModuleSelection = false;
break;
}
}
if ($addToModuleSelection) {
$GLOBALS['TCA']['pages']['ctrl']['typeicon_classes']['contains-' . $pageType] = $iconReference;
$GLOBALS['TCA']['pages']['columns']['module']['config']['items'][] = array(
0 => 'LLL:EXT:myextkey/locallang.xml:pageModule.plugin',
1 => $pageType,
2 => $iconReference
);
}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
$pageType,
'Configuration/TSconfig/Page/folder_tables.txt',
'EXT:myextkey :: Restrict pages to myextkey records'
);
locallang.xml:
<label index="pageModule.plugin">My Extension: Table names of my extension</label>
Resources/Public/Icons/apps-pagetree-folder-contains-myextkey.svg:
vector graphic image file for your extension tables
see https://github.com/TYPO3/TYPO3.Icons for working example SVG icons.
Configuration/TSconfig/Page/folder_tables.txt:
Insert the table names of your extension.
mod.web_list.allowedNewTables = tx_myextkey_tablename1, tx_myextkey_tablename2, tx_myextkey_tablename3

Typo3 sr_language_menu dropdown not working

I have installed and configured sr_language_menu(with real_url) in Typo3 6.2.
1.The translation is working, if I use links
But If I use Drop down list the redirection is not happening instead it contains some query string like this
/?tx_srlanguagemenu_languagemenu[__referrer][%40extension]=SrLanguageMenu&tx_srlanguagemenu_languagemenu[__referrer][%40controller]=Menu&tx_srlanguagemenu_languagemenu[__referrer][%40action]=index&tx_srlanguagemenu_languagemenu[__referrer][arguments]=YTowOnt9d9666863629331a07b703f260fec14a2665cc267&tx_srlanguagemenu_languagemenu[__trustedProperties]=a%3A0%3A{}cb8407c7c1f13f96cdceecffd389e5c5a2e8d31c&tx_srlanguagemenu_languagemenu[uri]=de%2Fzuhause%2F
How to hide non translated languages in drop down works fine in links but not working in dropdown(I use ShowInactive=0 in typoscript)
I used the following typoscript to hadle languages
lib.language = HMENU
lib.language {
special = language
special.value = 0,1
1 = TMENU
1 {
wrap =
class="dropdown-toggle" href="#">Language
class="dropdown-menu">|
noBlur = 1
NO {
linkWrap =
|
||
|
stdWrap.override = Nederlands || English
doNotLinkIt = 1
stdWrap.typolink.parameter.data = page:uid
stdWrap.typolink.additionalParams = &L=0 || &L=1
stdWrap.typolink.addQueryString = 1
stdWrap.typolink.addQueryString.exclude = L,id,cHash,no_cache
stdWrap.typolink.addQueryString.method = GET
stdWrap.typolink.useCacheHash = 1
stdWrap.typolink.no_cache = 0
stdWrap.typolink.title = Nederlands || English
}
ACT < .NO
ACT = 1
ACT {
linkWrap =
|
||
class="en_lang active">|
}
}
}
In your custom typo3conf/realurl_conf.php you need to set the languages
according to the id they have
array(
'GETvar' => 'L',
'valueMap' => array(
// id's need to line up with Website Language Ids in TYPO3
// 'nederlands' => '0',
'' => '0',
// 'english' => '1',
'en' => '1',
),
'noMatch' => 'bypass',
)

TYPO3 language switcher does not use the correct RealURL paths

I use the following TypoScript to generate a language switcher. It's basically a copy from an existing site where everything works fine:
lib.langMenu = HMENU
lib.langMenu {
special = language
addQueryString = 1
special.value = 0,1
special.normalWhenNoLanguage = 0
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
allWrap = <li>|</li>
stdWrap2.noTrimWrap = | | |
stdWrap.override = Deutsch || English
ATagParams = class="lang-switcher-de" || class="lang-switcher-en"
}
ACT < .NO
ACT = 1
ACT.allWrap = <li class="active">|</li>
wrap = <ul class="pull-right language"><li class="hidden-xs">Language:</li>|</ul>
}
}
Now, I use the following RealURL setup:
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' => array(
'enableCHashCache' => 1,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
),
'preVars' => array (
0 => array (
'GETvar' => 'L',
'valueMap' => array (
'en' => '1',
),
'noMatch' => 'bypass',
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
),
)
);
The issue is that, say I have the following pages, with their German and English path:
produkte / products
produktuebersicht / product_overview
When I'm on /produkte/produktuebersicht, the language switcher generates a link to/en/produkte/produktuebersicht instead of /en/products/product_overview. This problem occurs on every single page.
It always takes the path of the wrong (read, current) language. I've checked the ID to path mapping and it looks fine to me:
The encode cache has these entries – but even when I delete them the problem persists:
The weird thing is that the menu itself is generated correctly. So how can I make it link to the right RealURLs in the language switcher?
Your RealURL pagePath section should include a languageGetVar setting.
From the RealURL documentation:
Defines which GET variable in the URL that defines language id; if set the path will take this language value into account and try to generate the path in localized version.
Your pagePath section should look like:
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'languageGetVar' => 'L'
),