Skip to content
jessevondoom edited this page Oct 31, 2012 · 4 revisions

The admin app is a standalone webapp that works with the core framework to provide an easy admin interface for a platform user. It's a fairly standard MVC app, built with a custom controller, Mustache template views, and using the core framework as a model of sorts — providing both functionality and database access.

##Action routing and page rendering The controller and corresponding .htaccess file live in the main application folder and handle all action routing as well as keeping track of the login state. It's a fairly lightweight procedural script that accesses deeper functionality with two classes, AdminCore and AdminHelper. AdminCore is persistent and helps process CASHRequests and other vital functions. An AdminCore instance is always available as a global variable called $cash_admin.

The main controller scans /components/pages/controllers for page-level action controllers by filename. (Slashes transformed to underscores.) It matches as much of the requested URL as it can, finds the appropriate controller, and passes any additional slash-separated parameters to the controller in a $request_parameters array.

So a call to:

https://mysite.com/cashmusic/admin/assets/edit/1

calls

/components/pages/controllers/assets_edit.php with $request_parameters[0] == 1

The page controller handles the request by parsing the parameters and any POST variables, sending any needed CASHRequests, then choosing a Mustache template from the /components/pages/views folder. That view is rendered with the data, and the entire thing is passed back to the main controller.

Here the main controller gets the UI template from the /ui folder and renders the final page to screen. We don't currently support multiple themes in the admin UI, but there's nothing stopping us. The default UI can be overwritten easily to re-skin the admin app, or we could even make it switch themes dynamically.

##JavaScript While the admin works without JavaScript, the default UI relies on JavaScript to turn the entire admin into an AJAX application. This is key to future mobile webapp interfaces, which should run smoothly even as homescreen apps. Our scripts rely on jQuery and live in the /ui/default/assets/scripts/jquery.admin.js file.

##Mobile Works, kinda-sorta, but we need to get better. There's a ticket for porting the admin app to Zurb's excellent Foundation framework, and mobile UI sketches just need to be scanned and uploaded. Word.