1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category module
|
5
|
* @package Form
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright 2004-2009, Ryan Djurovich
|
8
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9
|
* @link http://www.websitebaker2.org/
|
10
|
* @license http://www.gnu.org/licenses/gpl.html
|
11
|
* @platform WebsiteBaker 2.8.x
|
12
|
* @requirements PHP 5.2.2 and higher
|
13
|
* @version $Id: modify_field.php 1457 2011-06-25 17:18:50Z Luisehahne $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/tags/2.8.2/wb/modules/form/modify_field.php $
|
15
|
* @lastmodified $Date: 2011-06-25 19:18:50 +0200 (Sat, 25 Jun 2011) $
|
16
|
* @description
|
17
|
*/
|
18
|
|
19
|
require('../../config.php');
|
20
|
|
21
|
$print_info_banner = true;
|
22
|
// Tells script to update when this page was last updated
|
23
|
$update_when_modified = false;
|
24
|
// Include WB admin wrapper script
|
25
|
require(WB_PATH.'/modules/admin.php');
|
26
|
/* */
|
27
|
// Get id
|
28
|
$field_id = $admin->checkIDKEY('field_id', false, 'GET');
|
29
|
if (!$field_id) {
|
30
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']." MF: $field_id :-(", ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
|
31
|
}
|
32
|
|
33
|
// Get header and footer
|
34
|
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_fields WHERE field_id = '$field_id'");
|
35
|
$form = $query_content->fetchRow();
|
36
|
$type = $form['type'];
|
37
|
if($type == '') {
|
38
|
$type = 'none';
|
39
|
}
|
40
|
|
41
|
// set new token
|
42
|
$field_id = $admin->getIDKEY($form['field_id']);
|
43
|
// Set raw html <'s and >'s to be replaced by friendly html code
|
44
|
$raw = array('<', '>');
|
45
|
$friendly = array('<', '>');
|
46
|
?>
|
47
|
|
48
|
<form name="modify" action="<?php echo WB_URL; ?>/modules/form/save_field.php" method="post" style="margin: 0;">
|
49
|
<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
|
50
|
<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
|
51
|
<input type="hidden" name="field_id" value="<?php echo $field_id; ?>" />
|
52
|
<?php echo $admin->getFTAN(); ?>
|
53
|
|
54
|
<table class="row_a" cellpadding="2" cellspacing="0" border="0" width="100%">
|
55
|
<tr>
|
56
|
<td colspan="2"><strong><?php echo $TEXT['MODIFY'].' '.$TEXT['FIELD']; ?></strong></td>
|
57
|
</tr>
|
58
|
<tr>
|
59
|
<td width="20%"><?php echo $TEXT['TITLE']; ?>:</td>
|
60
|
<td>
|
61
|
<input type="text" name="title" value="<?php echo htmlspecialchars(($form['title'])); ?>" style="width: 98%;" maxlength="255" />
|
62
|
</td>
|
63
|
</tr>
|
64
|
<tr>
|
65
|
<td><?php echo $TEXT['TYPE']; ?>:</td>
|
66
|
<td>
|
67
|
<select name="type" style="width: 98%;">
|
68
|
<option value=""><?php echo $TEXT['PLEASE_SELECT']; ?>...</option>
|
69
|
<option value="heading"<?php if($type == 'heading') { echo ' selected="selected"'; } ?>><?php echo $TEXT['HEADING']; ?></option>
|
70
|
<option value="textfield"<?php if($type == 'textfield') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SHORT'].' '.$TEXT['TEXT']; ?> (Textfield)</option>
|
71
|
<option value="textarea"<?php if($type == 'textarea') { echo ' selected="selected"'; } ?>><?php echo $TEXT['LONG'].' '.$TEXT['TEXT']; ?> (Textarea)</option>
|
72
|
<option value="select"<?php if($type == 'select') { echo ' selected="selected"'; } ?>><?php echo $TEXT['SELECT_BOX']; ?></option>
|
73
|
<option value="checkbox"<?php if($type == 'checkbox') { echo ' selected="selected"'; } ?>><?php echo $TEXT['CHECKBOX_GROUP']; ?></option>
|
74
|
<option value="radio"<?php if($type == 'radio') { echo ' selected="selected"'; } ?>><?php echo $TEXT['RADIO_BUTTON_GROUP']; ?></option>
|
75
|
<option value="email"<?php if($type == 'email') { echo ' selected="selected"'; } ?>><?php echo $TEXT['EMAIL_ADDRESS']; ?></option>
|
76
|
</select>
|
77
|
</td>
|
78
|
</tr>
|
79
|
<?php if($type != 'none' AND $type != 'email') { ?>
|
80
|
<?php if($type == 'heading') { ?>
|
81
|
<tr>
|
82
|
<td valign="top"><?php echo $TEXT['TEMPLATE']; ?>:</td>
|
83
|
<td>
|
84
|
<textarea name="template" style="width: 98%; height: 20px;"><?php echo htmlspecialchars(($form['extra'])); ?></textarea>
|
85
|
</td>
|
86
|
</tr>
|
87
|
<?php } elseif($type == 'textfield') { ?>
|
88
|
<tr>
|
89
|
<td><?php echo $TEXT['LENGTH']; ?>:</td>
|
90
|
<td>
|
91
|
<input type="text" name="length" value="<?php echo $form['extra']; ?>" style="width: 98%;" maxlength="3" />
|
92
|
</td>
|
93
|
</tr>
|
94
|
<tr>
|
95
|
<td><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td>
|
96
|
<td>
|
97
|
<input type="text" name="value" value="<?php echo $form['value']; ?>" style="width: 98%;" />
|
98
|
</td>
|
99
|
</tr>
|
100
|
<?php } elseif($type == 'textarea') { ?>
|
101
|
<tr>
|
102
|
<td valign="top"><?php echo $TEXT['DEFAULT_TEXT']; ?>:</td>
|
103
|
<td>
|
104
|
<textarea name="value" style="width: 98%; height: 100px;"><?php echo $form['value']; ?></textarea>
|
105
|
</td>
|
106
|
</tr>
|
107
|
<?php } elseif($type == 'select' OR $type = 'radio' OR $type = 'checkbox') { ?>
|
108
|
<tr>
|
109
|
<td valign="top"><?php echo $TEXT['LIST_OPTIONS']; ?>:</td>
|
110
|
<td>
|
111
|
<?php
|
112
|
$option_count = 0;
|
113
|
$list = explode(',', $form['value']);
|
114
|
foreach($list AS $option_value) {
|
115
|
$option_count = $option_count+1;
|
116
|
?>
|
117
|
<table cellpadding="3" cellspacing="0" width="100%" border="0">
|
118
|
<tr>
|
119
|
<td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td>
|
120
|
<td>
|
121
|
<input type="text" name="value<?php echo $option_count; ?>" value="<?php echo $option_value; ?>" style="width: 250px;" />
|
122
|
</td>
|
123
|
</tr>
|
124
|
</table>
|
125
|
<?php
|
126
|
}
|
127
|
for($i = 0; $i < 2; $i++) {
|
128
|
$option_count = $option_count+1;
|
129
|
?>
|
130
|
<table cellpadding="3" cellspacing="0" width="100%" border="0">
|
131
|
<tr>
|
132
|
<td width="70"><?php echo $TEXT['OPTION'].' '.$option_count; ?>:</td>
|
133
|
<td>
|
134
|
<input type="text" name="value<?php echo $option_count; ?>" value="" style="width: 250px;" />
|
135
|
</td>
|
136
|
</tr>
|
137
|
</table>
|
138
|
<?php
|
139
|
}
|
140
|
?>
|
141
|
<input type="hidden" name="list_count" value="<?php echo $option_count; ?>" />
|
142
|
</td>
|
143
|
</tr>
|
144
|
<?php } ?>
|
145
|
<?php if($type == 'select') { ?>
|
146
|
<tr>
|
147
|
<td><?php echo $TEXT['SIZE']; ?>:</td>
|
148
|
<td>
|
149
|
<?php $form['extra'] = explode(',',$form['extra']); ?>
|
150
|
<input type="text" name="size" value="<?php echo trim($form['extra'][0]); ?>" style="width: 98%;" maxlength="3" />
|
151
|
</td>
|
152
|
</tr>
|
153
|
<tr>
|
154
|
<td><?php echo $TEXT['ALLOW_MULTIPLE_SELECTIONS']; ?>:</td>
|
155
|
<td>
|
156
|
<input type="radio" name="multiselect" id="multiselect_true" value="multiple" <?php if($form['extra'][1] == 'multiple') { echo ' checked="checked"'; } ?> />
|
157
|
<a href="#" onclick="javascript: document.getElementById('multiselect_true').checked = true;">
|
158
|
<?php echo $TEXT['YES']; ?>
|
159
|
</a>
|
160
|
|
161
|
<input type="radio" name="multiselect" id="multiselect_false" value="" <?php if($form['extra'][1] == '') { echo ' checked="checked"'; } ?> />
|
162
|
<a href="#" onclick="javascript: document.getElementById('multiselect_false').checked = true;">
|
163
|
<?php echo $TEXT['NO']; ?>
|
164
|
</a>
|
165
|
</td>
|
166
|
</tr>
|
167
|
<?php } elseif($type == 'checkbox' OR $type == 'radio') { ?>
|
168
|
<tr>
|
169
|
<td valign="top"><?php echo $TEXT['SEPERATOR']; ?>:</td>
|
170
|
<td>
|
171
|
<input type="text" name="seperator" value="<?php echo $form['extra']; ?>" style="width: 98%;" />
|
172
|
</td>
|
173
|
</tr>
|
174
|
<?php } ?>
|
175
|
<?php } ?>
|
176
|
<?php if($type != 'heading' AND $type != 'none') { ?>
|
177
|
<tr>
|
178
|
<td><?php echo $TEXT['REQUIRED']; ?>:</td>
|
179
|
<td>
|
180
|
<input type="radio" name="required" id="required_true" value="1" <?php if($form['required'] == 1) { echo ' checked="checked"'; } ?> />
|
181
|
<a href="#" onclick="javascript: document.getElementById('required_true').checked = true;">
|
182
|
<?php echo $TEXT['YES']; ?>
|
183
|
</a>
|
184
|
|
185
|
<input type="radio" name="required" id="required_false" value="0" <?php if($form['required'] == 0) { echo ' checked="checked"'; } ?> />
|
186
|
<a href="#" onclick="javascript: document.getElementById('required_false').checked = true;">
|
187
|
<?php echo $TEXT['NO']; ?>
|
188
|
</a>
|
189
|
</td>
|
190
|
</tr>
|
191
|
<?php } ?>
|
192
|
</table>
|
193
|
|
194
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
195
|
<tr>
|
196
|
<td align="left">
|
197
|
<input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
|
198
|
</td>
|
199
|
<?php
|
200
|
// added by John Maats, PCWacht, 12 januar 2006
|
201
|
if ($type<>'none') {
|
202
|
?>
|
203
|
<td align="center">
|
204
|
<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; ?>§ion_id=<?php echo $section_id; ?>';" style="width: 200px; margin-top: 5px;" />
|
205
|
</td>
|
206
|
<?php }
|
207
|
// end addition
|
208
|
?>
|
209
|
<td align="right">
|
210
|
<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;" />
|
211
|
</td>
|
212
|
</tr>
|
213
|
</table>
|
214
|
</form>
|
215
|
<?php
|
216
|
|
217
|
// Print admin footer
|
218
|
$admin->print_footer();
|