Resizable standard editor

Discussion corner for Developers of Serendipity.
Post Reply
ahe123
Regular
Posts: 8
Joined: Sun Feb 10, 2008 8:21 pm

Resizable standard editor

Post by ahe123 » Mon Feb 11, 2008 12:50 am

Hi,

some time ago I added two buttons to templates/default/admin/entries.tpl which allow to resize the body and extended field. Since they use JavaScript the change is not persisted and the textareas take the default size the moment you press preview or save the entry.

I'd just like to know if it was the right file to make this change to and if there isn't a plugin that already provides this functionality that I don't know of.

If there is any interest I could also provide a patch and improve it so that the new size gets persisted.


Regards,

ahe

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Resizable standard editor

Post by garvinhicking » Mon Feb 11, 2008 4:06 pm

Hi!

Yes, that was the perfect fine place for that. It might be better for you though to create your own template and put the modified version in there. This way you can preserve your entries.tpl change after an upgrade.

You could also create a plugin for that, it doesn't exist yet, though.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

ahe123
Regular
Posts: 8
Joined: Sun Feb 10, 2008 8:21 pm

Re: Resizable standard editor

Post by ahe123 » Mon Feb 11, 2008 5:24 pm

Hi,

is there any chance to get this change into the main code base?

I think I will make an ajax call to a server side script with every resize to persist it in the config table. Maybe I will also save the cursor position in the entryproperties table because I use the preview and save buttons very often I don't like to search for the last position every time.


Regards,

ahe

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Resizable standard editor

Post by garvinhicking » Mon Feb 11, 2008 7:02 pm

Hi!

is there any chance to get this change into the main code base?


Sure, if it works well! :)

However I'm not so fond of the ajax call, actually. I'd rather store it in a cookie on submit/preview, so then it can be different forthe same author on different browsers or computer screen resolutions.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

ahe123
Regular
Posts: 8
Joined: Sun Feb 10, 2008 8:21 pm

Re: Resizable standard editor

Post by ahe123 » Tue Feb 12, 2008 12:19 am

OK I'll use cookies. Now that I think about it I think there's no strong reason to put it into the database.

As I already saw there is a SetCookie() function in serendipity_admin.php. Is there a GetCookie() function somewhere? Wouldn't it make sense to put it in a global JavaScript library file instead of serendipity_admin.php?

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Resizable standard editor

Post by garvinhicking » Tue Feb 12, 2008 10:00 am

Hi!

No, you can access cookies through $serendipity['COOKIE']['variable'] easily. :)

As I already saw there is a SetCookie() function in serendipity_admin.php. Is there a GetCookie() function somewhere? Wouldn't it make sense to put it in a global JavaScript library file instead of serendipity_admin.php?


Currently there's no need for that, if it every becomes a need we can think about it. But currently the s9y frontend does not need any javascript libraries, only the backend.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

ahe123
Regular
Posts: 8
Joined: Sun Feb 10, 2008 8:21 pm

Re: Resizable standard editor

Post by ahe123 » Wed Feb 13, 2008 9:28 pm

Thanks for the advise. It works now :D

The size of the text field can be changed and is saved to a cookie. I tested it with Firefox 2, Opera 9.2 and IE 7. Getting the cursor positon with JavaScript seems to be less trivial so I will try to implement this in the next days.

I made changes to templates/default/admin/enties.tpl and includes/functions_entries_admin.inc.php.

You can get the patches from here:

http://www.zockblog.org/entries.patch
http://www.zockblog.org/functions_entries_admin.patch


Regards,

ahe

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Resizable standard editor

Post by garvinhicking » Thu Feb 14, 2008 12:24 pm

Hi!

Oh, I don't really like those +/- buttons *g*

! I thought you were talking about textarea resizing through a vertical mouse grip at the bottom right of textareas like you get when using that firefox resize addon? I find that way sexier...having two more buttons on screen is IMHO too cluttering for the interface.

In this case I would suggest enhancing a plugin like serendipity_event_typesetbuttons to add those buttons to the output, then you also wouldn't need to modify any template files?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply