Modify

Opened 8 years ago

Last modified 5 years ago

#4779 new enhancement

Clone post or template support

Reported by: Ilmars Poikans Owned by: Odd Simon Simonsen
Priority: normal Component: FullBlogPlugin
Severity: normal Keywords:
Cc: Ryan J Ollos Trac Release: 0.11

Description

I'm using FullBlog plugin and it works well. But I have few very similar type of posts and it would be very helpfull, if there would be support for blog post templates.

Probably "template support" can be done very simple - by adding "Clone" button to every post for all users who can create new posts or make one more clone permission type. User can tag all templates for easy finding and broswing, for example, Templates or any other tag.

Anyway sometimes Clone button can make life easier even if you need to clone just once.

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by Ilmars Poikans

Currently I have found semi-solution, which is hacky with limitation and not nice - to put link somewhere in Trac

http://server.com/projects/myproject/blog/create?name=namevalue&title=tilevalue&body=bodyvalue&categories=tag&blog-preview=Preview+post&action=new

all values must be urlencoded of course.

It would be much nicer and I hope very easy to progam (reusing most of the code and with minimal additional code), if Clone button would pass additional parameter to create, so it know that it must clone post and load field values from post with name X from table in db. Maybe passing version id of post won't hurt.

comment:2 Changed 7 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:3 Changed 7 years ago by Ryan J Ollos

I'd find the template feature to be useful if it were implemented similar to t:PageTemplates in the Trac wiki.

comment:4 Changed 5 years ago by anonymous

I implemented this thusly:

from datetime import date 
20d18
< 
420d417
< 
422,435d418
<             if field in ['template']:
< 		tname = fields[field]
< 		cnx = self.env.get_db_cnx()
< 		cursor = cnx.cursor()
< 		sql = 'SELECT bname,title, categories, body FROM blog_template WHERE tname = "%s"' % tname
< 		cursor.execute(sql)
< 		row = cursor.fetchone()
< 		if row:
< 			cdate = date.today()
< 			setattr(self, 'name', cdate.strftime(row[0]))
< 			setattr(self, 'title', cdate.strftime(row[1]))
< 			setattr(self, 'categories', row[2])
< 			setattr(self, 'body', row[3])
< 			changes_made = True

Have to create the entries in the sql by hand .. but quite useful.

Modify Ticket

Action
as new The owner will remain Odd Simon Simonsen.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.