Mercurial > epgrec.yaz
diff templates/index.html @ 23:f3bf1be1a51b
Change: using ajax in custom reservation method
author | yoneda <yoneda@recorder.localnet.mda.or.jp> |
---|---|
date | Thu, 23 Jul 2009 23:35:43 +0900 |
parents | 19cd7816b2c1 |
children | 18df04305501 |
line wrap: on
line diff
--- a/templates/index.html Fri Jul 17 22:40:41 2009 +0900 +++ b/templates/index.html Thu Jul 23 23:35:43 2009 +0900 @@ -53,7 +53,7 @@ if ($(this).hasClass('prg_rec')) { str += '<div style="margin:2em 0 1em 0;text-align:center;"><a href="javascript:PRG.cancel(' + prgID + ')" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">予約キャンセル</a></div>'; } else { - str += '<div style="margin:2em 0 1em 0;text-align:center;"><a href="javascript:PRG.rec(' + prgID + ')" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">簡易予約</a> <a href="reservation.php?program_id=' + prgID + '" style="color:red;">予約カスタマイズ</a></div>'; + str += '<div style="margin:2em 0 1em 0;text-align:center;"><a href="javascript:PRG.rec(' + prgID + ')" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">簡易予約</a> <a href="javascript:PRG.customform(' + prgID + ')" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">予約カスタマイズ</a></div>'; } $('#floatBox4Dialog').html(str); $('#floatBox4Dialog').dialog('open', 'center'); @@ -100,6 +100,70 @@ $('#floatBox4Dialog').dialog('close'); } }); + }, + customform:function(id) { + $('#floatBox4Dialog').dialog('close'); + $.get('reservationform.php', { program_id: id }, function(data) { + if(data.match(/^error/i)){ + alert(data); + } + else { + var str = data; + str += '<div style="margin:2em 0 1em 0;text-align:center;"><a href="javascript:PRG.customrec()" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">予約する</a></div>'; + $('#floatBox4Dialog').html(str); + $('#floatBox4Dialog').dialog('open', 'center'); + } + }); + }, + customrec:function() { + var id_syear = $('#id_syear').val(); + var id_smonth = $('#id_smonth').val(); + var id_sday = $('#id_sday').val(); + var id_shour = $('#id_shour').val(); + var id_smin = $('#id_smin').val(); + var id_eyear = $('#id_eyear').val(); + var id_emonth = $('#id_emonth').val(); + var id_eday = $('#id_eday').val(); + var id_ehour = $('#id_ehour').val(); + var id_emin = $('#id_emin').val(); + var id_channel_id = $('#id_channel_id').val(); + var id_record_mode = $('#id_record_mode').val(); + var id_title = $('#id_title').val(); + var id_description = $('#id_description').val(); + var id_category_id = $('#id_category_id ').val(); + var id_program_id = $('#id_program_id').val(); + var with_program_id = $('#id_program_id').attr('checked'); + + if( ! with_program_id ) id_program_id = 0; + + $.post('customReservation.php', { syear: id_syear, + smonth: id_smonth, + sday: id_sday, + shour: id_shour, + smin: id_smin, + eyear: id_eyear, + emonth: id_emonth, + eday: id_eday, + ehour: id_ehour, + emin: id_emin, + channel_id: id_channel_id, + record_mode: id_record_mode, + title: id_title, + description: id_description, + category_id: id_category_id, + program_id: id_program_id }, function(data) { + if(data.match(/^error/i)){ + $('#floatBox4Dialog').dialog('close'); + alert(data); + } + else { + var id = parseInt(data); + if( id ) { + $('#prgID_' + id).addClass('prg_rec'); + } + $('#floatBox4Dialog').dialog('close'); + } + }); } } var CTG = { @@ -223,7 +287,7 @@ tvtimes_scroll(); prg_hover(); var DG = $('#floatBox4Dialog'); - DG.dialog({title:'録画予約',width:500}); + DG.dialog({title:'録画予約',width:600}); DG.dialog('close'); nowBar.INI(); CTG.INI();