comparison 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
comparison
equal deleted inserted replaced
22:95629ba1f043 23:f3bf1be1a51b
51 '<div class="prg_duration" style="clear: left"><span class=" labelLeft">録画時間:</span><span class="bold">' + parseInt(duration / 60) +'</span>分' + ((duration % 60)>0?'<span class="bold">' + parseInt(duration % 60) + '</span>秒':'') + '</div>' + 51 '<div class="prg_duration" style="clear: left"><span class=" labelLeft">録画時間:</span><span class="bold">' + parseInt(duration / 60) +'</span>分' + ((duration % 60)>0?'<span class="bold">' + parseInt(duration % 60) + '</span>秒':'') + '</div>' +
52 '</div>'; 52 '</div>';
53 if ($(this).hasClass('prg_rec')) { 53 if ($(this).hasClass('prg_rec')) {
54 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>'; 54 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>';
55 } else { 55 } else {
56 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>'; 56 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>';
57 } 57 }
58 $('#floatBox4Dialog').html(str); 58 $('#floatBox4Dialog').html(str);
59 $('#floatBox4Dialog').dialog('open', 'center'); 59 $('#floatBox4Dialog').dialog('open', 'center');
60 }; 60 };
61 $('.prg').hover( 61 $('.prg').hover(
98 }else{ 98 }else{
99 $('#prgID_' + id).removeClass('prg_rec'); 99 $('#prgID_' + id).removeClass('prg_rec');
100 $('#floatBox4Dialog').dialog('close'); 100 $('#floatBox4Dialog').dialog('close');
101 } 101 }
102 }); 102 });
103 },
104 customform:function(id) {
105 $('#floatBox4Dialog').dialog('close');
106 $.get('reservationform.php', { program_id: id }, function(data) {
107 if(data.match(/^error/i)){
108 alert(data);
109 }
110 else {
111 var str = data;
112 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>';
113 $('#floatBox4Dialog').html(str);
114 $('#floatBox4Dialog').dialog('open', 'center');
115 }
116 });
117 },
118 customrec:function() {
119 var id_syear = $('#id_syear').val();
120 var id_smonth = $('#id_smonth').val();
121 var id_sday = $('#id_sday').val();
122 var id_shour = $('#id_shour').val();
123 var id_smin = $('#id_smin').val();
124 var id_eyear = $('#id_eyear').val();
125 var id_emonth = $('#id_emonth').val();
126 var id_eday = $('#id_eday').val();
127 var id_ehour = $('#id_ehour').val();
128 var id_emin = $('#id_emin').val();
129 var id_channel_id = $('#id_channel_id').val();
130 var id_record_mode = $('#id_record_mode').val();
131 var id_title = $('#id_title').val();
132 var id_description = $('#id_description').val();
133 var id_category_id = $('#id_category_id ').val();
134 var id_program_id = $('#id_program_id').val();
135 var with_program_id = $('#id_program_id').attr('checked');
136
137 if( ! with_program_id ) id_program_id = 0;
138
139 $.post('customReservation.php', { syear: id_syear,
140 smonth: id_smonth,
141 sday: id_sday,
142 shour: id_shour,
143 smin: id_smin,
144 eyear: id_eyear,
145 emonth: id_emonth,
146 eday: id_eday,
147 ehour: id_ehour,
148 emin: id_emin,
149 channel_id: id_channel_id,
150 record_mode: id_record_mode,
151 title: id_title,
152 description: id_description,
153 category_id: id_category_id,
154 program_id: id_program_id }, function(data) {
155 if(data.match(/^error/i)){
156 $('#floatBox4Dialog').dialog('close');
157 alert(data);
158 }
159 else {
160 var id = parseInt(data);
161 if( id ) {
162 $('#prgID_' + id).addClass('prg_rec');
163 }
164 $('#floatBox4Dialog').dialog('close');
165 }
166 });
103 } 167 }
104 } 168 }
105 var CTG = { 169 var CTG = {
106 CN:'ctg', 170 CN:'ctg',
107 CV:'0.1', 171 CV:'0.1',
221 MDA.Cookie.CookieName = 'tvProgmas_'; 285 MDA.Cookie.CookieName = 'tvProgmas_';
222 CTG.toggle(); 286 CTG.toggle();
223 tvtimes_scroll(); 287 tvtimes_scroll();
224 prg_hover(); 288 prg_hover();
225 var DG = $('#floatBox4Dialog'); 289 var DG = $('#floatBox4Dialog');
226 DG.dialog({title:'録画予約',width:500}); 290 DG.dialog({title:'録画予約',width:600});
227 DG.dialog('close'); 291 DG.dialog('close');
228 nowBar.INI(); 292 nowBar.INI();
229 CTG.INI(); 293 CTG.INI();
230 MDA.SCR.INI(); // 番組表の位置保存 294 MDA.SCR.INI(); // 番組表の位置保存
231 }); 295 });