Mercurial > epgrec.yaz
comparison templates/programTable.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 | f5a9f0eb4858 |
children | f0ef6fb63aa4 |
comparison
equal
deleted
inserted
replaced
22:95629ba1f043 | 23:f3bf1be1a51b |
---|---|
7 <title>{$sitetitle}</title> | 7 <title>{$sitetitle}</title> |
8 <meta http-equiv="Content-Style-Type" content="text/css"> | 8 <meta http-equiv="Content-Style-Type" content="text/css"> |
9 | 9 |
10 {literal} | 10 {literal} |
11 <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> | 11 <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> |
12 <script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script> | |
13 <link rel="stylesheet" href="start/jquery-ui-1.7.2.custom.css" type="text/css"> | |
14 <script type="text/javascript" src="js/mdabasic.js"></script> | |
12 <script type="text/javascript"> | 15 <script type="text/javascript"> |
13 var PRG = { | 16 var PRG = { |
14 rec:function(id){ | 17 rec:function(id){ |
15 $.get(INISet.prgRecordURL, { program_id: id } ,function(data){ | 18 $.get(INISet.prgRecordURL, { program_id: id } ,function(data){ |
16 if(data.match(/^error/i)){ | 19 if(data.match(/^error/i)){ |
17 alert(data); | 20 alert(data); |
18 }else{ | 21 }else{ |
19 $('#resid_' + id).addClass('prg_rec'); | 22 $('#resid_' + id).addClass('prg_rec'); |
20 } | 23 } |
21 }); | 24 }); |
25 }, | |
26 customform:function(id) { | |
27 $('#floatBox4Dialog').dialog('close'); | |
28 $.get('reservationform.php', { program_id: id }, function(data) { | |
29 if(data.match(/^error/i)){ | |
30 alert(data); | |
31 } | |
32 else { | |
33 var str = data; | |
34 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>'; | |
35 $('#floatBox4Dialog').html(str); | |
36 $('#floatBox4Dialog').dialog('open', 'center'); | |
37 } | |
38 }); | |
39 }, | |
40 customrec:function() { | |
41 var id_syear = $('#id_syear').val(); | |
42 var id_smonth = $('#id_smonth').val(); | |
43 var id_sday = $('#id_sday').val(); | |
44 var id_shour = $('#id_shour').val(); | |
45 var id_smin = $('#id_smin').val(); | |
46 var id_eyear = $('#id_eyear').val(); | |
47 var id_emonth = $('#id_emonth').val(); | |
48 var id_eday = $('#id_eday').val(); | |
49 var id_ehour = $('#id_ehour').val(); | |
50 var id_emin = $('#id_emin').val(); | |
51 var id_channel_id = $('#id_channel_id').val(); | |
52 var id_record_mode = $('#id_record_mode').val(); | |
53 var id_title = $('#id_title').val(); | |
54 var id_description = $('#id_description').val(); | |
55 var id_category_id = $('#id_category_id ').val(); | |
56 var id_program_id = $('#id_program_id').val(); | |
57 var with_program_id = $('#id_program_id').attr('checked'); | |
58 | |
59 if( ! with_program_id ) id_program_id = 0; | |
60 | |
61 $.post('customReservation.php', { syear: id_syear, | |
62 smonth: id_smonth, | |
63 sday: id_sday, | |
64 shour: id_shour, | |
65 smin: id_smin, | |
66 eyear: id_eyear, | |
67 emonth: id_emonth, | |
68 eday: id_eday, | |
69 ehour: id_ehour, | |
70 emin: id_emin, | |
71 channel_id: id_channel_id, | |
72 record_mode: id_record_mode, | |
73 title: id_title, | |
74 description: id_description, | |
75 category_id: id_category_id, | |
76 program_id: id_program_id }, function(data) { | |
77 if(data.match(/^error/i)){ | |
78 $('#floatBox4Dialog').dialog('close'); | |
79 alert(data); | |
80 } | |
81 else { | |
82 var id = parseInt(data); | |
83 if( id ) { | |
84 $('#resid_' + id).addClass('prg_rec'); | |
85 } | |
86 $('#floatBox4Dialog').dialog('close'); | |
87 } | |
88 }); | |
22 } | 89 } |
23 } | 90 } |
91 | |
92 $(document).ready(function () { | |
93 var DG = $('#floatBox4Dialog'); | |
94 DG.dialog({title:'録画予約',width:600}); | |
95 DG.dialog('close'); | |
96 }); | |
24 </script> | 97 </script> |
25 <style type="text/css"> | 98 <style type="text/css"> |
26 <!-- | 99 <!-- |
27 body {padding:4px;margin:0;font-size:10pt;} | 100 body {padding:4px;margin:0;font-size:10pt;} |
28 a {text-decoration:none;} | 101 a {text-decoration:none;} |
124 <td>{$program.starttime}</td> | 197 <td>{$program.starttime}</td> |
125 <td>{$program.endtime}</td> | 198 <td>{$program.endtime}</td> |
126 <td>{$program.title|escape}</td> | 199 <td>{$program.title|escape}</td> |
127 <td>{$program.description|escape}</td> | 200 <td>{$program.description|escape}</td> |
128 <td><input type="button" value="録画" onClick="javascript:PRG.rec('{$program.id}')" /></td> | 201 <td><input type="button" value="録画" onClick="javascript:PRG.rec('{$program.id}')" /></td> |
129 <td><a href="reservation.php?program_id={$program.id}">詳細へ</a></td> | 202 <td><input type="button" value="詳細" onClick="javascript:PRG.customform('{$program.id}')" /></td> |
130 </tr> | 203 </tr> |
131 {/foreach} | 204 {/foreach} |
132 </table> | 205 </table> |
133 {else} | 206 {else} |
134 該当する番組はありません | 207 該当する番組はありません |
155 </form> | 228 </form> |
156 </div> | 229 </div> |
157 {/if} | 230 {/if} |
158 {/if} | 231 {/if} |
159 | 232 |
160 | 233 <div id="floatBox4Dialog">jQuery UI Dialog</div> |
161 | |
162 | 234 |
163 {literal} | 235 {literal} |
164 <script type="text/javascript"> | 236 <script type="text/javascript"> |
165 var INISet = { | 237 var INISet = { |
166 prgRecordURL : 'simpleReservation.php', // 簡易予約 | 238 prgRecordURL : 'simpleReservation.php', // 簡易予約 |