Index: trunk/grails-app/controllers/AppCoreController.groovy
===================================================================
--- trunk/grails-app/controllers/AppCoreController.groovy	(revision 234)
+++ trunk/grails-app/controllers/AppCoreController.groovy	(revision 237)
@@ -1,8 +1,12 @@
 import org.codehaus.groovy.grails.plugins.springsecurity.Secured
 
+/**
+* Controller class for the application core views.
+*/
 class AppCoreController extends BaseController {
 
     def personService
     def createDataService
+    def appConfigService
 
     def index = { redirect(action:start,params:params) }
@@ -25,7 +29,13 @@
     }
 
+    /**
+    * Render the start view.
+    */
     def start = {
     }
 
+    /**
+    * Allow a person to change their session timeout setting.
+    */
     def changeSessionTimeout = {
         if (request.method == 'GET') {
@@ -48,4 +58,7 @@
     }
 
+    /**
+    * Allow a person to change their password.
+    */
     def changePassword = {
         //def principal = authenticateService.principal()
@@ -83,23 +96,83 @@
     }
 
+    /**
+    * Render the manager view for manager or admin roles.
+    */
     @Secured(['ROLE_Manager','ROLE_AppAdmin'])
     def manager = {
     }
 
+    /**
+    * Render the appAdmin view for admin roles.
+    */
     @Secured(['ROLE_AppAdmin'])
     def appAdmin = {
+
+        def offerBaseDataCreation = false
+        def offerDemoDataCreation = false
+        def baseDataCreated = appConfigService.exists("baseDataCreated")
+        def demoDataCreated = appConfigService.exists("demoDataCreated")
+        def demoDataCreationDisabled = appConfigService.exists("demoDataCreationDisabled")
+
+        if(!baseDataCreated)
+            offerBaseDataCreation = true
+
+        if(baseDataCreated && !demoDataCreated && !demoDataCreationDisabled)
+            offerDemoDataCreation = true
+
+        return[baseDataCreated: baseDataCreated,
+                        demoDataCreated: demoDataCreated,
+                        offerDemoDataCreation: offerDemoDataCreation,
+                        offerBaseDataCreation: offerBaseDataCreation,
+                        demoDataCreationDisabled: demoDataCreationDisabled]
     }
 
+    /**
+    * Allow admin to disable demo data creation.
+    */
+    @Secured(['ROLE_AppAdmin'])
+    def disableDemoDataCreation = {
+        if(!appConfigService.set("demoDataCreationDisabled")) {
+            flash.message = "Demo data creation could not be disabled."
+            redirect(action: appAdmin)
+            return
+        }
+
+        // Success.
+        flash.message = "Demo data creation disabled."
+        redirect(action: appAdmin)
+    }
+
+    /**
+    * Allow admin to create base data.
+    */
     @Secured(['ROLE_AppAdmin'])
     def createBaseData = {
-        createDataService.createBaseData()
-        redirect(action:appAdmin)
+        if(!createDataService.createBaseData()) {
+            flash.message = "Base data could not be created."
+            redirect(action: appAdmin)
+            return
+        }
+
+        // Success.
+        flash.message = "Base data created."
+        redirect(action: appAdmin)
     }
 
+    /**
+    * Allow admin to create demo data.
+    */
     @Secured(['ROLE_AppAdmin'])
     def createDemoData = {
-        createDataService.createDemoData()
-        redirect(action:appAdmin)
+        if(!createDataService.createDemoData()) {
+            flash.message = "Demo data could not be created."
+            redirect(action: appAdmin)
+            return
+        }
+
+        // Success.
+        flash.message = "Demo data created."
+        redirect(action: appAdmin)
     }
 
-}
+} // end of class.
