<? global $vis_language;
?> 
<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-header">
       <button type="button" class="close" data-dismiss="modal" onclick="$(this).visExecution('submit_form',{'vis_module':'selfhelp', 'vis_operation':'delete_drive', 'vis_form':'vis_new_drive_form','vis_access':$('#vis_access').val(),'drive_id':$('#vis_attachments').val()})" >&times;</button>
     <h4 class="modal-title"><? echo "Upload File"; ?></h4>
    </div>
    <div class="modal-body">
		<form action="index.php" method="post" target="vis_hidden_frame" enctype="multipart/form-data" name="vis_new_drive_form" id="vis_new_drive_form" class="form-horizontal">
	<div class="row">
		
		<div class="form-group">
			  <label class="col-sm-3 control-label"><? echo $vis_language['TXTACCESS']; ?></label>
				   <div class="col-sm-9">
       <div class="col-sm-8">
					  <select name="vis_access" class="form-control input-sm selectpicker" >
					
					<option value="0" selected="selected"><? echo $vis_language['TXTPUBLIC']; ?></option>
					<option value="1" ><? echo $vis_language['TXTPRIVATE']; ?></option>
					
						</select>
      </div>
				   </div>
        </div>
        
        <div class="form-group">
       
			<label class="col-sm-3 control-label"><? echo $vis_language['TXTATTACHEDMEDIA']; ?></label>
			<div class="col-sm-9" style="padding-left:20px;">
<input type="file" name="files" multiple="multiple" class="filestyle" data-icon="false" data-classButton="btn btn-link link" data-buttonText="<? echo "Upload File"; ?>" data-input="false" onchange="$(this).visExecution('upload_file', {'vis_static_area':'#vis_drive_attachments', 'vis_form':'vis_new_drive_form', 'vis_form_attachment_area':'#vis_attachments','vis_action':'index.php?vis_module=selfhelp&vis_operation=upload_drive_file'});$('#add_link').attr('disabled','disabled');" style="display:none">							
						<input type="hidden" name="vis_location" value="<? echo VIS_DOMAIN; ?>" />
						<input type="hidden" name="vis_attachments" id="vis_attachments" value="" />
			
			</div>
        
           <div id="attachedMedia">
		  <div class="line line-dashed b-b line-lg pull-in"></div>
		  <div class="form-group">
			<label class="col-sm-3 control-label" for="HomeAddress"></label>
			<div class="col-sm-9">		
   <div class="col-sm-12">					
			  <div id="vis_drive_attachments">
					
			  </div>
     </div>
			</div>
		  </div>
        </div> 
        <input type="hidden" id="vis_attachment_count" name="vis_attachment_count" value="0">
	</div>	
	
    <div class="modal-footer">	
		<a class="btn btn-default" data-dismiss="modal" onclick="$(this).visExecution('submit_form',{'vis_module':'selfhelp', 'vis_operation':'delete_drive', 'vis_form':'vis_new_drive_form','vis_access':$('#vis_access').val(),'drive_id':$('#vis_attachments').val()})"  > <? echo $vis_language['TXTCANCEL']; ?></a>
		<a class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'selfhelp', 'vis_operation':'add_drive', 'vis_form':'vis_new_drive_form','vis_access':$('#vis_access').val(),'drive_id':$('#vis_attachments').val()})" id="add_link"><? echo $vis_language['TXTADD']; ?></a>    	
	</div>
    <input type="hidden" name="parent_type" value="3">	
		<textarea name="vis_blab_post_hidden" id="vis_blab_post_hidden" class="form-control"  data-minwords="6" rows="2" style="display:none;"></textarea>
  </div><!-- /.modal-content -->
  </form>
</div><!-- /.modal-dialog -->
<script>
//$(document).ready(function(){
	//	$('#attachedMedia').hide();
	//});	

function vis_remove_attachment(attach_id){
	$.ajax({
        url: 'index.php',
        data: {'vis_module':"selfhelp", 'vis_operation':"remove_attachment", 'vis_attachment_id':attach_id },
        type: "POST",
        success: function(data) {  }
    });
    var attachments=$("#vis_attachment_count").val();
	$("#vis_attachment_count").val(eval(parseInt(attachments)-1));
	var attachmentsCnt=$("#vis_attachment_count").val();
	if((attachmentsCnt==0)) $("#attachedMedia").css('display','none');
	}

 $(".selectpicker").selectpicker();
   function toggle_dept_list(){
       if($('#vis_department_all').is(":checked")) $('#vis_dept_list_section').hide();
       else $('#vis_dept_list_section').show();
   }
</script>
<script src="<?= VIS_PATH_SCRIPT; ?>file-input/bootstrap-filestyle.min.js"></script>
