Opened 10 years ago

Closed 10 years ago

Last modified 10 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


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:

Attachments (0)

Change History (4)

comment:1 Changed 10 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 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 10 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')['display'] = display
        if display == 'flat-asc':
  ['messages'] = self.get_flat_messages(context,
              topic['id'], visit_time)
        elif display == 'flat-desc':
  ['messages'] = self.get_flat_messages(context,
              topic['id'], visit_time, 'ORDER BY time DESC')
	elif display == 'tree':['messages'] = self.get_messages(context, 
	      topic['id'], visit_time)
  ['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 10 years ago by Radek Bartoň

Resolution: fixed
Status: assignedclosed

Implemented in r3518.

comment:4 Changed 10 years ago by lordsauronthegreat@…

Wow, man, you're amazing! Thanks!

Modify Ticket

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

Add Comment

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

Note: See TracTickets for help on using tickets.