--- /dev/null
+<%- $templates['doctype'] %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
+<head>
+ <%- $templates['headinclude'] %>
+ <title><%- $templates['title'] %> - <%- T('Edit User Help') %></title>
+</head>
+
+<body>
+
+<%- $templates['nav'] %>
+
+<div id="title"><%- T('Edit User Help') %></div>
+
+<div id="body">
+
+<%- admin_flash() %>
+
+<form action="userhelp.php" method="post">
+<input type="hidden" name="do" value="update" />
+
+<table>
+<thead>
+ <tr><td colspan="2"><%- T('Edit User Help') %></td></tr>
+</thead>
+
+<% foreach ($topics as $topic): %>
+<tr class="alt1">
+ <td>
+ <div><input type="text" class="input" name="help[<%- $topic['keystring'] %>][title]" value="<%- $topic['title'] %>" size="35" /></div>
+ <div>
+ <em><%- $topic['keystring'] %></em>
+ <% if (!in_array($topic['keystring'], UserHelpAPI::not_able_to_delete())): %><a href="userhelp.php?do=delete&keystring=<%- $topic['keystring'] %>">[<%- T('Delete') %>]</a><% endif %>
+ </div>
+ </td>
+ <td><textarea name="help[<%- $topic['keystring'] %>][body]"><%- $topic['body'] %></textarea></td>
+</tr>
+<% endforeach %>
+
+</table>
+
+<div class="submit">
+ <input type="submit" value="<%- T('Save') %>" />
+ <input type="reset" value="<%- T('Reset') %>" />
+ <a href="userhelp.php?do=add" class="button"><%- T('Add New Item') %></a>
+</div>
+
+</form>
+
+
+<%- admin_footer() %>
+
+</div>
+
+<script type="text/javascript"> nav_init("system", "system_userhelp"); </script>
+
+</body>
+
+</html>
\ No newline at end of file
--- /dev/null
+<%- $templates['doctype'] %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
+<head>
+ <%- $templates['headinclude'] %>
+ <title><%- $templates['title'] %> - <%- T('New Help Text') %></title>
+</head>
+
+<body>
+
+<%- $templates['nav'] %>
+
+<div id="title"><%- T('Manage Languages') %></div>
+
+<div id="body">
+
+<%- admin_flash() %>
+
+<form action="userhelp.php" method="post">
+<input type="hidden" name="do" value="insert" />
+
+<fieldset>
+ <legend><%- T('New Help Text') %></legend>
+
+ <dl>
+
+ <dt><label for="l_title"><%- T('Topic Title') %></label></dt>
+ <dd><input type="text" name="title" id="l_title" /></dd>
+
+ <dt>
+ <label for="keystring">
+ <%- T('Unique Key') %>
+ <dfn><%- T('This should contain lonly owercase letters, underscores, and numbers.') %></dfn>
+ </label>
+ </dt>
+ <dd><input type="text" name="keystring" id="keystring" /></dd>
+
+ <dt><label for="body"><%- T('Body Text') %></label></dt>
+ <dd><textarea id="body"></textarea></dd>
+
+ </dl>
+</fieldset>
+
+<div class="submit">
+ <input type="submit" value="<%- T('Save') %>" />
+ <input type="reset" value="<%- T('Reset') %>" />
+</div>
+
+<%- admin_footer() %>
+
+</div>
+
+</body>
+
+<script type="text/javascript"> nav_init("system", "system_userhelp"); </script>
+
+</body>
+
+</html>
\ No newline at end of file
require_once('./includes/api_userhelp.php');
require_once('./includes/functions_datastore.php');
-APIError(array(new API_Error_Handler($admin), 'admin_error'));
-
-NavLinks::optionsPages();
-NavLinks::userhelpAdd();
-$navigator->set_focus('tab', 'options', null);
-
if (!can_perform('canadmintools'))
{
admin_login();
build_user_help();
- $admin->redirect('userhelp.php?do=modify');
+ admin_flash_redirect('userhelp.php?do=modify');
}
// ###################################################################
$help->set('body', $input->in['body']);
$help->insert();
- $admin->redirect('userhelp.php?do=modify');
+ admin_flash_redirect('userhelp.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'add')
{
- $navigator->set_focus('link', 'options-userhelp-add', 'options-userhelp');
-
- $admin->page_start(T('New Help Text'));
-
- $admin->form_start('userhelp.php', 'insert');
-
- $admin->table_start();
- $admin->table_head(T('New Help Text'));
-
- $admin->row_input(T('Topic Title'), 'title');
- $admin->row_input(T('Unique Key<br />(lowercase letters, underscores, and numbers only)'), 'keystring');
- $admin->row_textarea(T('Body Text'), 'body');
-
- $admin->row_submit();
-
- $admin->table_end();
-
- $admin->form_end();
-
- $admin->page_end();
+ BSTemplate::fetch('userhelp_add')->evaluate()->flush();
}
// ###################################################################
if ($_POST['do'] == 'update')
{
- foreach ($input->in['help'] AS $keystring => $fields)
+ foreach ($input->in['help'] as $keystring => $fields)
{
$help = new UserHelpAPI();
- $help->norunners = array('post_update');
$help->set('keystring', $keystring);
- $help->set_condition();
$help->set('title', $fields['title']);
$help->set('body', $fields['body']);
- $help->update();
+ $help->update(true, false);
}
build_user_help();
- $admin->redirect('userhelp.php?do=modify');
+ admin_flash_redirect('userhelp.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'modify')
{
- $navigator->set_focus('link', 'options-pages-userhelp', 'options-pages');
-
- $admin->page_start(T('Edit User Help'));
-
- $admin->form_start('userhelp.php', 'update');
-
- $admin->table_start();
- $admin->table_head(T('Edit User Help'));
-
- $topics = $db->query("SELECT * FROM " . TABLE_PREFIX . "fieldhelp ORDER BY keystring ASC");
- foreach ($topics as $topic)
- {
- $inputfield = '<input type="text" class="input" name="help[' . $topic['keystring'] . '][title]" value="' . $topic['title'] . '" size="35" />';
- $delete = (!in_array($topic['keystring'], UserHelpAPI::not_able_to_delete()) ? '<br /><br /><a href="userhelp.php?do=delete&keystring=' . $topic['keystring'] . '">[' . T('Delete') . ']</a>' : '');
-
- $admin->row_textarea($inputfield . '<br /><em>' . $topic['keystring'] . '</em>' . $delete, 'help[' . $topic['keystring'] . '][body]', $topic['body']);
- }
-
- $admin->row_submit();
- $admin->table_end();
-
- $admin->page_end();
+ $admin = new BSTemplate('userhelp');
+ $admin->vars['topics'] = $db->query("SELECT * FROM " . TABLE_PREFIX . "fieldhelp ORDER BY keystring ASC");
+ $admin->evaluate()->flush();
}
?>
\ No newline at end of file