Hi!
The only thing I really don´t like with TinyMCE is the bad integration of internal links ... I will try to improve it, but my knowledge about TinyMCE is really limited - therefore I want to ask for your oppinion first.
What I want to do:
Limit the link list to documents with a specific parent id
this is not too hard - I just have to modify line 39 of assets/plugins/tinymce2111/tinymce.linklist.php
from
WHERE sc.published=1 AND sc.deleted=0
to
WHERE sc.published=1 AND sc.deleted=0 AND sc.parent=0
But there are two problems: it is hardcoded, and doesn´t show the child documents.
show child documents
There is the need to configure the id and the depth. In order to show the child-documents, the cleanest solution would be to do it in the SQL-Query ... something like
$sql = "SELECT DISTINCT $fields FROM $tblsc sc
LEFT JOIN $tbldg dg on dg.document = sc.id
WHERE sc.published=1 AND sc.deleted=0 AND sc.parent IN
( SELECT DISTINCT $fields FROM $tblsc sc
LEFT JOIN $tbldg dg on dg.document = sc.id
WHERE sc.published=1 AND sc.deleted=0 AND sc.parent=0
ORDER BY $sort $dir )
ORDER BY $sort $dir;";
But this just covers direct child documents, and not the possibility to choose a depth of n levels.
Is there a possibility to solve it within the SQL-Query, or do I have to loop it in PHP?
defining config-settings for the new linklist
This is an easy one - just add "&tinyLinkListParent=parent ID for link list;int;0 &tinyLinkListDepth=depth of link list;int;0" to the configuration settings field of the plugin
&tinyFormats=Block Formats;text;p,h1,h2,h3,h4,h5,h6,div,blockquote,code,pre,address &entity_encoding=Entity Encoding;list;named,numeric,raw;named &entities=Entities;text; &tinyPathOptions=Path Options;list;rootrelative,docrelative,fullpathurl;docrelative &tinyCleanup=Cleanup;list;enabled,disabled;enabled &tinyResizing=Advanced Resizing;list;true,false;false &advimage_styles=Advanced Image Styles;text; &advlink_styles=Advanced Link Styles;text; &disabledButtons=Disabled Buttons;text; &tinyLinkList=Link List;list;enabled,disabled;enabled &tinyLinkListParent=parent ID for link list;int;0 &tinyLinkListDepth=depth of link list;int;0 &webtheme=Web Theme;list;simple,advanced,editor,custom;simple &webPlugins=Web Plugins;text;style,advimage,advlink,searchreplace,print,contextmenu,paste,fullscreen,nonbreaking,xhtmlxtras,visualchars,media &webButtons1=Web Buttons 1;text;undo,redo,selectall,separator,pastetext,pasteword,separator,search,replace,separator,nonbreaking,hr,charmap,separator,image,link,unlink,anchor,media,separator,cleanup,removeformat,separator,fullscreen,print,code,help &webButtons2=Web Buttons 2;text;bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,separator,styleprops &webButtons3=Web Buttons 3;text; &webButtons4=Web Buttons 4;text; &webAlign=Web Toolbar Alignment;list;ltr,rtl;ltr
and add "$tinyLinkListParent, $tinyLinkListDepth" to line 37 of the plugincode (assets/plugins/tinymce2111/plugin.tinymce.php)
$html = getTinyMCEScript($elementList,$webtheme,$width,$height,$tinymce_language,$frontend,$base_url, $webPlugins, $webButtons1, $webButtons2, $webButtons3, $webButtons4, $disabledButtons, $tinyFormats, $entity_encoding, $entities, $tinyPathOptions, $tinyCleanup, $tinyResizing, $modx->config['editor_css_path'], $modx->config['tinymce_css_selectors'], $modx->config['use_browser'], $webAlign, null, null, $tinyLinkList, $tinyLinkListParent, $tinyLinkListDepth);
and add "$tinyLinkListParent, $tinyLinkListDepth" to line 89 of assets/plugins/tinymce2111/tinymce.functions.php
function getTinyMCEScript($elmList, $theme='simple', $width, $height, $language='en', $frontend, $base_url, $plugins, $buttons1, $buttons2, $buttons3, $buttons4, $disabledButtons, $blockFormats, $entity_encoding, $entities, $pathoptions, $cleanup, $resizing, $css_path, $css_selectors, $use_browser, $toolbar_align, $advimage_styles, $advlink_styles, $linklist, $linklistParent, $linklistDepth)
passing variables within tinyMCE
... but I get stuck in line 158 of assets/plugins/tinymce2111/tinymce.functions.php
$tinymceInit .= ($linklist == 'enabled') ? " external_link_list_url : \"".$base_url."assets/plugins/tinymce2111/tinymce.linklist.php\",\n" : "";
how can I pass $linklistParent and $linklistDepth to tinymce.linklist.php?
I hope, with your help, these problems are solved soon ...
There are two other things I would love to see within TinyMCE, but I don´t really know how to accomplish it:
-
multiple link lists with separate parent-id´s (one for the documents of the support area, one with blog documents etc)
- a dropdownmenu in the "edit/insert link" window to choose
custom rel="" atributes (for example lightbox)
maybee you also have an idea for this ...
Hope it works soon,
Tobias