<commit_before><?

class frontend {
	public static function makeHtmlElement($element, $prefix, $indent=''){

		$field = $element->getAttribute('field');

		switch($element->nodeName){
		case 'list':
			$family = $element->getAttribute('family');
			$addables = mop::config('objects', 'addableObject', $element);		
			$addable = $addables->item(0);
			$templateName = $addable->getAttribute('templateName');
			$listItemElements = mop::config('objects', sprintf('//template[@name="%s"]/elements/*', $templateName));		
			echo $indent."<ul id=\"$family\" >\n";
			echo $indent."<?foreach({$prefix}['$family'] as \$label => \${$family}ListItem):?>\n";
			echo $indent." <li class=\"$templateName\">\n";
			foreach($listItemElements as $element){
				frontend::makeHtmlElement($element, "\${$family}ListItem", $indent.'  ');
			}
			echo $indent." </li>\n";
			echo $indent."<?endforeach;?>\n";
			echo $indent."</ul>\n\n";
			break;

		case 'image':
			if(!($size=$element->getAttribute('size'))){
				$size = 'original';	
			}
			echo $indent."<?if(is_object({$prefix}['$field'])):?>\n";
			echo $indent." <img id=\"$field\" src=\"<?={$prefix}['$field']->{$size}->fullpath;?>\" width=\"<?={$prefix}['$field']->{$size}->width;?>\" height=\"<?={$prefix}['$field']->{$size}->height;?>\" alt=\"<?={$prefix}['$field']->{$size}->filename;?>\" />\n";
			echo $indent."<?endif;?>\n\n";
			break;
		case 'file':
			echo $indent."<?if(is_object({$prefix}['$field'])):?>\n";
			echo $indent."<a href=\"<?={$prefix}['$field']->fullpath;?>\"><?={$prefix}['$field']->filename;?></a>\n\n";
			echo $indent."<?endif;?>\n\n";
			break;
		case 'checkbox':
			echo $indent."<div type=\"checkboxResult\">\n";
			echo $indent." <label>".$element->getAttribute('label')."</label>\n";
			echo $indent." <input type=\"checkbox\" name=\"".$element->getAttribute('field')."\" ".
				"<?echo ({$prefix}['$field'])?'checked ':'';?> disabled>\n";
			echo $indent."</div>\n\n";
			break;
		default:
			echo $indent."<p class=\"$field\"> <?={$prefix}['$field'];?></p>\n\n";
			break;<commit_msg>modules: frontend gen of checkbox now correct<commit_after><?

class frontend {
	public static function makeHtmlElement($element, $prefix, $indent=''){

		$field = $element->getAttribute('field');

		switch($element->nodeName){
		case 'list':
			$family = $element->getAttribute('family');
			$addables = mop::config('objects', 'addableObject', $element);		
			$addable = $addables->item(0);
			$templateName = $addable->getAttribute('templateName');
			$listItemElements = mop::config('objects', sprintf('//template[@name="%s"]/elements/*', $templateName));		
			echo $indent."<ul id=\"$family\" >\n";
			echo $indent."<?foreach({$prefix}['$family'] as \$label => \${$family}ListItem):?>\n";
			echo $indent." <li class=\"$templateName\">\n";
			foreach($listItemElements as $element){
				frontend::makeHtmlElement($element, "\${$family}ListItem", $indent.'  ');
			}
			echo $indent." </li>\n";
			echo $indent."<?endforeach;?>\n";
			echo $indent."</ul>\n\n";
			break;

		case 'image':
			if(!($size=$element->getAttribute('size'))){
				$size = 'original';	
			}
			echo $indent."<?if(is_object({$prefix}['$field'])):?>\n";
			echo $indent." <img id=\"$field\" src=\"<?={$prefix}['$field']->{$size}->fullpath;?>\" width=\"<?={$prefix}['$field']->{$size}->width;?>\" height=\"<?={$prefix}['$field']->{$size}->height;?>\" alt=\"<?={$prefix}['$field']->{$size}->filename;?>\" />\n";
			echo $indent."<?endif;?>\n\n";
			break;
		case 'file':
			echo $indent."<?if(is_object({$prefix}['$field'])):?>\n";
			echo $indent."<a href=\"<?={$prefix}['$field']->fullpath;?>\"><?={$prefix}['$field']->filename;?></a>\n\n";
			echo $indent."<?endif;?>\n\n";
			break;
		case 'checkbox':
			echo $indent."<div type=\"checkboxResult\">\n";
			echo $indent." <label>".$element->getAttribute('label')."</label>\n";
			echo $indent." <input type=\"checkbox\" name=\"".$element->getAttribute('field')."\" ".
				"<?echo ({$prefix}['$field'])?'checked=\"true\" ':'';?> disabled=\"disabled\" >\n";
			echo $indent."</div>\n\n";
			break;
		default:
			echo $indent."<p class=\"$field\"> <?={$prefix}['$field'];?></p>\n\n";
			break;
{'fraction_non_alphanumeric': 0.3007896625987078, 'fraction_numerical': 0.0004785833931562575, 'mean_word_length': 4.805555555555555, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '652324', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1476, 'n_words': 224}