///////// **************** FORM TEMPLATES FILES **************** /////////
/*
We have are given two variables:
- $type : The type of line to display
- $details : The details for the line such as the name, value etc.
To simplfy writing we set these to $t and $d
We can call a line with the function s(type,details,extra_information).
*/
function write_default_fields($type,$details,$extra){
$t = $type;
$d = $details;
$e = $extra;
///////// **************** ******************** **************** /////////
///////// **************** FORM HEADER AND FOOTER **************** /////////
if($t == "header") { ?>
}
///////// **************** STANDARD ITEMS **************** /////////
if($t == "general_messages") { ?>
s("general_message"); ?>
s("general_warning"); ?>
s("general_error"); ?>
}
if($t == "general_error") { ?>
if($d['general_error']){ ?>
=$d['general_error']?>
} ?>
}
if($t == "general_warning") { ?>
if($d['general_warning']){ ?>
=$d['general_warning']?>
} ?>
}
if($t == "general_message") { ?>
if($d['general_message']){ ?>
=$d['general_message']?>
} ?>
}
if($t == "custom_message") { ?>
if($d['message']){ ?>=$d['message']?>
} ?>
}
if($t == "error_line") { ?>
=$d['error_text']?>
}
if($t == "pre_line") { ?>
if($d['multiple_start']){ ?> } ?>
class="=$d['error']?"error ":""?>=$d['class']?>" } ?> id="group_=$d['input_id']?>" >
}
if($t == "post_line") { ?>
if($d['multiple_end']){ ?>
} ?>
}
if($t == "main_error") { ?>
There were errors on the form.
}
if($t == "or") { ?>
and / or*
}
if($t == "required") { ?> if($d['required'] && $d['required'] !== "or" && $d['required'] !== "ignore"){?>* } ?> }
if($t == "h2") { ?>
s("pre_line"); ?>
=$d['title']?>
s("post_line"); ?>
}
if($t == "h3") { ?>
s("pre_line"); ?>
=$d['title']?>
s("post_line"); ?>
}
if($t == "p") { ?>
=$d['title']?>
if($d['information']){ ?>=$d['information']?> } ?>
}
if($t == "long") { ?>
=$d['title']?>
}
///////// **************** INPUT FIELDS **************** /////////
if($t == "label") { ?>
=$d['title']?> s("required");?> if($d['information']){ ?>=$d['information']?> } ?>
}
if($t == "input") { ?>
maxlength="=$d['maxlength']?>" } ?>/>
}
if($t == "item") { ?>
s("pre_line"); ?>
s("label"); ?>
s("error_line"); ?>
s("input"); ?>
s("post_line"); ?>
}
if($t == "text") { ?>
s("item"); ?>
}
if($t == "password") {
s("item");
}
if($t == "hidden") { ?>
}
if($t == "textarea") { ?>
s("pre_line"); ?>
s("label"); ?>
s("javascript"); ?>
s("post_line"); ?>
}
if($t == "wysiwyg") { ?>
s("pre_line"); ?>
s("label"); ?>
$s = $d['settings']; ?>
s("post_line"); ?>
}
if($t == "select") { ?>
s("pre_line"); ?>
s("label"); ?>
onchange="=$e['javascript']?>" } ?> if($d['j-data']){ ?>j-data="=$d['j-data']?>" } ?>>
if(J::fe($d['options'])) foreach($d['options'] as $o) s("option",$o,$d); ?>
if(J::fe($d['option_groups'])) foreach($d['option_groups'] as $o) s("option_group",$o,$d); ?>
s("post_line"); ?>
}
if($t == "option") { ?>
selected="selected" } ?> if($d['j-data']){ ?>j-data="=$d['j-data']?>" } ?>>=$d['title']?>
}
if($t == "option_group") { ?>
foreach($d['options'] as $o) s("option",$o,$d); ?>
}
if($t == "checkboxes") { ?>
s("pre_line"); ?>
=$d['title']?> s("required");?>
if($d['information']){ ?>=$d['information']?> } ?>
foreach($d['options'] as $i=>$o){ $o['i'] = $i; s("single_checkbox",$o,$d); } ?>
if($d['reorder']) s("reorder_javascript",$d); ?>
s("post_line"); ?>
}
if($t == "single_checkbox") { ?>
class="contact_first" } ?>>
" name="=$e['name']?>[]" type="checkbox" class="input_checkbox" value="=$d['name']?>" if($e['values'][$d['name']]){ ?>checked="checked" } ?> />
">=$d['title']?>
}
if($t == "reorder_javascript") { ?>
}
if($t == "radios") { ?>
s("pre_line"); ?>
=$d['title']?> s("required");?>
foreach($d['options'] as $i=>$o){ $o['i'] = $i; s("single_radio",$o,$d); } ?>
s("post_line"); ?>
}
if($t == "single_radio") { ?>
class="contact_first" } ?>>
checked="checked" } ?> />
=$d['title']?>
}
if($t == "checkbox") { ?>
s("pre_line"); ?>
checked="checked" } ?>/>
s("label"); ?>
s("post_line"); ?>
}
if($t == "image") { ?>
s("pre_line"); ?>
s("label"); ?>
s("post_line"); ?>
}
if($t == "submit") { ?>
s("pre_line"); ?>
if($d['javascript']){ ?>
=$d['title']?>
}else{ ?>
} ?>
s("post_line"); ?>
}
if($t == "image_verification") { ?>
s("pre_line"); ?>
s("label"); ?>
s("post_line"); ?>
}
///////// **************** JAVASCRIPT **************** /////////
if($t == "multiple") { ?>
}
}
///////// **************** END **************** /////////