<commit_before><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %>
<%@ taglib uri="http://sakaiproject.org/jsf/syllabus" prefix="syllabus" %>
<% response.setContentType("text/html; charset=UTF-8"); %>
<f:view>
<jsp:useBean id="msgs" class="org.sakaiproject.util.ResourceLoader" scope="session">
   <jsp:setProperty name="msgs" property="baseName" value="org.sakaiproject.tool.syllabus.bundle.Messages"/>
</jsp:useBean>
	<sakai:view_container title="#{msgs.title_list}">
	<sakai:view_content>

<script type="text/javascript" src="/library/js/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/library/js/jquery/ui/1.10.3/jquery-ui.1.10.3.full.min.js"></script>
<link rel="stylesheet" href="/library/js/jquery/ui/1.10.3/css/ui-lightness/jquery-ui-1.10.3.custom.min.css" type="text/css" />
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="js/syllabus.js"></script>
<link type="text/css" href="syllabus/css/syllabus.css" rel="stylesheet" media="screen" />
<script type="text/javascript">
  var startDateValues = new Array();
  var dateFormat = '<h:outputText value="#{msgs.jqueryDatePickerDateFormat}"/>';
  var timeFormat = '<h:outputText value="#{msgs.jqueryDatePickerTimeFormat}"/>';
  var dataChanged = false;
  $(function() {
    $('.dateInput').datetimepicker({
    	hour: 8,
		timeFormat: timeFormat,
		currentText: "<h:outputText value="#{msgs.now}"/>",
		closeText: "<h:outputText value="#{msgs.done}"/>",
		amNames: ['<h:outputText value="#{msgs.am}"/>', '<h:outputText value="#{msgs.am2}"/>'],
		pmNames: ['<h:outputText value="#{msgs.pm}"/>', '<h:outputText value="#{msgs.pm2}"/>'],
		timeText: "<h:outputText value="#{msgs.time}"/>",
		hourText: "<h:outputText value="#{msgs.hour}"/>",
		minuteText: "<h:outputText value="#{msgs.minute}"/>",
		monthNames: ["<h:outputText value="#{msgs.jan}"/>",
					  "<h:outputText value="#{msgs.feb}"/>",
					  "<h:outputText value="#{msgs.mar}"/>",
					  "<h:outputText value="#{msgs.apr}"/>",
					  "<h:outputText value="#{msgs.may}"/>",
					  "<h:outputText value="#{msgs.jun}"/>",
					  "<h:outputText value="#{msgs.jul}"/>",
					  "<h:outputText value="#{msgs.aug}"/>",
					  "<h:outputText value="#{msgs.sep}"/>",
					  "<h:outputText value="#{msgs.oct}"/>",
					  "<h:outputText value="#{msgs.nov}"/>",
					  "<h:outputText value="#{msgs.dec}"/>"],
		dayNames: ["<h:outputText value="#{msgs.sunday}"/>",
							"<h:outputText value="#{msgs.monday}"/>",
							"<h:outputText value="#{msgs.tuesday}"/>",
							"<h:outputText value="#{msgs.wednesday}"/>",
							"<h:outputText value="#{msgs.thursday}"/>",
							"<h:outputText value="#{msgs.friday}"/>",
							"<h:outputText value="#{msgs.saturday}"/>"],
		dayNamesMin: ["<h:outputText value="#{msgs.sun}"/>",
							"<h:outputText value="#{msgs.mon}"/>",
							"<h:outputText value="#{msgs.tue}"/>",
							"<h:outputText value="#{msgs.wed}"/>",
							"<h:outputText value="#{msgs.thu}"/>",
							"<h:outputText value="#{msgs.fri}"/>",
							"<h:outputText value="#{msgs.sat}"/>"],
		beforeShow: function (textbox, instance) {
			            instance.dpDiv.css({
			                    marginLeft: textbox.offsetWidth + 'px'
			          });
		
	}
	});
  
  
  	
  	//Setup the current values of the start dates (to compare and adjust the end dates when changed)
  	$(".dateInputStart").each(function(){
		startDateValues[$(this).attr('id')] = $(this).val();
  	});
  	//setup onchange event for startDate changes
  	$(".dateInputStart").change(function(){
  		var startDate = new Date($(this).val());
  		var prevStartDate = new Date(startDateValues[$(this).attr('id')]);
  		var endDate = new Date($(this).closest("tr").find(".dateInputEnd").val());
  		if(isNaN(startDate.getTime()) == false && isNaN(prevStartDate.getTime()) == false && isNaN(endDate.getTime()) == false){
  			//we only want to update if all three of these dates have been set
  			var timeDiff = startDate.getTime() - prevStartDate.getTime();
  			var newEndDate = new Date(endDate.getTime() + timeDiff);
  			var newEndTime = {hour: newEndDate.getHours(), minute: newEndDate.getMinutes()};
  			$(this).closest("tr").find(".dateInputEnd").val($.datepicker.formatDate(dateFormat, newEndDate) + " " + $.datepicker.formatTime(timeFormat, newEndTime));
  		}
  		startDateValues[$(this).attr('id')] = $(this).val();
  	});
  	
  	//setup data change listener
  	$('input').change(function() {
    	dataChanged = true;
	});
  	
  	//disable calendar options that are in draft:
  	disableCalendarOptions();
  	//add listeners to the calendar dates for the calendar checkbox:
  	$(".dateInputStart").change(function(){
  		checkCalendarDates(this);
  	});
  	$(".dateInputEnd").change(function(){
  		checkCalendarDates(this);
  	});
  	
  });
  
	function toggleCalendarCheckbox(postCheckbox){
		$(postCheckbox).parent().parent().find(".calendarBox").each(function(){
			if(postCheckbox.checked){
				$(this).removeAttr("disabled");
			}else{
				$(this).attr("disabled", "disabled");
				this.checked = false;
			}
		});
	}
	
	function checkStartEndDates(calendarCheckbox){
		if(calendarCheckbox.checked){
			//check that this rows has either start or end dates set
			var startTime = $(calendarCheckbox).parent().parent().find(".dateInputStart").val();
			var endTime = $(calendarCheckbox).parent().parent().find(".dateInputEnd").val();
			if((startTime == null || "" == $.trim(startTime))
					&& (endTime == null || "" == $.trim(endTime))){
				showMessage("<h:outputText value="#{msgs.calendarDatesNeeded}"/>", false);
				calendarCheckbox.checked = false;
			}
		}
	}
	
	var deleteClick;
            
	function assignWarningClick(link) {
  		if (link.onclick == confirmPost) {
    		return;
  		}
                
  		deleteClick = link.onclick;
  		link.onclick = confirmPost;
	}

	function confirmPost(){
		if(dataChanged){
			var agree=confirm('<h:outputText value="#{msgs.main_edit_confirmDataChanged}"/>');
			if (agree)
				return deleteClick();
			else
				return false ;
		}else{
			return deleteClick();
		}
	}
	
	function toggleAllCalendarOptions(toggleCheckbox){
		$('.calendarBox').each(function(){
			if(toggleCheckbox.checked){
				//make sure that the post option is checked otherwise don't check it as well as the start or end date isn't null
				var startTime = $(this).parent().parent().find(".dateInputStart").val();
				var endTime = $(this).parent().parent().find(".dateInputEnd").val();
				if((startTime != null && "" != $.trim(startTime)) || (endTime != null && "" != $.trim(endTime))){
					//at least one date is set, now check if the item is posted
					if($(this).parent().parent().find(".postBox:checked").length == 1){
						this.checked = true;
					}
				}
			}else{
				this.checked = false;
			}
		});
	}

	function toggleAllPostOptions(toggleCheckbox){
		$('.postBox').each(function(){
			if(toggleCheckbox.checked){
				this.checked = true;
			}else{
				this.checked = false;
				//make sure calendar option is unchecked
				$(this).parent().parent().find(".calendarBox").removeAttr("checked");
			}
		});
	}
	
	function disableCalendarOptions(){
		$('.calendarBox').each(function(){
			if($(this).parent().parent().find(".postBox:checked").length == 0){
				$(this).attr("disabled", "disabled");
			}
		});<commit_msg>SAK-26249 Syllabus: Calendar setting doesn't take the first time you save<commit_after><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://sakaiproject.org/jsf/sakai" prefix="sakai" %>
<%@ taglib uri="http://sakaiproject.org/jsf/syllabus" prefix="syllabus" %>
<% response.setContentType("text/html; charset=UTF-8"); %>
<f:view>
<jsp:useBean id="msgs" class="org.sakaiproject.util.ResourceLoader" scope="session">
   <jsp:setProperty name="msgs" property="baseName" value="org.sakaiproject.tool.syllabus.bundle.Messages"/>
</jsp:useBean>
	<sakai:view_container title="#{msgs.title_list}">
	<sakai:view_content>

<script type="text/javascript" src="/library/js/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/library/js/jquery/ui/1.10.3/jquery-ui.1.10.3.full.min.js"></script>
<link rel="stylesheet" href="/library/js/jquery/ui/1.10.3/css/ui-lightness/jquery-ui-1.10.3.custom.min.css" type="text/css" />
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="js/syllabus.js"></script>
<link type="text/css" href="syllabus/css/syllabus.css" rel="stylesheet" media="screen" />
<script type="text/javascript">
  var startDateValues = new Array();
  var dateFormat = '<h:outputText value="#{msgs.jqueryDatePickerDateFormat}"/>';
  var timeFormat = '<h:outputText value="#{msgs.jqueryDatePickerTimeFormat}"/>';
  var dataChanged = false;
  $(function() {
    $('.dateInput').datetimepicker({
    	hour: 8,
		timeFormat: timeFormat,
		currentText: "<h:outputText value="#{msgs.now}"/>",
		closeText: "<h:outputText value="#{msgs.done}"/>",
		amNames: ['<h:outputText value="#{msgs.am}"/>', '<h:outputText value="#{msgs.am2}"/>'],
		pmNames: ['<h:outputText value="#{msgs.pm}"/>', '<h:outputText value="#{msgs.pm2}"/>'],
		timeText: "<h:outputText value="#{msgs.time}"/>",
		hourText: "<h:outputText value="#{msgs.hour}"/>",
		minuteText: "<h:outputText value="#{msgs.minute}"/>",
		monthNames: ["<h:outputText value="#{msgs.jan}"/>",
					  "<h:outputText value="#{msgs.feb}"/>",
					  "<h:outputText value="#{msgs.mar}"/>",
					  "<h:outputText value="#{msgs.apr}"/>",
					  "<h:outputText value="#{msgs.may}"/>",
					  "<h:outputText value="#{msgs.jun}"/>",
					  "<h:outputText value="#{msgs.jul}"/>",
					  "<h:outputText value="#{msgs.aug}"/>",
					  "<h:outputText value="#{msgs.sep}"/>",
					  "<h:outputText value="#{msgs.oct}"/>",
					  "<h:outputText value="#{msgs.nov}"/>",
					  "<h:outputText value="#{msgs.dec}"/>"],
		dayNames: ["<h:outputText value="#{msgs.sunday}"/>",
							"<h:outputText value="#{msgs.monday}"/>",
							"<h:outputText value="#{msgs.tuesday}"/>",
							"<h:outputText value="#{msgs.wednesday}"/>",
							"<h:outputText value="#{msgs.thursday}"/>",
							"<h:outputText value="#{msgs.friday}"/>",
							"<h:outputText value="#{msgs.saturday}"/>"],
		dayNamesMin: ["<h:outputText value="#{msgs.sun}"/>",
							"<h:outputText value="#{msgs.mon}"/>",
							"<h:outputText value="#{msgs.tue}"/>",
							"<h:outputText value="#{msgs.wed}"/>",
							"<h:outputText value="#{msgs.thu}"/>",
							"<h:outputText value="#{msgs.fri}"/>",
							"<h:outputText value="#{msgs.sat}"/>"],
		beforeShow: function (textbox, instance) {
			            instance.dpDiv.css({
			                    marginLeft: textbox.offsetWidth + 'px'
			          });
		
	}
	});
  
  
  	
  	//Setup the current values of the start dates (to compare and adjust the end dates when changed)
  	$(".dateInputStart").each(function(){
		startDateValues[$(this).attr('id')] = $(this).val();
  	});
  	//setup onchange event for startDate changes
  	$(".dateInputStart").change(function(){
  		var startDate = new Date($(this).val());
  		var prevStartDate = new Date(startDateValues[$(this).attr('id')]);
  		var endDate = new Date($(this).closest("tr").find(".dateInputEnd").val());
  		if(isNaN(startDate.getTime()) == false && isNaN(prevStartDate.getTime()) == false && isNaN(endDate.getTime()) == false){
  			//we only want to update if all three of these dates have been set
  			var timeDiff = startDate.getTime() - prevStartDate.getTime();
  			var newEndDate = new Date(endDate.getTime() + timeDiff);
  			var newEndTime = {hour: newEndDate.getHours(), minute: newEndDate.getMinutes()};
  			$(this).closest("tr").find(".dateInputEnd").val($.datepicker.formatDate(dateFormat, newEndDate) + " " + $.datepicker.formatTime(timeFormat, newEndTime));
  		}
  		startDateValues[$(this).attr('id')] = $(this).val();
  	});
  	
  	//setup data change listener
  	$('input').change(function() {
    	dataChanged = true;
	});
  	
  	//disable calendar options that are in draft:
  	disableCalendarOptions();
  	//add listeners to the calendar dates for the calendar checkbox:
  	$(".dateInputStart").change(function(){
  		checkCalendarDates(this);
  	});
  	$(".dateInputEnd").change(function(){
  		checkCalendarDates(this);
  	});
  	
  });
  
	function toggleCalendarCheckbox(postCheckbox){
		$(postCheckbox).parent().parent().find(".calendarBox").each(function(){
			if(postCheckbox.checked){
				$(this).removeAttr("disabled");
			}else{
				$(this).attr("disabled", "disabled");
				this.checked = false;
			}
		});
	}
	
	function checkStartEndDates(calendarCheckbox){
		if(calendarCheckbox.checked){
			//check that this rows has either start or end dates set
			var startTime = $(calendarCheckbox).parent().parent().find(".dateInputStart").val();
			var endTime = $(calendarCheckbox).parent().parent().find(".dateInputEnd").val();
			if((startTime == null || "" == $.trim(startTime))
					&& (endTime == null || "" == $.trim(endTime))){
				showMessage("<h:outputText value="#{msgs.calendarDatesNeeded}"/>", false);
				calendarCheckbox.checked = false;
			}
		}
	}
	
	var deleteClick;
            
	function assignWarningClick(link) {
  		if (link.onclick == confirmPost) {
    		return;
  		}
                
  		deleteClick = link.onclick;
  		link.onclick = confirmPost;
	}

	function confirmPost(){
		if(dataChanged){
			var agree=confirm('<h:outputText value="#{msgs.main_edit_confirmDataChanged}"/>');
			if (agree)
				return deleteClick();
			else
				return false ;
		}else{
			return deleteClick();
		}
	}
	
	function toggleAllCalendarOptions(toggleCheckbox){
		$('.calendarBox').each(function(){
			if(toggleCheckbox.checked){
				//make sure that the post option is checked otherwise don't check it as well as the start or end date isn't null
				var startTime = $(this).parent().parent().find(".dateInputStart").val();
				var endTime = $(this).parent().parent().find(".dateInputEnd").val();
				if((startTime != null && "" != $.trim(startTime)) || (endTime != null && "" != $.trim(endTime))){
					//at least one date is set, now check if the item is posted
					if($(this).parent().parent().find(".postBox:checked").length == 1){
						this.checked = true;
					}
				}
			}else{
				this.checked = false;
			}
		});
	}

	function toggleAllPostOptions(toggleCheckbox){
		$('.postBox').each(function(){
			if(toggleCheckbox.checked){
				this.checked = true;
			}else{
				this.checked = false;
				//make sure calendar option is unchecked
				$(this).parent().parent().find(".calendarBox").removeAttr("checked");
			}
			toggleCalendarCheckbox(this);
		});
	}
	
	function disableCalendarOptions(){
		$('.calendarBox').each(function(){
			if($(this).parent().parent().find(".postBox:checked").length == 0){
				$(this).attr("disabled", "disabled");
			}
		});
{'fraction_non_alphanumeric': 0.21197421755598378, 'fraction_numerical': 0.003654727888896272, 'mean_word_length': 4.016666666666667, 'pattern_counts': {'":': 0, '<': 125, '<?xml version=': 0, '>': 125, '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': '2010488', 'n_tokens_mistral': 5760, 'n_tokens_neox': 5124, 'n_words': 849}