1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 $('#form-preview').click(function() {
    $('#input-form').hide();
    $('#preview-tbl').show();
    $('#form-submit').show();
    $('#form-edit').show();
    var d = 'Dates';
    var cat_id                                     = $('select[name=events_category_id]').val();
    var [startDate, startTime]                     = $('input[name=start_date]').val().split(' ');
    var [endDate, endTime]                         = $('input[name=end_date]').val().split(' ');
    var [deadlineDate, deadlineTime]               = $('input[name=regclose_date]').val().split(' ');
    var [deadlineYear, deadlineMonth, deadlineDay] = ['', '', ''];
    if( deadlineDate ) {
      [deadlineYear, deadlineMonth, deadlineDay] = deadlineDate.split('-');
    }
    var [startYear, startMonth, startDay]          = startDate.split('-');
    var [endYear, endMonth, endDay]                = endDate.split('-');
    var [dateRangeFormatted, appDeadlineFormatted] = formatSearchDates();
    var brandImage                                 = 'http://www.hinxton.org/gfx/';

    switch (cat_id) {
      case '39':
        brandImage += 'circle.png';
        break;
      case '40':
        brandImage += 'rhombus.png';
        break;
      case '41':
        brandImage += 'square.png';
        break;
      case '42':
        d = 'Date';
        brandImage += 'pentagon.png';
    }

    if( $('input[name=title_link]').val() != '' ) {
      $('#p-title_link').children('td').first().html('<a href="' + $('input[name=title_link]').val() + '" target="_new"><h3>' + $('input[name=title_name]').val() + '</h3></a>');
    } else {
      $('#p-title_link').children('td').first().html('<h3>' + $('input[name=title_name]').val() + '</h3>');
    }
    $('#p-event_type').children('td[class=col1]').html('<img src="' + brandImage + '" />');
    $('#p-event_type').children('td[class=col3]').html($('select[name=events_category_id]').children('option[value='+cat_id+']').text());
    $('#p-dates').children('td[class=col2]').html(d);
    $('#p-dates').children('td[class=col3]').html(dateRangeFormatted);
    if( cat_id != '42' ) {
      $('#p-deadline').children('td[class=col3]').html(appDeadlineFormatted).show();
      $('#p-time').hide();
      $('#p-speaker').hide();
      $('#p-affiliation').hide();
      $('#p-location').hide();
      $('#p-host').hide();
      $('#p-abstract').hide();
    } else {
      $('#p-deadline').hide();
      if( startTime && ! startTime.match(/00:00:00/) ) {
        $('#p-time').show();
        $('#p-time').children('td[class=col3]').html(startTime.replace(/:\d+$/, ''));
      }
      $('#p-speaker').children('td[class=col3]').html(
        $('select[name=speaker_title]').val() + ' ' + $('input[name=speaker_first_name]').val() + ' ' + $('input[name=speaker_last_name]').val()
      ).show();
      $('#p-affiliation').children('td[class=col3]').html($('input[name=affiliation]').val()).show();
      $('#p-location').children('td[class=col3]').html($('input[name=location]').val()).show();
      $('#p-host').children('td[class=col3]').html($('input[name=host]').val()).show();
      $('#p-abstract').children('td[class=col3]').html($('textarea[name=abstract]').text()).show();
    }