export default {
descMapMake:function(){
/**
* +空=自己操作事件
* +item=某个子文件夹事件;
* +more=该文件夹多条事件;
* ----
* +current=该文件夹子内容事件
* +more-at=子文件夹多条事件;
* +more-self=该文件(夹)多条事件
*
* ----
* value为字符串: 则有动作描述;没有动作内容;
* value为数组,2项时; 1为动作描述;2为动作内容; 取值自file;
* value为数组,3项时; 1为动作描述;2为动作内容; 取值自循环的group的内容;
*/
var map = {
'create-mkdir':'新建了该文件夹',
'create-mkfile':'新建了该文件',
'create-upload':'上传了该文件',
'create-copy':'粘贴创建了该文件',
'create-mkdir-current':'在此新建了文件夹{{file}}',
'create-mkfile-current':'在此新建了文件{{file}}',
'create-upload-current':'在此上传了{{file}}',
'create-copy-current':'粘贴了{{file}}到此处',
'create-mkdir-item':'在{{parent}}新建了文件夹{{file}}',
'create-mkfile-item':'在{{parent}}新建了文件{{file}}',
'create-upload-item':'在{{parent}}上传了{{file}}',
'create-copy-item':'粘贴{{file}}到{{parent}}',
'create-mkdir-more':['在此新建了{{count}}个文件夹','{{file}}',1],
'create-mkfile-more':['在此新建了{{count}}个文件','{{file}}',1],
'create-upload-more':['在此上传了上传了{{count}}个文件','{{file}}',1],
'create-copy-more':['粘贴了{{count}}个文件到此处','{{file}}',1],
'create-mkdir-more-at':['在{{parent}}新建了{{count}}个文件夹','{{file}}',1],
'create-mkfile-more-at':['在{{parent}}新建了{{count}}个文件','{{file}}',1],
'create-upload-more-at':['在{{parent}}上传了{{count}}个文件','{{file}}',1],
'create-copy-more-at':['粘贴了{{count}}个文档到{{parent}}','{{file}}',1],
'edit':'更新了该文件',
'edit-item':'编辑更新了{{file}}',
'edit-more':['编辑更新了{{count}}个文件','{{file}}{{fromDevice}}',1],
'edit-more-at':['在{{parent}}编辑更新了{{count}}个文件','{{file}} {{fromDevice}} {{timeShow}}',1],
'edit-more-self':['edit','{{timeShow}} {{fromDevice}}',1],
'move':'将该文档从{{desc.from}}移动到{{desc.to}}',
'move-item':'将{{file}}从{{desc.from}}移动到{{desc.to}}',
'move-current':'将{{file}}从{{desc.from}}移动到此处',
'move-more':['移动了{{count}}个文档',"将{{file}}从{{desc.from}}移动到{{desc.to}}",1],
'move-more-self':[LNG['log-type-move'],"move",1],
'moveOut':'从此处移走了{{desc.sourceID}}',
'moveOut-item':'从{{file}}移走了{{desc.sourceID}}',
'moveOut-more':['移走了{{count}}个文档',"从{{file}}移走了{{desc.sourceID}}",1],
'share-shareLinkAdd':'将该文档创建了外链分享',
'share-shareLinkAdd-item':'将{{file}}创建了外链分享',
'share-shareLinkAdd-more':['创建了{{count}}个外链分享',"{{file}}",1],
'share-shareToAdd':'将该文档开启了协作分享',
'share-shareToAdd-item':'将{{file}}开启了协作分享',
'share-shareToAdd-more':['创建了{{count}}个协作分享',"{{file}}",1],
'share-shareLinkRemove':'关闭了该文档的外链分享',
'share-shareLinkRemove-item':'关闭了{{file}}的外链分享',
'share-shareLinkRemove-more':['关闭{{count}}个外链分享',"{{file}}",1],
'share-shareToRemove':'关闭了该文档的协作分享',
'share-shareToRemove-item':'关闭了{{file}}的协作分享',
'share-shareToRemove-more':['关闭{{count}}个协作分享',"{{file}}",1],
'share-shareEdit':'编辑了该文档的分享',
'share-shareEdit-item':'编辑了{{file}}的分享',
'share-shareEdit-more':['编辑了{{count}}个文档分享',"{{file}}",1],
'share-shareEdit-more-self':['share-shareEdit',"{{timeShow}}",1],
'rename':['重命名了该文档','{{desc.from}}<em></em>{{desc.to}}'],
'rename-item':['重命名了{{file}}','{{desc.from}}<em></em>{{desc.to}}'],
'rename-more':['重命名了{{count}}个文档','{{file}}:{{desc.from}}<em></em>{{desc.to}}',1],
'rename-more-self':['rename','{{timeShow}}: {{desc.from}}<em></em>{{desc.to}}',1],
'recycle-toRecycle':'将该文档移到了回收站',
'recycle-toRecycle-current':'在此处将{{file}}移到了回收站',
'recycle-toRecycle-item':'在{{parent}}将{{file}}移到了回收站',
'recycle-toRecycle-more':['将{{count}}个文档移到了回收站',"{{file}}",1],
'recycle-toRecycle-more-at':['在{{parent}}将{{count}}个文档移到了回收站',"{{file}}",1],
'recycle-restore':'将该文档从回收站还原',
'recycle-restore-item':'将{{file}}从回收站还原',
'recycle-restore-more':['将{{count}}个文档从回收站还原',"{{file}}",1],
'remove':'删除了{{desc.content}}',
'remove-current':'在此处删除了{{desc.content}}',
'remove-more':['在此处删除了{{count}}个文档','{{desc.content}}',1],
'remove-item':'在{{parent}}删除了{{desc.content}}',
'remove-more-at':['在{{parent}}删除了{{count}}个文档','{{desc.content}}',1],
'addDesc':['修改了该文档描述','{{desc.content}}'],
'addDesc-item':['修改了{{file}}文档描述','{{desc.content}}'],
'addDesc-more':['修改了{{count}}个文档描述','{{file}}<em></em>{{desc.content}}',1],
'addDesc-more-self':['addDesc','{{timeShow}}: <em></em>{{desc.content}}',1],
// 暂未加入;
'addComment':['在该文档发表了评论','{{desc.content}}'],
'addComment-item':['在{{file}}发表了评论','{{desc.content}}',1],
'addComment-more':['在{{file}}发表了{{count}}条评论','{{file}}<em></em>{{desc.content}}',1],
'addComment-more-self':['addComment','{{timeShow}}: <em></em>{{desc.content}}',1],
};
var actionDesc = {
'create-mkdir':'新建文件夹',
'create-mkfile':'新建文件',
'create-upload':'上传文件',
'create-copy':'粘贴文件',
'edit':'更新文件',
'move':'移动文件',
'moveOut':'移走文件',
'share-shareLinkAdd':'创建了外链分享',
'share-shareToAdd':'开启了协作分享',
'share-shareLinkRemove':'关闭的外链分享',
'share-shareToRemove':'关闭协作分享',
'share-shareEdit':'编辑分享',
'rename':'重命名',
'recycle-toRecycle':'移到回收站',
'recycle-restore':'从回收站还原',
'remove':'删除',
'addDesc':'修改描述',
'addComment':'发表评论',
};
// 多语言处理;
this._each(map,function(value,key){
if(_.isString(value)){value = [value];map[key] = value;}
value[0] = this.lang(key,value[0]);
if(value[0] && map[value[0]]){value[0] = this.lang(value[0],map[value[0]][0]);} // 支持引用key;
if(value[1] && map[value[1]]){value[1] = this.lang(value[1],map[value[1]][0]);}
if(value[1] && LNG['log-event-'+key+'-desc']){value[1] = this.lang(key+'-desc',value[1]);}
});
this._each(actionDesc,function(value,key){
actionDesc[key] = LNG['log-type-'+key];
});
return {map:map,descTitle:actionDesc};
},
// 将%s 替换为标记占位符; (多语言存储时将标记占位符统一替换为了%s);
lang:function(logType,displayText){
var text = LNG['log-event-'+logType] || displayText;
var match = displayText.match(/({{[\w\d\.]*}})/g);
if(!match) return text;
for (var i = 0; i < match.length; i++) {
text = text.replace('['+(i+1)+']',match[i]);
}
return text;
},
}