Project

General

Profile

1 4 ryan
<?php
2
3 36 stefan
// $Id$
4 4 ryan
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, Ryan Djurovich
9
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
24
*/
25
26
/*
27
The Website Baker Project would like to thank Rudolph Lartey <www.carbonect.com>
28
for his contributions to this module - adding extra field types
29
*/
30
31
require('../../config.php');
32
33
// Include WB admin wrapper script
34
require(WB_PATH.'/modules/admin.php');
35
36
// Get header and footer
37
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings WHERE section_id = '$section_id'");
38
$setting = $query_content->fetchRow();
39
40
// Set raw html <'s and >'s to be replace by friendly html code
41
$raw = array('<', '>');
42
$friendly = array('&lt;', '&gt;');
43
44
?>
45
46
<style type="text/css">
47
.setting_name {
48
	vertical-align: top;
49
}
50
</style>
51
52
<form name="edit" action="<?php echo WB_URL; ?>/modules/form/save_settings.php" method="post" style="margin: 0;">
53
54
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>">
55
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">
56
57
<table cellpadding="2" cellspacing="0" border="0" width="100%">
58
<tr>
59
	<td class="setting_name" width="220"><?php echo $TEXT['HEADER']; ?>:</td>
60
	<td class="setting_name">
61 42 stefan
		<textarea name="header" style="width: 100%; height: 80px;"><?php echo $admin->strip_slashes_dummy($setting['header']); ?></textarea>
62 4 ryan
	</td>
63
</tr>
64
<tr>
65
	<td class="setting_name"><?php echo $TEXT['FIELD'].' '.$TEXT['LOOP']; ?>:</td>
66
	<td class="setting_name">
67 42 stefan
		<textarea name="field_loop" style="width: 100%; height: 60px;"><?php echo $admin->strip_slashes_dummy($setting['field_loop']); ?></textarea>
68 4 ryan
	</td>
69
</tr>
70
<tr>
71
	<td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
72
	<td class="setting_name">
73 42 stefan
		<textarea name="footer" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($setting['footer'])); ?></textarea>
74 4 ryan
	</td>
75
</tr>
76
<tr>
77
	<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['TO']; ?>:</td>
78
	<td class="setting_name">
79 42 stefan
		<textarea name="email_to" style="width: 100%; height: 30px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($setting['email_to'])); ?></textarea>
80 4 ryan
	</td>
81
</tr>
82
<tr>
83
	<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['FROM']; ?>:</td>
84
	<td class="setting_name">
85
		<select name="email_from_field" style="width: 100%;">
86
			<option value="" onclick="javascript: document.getElementById('email_from').style.display = 'block';"><?php echo $TEXT['CUSTOM']; ?>:</option>
87
			<?php
88 42 stefan
			$email_from_value = str_replace($raw, $friendly, $admin->strip_slashes_dummy($setting['email_from']));
89 4 ryan
			$query_email_fields = $database->query("SELECT field_id,title FROM ".TABLE_PREFIX."mod_form_fields ORDER BY position ASC");
90
			if($query_email_fields->numRows() > 0) {
91
				while($field = $query_email_fields->fetchRow()) {
92
					?>
93
					<option value="field<?php echo $field['field_id']; ?>"<?php if($email_from_value == 'field'.$field['field_id']) { echo ' selected'; $selected = true; } ?> onclick="javascript: document.getElementById('email_from').style.display = 'none';">
94
						<?php echo $TEXT['FIELD'].': '.$field['title']; ?>
95
					</option>
96
					<?php
97
				}
98
			}
99
			?>
100
		</select>
101
		<input type="text" name="email_from" id="email_from" style="width: 100%; display: <?php if(isset($selected) AND $selected == true) { echo 'none'; } else { echo 'block'; } ?>;" maxlength="255" value="<?php if(substr($email_from_value, 0, 5) != 'field') { echo $email_from_value; } ?>" />
102
	</td>
103
</tr>
104
<tr>
105
	<td class="setting_name"><?php echo $TEXT['EMAIL'].' '.$TEXT['SUBJECT']; ?>:</td>
106
	<td class="setting_name">
107 42 stefan
		<input type="text" name="email_subject" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($setting['email_subject'])); ?>" />
108 4 ryan
	</td>
109
</tr>
110
<tr>
111
	<td class="setting_name"><?php echo $TEXT['SUCCESS'].' '.$TEXT['MESSAGE']; ?>:</td>
112
	<td class="setting_name">
113 42 stefan
		<textarea name="success_message" style="width: 100%; height: 80px;"><?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($setting['success_message'])); ?></textarea>
114 4 ryan
	</td>
115
</tr>
116
<tr>
117
	<td class="setting_name"><?php echo $TEXT['MAX_SUBMISSIONS_PER_HOUR']; ?>:</td>
118
	<td class="setting_name">
119 42 stefan
		<input type="text" name="max_submissions" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($setting['max_submissions'])); ?>" />
120 4 ryan
	</td>
121
</tr>
122
<tr>
123
	<td class="setting_name"><?php echo $TEXT['SUBMISSIONS_STORED_IN_DATABASE']; ?>:</td>
124
	<td class="setting_name">
125 42 stefan
		<input type="text" name="stored_submissions" style="width: 100%;" maxlength="255" value="<?php echo str_replace($raw, $friendly, $admin->strip_slashes_dummy($setting['stored_submissions'])); ?>" />
126 4 ryan
	</td>
127
</tr>
128
</table>
129
<table cellpadding="0" cellspacing="0" border="0" width="100%">
130
<tr>
131
	<td width="225">&nbsp;</td>
132
	<td align="left">
133
		<input name="save" type="submit" value="<?php echo $TEXT['SAVE'].' '.$TEXT['SETTINGS']; ?>" style="width: 200px; margin-top: 5px;"></form>
134
	</td>
135
	<td align="right">
136
		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
137
	</td>
138
</tr>
139
</table>
140
141
142
<?php
143
144
// Print admin footer
145
$admin->print_footer();
146
147
?>