Modal support

Modal support

Postby eric9066 on Fri Jul 15, 2011 9:40 am

Hello,

I'd like to add a function to my website that would allow a member to add a quick blog post from anywhere on the site by clicking a button on a toolbar that would open a modal window. Is this possible or will smarty templates not allow such a thing?

Thanks
eric9066
 
Posts: 8
Joined: Thu Jul 14, 2011 4:32 pm
LifeType Version: 1.2.11

Re: Modal support

Postby jondaley on Sat Jul 16, 2011 1:53 pm

That should be doable. I would probably do it using a jquery modal window, and then simply direct the url to /admin.php?blogId=XXX&op=newPost or whatever it is called. I've never tried it, but I think it would work. You might have some trouble making the window size be big enough to be useful on the post editing page.

I suppose you could make your own edit box and post the data yourself. Oh - you need the CSRF token for posting. I'm not sure how you would get that - I'm guessing you want to have the user logged in already, so he doesn't have to login when he hits the "quick post" button?
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Modal support

Postby eric9066 on Sat Jul 16, 2011 3:52 pm

Hi Jondaley,

I'm guessing you want to have the user logged in already, so he doesn't have to login when he hits the "quick post" button?


Correct. The person would be logged in already. I want to put a blog button on a tool bar (which only appears when you log in). I don't really care about the size of the box (not until I see it, I guess).

Oh - you need the CSRF token for posting. I'm not sure how you would get that


What is the CSRF token?

Thanks
eric9066
 
Posts: 8
Joined: Thu Jul 14, 2011 4:32 pm
LifeType Version: 1.2.11

Re: Modal support

Postby jondaley on Mon Jul 18, 2011 12:17 pm

CSRF is a security issue: http://en.wikipedia.org/wiki/Cross-site_request_forgery

A CSRF token is a way to protect sites. LifeType has a CSRF plugin (with a bit of supporting core code) that protects the software. We need to change a couple forms to use POST requests on the admin side, which they should be anyway, and that will solve the last couple issues with the plugin.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Templates

cron