Show
Ignore:
Timestamp:
10/01/08 08:02:29 (3 months ago)
Author:
anatoo
Message:

テンプレート周りいじった

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/plain_php/trunk/resource/timeline.php

    r20038 r20339  
    99    <base href="<?php echo $c->templateBaseUrl ?>/" /> 
    1010    <link rel="shortcut icon" href="./img/share/favicon.ico" /> 
    11  
     11    <?php if ($current_action === 'public_timeline'): ?> 
     12    <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $c->baseUrl ?>/public_timeline/rss" /> 
     13    <?php endif ?> 
    1214    <!-- *** stylesheet *** --> 
    1315    <link href="./css/import.css" rel="stylesheet" type="text/css" media="all" /> 
    1416     
    1517    <!-- *** javascript *** --> 
    16  
     18    <script src="./js/jquery.js" type="text/javascript"></script> 
     19    <script type="text/javascript"> 
     20    $(document).ready(function() { 
     21        var textcount = $("#js_textcount"); 
     22        var comment = $("#comment"); 
     23        var baseurl = "<?php echo $c->baseUrl ?>"; 
     24        var resourceurl = "<?php echo $c->templateBaseUrl ?>"; 
     25        var url = baseurl + "/status/update/ajax"; 
     26        var token = $("#token")[0].value; 
     27        var reload = function() { 
     28            textcount.text(140 - comment[0].value.length); 
     29        }; 
     30        var bind_delete_action = function () { 
     31            $(".delete_link").click(function (){ 
     32                return confirm("Sure you want to delete this update? There is NO undo!"); 
     33            }); 
     34        }; 
     35        reload(); 
     36        comment.bind("keyup", reload); 
     37        $("#post_form").submit(function() { 
     38            if (comment[0].value.length <= 0 || 140 - comment[0].value.length < 0) { 
     39                return false; 
     40            } 
     41            $.post(url, {token: token, comment: comment[0].value}, function(data) { 
     42                if (data.success) { 
     43                    comment[0].value = ""; 
     44                    reload(); 
     45                    var st = data.status; 
     46                    var cont = ""; 
     47                    cont += "<tr><td><a href=\"" + baseurl + "/" + st.user_name + "\">"; 
     48                    cont += "<img src=\"./img/" + (st.image ? "user/" + st.user_name : "friend") + "_icon.png\" /></a></td>"; 
     49                    cont += "<td class=\"status_body\"><a href=\"" + baseurl + "/" + st.user_name + "\">" + st.user_name + "</a> " + st.comment; 
     50                    cont += " <span class=\"meta\"><a class=\"published\" href=\"" + baseurl + "/statuses/" + st.id + "\">" + st.created_at + "</a></span>" + "</td>"; 
     51                    cont += "<td><a class=\"delete_link\" href=\"" + baseurl + "/status/delete/" + st.id + "/" + token + "\">"; 
     52                    cont += "<img src=\"img/share/trash_icon.gif\" alt=\"Delete\" /></a></td></tr>"; 
     53                    cont = $(cont); 
     54                    cont.hide(); 
     55                    $("#timeline table.autopagerize_page_element").prepend(cont); 
     56                    cont.fadeIn("normal"); 
     57                     
     58                    bind_delete_action(); 
     59                } 
     60            }, "json"); 
     61            return false; 
     62        }); 
     63        bind_delete_action(); 
     64    }); 
     65    </script> 
    1766</head> 
    1867 
     
    3988<?php endforeach ?> 
    4089 
    41 <form action="<?php echo $c->baseUrl; ?>/status/update" method="post"> 
     90<form action="<?php echo $c->baseUrl; ?>/status/update" method="post" id="post_form"> 
    4291<div id="post"> 
    4392<h2>What are you doing?</h2> 
    4493<span class="textCount" id="js_textcount">140</span> 
    4594<textarea id="comment" name="comment"><?php if ($status) echo h($status) . ' ' ?></textarea> 
    46 <input type="hidden" name="token" value="<?php echo $session->token ?>" /> 
     95<input type="hidden" id="token" name="token" value="<?php echo $session->token ?>" /> 
    4796<p id="button_space"> 
    4897<input type="submit" id="twit_button" value=" update " /> 
     
    76125    <td> 
    77126        <?php if($status['user_name'] === $user_name): ?> 
    78         <a href="<?php echo $c->baseUrl ?>/status/delete/<?php echo $status['id'] . '/' . $session->token ?>"> 
    79             <img src="img/share/trash_icon.gif" alt="Delete" class="icon16" /></a> 
     127        <a class="delete_link" href="<?php echo $c->baseUrl ?>/status/delete/<?php echo $status['id'] . '/' . $session->token ?>"> 
     128            <img src="img/share/trash_icon.gif" alt="Delete" /></a> 
    80129        <?php else: ?> 
    81130            <a href="<?php echo "{$c->baseUrl}/home?status=@{$status['user_name']}" ?>"><img src="./img/share/reply_icon.gif" /></a>