Project

General

Profile

1 560 Ruebenwurz
<?php
2
3
// $Id$
4
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8 915 Ruebenwurz
 Copyright (C) 2004-2009, Ryan Djurovich
9 560 Ruebenwurz
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
// Get id
34
if(!isset($_GET['field_id']) OR !is_numeric($_GET['field_id'])) {
35
	header("Location: ".ADMIN_URL."/pages/index.php");
36
	exit(0);
37
} else {
38
	$field_id = $_GET['field_id'];
39
}
40
41
// Include WB admin wrapper script
42
require(WB_PATH.'/modules/admin.php');
43
44
// Get header and footer
45
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'");
46
$form = $query_content->fetchRow();
47
$type = $form['type'];
48
if($type == '') {
49
	$type = 'none';
50
}
51
52
// Set raw html <'s and >'s to be replaced by friendly html code
53
$raw = array('<', '>');
54
$friendly = array('&lt;', '&gt;');
55
?>
56
57
<form name="modify" action="<?php echo WB_URL; ?>/modules/form/save_field.php" method="post" style="margin: 0;">
58
59 1069 Ruebenwurz
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
60
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
61
<input type="hidden" name="field_id" value="<?php echo $field_id; ?>" />
62 560 Ruebenwurz
63
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
64
	<tr>
65
		<td colspan="2"><strong><?php echo $TEXT['MODIFY'].' '.$TEXT['FIELD']; ?></strong></td>
66
	</tr>
67
	<tr>
68
		<td width="20%"><?php echo $TEXT['TITLE']; ?>:</td>
69
		<td>
70
			<input type="text" name="title" value="<?php echo htmlspecialchars(($form['title'])); ?>" style="width: 98%;" maxlength="255" />
71
		</td>
72
	</tr>
73
	<tr>
74
		<td><?php echo $TEXT['TYPE']; ?>:</td>
75
		<td>
76
			<select name="type" style="width: 98%;">
77
				<option value=""><?php echo $TEXT['PLEASE_SELECT']; ?>...</option>
78 1069 Ruebenwurz
				<option value="heading"<?php if($type == 'heading') { echo ' selected="selected"'; } ?>><?php echo $TEXT['HEADING']; ?></option>
79
				<option value="textfield"<?php if($type == 'textfield') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SHORT'].' '.$TEXT['TEXT']; ?> (Textfield)</option>
80
				<option value="textarea"<?php if($type == 'textarea') { echo ' selected="selected"'; } ?>><?php echo $TEXT['LONG'].' '.$TEXT['TEXT']; ?> (Textarea)</option>
81
				<option value="select"<?php if($type == 'select') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SELECT_BOX']; ?></option>
82
				<option value="checkbox"<?php if($type == 'checkbox') { echo ' selected="selected"'; } ?>><?php echo $TEXT['CHECKBOX_GROUP']; ?></option>
83
				<option value="radio"<?php if($type == 'radio') { echo ' selected="selected"'; } ?>><?php echo $TEXT['RADIO_BUTTON_GROUP']; ?></option>
84
				<option value="email"<?php if($type == 'email') { echo ' selected="selected"'; } ?>><?php echo $TEXT['EMAIL_ADDRESS']; ?></option>
85 560 Ruebenwurz
			</select>
86
		</td>
87
	</tr>
88
<?php if($type != 'none' AND $type != 'email') { ?>
89
	<?php if($type == 'heading') { ?>
90
	<tr>
91
		<td valign="top"><?php echo $TEXT['TEMPLATE']; ?>:</td>
92
		<td>
93
			<textarea name="template" style="width: 98%; height: 20px;"><?php echo htmlspecialchars(($form['extra'])); ?></textarea>
94
		</td>
95
	</tr>
96
	<?php } elseif($type == 'textfield') { ?>
97
	<tr>
98
		<td><?php echo $TEXT['LENGTH']; ?>:</td>
99
		<td>
100
			<input type="text" name="length" value="<?php echo $form['extra']; ?>" style="width: 98%;" maxlength="3" />
101
		</td>
102
	</tr>
103
	<tr>
104
		<td><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td>
105
		<td>
106
			<input type="text" name="value" value="<?php echo $form['value']; ?>" style="width: 98%;" />
107
		</td>
108
	</tr>
109
	<?php } elseif($type == 'textarea') { ?>
110
	<tr>
111
		<td valign="top"><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td>
112
		<td>
113
			<textarea name="value" style="width: 98%; height: 100px;"><?php echo $form['value']; ?></textarea>
114
		</td>
115
	</tr>
116
	<?php } elseif($type == 'select' OR $type = 'radio' OR $type = 'checkbox') { ?>
117
	<tr>
118 1124 Ruebenwurz
		<td valign="top"><?php echo $TEXT['LIST_OPTIONS']; ?>:</td>
119 560 Ruebenwurz
		<td>
120
			<?php
121
			$option_count = 0;
122
			$list = explode(',', $form['value']);
123
			foreach($list AS $option_value) {
124
				$option_count = $option_count+1;
125
				?>
126
				<table cellpadding="3" cellspacing="0" width="100%" border="0">
127
				<tr>
128
					<td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td>
129
					<td>
130
						<input type="text" name="value<?php echo $option_count; ?>" value="<?php echo $option_value; ?>" style="width: 250px;" />
131
					</td>
132
				</tr>
133
				</table>
134
				<?php
135
			}
136
			for($i = 0; $i < 2; $i++) {
137
				$option_count = $option_count+1;
138
				?>
139
				<table cellpadding="3" cellspacing="0" width="100%" border="0">
140
				<tr>
141
					<td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td>
142
					<td>
143
						<input type="text" name="value<?php echo $option_count; ?>" value="" style="width: 250px;" />
144
					</td>
145
				</tr>
146
				</table>
147
				<?php
148
			}
149
			?>
150
			<input type="hidden" name="list_count" value="<?php echo $option_count; ?>" />
151
		</td>
152
	</tr>
153
	<?php } ?>
154
	<?php if($type == 'select') { ?>
155
	<tr>
156
		<td><?php echo $TEXT['SIZE']; ?>:</td>
157
		<td>
158
			<?php $form['extra'] = explode(',',$form['extra']); ?>
159
			<input type="text" name="size" value="<?php echo trim($form['extra'][0]); ?>" style="width: 98%;" maxlength="3" />
160
		</td>
161
	</tr>
162
	<tr>
163
		<td><?php echo $TEXT['ALLOW_MULTIPLE_SELECTIONS']; ?>:</td>
164
		<td>
165 1069 Ruebenwurz
			<input type="radio" name="multiselect" id="multiselect_true" value="multiple" <?php if($form['extra'][1] == 'multiple') { echo ' checked="checked"'; } ?> />
166 560 Ruebenwurz
			<a href="#" onclick="javascript: document.getElementById('multiselect_true').checked = true;">
167
			<?php echo $TEXT['YES']; ?>
168
			</a>
169
			&nbsp;
170 1069 Ruebenwurz
			<input type="radio" name="multiselect" id="multiselect_false" value="" <?php if($form['extra'][1] == '') { echo ' checked="checked"'; } ?> />
171 560 Ruebenwurz
			<a href="#" onclick="javascript: document.getElementById('multiselect_false').checked = true;">
172
			<?php echo $TEXT['NO']; ?>
173
			</a>
174
		</td>
175
	</tr>
176
	<?php } elseif($type == 'checkbox' OR $type == 'radio') { ?>
177
	<tr>
178
		<td valign="top"><?php echo $TEXT['SEPERATOR']; ?>:</td>
179
		<td>
180
			<input type="text" name="seperator" value="<?php echo $form['extra']; ?>" style="width: 98%;" />
181
		</td>
182
	</tr>
183
	<?php } ?>
184
<?php } ?>
185
<?php if($type != 'heading' AND $type != 'none') { ?>
186
	<tr>
187
		<td><?php echo $TEXT['REQUIRED']; ?>:</td>
188
		<td>
189 1069 Ruebenwurz
			<input type="radio" name="required" id="required_true" value="1" <?php if($form['required'] == 1) { echo ' checked="checked"'; } ?> />
190 560 Ruebenwurz
			<a href="#" onclick="javascript: document.getElementById('required_true').checked = true;">
191
			<?php echo $TEXT['YES']; ?>
192
			</a>
193
			&nbsp;
194 1069 Ruebenwurz
			<input type="radio" name="required" id="required_false" value="0" <?php if($form['required'] == 0) { echo ' checked="checked"'; } ?> />
195 560 Ruebenwurz
			<a href="#" onclick="javascript: document.getElementById('required_false').checked = true;">
196
			<?php echo $TEXT['NO']; ?>
197
			</a>
198
		</td>
199
	</tr>
200
<?php } ?>
201
</table>
202
203
<table cellpadding="0" cellspacing="0" border="0" width="100%">
204
	<tr>
205
		<td align="left">
206 1069 Ruebenwurz
			<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
207 560 Ruebenwurz
		</td>
208
		<?php
209
		// added by John Maats, PCWacht, 12 januar 2006
210
		if ($type<>'none') {
211
		?>
212
		<td align="center">
213 1074 Ruebenwurz
			<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 200px; margin-top: 5px;" />
214 560 Ruebenwurz
		</td>
215
		<?php }
216
		// end addition
217
		?>
218
		<td align="right">
219
			<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="javascript: window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" style="width: 100px; margin-top: 5px;" />
220
		</td>
221
	</tr>
222
</table>
223 1069 Ruebenwurz
</form>
224 560 Ruebenwurz
<?php
225
226
// Print admin footer
227
$admin->print_footer();
228
229
?>