Modify

Opened 6 years ago

Last modified 2 years ago

#4779 new enhancement

Clone post or template support

Reported by: ilmars Owned by: osimons
Priority: normal Component: FullBlogPlugin
Severity: normal Keywords:
Cc: rjollos 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 6 years ago by ilmars

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 5 years ago by rjollos

  • Cc rjollos added; anonymous removed

comment:3 Changed 5 years ago by rjollos

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

comment:4 Changed 2 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.

Add Comment

Modify Ticket

Action
as new The owner will remain osimons.
Author


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

 
Note: See TracTickets for help on using tickets.