Documentation

Learning Center

The Guide, Knowledge Base, and FAQ — all in one place.

XMod Pro Online Help →
← Return to list

Author Management

We can add authors now but there's not way to see them, edit them, or delete them. We'll rectify that in this lesson.

Now that we've created our Author Form, we can now add new authors to our system. Without any additional effort on my part, the Form Builder has also created an Edit form for our authors. However, we don't have any way of accessing it. Come to think of it, we don't know for sure if the authors we have added already have even made it to the database. Let's correct all of that now by building a basic interface to manage our authors. 

In XMod Pro, you create views of your data by creating templates. These templates are very flexible. They can be tightly coupled to your form (as we'll do in this example) but they don't have to. Though we won't cover it here, you can even embed multiple data views inside a single template. Templates provide a way for you to mix data from you database in with your own HTML, CSS, and even Javascript. XMod Pro handles all the plumbing for you, leaving you in control of the visuals so you can fit your solution in with the look and feel of your site - regardless of how that site is styled. So, let's create our first template.

  1. From the Actions Menu on the Author form's module, navigate back to the Control Panel
    Selecting the Control Panel item from the Actions menu

  2. Click on the Manage Templates button in the toolbar
    Manage Templates toolbar button

  3. This will bring up the Manage Templates Grid, where you can add, edit, delete, and copy your templates as well as see which templates are in use - much like the Manage Forms Grid functions for forms.  
    Manage Templates Grid

  4. To create a new template, click the New Template button
    New Template Button

  5. This displays the New Template Dialog where you can tell XMod Pro how to generate your template.
    New Template Dialog

  6. Let's begin by selecting Grid as the View Type
    Select Grid View Type

  7. Next, select DotNetNuke Database Table for your Data Source
    Select DotNetNuke (DNN) Database Table for the Data Source

  8. Once you select your Data Source, XMod Pro will fetch a list of tables and views from your datasource and display them for your selection. Once this is done, select our XMP_ArticleAuthors table:
    Select the XMP_ArticleAuthors table

  9. Set the remaining settings as you see them below. The Key Field is the column that uniquely identifies each record. This is needed for XMod Pro to wire-up your form and template so you can update and delete records - without having to do any coding.  The columns selected in Choose Fields will determine the values that appear in your List View - i.e. the list of all your authors. If you tick the Include Detail View box (do so for this example), then the Choose Detail Fields list will determine the columns that will be available in your record's Detail View - i.e. when a user clicks on record in your List View, they will be shown that record's details.  Again, all this is wired up by XMod Pro so you don't have to code anything.
    New Template dialog settings for Author template

  10. Astute readers will have noticed the Buttons tab. We don't want to change anything there for this example. Here's a look at that tab:
    New Template Dialog buttons tab
    This tab allows you to select which of the built in button types XMod Pro should include when it generates your template. If you click the arrow next to a button, you can determine what type of control will be used for the button (a push button or an image or a hyperlink), the button's caption, as well as what DNN Security Roles are allowed to perform that action. For now, don't change anything on this tab.
    Add Button Expanded 

  11. Click the Save button in the bottom-left corner of the dialog. Once you do, XMod Pro will generate your template and display it for you in the template editor. Don't let the code scare you away. You actually don't have to do anything with it - but it's there so you can customize it later.
    Initial Author Template Code

  12. As I mentioned in the previous step, you don't have to touch the code here. Simply give your template a name of Author_Manager. Just like forms, template names cannot have spaces or special characters. You can only use letters, numbers, underscores and dashes. I'm using underscores.  
    Give the template a name

  13. Once you've supplied the name, click the Save button and XMod Pro will save your shiny new template
    Manage Templates Grid with Author_Manager template listed

  14. Finally, let's configure our module to use the new template. Exit out of the Control Panel and go to the Configure page of your Authors module. On that page, select the template we just created from the Portal Templates dropdown
    Configuring the module to use the Author_Manager template

  15. Save your changes and you should see something similar to this:
    Initial Author management template displayed

  16. Your solution is fully-functional. You can add authors by clicking the New link at the bottom of the author list, and you can Edit, Delete and view the Details of each record by clicking on their respective links - and you didn't write a single line of code or touch the database. That is a LOT of functionality that XMod Pro has pre-built for you.  On top of that, it didn't take long to do it. I guarantee that it took you a lot longer to read through this article than it will take you to build it again. In most cases, the entire process should only take a couple of minutes at most.  
    Author detail view for Herman Melville


  17.  

It Ain't Pretty

Well, that's kind of the point, isn't it? XMod Pro is an enabler - a tool you can use to quickly build the functional guts of your application in a matter of minutes without you having to do any coding at all. That's its first goal. Its second goal is to stay out of your way as much as possible. Every website you build is different - different styles and layouts and functional requirements. So, it adds clean HTML (witness the plain table it created in our example) and complete flexibility for you to add your own CSS class names, styles, and Javascript.

In the next lesson, we'll customize the template we just created so you can get a taste for how to do your own customizations.

 

← Return to list