Modify

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#2911 closed enhancement (fixed)

RFE: Add Ability to Define a Default Display Mode

Reported by: lordsauronthegreat@… Owned by: Radek Bartoň
Priority: normal Component: DiscussionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Right now the forum defaults to a tree view, which can get crowded towards the right side of the screen after a while. It would be really nice if administrators could control the default display mode. I read through the code base, and I think I found where the default mode is set:

http://trac-hacks.org/browser/discussionplugin/0.11/tracdiscussion/api.py#L763

Attachments (0)

Change History (4)

comment:1 Changed 17 years ago by Radek Bartoň

Status: newassigned
Summary: Add Ability to Define a Default Display ModeRFE: Add Ability to Define a Default Display Mode

Ok. Actually the modification should be done at http://trac-hacks.org/browser/discussionplugin/0.11/tracdiscussion/api.py#L764 where will be test if display type is present in session and if not loaded from configuration option which will be defined at the top...

comment:2 Changed 17 years ago by lordsauronthegreat@…

Cool, I successfully isolated the right line of code. The more I read, the better I'm getting at this Python stuff. I still wouldn't feel safe trying to make a really big change - I'm liable to break something!

In the mean time, I managed to make an ugly nasty evil hack to do what I wanted by reorganizing the structure of that if-elseif-else block:

        # Prepare display of messages.
        display = context.req.session.get('message-list-display')
        self.data['display'] = display
        if display == 'flat-asc':
            self.data['messages'] = self.get_flat_messages(context,
              topic['id'], visit_time)
        elif display == 'flat-desc':
            self.data['messages'] = self.get_flat_messages(context,
              topic['id'], visit_time, 'ORDER BY time DESC')
	elif display == 'tree':
	    self.data['messages'] = self.get_messages(context, 
	      topic['id'], visit_time)
        else:
            self.data['messages'] = self.get_flat_messages(context, 
	      topic['id'], visit_time)

I would not suggest it for anything beyond my site (which didn't blow up, so I guess it works).

comment:3 Changed 17 years ago by Radek Bartoň

Resolution: fixed
Status: assignedclosed

Implemented in r3518.

comment:4 Changed 17 years ago by lordsauronthegreat@…

Wow, man, you're amazing! Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.