OSDN Git Service

add: height_per_minite at index.html
[epgrec/epgrec.git] / templates / index.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3
4 <html>
5 <head>
6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7 <title>{$sitetitle}</title>
8 <meta http-equiv="Content-Style-Type" content="text/css">
9
10 {literal}
11
12 <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
13 <script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
14 <link rel="stylesheet" href="start/jquery-ui-1.7.2.custom.css" type="text/css">
15 <script type="text/javascript" src="js/mdabasic.js"></script>
16 <script type="text/javascript">
17         function tvtimes_scroll(){
18                 var t2max = $('#tvtimes2').position().left;
19                 var ftmin = $('#float_titles').position().top;
20                 tvtimes2scrl();
21                 $(window).scroll(function () {
22                         $('#tvtimes').css('left', parseInt($(document ).scrollLeft())); 
23                         var newTop = parseInt($(document ).scrollTop());
24                         if(newTop < ftmin) {newTop = ftmin;}
25                         $('#float_titles').css('top', newTop);
26                         tvtimes2scrl();
27                         $('#float_follows').css('left', parseInt($(document ).scrollLeft()));
28                 });
29                 $(window).resize(function () {  tvtimes2scrl();});
30                 function tvtimes2scrl(){
31                         var inwidth = parseInt($('body').innerWidth());
32                         // IE6
33                         if ($.browser.msie && $.browser.version == 6){ inwidth = document.documentElement.clientWidth;}
34                         var newLeft = inwidth - parseInt($('#tvtimes2').width()) + parseInt($( document ).scrollLeft());
35                         if(newLeft > t2max ) {newLeft = t2max}
36                         $('#tvtimes2').css('left', newLeft);
37                         $('#float_follows').width(inwidth);
38                 }
39         }
40         function prg_hover(){
41                 function aClick(){
42                         var TG = $(this).children('.prg_dummy');
43                         var startTime = new Date(TG.children('.prg_start').html());
44                         var duration = parseInt(TG.children('.prg_duration').html());
45                         var endTime = new Date(startTime.getTime() + duration * 1000);
46                         var prgID = parseInt(TG.children('.prg_id').html());
47
48                         var str = '<div class="prg_title">' + TG.children('.prg_title').html() +'</div>' + 
49                                 '<div class="prg_rec_cfg ui-corner-all"><div class="prg_channel"><span class=" labelLeft">チャンネル:</span><span class="bold">' + TG.children('.prg_channel').html() + '</span></div>' +
50                                 '<div class="prg_startTime" style="clear: left"><span class=" labelLeft">日時:</span>' + MDA.Days.time4Disp(startTime) + ' ~ ' + MDA.Days.time4DispH(endTime) + '</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>';
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>';
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="javascript:PRG.customform(' + prgID + ')" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">予約カスタマイズ</a></div>';
57                         }
58                         $('#floatBox4Dialog').html(str);
59                         $('#floatBox4Dialog').dialog('open', 'center');
60                 };
61                 $('.prg').hover(
62                         function(){
63                                 $('#tv_chs .prg_hover').removeClass('prg_hover');
64                                 if($(this).hasClass('prg_none')) return ;
65                                 $(this).addClass('prg_hover');
66                                 var TG = $(this).children('.prg_dummy');
67                                 var startTime = new Date(TG.children('.prg_start').html());
68                                 var duration = parseInt(TG.children('.prg_duration').html());
69                                 var endTime = new Date(startTime.getTime() + duration * 1000);
70                                 var str = '<div class="prg_title">' + TG.children('.prg_title').html() + '</div>' +
71                                         '<div class="prg_desc"><span class="prg_sub">' + TG.children('.prg_channel').html() + ':' + MDA.Days.time4Disp(startTime) + '~' + MDA.Days.time4DispH(endTime)  + ' </span>' + TG.children('.prg_desc').html() + '</div>';
72                                 $('#prg_info').html('<div class="prg_dummy">' + str + '</div>').show();
73                                 $(this).click(aClick);
74                         },
75                         function(){
76                                 $(this).removeClass('prg_hover');$('#prg_info').hide();
77                                 $(this).unbind('click',aClick);
78                         }
79                 );
80         }
81         var PRG = {
82                 rec:function(id){
83                         $.get(INISet.prgRecordURL, { program_id: id } ,function(data){
84                                 if(data.match(/^error/i)){
85                                         alert(data);
86                                         $('#floatBox4Dialog').dialog('close');
87                                 }else{
88                                         $('#prgID_' + id).addClass('prg_rec');
89                                         $('#floatBox4Dialog').dialog('close');
90                                 }
91                         });
92                 },
93                 cancel:function(id){
94                         $.get(INISet.prgCancelURL, { program_id: id } ,function(data){
95                                 if(data.match(/^error/i)){
96                                         alert(data);
97                                         $('#floatBox4Dialog').dialog('close');
98                                 }else{
99                                         $('#prgID_' + id).removeClass('prg_rec');
100                                         $('#floatBox4Dialog').dialog('close');
101                                 }
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                         });
167                 }
168         }
169         var CTG = {
170                 CN:'ctg',
171                 CV:'0.1',
172                 defaultCk:[],
173                 INI:function(){
174                         var Ck = this.CkGet()[1];
175                         if(Ck){ $.each(Ck.split(','), function(){CTG.select(this);})}
176                 },
177                 select:function(ctg){
178                         if($('#category_select .ctg-hide.ctg_'+ctg).length){
179                                 $('#tv_chs .ctg_'+ctg).removeClass('ctg-hide');
180                                 $('#category_select a.ctg_'+ctg).removeClass('ctg-hide');
181                         } else {
182                                 $('#tv_chs .ctg_'+ctg).addClass('ctg-hide');
183                                 $('#category_select a.ctg_'+ctg).addClass('ctg-hide');
184                         }
185                         this.oCk();
186                 },
187                 toggle:function (){$('#category_select ul').toggle();},
188                 oCk:function(){
189                         var T=$('#category_select ul li a.ctg-hide');
190                         var X=[];
191                         $.each(T.get(), function(){
192                                 $(this).attr('class').match(/ctg_([^ ]+)/);
193                                 var TMC=RegExp.$1;
194                                 X.push(TMC);
195                         });
196                         this.CkSet([X.join(',')]);
197                 },
198                 CkGet:function (){
199                         var Ck = MDA.Cookie.get(this.CN);
200                         if(!Ck){return this.defaultCk};
201                          Ck=Ck.replace(/^([^;]+;)/,'');
202                         return Ck.split('+');
203                 },
204                 CkSet:function(V){
205                         MDA.Cookie.set(this.CN,'ver='+this.CV+'+'+V.join('+'));
206                 }
207         };
208         var nowBar = {
209                 defaultID:'tableNowBas',
210                 startTime:null,
211                 endTime:null,
212                 INI:function(){
213                         if (INISet.tableStartTime && INISet.tableStartTime && INISet.dotMin) {
214                                 $('#tvtable').append('<div id="' + this.defaultID + '" style="display:none">now</div>');
215                                 this.startTime = new Date(INISet.tableStartTime);
216                                 this.endTime = new Date(INISet.tableEndTime);
217                                 $('#' + this.defaultID).width($('#float_titles').width());
218                                 this.ch();
219                         }
220                 },
221                 ch:function(){
222                         var now = new Date();
223                         if(this.startTime){
224                                 if((now >= this.startTime) && (this.endTime >= now)){
225 //                                      console.log((now - this.startTime) / 60000);
226                                         $('#' + this.defaultID).css({top:(now - this.startTime) / 60000 * INISet.dotMin}).show()
227                                 } else {
228                                         $('#' + this.defaultID).hide()
229                                 }
230                         }
231                 }
232         }
233
234         MDA.SCR = {
235                 CN:'scr',
236                 CV:'0.1',
237                 defaultCk:{md:'',x:0,y:0},
238                 jqSel:[{sel:'#jump-time a.jump',md:'x'},{sel:'#jump-day a.jump',md:'xy'},{sel:'#jump-day a.jump-today',md:'x'},{sel:'#jump-broadcast a.jump',md:'y'}],
239                 INI:function(){
240 //                      this.defaultCk.y = $('#float_titles').position().top;
241                         $.each(this.jqSel, function(){
242                                 var md = this.md;
243                                 $(this.sel).click(function(){MDA.SCR.oCk(md)})
244                         });
245                         var Ck = this.CkGet();
246 //                      console.log(Ck);
247                         var x = (Ck.md.indexOf('x')>-1)?Ck.x:this.defaultCk.x;
248                         var y = (Ck.md.indexOf('y')>-1)?Ck.y:this.defaultCk.y;
249                         if (Ck.md) {
250                                 window.scrollBy(x, y);
251                         }
252                         this.CkClear();
253                 },
254                 channel:{
255                         save:function(){},
256                         load:function(){}
257                 },
258                 time: {
259                 },
260                 oCk:function(xy){
261                         this.CkSet(['md=' + ((!xy)?'xy':xy),
262                                 'x=' + $(document ).scrollLeft(),
263                                 'y=' + $(document ).scrollTop()]);
264                 },
265                 CkGet:function (){
266                         var Ck = MDA.Cookie.get(this.CN);
267                         if(!Ck){return this.defaultCk};
268                         Ck=Ck.replace(/^([^;]+;)/,'').split('+');
269                         var ret = {};
270                         $.each(Ck, function(){
271                                 var str = this.split('=', 2);
272                                 ret[str[0]] = str[1];
273                         })
274                         return ret;
275                 },
276                 CkSet:function(V){
277                         MDA.Cookie.set(this.CN,'ver='+this.CV+'+'+V.join('+'));
278                 },
279                 CkClear:function(){
280                         MDA.Cookie.del(this.CN);
281                 }
282         };
283         
284         $(document).ready(function () {
285                 MDA.Cookie.CookieName = 'tvProgmas_';
286                 CTG.toggle();
287                 tvtimes_scroll();
288                 prg_hover();
289                 var DG = $('#floatBox4Dialog');
290                 DG.dialog({title:'録画予約',width:600});
291                 DG.dialog('close');
292                 nowBar.INI();
293                 CTG.INI();
294                 MDA.SCR.INI();  // 番組表の位置保存
295         });
296
297
298 </script>
299
300 <style type="text/css">
301 <!--
302 body {padding:0;margin:0;font-size:10pt;}
303 a {text-decoration:none;}
304
305 .bold {font-weight:bold;}
306 .small {font-size:75%;}
307
308 h2 {padding: 4px}
309
310 #float_titles {position:absolute;background-image: url(imgs/trancBG50.png);}
311
312 #float_titles div.set.ctg_sel {background-color:#BBB;color:#3CF}
313 #float_titles .ctg_sel  a{color:#111;}
314
315 #float_titles div.set {float:left;background-color:#444;padding:4px;margin:4px;}
316 #float_titles span.title {float:left;color:#ACF;}
317 #float_titles ul {float:left;padding:0;margin:0;}
318 #float_titles ul li {float:left;list-style:none;margin:0 0 0 4px;}
319 #float_titles li a{padding:1px 4px;background-color:#555;color:#FFF;}
320 #float_titles li.selected a{background-color:#48B;}
321 #float_titles li a:hover{background-color:#28D;}
322
323 #float_titles, #tvtable {}
324 #tvtable {line-height:1.2em;width:100%;position:relative;}
325 #tvtimes,#tvtimes2 {position:absolute;  background-image: url(imgs/trancBG70.png);}
326 #tvtimes,#tvtimes2, .tvtimeDM {width:40px;}
327 #tv_chs {padding-left:40px;padding-right:40px;}
328 .tvtime {
329         height:{/literal}{$height_per_hour}{literal}px;
330         color:#EEE;
331         text-align:center;
332         font-weight:bold;
333         font-size:120%;
334         background-image: url(imgs/dot2.gif);
335         background-repeat: repeat-x;
336         background-position: left bottom;
337 }
338 #tvtable div.tvtimetop {padding:8px 0px;}
339
340 #tvtable div.ch_set {width:{/literal}{$ch_set_width}{literal}px;float:left;background-color:#BBB;}
341
342
343 #tvtable div.ch_title, #tvtable div.prg {margin-right:2px;}
344 #tvtable div.ch_title {padding:8px 0px;background-color:#333;color:#DDD;font-weight:bold;text-align:center}
345 #tvtable div.prg {
346         overflow:hidden;
347         color:#444;
348         background-image: url(imgs/dot2.gif);
349         background-image: url(imgs/prg_bg2.png);
350         background-repeat: repeat-x;
351         background-position: left bottom;
352         -moz-border-radius: 0.6em 0.6em 0.3em 0.3em;
353         -webkit-border-radius: 0.6em;
354         -webkit-border-bottom-right-radius: 0.3em;
355         -webkit-border-bottom-left-radius: 0.3em;
356 }
357 #tvtable div.prg_none {background-color:#eee;}
358 #tvtable div.prg_dummy {margin:3px 6px;}
359 #tvtable div.prg_title {color:#111;font-weight:bold;}
360 #tvtable div.prg_subtitle {font-size:80%;}
361 #tvtable div.prg_desc {font-size:80%;}
362
363 #tvtable div.prg_start,#tvtable div.prg_duration,#tvtable div.prg_channel ,#tvtable div.prg_id  {display: none;}
364
365 #tvtable div.ctg_news, #category_select a.ctg_news {background-color: #FFFFD8;}
366 #tvtable div.ctg_etc, #category_select a.ctg_etc {background-color: #FFFFFF;}
367 #tvtable div.ctg_information, #category_select a.ctg_information {background-color: #F2D8FF;}
368 #tvtable div.ctg_sports, #category_select a.ctg_sports {background-color: #D8FFFF;}
369 #tvtable div.ctg_cinema, #category_select a.ctg_cinema {background-color: #FFD8D8;}
370 #tvtable div.ctg_music, #category_select a.ctg_music {background-color: #D8D8FF;}
371 #tvtable div.ctg_drama, #category_select a.ctg_drama {background-color: #D8FFD8;}
372 #tvtable div.ctg_anime, #category_select a.ctg_anime {background-color: #FFE4C8;}
373 #tvtable div.ctg_variety, #category_select a.ctg_variety {background-color: #FFD2EB;}
374 #tvtable div.ctg_10, #category_select a.ctg_10 {background-color: #E4F4F4;}
375 #tvtable div.ctg-hide, #category_select a.ctg-hide {background-color: #F8F8F8;color:#888;}
376 #tvtable div.ctg-hide .prg_title, #category_select a.ctg-hide .prg_title{color:#666;}
377 #tvtable div.prg_rec  {background-color: #F55;color:#FEE}
378 #tvtable div.prg_rec .prg_title,#tvtable div.prg_hover .prg_title {color:white;}
379 #tvtable div.prg_hover  {background-color: #28D;color:#EFF}
380
381 #float_titles { z-index:100}
382 #float_titles div.ch_title {width:{/literal}{$ch_set_width}{literal}px;float:left;color:#FFF;font-weight:bold;text-align:center}
383 #float_titles div.ch_title div{padding:8px 0px;margin:0 6px 0 4px;background-image: url(imgs/trancBG50.png);}
384
385 #float_follows {position:absolute;}
386 #prg_info {
387         display:none;
388         position:absolute;
389         top:0;left:0;
390         width:100%;
391         background-color:#246;
392         color:#BDF;
393         height:80px;
394 }
395 #prg_info div.prg_dummy{margin:4px 20px;}
396 #prg_info div.prg_title {font-weight:bold;font-size:120%;color:#FFF;}
397 #prg_info span.prg_sub  {color:#FFF;}
398
399 #tableNowBas {position:absolute;background:red;width:100%;top:190px;height:2px;overflow:hidden;}
400
401
402 #floatBox4Dialog .prg_title{font-size:120%;font-weight:bold;padding:0.4em 0;text-align:center;}
403 #floatBox4Dialog .prg_rec_cfg{background:#EEE;padding:1em 2em;margin:0.4em 0;}
404 #floatBox4Dialog .labelLeft {width:8em;float:left;text-align:right;}
405 #floatBox4Dialog .button {padding:0.4em 1em;}
406 -->
407 </style>
408
409
410 {/literal}
411
412
413 </head>
414
415 <body>
416
417 <h2>{$sitetitle}</h2>
418
419
420 <div id="float_titles" style="width: {math equation="x + 80" x=$chs_width}px;height:120px;">
421 <div id="float_follows">
422
423 <div class="set">
424   <ul>
425     <li><a href="envSetting.php">環境設定</a></li>
426   </ul>
427 </div>
428
429 <div class="set ctg_sel" id="category_select">
430  <span class="title"><a href="javascript:CTG.toggle()">強調表示</a></span>
431
432  <ul>
433    {foreach from=$cats item=cat}
434    <li><a href="javascript:CTG.select('{$cat.name_en}');" class="ctg_{$cat.name_en}">{$cat.name_jp}</a></li>
435    {/foreach}
436   </ul>
437 </div>
438
439 <div id="time_selects">
440  <div class="set" id="jump-broadcast" >
441  <span class="title">放送波選択</span>
442   <ul>
443    {foreach from=$types item=type }
444      <li {$type.selected}><a  class="jump" href="{$type.link}">{$type.name}</a></li>
445    {/foreach}
446   </ul><br style="clear:left;" />
447  </div>
448
449  <div class="set"  id="jump-time">
450  <span class="title">時間</span>
451  <ul>
452     {foreach from=$toptimes item=top}
453      <li><a class="jump" href="{$top.link}">{$top.hour}~</a></li>
454     {/foreach}
455   </ul><br style="clear:left;" />
456  </div>
457  <br style="clear:left;" />
458
459  <div class="set">
460   <ul>
461     <li><a href="programTable.php">番組検索</a></li>
462     <li><a href="reservationTable.php">録画予約一覧</a></li>
463     <li><a href="recordedTable.php">録画済一覧</a></li>
464   </ul>
465  </div>
466
467  <div class="set" id="jump-day" >
468  <span class="title">日付</span>
469   <ul>
470     {foreach from=$days item=day}
471      <li {$day.selected}><a {if $day.d eq "現在" } class="jump-today" {else} class="jump" {/if} href="{$day.link}">{$day.d}{$day.ofweek}</a></li>
472     {/foreach}
473   </ul><br style="clear:left;" />
474  </div>
475
476
477 </div>
478 <br style="clear:left;" />
479 <div id="prg_info"><div class="dummy">test</div></div>
480 </div>
481
482 <div style="position:absolute;bottom:0;">
483   <div class="tvtimeDM" style="float:left;">&nbsp;</div>
484   {foreach from=$programs item=program }
485   <div class="ch_title"><div>{$program.station_name}</div></div>
486   {/foreach}
487 </div>
488 <br style="clear:left;" />
489 <div id="prg_info"><div class="dummy">&nbsp;</div></div>
490 </div>
491
492 <div id="float_titles_dummy" style="width:1410px;height:120px;">&nbsp;</div>
493
494
495 <div id="tvtable">
496
497 <div id="tvtimes">
498   {foreach from=$tvtimes item=time}
499   <div class="tvtime">{$time}</div>
500   {/foreach}
501 </div>
502
503 <div id="tv_chs" style="width: {$chs_width}px" >
504    {foreach from=$programs item=program }
505    <div class="ch_set" style="width: {$ch_set_width}px" >
506     <div class="ch_programs">
507     {foreach from=$program.list item=item }
508       <div {if $item.id}id="prgID_{$item.id}"{/if} class="prg {if ! $item.id}prg_none {/if} ctg_{$item.category_name}{if $item.rec gt 0 } prg_rec{/if}" style="height:{$item.height}px;">
509         <div class="prg_dummy">
510           <div class="prg_title">{$item.title|escape}</div>
511           <div class="prg_subtitle">{$item.starttime}</div>
512           <div class="prg_desc">{$item.description|escape}</div>
513           <div class="prg_channel">{$item.channel}</div>
514           <div class="prg_start">{$item.prg_start}</div>
515           <div class="prg_duration">{$item.duration}</div>
516           <div class="prg_id">{$item.id}</div>
517         </div>
518       </div>
519     {/foreach}
520     </div>
521    </div>
522    {/foreach}
523  </div>
524
525  <div id="tvtimes2" style="top : 0px; left: {math equation="x + 40" x=$chs_width}px" >
526   {foreach from=$tvtimes item=time}
527     <div class="tvtime">{$time}</div>
528   {/foreach}
529  </div>
530 </div>
531
532
533
534 <div id="floatBox4Dialog">jQuery UI Dialog</div>
535
536 {literal}
537 <script type="text/javascript">
538 var INISet = {
539         prgRecordURL : 'simpleReservation.php',         // 簡易予約
540         prgRecordPlusURL : 'recordp.php',               // 詳細予約
541         prgCancelURL : 'cancelReservation.php',         // 予約キャンセル
542         dotMin : {/literal}{$height_per_min}{literal},
543         tableStartTime : {/literal}'{$top_time}',
544         tableEndTime : '{$last_time}'{literal}
545 }
546 </script>
547 {/literal}
548 </body>
549 </html>