提交 6de390e2 编写于 作者: 傻拖

增加wps、onlyoffice组件

上级 efd3f7ae
......@@ -217,6 +217,16 @@
"text": "yozoOffice",
"className": "YozoOffice"
},
"onlyOffice": {
"icon": "onlyOffice.png",
"text": "onlyOffice",
"className": "OnlyOffice"
},
"wpsOffice": {
"icon": "wpsOffice.png",
"text": "wpsOffice",
"className": "WpsOffice"
},
"statementSelector": {
"icon": "statementSelector.png",
"text": MWF.xApplication.process.FormDesigner.LP.modules.statementSelector,
......
MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
MWF.xApplication.process.FormDesigner.Module.OnlyOffice = MWF.FCOnlyOffice = new Class({
Extends: MWF.FC$Element,
Implements: [Options, Events],
options: {
"style": "default",
"propertyPath": "../x_component_process_FormDesigner/Module/OnlyOffice/onlyoffice.html"
},
initialize: function(form, options){
this.setOptions(options);
this.path = "../x_component_process_FormDesigner/Module/OnlyOffice/";
this.cssPath = "../x_component_process_FormDesigner/Module/OnlyOffice/"+this.options.style+"/css.wcss";
this._loadCss();
this.moduleType = "element";
this.moduleName = "onlyoffice";
this.form = form;
this.container = null;
this.containerNode = null;
},
_createMoveNode: function(){
// var flag = false;
// this.form.moduleList.each(function (module){
// if(module.moduleName === "onlyoffice"){
// flag = true;
// }
// }.bind(this));
// if(flag){
// this.form.designer.notice( "表单中只允许有一个OnlyOffice控件", "error", this.form.container );
// return false;
// }
this.moveNode = new Element("div", {
"MWFType": "onlyoffice",
"id": this.json.id,
"styles": this.css.moduleNodeMove,
"events": {
"selectstart": function(){
return false;
}
}
}).inject(this.form.container);
},
_createNode: function(){
this.node = this.moveNode.clone(true, true);
this.node.setStyles(this.css.moduleNode);
this.node.set("id", this.json.id);
this.node.addEvent("selectstart", function(){
return false;
});
if(!layout.serviceAddressList["x_onlyofficefile_assemble_control"]){
this.tipNode = new Element("div").inject(this.node);
this.tipNode.set("html","<h3><font color=red>请先安装onlyoffice应用</font></h3>");
}
this.iconNode = new Element("div", {
"styles": this.css.iconNode
}).inject(this.node);
var icon = new Element("div", {
"styles": this.css.iconNodeIcon
}).inject(this.iconNode);
var text = new Element("div", {
"styles": this.css.iconNodeText,
"text": "OnlyOffice"
}).inject(this.iconNode);
this.setIcon();
},
_loadNodeStyles: function(){
this.iconNode = this.node.getElement("div").setStyles(this.css.iconNode);
this.iconNode.getFirst("div").setStyles(this.css.iconNodeIcon);
this.iconNode.getLast("div").setStyles(this.css.iconNodeText);
this.setIcon();
},
setIconNode: function(img, txt, color, width){
if (this.iconNode){
this.iconNode.setStyle("width", width);
var icon = this.iconNode.getFirst();
var text = this.iconNode.getLast();
icon.setStyle("background-image", "url("+this.path+this.options.style+"/icon/"+img+".png)");
text.set("text", txt);
text.setStyles({
"color": color,
"width": width-34
});
}
},
setIcon: function(){
if (this.json.officeType=="docx"){
this.setIconNode("docx", "Word", "#2b5797", 90);
}
if (this.json.officeType=="xlsx"){
this.setIconNode("xlsx", "Excel", "#1e7145", 86);
}
if (this.json.officeType=="pptx"){
this.setIconNode("pptx", "PowerPoint", "#d04525", 130);
}
if (this.json.officeType=="other"){
this.setIconNode("office", "Office", "#f36523", 96);
}
},
_setEditStyle_custom: function(name){
if (name=="officeType"){
this.setIcon();
}
}
});
{
"moduleNodeMove": {
"border": "2px dashed #ffa200",
"height": "22px",
"line-height": "22px",
"overflow": "hidden",
"margin": "3px",
"display": "block",
"-webkit-user-select": "none",
"-moz-user-select": "none",
"position": "absolute",
"z-index": 10002,
"opacity": 0.7,
"width": "100px",
"cursor": "move",
"background-color": "#EEE"
},
"moduleNodeShow": {
"border": "1px dashed #333",
"height": "2px",
"cursor": "pointer",
"line-height": "22px",
"overflow": "hidden",
"margin": "3px",
"-webkit-user-select": "none",
"-moz-user-select": "none",
"position": "static",
"display": "block",
"top": "auto",
"left": "auto",
"width": "auto",
"opacity": 0.5,
"background": "#ffa200"
},
"moduleNode": {
"border": "1px dashed #333",
"min-height": "300px",
"cursor": "pointer",
"line-height": "22px",
"overflow": "hidden",
"margin": "3px",
"-webkit-user-select": "none",
"-moz-user-select": "none",
"position": "static",
"display": "block",
"top": "auto",
"left": "auto",
"width": "auto",
"opacity": 1,
"background-color": "#ffffff"
},
"iconNode": {
"width": "100px",
"height": "34px",
"color": "#999",
"font-size": "12px",
"margin": "auto",
"margin-top": "36px",
// "background": "#FFF",
"position": "static",
"float": "none"
},
"iconNodeIcon":{
"width": "34px",
"height": "34px",
"background": "url("+"../x_component_process_FormDesigner/Module/OnlyOffice/default/icon/office.png) 5px center no-repeat",
"float": "left"
},
"iconNodeText":{
"line-height": "34px",
"height": "34px",
"width": "66px",
"float": "right",
"font-family": "Gadugi",
"font-weight": "bold",
"font-size": "16px",
"color": "#f36523"
}
}
\ No newline at end of file
<div style="background-color: #FFF; overflow: hidden">
<div title="基本" class="MWFTab">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">标识:</td>
<td class="editTableValue"><input type="text" name="id" value="text{$.id}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">名称:</td>
<td class="editTableValue"><input type="text" name="companyName" value="text{$.companyName}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">描述:</td>
<td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">是否只读:</td>
<td class="editTableValue">
<input type="radio" name="isReadonly" value="true" text{($.isReadonly)?'checked':''}/>
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>
</td>
</tr>
</table>
<div class="MWFMaplist" name="styles" title="样式"></div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">类型:</td>
<td class="editTableValue">
<input class="editTableRadio" onclick="if (this.checked) $('officeTemplateArea').setStyle('display', 'none'); " name="officeType" text{($.officeType=='docx')?'checked':''} type="radio" value="docx"/>Word 文档<br/>
<input class="editTableRadio" onclick="if (this.checked) $('officeTemplateArea').setStyle('display', 'none'); " name="officeType" text{($.officeType=='xlsx')?'checked':''} type="radio" value="xlsx"/>Excel 电子表格<br/>
<input class="editTableRadio" onclick="if (this.checked) $('officeTemplateArea').setStyle('display', 'none'); " name="officeType" text{($.officeType=='pptx')?'checked':''} type="radio" value="pptx"/>PowerPoint 幻灯片<br/>
</td>
</tr>
</table>
<div class="MWFScriptArea" name="readScript" title="满足条件时只读 (S)"></div>
</div>
<div title="配置" class="MWFTab">
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">功能设置</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">自动保存:</td>
<td class="editTableValue">
<input type="radio" name="autosave" value="true" text{($.autosave)?'checked':''}/>
<input type="radio" name="autosave" value="false" text{(!$.autosave)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">启用聊天:</td>
<td class="editTableValue">
<input type="radio" name="chat" value="true" text{($.chat)?'checked':''}/>
<input type="radio" name="chat" value="false" text{(!$.chat)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">开启评论:</td>
<td class="editTableValue">
<input type="radio" name="comments" value="true" text{($.comments)?'checked':''}/>
<input type="radio" name="comments" value="false" text{(!$.comments)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">兼容旧版本:</td>
<td class="editTableValue">
<input type="radio" name="compatibleFeatures" value="true" text{($.compatibleFeatures)?'checked':''}/>
<input type="radio" name="compatibleFeatures" value="false" text{(!$.compatibleFeatures)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">强制保存:</td>
<td class="editTableValue">
<input type="radio" name="forcesave" value="true" text{($.forcesave)?'checked':''}/>
<input type="radio" name="forcesave" value="false" text{(!$.forcesave)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">启用插件:</td>
<td class="editTableValue">
<input type="radio" name="plugins" value="true" text{($.plugins)?'checked':''}/>
<input type="radio" name="plugins" value="false" text{(!$.plugins)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">修订显示方式:</td>
<td class="editTableValue">
<input type="radio" name="reviewDisplay" value="markup" text{$.reviewDisplay=='markup'||!$.reviewDisplay ?'checked':''}/>标记
<input type="radio" name="reviewDisplay" value="final" text{$.reviewDisplay=='final'?'checked':''}/>最终版
<input type="radio" name="reviewDisplay" value="original" text{$.reviewDisplay=='original'?'checked':''}/>原始
</td>
</tr>
<tr>
<td class="editTableTitle">显示跟踪变化:</td>
<td class="editTableValue">
<input type="radio" name="showReviewChanges" value="true" text{($.showReviewChanges)?'checked':''}/>
<input type="radio" name="showReviewChanges" value="false" text{(!$.showReviewChanges)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">打开审阅编辑模式:</td>
<td class="editTableValue">
<input type="radio" name="trackChanges" value="true" text{($.trackChanges)?'checked':''}/>
<input type="radio" name="trackChanges" value="false" text{(!$.trackChanges)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">拼写检查:</td>
<td class="editTableValue">
<input type="radio" name="spellcheck" value="true" text{($.spellcheck)?'checked':''}/>
<input type="radio" name="spellcheck" value="false" text{(!$.spellcheck)?'checked':''}/>
</td>
</tr>
</table>
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">界面设置</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">隐藏编辑器头:</td>
<td class="editTableValue">
<input type="radio" name="compactHeader" value="true" text{($.compactHeader)?'checked':''}/>
<input type="radio" name="compactHeader" value="false" text{(!$.compactHeader)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">紧凑型工具栏:</td>
<td class="editTableValue">
<input type="radio" name="compactToolbar" value="true" text{($.compactToolbar)?'checked':''}/>
<input type="radio" name="compactToolbar" value="false" text{(!$.compactToolbar)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">是否显示反馈:</td>
<td class="editTableValue">
<input type="radio" name="feedback" value="true" text{($.feedback)?'checked':''}/>
<input type="radio" name="feedback" value="false" text{(!$.feedback)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">是否显示帮助:</td>
<td class="editTableValue">
<input type="radio" name="help" value="true" text{($.help)?'checked':''}/>
<input type="radio" name="help" value="false" text{(!$.help)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">标题栏是否显示文件名:</td>
<td class="editTableValue">
<input type="radio" name="toolbarHideFileName" value="true" text{($.toolbarHideFileName)?'checked':''}/>
<input type="radio" name="toolbarHideFileName" value="false" text{(!$.toolbarHideFileName)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">顶部工具栏是否高亮显示:</td>
<td class="editTableValue">
<input type="radio" name="toolbarNoTabs" value="true" text{($.toolbarNoTabs)?'checked':''}/>
<input type="radio" name="toolbarNoTabs" value="false" text{(!$.toolbarNoTabs)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">标尺测量单位</td>
<td class="editTableValue">
<input type="radio" name="unit" value="cm" text{$.unit=='cm'||!$.unit ?'checked':''}/>厘米
<input type="radio" name="unit" value="pt" text{$.unit=='pt'?'checked':''}/>像素
<input type="radio" name="unit" value="inch" text{$.unit=='inch'?'checked':''}/>英寸
</td>
</tr>
<tr>
<td class="editTableTitle">默认缩放</td>
<td class="editTableValue">
<input type="text" name="zoom" value="text{!$.zoom?'100':$.zoom}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">隐藏侧栏:</td>
<td class="editTableValue">
<input type="radio" name="hideRightMenu" value="true" text{($.hideRightMenu)?'checked':''}/>
<input type="radio" name="hideRightMenu" value="false" text{(!$.hideRightMenu)?'checked':''}/>
</td>
</tr>
</table>
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">个性化信息</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">地址:</td>
<td class="editTableValue">
<input type="text" name="address" value="text{$.address}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">简介:</td>
<td class="editTableValue">
<input type="text" name="info" value="text{$.info}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">logo:</td>
<td class="editTableValue">
<input type="text" name="logo" value="text{$.logo}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">邮箱:</td>
<td class="editTableValue">
<input type="text" name="mail" value="text{$.mail}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">公司名字:</td>
<td class="editTableValue">
<input type="text" name="name" value="text{$.name}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">网址:</td>
<td class="editTableValue">
<input type="text" name="www" value="text{$.www}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">反馈地址:</td>
<td class="editTableValue">
<input type="text" name="feedbackUrl" value="text{$.feedbackUrl}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">左上角logo(172x40):</td>
<td class="editTableValue">
<input type="text" name="logoImg" value="text{$.logoImg}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">logo链接:</td>
<td class="editTableValue">
<input type="text" name="logoUrl" value="text{$.logoUrl}" class="editTableInput"/>
</td>
</tr>
</table>
</div>
<div title="事件" class="MWFTab">
<div class="MWFEventsArea" name="events"></div>
</div>
<div title="HTML" class="MWFTab">
<div class="MWFHTMLArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
</div>
<div title="JSON" class="MWFTab">
<div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
</div>
</div>
{
"id": "",
"name": "",
"type": "OnlyOffice",
"description": "",
"officeType": "docx",
"template": "",
"isNotLoadNow": false,
"autosave": true,
"chat": false,
"comments":false,
"compatibleFeatures": true,
"forcesave": true,
"plugins": true,
"reviewDisplay": "markup",
"showReviewChanges": false,
"trackChanges": false,
"spellcheck": false,
"compactHeader": false,
"compactToolbar": false,
"feedback": false,
"help": false,
"toolbarHideFileName": false,
"toolbarNoTabs": false,
"unit": "cm",
"zoom": 100,
"hideRightMenu": false,
"script": {
"code": "",
"html": ""
},
"events": {
"afterOpen": {
"code": "",
"html": ""
},
"beforeOpen": {
"code": "",
"html": ""
},
"afterSave": {
"code": "",
"html": ""
}
},
"properties": {},
"class": "",
"styles": {},
"container": ""
}
......@@ -41,6 +41,8 @@ MWF.xDesktop.requireApp("process.FormDesigner", "Module.Htmleditor", null, false
MWF.xDesktop.requireApp("process.FormDesigner", "Module.Office", null, false);
MWF.xDesktop.requireApp("process.FormDesigner", "Module.IWebOffice", null, false);
MWF.xDesktop.requireApp("process.FormDesigner", "Module.YozoOffice", null, false);
MWF.xDesktop.requireApp("process.FormDesigner", "Module.OnlyOffice", null, false);
MWF.xDesktop.requireApp("process.FormDesigner", "Module.WpsOffice", null, false);
MWF.xDesktop.requireApp("process.FormDesigner", "Module.Attachment", null, false);
MWF.xDesktop.requireApp("process.FormDesigner", "Module.Orgfield", null, false);
MWF.xDesktop.requireApp("process.FormDesigner", "Module.Org", null, false);
......
MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
MWF.xApplication.process.FormDesigner.Module.WpsOffice = MWF.FCWpsOffice = new Class({
Extends: MWF.FC$Element,
Implements: [Options, Events],
options: {
"style": "default",
"propertyPath": "../x_component_process_FormDesigner/Module/WpsOffice/wpsoffice.html"
},
initialize: function(form, options){
this.setOptions(options);
this.path = "../x_component_process_FormDesigner/Module/WpsOffice/";
this.cssPath = "../x_component_process_FormDesigner/Module/WpsOffice/"+this.options.style+"/css.wcss";
this._loadCss();
this.moduleType = "element";
this.moduleName = "wpsoffice";
this.form = form;
this.container = null;
this.containerNode = null;
},
_createMoveNode: function(){
this.moveNode = new Element("div", {
"MWFType": "wpsoffice",
"id": this.json.id,
"styles": this.css.moduleNodeMove,
"events": {
"selectstart": function(){
return false;
}
}
}).inject(this.form.container);
},
_createNode: function(){
this.node = this.moveNode.clone(true, true);
this.node.setStyles(this.css.moduleNode);
this.node.set("id", this.json.id);
this.node.addEvent("selectstart", function(){
return false;
});
if(!layout.serviceAddressList["x_wps_assemble_control"]){
this.tipNode = new Element("div").inject(this.node);
this.tipNode.set("html","<h3><font color=red>请先安装wps应用</font></h3>");
}
this.iconNode = new Element("div", {
"styles": this.css.iconNode
}).inject(this.node);
var icon = new Element("div", {
"styles": this.css.iconNodeIcon
}).inject(this.iconNode);
var text = new Element("div", {
"styles": this.css.iconNodeText,
"text": "WpsOffice"
}).inject(this.iconNode);
this.setIcon();
},
_loadNodeStyles: function(){
this.iconNode = this.node.getElement("div").setStyles(this.css.iconNode);
this.iconNode.getFirst("div").setStyles(this.css.iconNodeIcon);
this.iconNode.getLast("div").setStyles(this.css.iconNodeText);
this.setIcon();
},
setIconNode: function(img, txt, color, width){
if (this.iconNode){
this.iconNode.setStyle("width", width);
var icon = this.iconNode.getFirst();
var text = this.iconNode.getLast();
icon.setStyle("background-image", "url("+this.path+this.options.style+"/icon/"+img+".png)");
text.set("text", txt);
text.setStyles({
"color": color,
"width": width-34
});
}
},
setIcon: function(){
if (this.json.officeType=="word"){
this.setIconNode("word", "Word", "#2b5797", 90);
}
if (this.json.officeType=="excel"){
this.setIconNode("excel", "Excel", "#1e7145", 86);
}
if (this.json.officeType=="ppt"){
this.setIconNode("ppt", "PowerPoint", "#d04525", 130);
}
if (this.json.officeType=="other"){
this.setIconNode("office", "Office", "#f36523", 96);
}
},
_setEditStyle_custom: function(name){
if (name=="officeType"){
this.setIcon();
}
}
});
{
"moduleNodeMove": {
"border": "2px dashed #ffa200",
"height": "22px",
"line-height": "22px",
"overflow": "hidden",
"margin": "3px",
"display": "block",
"-webkit-user-select": "none",
"-moz-user-select": "none",
"position": "absolute",
"z-index": 10002,
"opacity": 0.7,
"width": "100px",
"cursor": "move",
"background-color": "#EEE"
},
"moduleNodeShow": {
"border": "1px dashed #333",
"height": "2px",
"cursor": "pointer",
"line-height": "22px",
"overflow": "hidden",
"margin": "3px",
"-webkit-user-select": "none",
"-moz-user-select": "none",
"position": "static",
"display": "block",
"top": "auto",
"left": "auto",
"width": "auto",
"opacity": 0.5,
"background": "#ffa200"
},
"moduleNode": {
"border": "1px dashed #333",
"min-height": "300px",
"cursor": "pointer",
"line-height": "22px",
"overflow": "hidden",
"margin": "3px",
"-webkit-user-select": "none",
"-moz-user-select": "none",
"position": "static",
"display": "block",
"top": "auto",
"left": "auto",
"width": "auto",
"opacity": 1,
"background-color": "#ffffff"
},
"iconNode": {
"width": "100px",
"height": "34px",
"color": "#999",
"font-size": "12px",
"margin": "auto",
"margin-top": "36px",
// "background": "#FFF",
"position": "static",
"float": "none"
},
"iconNodeIcon":{
"width": "34px",
"height": "34px",
"background": "url("+"../x_component_process_FormDesigner/Module/OnlyOffice/default/icon/office.png) 5px center no-repeat",
"float": "left"
},
"iconNodeText":{
"line-height": "34px",
"height": "34px",
"width": "66px",
"float": "right",
"font-family": "Gadugi",
"font-weight": "bold",
"font-size": "16px",
"color": "#f36523"
}
}
\ No newline at end of file
{
"id": "",
"name": "",
"type": "WpsOffice",
"description": "",
"officeType": "word",
"template": "",
"isNotLoadNow": false,
"isShowTopArea" : true,
"isShowHeader" : true,
"isShowComment" : false,
"isCooperUsersAvatarVisible" : false,
"showMode" : "normal",
"isBrowserViewFullscreen" : false,
"isIframeViewFullscreen" : false,
"isShowDocMap" : true,
"isBestScale" : false,
"isShowBottomStatusBar" : true,
"isOpenIntoEdit" : false,
"HeaderLeft": true,
"HeaderRight": true,
"FloatQuickHelp": true,
"HistoryVersion": true,
"HistoryRecord": true,
"HistoryVersionDivider": true,
"TabPrintPreview": true,
"MenuPrintPreview": true,
"ReviewTrackChanges": true,
"TrackChanges": true,
"ContextMenuConvene": true,
"Logo": true,
"Cooperation": true,
"More": true,
"SendButton": true,
"CooperHistoryMenuItem": true,
"WriterHoverToolbars": true,
"ReadSetting": true,
"script": {
"code": "",
"html": ""
},
"events": {
"afterOpen": {
"code": "",
"html": ""
},
"beforeOpen": {
"code": "",
"html": ""
},
"afterSave": {
"code": "",
"html": ""
}
},
"properties": {},
"class": "",
"styles": {},
"container": ""
}
<div style="background-color: #FFF; overflow: hidden">
<div title="基本" class="MWFTab">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">标识:</td>
<td class="editTableValue"><input type="text" name="id" value="text{$.id}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">名称:</td>
<td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">描述:</td>
<td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">是否只读:</td>
<td class="editTableValue">
<input type="radio" name="isReadonly" value="true" text{($.isReadonly)?'checked':''}/>
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>
</td>
</tr>
<!-- <tr>-->
<!-- <td class="editTableTitle">延时加载:</td>-->
<!-- <td class="editTableValue">-->
<!-- <input type="radio" name="isNotLoadNow" value="true" text{($.isNotLoadNow)?'checked':''}/>是-->
<!-- <input type="radio" name="isNotLoadNow" value="false" text{(!$.isNotLoadNow)?'checked':''}/>否-->
<!-- </td>-->
<!-- </tr>-->
</table>
<div class="MWFMaplist" name="styles" title="样式"></div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">类型:</td>
<td class="editTableValue">
<input class="editTableRadio" onclick="if (this.checked) $('officeTemplateArea').setStyle('display', 'none'); " name="officeType" text{($.officeType=='word')?'checked':''} type="radio" value="word"/>Word 文档<br/>
<input class="editTableRadio" onclick="if (this.checked) $('officeTemplateArea').setStyle('display', 'none'); " name="officeType" text{($.officeType=='excel')?'checked':''} type="radio" value="excel"/>Excel 电子表格<br/>
<input class="editTableRadio" onclick="if (this.checked) $('officeTemplateArea').setStyle('display', 'none'); " name="officeType" text{($.officeType=='ppt')?'checked':''} type="radio" value="ppt"/>PowerPoint 幻灯片<br/>
</td>
</tr>
</table>
<div id="officeTemplateArea" title="src" style="display: text{($.officeType=='other')?'block':'none'}">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">模板标识:</td>
<td class="editTableValue">
<input type="text" name="template" value="text{$.template}" class="editTableInput"/>
</td>
</tr>
</table>
</div>
<div class="MWFScriptArea" name="readScript" title="满足条件时只读 (S)"></div>
</div>
<div title="配置" class="MWFTab">
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">通用选项</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">顶部区域:</td>
<td class="editTableValue">
<input type="radio" name="isShowTopArea" value="true" text{($.isShowTopArea)?'checked':''}/>显示
<input type="radio" name="isShowTopArea" value="false" text{(!$.isShowTopArea)?'checked':''}/>隐藏
</td>
</tr>
<tr>
<td class="editTableTitle">头部区域:</td>
<td class="editTableValue">
<input type="radio" name="isShowHeader" value="true" text{($.isShowHeader)?'checked':''}/>显示
<input type="radio" name="isShowHeader" value="false" text{(!$.isShowHeader)?'checked':''}/>隐藏
</td>
</tr>
<tr>
<td class="editTableTitle">评论:</td>
<td class="editTableValue">
<input type="radio" name="isShowComment" value="true" text{($.isShowComment)?'checked':''}/>显示
<input type="radio" name="isShowComment" value="false" text{(!$.isShowComment)?'checked':''}/>隐藏
</td>
</tr>
<tr>
<td class="editTableTitle">头像:</td>
<td class="editTableValue">
<input type="radio" name="isCooperUsersAvatarVisible" value="true" text{($.isCooperUsersAvatarVisible)?'checked':''}/>显示
<input type="radio" name="isCooperUsersAvatarVisible" value="false" text{(!$.isCooperUsersAvatarVisible)?'checked':''}/>隐藏
</td>
</tr>
<tr>
<td class="editTableTitle">显示模式:</td>
<td class="editTableValue">
<input type="radio" name="showMode" value="normal" text{($.showMode=='normal')||(!$.showMode)?'checked':''}/>普通模式, 展示所有功能界面
<br>
<input type="radio" name="showMode" value="simple" text{($.showMode=='simple')?'checked':''}/>极简模式, 不显示头部和工具栏
</td>
</tr>
<tr>
<td class="editTableTitle">浏览器区域全屏:</td>
<td class="editTableValue">
<input type="radio" name="isBrowserViewFullscreen" value="true" text{($.isBrowserViewFullscreen)?'checked':''}/>
<input type="radio" name="isBrowserViewFullscreen" value="false" text{(!$.isBrowserViewFullscreen)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">在iframe区域内全屏:</td>
<td class="editTableValue">
<input type="radio" name="isIframeViewFullscreen" value="true" text{($.isIframeViewFullscreen)?'checked':''}/>
<input type="radio" name="isIframeViewFullscreen" value="false" text{(!$.isIframeViewFullscreen)?'checked':''}/>
</td>
</tr>
</table>
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">Word配置项</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">是否开启目录功能:</td>
<td class="editTableValue">
<input type="radio" name="isShowDocMap" value="true" text{($.isShowDocMap)?'checked':''}/>
<input type="radio" name="isShowDocMap" value="false" text{(!$.isShowDocMap)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">打开文档时,默认以最佳比例显示(PC):</td>
<td class="editTableValue">
<input type="radio" name="isBestScale" value="true" text{($.isBestScale)?'checked':''}/>
<input type="radio" name="isBestScale" value="false" text{(!$.isBestScale)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">底部状态栏(PC):</td>
<td class="editTableValue">
<input type="radio" name="isShowBottomStatusBar" value="true" text{($.isShowBottomStatusBar)?'checked':''}/>显示
<input type="radio" name="isShowBottomStatusBar" value="false" text{(!$.isShowBottomStatusBar)?'checked':''}/>隐藏
</td>
</tr>
<tr>
<td class="editTableTitle">移动端打开时是否进入编辑:</td>
<td class="editTableValue">
<input type="radio" name="isOpenIntoEdit" value="true" text{($.isOpenIntoEdit)?'checked':''}/>
<input type="radio" name="isOpenIntoEdit" value="false" text{(!$.isOpenIntoEdit)?'checked':''}/>
</td>
</tr>
</table>
</div>
<div title="组件" class="MWFTab">
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">是否启用组件(PC端)</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">头部左侧:</td>
<td class="editTableValue">
<input type="radio" name="HeaderLeft" value="true" text{($.HeaderLeft)?'checked':''}/>
<input type="radio" name="HeaderLeft" value="false" text{(!$.HeaderLeft)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">头部右侧:</td>
<td class="editTableValue">
<input type="radio" name="HeaderRight" value="true" text{($.HeaderRight)?'checked':''}/>
<input type="radio" name="HeaderRight" value="false" text{(!$.HeaderRight)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">右下角帮助(金小豹):</td>
<td class="editTableValue">
<input type="radio" name="FloatQuickHelp" value="true" text{($.FloatQuickHelp)?'checked':''}/>
<input type="radio" name="FloatQuickHelp" value="false" text{(!$.FloatQuickHelp)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">顶部状态栏-历史记录菜单-历史版本:</td>
<td class="editTableValue">
<input type="radio" name="HistoryVersion" value="true" text{($.HistoryVersion)?'checked':''}/>
<input type="radio" name="HistoryVersion" value="false" text{(!$.HistoryVersion)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">顶部状态栏-历史记录菜单-协作记录:</td>
<td class="editTableValue">
<input type="radio" name="HistoryRecord" value="true" text{($.HistoryRecord)?'checked':''}/>
<input type="radio" name="HistoryRecord" value="false" text{(!$.HistoryRecord)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">表格-右键菜单-历史版本/协作记录分割线:</td>
<td class="editTableValue">
<input type="radio" name="HistoryVersionDivider" value="true" text{($.HistoryVersionDivider)?'checked':''}/>
<input type="radio" name="HistoryVersionDivider" value="false" text{(!$.HistoryVersionDivider)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">顶部工具栏打印按钮:</td>
<td class="editTableValue">
<input type="radio" name="TabPrintPreview" value="true" text{($.TabPrintPreview)?'checked':''}/>
<input type="radio" name="TabPrintPreview" value="false" text{(!$.TabPrintPreview)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">更多菜单打印按钮:</td>
<td class="editTableValue">
<input type="radio" name="MenuPrintPreview" value="true" text{($.MenuPrintPreview)?'checked':''}/>
<input type="radio" name="MenuPrintPreview" value="false" text{(!$.MenuPrintPreview)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">编辑、修订状态按钮:</td>
<td class="editTableValue">
<input type="radio" name="ReviewTrackChanges" value="true" text{($.ReviewTrackChanges)?'checked':''}/>
<input type="radio" name="ReviewTrackChanges" value="false" text{(!$.ReviewTrackChanges)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">编辑、修订状态下拉选项:</td>
<td class="editTableValue">
<input type="radio" name="TrackChanges" value="true" text{($.TrackChanges)?'checked':''}/>
<input type="radio" name="TrackChanges" value="false" text{(!$.TrackChanges)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">文字右键召唤在线协助者:</td>
<td class="editTableValue">
<input type="radio" name="ContextMenuConvene" value="true" text{($.ContextMenuConvene)?'checked':''}/>
<input type="radio" name="ContextMenuConvene" value="false" text{(!$.ContextMenuConvene)?'checked':''}/>
</td>
</tr>
</table>
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">是否启用组件(移动端)</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">状态栏Logo:</td>
<td class="editTableValue">
<input type="radio" name="Logo" value="true" text{($.Logo)?'checked':''}/>
<input type="radio" name="Logo" value="false" text{(!$.Logo)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">状态栏协作头像:</td>
<td class="editTableValue">
<input type="radio" name="Cooperation" value="true" text{($.Cooperation)?'checked':''}/>
<input type="radio" name="Cooperation" value="false" text{(!$.Cooperation)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">状态栏更多按钮:</td>
<td class="editTableValue">
<input type="radio" name="More" value="true" text{($.More)?'checked':''}/>
<input type="radio" name="More" value="false" text{(!$.More)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">顶部工具栏-分享按钮:</td>
<td class="editTableValue">
<input type="radio" name="SendButton" value="true" text{($.SendButton)?'checked':''}/>
<input type="radio" name="SendButton" value="false" text{(!$.SendButton)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">顶部工具栏-协作记录菜单:</td>
<td class="editTableValue">
<input type="radio" name="CooperHistoryMenuItem" value="true" text{($.CooperHistoryMenuItem)?'checked':''}/>
<input type="radio" name="CooperHistoryMenuItem" value="false" text{(!$.CooperHistoryMenuItem)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">文字-底部工具栏:</td>
<td class="editTableValue">
<input type="radio" name="WriterHoverToolbars" value="true" text{($.WriterHoverToolbars)?'checked':''}/>
<input type="radio" name="WriterHoverToolbars" value="false" text{(!$.WriterHoverToolbars)?'checked':''}/>
</td>
</tr>
<tr>
<td class="editTableTitle">文字-状态栏-阅读设置:</td>
<td class="editTableValue">
<input type="radio" name="ReadSetting" value="true" text{($.ReadSetting)?'checked':''}/>
<input type="radio" name="ReadSetting" value="false" text{(!$.ReadSetting)?'checked':''}/>
</td>
</tr>
</table>
</div>
<div title="事件" class="MWFTab">
<div class="MWFEventsArea" name="events"></div>
</div>
<div title="HTML" class="MWFTab">
<div class="MWFHTMLArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
</div>
<div title="JSON" class="MWFTab">
<div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
</div>
</div>
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.OnlyOffice = MWF.APPOnlyOffice = new Class({
Extends: MWF.APP$Module,
isActive: false,
options:{
"moduleEvents": ["beforeOpen",
"afterOpen",
"afterSave"
]
},
initialize: function(node, json, form, options){
this.node = $(node);
this.node.store("module", this);
this.json = json;
this.form = form;
this.documentId = "";
this.mode = "edit";
},
_loadUserInterface: function(){
this.node.empty();
this.node.setStyles({
"min-height": "100px"
});
},
_afterLoaded: function(){
if(!layout.serviceAddressList["x_onlyofficefile_assemble_control"]){
this.node.set("html","<h3><font color=red>请先安装onlyoffice应用</font></h3>");
return false;
}
this.action = o2.Actions.load("x_onlyofficefile_assemble_control");
if (!this.json.isNotLoadNow){
this.data = this.getData();
if(this.data.documentId === ""){
this.createDocument(function (){
this.loadDocument();
}.bind(this));
}else {
this.documentId = this.data.documentId;
this.loadDocument();
}
}
},
createDocument : function (callback){
var data = {
"fileName" : "文件正文." + this.json.officeType,
"fileType" : this.json.officeType,
"relevanceId" : this.form.businessData.work.job
}
this.action.OnlyofficeAction.create(data,
function( json ){
this.documentId = json.data.id;
this.setData();
if (callback) callback();
}.bind(this),null, false
);
},
loadDocument: function () {
this.getEditor(function () {
this.loadApi(function (){
this.loadEditor();
}.bind(this));
}.bind(this));
},
loadApi : function (callback){
this.action.OnlyofficeConfigAction.getConfig(function( json ){
var data = json.data;
var docserviceApi = data.docserviceApi;
o2.load(docserviceApi, function () {
if (callback) callback();
}.bind(this))
}.bind(this),null, false);
},
getEditor: function (callback) {
this.action.OnlyofficeAction.get(this.documentId, function( json ){
this.document = json.data;
this.document.editor = this.document.fileModel;
if (callback) callback();
}.bind(this),null,false);
},
loadEditor: function () {
this.fireEvent("beforeOpen");
if (this.json.isReadonly){
this.mode = "view";
}else{
if (this.json.readScript && this.json.readScript.code){
var flag = this.form.Macro.exec(this.json.readScript.code, this);
if (flag){
this.mode = "view";
}
}
}
var docEditor;
var _self = this;
var innerAlert = function (message) {
if (console && console.log)
console.log(message);
};
var onAppReady = function () {
innerAlert("Document editor ready");
};
var onDocumentStateChange = function (event) {
var title = document.title.replace(/\*$/g, "");
document.title = title + (event.data ? "*" : "");
if(event.data){
_self.fireEvent("afterSave");
}
};
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
};
var onRequestHistory = function (event) {
if (this.document.FileHistory[0] === "") {
docEditor.refreshHistory({
currentVersion: null,
history: null
});
} else {
var historyArr = JSON.parse(this.document.FileHistory[0]).history;
var newHistoryArr = [];
for (var i = 0; i < historyArr.length; i++) {
if (historyArr[i].version > 0) {
newHistoryArr.push(historyArr[i]);
}
}
newHistoryArr.sort(function (a, b) {
return a.version - b.version;
});
var historyObj = newHistoryArr || null;
docEditor.refreshHistory({
currentVersion: JSON.parse(this.document.FileHistory[0]).currentVersion,
history: historyObj
});
}
}.bind(this);
var onRequestHistoryData = function (data) {
var historyArr = [];
var history = JSON.parse(this.document.FileHistory[1]);
for (var key in history) {
if (key !== "0") {
historyArr.push(history[key]);
}
}
var version = data.data;
var historyData = historyArr || null;
docEditor.setHistoryData(historyData[version - 1]);
}.bind(this);
var onRequestHistoryClose = function (event) {
document.location.reload();
};
var onError = function (event) {
if (event) innerAlert(event.data);
};
var onOutdatedVersion = function (event) {
location.reload(true);
};
var onDocumentReady= function() {
console.log("Document is loaded");
this.fireEvent("afterOpen");
}.bind(this);
this.document.editor.events = {
"onAppReady": onAppReady,
"onDocumentReady":onDocumentReady,
"onDocumentStateChange": onDocumentStateChange,
'onRequestEditRights': onRequestEditRights,
"onError": onError,
"onOutdatedVersion": onOutdatedVersion,
}
if (this.document.FileHistory[0] !== "") {
this.document.editor.events.onRequestHistory = onRequestHistory;
this.document.editor.events.onRequestHistoryData = onRequestHistoryData;
this.document.editor.events.onRequestHistoryClose = onRequestHistoryClose;
}
if(layout.mobile){
// this.document.editor.type = "mobile";
}
this.officeNode = new Element("div#officeNode", {
"styles": this.form.css.officeAreaNode
}).inject(this.node);
if (this.node.getSize().y<800) this.node.setStyle("height", "800px");
debugger
this.document.editor.editorConfig.mode = this.mode;
this.document.editor.editorConfig.customization = {
"chat": this.json.chat,
"commentAuthorOnly": false,
"comments": this.json.comments,
"compactHeader": this.json.compactHeader,
"compactToolbar": this.json.compactToolbar,
"compatibleFeatures": this.json.compatibleFeatures,
"customer": {
"address": this.json.address,
"info": this.json.info,
"logo": this.json.logo,
"mail": this.json.mail,
"name": this.json.companyName,
"www": this.json.www
},
"feedback": {
"url": this.json.feedback,
"visible": this.json.feedbackUrl
},
"forcesave": this.json.forcesave,
"help": this.json.help,
"hideRightMenu": this.json.hideRightMenu,
"logo": {
"image": this.json.logoImg,
"url": this.json.logoUrl
},
"macros": true,
"macrosMode": "warn",
"mentionShare": true,
"plugins": this.json.plugins,
"reviewDisplay": this.json.reviewDisplay,
"showReviewChanges": this.json.showReviewChanges,
"spellcheck": this.json.spellcheck,
"toolbarHideFileName": this.json.toolbarHideFileName,
"toolbarNoTabs": this.json.toolbarNoTabs,
"trackChanges": this.json.trackChanges,
"unit": this.json.unit,
"zoom": this.json.zoom
}
docEditor = new DocsAPI.DocEditor("officeNode", this.document.editor);
this.onlyOffice = docEditor;
},
hide: function(){
this.node.hide();
},
show: function(){
this.node.show();
},
isEmpty : function(){
var data = this.getData();
if(data.documentId === ""){
return true;
}else {
return false;
}
},
getData: function(){
var data = {
"documentId" : ""
}
if(this.form.businessData.data[this.json.id]){
data.documentId = this.form.businessData.data[this.json.id].documentId;
}
return data;
},
setData: function(){
var data = {
"documentId" : this.documentId
}
this._setBusinessData(data);
}
});
......@@ -32,6 +32,8 @@ MWF.xApplication.process.Xform.require = function(callback){
["process.Xform", "Office"],
["process.Xform", "IWebOffice"],
["process.Xform", "YozoOffice"],
["process.Xform", "OnlyOffice"],
["process.Xform", "WpsOffice"],
["process.Xform", "Attachment"],
["process.Xform", "Actionbar"],
["process.Xform", "Sidebar"],
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册