Skip to content

Commit

Permalink
bisheng: Add menu item -- preview by bisheng
Browse files Browse the repository at this point in the history
  • Loading branch information
zhtengw committed Jan 19, 2020
1 parent 2e23d01 commit 1b46c60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions bisheng/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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'];
Expand All @@ -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.'<br/>'.$sign);
Expand Down
2 changes: 1 addition & 1 deletion bisheng/php/handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ function saveBack() {
}
}
echo "{\"error\":0}";
}
}
10 changes: 5 additions & 5 deletions bisheng/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
//}
}
});

});

0 comments on commit 1b46c60

Please sign in to comment.