Need ideas creating a Content Part

Oct 20, 2010 at 6:52 AM

Hi, I’m going to write a content part to present media files. For example when creating a new blog page I want to be able to upload a file and attach to the page, and when viewing the page show an overview of the media file if it’s of a known file type. I’m learning Orchard development as I go, but I’m not exactly sure how to design this content part as I'm not familiar with all the limitations/features of the platform. Please help me get an idea where to start for this project. How would you go with the implementing such a content part, as it needs to store files on the file system (like Orchard.Media module) and store the relations in database (like Orchard.Comment)? Are there any services that Orchard already provides that I can use for this? For example, can I reuse Orchard.Media to upload and store files from my module without having to write a similar functionality? Is there a module that you can suggest me to use as a template here? I'd appreciate any comments/ideas.

Thanks,

Omid

Coordinator
Oct 20, 2010 at 4:22 PM

I would suggest you to create a new Field Type for that. You can find some documentation on the website with an example.

A field type would allow anyone to add images to any content type, in a very unobstrusive way. Can I suggest you to look at how Drupal is doing it, there are a bunch of available fields for that on Drupal from where you could get a lot of ideas.

Sebastien

Oct 20, 2010 at 7:41 PM

The closes thing I could find is Creating custom content types. Are you suggesting a custom Field Type? What I want to do definitely needs some coding and custom UI, I'm not sure how to do it with custom types. Please advise me.

 

Coordinator
Oct 20, 2010 at 7:44 PM

I really mean a Field Type which does require custom coding and UI.

Take a look at this: http://www.orchardproject.net/docs/Creating-a-custom-field-type.ashx

Oct 23, 2010 at 12:15 AM
Edited Oct 27, 2010 at 9:38 AM

Hi Sebastien,

I followed your tutorial on Creating a custom field type. The tutorial is very well written but it needs to be updated as some API is changed. I tried to figure the changes I needed to make in the code but I still have a problem. I can add the DateTimeField to Content Types and set its settings but it doesn't show up in the Edit Type page.

 

Coordinator
Oct 23, 2010 at 12:28 AM

Yes, we are going to do a pass on all the documentation and upgrade it for 0.8. Please do note that the documentation is a wiki and that you can submit changes directly there. Thanks for the heads up.

Coordinator
Oct 23, 2010 at 1:21 AM

The field is now updated to the latest dev version. You can get it on orcharddatetime.codeplex.com, waiting for the documentation to be updated with those changes.

Oct 23, 2010 at 1:35 AM

OK, I created a user for orchard wiki. Waiting to be approved :)

Coordinator
Oct 23, 2010 at 9:35 PM

Done. Please be sure to follow the guidelines from this page: http://orchardproject.net/docs/Documentation-style-guidelines.ashx

Oct 27, 2010 at 9:46 AM

I updated the doc in the wiki, but there are some parts that need more description that I'm not very familiar with. Please see TODO on the page. Thank you.

Coordinator
Oct 27, 2010 at 4:31 PM

Thanks for your contributions.

Nov 15, 2010 at 4:10 PM
Edited Nov 15, 2010 at 4:11 PM

There is an issue on the DateTimeField.

Coordinator
Nov 15, 2010 at 4:14 PM

I have commented this item, can you check please ? A recent changeset have induced some new zone names in the admin, for consistency.

Nov 15, 2010 at 4:22 PM

That worked very nicely, thanks! I'm wondering why using two separate configuration files (placement.info and module.txt) in two different markups (XML and YAML), this looks a bit inconsistent to me. Just a thought.

Coordinator
Nov 15, 2010 at 4:26 PM

We all agree ;) But not high priority.

Nov 15, 2010 at 4:33 PM
Edited Nov 15, 2010 at 4:53 PM

One suggestion: A document schema (XSD) for placement.info files would be great. It can include both documentation of the elements as well as allowing auto-completion in visual studio, and let Orchard to validate the placement.info file.

Nov 15, 2010 at 7:45 PM

I think I messed up the <script> tag here. I wanted to add a minor change but it didn't allow the script tag.

Coordinator
Nov 15, 2010 at 8:03 PM

Weird. I fixed it.