Index: trunk/services/admins.php
===================================================================
--- trunk/services/admins.php	(revision 483)
+++ trunk/services/admins.php	(revision 497)
@@ -34,5 +34,5 @@
 require_once 'codebase/lib/FormValidator.inc.php';
 require_once 'codebase/lib/SortOrder.inc.php';
-require_once 'codebase/lib/TemplateGlue.inc.php';
+require_once 'codebase/lib/HTML.inc.php';
 require_once 'codebase/lib/Prefs.inc.php';
 require_once 'codebase/lib/Lock.inc.php';
@@ -229,5 +229,5 @@
     }
 
-    $fv->numericRange('admin_id', -32768, 32767, _("<strong>Admin id</strong> must be a valid number between -32768 and 32767."));
+    $fv->numericRange('admin_id', 0, 32767, _("<strong>Admin id</strong> must be a valid number between 0 and 32767."));
 
     $fv->isEmpty('username', _("<strong>Username</strong> cannot be blank."));
@@ -235,5 +235,5 @@
 
     $fv->isEmpty('userpass', _("<strong>Passwords</strong> cannot be blank."));
-    $fv->stringLength('userpass', 6, 36, _("<strong>Passwords</strong> must be between 6 and 36 characters long."));
+    $fv->stringLength('userpass', 8, 36, _("<strong>Passwords</strong> must be between 8 and 36 characters long."));
 
     $fv->stringLength('first_name', 0, 255, _("<strong>First name</strong> must contain less than 256 characters."));
@@ -242,5 +242,4 @@
 
     $fv->isEmpty('email', _("<strong>Email</strong> cannot be blank."));
-    $fv->stringLength('email', 0, 255, _("<strong>Email</strong> must contain less than 256 characters."));
     $fv->validateEmail('email');
 }
@@ -267,7 +266,7 @@
         'new_op' => 'insert',
         'submit_buttons' => array(
-            'submit' => _("Add Administrator"),
-            'repeat' => _("Add &amp; repeat"),
-            'cancel' => _("Cancel"),
+            array('name' => 'submit', 'value' => _("Add Administrator"), 'class' => 'small button', 'accesskey' => 's'),
+            array('name' => 'repeat', 'value' => _("Add &amp; repeat"), 'class' => 'small button secondary', 'accesskey' => 'r'),
+            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
         ),
     );
@@ -280,4 +279,5 @@
     global $auth;
     global $lock;
+    global $locally_carried_queries;
     $app =& App::getInstance();
     $db =& DB::getInstance();
@@ -324,10 +324,10 @@
         'old_username' => $frm['username'],
         'submit_buttons' => array(
-            'submit' => _("Save changes"),
-            'repeat' => _("Save &amp; edit next"),
-            'reset' => _("Reset"),
-            'cancel' => _("Cancel"),
+            array('name' => 'submit', 'value' => _("Save changes"), 'class' => 'small button', 'accesskey' => 's'),
+            array('name' => 'repeat', 'value' => _("Save & edit next"), 'class' => 'small button secondary', 'accesskey' => 'e'),
+            array('name' => 'reset', 'value' => _("Reset"), 'class' => 'small button secondary', 'accesskey' => 'r'),
+            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
         ),
-    ), $frm, array('userpass' => '****************'));
+    ), $frm, array('userpass' => 'â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢'));
 
     return $frm;
@@ -339,4 +339,5 @@
     global $lock;
     global $cache;
+    global $locally_carried_queries;
     $app =& App::getInstance();
     $db =& DB::getInstance();
@@ -367,5 +368,5 @@
     if ($num_admins <= 1) {
         // There must always be at least one admnistrator!
-        $app->raiseMsg(_("You cannot delete the only administrator in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(_("You cannot delete the only user in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);
     } else if ($auth->get('user_id') == $id) {
         // Do not delete yourself!
@@ -418,5 +419,5 @@
     $version->create($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $last_insert_id, $frm['username']);
 
-    $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
+    $app->raiseMsg(sprintf(_("The user <em>%s</em> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
 
     return $last_insert_id;
@@ -461,5 +462,5 @@
     $version->create($auth->getParam('db_table'), $auth->getParam('db_primary_key'), $frm['admin_id'], $frm['username']);
 
-    $app->raiseMsg(sprintf(_("The Administrator <em>%s</em> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
+    $app->raiseMsg(sprintf(_("The user <em>%s</em> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
 
     // Unlock record.
Index: trunk/services/lock.php
===================================================================
--- trunk/services/lock.php	(revision 483)
+++ trunk/services/lock.php	(revision 497)
@@ -25,6 +25,12 @@
  */
 
-// require_once dirname(__FILE__) . '/_config.inc.php';
+// Redefine include_path including the codebase/services but allow local templates override global ones.
+ini_set('include_path', join(PATH_SEPARATOR, array(
+    get_include_path(),
+    dirname(__FILE__) . '/templates'
+)));
+
 require_once 'codebase/lib/Lock.inc.php';
+require_once 'codebase/lib/HTML.inc.php';
 
 $app->sslOn();
@@ -66,5 +72,6 @@
 // Templates.
 include 'header.ihtml';
-$lock->printErrorHTML();
+// $lock->printErrorHTML();
+include 'lock.ihtml';
 include 'footer.ihtml';
 
Index: trunk/services/login.php
===================================================================
--- trunk/services/login.php	(revision 483)
+++ trunk/services/login.php	(revision 497)
@@ -24,4 +24,10 @@
  * login.php
  */
+
+// Redefine include_path including the codebase/services but allow local templates override global ones.
+ini_set('include_path', join(PATH_SEPARATOR, array(
+    get_include_path(),
+    dirname(__FILE__) . '/templates'
+)));
 
 // We may want to use the add/edit interface from another script, so this
@@ -64,5 +70,5 @@
 // Templates.
 include 'header.ihtml';
-include 'codebase/services/templates/login_form.ihtml';
+include 'login_form.ihtml';
 include 'footer.ihtml';
 
Index: trunk/services/logs.php
===================================================================
--- trunk/services/logs.php	(revision 483)
+++ trunk/services/logs.php	(revision 497)
@@ -25,5 +25,9 @@
  */
 
-// require_once dirname(__FILE__) . '/_config.inc.php';
+// Redefine include_path including the codebase/services but allow local templates override global ones.
+ini_set('include_path', join(PATH_SEPARATOR, array(
+    get_include_path(),
+    dirname(__FILE__) . '/templates'
+)));
 
 $app->sslOn();
@@ -67,5 +71,5 @@
 
 // Titles and navigation header.
-$nav->add(sprintf(_("Viewing log: <em>%s</em>"), $tmp_prefs->get('log_file')), '/admin/logs.php');
+$nav->add(sprintf(_("Viewing <em>%s</em>"), $tmp_prefs->get('log_file')), '/admin/logs.php');
 
 /********************************************************************
@@ -148,5 +152,5 @@
     printLog($tmp_prefs->get('log_file'));
 } else {
-    include 'codebase/services/templates/' . $main_template;
+    include $main_template;
 }
 include 'footer.ihtml';
Index: trunk/services/password.php
===================================================================
--- trunk/services/password.php	(revision 483)
+++ trunk/services/password.php	(revision 497)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -25,9 +25,14 @@
  */
 
-// require_once dirname(__FILE__) . '/_config.inc.php';
+// Redefine include_path including the codebase/services but allow local templates override global ones.
+ini_set('include_path', join(PATH_SEPARATOR, array(
+    get_include_path(),
+    dirname(__FILE__) . '/templates'
+)));
 
 $auth->requireLogin();
 
 require_once 'codebase/lib/FormValidator.inc.php';
+require_once 'codebase/lib/HTML.inc.php';
 
 /******************************************************************************
@@ -36,5 +41,5 @@
 
 // Titles and navigation header.
-$nav->add(_("Change password"));
+$nav->add(sprintf(_("Change password for <em>%s</em>"), $auth->get('username')));
 
 // The object to validate form input from the user.
@@ -58,16 +63,18 @@
 
     // Validate the posted data.
-//  $fv->isEmpty('oldpassword', _("You did not specify the <strong>old password</strong>."));
-    $fv->checkRegex('oldpassword', '/^[[:alnum:][:punct:]]{0,128}$/i', true, _("The <strong>Old password</strong> specified is not valid."));
-    if (!$fv->isEmpty('newpassword', _("You did not specify the <strong>New password</strong>."))) {
-        $fv->checkRegex('newpassword', '/^[[:alnum:][:punct:]]{6,128}$/i', true, _("The <strong>New password</strong> specified is not valid. A password must be 6 or more characters."));
-        if ($frm['newpassword'] != $frm['newpassword2'] && !$fv->isEmpty('newpassword2', _("You need to type the <strong>New password</strong> twice."))) {
-            $fv->addError('newpassword', _("The <strong>New passwords</strong> do not match."));
-            $fv->addError('newpassword2');
+    if ($fv->notEmpty('oldpassword', _("You did not specify the <strong>old password</strong>."))) {
+        $fv->checkRegex('oldpassword', '/^\S{0,128}$/i', true, _("The <strong>old password</strong> specified is not valid."));
+    }
+    if ($fv->notEmpty('newpassword', _("You did not specify the <strong>new password</strong>."))) {
+        if ($fv->checkRegex('newpassword', '/^\S{8,128}$/i', true, _("The <strong>new password</strong> specified is not valid. A password must be eight or more characters."))) {
+            if ($fv->notEmpty('newpassword2', _("You need to type the <strong>new password</strong> twice.")) && $frm['newpassword'] != $frm['newpassword2']) {
+                $fv->addError('newpassword', _("The <strong>new passwords</strong> do not match."));
+                $fv->addError('newpassword2');
+            }
         }
     }
 
     if (!$fv->anyErrors() && false === $auth->authenticate($auth->get('username'), $frm['oldpassword'])) {
-        $fv->addError('oldpassword', _("Your <strong>Old password</strong> failed authentication."));
+        $fv->addError('oldpassword', _("Your <strong>old password</strong> failed authentication."));
         $app->logMsg(sprintf('Password change failed for %s, using (md5ed) password: %s', $auth->get('username'), md5($frm['oldpassword'])), LOG_NOTICE, __FILE__, __LINE__);
     }
@@ -84,5 +91,5 @@
 // Templates.
 include 'header.ihtml';
-include 'codebase/services/templates/password.ihtml';
+include 'password.ihtml';
 include 'footer.ihtml';
 
Index: trunk/services/reset_password.php
===================================================================
--- trunk/services/reset_password.php	(revision 483)
+++ trunk/services/reset_password.php	(revision 497)
@@ -4,5 +4,5 @@
  * For details visit the project site: <http://trac.strangecode.com/codebase/>
  * Copyright 2001-2012 Strangecode, LLC
- * 
+ *
  * This file is part of The Strangecode Codebase.
  *
@@ -11,10 +11,10 @@
  * Free Software Foundation, either version 3 of the License, or (at your option)
  * any later version.
- * 
+ *
  * The Strangecode Codebase is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  * details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along with
  * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
@@ -34,7 +34,15 @@
 ********************************************************************/
 
+// Redefine include_path including the codebase/services but allow local templates override global ones.
+ini_set('include_path', join(PATH_SEPARATOR, array(
+    get_include_path(),
+    dirname(__FILE__) . '/templates'
+)));
+
 // The object to validate form input from the user.
 require_once 'codebase/lib/FormValidator.inc.php';
 $fv = new FormValidator();
+
+require_once 'codebase/lib/HTML.inc.php';
 
 /********************************************************************
@@ -84,5 +92,5 @@
 
 include 'header.ihtml';
-include 'codebase/services/templates/reset_password.ihtml';
+include 'reset_password.ihtml';
 include 'footer.ihtml';
 
Index: trunk/services/templates/admin_form.ihtml
===================================================================
--- trunk/services/templates/admin_form.ihtml	(revision 483)
+++ trunk/services/templates/admin_form.ihtml	(revision 497)
@@ -1,45 +1,45 @@
-<?php $fv->printErrorMessages(); ?>
-
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
-<?php $app->printHiddenSession(); ?>
-<input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" />
-<input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" />
-<input type="hidden" name="old_username" value="<?php echo $frm['old_username']; ?>" />
-
-<table>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="username" class="<?php $fv->err('username'); ?>"><?php echo _("Username"); ?></label></td>
-        <td>
-            <input type="text" class="sc-small" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="userpass" class="<?php $fv->err('userpass'); ?>"><?php echo _("Password"); ?></label></td>
-        <td>
-            <input type="password" class="sc-small" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="first_name" class="<?php $fv->err('first_name'); ?>"><?php echo _("First name"); ?></label></td>
-        <td>
-            <input type="text" class="sc-small" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="last_name" class="<?php $fv->err('last_name'); ?>"><?php echo _("Last name"); ?></label></td>
-        <td>
-            <input type="text" class="sc-small" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="email" class="<?php $fv->err('email'); ?>"><?php echo _("Email"); ?></label></td>
-        <td>
-            <input type="text" class="sc-medium" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td>&nbsp;</td>
-        <td><?php printSubmitButtons($frm['submit_buttons']); ?></td>
-    </tr>
-</table>
-</form>
+<header class="row">
+    <div class="large-12 columns">
+        <h1><?php echo $nav->get('title'); ?></h1>
+        <?php $fv->printErrorMessages(); ?>
+    </div>
+</header>
+<main role="main">
+    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
+        <?php $app->printHiddenSession(); ?>
+        <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" />
+        <input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" />
+        <input type="hidden" name="old_username" value="<?php echo $frm['old_username']; ?>" />
+        <div class="row">
+            <div class="medium-5 large-3 columns">
+                <label for="first_name" class="<?php $fv->err('first_name'); ?>"><?php echo _("First name"); ?></label>
+                <input type="text" class="sc-small" size="50" name="first_name" value="<?php echo oTxt($frm['first_name']); ?>" />
+            </div>
+            <div class="medium-5 large-3 columns end">
+                <label for="last_name" class="<?php $fv->err('last_name'); ?>"><?php echo _("Last name"); ?></label>
+                <input type="text" class="sc-small" size="50" name="last_name" value="<?php echo oTxt($frm['last_name']); ?>" />
+            </div>
+        </div>
+        <div class="row">
+            <div class="medium-10 large-6 columns">
+                <label for="email" class="<?php $fv->err('email'); ?>"><?php echo _("Email address"); ?></label>
+                <input type="text" class="sc-medium" size="50" name="email" value="<?php echo oTxt($frm['email']); ?>" />
+            </div>
+        </div>
+        <div class="row">
+            <div class="medium-5 large-3 columns">
+                <label for="username" class="<?php $fv->err('username'); ?>"><?php echo _("Username"); ?></label>
+                <input type="text" class="sc-small" size="50" name="username" value="<?php echo oTxt($frm['username']); ?>" />
+            </div>
+            <div class="medium-5 large-3 columns end">
+                <label for="userpass" class="<?php $fv->err('userpass'); ?>"><?php echo _("Password"); ?></label>
+                <input type="password" class="sc-small" size="50" name="userpass" value="<?php echo oTxt($frm['userpass']); ?>" />
+            </div>
+        </div>
+        <div class="row">
+            <div class="large-6 columns">
+                <?php HTML::printButtons($frm['submit_buttons']); ?>
+            </div>
+        </div>
+    </form>
+</main>
Index: trunk/services/templates/admin_list.ihtml
===================================================================
--- trunk/services/templates/admin_list.ihtml	(revision 483)
+++ trunk/services/templates/admin_list.ihtml	(revision 497)
@@ -1,60 +1,79 @@
-
-<?php $fv->printErrorMessages(); ?>
-
-<div class="commandbox">
-    <span class="sc-nowrap commanditem"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add Administrator"); ?></a></span>
-    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
-        <?php $app->printHiddenSession(false); ?>
-        <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: Admin id, Username, Userpass, First name, Last name, Email.")); ?>" />
-        <input type="submit" value="<?php echo _("Search"); ?>" />
-    </form>
+<div class="sticky">
+    <nav class="top-bar list-bar" data-topbar role="navigation" data-options="sticky_on: large">
+        <ul class="title-area">
+            <li class="name"><h1><a href="#"><?php echo $nav->get('title'); ?></a></h1></li>
+            <li class="toggle-topbar"><a href="#"><span><?php echo _("Show commands"); ?></span></a></li>
+        </ul>
+        <section class="top-bar-section">
+            <ul class="left">
+                <li class="has-form"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>" class="button"><i class="fa fa-plus"></i> <?php echo _("Add Administrator"); ?></a></li>
+            </ul>
+            <ul class="right">
+                <li class="has-form">
+                    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
+                        <div class="row collapse">
+                            <?php $app->printHiddenSession(false); ?>
+                            <div class="small-8 columns">
+                                <input type="text" class="" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" placeholder="<?php echo _("SearchâŠ"); ?>" title="<?php echo oTxt(_("Fields searched: question text.")); ?>" />
+                            </div>
+                            <div class="small-4 columns">
+                                <input type="submit" class="button expand" value="<?php echo _("Search"); ?>" />
+                            </div>
+                        </div>
+                    </form>
+                </li>
+                <?php if ('' != getFormData('search_query')): ?>
+                    <li class="has-form"><a href="<?php echo $app->ohref($_SERVER['PHP_SELF'], false); ?>" class="button expand"><?php echo _("Show all"); ?></a></li>
+                <?php endif ?>
+            </ul>
+        </section>
+    </nav>
 </div>
-
+<table>
+    <thead>
+        <tr>
+            <th></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.admin_id', _("ID"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.username', _("Username"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.first_name', _("First"), 'ASC'); ?> <?php echo $so->printSortHeader('admin_tbl.last_name', _("Last name"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.seconds_online', _("Min online"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.last_login_datetime', _("Last login"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.last_login_ip', _("Remote host"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.added_datetime', _("Added"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.added_by_user_id', _("by"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.modified_datetime', _("Modified"), 'ASC'); ?></th>
+            <th><?php echo $so->printSortHeader('admin_tbl.modified_by_user_id', _("by"), 'ASC'); ?></th>
+        </tr>
+    </thead>
+    <tbody>
+        <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
+        <tr>
+            <td>
+                <a href="#" data-dropdown="actions-for-id-<?php echo oTxt($list[$i]['admin_id']); ?>" aria-controls="actions-for-id-<?php echo oTxt($list[$i]['admin_id']); ?>" aria-expanded="false" class="sc-action dropdown" data-options="is_hover:false"><i class="fa fa-cog fa-lg"></i></a>
+                <ul id="actions-for-id-<?php echo oTxt($list[$i]['admin_id']); ?>" data-dropdown-content class="f-dropdown sc-action" aria-hidden="true" tabindex="-1">
+                    <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><i class="fa fa-pencil fa-fw"></i> <?php printf(_("Edit <em>%s</em>"), oTxt(truncate($list[$i]['username'], 30))) ?></a></li>
+                    <li><a href="<?php echo $app->oHREF('/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><i class="fa fa-files-o fa-fw"></i> <?php printf(_("Versions of %s"), oTxt(truncate($list[$i]['username'], 30))) ?></a></li>
+                    <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>"><i class="fa fa-trash-o fa-fw"></i> <?php printf(_("Delete <em>%s</em>"), oTxt(truncate($list[$i]['username'], 30))) ?></a></li>
+                </ul>
+            </td>
+            <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?></td>
+            <td class="sc-nowrap"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><?php echo oTxt($list[$i]['username'], true); ?></a></td>
+            <td class="sc-nowrap"><?php echo oTxt($list[$i]['first_name'], true); ?> <?php echo oTxt($list[$i]['last_name'], true); ?></td>
+            <td class="sc-nowrap"><?php echo round($list[$i]['seconds_online'] / 60); ?></td>
+            <td class="sc-nowrap"><?php
+                if ($auth->isLoggedIn($list[$i]['admin_id'])) {
+                    ?><strong><?php echo date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php
+                } else {
+                    echo Validator::validateStrDate($list[$i]['last_login_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) : '';
+                }
+            ?></td>
+            <td class="sc-nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?></td>
+            <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['added_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['added_datetime'])) : ''; ?></td>
+            <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?></td>
+            <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['modified_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['modified_datetime'])) : ''; ?></td>
+            <td class="sc-nowrap"><?php echo oTxt($list[$i]['modified_admin_username'], true); ?></td>
+        </tr>
+        <?php } ?>
+    </tbody>
+</table>
 <?php include 'list_info.ihtml'; ?>
-
-<form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
-<table class="list">
-    <tr>
-        <th>&nbsp;</th>
-        <th>&nbsp;</th>
-        <th><?php echo $so->printSortHeader('admin_tbl.admin_id', _("ID"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.username', _("Username"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.first_name', _("First"), 'ASC'); ?> <?php echo $so->printSortHeader('admin_tbl.last_name', _("Last name"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.seconds_online', _("Min online"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.last_login_datetime', _("Last login"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.last_login_ip', _("Remote host"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.added_datetime', _("Added"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.added_by_user_id', _("by"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.modified_datetime', _("Modified"), 'ASC'); ?></th>
-        <th><?php echo $so->printSortHeader('admin_tbl.modified_by_user_id', _("by"), 'ASC'); ?></th>
-        <th>&nbsp;</th>
-    </tr>
-    <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
-    <tr>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/i/pen.gif" alt="Edit" width="12" height="12" border="0" /></a> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF(sprintf('/admin/versions.php?record_table=%s&record_key=%s&record_val=%s&boomerang=true', $auth->getParam('db_table'), $auth->getParam('db_primary_key'), $list[$i]['admin_id'])); ?>"><img src="/admin/i/multiple.png" alt="" width="12" height="12" border="0" /></a> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo oTxt($list[$i]['username'], true); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo oTxt($list[$i]['first_name'], true); ?> <?php echo oTxt($list[$i]['last_name'], true); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo round($list[$i]['seconds_online'] / 60); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php
-            if ($auth->isLoggedIn($list[$i]['admin_id'])) {
-                ?><strong><?php echo date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php
-            } else {
-                echo Validator::validateStrDate($list[$i]['last_login_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) : '';
-            }
-        ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['added_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['added_datetime'])) : ''; ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo Validator::validateStrDate($list[$i]['modified_datetime']) ? date($app->getParam('date_format'), strtotime($list[$i]['modified_datetime'])) : ''; ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo oTxt($list[$i]['modified_admin_username'], true); ?> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onclick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> &nbsp;</td>
-    </tr>
-    <?php } ?>
-</table>
-
-<?php if ($page->total_pages > 1) { ?>
-<div class="sc-nowrap commanditem" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></div>
-<?php } ?>
-</form>
Index: trunk/services/templates/email_reset_password.txt
===================================================================
--- trunk/services/templates/email_reset_password.txt	(revision 483)
+++ trunk/services/templates/email_reset_password.txt	(revision 497)
@@ -9,4 +9,4 @@
 
 {SITE_NAME}
-<{SITE_URL}/>
+{SITE_URL}/
 
Index: trunk/services/templates/list_info.ihtml
===================================================================
--- trunk/services/templates/list_info.ihtml	(revision 483)
+++ trunk/services/templates/list_info.ihtml	(revision 497)
@@ -1,10 +1,11 @@
-<div>
-    <?php if ($page->total_pages > 1) { ?>
-    <span class="sc-nowrap commanditem" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></span>
-    <?php } ?>
-    <span class="sc-nowrap commanditem">
-        <?php printf(_("Listing <strong>%s-%s</strong> of <strong>%s</strong> results on <strong>%s</strong> pages"), (0==$page->total_items ? 0 : $page->first_item+1), (0==$page->total_items ? 0 : $page->last_item+1), $page->total_items, $page->total_pages) ?>
-        &nbsp;&nbsp; <a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'], false); ?>"><?php echo _("List all"); ?></a>
-        &nbsp;&nbsp; <?php echo _("Per page"); ?>:&nbsp;<?php $page->printPerPageLinks() ?>
-    </span>
+<div class="row">
+    <div class="large-12 text-center columns">
+        <ul class="inline-list">
+            <li><?php printf(_("Listing <strong>%s-%s</strong> of <strong>%s</strong> results on <strong>%s</strong> %s"), (0==$page->total_items ? 0 : $page->first_item+1), (0==$page->total_items ? 0 : $page->last_item+1), $page->total_items, $page->total_pages, (1==$page->total_pages ? _("page") : _("pages"))); ?></li>
+            <?php if ($page->total_pages > 1) { ?>
+                <li class=""><?php $page->printPageNumbers() ?></li>
+                <li><?php echo _("Per page"); ?>:&nbsp;<?php $page->printPerPageLinks() ?></li>
+            <?php } ?>
+        </ul>
+    </div>
 </div>
Index: trunk/services/templates/lock.ihtml
===================================================================
--- trunk/services/templates/lock.ihtml	(revision 483)
+++ trunk/services/templates/lock.ihtml	(revision 497)
@@ -1,24 +1,47 @@
 <?php
 if (!is_a($lock, 'Lock')) {
+    // If the Lock object hasn't been instantiated, don't execute this template.
     return null;
 }
 ?>
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
-    <?php $app->printHiddenSession() ?>
-    <input type="hidden" name="lock_id" value="<?php echo $lock->getID(); ?>" />
-
-    <p><?php
-    printf(_("The record %s is currently being edited by %s (%d minutes elapsed). You cannot modify the record while it is locked by another user."),
-        $lock->getTitle(),
-        $lock->getEditor(),
-        date('i', $lock->getSecondsElapsed() + 60)
-    );
-    ?></p>
-
-    <?php if ($lock->getSecondsElapsed() > $lock->timeout) { ?>
-    <p><?php printf(_("You can force unlock the record if you believe the editing session has expired. You might want to confirm with before doing this."), $lock->getEditor()) ?></p>
-    <input type="submit" name="unlock" value="<?php echo _("Unlock"); ?>" />
-    <?php } ?>
-
-    <input type="submit" name="cancel" value="<?php echo _("Cancel"); ?>" />
-</form>
+<header class="row">
+    <div class="large-12 columns">
+        <h1><?php echo $nav->get('title'); ?></h2>
+    </div>
+</header>
+<main role="main">
+    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>">
+        <?php $app->printHiddenSession() ?>
+        <input type="hidden" name="lock_id" value="<?php echo $lock->getID(); ?>" />
+        <div id="sc-msg" class="sc-msg row">
+            <div class="large-12 columns">
+                <p class="sc-msg-notice">
+                <?php printf(_("The record <em>%s</em> is currently being edited by %s (%d minutes elapsed). You cannot modify the record while it is locked by another user."),
+                    $lock->getTitle(),
+                    $lock->getEditor(),
+                    date('i', $lock->getSecondsElapsed() + 60)
+                ); ?>
+                </p>
+                <?php if ($lock->getSecondsElapsed() >= $lock->getParam('timeout')) { ?>
+                    <p class="sc-msg-notice"><?php printf(_("You can forcibly unlock the record if you believe the editing session has expired. You might want to confirm with %s before doing this."), $lock->getEditor()) ?></p>
+                    <div class="sc-msg-notice">
+                        <?php
+                        HTML::printButtons(array(
+                            array('name' => 'unlock', 'value' => _("Unlock"), 'class' => 'small button alert', 'accesskey' => 'u'),
+                            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
+                        ));
+                        ?>
+                    </div>
+                <?php } else { ?>
+                    <div class="sc-msg-notice">
+                        <?php
+                        HTML::printButtons(array(
+                            array('name' => 'cancel', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
+                        ));
+                        ?>
+                    </div>
+                <?php } ?>
+            </div>
+        </div>
+    </form>
+</main>
Index: trunk/services/templates/log_list.ihtml
===================================================================
--- trunk/services/templates/log_list.ihtml	(revision 483)
+++ trunk/services/templates/log_list.ihtml	(revision 497)
@@ -1,42 +1,69 @@
-<form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
-<?php $app->printHiddenSession(false); ?>
-<div class="commandbox">
-<?php if (is_array($logs) && !empty($logs)) { ?>
-    <table>
-    <?php
-    foreach ($logs as $l) {
-        ?>
-        <tr>
-            <td>
-                <?php if ($l['filename'] == $tmp_prefs->get('log_file')) { ?>
-                    <strong class="sc-padright"><?php echo sprintf(_("%s"), $l['filename']); ?></strong>
-                <?php } else { ?>
-                    <a class="sc-padright" href="<?php echo $app->oHREF('/admin/logs.php?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a>
-                <?php } ?>
-            </td>
-            <td>
-                <em class="sc-padright"><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date($app->getParam('date_format'), $l['modified'])); ?></em>
-            </td>
-            <td>
-                <?php if (!preg_match($no_download_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('/admin/logs.php?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a><?php } ?>
-                <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('/admin/logs.php?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a><?php } ?>
-                <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('/admin/logs.php?op=clear&log=' . $l['filename']); ?>" onclick="javascript:return confirm('<?php printf(_("Are you sure you want to clear the log file %s? This will empty this file of its contents. This action is not reversible."), $l['filename'])?>')"><?php echo _("Clear"); ?></a><?php } ?>
-                <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><a href="<?php echo $app->oHREF('/admin/logs.php?op=delete&log=' . $l['filename']); ?>" onclick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the log file %s? This will remove this log file permanently. This action is not reversible."), $l['filename'])?>')"><?php echo _("Delete"); ?></a><?php } ?>
-            </td>
-        </tr><?php
-    }
-    ?>
-    </table>
-<?php } ?>
-    <div class="form">
-        <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo oTxt(getFormData('search_query')); ?>" title="<?php echo _("All lines in currently viewed log file are searched."); ?>" />
-        <label class="sc-normal"><input type="checkbox" name="search_grep"<?php frmChecked(getFormData('search_grep')) ?> /><?php echo _("Use Regex"); ?></label>
-        <input class="sc-padleft" type="submit" name="list" value="<?php echo _("Search"); ?>" />
+<div class="sticky">
+    <nav class="top-bar list-bar" data-topbar role="navigation" data-options="sticky_on: large">
+        <ul class="title-area">
+            <li class="name"><h1><a href="#"><?php echo $nav->get('title'); ?></a></h1></li>
+            <li class="toggle-topbar"><a href="#"><span><?php echo _("Show commands"); ?></span></a></li>
+        </ul>
+        <section class="top-bar-section">
+            <ul class="left">
+                <li class="has-form">
+                    <button data-dropdown="loglist" aria-controls="loglist" aria-expanded="false" class="button"><?php echo _("Select log"); ?> <i class="fa fa-caret-down"></i></button>
+                </li>
+            </ul>
+            <ul class="right">
+                <li class="has-form">
+                    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
+                        <div class="row collapse">
+                            <?php $app->printHiddenSession(false); ?>
+                            <div class="small-5 columns">
+                                <input type="text" class="" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" placeholder="<?php echo _("SearchâŠ"); ?>" title="<?php echo oTxt(_("Fields searched: question text.")); ?>" />
+                            </div>
+                            <div class="small-4 columns">
+                                <input type="checkbox" id="search_grep" name="search_grep"<?php frmChecked(getFormData('search_grep')) ?> /><label for="search_grep"><?php echo _("Regex"); ?></label>
+                            </div>
+                            <div class="small-3 columns">
+                                <input type="submit" class="button expand" value="<?php echo _("Search"); ?>" />
+                            </div>
+                        </div>
+                    </form>
+                </li>
+                <?php if ('' != getFormData('search_query')): ?>
+                    <li class="has-form"><a href="<?php echo $app->ohref($_SERVER['PHP_SELF'], false); ?>" class="button expand"><?php echo _("Show all"); ?></a></li>
+                <?php endif ?>
+            </ul>
+        </section>
+    </nav>
+    <?php if (is_array($logs) && !empty($logs)) { ?>
+    <div id="loglist" data-dropdown-content class="f-dropdown content large" aria-hidden="true" tabindex="-1">
+        <table>
+            <?php
+            foreach ($logs as $l) {
+                ?>
+                <tr>
+                    <td>
+                        <?php if ($l['filename'] == $tmp_prefs->get('log_file')) { ?>
+                            <strong class="sc-padright"><?php echo sprintf(_("%s"), $l['filename']); ?></strong>
+                        <?php } else { ?>
+                            <a class="sc-padright" href="<?php echo $app->oHREF('?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a>
+                        <?php } ?>
+                    </td>
+                    <td>
+                        <em class="sc-padright"><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date($app->getParam('date_format'), $l['modified'])); ?></em>
+                    </td>
+                    <td>
+                        <?php if (!preg_match($no_download_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a><?php } ?>
+                        <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a><?php } ?>
+                        <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><a class="sc-padright" href="<?php echo $app->oHREF('?op=clear&log=' . $l['filename']); ?>" onclick="javascript:return confirm('<?php printf(_("Are you sure you want to clear the log file %s? This will empty this file of its contents. This action is not reversible."), $l['filename'])?>')"><?php echo _("Clear"); ?></a><?php } ?>
+                        <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><a href="<?php echo $app->oHREF('?op=delete&log=' . $l['filename']); ?>" onclick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the log file %s? This will remove this log file permanently. This action is not reversible."), $l['filename'])?>')"><?php echo _("Delete"); ?></a><?php } ?>
+                    </td>
+                </tr><?php
+            }
+            ?>
+        </table>
     </div>
+    <?php } ?>
 </div>
 
-<?php include 'list_info.ihtml'; ?>
-
-<pre style="font: 9px monaco;">
+<pre>
 <?php
 for ($i = $page->first_item; $i <= $page->last_item && $page->total_items; $i++) {
@@ -45,7 +72,16 @@
 ?>
 </pre>
+<?php include 'list_info.ihtml'; ?>
 
-<?php if ($page->total_pages > 1) { ?>
-<div class="sc-nowrap commanditem" style="float: right;"><?php echo _("Pages:"); ?>&nbsp;<?php $page->printPageNumbers() ?></div>
-<?php } ?>
-</form>
+<style>
+td { padding: .1rem .5rem; }
+pre {
+    font-family: monospace;
+    font-size: .75rem;
+    line-height: 1.2;
+    padding: 15px;
+}
+.right .has-form .columns {
+    padding: 0 .25rem;
+}
+</style>
Index: trunk/services/templates/password.ihtml
===================================================================
--- trunk/services/templates/password.ihtml	(revision 483)
+++ trunk/services/templates/password.ihtml	(revision 497)
@@ -1,30 +1,42 @@
-<?php $fv->printErrorMessages(); ?>
-
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
-<?php $app->printHiddenSession() ?>
-<input type="hidden" name="op" value="update_password" />
-<table>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="oldpassword" class="<?php $fv->err('oldpassword'); ?>"><?php echo _("Old password"); ?></label></td>
-        <td>
-            <input type="password" class="sc-medium" size="50" name="oldpassword" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="newpassword" class="<?php $fv->err('newpassword'); ?>"><?php echo _("New password"); ?></label></td>
-        <td>
-            <input type="password" class="sc-medium" size="50" name="newpassword" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td class="sc-right"><label for="newpassword2" class="<?php $fv->err('newpassword2'); ?>"><?php echo _("New password again"); ?></label></td>
-        <td>
-            <input type="password" class="sc-medium" size="50" name="newpassword2" />
-        </td>
-    </tr>
-    <tr class="sc-form-row">
-        <td>&nbsp;</td>
-        <td><input type="submit" value="<?php echo _("Change password"); ?>" /></td>
-    </tr>
-</table>
-</form>
+<header class="row">
+    <div class="large-12 columns">
+        <h1><?php echo $nav->get('title'); ?></h1>
+        <?php $fv->printErrorMessages(); ?>
+    </div>
+</header>
+<main role="main">
+    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
+        <?php $app->printHiddenSession() ?>
+        <input type="hidden" name="op" value="update_password" />
+        <div class="row">
+            <div class="large-6 columns">
+                <label for="oldpassword" class="<?php $fv->err('oldpassword'); ?>"><?php echo _("Old password"); ?></label>
+                <input type="password" class="sc-medium" size="50" name="oldpassword" />
+            </div>
+        </div>
+        <div class="row">
+            <div class="large-6 columns">
+                <label for="newpassword" class="<?php $fv->err('newpassword'); ?><?php $fv->err('newpassword2'); ?>"><?php echo _("New password (twice)"); ?></label>
+                <input type="password" class="sc-medium" size="50" name="newpassword" />
+            </div>
+        </div>
+        <div class="row">
+            <div class="large-6 columns">
+                <input type="password" class="sc-medium" size="50" name="newpassword2" />
+                <div class="sc-help"><?php printf(_("See the <a href=\"%s\">Strangecode password guide</a> for tips on choosing a strong password."), 'http://www.strangecode.com/support/passwords'); ?></div>
+            </div>
+        </div>
+        <div class="row">
+            <div class="large-6 columns">
+                <?php
+                HTML::printButtons(array(array(
+                    'name' => 'submit',
+                    'value' => _("Change password"),
+                    'class' => 'small button',
+                    'accesskey' => 's'
+                )));
+                ?>
+            </div>
+        </div>
+    </form>
+</main>
Index: trunk/services/templates/reset_password.ihtml
===================================================================
--- trunk/services/templates/reset_password.ihtml	(revision 483)
+++ trunk/services/templates/reset_password.ihtml	(revision 497)
@@ -1,13 +1,31 @@
-<p><?php echo _("If you have forgotten your password enter your username here. A new password will be emailed to you."); ?></p>
-
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
-    <?php $app->printHiddenSession(); ?>
-    <input type="hidden" name="op" value="reset" />
-    <div class="sc-form-row<?php $fv->err('username'); ?>">
-        <label for="username"><?php echo _("Username"); ?></label>
-        <input type="text" name="username" id="username" class="sc-medium" value="<?php echo oTxt($frm['username']); ?>" />
+<header class="row">
+    <div class="large-12 columns">
+        <h1><?php echo $nav->get('title'); ?></h1>
+        <p><?php echo _("If you have forgotten your password enter your username here. A new password will be emailed to you."); ?></p>
+        <?php $fv->printErrorMessages(); ?>
     </div>
-    <div class="sc-form-row sc-submit-buttons sc-clearboth">
-        <input type="submit" value="<?php echo _("Submit"); ?>" />
-    </div>
-</form>
+</header>
+<main role="main">
+    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
+        <?php $app->printHiddenSession(); ?>
+        <input type="hidden" name="op" value="reset" />
+        <div class="row<?php $fv->err('username'); ?>">
+            <div class="large-6 columns">
+                <label for="username"><?php echo _("Username"); ?></label>
+                <input type="text" name="username" id="username" class="sc-medium" value="<?php echo oTxt($frm['username']); ?>" />
+            </div>
+        </div>
+        <div class="row sc-submit-buttons">
+            <div class="large-6 columns">
+                <?php
+                HTML::printButtons(array(array(
+                    'name' => 'submit',
+                    'value' => _("Submit"),
+                    'class' => 'small button',
+                    'accesskey' => 's'
+                )));
+                ?>
+            </div>
+        </div>
+    </form>
+</main>
Index: trunk/services/templates/versions_diff.ihtml
===================================================================
--- trunk/services/templates/versions_diff.ihtml	(revision 483)
+++ trunk/services/templates/versions_diff.ihtml	(revision 497)
@@ -1,28 +1,54 @@
-<div class="commandbox">
-<?php if (!getFormData('current', false)) { ?>
-    <span class="sc-nowrap commanditem"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>
-<?php } else { ?>
-    <span class="sc-nowrap commanditem">&nbsp;</span>
-<?php } ?>
-</div>
+<header class="row">
+    <div class="large-12 columns">
+        <h1><?php echo $nav->get('title'); ?></h1>
+    </div>
+</header>
+<main role="main">
+    <div class="row">
+        <div class="large-12 columns">
+            <?php
+            if (is_array($data) && !empty($data)) {
+                ?>
+                <table class="list">
+                    <thead>
+                        <tr>
+                            <th class="sc-padleft"><?php echo _("Field"); ?></th>
+                            <th class="sc-padleft"><?php echo _("Saved version"); ?></th>
+                            <th class="sc-padleft"><?php echo _("Current record"); ?></th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <?php
+                        foreach ($current as $k=>$v_c) {
+                            if (isset($data[$k])) {
+                                $v_d =  $data[$k];
+                                $td_style = '';
+                            } else {
+                                $v_d = '(Unavailable)';
+                                $td_style = 'color: #e00;';
+                            }
+                            $tr_style = $v_d != $v_c ? 'font-weight:bold;' : '';
+                            ?>
+                            <tr style="<?php echo $tr_style; ?>">
+                                <td class="sc-nowrap"><label><?php echo oTxt($k); ?></label></td>
+                                <td style="<?php echo $td_style; ?>"><?php echo oTxt($v_d); ?></td>
+                                <td style="<?php echo $td_style; ?>"><?php echo oTxt($v_c); ?></td>
+                            </tr>
+                        <?php } ?>
+                    </tbody>
+                </table>
+                <p class="sc-help"><?php echo _("Emboldened lines indicate something changed between the saved version and the current record."); ?></p>
+            <?php
+            }
 
-<?php if (is_array($data) && !empty($data) && is_array($current) && !empty($current)) { ?>
-<table class="list">
-    <tr>
-        <th class="sc-padleft"><?php echo _("Field"); ?></th>
-        <th class="sc-padleft"><?php echo _("Saved version"); ?></th>
-        <th class="sc-padleft"><?php echo _("Current record"); ?></th>
-    </tr>
-<?php
-foreach ($current as $k=>$v_c) {
-    $v_d = isset($data[$k]) ? $data[$k] : '<span style="color: #e00;">Unavailable</span>';
-    $style = $v_d != $v_c ? ' style="font-weight: bold;"' : '';
-    ?>
-    <tr>
-        <td class="sc-padleft sc-nowrap"<?php echo $style; ?>><label><?php echo $k; ?></label></td>
-        <td class="sc-padleft"><?php echo $v_d; ?></td>
-        <td class="sc-padleft"><?php echo $v_c; ?></td>
-    </tr>
-<?php } ?>
-</table>
-<?php } ?>
+            // Buttons.
+            $action_links = array();
+            if (!getFormData('current', false)) {
+                $action_links[] = array('href' => $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')), 'value' => _("Restore this saved version"), 'class' => 'small button alert', 'accesskey' => 'r');
+            }
+            $action_links[] = array('href' => $app->ohref(oTxt($_SERVER['PHP_SELF'])), 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'b');
+            HTML::printButtons($action_links);
+            ?>
+        </div>
+    </div>
+</main>
Index: trunk/services/templates/versions_list.ihtml
===================================================================
--- trunk/services/templates/versions_list.ihtml	(revision 483)
+++ trunk/services/templates/versions_list.ihtml	(revision 497)
@@ -1,34 +1,59 @@
-<form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
-<?php $app->printHiddenSession() ?>
-<input type="submit" name="op" value="<?php echo _("Cancel"); ?>" />
-<table class="list">
-<tr>
-    <th class="sc-padleft" colspan="3">&nbsp;</th>
-    <th class="sc-padleft"><?php echo _("ID"); ?></th>
-    <th class="sc-padleft"><?php echo _("Saved"); ?></th>
-    <th class="sc-padleft"><?php echo _("By"); ?></th>
-</tr>
-<?php
-$first = true;
-foreach ($versions as $v) { ?>
-<tr>
-    <?php if ($first) { ?>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&current=true&version_id=' . $v['version_id']); ?>">view</a>]</td>
-    <td class="sc-padleft sc-nowrap" colspan="2">(<?php echo _("Current record"); ?>)</td>
-    <?php } else { ?>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&version_id=' . $v['version_id']); ?>">view</a>]</td>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=diff&version_id=' . $v['version_id']); ?>">diff</a>]</td>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore&version_id=' . $v['version_id']); ?>">restore</a>]</td>
-    <?php } ?>
-    <td class="sc-padleft sc-nowrap"><?php echo $v['version_id']; ?></td>
-    <td class="sc-padleft sc-nowrap"><?php echo date('d M Y H:i:s', strtotime($v['version_datetime'])); ?></td>
-    <td class="sc-padleft sc-nowrap"><?php echo $v['editor']; ?></td>
-</tr>
-<?php
-$first = false;
-}
-?>
-</table>
-<div class="sc-help"><?php printf(_("When there are more than %s versions, those over %s days old are deleted."), $version->getParam('min_qty'), $version->getParam('min_days')); ?></div>
-<input type="submit" name="op" value="<?php echo _("Cancel"); ?>" />
-</form>
+<header class="row">
+    <div class="large-12 columns">
+        <h1><?php echo $nav->get('title'); ?></h1>
+    </div>
+</header>
+<main role="main">
+    <form method="post" action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" class="sc-form">
+        <?php $app->printHiddenSession() ?>
+        <div class="row">
+            <div class="large-12 columns">
+                <table>
+                    <thead>
+                        <tr>
+                            <th></th>
+                            <th><?php echo _("ID"); ?></th>
+                            <th><?php echo _("Date"); ?></th>
+                            <th><?php echo _("By"); ?></th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <?php
+                        $first = true;
+                        foreach ($versions as $v) { ?>
+                        <tr>
+                            <td>
+                                <a href="#" data-dropdown="actions-for-id-<?php echo oTxt($v['version_id']); ?>" aria-controls="actions-for-id-<?php echo oTxt($v['version_id']); ?>" aria-expanded="false" class="sc-action dropdown" data-options="is_hover:false"><i class="fa fa-cog fa-lg"></i></a>
+                                <ul id="actions-for-id-<?php echo oTxt($v['version_id']); ?>" data-dropdown-content class="f-dropdown sc-action" aria-hidden="true" tabindex="-1">
+                                    <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&version_id=' . $v['version_id']); ?>"><i class="fa fa-eye fa-fw"></i> <?php printf(_("View version <em>%s</em>"), oTxt(truncate($v['version_id'], 30))) ?></a></li>
+                                    <?php if (!$first) { ?>
+                                        <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=diff&version_id=' . $v['version_id']); ?>"><i class="fa fa-columns fa-fw"></i> <?php printf(_("View differences from version %s"), oTxt(truncate($v['version_id'], 30))) ?></a></li>
+                                        <li><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore&version_id=' . $v['version_id']); ?>"><i class="fa fa-history fa-fw"></i> <?php printf(_("Restore version <em>%s</em>"), oTxt(truncate($v['version_id'], 30))) ?></a></li>
+                                    <?php } ?>
+                                </ul>
+                            </td>
+                            <td class="sc-padleft sc-nowrap"><?php echo $v['version_id']; ?></td>
+                            <td class="sc-padleft sc-nowrap"><?php
+                                echo date(sprintf('%s %s', $app->getParam('date_format'), $app->getParam('time_format')), strtotime($v['version_datetime']));
+                                if ($first) {
+                                    ?> <span><em>(<?php echo _("The current record"); ?>)</em></span><?php
+                                }
+                                ?></td>
+                            <td class="sc-padleft sc-nowrap"><?php echo $v['editor']; ?></td>
+                        </tr>
+                        <?php
+                        $first = false;
+                        }
+                        ?>
+                    </tbody>
+                </table>
+                <div class="sc-help"><?php printf(_("When there are more than %s versions, those over %s days old are deleted."), $version->getParam('min_qty'), $version->getParam('min_days')); ?></div>
+                <?php
+                HTML::printButtons(array(
+                    array('name' => 'op', 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'c'),
+                ));
+                ?>
+            </div>
+        </div>
+    </form>
+</main>
Index: trunk/services/templates/versions_view.ihtml
===================================================================
--- trunk/services/templates/versions_view.ihtml	(revision 483)
+++ trunk/services/templates/versions_view.ihtml	(revision 497)
@@ -1,19 +1,37 @@
-<div class="commandbox">
-<span class="sc-nowrap commanditem"><a href="<?php echo $app->ohref(oTxt($_SERVER['PHP_SELF'])); ?>"><?php echo _("Back to the Versions List"); ?></a></span>
-<?php if (!getFormData('current', false)) { ?>
-    <span class="sc-nowrap commanditem"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>
-<?php } ?>
-</div>
+<header class="row">
+    <div class="large-12 columns">
+        <h1><?php echo $nav->get('title'); ?></h1>
+    </div>
+</header>
+<main role="main">
+    <div class="row">
+        <div class="large-12 columns">
+            <?php
+            if (is_array($data) && !empty($data)) {
+                ?>
+                <table class="list">
+                    <tbody>
+                        <?php
+                        foreach ($data as $k => $v_d) {
+                            ?>
+                            <tr>
+                                <td class="sc-nowrap"><label><?php echo oTxt($k); ?></label></td>
+                                <td><pre><?php echo oTxt($v_d); ?></pre></td>
+                            </tr>
+                        <?php } ?>
+                    </tbody>
+                </table>
+            <?php
+            }
 
-<?php if (is_array($data) && !empty($data)) { ?>
-<table class="list">
-<?php
-while ((list($k, $v_d) = each($data))) {
-    ?>
-    <tr>
-        <td class="sc-padleft sc-nowrap"><label><?php echo $k; ?></label></td>
-        <td class="sc-padleft"><pre><?php echo $v_d; ?></pre></td>
-    </tr>
-<?php } ?>
-</table>
-<?php } ?>
+            // Buttons.
+            $action_links = array();
+            if (!getFormData('current', false)) {
+                $action_links[] = array('href' => $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')), 'value' => _("Restore this saved version"), 'class' => 'small button alert', 'accesskey' => 'r');
+            }
+            $action_links[] = array('href' => $app->ohref(oTxt($_SERVER['PHP_SELF'])), 'value' => _("Cancel"), 'class' => 'small button secondary', 'accesskey' => 'b');
+            HTML::printButtons($action_links);
+            ?>
+        </div>
+    </div>
+</main>
Index: trunk/services/versions.php
===================================================================
--- trunk/services/versions.php	(revision 483)
+++ trunk/services/versions.php	(revision 497)
@@ -32,4 +32,5 @@
 require_once 'codebase/lib/Version.inc.php';
 require_once 'codebase/lib/Lock.inc.php';
+require_once 'codebase/lib/HTML.inc.php';
 
 /******************************************************************************
@@ -39,4 +40,8 @@
 // Since we're using the singleton pattern we can instantiate a Version object earlier with custom parameters.
 $version =& Version::getInstance($auth);
+$version->setParam(array(
+    // If true, makes an exact comparison of saved vs. live table schemas. If false, just checks that the saved columns are available.
+    'db_schema_strict' => false,
+));
 
 // Query arguments to retain their values between page requests.
@@ -80,5 +85,5 @@
     $data = $version->getData($version_id);
     $versionrecord = $version->getVerson($version_id);
-    $nav->add(sprintf(_("View <em>%s</em> version %s (%s)"), $versionrecord['version_title'], $version_id, $versionrecord['version_datetime']));
+    $nav->add(sprintf(_("%s <small>Version %s (%s)</small>"), $versionrecord['version_title'], $version_id, date(sprintf('%s %s', $app->getParam('date_format'), $app->getParam('time_format')), strtotime($versionrecord['version_datetime']))));
     $main_template = 'versions_view.ihtml';
     break;
@@ -89,7 +94,7 @@
     $current = $version->getCurrent($record_table, $record_key, $record_val);
     if (serialize($data) == serialize($current)) {
-        $app->raiseMsg(sprintf(_("Version <em>%s</em> is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("Version %s is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__);
     }
-    $nav->add(sprintf(_("Difference between version %s (%s) and current record."), $version_id, $versionrecord['version_datetime']));
+    $nav->add(sprintf(_("%s <small>Version %s (%s)</small>"), $versionrecord['version_title'], $version_id, date(sprintf('%s %s', $app->getParam('date_format'), $app->getParam('time_format')), strtotime($versionrecord['version_datetime']))));
     $main_template = 'versions_diff.ihtml';
     break;
@@ -119,8 +124,8 @@
     if (is_array($versions) && !empty($versions)) {
         $_POST['version_title'] = $versions[0]['version_title'];
-        $nav->add(sprintf(_("%s versions of record <em>%s</em>"), sizeof($versions), $versions[0]['version_title']));
+        $nav->add(sprintf(_("%s versions of <em>%s</em>"), sizeof($versions), $versions[0]['version_title']));
         $main_template = 'versions_list.ihtml';
     } else {
-        $app->raiseMsg(sprintf(_("No saved versions available for this record"), null), MSG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("No saved versions available"), null), MSG_NOTICE, __FILE__, __LINE__);
         $app->dieBoomerangURL('versions');
     }
