Ticket #541 (closed Enhancement: fixed)

Opened 11 years ago

Last modified 11 years ago

Question: Is there a way to access the parent-topics ID from within a multi_renderer

Reported by: Malte Owned by: jri
Priority: Minor Milestone:
Component: DeepaMehta Standard Distribution Version: 4.1.2
Keywords: Cc:
Complexity: 1 Area: Application Framework / API
Module: deepamehta-webclient

Description

The scenario is the following:

I wrote a multi_renderer for "Moodle Items" which are aggregated child topics of a "Moodle Section". Now, whenever a user clicks on a "Moodle item" I want to reveal two items, the intermediary "Moodle Section" topic and the clicked "Moodle Item", but in the click handler of the latter I don't know the parents topic id.

I just wonder if this is possible somehow because otherwise I would have to implement a custom renderer for the parent, too.

Change History

comment:1 Changed 11 years ago by Malte

When inspecting the page_model of my "Moodle Items" I could not find the corresponding parents ("Moodle Section") topic id.

comment:2 Changed 11 years ago by jri

You're right, the parent topic ID is not contained in the page model. In the Moodle Item click handler you could request the parent topic from the DB. This would not be expensive as only performed when the user clicks.

What is the selected topic in your scenario? In case it is the Moodle Section you find that topic in page_model.toplevel_object (as well as in dm4c.selected_object).

Should we include the parent topic in the page model? (The parent *type* is available in page_model.assoc_def)

comment:3 follow-up: ↓ 4 Changed 11 years ago by jri

Meanwhile JuergeN came up with a scenario that leads to a similar renderer question regarding the parent object (#566).

In a page model I will provide access to the parent page model very soon (#567).

In your Moodle Item's renderer you will then have access to the Moodle Section ID by page_model.parent.object.id.

comment:4 in reply to: ↑ 3 Changed 11 years ago by jri

Replying to jri:

In your Moodle Item's renderer you will then have access to the Moodle Section ID by page_model.parent.object.id.

This is now realized (see the hints in #567).

comment:5 Changed 11 years ago by Malte

Great, thanks for the progress.

As soon as I can update the moodle-plugin to run on 4.1.13 I will use that new info to enable users to reveal the intermediary-topic right away with their click on a sub-sub-topic.

This way custom_renderers of the "Page Panel" can reveal the complete path (render it on the map) if a user decides to reveal a deeply nested topic (in this case a "Moodle Item" which is a sub-sub-topic of a "Moodle Course").

comment:6 Changed 11 years ago by jri

Good!

comment:7 Changed 11 years ago by jri

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.