<? $this->load->view( $this->aSystemVar['template_viewer_root'] . 'admin/_header') ?>
	<div class="bigCaption">Edit Custom Filed</div>

		<div id="custom_fields">
            <?= form_open('admin/customfield/save') ?>
			<table cellpadding="5" cellspacing="0" border="0" width="100%" summary="">
				<tr>
					<td class="key">Field category:</td>
					<td class="inputs">
						<select name="CategoryId">
							<?= '<option value="0" ' . ( '0' != $data['CustomField']['CategoryId'] ? '' : 'selected="selected"') . ' />all categories</option>' ?>
							<? foreach ( $data['Category']['CategoryList'] as $aCategory ) : ?>
								<?= '<option value="' . $aCategory['Id'] . '" ' . ( $aCategory['Id'] != $data['CustomField']['CategoryId'] ? '' : 'selected="selected"') . ' />' . $aCategory['Title'] . '</option>' ?>
							<? endforeach ?>
						</select>
					</td>
					<td></td>
				</tr>
				<tr>
					<td class="key">Field id:</td>
					<td class="inputs"><input name="basename" type="text" value="<?=$data['CustomField']['BaseName']?>"></td>
					<td></td>
				</tr>
                <tr>
					<td class="key">Field type:</td>
					<td class="inputs">
						<select name="field_type" onChange="javascript: var vals=document.getElementById('field_values'); if ('radio'==this.value || 'check'==this.value || 'select'==this.value){vals.style.display='block';}else{vals.style.display='none';}">
							<option value="num" <?=('num'==$data['CustomField']['FieldType']?'selected="selected"':'')?>>Numbers</option>
							<option value="tfield" <?=('tfield'==$data['CustomField']['FieldType']?'selected="selected"':'')?>>Single text field</option>
							<option value="textarea" <?=('textarea'==$data['CustomField']['FieldType']?'selected="selected"':'')?>>Textarea</option>
							<option value="radio" <?=('radio'==$data['CustomField']['FieldType']?'selected="selected"':'')?>>Radio buttons</option>
							<option value="check" <?=('check'==$data['CustomField']['FieldType']?'selected="selected"':'')?>>Check buttons</option>
							<option value="select" <?=('select'==$data['CustomField']['FieldType']?'selected="selected"':'')?>>Dropdown box</option>
						</select>
					</td>
					<td></td>
				</tr>
                <tr>
					<td class="key">Display field:</td>
					<td class="inputs">
						<label><input name="display" value="1" <?=(1==$data['CustomField']['Display']?'checked="checked"':'')?> type="radio">Yes</label>
						<label><input name="display" value="0" <?=(0==$data['CustomField']['Display']?'checked="checked"':'')?> type="radio">No</label>
					</td>
					<td></td>
				</tr>
                <tr>
					<td class="key">Field Mode:</td>
					<td class="inputs">
                        <div>
                        	<label>
							<input class="radio" name="mode" value="simple" <?=('simple'==$data['CustomField']['Mode']?'checked="checked"':'')?> type="radio" />
							The user is able to see and change this field.
							</label>
						</div>
						<div>
							<label>
							<input class="radio" name="mode" value="req" <?=('req'==$data['CustomField']['Mode']?'checked="checked"':'')?> type="radio" />
							This is required field.
							</label>
						</div>
						<div>
							<label>
							<input class="radio" name="mode" value="adm" <?=('adm'==$data['CustomField']['Mode']?'checked="checked"':'')?> type="radio" />
							Hidden field: only administrators and moderators are able to see/fill out this field.
							</label>
						</div>
					</td>
					<td></td>
				</tr>
                <tr>
					<td class="key">Field name/title presented to the user:</td>
					<td class="inputs"><input name="title" value="<?=$data['CustomField']['Title']?>" type="text"></td>
					<td></td>
				</tr>
			</table>
            <?
						if ( 'radio' == $data['CustomField']['FieldType']
							|| 'check' == $data['CustomField']['FieldType']
							|| 'select' == $data['CustomField']['FieldType'] )
							$sDisplay = 'block';
						else
							$sDisplay = 'none';
					?>

					<div id="field_values" style="display:<?=$sDisplay?>;margin:10px;padding:5px;">
						<b>Values:</b>
						<br />
						<i>
						Set of values should be separated by newline. ( press "enter" after each value ;-)
						</i>
						<br />
						<textarea name="values" rows="5" cols="80"><?=$data['CustomField']['Values']?></textarea>
					</div>
            <div class="submit" style="text-align:left;">
                <input name="fieldId" type="hidden" value="<?=$data['CustomField']['Id']?>">
				<input name="lang" type="hidden" value="<?=$data['Lang']?>">
				<input type="submit" name="go" value="go" />
			</div>
			<?= form_close() ?>
		</div>

<? $this->load->view( $this->aSystemVar['template_viewer_root'] . 'admin/_footer') ?>