Forum OpenACS Development: Replicate news among instances of news pkg

Hi there,

I have the following scenario and I'd like to share it with the community just in case we have a better way to accomplish the goal.

I have several instances of package "news" that are mounted under several subsites bellow the Mainsite.
Under the Mainsite I also have another instance of package "news" where I created a functionality, parameterized, to replicate "news items" to the other instances distributed in the subsites bellow the Mainsite.

There are a few considerations:

1) The "news item" must be actually duplicated, which means I must not link, somehow, the "news item" from the main instance, to any instance bellow, in order to read it from there. The reasons for that are many. They lay down in the OACS dependencies and associations such as permissions and etc.

2) Moreover I do need to recreate/import the "news item" from the main instance to the respective instance choosen.

The big question is: How do I know/associate that the duplicated "news item" comes from the main "news item" from the main instance?

I believe the best way to go is using acs_rels. I can create a new rel_type called replicate_news, on acs_rel_types, and use it acs_rels to know/associate both items such as in

(rel_type,object_id_one,object_id_two) = (replicated_news,news_id1, news_id2)

Any ideas if this is the best way to go?

Collapse
Posted by Ryan Gallimore on
Hi Iuri,

This may be more complicated than it needs to be.

Why do you need multiple package instances?

It sounds like you can create one news instance and permission each item you create. Create a new dropdown of grantees (parties) in the news create admin page and grant read permission on submit.

Your users with read on the main site news package will then only see the items that have been permissioned for them. I would suggest granting permissions to groups or relational segments rather than individual users.

Collapse
Posted by Iuri Sampaio on
Ryan,

You misunderstood the main idea. What you described doesn't fit in the scenario.

The structure is already in place, package instances are already there.
I want to avoid the duplicated work of the staff. i.e. the situation to manually create a "news item" twice, on two different package instances.

Collapse
Posted by Ryan Gallimore on
Iuri,

I was suggesting a change in your scenario to prevent unnecessary work.

1) Why do you have so many news instances?

2) Can you permission the individual news items inside one instance instead of using many package instances? This would avoid duplicating objects.

3) How is news being viewed on your site by your users? A use case would be helpful.

If the structure is already in place, it would not be difficult to alter the context of the existing items and move them to a new package.

Collapse
Posted by Iuri Sampaio on
1) Because every subsite as well as dotlrn communities, must have an individual application of news.

2) I agree that duplicated objects looks at least unnecessary and redundant information. But I still don't see another way to accomplish it. Your approach about giving permission seems very confuse, plus it would add even more customised code in the news package .

3) What do you mean with a use case of how the news are viewed?
The news are viewed by subsite or dotlrn community. Each one community or subsite has one instance of news package, if its closed the news are available only to members, if not the public is allowed to view so.

I don't why it was made like that but maybe there is a reason for it. I believe it was to make things more organised and easier to maintain. I also think the same.

By the way, We are discussing what is the best to be done, aren't we?

Once we figure out the approach to take I am well aware of how to code it

Collapse
Posted by Dave Bauer on
Do you want ALL news items to appear in the subsite news?

If you you just need a query that pulls all news items and does not restrict by package_id.

Collapse
Posted by Iuri Sampaio on
Nope, just a few.
Precisely, the ones they choose to.
Collapse
Posted by Iuri Sampaio on
So far I ended up using acs_rels to associate one "news item" to another.

That way
1) I kept the structure as it is (many instances of news mounted under subsites and dotlrn communities)

2) The feature is parameterized, so, only chosen instances are able to replicate its news to others.

3) Plus, with acs_rels I can easily track what "news items" are replicated and then make the necessary amends in case the original item has been edit.

4) The "news items" are associated, but the fact that they are not the same any more, it offers the possibility to customize the news even further.

For example I created new templates do display "news items" accordingly to the priority and the sort order, which btw they change from one instance to another.

Thus, in the Mainsite we have the "news item" as an important one, "Breaking News", located in the first page with photo, large fonts and etc.
http://www.mda.gov.br/portal

But, the replicated "news item" is in a subsite under mainsite with no photo, smaller fonts, as a secondary item.
http://www.mda.gov.br/plano-safra

Furthermore,
I still can't picture how permissions applied to only one instance of the news pkg working for many subites would substitute the structure of different instances on different subsites and dotlrn communities.

So please, Ryan if you have time it would be great to see how that works out.