Extend Admin Section - Excel Importer For Content

Topics: General, Writing modules
Jul 30, 2012 at 8:09 AM

Hi I have spent alot of time in umbraco and would now like to start using orchard for it's mvc capabilites.

 

I'm just wondering the process of how to extend the admin area. I wanted to write an excel importer using FlexCel so content admins could log in to the admin area and import a spreadsheet to a db table. or alternatively create pages on the fly with cms content fields populated with the content.

 

I was just wondering what would be the best way of going about this as I'm not too familiar with the terminology or definition of a module whether that's an admin or public facing feature etc...

Developer
Jul 30, 2012 at 10:06 AM
Edited Jul 30, 2012 at 10:08 AM

That's basically a 3 step process:

  1. Create a Module (see the docs on how to generate a skeleton project for that.)
  2. Create an admin controller (there's a tutorial on that). In this controller, you'll leverage Orchard's ContentManager amongst other services that you may need.
  3. Implement a navigation provider class to inject menu items in the admin menu

A module can provide many features, some meant to be public facing, some meant to be admin facing, or both.
The dashboard is basically another module and a theme called TheAdmin, which activates on certain conditions (e.g. when the url starts with "/admin")

A module in Orchard is very much like an MVC area.

Jul 30, 2012 at 1:41 PM
Edited Jul 30, 2012 at 1:44 PM

I have built a excel importer for Orchard before so it's certainly possible and quite easy.

Create a module like sfmskywalker told and put a admin controller with action like:

[HttpPost]        [ActionName("ImportPagesByExcel")]        public ActionResult ImportPagesByExcelPost(string duplicateHandling, HttpPostedFileBase file, HttpPostedFileBase avatar, int skipCount, int max, char separator)

In the method a StreamReader which reads the posted excel file and you are ready to save data!