Mercurial > epgrec.yaz
diff templates/recordedTable.html @ 27:a34f2ff49097
add: editable title & description
author | yoneda <epgrec@park.mda.or.jp> |
---|---|
date | Sun, 26 Jul 2009 18:00:11 +0900 |
parents | bbbc4f1ecf1d |
children | ae5491d72470 |
line wrap: on
line diff
--- a/templates/recordedTable.html Sat Jul 25 23:07:02 2009 +0900 +++ b/templates/recordedTable.html Sun Jul 26 18:00:11 2009 +0900 @@ -40,8 +40,45 @@ $('#resid_' + id ).hide(); } }); + }, + editdialog:function(id) { + $('#floatBox4Dialog').dialog({title:'変更',width:500}); + var str; + str = '<div class="prg_title">録画ID:' + id + '</div>'; + str += '<input type="hidden" name="reserve_id" id="id_reserve_id" value="' + id + '" />'; + str += '<div><span class="labelLeft">タイトル</span><input name="title" id="id_title" size="30" value="'+ $('#tid_' + id ).html() + '" /></div>'; + str += '<div><span class="labelLeft">概要</span><textarea name="description" id="id_description" cols="30" rows="5" >' + $('#did_' + id ).html() + '</textarea></div>'; + str += '<div style="margin:2em 0 1em 0;text-align:center;"><a href="javascript:PRG.edit()" class="ui-state-default ui-corner-all ui-dialog-buttonpane button">変更する</a></div>'; + + $('#floatBox4Dialog').html(str); + $('#floatBox4Dialog').dialog('open','center'); + }, + edit:function() { + var id_reserve_id = $('#id_reserve_id').val(); + var id_title = $('#id_title').val(); + var id_description = $('#id_description').val(); + + $.post('changeReservation.php', { reserve_id: id_reserve_id, + title: id_title, + description: id_description }, function( data ) { + if(data.match(/^error/i)){ + alert(data); + $('#floatBox4Dialog').dialog('close'); + + } + else { + $('#tid_' + id_reserve_id ).html( id_title ); + $('#did_' + id_reserve_id ).html( id_description ); + $('#floatBox4Dialog').dialog('close'); + } + }); } } + $(document).ready(function () { + var DG = $('#floatBox4Dialog'); + DG.dialog({title:'あれ?',width:500}); + DG.dialog('close'); + }); --> </script> <style type="text/css"> @@ -136,7 +173,8 @@ {if $use_thumbs}<th>サムネール</th>{/if} <th>タイトル</th> <th>内容</th> - <th>情報削除</th> + <th>変更</th> + <th>削除</th> </tr> {foreach from=$records item=rec } @@ -145,8 +183,9 @@ <td>{$rec.station_name}</td> <td>{$rec.mode}</td> {if $use_thumbs}<td><a href="{$rec.asf}">{$rec.thumb}</a></td>{/if} - <td><a href="{$rec.asf}">{$rec.title}</a></td> - <td><a href="{$rec.asf}">{$rec.description}</a></td> + <td><a href="{$rec.asf}" id="tid_{$rec.id}">{$rec.title}</a></td> + <td><a href="{$rec.asf}" id="did_{$rec.id}">{$rec.description}</a></td> + <td><input type="button" value="変更" onClick="javascript:PRG.editdialog('{$rec.id}')" /></td> <td><input type="button" value="削除" onClick="javascript:PRG.dialog('{$rec.id}','{$rec.title}')" /></td> </tr> {/foreach}