Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

Page: 1 2
# D3grade 4/21/2008 10:04 AM
Hi Guys,

When working on modules, i seem to come against a common problem. The battle between administering in one place, and module abilities. An example of this is a news module. Whilst it makes sence to be able to click to edit the news module and edit all the news articles within it, i come across the problem of what functionality the article view module can do.

Say for example on the article details view there may be a link to a PDF download, links to related news, an embeded video or an image gallery. Now each of these could easily be there own module, but as the article view is part of another module, and so it's output is dynamic (ie always the same physical page, just a different article is loaded) there isn't a way to have these modules on the article details view with related content.

This can obviously be achived by just creating pages and adding modules for each article, but this then means they are not managed as easily.

Does anyone have any advice on how best to work in scenarios?

Many thanks

Matt
# martijnb 4/21/2008 6:29 PM
Maybe you can leverage module connections? There is a little topic about it in the module development guide. These connections allow to connect different modules.
For example, an article list module can connect to an article details module with the article ID as parameter. See also the Articles module as an example. it can be connected to a section with a ProfileModule with the user ID as parameter.
# D3grade 4/21/2008 6:37 PM
I am aware of module connections, but as far as i am aware you can't get the module to do something based on another module on the same page, i thought it only showed the relevant content when it was directly linked to, no?

I'm guessing the event mediator in the ecommerce module might go someway to solving this, which i will be looking into, but I just want to see how other people do this as i have hit the problem multiple times so other must have also.

Matt
# D3grade 4/22/2008 5:37 PM
Has nobody else come across this probem?

Say you use the Article module and a client then requests to add video files, or downloads, or a rating system, etc, etc. Do you guys just keep extending the Article module? even if it's a duplication of functionality in a different module?

Matt
# martijnb 4/22/2008 6:23 PM
D3gradeI am aware of module connections, but as far as i am aware you can't get the module to do something based on another module on the same page, i thought it only showed the relevant content when it was directly linked to, no?

Indeed, connections always require an action. In the case of article-comments, this would imply that you have to click a button to view the comments on the page.

Perhaps the event mediator solution in the eCommerce module will work, but unfortunately, I don't have enough experience with it to give some sane arguments in this case.
# D3grade 4/22/2008 8:24 PM
It's just a little frustrating at the moment, as we have created a module for a client that lists all of their products, so we have done it similar to articles so that it can all be managed in one place. The problem is the client keeps requesting more features so it is just becoming one monster module which i don't think is using the framework to it's maximum.

They can enter product details, add statistics, images, movies, downloads, links to similar content and categories, and have just requested a rating feature and customer comments all under one roof. I just can't see how you can do it any differently if you want to manage them alltogether.
# jbland 4/22/2008 8:40 PM
Matt,
do you have a rough idea of what a solution would look like ? im working on a social network and im running into the same types of questions.

btw, im still working on the EventMediator (mostly done). My initial usecase was different so i had to accomodate the UI aspect. i dont have a working module yet that uses it though. Let me know if you want an early peek.


# D3grade 4/22/2008 9:13 PM
I'm not sure quite yet, i'm trying to work it out in my own head.

I guess going the mediator route, you would need someway of telling a module it's content is related to something else and show that content if a certain event is fired. But would this add extra complexity in updating? ie add content in one place, then images in another, then downloads in another?

The only other thing i've been thinking of, but have no idea how it would work is weather you can make modules, that use other modules? So you could create a module that allows you to manage all your products in one location, but when you edit a product, you may see a list of more modules and you click to change one. This would, to me, give you the best of both worlds. Manage similar items in one place, but be able to build up the way they are viewed.

What do you think?
# jbland 4/22/2008 11:13 PM
like you, im still not sure of how this would work UI wise, but the way my code would work is to allow you to associate an event with a delegate which is called when that event is raised. So for example, the product list could raise the event "Product.Selected" and pass the product id (or product itself) as an argument.

protected void Page_Load(object sender, System.EventArgs e)
{
   //  other init code
    MediatorUtils.RequestPublish("Product.Selected");
  // other code
}


    private void ddlProducts_SelectedIndexChanged(object sender, EventArgs e)
   {
       // other processing code
       MediatorUtils.RequestNotify(this, "Product.Selected", "productId", productIdFromForm);  // one of the convenience overloads
   }

This is completely independent of whether any module on a page understands the event, but this is provided precisely for extensibility. E.g. when the video module is written, it will have the code

  
protected void Page_Load(object sender, System.EventArgs e)
{
  MediatorUtils.RequestSubscribe("Product.Selected", ProductSelectedHandler);
}


  protected void ProductSelectedHandler(object source, MediatorEventArgs args)
  {
        this.productId = (int)args.Properties["productId"];
       GetRelatedVideos(productId);
  }

  protected void GetRelatedVideos(int productId)
  {
    IList relatedVideos = videoService.GetProductVideos(productId, 0, VideosPerPage);
    DoSomethingWithVideos(relatedVideos);
  }

The same goes for when the ratings module is written. This way the system remains loosely coupled and extensible.

thoughts ?
# D3grade 4/23/2008 9:29 AM
Pretty much how i thought it would work, and i like the decoupled nature. I'd just like to see how complicated the administration of it would be, associating the media file with an article.
# jbland 4/23/2008 2:37 PM
D3gradePretty much how i thought it would work, and i like the decoupled nature. I'd just like to see how complicated the administration of it would be, associating the media file with an article.

yeah, thats an issue if you want to handle it in an automated way, but for my purposes Cuyahoga is more CMF than CMS. So in this case, i know there'd be some additional manual work. in my case, i would create a frontend protected page to handle those tasks (yet some more modules, but for admin only. or maybe just an aspx).



jbland
# D3grade 4/23/2008 3:17 PM
What do you think of the other idea of having modules that can be made up of other modules? (From both a useable point of view and architectualy)
# jbland 4/23/2008 3:35 PM
D3gradeWhat do you think of the other idea of having modules that can be made up of other modules? (From both a useable point of view and architectualy)

im note sure i understand the concept... could you explain more ? give an example ?
# D3grade 4/23/2008 3:46 PM
I'll try, like i said before, i have no idea how it would be implemented yet, but the more i think about it, it goes along the following lines.

You'de have a module that allows you to manage multiple items (similar to Article module) So it's initial view would be a list view with link to a details view. In the admin, when you go to edit that module you are presented with a list of entries (the same as Article) however in the edit screen for an item, you are presented with some sort of placeholder for other modules (something similar to the Section part of the edit node screen). Here you can basically add modules to build up the details view and enter content specific to that item.

From the front end point of view, i guess you would click through from the inital list to a details view which would then dynamicaly build the modules in the same way as the pageengine.

I'm not sure how this would affect any search indexing and the likes.

Does this explain any clearer?

Matt
# jbland 4/23/2008 10:18 PM
D3gradeYou'de have a module that allows you to manage multiple items (similar to Article module) So it's initial view would be a list view with link to a details view. In the admin, when you go to edit that module you are presented with a list of entries (the same as Article) however in the edit screen for an item, you are presented with some sort of placeholder for other modules (something similar to the Section part of the edit node screen). Here you can basically add modules to build up the details view and enter content specific to that item.

From the front end point of view, i guess you would click through from the inital list to a details view which would then dynamicaly build the modules in the same way as the pageengine.

This is a lot, and mixes a few things, but lets try to see what this would entail...
First, modules would have to have some notions of "relatedness" (or a module may specify that its related to the Product's module, for instance). But when we speak of modules, we really mean views (the News modules, for instance has many views). Even leaving aside the distinction, there would have to be either an interface or Db entry which establishes that a module makes use of another. Perhaps the Actions idea can be perverted for this purpose.

Second is the question of layout. Where and how is the related module placed ? (i guess you address this in the second paragraph) In Drupal, there is the concept of module weights, and in certain cases (like nodes), you speify that a module goes before or after another. I personally like Cuyahoga's decision to go the hthml/css route via templates. If we stick with that paradigm, would we use subtemplates?

im at work, so that's all the time i have for now...
# D3grade 4/23/2008 11:17 PM
Thanks jbland,

Some interesting ideas there, i think you have gotten the ideas i was trying to put over, but i would like to clarify one thing (i don't think anythin you have said goes against it, but i just think it needs saying) the idea is to try not to duplicate functionality, so if i create a downloads module, i'd want to be able to use it standalone as a normal, or embeded within the article details view.

With what you have outlined, i guess this could be achived by having both modules utilise the same view.

Do you think this is a viable route? or are we over engineering something?
# jbland 4/23/2008 11:39 PM
D3gradethe idea is to try not to duplicate functionality, so if i create a downloads module, i'd want to be able to use it standalone as a normal, or embeded within the article details view.

With what you have outlined, i guess this could be achived by having both modules utilise the same view.

Do you think this is a viable route? or are we over engineering something?

im dealing with the same issue. the thing is that to do this right, you had to have started out thinking that way. IOW, not having an all-encompassing module, possibly having a single view per module, developing some means of module classification (so we dont have a mile long list). my only difference with what you said is that (as i said previously), i'm looking more for a CMF as opposed to a CMS, so i dont expect the layout issues to be resolved automatically for me. Its enough for me to put the list view and detail view on the page and have event code/actions do their thing.
i *think* N2CMS does somewhat of what you want, so you may want to look there for ideas. My only problem with their approach is the mixing of the content item with its presentation (SRP violation), but i guess it works well for their purposes.
# D3grade 4/24/2008 9:36 AM (edited 4/24/2008 9:37 AM)
I think i'll just have to see what i can come up with. I'll take a look at the N2CMS and see if there is anything we can take from it.

If you have any other thoughts on this please do let me know (that goes for everyone).

PS Thanks for all ideas JB, they have been really helpful
# swilliam 5/7/2008 12:44 PM
The solution we used for a few things is to have a class instance that is shared in the current request (see WebStoreContext in the eCommerce code). There is only ever one instance per request and is accessed by a static method. The instance will have an event like EventPublished, or something more meaningful, and a method called PublishEvent() or something. One control (notifier) will publish an event by calling PublishEvent(), with arguments, which fires the EventPublished event. Any controls listening to this event can handle the event, checking if it is one they want to handle, and use the arguments supplied by the notifier. This uses the mediator pattern and isolates sender from receiver, and is also completely independent of Cuyahoga.

Simon
# D3grade 5/7/2008 9:38 PM
I think this was mentioned earlier.

The one thing I want to figure out using this method is how easy it is for an admin to setup? How to link an image in a image gallery module, to an article in a new listing? The reason why the module is every expanding is becuase we want to administer the content that makes up an article (be that text, images, videos or downloads) in one place, but still be able to split it into multiple modules (ideally that can work standalone also without needed to be hooked into the article module).

Do you have any advice on this?
Page: 1 2