set_focus('tab', 'options', null); if (!can_perform('canadmintools')) { admin_login(); } // ################################################################### if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'modify'; } // ################################################################### if ($_REQUEST['do'] == 'kill') { $help = new UserHelpAPI(); $help->set('keystring', $input->in['keystring']); $help->delete(); build_user_help(); $admin->redirect('userhelp.php?do=modify'); } // ################################################################### if ($_REQUEST['do'] == 'delete') { $admin->page_confirm(T('Are you sure you want to delete help text?'), 'userhelp.php', 'kill', array('keystring' => $input->in['keystring'])); } // ################################################################### if ($_POST['do'] == 'insert') { $help = new UserHelpAPI(); $help->set('keystring', $input->in['keystring']); $help->set('title', $input->in['title']); $help->set('body', $input->in['body']); $help->insert(); $admin->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
(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(); } // ################################################################### if ($_POST['do'] == 'update') { 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(); } build_user_help(); $admin->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 = ''; $delete = (!in_array($topic['keystring'], UserHelpAPI::not_able_to_delete()) ? '

[' . T('Delete') . ']' : ''); $admin->row_textarea($inputfield . '
' . $topic['keystring'] . '' . $delete, 'help[' . $topic['keystring'] . '][body]', $topic['body']); } $admin->row_submit(); $admin->table_end(); $admin->page_end(); } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>