<? global $vis_language;

	if($operation['vis_analysis_type']=='buildplan'){
		$label = $vis_language['TXTNOBUILDPLAN'];
		$desc = $releases_details['buildplan'];
		$release_attachments = $releases_details['buildplan_attachment'];
	}
	else if($operation['vis_analysis_type']=='testplan'){
		$label = $vis_language['TXTNOTESTPLAN'];
		$desc = $releases_details['testplan'];
		$release_attachments = $releases_details['testplan_attachment'];
	}
?>
		
<form class="form-horizontal" method="post" enctype="multipart/form-data" name="vis_release_analysis_edit" id="vis_release_analysis_edit_<? echo $releases_details['release_id']; ?>">
	<div class="form-group">
		<div class="col-sm-12">
			<textarea name="vis_release_plan_desc" id="vis_release_plan_desc" class="form-control"><? echo $desc; ?></textarea>
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-12">
			<input type="file" name="files[]" multiple="multiple" onchange="$(this).visExecution('upload_file', {'vis_static_area':'#vis_csve_attachments', 'vis_form':'vis_release_analysis_edit_<? echo $releases_details['release_id']; ?>', 'vis_form_attachment_area':'#vis_attachments'})" class="filestyle" data-input="false" data-icon="true" data-iconName="vh-chat" data-classButton="btn btn-link link" data-buttonText="<?=$vis_language['TXTATTACHFILE']?>" data-badge="true"/><input type="hidden" name="vis_location" value="<? echo VIS_DOMAIN; ?>" />
			<input type="hidden" name="vis_attachments" id="vis_attachments" value="<?=$release_attachments?>" />
			<div id="vis_csve_attachments">
			<?php
				if($attachments!=-1) {
					for($j=0;$j<count($attachments);$j++){
			?>
				<div class="btn-group wrapper-xxs">
					<span class="btn btn-xs alert-success"><?php echo $attachments[$j]['file_name'];?></span>
					<button onclick="$(this).parent().remove(); $(this).visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'remove_attachment', 'vis_attachment_id':<?php echo $attachments[$j]['attachment_id'];?>});vis_remove_attachment(<?php echo $attachments[$j]['attachment_id'];?>,'vis_attachments');" data-dismiss="alert" type="button" class="btn btn-xs alert-success"><i class="vh vh-cross"></i></button>
				</div>
			<?php }}?>
			</div>
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-12">		    
			<input name="vis_release_id" type="hidden" value="<? echo $releases_details['release_id']; ?>" />
			<span class="btn btn-default" onclick="$('#vis_release_analysis_show_<? echo $releases_details['release_id']; ?>').hide();$('#vis_release_analysis_show_<? echo $releases_details['release_id']; ?>').html('');"><? echo $vis_language['TXTDISCARD']; ?></span>
			<span class="btn btn-primary m-l-xs" onclick="$(this).visExecution('submit_form',{'vis_module':'releases', 'vis_operation':'update_release_analysis', 'vis_form':'vis_release_analysis_edit_<? echo $releases_details['release_id']; ?>', 'vis_analysis_type' : '<?php echo $operation['vis_analysis_type'];?>'});"><? echo $vis_language['TXTSAVE']; ?></span>
        </div>
    </div>
</form>
<script src="<?= VIS_PATH_SCRIPT; ?>file-input/bootstrap-filestyle.min.js"></script>
<script type="text/javascript">
	$(document).ready(function () {
		$(":file").filestyle({input: false});
	});
	<? if(!defined('VIS_HTML_EDITOR') || VIS_HTML_EDITOR==1) { ?>    
		$(function(){
			$('#vis_release_plan_desc').redactor({
				buttonSource: true,
				minHeight: 100, // pixels
				maxHeight: 100,
				imageUpload: "index.php?vis_tmpst="+new Date().getTime()+"&vis_module=ticket&vis_operation=upload_file&vis_static_area=editor_image_upload",
                imageUploadParam: 'files',
				focus: true,
				plugins: ['source'],
                deniedTags: ['html', 'head', 'link', 'body', 'meta', 'script','applet']
			});
		});
	<? } ?>
	function vis_remove_attachment(ticket_id, attach_location){
		var loc = '';
		loc = (attach_location != "" && typeof(attach_location) != "undefined") ? attach_location : "vis_image_attachments";
		$("#" + loc).val( $("#" + loc).val().replace(ticket_id + ',', '') );
	}
</script>
