* add web client entry button to bottom navbar in index page.
This commit is contained in:
@@ -15,6 +15,24 @@ class myIndex extends index
|
||||
{
|
||||
$this->view->pageBodyClass = 'xxc-embed';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->loadModel('im');
|
||||
|
||||
$xuanConfig = new stdclass();
|
||||
$token = $this->im->userGetAuthToken($this->app->user->id, 'zentaoweb');
|
||||
$clientUrl = isset($this->config->webClientUrl) ? $this->config->webClientUrl : 'data/xuanxuan/web/';
|
||||
|
||||
$xuanConfig->clientUrl = $clientUrl;
|
||||
$xuanConfig->server = $this->im->getServer('zentao');
|
||||
$xuanConfig->account = $this->app->user->account;
|
||||
$xuanConfig->authKey = $token->token;
|
||||
$xuanConfig->debug = $this->config->debug;
|
||||
$xuanConfig->serverTime = (int)(microtime(true) * 1000);
|
||||
$xuanConfig->serverNowTime = (int)round(time() / $tokenAuthWindow);
|
||||
|
||||
$this->view->xuanConfig = $xuanConfig;
|
||||
}
|
||||
|
||||
return parent::index($open);
|
||||
}
|
||||
|
||||
@@ -30,3 +30,23 @@ $(function()
|
||||
});
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(isset($xuanConfig)): ?>
|
||||
<style>
|
||||
#chatBtn {padding: 3px;}
|
||||
#chatBtn .icon {font-size: 24px;}
|
||||
</style>
|
||||
<?php js::import($webRoot . 'data/xuanxuan/sdk/sdk.min.js'); ?>
|
||||
<?php js::import($jsRoot . 'md5.js'); ?>
|
||||
<?php js::set('xuanConfig', $xuanConfig); ?>
|
||||
<script>
|
||||
function showXuanClient()
|
||||
{
|
||||
window.xuan.show();
|
||||
}
|
||||
|
||||
var $chatBtn = $('<a href="javascript:void(0)" id="chatBtn" class="btn btn-link"><i class="text-primary icon icon-chat"></i></a>');
|
||||
$chatBtn.insertBefore('#globalSearchDiv').on('click', showXuanClient);
|
||||
window.xuan = new Xuanxuan($.extend(xuanConfig, {preload: true}));
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
+5
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user