]>
src.bluestatic.org Git - bugdar.git/blob - admin/userhelp.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 require_once('./global.php');
23 require_once('./includes/api_userhelp.php');
24 require_once('./includes/functions_datastore.php');
26 NavLinks
::optionsPages();
27 NavLinks
::userhelpAdd();
28 $navigator->set_focus('tab', 'options', null);
30 if (!can_perform('canadmintools'))
35 // ###################################################################
37 if (empty($_REQUEST['do']))
39 $_REQUEST['do'] = 'modify';
42 // ###################################################################
44 if ($_REQUEST['do'] == 'kill')
46 $help = new UserHelpAPI($bugsys);
47 $help->set('keystring', $bugsys->in
['keystring']);
52 $admin->redirect('userhelp.php?do=modify');
55 // ###################################################################
57 if ($_REQUEST['do'] == 'delete')
59 $admin->page_confirm($lang->string('Are you sure you want to delete help text?'), 'userhelp.php?do=kill&keystring=' . $bugsys->in
['keystring']);
62 // ###################################################################
64 if ($_POST['do'] == 'insert')
66 $help = new UserHelpAPI($bugsys);
67 $help->set('keystring', $bugsys->in
['keystring']);
68 $help->set('title', $bugsys->in
['title']);
69 $help->set('body', $bugsys->in
['body']);
72 $admin->redirect('userhelp.php?do=modify');
75 // ###################################################################
77 if ($_REQUEST['do'] == 'add')
79 $navigator->set_focus('link', 'options-userhelp-add', 'options-userhelp');
81 $admin->page_start($lang->string('New Help Text'));
83 $admin->form_start('userhelp.php', 'insert');
85 $admin->table_start();
86 $admin->table_head($lang->string('New Help Text'));
88 $admin->row_input($lang->string('Topic Title'), 'title');
89 $admin->row_input($lang->string('Unique Key<br />(lowercase letters, underscores, and numbers only)'), 'keystring');
90 $admin->row_textarea($lang->string('Body Text'), 'body');
101 // ###################################################################
103 if ($_POST['do'] == 'update')
105 foreach ($bugsys->in
['help'] AS $keystring => $fields)
107 $help = new UserHelpAPI($bugsys);
108 $help->norunners
= array('post_update');
109 $help->set('keystring', $keystring);
110 $help->set_condition();
111 $help->set('title', $fields['title']);
112 $help->set('body', $fields['body']);
118 $admin->redirect('userhelp.php?do=modify');
121 // ###################################################################
123 if ($_REQUEST['do'] == 'modify')
125 $navigator->set_focus('link', 'options-pages-userhelp', 'options-pages');
127 $admin->page_start($lang->string('Edit User Help'));
129 $admin->form_start('userhelp.php', 'update');
131 $admin->table_start();
132 $admin->table_head($lang->string('Edit User Help'));
134 $topics = $db->query("SELECT * FROM " . TABLE_PREFIX
. "fieldhelp ORDER BY keystring ASC");
135 while ($topic = $db->fetch_array($topics))
137 $inputfield = '<input type="text" class="input" name="help[' . $topic['keystring'] . '][title]" value="' . $topic['title'] . '" size="35" />';
138 $delete = (!in_array($topic['keystring'], UserHelpAPI
::not_able_to_delete()) ? '<br /><br /><a href="userhelp.php?do=delete&keystring=' . $topic['keystring'] . '">[' . $lang->string('Delete') . ']</a>' : '');
140 $admin->row_textarea($inputfield . '<br /><em>' . $topic['keystring'] . '</em>' . $delete, 'help[' . $topic['keystring'] . '][body]', $topic['body']);
143 $admin->row_submit();
149 /*=====================================================================*\
150 || ###################################################################
153 || ###################################################################
154 \*=====================================================================*/