Modify

Opened 16 years ago

Last modified 5 years ago

#4779 new enhancement

Clone post or template support

Reported by: Ilmars Poikans Owned by: osimons
Priority: normal Component: FullBlogPlugin
Severity: normal Keywords: patch
Cc: 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 (8)

comment:1 Changed 16 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 15 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:3 Changed 15 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 12 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.

comment:5 Changed 5 years ago by Ryan J Ollos

Cc: Ryan J Ollos removed

comment:6 Changed 5 years ago by figaro

Keywords: patch added

comment:7 Changed 5 years ago by figaro

See also #8457, possibly duplicate request.

comment:8 Changed 5 years ago by Ryan J Ollos

#8457 closed as a duplicate.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain osimons.

Add Comment


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

 
Note: See TracTickets for help on using tickets.