Merge branch 'sprint/xuanxuan_93' into 'master'

Zentaoclient related changes from xuanxuan sprint 93

See merge request easycorp/zentaopms!2398
This commit is contained in:
朱金勇
2022-03-22 00:55:07 +00:00
5 changed files with 24 additions and 9 deletions
+3 -2
View File
@@ -335,13 +335,14 @@
function hideTab(appCode)
{
var app = openedApps[appCode];
if(!app || !app.show) return;
if(!app) return;
app.$app.trigger('hideapp', app);
if(!app.show) return;
app.$app.hide();
app.show = false;
lastOpenedApp = null;
app.$app.trigger('hideapp', app);
/* Active last app */
var lastApp = getLastApp(true) || getLastApp();
@@ -192,7 +192,7 @@ class xuanxuanIm extends imModel
}
/**
* Merge notifications with same actor, objectType, actionType.
* Merge notifications with same actor, objectType, actionType. Notifications with contentType of 'text' won't be merged.
*
* @param array $notificationData
* @access public
@@ -209,11 +209,16 @@ class xuanxuanIm extends imModel
/* Group by $message->content->content->objectType, ...->parentType, ...->action, ...->actor */
$contentData = json_decode($message->content);
$contentData = json_decode($contentData->content);
if($contentData->contentType == 'text')
{
$messageGroups[$contentData->contentType][] = $message;
continue;
}
$messageGroups["$contentData->objectType-$contentData->parentType-$contentData->action-$contentData->actor"][] = $message;
}
foreach($messageGroups as $groupKey => $messages)
{
if(count($messages) < 2) continue;
if(count($messages) < 2 || $groupKey == 'text') continue;
$notification = current($messages);
array_shift($messages);
@@ -18,6 +18,10 @@ if(window.navigator.userAgent.indexOf('xuanxuan') > 0)
$(document).on('showapp', function(e, app)
{
window.open('xxc://extension.zentao-integrated.activeAppMenuItem/' + app.code);
window.open('xxc://extension.zentao-integrated.activeAppMenuItem/' + encodeURIComponent(JSON.stringify({id: app.code, openedApps:Object.keys($.apps.openedApps)})));
});
$(document).on('hideapp', function(e, app)
{
window.open('xxc://extension.zentao-integrated.hideAppMenuItem/' + encodeURIComponent(JSON.stringify({id: app.code, openedApps:Object.keys($.apps.openedApps)})));
});
}
@@ -23,7 +23,11 @@ updateAppMenu();
$(document).on('showapp', function(e, app)
{
window.open('xxc://extension.zentao-integrated.activeAppMenuItem/' + app.code);
window.open('xxc://extension.zentao-integrated.activeAppMenuItem/' + encodeURIComponent(JSON.stringify({id: app.code, openedApps:Object.keys($.apps.openedApps)})));
});
$(document).on('hideapp', function(e, app)
{
window.open('xxc://extension.zentao-integrated.hideAppMenuItem/' + encodeURIComponent(JSON.stringify({id: app.code, openedApps:Object.keys($.apps.openedApps)})));
});
</script>
<?php else: ?>
@@ -48,7 +52,7 @@ if(isset($this->config->xuanxuan->turnon) && $this->config->xuanxuan->turnon)
<style>
#chatBtn {padding: 3px; position: relative;}
#chatBtn .icon {font-size: 24px;}
#chatNoticeBadge {position: absolute; top: -4px; right: -2px; line-height: 14px; height: 14px; width: 14px; text-align: center; display: block; font-size: 12px; border-radius: 50%; opacity: 0; transform: scale(0); transition: .2s; transition-property: transform, opacity;}
#chatNoticeBadge {position: absolute; top: -4px; right: -2px; line-height: 14px; height: 14px; min-width: 14px; text-align: center; display: inline-block; font-size: 12px; border-radius: 7px; opacity: 0; transform: scale(0); transition: .2s; transition-property: transform, opacity; padding: 0 2px;}
#chatNoticeBadge.show {opacity: 1; transform: scale(1);}
#xx-embed-container {bottom: 40px!important; z-index: 1010!important;}
#xx-embed-container .xx-embed-has-animation {transition: min-width .5s ease-out, min-height .5s ease-out, transform, opacity!important;}
@@ -131,7 +131,8 @@ class xuanxuanMessage extends messageModel
}
$content = json_encode($contentData);
if($target) $this->loadModel('im')->messageCreateNotify($target, $title, $subtitle = '', $content, $contentType = 'object', $url, $actions = array(), $sender = array('id' => 'zentao', 'realname' => $this->lang->message->sender, 'name' => $this->lang->message->sender));
$avatarUrl = $server . $this->app->getWebRoot() . 'favicon.ico';
if($target) $this->loadModel('im')->messageCreateNotify($target, $title, $subtitle = '', $content, $contentType = 'object', $url, $actions = array(), $sender = array('id' => 'zentao', 'realname' => $this->lang->message->sender, 'name' => $this->lang->message->sender, 'avatar' => $avatarUrl));
if($objectType == 'mr' and is_array($this->lang->message->mr->$actionType) and !empty($object->assignee))
{
@@ -139,7 +140,7 @@ class xuanxuanMessage extends messageModel
$content = json_encode($contentData);
$target = $this->dao->select('id')->from(TABLE_USER)->where('account')->eq($object->assignee)->fetch('id');
if($target) $this->loadModel('im')->messageCreateNotify(array($target), $title, $subtitle = '', $content, $contentType = 'object', $url, $actions = array(), $sender = array('id' => 'zentao', 'realname' => $this->lang->message->sender, 'name' => $this->lang->message->sender));
if($target) $this->loadModel('im')->messageCreateNotify(array($target), $title, $subtitle = '', $content, $contentType = 'object', $url, $actions = array(), $sender = array('id' => 'zentao', 'realname' => $this->lang->message->sender, 'name' => $this->lang->message->sender, 'avatar' => $avatarUrl));
}
if($onlybody) $_GET['onlybody'] = $onlybody;