Created
November 17, 2011 17:29
-
-
Save steve-ayerhart/1373831 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function events_management_js() { | |
?> | |
<script type="text/javascript"> | |
var date_time_counter = 0; | |
function event_add_date_time_form_fields(date, hour, minute, meridiem, type) { | |
dt_id = "date-time-" + date_time_counter; | |
dt_name = "date_times[" + date_time_counter + "]"; | |
html = ''; | |
html += '<div id="'+dt_id+'" class="date-time">'; | |
html += '<a class="remove-event-link" href="#" onclick="$(\'#'+dt_id+'\').remove(); return false;" title="Remove"><img src="/cms/admin/images/icon-delete.png" alt="Delete" /></a> '; | |
html += '<input id="'+dt_id+'-date" class="date-time-date" type="text" size="15" name="'+dt_name+'[date]" value="'+date+'" />'; | |
html += ' @ '; | |
html += '<span id="'+dt_id+'-time" '+( (type != 'Normal') ? 'style="display:none"' : '' )+'>'; | |
html += '<input type="text" name="'+dt_name+'[hour]" size="2" value="'+hour+'" />'; | |
html += ':'; | |
html += '<input type="text" name="'+dt_name+'[minute]" size="2" value="'+minute+'" />'; | |
html += '<select name="'+dt_name+'[meridiem]">'; | |
html += '<option value="am" '+( (meridiem == 'am') ? 'selected="selected"' : '' )+'>am</option>'; | |
html += '<option value="pm" '+( (meridiem == 'pm') ? 'selected="selected"' : '' )+'>pm</option>'; | |
html += '</select>'; | |
html += ' or '; | |
html += '<a href="#" onclick="$(\'#'+dt_id+'-type\').val(\'All day\'); $(\'#'+dt_id+'-time\').hide(); $(\'#'+dt_id+'-type-all-day\').show(); $(\'#'+dt_id+'-type-no-time\').hide(); return false;">all day event</a>'; | |
html += ' or '; | |
html += '<a href="#" onclick="$(\'#'+dt_id+'-type\').val(\'No time\'); $(\'#'+dt_id+'-time\').hide(); $(\'#'+dt_id+'-type-all-day\').hide(); $(\'#'+dt_id+'-type-no-time\').show(); return false;">no time specified</a>'; | |
html += '</span>'; | |
html += '<span id="'+dt_id+'-type-no-time" '+( (type != 'No time') ? 'style="display:none"' : '' )+'>'; | |
html += '<strong>no time specified</strong>, '; | |
html += '<a href="#" onclick="$(\'#'+dt_id+'-type\').val(\'Normal\'); $(\'#'+dt_id+'-time\').show(); $(\'#'+dt_id+'-type-all-day\').hide(); $(\'#'+dt_id+'-type-no-time\').hide(); return false;">set time</a>'; | |
html += ' or '; | |
html += '<a href="#" onclick="$(\'#'+dt_id+'-type\').val(\'All day\'); $(\'#'+dt_id+'-time\').hide(); $(\'#'+dt_id+'-type-all-day\').show(); $(\'#'+dt_id+'-type-no-time\').hide(); return false;">all day event</a>'; | |
html += '</span>'; | |
html += '<span id="'+dt_id+'-type-all-day" '+( (type != 'All day') ? 'style="display:none"' : '' )+'>'; | |
html += '<strong>all day</strong>, '; | |
html += '<a href="#" onclick="$(\'#'+dt_id+'-type\').val(\'Normal\'); $(\'#'+dt_id+'-time\').show(); $(\'#'+dt_id+'-type-all-day\').hide(); $(\'#'+dt_id+'-type-no-time\').hide(); return false;">set time</a>'; | |
html += ' or '; | |
html += '<a href="#" onclick="$(\'#'+dt_id+'-type\').val(\'No time\'); $(\'#'+dt_id+'-time\').hide(); $(\'#'+dt_id+'-type-all-day\').hide(); $(\'#'+dt_id+'-type-no-time\').show(); return false;">no time specified</a>'; | |
html += '</span>'; | |
html += '<input id="'+dt_id+'-type" type="hidden" name="'+dt_name+'[type]" value="'+type+'" />'; | |
html += '</div>'; | |
$('#date-times').append(html); | |
$(document).ready(function(){ | |
$('input.date-time-date').datepicker({ changeMonth:false, changeYear:false, showAnim: 'slideDown', duration:'fast' }); | |
}); | |
date_time_counter++; | |
} | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment