managing images in editor and created pages ?

Want something adding or changing?

managing images in editor and created pages ?

Postby luigi » Mon Jun 21, 2010 7:33 pm

Hi,
recently I have been playing a bit with the RazorCMS code
(see BACKGROUND below), and I have one question:

- when creating pages that involve images, I have not found a good
way to store them and display them in the editor.

For the first part, i made a one-line change to function findPageFile()
(and similar one on the page creation routine, put2file) so that
each page is created in its own directory datastore/pages/NNNN/
which can contain the file, N.txt, and possibly images or other
related content.

Irrespective of the above change, there is the problem that the
editor (i tried tinyMCE but possibly others have the same problem)
runs with http://..../yoursite/admin/ as base URL,
whereas pages are displayed with a base of http://..../yoursite/
and so there is no good way to use relative URLs for images and
other inline objects.

My take would be to create the text files with plain relative urls
or perhaps some recognisable marker ./ in front of them (e.g. <img
src="./img1.jpg"> ) and then have loadSlabContents() replace the
'./' with 'datastore/pages/NNNN' (this is straightforward).

On the editor side, however, I would need a similar rewrite, and
I am not sure on which option to follow:
a) try to run the editor within an IFRAME and a base of
http://..../yoursite/datastore/pages/NNNN/
b) tweak the editor (the javascript code) so that it does some URL
rewriting when you enter a relative URL for an image, so that
it automatically adds the datastore/pages/NNNN part if not there
yet;
Perhaps there are other ways. Any ideas ?


BACKGROUND
In my search for db-less CMS, i found RazorCMS and i quite liked
certain design choices (very small footprint, modularity, zip-based
installs) so i started trying it and see how it suited my purposes
(a few CMS for my own research pages and departments i am affiliated
with).

In the past few weeks i have been doing a significant amount of code
restructuring on your RazorCMS code, especially on the admin side,
with the intent of removing some code duplication and figure out
its features and limitations.

You can find a snapshot of what I have so far at
http://info.iet.unipi.it/~luigi/doc/razor20100621.tgz
you may or may not like them.

The changes include all of your 1.1-stable bugfixes, and more
(e.g. the 'random' support is now present on all file manipulation
functions). I have also added a number of small features, such as
- create file (and fixes for editing empty files);
- upload directly from a remote URL;
- ability to customize on a per-page basis three menus;
- much more compact admin menus (it was painful to work with them
on a small laptop with 768 rows)

One thing you might notice is that i have replaced inline
section of html with function-generated ones e.g. _t('li', ...)
creates a <li>...</li> block and so on. This makes it a lot
easier to figure out the logical structure of a block, as well
as move objects around in the page.

If you are interested in further changes let me know, and I will
gladly keep you posted.
cheers
luigi
luigi
 
Posts: 4
Joined: Mon Jun 21, 2010 7:29 pm

Re: managing images in editor and created pages ?

Postby Adminer » Wed Jun 23, 2010 9:45 pm

luigi wrote:Hi,
recently I have been playing a bit with the RazorCMS code
(see BACKGROUND below), and I have one question:
- when creating pages that involve images, I have not found a good
way to store them and display them in the editor.


Hi!
Hint: use CKeditor 3.2.x + Gestor File Manager - it works nice for manage images for me
( http://www.miguelmanchego.com/2010/file ... tor-3-2-1/ ).

luigi wrote:You can find a snapshot of what I have so far at
http://info.iet.unipi.it/~luigi/doc/razor20100621.tgz
you may or may not like them.


It's not a big problem to hack luigi password there ;-), but:

"- create file (and fixes for editing empty files);"
- works, but I have no idea, how to edit inside this file. So, if I can not edit created file... ;-)
And chmod editor will be welcome too. And theme files editor too.

"- ability to customize on a per-page basis three menus;"
- screenshot will be welcome.

"- much more compact admin menus"
- very nice. Do you remember, where is the block of that code for that?

The problem is, that I can not see created backups in your version.
When I can not see my backup - restore is not working too ;-)
When I do restoring manualy - I have my menu, but I can not see my articles. Only 404...
On Razor native 1.1 version - everything works ok with backup and restoring.

Regards
Adminer
 
Posts: 222
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: managing images in editor and created pages ?

Postby luigi » Mon Jun 28, 2010 4:35 pm

Adminer wrote:
luigi wrote:Hi,
recently I have been playing a bit with the RazorCMS code
(see BACKGROUND below), and I have one question:
- when creating pages that involve images, I have not found a good
way to store them and display them in the editor.




just replying to myself... the trick to make the editor work handle images correctly
is to set document_base_url and content_css in the call to tinyMCE.init()
(file blade_packs/system_tinyMCE.php).
I believe document_base_url must be absolute, and content_css relative to the former. So:

document_base_url : <?php echo "'" . getBaseDir() . "'";?>,
//content_css : is relative to document_base_url
content_css : "<?php global $loadCSS; echo "../../../$loadCSS"; ?>",

where getBaseDir() returns the absolute URL for the directory, something like
http://your.web.site/some/path/datastore/pages/NNNN/

cheers
luigi
luigi
 
Posts: 4
Joined: Mon Jun 21, 2010 7:29 pm

Re: managing images in editor and created pages ?

Postby Crypt0r » Tue Jun 29, 2010 9:04 am

Your version just totally blows up a fresh installation of razorCMS. You messed something up.
www.techgeek.at

Supporting in english, german and hungarian.
Crypt0r
Global Moderator
 
Posts: 218
Joined: Wed Mar 11, 2009 4:40 pm
Location: Austria, Vienna

Re: managing images in editor and created pages ?

Postby luigi » Tue Jun 29, 2010 2:07 pm

Crypt0r wrote:Your version just totally blows up a fresh installation of razorCMS. You messed something up.


i said "something like" -- the URL to use depends on where you put your contents.
In my version i have per-slab directories datastore/pages/NNNN/ , a standard
razorCMS install uses a single directory for everything so you have to adjust
your pathnames accordingly (remove the NNNN/ from the base URL, and one '../'
from the css path).

cheers
luigi
luigi
 
Posts: 4
Joined: Mon Jun 21, 2010 7:29 pm


Return to Wishlist

Who is online

Users browsing this forum: No registered users and 1 guest

cron