Kotti/kotti_tinymce — pull request #9 by geojeff (2013-08-01 18:20:30+00:00)
Title: Image plugin and ui

Thanks to the work by Zidanca sprinters for the tinymce 4.x update, allowing this work!

This PR adds a new tinymce plugin, kottiimage_plugin, to replace the image plugin in the new tinymce 4.x (the previous plugin was called advimage).

The kottiimage_plugin controls the first dialog that appears when an image is inserted/added with the tinymce interface. The dialog is kept fairly like the one in the tinymce 4.x image plugin, where the image source and dimensions are in the first tab; the Advanced tab is the same. The input labels were changed from Source to Image Source, for the filepicker input, and from Dimensions to Size for the second input. The filepicker "browse" button fires the same kottibrowser.pt, from which the image scale select was removed. The Size part consists of an upper control with a "Change Size" button and a "Current Size" label, and a lower part with width and height and aspect ratio checkbox.

The "Change Size" button replaces the image scale select that we had in the old kottibrowser.pt. It was debated about whether to keep the old way of selecting span1, span2, etc. in the kottibrowser.pt, which did allow for a kind of image preview, but ultimately decided to put it in the first dialog. This has the advantage of having a single place and UI for adjusting size, but it means "previewing" image size requires the user to add the image at a given size.

Image scales were changed in the UI, except for where they appear in URLs, from span1, span2, etc. to just numbers, 1, 2, ... to 12. This simplifies the verbiage presented to the user, and it also prepares for what we might need to do for bootstrap3, which has these as percentages.

There remain some known TODO items:

1) Prepare js min files.
2) In the kottibrowserdialog submit() function, which fires from kottibrowser.pt when an image is selected, there is a forced firing of a change event for the "Image Source" filepicker. This was found on a tinymce forum page, but it seems unfortunate that programmatically changing the textinput does not fire the event.
3) The image scales were read from python, from views/image.py, previously, but this was when the image scales were picked in kottibrowser.pt. I didn't find a way to get these available in the javascript functions. As it is, we will have to update them in two places if this isn't fix. See note above about bootstrap3.
4) There is an old TODO for kottibrowser that says "upload_allowed needs a better check."