diff --git a/bisheng/app.php b/bisheng/app.php index bcb2270..72da684 100755 --- a/bisheng/app.php +++ b/bisheng/app.php @@ -36,13 +36,13 @@ public function index() { //'mime_type' => mime_content_type($fileName), 'fetchUrl' => $fileUrl, 'callback' => '', + 'opts' => array('pdf_viewer' => ($this->in['viewtype'] == 'pdf')), ), 'user' => array( 'uid' => $_SESSION['kodUser']['userID'], 'nickName' => $_SESSION['kodUser']['nickName'].' ('.$_SESSION['kodUser']['name'].')', 'avatar' => '', 'privilege' => array('FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT',), - 'opts' => array('pdf_viewer' => ($this->in['viewtype'] == 'pdf')), ) ); $timestamp = filemtime($path); @@ -64,7 +64,7 @@ public function index() { array_push($options['user']['privilege'],'FILE_WRITE'); $options['doc']['docId'] = md5($path.$timestamp); $options['doc']['callback'] = $this->pluginHost.'php/handler.php?act=save&path='.$path.'&api='.$config['apiServer']; - $apiServer = $config['apiServer'].'/apps/editor/openEditor?callURL='; + if(!$options['doc']['opts']['pdf_viewer']) $apiServer = $config['apiServer'].'/apps/editor/openEditor?callURL='; } $apiKey = $config['apiKey']; @@ -73,7 +73,7 @@ public function index() { $postUrl = $this->pluginHost.'php/handler.php?act=sent&data='.$data; $callURL = base64_encode($postUrl); if (strlen($apiServer) > 0) { - //print_r(json_encode($options)); + //show_tips(json_encode($options)); if (strlen($apiKey) > 0) { $sign = hash_hmac('md5',$callURL,$apiKey); //show_tips($callURL.'
'.$sign); diff --git a/bisheng/php/handler.php b/bisheng/php/handler.php index 9cb346a..b7e098b 100755 --- a/bisheng/php/handler.php +++ b/bisheng/php/handler.php @@ -30,4 +30,4 @@ function saveBack() { } } echo "{\"error\":0}"; -} +} \ No newline at end of file diff --git a/bisheng/static/main.js b/bisheng/static/main.js index bdee9a2..645ad92 100755 --- a/bisheng/static/main.js +++ b/bisheng/static/main.js @@ -16,7 +16,7 @@ kodReady.push(function() { }); $.contextMenu.menuAdd({ 'viewAsPDF': { - name: "转成PDF查看", + name: "使用毕升预览", className: "viewAsPDF", icon: "{{pluginHost}}static/images/icon.png", callback: function(action, option) { @@ -45,11 +45,11 @@ kodReady.push(function() { var allowExt = "{{config.fileExt}}"; var hideClass = "hidden"; - //if (inArray(allowExt.split(","), ext)) { - // $theMenu.find(".viewAsPDF").removeClass(hideClass); - //} else { + if (inArray(allowExt.split(","), ext)) { + $theMenu.find(".viewAsPDF").removeClass(hideClass); + } else { $theMenu.find(".viewAsPDF").addClass(hideClass); - //} + } }); }); \ No newline at end of file