Browse Source

可以查看页面的最后编辑时间和编辑人

star7th 8 years ago
parent
commit
191c826292

+ 6 - 5
Application/Home/View/Item/show_regular.html

@@ -111,8 +111,8 @@
       <!-- 编辑栏 -->
       <div class='page-edit-link pull-right hide'>
         <ul class="inline">
-          <if condition="$ItemPermn">
             <li><a class="btn btn-link" href="" id="share-page" title="{$Think.Lang.share_address_to_your_friends}">{$Think.Lang.share}</a></li>
+          <if condition="$ItemPermn">
                   <li><a class="btn btn-link" href="" id="edit-link" title="{$Think.Lang.edit_interface}">{$Think.Lang.edit}</a></li>
             <li>
               <div class="btn-group">
@@ -122,15 +122,14 @@
                 <ul class="dropdown-menu left-dropdown-menu">
                 <!-- dropdown menu links -->
                   <li><a href="" id="copy-link" title="{$Think.Lang.copy_interface_to_new}">{$Think.Lang.copy}</a></li>
-
+                  <li><a href="" data-page_id= "0" class="show_page_info" title="详情">详情</a></li>
                   <li><a href="" title="{$Think.Lang.delete_interface}" onclick="return confirm('{$Think.Lang.comfirm_delete}');return false;" id="delete-link">{$Think.Lang.delete}</a></li>
 
                 </ul>
               </div>
             </li>
           <else />
-            <li></li>
-            <li></li>
+              <li><a href="" data-page_id= "0" class="show_page_info" title="详情">详情</a></li>
         </if>
         </ul>
       </div>
@@ -176,9 +175,11 @@
     </p>
   </div>
 </div>
+
+
 <script src="__PUBLIC__/js/jquery.bootstrap-growl.min.js"></script>
 <script src="__PUBLIC__/js/jquery.goup.min.js"></script>
 <script src="__PUBLIC__/js/jquery.hotkeys.js"></script>
 <script src="__PUBLIC__/jquery.zclip/jquery.zclip.js"></script>
 
-<script src="__PUBLIC__/js/item/show.js?v=1.21212345678901"></script>
+<script src="__PUBLIC__/js/item/show.js?v=1.212123456789012"></script>

+ 16 - 1
Public/js/item/show.js

@@ -157,7 +157,7 @@ $(function(){
 
       $("#qr-page-link").attr("src","?s=home/common/qrcode&size=3&url="+cur_page_url);
       $("#qr-single-link").attr("src","?s=home/common/qrcode&size=3&url="+single_page_url);
-
+      $(".show_page_info").data("page_id",page_id);
       var html = '<iframe id="page-content" width="100%" scrolling="yes"  height="100%" frameborder="0" style=" overflow:visible; height:100%;" name="main"  seamless ="seamless"src="'+iframe_url+'"></iframe>';
       $(".iframe_content").html(html);
       iFrameHeight();
@@ -280,6 +280,21 @@ function iFrameHeight() { 
     });
   }
 
+  $(".show_page_info").click(function(){
+    var page_id =  $(this).data("page_id") ;
+    $.post(
+      DocConfig.server+"/api/page/info",
+      {page_id,page_id},
+      function(data){
+        var html = "<p>最后编辑时间:"+data.data.addtime+"</p><p>编辑人:"+data.data.author_username+"</p>";
+         layer.alert(html);
+      },
+      "json"
+
+      );
+    return false;
+  });
+  
 })
 
 

+ 23 - 0
server/Application/Api/Controller/PageController.class.php

@@ -0,0 +1,23 @@
+<?php
+namespace Api\Controller;
+use Think\Controller;
+class PageController extends BaseController {
+
+    //页面详情
+    public function info(){
+        $page_id = I("page_id/d");
+        $page = D("Page")->where(" page_id = '$page_id' ")->find();
+        $login_user = $this->checkLogin(false);
+        if (!$this->checkItemVisit($login_user['uid'] , $page['item_id'])) {
+            $this->sendError(10303);
+            return;
+        }
+        $page = $page ? $page : array();
+        if ($page) {
+           unset($page['page_content']);
+           $page['addtime'] = date("Y-m-d H:i:s",$page['addtime']);
+        }
+        $this->sendResult($page);
+    }
+
+}