I added TinyMCE (directly, not django-tinymce) and django-filebrowser to django admin. It works, except one thing: Then I click File Browse button on Tiny "add picture" menu, I get Page not found (404), because I don't understand what means this string in Tiny options:
var managerURL = window.location.toString()
+ 'media/upload/?type=' + type;
Full code:
<script type="text/javascript">
function tinyDjangoBrowser(field_name, url, type, win) {
var managerURL = window.location.toString()
+ 'media/upload/?type=' + type;
tinyMCE.activeEditor.windowManager.open({
file: managerURL,
title: 'Pic',
width: 800,
height: 450,
resizable: 'yes',
inline: 'yes',
close_previous: 'no',
popup_css : false
}, {
window: win,
input: field_name
});
return false;
}
tinyMCE.init({
mode : "specific_textareas",
theme : "advanced",
skin : "bootstrap",
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
extended_valid_elements : 'script[type|src],iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder],div[*],p[*],object[width|height|classid|codebase|embed|param],param[name|value],embed[param|src|type|width|height|flashvars|wmode]',
media_strict: false,
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
file_browser_callback: 'tinyDjangoBrowser',
relative_urls : "false",
remove_script_host : false,
convert_urls : false
});
</script>
Tell me please, how it should be in my case?
One more thing: need I connect tiny_mce_popup.js? Sorry for my bad english. Thx!
I found! In my case it should be
var managerURL = '/admin/filebrowser/browse/?pop=2'