How to integrate TinyMCE with hi_kcfinder?

Questions about how to install and problems installing - please read the documentation first!
sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

How to integrate TinyMCE with hi_kcfinder?

Post by sonnur » Sun Dec 30, 2012 4:43 am

Hi Everyone,

I have changed from Filebrowser to hi_kcfinder. I have set it to the external editor in CMS config. I have disabled the filebrowser plugin. I have googled for an solution to integrate the tinymce plugin with the hi_kcfinder plugin. But have not found any. Expect that it should work when the external filebrowser is set. But there is no filebrowser link in the tinymce editor :(

I know it can work because if this example: http://kcfinder.sunhater.com/demos/tinymce

Here is the JS that is generated for tinymce when logged in. The filebrowser is set to default, that is not expected when I have a external filebrowser:

Code: Select all

        <script language="javascript" type="text/javascript" src="./plugins/tinymce/tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript" src="./plugins/tinymce/init.js"></script>
	<script type="text/javascript">
	/* <![CDATA[ */
	function wrFilebrowser (field_name, url, type, win) {
  poppedUpWin = win;
  inputField = field_name;
  if (type == "file") {type = "downloads"};
    var cmsURL = "/plugins/filebrowser/editorbrowser.php?editor=tinymce&prefix=./&base=./";    

    if (cmsURL.indexOf("?") < 0) {
        cmsURL = cmsURL + "?type="+ type ;
    }
    else {
        cmsURL = cmsURL + "&type="+type ;
    }

    tinyMCE.activeEditor.windowManager.open(
        {
            file  : cmsURL,
            width : 800,
            height : 600,
            resizable : "yes",
            inline : "yes",
            close_previous : "no",
            popup_css : false,
            scrollbars : "yes"
          },
          {
            window : win,
            input : field_name
          }
    );
    return false;
  }

	var myImageList = new Array();
	var myLinkList = new Array(["Welcome to Wire2All", "?Welcome_to_Wire2All"],["Wire2All Enjoy Life (MemPages Level 1)", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29"],["&nbsp;&nbsp;&nbsp;Wire2All Enjoy Life Logged-In", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29___Wire2All_Enjoy_Life_Logged-In"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users contribute to Wire2All", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29___Wire2All_Enjoy_Life_Logged-In___Users_contribute_to_Wire2All"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 1", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29___Wire2All_Enjoy_Life_Logged-In___Users_Subpage_1"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 2", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29___Wire2All_Enjoy_Life_Logged-In___Users_Subpage_2"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 3", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29___Wire2All_Enjoy_Life_Logged-In___Users_Subpage_3"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Mailform Subpage", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29___Wire2All_Enjoy_Life_Logged-In___Users_Mailform_Subpage"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wire2All Enjoy Life Q&A", "?Wire2All_Enjoy_Life_%28MemPages_Level_1%29___Wire2All_Enjoy_Life_Logged-In___Wire2All_Enjoy_Life_Q%26amp%3BA"],["Wire2All Business (MemPages Level 5)", "?Wire2All_Business_%28MemPages_Level_5%29"],["&nbsp;&nbsp;&nbsp;Wire2All Business Logged-In", "?Wire2All_Business_%28MemPages_Level_5%29___Wire2All_Business_Logged-In"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users contribute to Wire2All", "?Wire2All_Business_%28MemPages_Level_5%29___Wire2All_Business_Logged-In___Users_contribute_to_Wire2All"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 1", "?Wire2All_Business_%28MemPages_Level_5%29___Wire2All_Business_Logged-In___Users_Subpage_1"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 2", "?Wire2All_Business_%28MemPages_Level_5%29___Wire2All_Business_Logged-In___Users_Subpage_2"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 3", "?Wire2All_Business_%28MemPages_Level_5%29___Wire2All_Business_Logged-In___Users_Subpage_3"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Mailform Subpage", "?Wire2All_Business_%28MemPages_Level_5%29___Wire2All_Business_Logged-In___Users_Mailform_Subpage"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wire2All Business Q&A", "?Wire2All_Business_%28MemPages_Level_5%29___Wire2All_Business_Logged-In___Wire2All_Business_Q%26amp%3BA"],["Distributors Area (MemPages Level 2)", "?Distributors_Area_%28MemPages_Level_2%29"],["&nbsp;&nbsp;&nbsp;Distributors Area Logged-In", "?Distributors_Area_%28MemPages_Level_2%29___Distributors_Area_Logged-In"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Distributors contribute to Wire2All", "?Distributors_Area_%28MemPages_Level_2%29___Distributors_Area_Logged-In___Distributors_contribute_to_Wire2All"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Distributors Subpage 1", "?Distributors_Area_%28MemPages_Level_2%29___Distributors_Area_Logged-In___Distributors_Subpage_1"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Distributors Subpage 2", "?Distributors_Area_%28MemPages_Level_2%29___Distributors_Area_Logged-In___Distributors_Subpage_2"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Distributors Subpage 3", "?Distributors_Area_%28MemPages_Level_2%29___Distributors_Area_Logged-In___Distributors_Subpage_3"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Distributors Mailform Subpage", "?Distributors_Area_%28MemPages_Level_2%29___Distributors_Area_Logged-In___Distributors_Mailform_Subpage"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Distributors Area Q&A", "?Distributors_Area_%28MemPages_Level_2%29___Distributors_Area_Logged-In___Distributors_Area_Q%26amp%3BA"],["Ambassadors Area (MemPages Level 6)", "?Ambassadors_Area_%28MemPages_Level_6%29"],["&nbsp;&nbsp;&nbsp;Ambassadors Area Logged-In", "?Ambassadors_Area_%28MemPages_Level_6%29___Ambassadors_Area_Logged-In"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users contribute to Wire2All", "?Ambassadors_Area_%28MemPages_Level_6%29___Ambassadors_Area_Logged-In___Users_contribute_to_Wire2All"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 1", "?Ambassadors_Area_%28MemPages_Level_6%29___Ambassadors_Area_Logged-In___Users_Subpage_1"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 2", "?Ambassadors_Area_%28MemPages_Level_6%29___Ambassadors_Area_Logged-In___Users_Subpage_2"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 3", "?Ambassadors_Area_%28MemPages_Level_6%29___Ambassadors_Area_Logged-In___Users_Subpage_3"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Mailform Subpage", "?Ambassadors_Area_%28MemPages_Level_6%29___Ambassadors_Area_Logged-In___Users_Mailform_Subpage"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wire2All Ambassador's Area Q&A", "?Ambassadors_Area_%28MemPages_Level_6%29___Ambassadors_Area_Logged-In___Wire2All_Ambassador%27s_Area_Q%26amp%3BA"],["Contributors Area (MemPages Level 7)", "?Contributors_Area_%28MemPages_Level_7%29"],["&nbsp;&nbsp;&nbsp;Contributors Area Logged-In", "?Contributors_Area_%28MemPages_Level_7%29___Contributors_Area_Logged-In"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users contribute to Wire2All", "?Contributors_Area_%28MemPages_Level_7%29___Contributors_Area_Logged-In___Users_contribute_to_Wire2All"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 1", "?Contributors_Area_%28MemPages_Level_7%29___Contributors_Area_Logged-In___Users_Subpage_1"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 2", "?Contributors_Area_%28MemPages_Level_7%29___Contributors_Area_Logged-In___Users_Subpage_2"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Subpage 3", "?Contributors_Area_%28MemPages_Level_7%29___Contributors_Area_Logged-In___Users_Subpage_3"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Users Mailform Subpage", "?Contributors_Area_%28MemPages_Level_7%29___Contributors_Area_Logged-In___Users_Mailform_Subpage"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wire2All Contributors Area Q&A", "?Contributors_Area_%28MemPages_Level_7%29___Contributors_Area_Logged-In___Wire2All_Contributors_Area_Q%26amp%3BA"],["Programmers Area (MemPages Level 3)", "?Programmers_Area_%28MemPages_Level_3%29"],["&nbsp;&nbsp;&nbsp;Programmers Area (Logged-In)", "?Programmers_Area_%28MemPages_Level_3%29___Programmers_Area_%28Logged-In%29"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Programmers contribute to Wire2All", "?Programmers_Area_%28MemPages_Level_3%29___Programmers_Area_%28Logged-In%29___Programmers_contribute_to_Wire2All"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Programmers Subpage 1", "?Programmers_Area_%28MemPages_Level_3%29___Programmers_Area_%28Logged-In%29___Programmers_Subpage_1"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Programmers Subpage 2", "?Programmers_Area_%28MemPages_Level_3%29___Programmers_Area_%28Logged-In%29___Programmers_Subpage_2"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Programmers Subpage 3", "?Programmers_Area_%28MemPages_Level_3%29___Programmers_Area_%28Logged-In%29___Programmers_Subpage_3"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Programmers Mailform Subpage", "?Programmers_Area_%28MemPages_Level_3%29___Programmers_Area_%28Logged-In%29___Programmers_Mailform_Subpage"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Programmers Area Q&A", "?Programmers_Area_%28MemPages_Level_3%29___Programmers_Area_%28Logged-In%29___Programmers_Area_Q%26amp%3BA"],["Investors Area (MemPages 4)", "?Investors_Area_%28MemPages_4%29"],["&nbsp;&nbsp;&nbsp;Investors Area (Logged-In)", "?Investors_Area_%28MemPages_4%29___Investors_Area_%28Logged-In%29"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Investors contribute to Wire2All", "?Investors_Area_%28MemPages_4%29___Investors_Area_%28Logged-In%29___Investors_contribute_to_Wire2All"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Investors Subpage 1", "?Investors_Area_%28MemPages_4%29___Investors_Area_%28Logged-In%29___Investors_Subpage_1"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Investors Subpage 2", "?Investors_Area_%28MemPages_4%29___Investors_Area_%28Logged-In%29___Investors_Subpage_2"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Investors Subpage 3", "?Investors_Area_%28MemPages_4%29___Investors_Area_%28Logged-In%29___Investors_Subpage_3"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Investors Mailform Subpage", "?Investors_Area_%28MemPages_4%29___Investors_Area_%28Logged-In%29___Investors_Mailform_Subpage"],["&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Investors Area Q&A", "?Investors_Area_%28MemPages_4%29___Investors_Area_%28Logged-In%29___Investors_Area_Q%26amp%3BA"],["Invitation Business Partner", "?Invitation_Business_Partner"],["Invitation Ambassador", "?Invitation_Ambassador"],["Free Wire2All Invitation", "?Free_Wire2All_Invitation"],["News01", "?News01"],["News02", "?News02"],["News03", "?News03"],["Wire2All Demo-Shop", "?Wire2All_Demo-Shop"],["DOWNLOADS:",""],["&nbsp;&nbsp;XHdebug.txt (0 KB)", "./?download=XHdebug.txt"]);
	/* ]]> */
	</script>
	
	<script language="javascript" type="text/javascript">
	/* <![CDATA[ */
	function tinyMCE_initialize0() {
	    tinyMCE_instantiateByClasses('xh-editor', {
    // General options

    theme : "advanced",
    element_format : "html",
    language : "en",
    plugins : "autosave,pagebreak,style,layer,table,save,advimage,advlink,advhr,emotions,iespell,"
            + "insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,"
            + "noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,media,lists",
   /*
    style_formats : [


        {title : "Normal", block : "p", classes : true , remove : "all", exact : false},
        {title : "Teaser", block : "p", classes : "teaser", exact : true},
        {title : "Zitat",  block : "p", classes : "zitat", exact : false },

    ],*/
    // Theme options
    theme_advanced_buttons1 : "save,|,fullscreen,code,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent,blockquote",
	theme_advanced_buttons2 : "formatselect,fontselect,fontsizeselect,styleselect",
    theme_advanced_buttons3 : "bullist,numlist,|,cut,copy,paste,pastetext,pasteword,|,forecolor,backcolor,|,sub,sup,|,emotions,charmap",
    theme_advanced_buttons4 : "undo,redo,|,link,unlink,anchor,image,media,cleanup,|,hr,removeformat,visualaid,|,search,replace,|,help",
    theme_advanced_buttons5 : "tablecontrols,|,insertdate,inserttime",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
    theme_advanced_blockformats : "h1,h2,h3,p,div,h4,h5,h6,blockquote,dt,dd,code",
    theme_advanced_font_sizes : "8px=8px, 10px=10px,12px=12px, 14px=14px, 16px=16px, 18px=18px,20px=20px,24px=24px,36px=36px",


//    height : height : "600",,
    content_css : "./templates/ge1024blackred2XH/stylesheet.css",
    //link and image list
    external_image_list_url: "./plugins/tinymce/cms_image_list.js",
    external_link_list_url: "./plugins/tinymce/cms_link_list.js",

    // Extra
    plugin_insertdate_dateFormat: "%d-%m-%Y",
    plugin_insertdate_timeFormat: "%H:%M:%S",
    inline_styles : true,
    apply_source_formatting : true,
    relative_urls : true,
    convert_urls: false,
    entity_encoding : "raw",
//    entity_encoding : "'.$plugin_cf['tinymce']['entity_encoding'].'",


    file_browser_callback: "wrFilebrowser" ,
    fullscreen_new_window : false ,
    fullscreen_settings : {
    theme_advanced_buttons1: "save,|,fullscreen,code,|,formatselect,fontselect,fontsizeselect,styleselect,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,outdent,indent,blockquote,|,undo,redo",
    theme_advanced_buttons2 : "link,unlink,anchor,image,media,cleanup,|,hr,removeformat,visualaid,|,forecolor,backcolor,|,search,replace,|,charmap,emotions,|,sub,sup,tablecontrols,insertdate,inserttime,|,help",
	theme_advanced_buttons3 : "",
	theme_advanced_buttons4 : ""

    }
});
	}
	/* ]]> */
	</script>

manu
Posts: 861
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: How to integrate TinyMCE with hi_kcfinder?

Post by manu » Sun Dec 30, 2012 11:28 am

Hi sonnur
Did you follow the instructions in the plugin help file? Especially the passage how to integrate into a wysigyw editor?
regards
manu

EDIT: sorry, the link above is deprecated. Just to set the external file manager in config is the right way. Did you install the latest hi_kcfinder 1.6?
Your source for the filebrowser callback should look like this:

Code: Select all

 file_browser_callback: "openKCFinder" ,...
Last edited by manu on Sun Dec 30, 2012 11:45 am, edited 1 time in total.

cmb
Posts: 13341
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: How to integrate TinyMCE with hi_kcfinder?

Post by cmb » Sun Dec 30, 2012 11:43 am

Hi sonnur, hi manu,

if I'm not mistaken, sonnur is using CMSimple 4.0.3. There the usage of hi_kcfinder is very simple: just install it, and set "filebroser external" to "hi_kcfinder". That should be enough to replace the default filebrowser.
sonnur wrote:

Code: Select all

    file_browser_callback: "wrFilebrowser" ,
That indicates, that the system is still trying to use the default filebrowser. But that will fail, as the filebrowser is disabled.

Please double check the setting of "filebrowser_external" in admin mode (not only in the config file). If everything is correct, than please have a try with debug mode; there could be a similar problem to what happened yesterday ("500 Internal server error").

Christoph

PS: it's probably important to use the latest version of hi_kcfinder: 1.6.
Last edited by cmb on Sun Dec 30, 2012 11:44 am, edited 1 time in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

Re: How to integrate TinyMCE with hi_kcfinder?

Post by sonnur » Sun Dec 30, 2012 2:15 pm

Yes I have followed the instructions and have the latest version of hi_kcfinder (1.6) and the external filebrowser is set to: hi_kcfinder

sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

Re: How to integrate TinyMCE with hi_kcfinder?

Post by sonnur » Sun Dec 30, 2012 2:20 pm

And the system check is ok:

System-Check
hi_KCFinder Version: 1.6 - 2012-01-28

PHP-Version: 5.2.6-1+lenny16

Extension "date" installed
Extension "gd" installed
Extension "mbstring" installed
Extension "pcre" installed
Extension "session" installed
Extension "SPL" installed

Folder "images" is writeable
Folder "downloads" is writeable
Folder "userfiles" is writeable

sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

Re: How to integrate TinyMCE with hi_kcfinder?

Post by sonnur » Sun Dec 30, 2012 2:23 pm

Here is the TINymce plugin info:

TinyMCE for CMSimple_XH
Version 1.1

TinyMCE version 3.4.5 – http://www.tinymce.com/

Filebrowser integration – http://www.zeichenkombinat.de/

Adapted for CMSimpleSubsites by ge-webdesign.de

cmb
Posts: 13341
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: How to integrate TinyMCE with hi_kcfinder?

Post by cmb » Sun Dec 30, 2012 2:28 pm

Hi sonnur,

is the hi_kcfinder shown, when you call the filebrowser from the admin menu (Files->Images etc.)?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

Re: How to integrate TinyMCE with hi_kcfinder?

Post by sonnur » Sun Dec 30, 2012 2:33 pm

cmb wrote:Hi sonnur,

is the hi_kcfinder shown, when you call the filebrowser from the admin menu (Files->Images etc.)?

Christoph
Yes it works perfect in the menu :) Files, images, download etc.

cmb
Posts: 13341
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: How to integrate TinyMCE with hi_kcfinder?

Post by cmb » Sun Dec 30, 2012 2:48 pm

There's probably some debugging necessary. In plugins/tinymce/init.php insert before line 20:

Code: Select all

    //Einbindung alternativer Filebrowser, gesteuert über $cf['filebrowser']['external']
    //und den Namen des aufrufenden Editors
var_dump($cf['filebrowser']['external']); 
This should display "string 'hi_kcfinder' (length=11)" below the menu. In your case it probably displays "string '' (length=0)". Is that so?
Christoph M. Becker – Plugins for CMSimple_XH

sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

Re: How to integrate TinyMCE with hi_kcfinder?

Post by sonnur » Sun Dec 30, 2012 3:05 pm

cmb wrote:There's probably some debugging necessary. In plugins/tinymce/init.php insert before line 20:

Code: Select all

    //Einbindung alternativer Filebrowser, gesteuert über $cf['filebrowser']['external']
    //und den Namen des aufrufenden Editors
var_dump($cf['filebrowser']['external']); 
This should display "string 'hi_kcfinder' (length=11)" below the menu. In your case it probably displays "string '' (length=0)". Is that so?
It displays:

Code: Select all

string(11) "hi_kcfinder"

Post Reply