提交 f6aa5e69 编写于 作者: 傻拖

增加金格控件

上级 2ac48f95
......@@ -203,7 +203,7 @@
"className": "Office"
},
"iWebOffice": {
"icon": "office.png",
"icon": "iWebOffice.png",
"text": "iWebOffice",
"className": "IWebOffice"
},
......
......@@ -30,71 +30,7 @@
<input type="radio" name="isNotLoadNow" value="false" text{(!$.isNotLoadNow)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.keepHistory}}:</td>
<td class="editTableValue">
<input type="radio" name="isHistory" value="true" text{($.isHistory)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isHistory" value="false" text{(!$.isHistory)?'checked':''}/>{{$.lp.yes}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.openAttachment}}:</td>
<td class="editTableValue">
<input onclick="if (this.checked){ $('text{$.pid}attachmentConfigArea').setStyle('display', 'block')}" type="radio" name="isOpenAttachment" value="true" text{($.isOpenAttachment)?'checked':''}/>{{$.lp.yes}}
<input onclick="if (this.checked){ $('text{$.pid}attachmentConfigArea').setStyle('display', 'none')}" type="radio" name="isOpenAttachment" value="false" text{(!$.isOpenAttachment)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
</table>
<div id="text{$.pid}attachmentConfigArea" style="display: text{($.isOpenAttachment)?'block':'none'};">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">{{$.lp.attachmentId}}</td>
<td class="editTableValue">
<input type="text" name="attachmentIds" value="text{$.attachmentIds}" class="editTableInput"/>
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.attachmentReadonly}}:</td>
<td class="editTableValue">
<input type="radio" name="isAttReadonly" value="true" text{($.isAttReadonly)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isAttReadonly" value="false" text{(!$.isAttReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
</table>
</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">{{$.lp.autoSave}}:</td>
<td class="editTableValue">
<input onclick="if (this.checked){ $('text{$.pid}fileAutoSaveArea').setStyle('display', 'block')}" type="radio" name="isAutoSave" value="true" text{($.isAutoSave)?'checked':''}/>{{$.lp.yes}}
<input onclick="if (this.checked){ $('text{$.pid}fileAutoSaveArea').setStyle('display', 'none')}" type="radio" name="isAutoSave" value="false" text{(!$.isAutoSave)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
</table>
<div id="text{$.pid}fileAutoSaveArea" style="display: text{($.isAutoSave)?'block':'none'};">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableValue" colspan="2"><b>{{$.lp.historyCount}}: &nbsp;&nbsp;</b>
<select name="autoSaveNumber">
<option value="1" text{($.autoSaveNumber=='1')?'selected':''}>1</option>
<option value="2" text{($.autoSaveNumber=='2')?'selected':''}>2</option>
<option value="3" text{(!$.autoSaveNumber || $.autoSaveNumber=='3')?'selected':''}>3</option>
<option value="4" text{($.autoSaveNumber=='4')?'selected':''}>4</option>
<option value="5" text{($.autoSaveNumber=='5')?'selected':''}>5</option>
<option value="6" text{($.autoSaveNumber=='6')?'selected':''}>6</option>
</select>
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.timeInterval}}:</td>
<td class="editTableValue">
<input type="number" name="autoSaveTime" value="text{$.autoSaveTime || 5}" class="editTableInput"/>
</td>
</tr>
</table>
</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableValue" colspan="2">
......@@ -128,17 +64,15 @@
</table>
</div>
<div class="MWFScriptArea" name="readScript" title="{{$.lp.readonlyCondition}} (S)"></div>
<div class="MWFFormulaArea" name="fileSite" title="{{$.lp.officeFileSite}} (S)"></div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">{{$.lp.userTitle}}:</td>
<td class="editTableValue"><input type="text" name="productCaption" value="text{$.productCaption}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.userId}}:</td>
<td class="editTableValue"><input type="text" name="productKey" value="text{$.productKey}" class="editTableInput"/></td>
</tr>
<!-- <tr>-->
<!-- <td class="editTableTitle">{{$.lp.userTitle}}:</td>-->
<!-- <td class="editTableValue"><input type="text" name="productCaption" value="text{$.productCaption}" class="editTableInput"/></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td class="editTableTitle">{{$.lp.userId}}:</td>-->
<!-- <td class="editTableValue"><input type="text" name="productKey" value="text{$.productKey}" class="editTableInput"/></td>-->
<!-- </tr>-->
<!--<tr>-->
<!--<td class="editTableTitle">授权标题:</td>-->
<!--<td class="editTableValue"><input type="text" name="makerCaption" value="text{$.makerCaption}" class="editTableInput"/></td>-->
......@@ -182,106 +116,32 @@
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('save')!=-1)?'checked':''} type="checkbox" value="save"/>{{$.lp.saveLocal}}
<br/>
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('revisions')!=-1)?'checked':''} type="checkbox" value="revisions"/>{{$.lp.traceSwitch}}
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('fullscreen')!=-1)?'checked':''} type="checkbox" value="fullscreen"/>{{$.lp.fullscreenMode}}
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('toolbar')!=-1)?'checked':''} type="checkbox" value="toolbar"/>{{$.lp.toolbarSwitch}}
<br/><input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('preview')!=-1)?'checked':''} type="checkbox" value="preview"/>{{$.lp.printPreview}}
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('redfile')!=-1)?'checked':''} type="checkbox" value="redfile"/>{{$.lp.redFileButton}}
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('seal')!=-1)?'checked':''} type="checkbox" value="seal"/>{{$.lp.stampButton}}
<br/><input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('showHistory')!=-1)?'checked':''} type="checkbox" value="showHistory"/>{{$.lp.showHistory}}
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('preview')!=-1)?'checked':''} type="checkbox" value="preview"/>{{$.lp.printPreview}}
</td>
</tr>
</table>
<!--<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
<!--<tr>-->
<!--<td class="editTableValue">-->
<!--<b>痕迹切换:</b>-->
<!--<input class="editTableRadio" name="menu_revisions" text{($.menu_revisions!='0')?'checked':''} type="radio" value="1"/>是-->
<!--<input class="editTableRadio" name="menu_revisions" text{($.menu_revisions=='0')?'checked':''} type="radio" value="0"/>否-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td class="editTableValue">-->
<!--<b>全屏模式:</b>-->
<!--<input class="editTableRadio" name="menu_fullscreen" text{($.menu_fullscreen!='0')?'checked':''} type="radio" value="1"/>是-->
<!--<input class="editTableRadio" name="menu_fullscreen" text{($.menu_fullscreen=='0')?'checked':''} type="radio" value="0"/>否-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td class="editTableValue">-->
<!--<b>工具栏切换:</b>-->
<!--<input class="editTableRadio" name="menu_toolbar" text{($.menu_toolbar=='1')?'checked':''} type="radio" value="1"/>是-->
<!--<input class="editTableRadio" name="menu_toolbar" text{($.menu_toolbar!='1')?'checked':''} type="radio" value="0"/>否-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td class="editTableValue">-->
<!--<b>打印预览:</b>-->
<!--<input class="editTableRadio" name="menu_preview" text{($.menu_preview!='0')?'checked':''} type="radio" value="1"/>是-->
<!--<input class="editTableRadio" name="menu_preview" text{($.menu_preview=='0')?'checked':''} type="radio" value="0"/>否-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td class="editTableValue">-->
<!--<b>套红按钮:</b>-->
<!--<input class="editTableRadio" name="menu_redfile" text{($.menu_redfile=='1')?'checked':''} type="radio" value="1"/>是-->
<!--<input class="editTableRadio" name="menu_redfile" text{($.menu_redfile!='1')?'checked':''} type="radio" value="0"/>否-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td class="editTableValue">-->
<!--<b>盖章按钮:</b>-->
<!--<input class="editTableRadio" name="menu_seal" text{($.menu_seal=='1')?'checked':''} type="radio" value="1"/>是-->
<!--<input class="editTableRadio" name="menu_seal" text{($.menu_seal!='1')?'checked':''} type="radio" value="0"/>否-->
<!--</td>-->
<!--</tr>-->
<!--</table>-->
<div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">{{$.lp.attribute}}:</div>
<!--<div style="background-color: #eeeeee; height: 24px; line-height: 24px; text-align: center;">界面相关</div>-->
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showTitleBar}}:</b>
<input class="editTableRadio" name="ntkoEditProperties.TitleBar" text{($.ntkoEditProperties.TitleBar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoEditProperties.TitleBar" text{($.ntkoEditProperties.TitleBar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showMenuBar}}:</b>
<input class="editTableRadio" name="ntkoEditProperties.Menubar" text{($.ntkoEditProperties.Menubar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoEditProperties.Menubar" text{($.ntkoEditProperties.Menubar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
<input class="editTableRadio" name="iWebOfficeEditProperties.Menubar" text{($.iWebOfficeEditProperties.Menubar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="iWebOfficeEditProperties.Menubar" text{($.iWebOfficeEditProperties.Menubar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showToolBar}}:</b>
<input class="editTableRadio" name="ntkoEditProperties.ToolBars" text{($.ntkoEditProperties.ToolBars!='0')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoEditProperties.ToolBars" text{($.ntkoEditProperties.ToolBars=='0')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showStatusBar}}:</b>
<input class="editTableRadio" name="ntkoEditProperties.Statusbar" text{($.ntkoEditProperties.Statusbar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoEditProperties.Statusbar" text{($.ntkoEditProperties.Statusbar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr>
<td class="editTableTitle">{{$.lp.showZoom}}:</td>
<td class="editTableValue"><input type="number" name="editScale" value="text{$.editScale}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.title}}:</td>
<td class="editTableValue"><input type="text" name="ntkoEditProperties.Caption" value="text{$.ntkoEditProperties.Caption}" class="editTableInput"/></td>
</tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.borderStyle}}:</b>
<input class="editTableRadio" name="ntkoEditProperties.BorderStyle" text{($.ntkoEditProperties.BorderStyle=='0')?'checked':''} type="radio" value="0"/>{{$.lp.none}}
<input class="editTableRadio" name="ntkoEditProperties.BorderStyle" text{($.ntkoEditProperties.BorderStyle!='0' && $.ntkoEditProperties.BorderStyle!='2')?'checked':''} type="radio" value="1"/>{{$.lp.flat}}
<input class="editTableRadio" name="ntkoEditProperties.BorderStyle" text{($.ntkoEditProperties.BorderStyle=='2')?'checked':''} type="radio" value="2"/>3D
<input class="editTableRadio" name="iWebOfficeEditProperties.ToolBars" text{($.iWebOfficeEditProperties.ToolBars!='0')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="iWebOfficeEditProperties.ToolBars" text{($.iWebOfficeEditProperties.ToolBars=='0')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr>
<td class="editTableTitle">{{$.lp.borderColor}}:</td>
<td class="editTableValue"><input type="color" name="ntkoEditProperties.BorderColor" value="text{$.ntkoEditProperties.BorderColor}" class="editTableInput"/></td>
</tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.noCopy}}:</b>
<input class="editTableRadio" name="ntkoEditProperties.IsNoCopy" text{($.ntkoEditProperties.IsNoCopy=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoEditProperties.IsNoCopy" text{($.ntkoEditProperties.IsNoCopy!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
<input class="editTableRadio" name="iWebOfficeEditProperties.IsNoCopy" text{($.iWebOfficeEditProperties.IsNoCopy=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="iWebOfficeEditProperties.IsNoCopy" text{($.iWebOfficeEditProperties.IsNoCopy!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.keepTraces}}:</b>
......@@ -298,59 +158,28 @@
<td class="editTableTitle">{{$.lp.toolbar}}</td>
<td class="editTableValue">
<input class="editTableRadio" name="menuReadButtons" text{(($.menuReadButtons) && $.menuReadButtons.indexOf('revisions')!=-1)?'checked':''} type="checkbox" value="revisions"/>{{$.lp.traceSwitch}}
<input class="editTableRadio" name="menuReadButtons" text{(($.menuReadButtons) && $.menuReadButtons.indexOf('fullscreen')!=-1)?'checked':''} type="checkbox" value="fullscreen"/>{{$.lp.fullscreenMode}}
<input class="editTableRadio" name="menuReadButtons" text{(($.menuReadButtons) && $.menuReadButtons.indexOf('toolbar')!=-1)?'checked':''} type="checkbox" value="toolbar"/>{{$.lp.toolbarSwitch}}
<br/><input class="editTableRadio" name="menuReadButtons" text{(($.menuReadButtons) && $.menuReadButtons.indexOf('preview')!=-1)?'checked':''} type="checkbox" value="preview"/>{{$.lp.printPreview}}
<input class="editTableRadio" name="menuEditButtons" text{(($.menuEditButtons) && $.menuEditButtons.indexOf('showHistory')!=-1)?'checked':''} type="checkbox" value="showHistory"/>{{$.lp.showHistory}}
<!--<input class="editTableRadio" name="menuReadButtons" text{(($.menu_buttons) && $.menu_buttons.indexOf('redfile')!=-1)?'checked':''} type="checkbox" value="redfile"/>套红按钮-->
<!--<input class="editTableRadio" name="menuReadButtons" text{(($.menu_buttons) && $.menu_buttons.indexOf('seal')!=-1)?'checked':''} type="checkbox" value="seal"/>盖章按钮-->
<input class="editTableRadio" name="menuReadButtons" text{(($.menuReadButtons) && $.menuReadButtons.indexOf('preview')!=-1)?'checked':''} type="checkbox" value="preview"/>{{$.lp.printPreview}}
</td>
</tr>
</table>
<!--<div style="background-color: #eeeeee; height: 24px; line-height: 24px; text-align: center;">界面相关</div>-->
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showTitleBar}}:</b>
<input class="editTableRadio" name="ntkoReadProperties.TitleBar" text{($.ntkoReadProperties.TitleBar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoReadProperties.TitleBar" text{($.ntkoReadProperties.TitleBar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showMenuBar}}:</b>
<input class="editTableRadio" name="ntkoReadProperties.Menubar" text{($.ntkoReadProperties.Menubar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoReadProperties.Menubar" text{($.ntkoReadProperties.Menubar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
<input class="editTableRadio" name="iWebOfficeReadProperties.Menubar" text{($.iWebOfficeReadProperties.Menubar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="iWebOfficeReadProperties.Menubar" text{($.iWebOfficeReadProperties.Menubar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showToolBar}}:</b>
<input class="editTableRadio" name="ntkoReadProperties.ToolBars" text{($.ntkoReadProperties.ToolBars!='0')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoReadProperties.ToolBars" text{($.ntkoReadProperties.ToolBars=='0')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
<input class="editTableRadio" name="iWebOfficeReadProperties.ToolBars" text{($.iWebOfficeReadProperties.ToolBars!='0')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="iWebOfficeReadProperties.ToolBars" text{($.iWebOfficeReadProperties.ToolBars=='0')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.showStatusBar}}:</b>
<input class="editTableRadio" name="ntkoReadProperties.Statusbar" text{($.ntkoReadProperties.Statusbar=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoReadProperties.Statusbar" text{($.ntkoReadProperties.Statusbar!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
<tr>
<td class="editTableTitle">{{$.lp.showZoom}}:</td>
<td class="editTableValue"><input type="number" name="readScale" value="text{$.readScale}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.title}}:</td>
<td class="editTableValue"><input type="text" name="ntkoReadProperties.Caption" value="text{$.ntkoReadProperties.Caption}" class="editTableInput"/></td>
</tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.borderStyle}}:</b>
<input class="editTableRadio" name="ntkoReadProperties.BorderStyle" text{($.ntkoReadProperties.BorderStyle=='0')?'checked':''} type="radio" value="0"/>{{$.lp.none}}
<input class="editTableRadio" name="ntkoReadProperties.BorderStyle" text{($.ntkoReadProperties.BorderStyle!='0' && $.ntkoReadProperties.BorderStyle!='2')?'checked':''} type="radio" value="1"/>{{$.lp.flat}}
<input class="editTableRadio" name="ntkoReadProperties.BorderStyle" text{($.ntkoReadProperties.BorderStyle=='2')?'checked':''} type="radio" value="2"/>3D
</td></tr>
<tr>
<td class="editTableTitle">{{$.lp.borderColor}}:</td>
<td class="editTableValue"><input type="color" name="ntkoReadProperties.BorderColor" value="text{$.ntkoReadProperties.BorderColor}" class="editTableInput"/></td>
</tr>
<tr><td class="editTableValue" colspan="2">
<b>{{$.lp.noCopy}}:</b>
<input class="editTableRadio" name="ntkoReadProperties.IsNoCopy" text{($.ntkoReadProperties.IsNoCopy=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="ntkoReadProperties.IsNoCopy" text{($.ntkoReadProperties.IsNoCopy!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
<input class="editTableRadio" name="iWebOfficeReadProperties.IsNoCopy" text{($.iWebOfficeReadProperties.IsNoCopy=='1')?'checked':''} type="radio" value="1"/>{{$.lp.yes}}
<input class="editTableRadio" name="iWebOfficeReadProperties.IsNoCopy" text{($.iWebOfficeReadProperties.IsNoCopy!='1')?'checked':''} type="radio" value="0"/>{{$.lp.no}}
</td></tr>
</table>
<div class="MWFMaplist" name="readProperties" title="{{$.lp.otherAttr}}"></div>
......
......@@ -5,59 +5,33 @@
"description": "",
"officeType": "word",
"template": "",
"productCaption": "O2",
"productKey": "EDCC626CB85C9A1D3E0D7BDDDC2637753C596725",
// "makerCaption": "浙江兰德纵横网络技术股份有限公司",
// "makerKey": "E138DABB4AC26C2D8E09FAE59AB3BDE87AFB9D7B",
// "version": "5.0.3.1",
// "clsid": "A64E3073-2016-4baf-A89D-FFE1FAA10EC0",
// "codeBase": "../x_desktop/res/framework/officecontrol/OfficeControl.cab",
// "clsid64": "A64E3073-2016-4baf-A89D-FFE1FAA10EC0",
// "codeBase64": "../x_desktop/res/framework/officecontrol/OfficeControl.cab",
"isNotLoadNow": false,
"trackRevisions" : "0",
"script": {
"code": "",
"html": ""
},
"ntkoEditProperties": {
"Titlebar": "0",
"iWebOfficeEditProperties": {
"Menubar": "0",
"ToolBars": "1",
"Statusbar": "0",
"BorderStyle": "1",
"IsNoCopy": "0"
},
"ntkoReadProperties": {
"Titlebar": "0",
"iWebOfficeReadProperties": {
"Menubar": "0",
"ToolBars": "0",
"Statusbar": "0",
"BorderStyle": "0",
"IsNoCopy": "0"
},
"menuReadButtons": ["revisions","fullscreen","preview"],
"menuEditButtons": ["revisions","fullscreen","toolbar","preview"],
"events": {
"redFile": {
"code": "",
"html": ""
},
"afterOpen": {
"code": "",
"html": ""
},
"afterOpenOffice": {
"code": "",
"html": ""
},
"afterCreate": {
"code": "",
"html": ""
},
"seal": {
"code": "",
"html": ""
},
"beforeSave": {
"code": "",
"html": ""
......@@ -65,58 +39,6 @@
"afterSave": {
"code": "",
"html": ""
},
"afterCloseOffice": {
"code": "",
"html": ""
},
"click": {
"code": "",
"html": ""
},
"dblclick": {
"code": "",
"html": ""
},
"keydown": {
"code": "",
"html": ""
},
"keypress": {
"code": "",
"html": ""
},
"keyup": {
"code": "",
"html": ""
},
"mousedown": {
"code": "",
"html": ""
},
"mousemove": {
"code": "",
"html": ""
},
"mouseout": {
"code": "",
"html": ""
},
"mouseover": {
"code": "",
"html": ""
},
"mouseup": {
"code": "",
"html": ""
},
"focus": {
"code": "",
"html": ""
},
"blur": {
"code": "",
"html": ""
}
},
"properties": {},
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
Extends: MWF.APP$Module,
isActive: false,
options:{
"copyright": "金格科技iWebOffice2015智能文档中间件[演示版];V5.0S0xGAAEAAAAAAAAAEAAAAJ0BAACgAQAALAAAAFgHOIQT3Ejo2JZMmSVxBkTixI2YkNh+cy/HGFlQ3HNIRG8j2V9vAnBWM8B384zkV79hltghTpDkba9QJTjGCDkylzhl3rian7v/AFF5DXQ7HdoXpN2imHbGHf8ieQNf672v38ODXJum7VaWv4P3DXzlzdnmzoaTTukFl+3ntFH29dQSjC94c4v0npn9rnXK5OsjJGR5mVGJJd6GWjE9rP3fo+kWCBYzb+bhn2sL+SKoyFjUuSptNHsOn3nRKrXyqkRd+QaHR/MDuKd1kEbUpRqCz9CjgfZFX00Zaz2l6ChA6LmdMMjjECalHZQA9WuxAc7cynGbvNfEgi277ahRpSZHmjKY5s18dJM/t9gdatg5b/dCqnUEn0+HS511XaM3xvy4DCVnD1n8xC9I5w+16NGrtTMiMSZFpc3QJphdShC0j+1l/ZyVj33YM31JmuxkI5SDL2CAfMUNsioseUfpOKvpxdcA7nmwlKrpxNetm9Bq0kwJn/jUU2bQa2c+bPRX82JcmFUwAz0ctOQ+Tyi+MoRpATEYW35KZtWepeDTGHJRfaJR81x8dVU0Lp1TuxtQiw==",
"version": "12,7,0,828",
......@@ -11,18 +9,11 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
"version64" : "12,5,0,652",
"clsid64" : "D89F482C-5045-4DB5-8C53-D2C9EE71D024",
"codeBase64": "../o2_lib/iWebOffice/iWebOffice2015.cab",
"files": ["doc","docx","dotx","dot","xls","xlsx","xlsm","xlt","xltx","pptx","ppt","pot","potx","potm","pdf"],
"moduleEvents": ["redFile",
"moduleEvents": [,
"afterOpen",
"afterOpenOffice",
"afterCreate",
"seal",
"beforeSave",
"afterSave",
"afterCloseOffice",
"load"
"afterSave"
]
},
initialize: function(node, json, form, options){
......@@ -39,42 +30,77 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
"min-height": "100px"
});
if (Browser.name==="ie"){
this.isActive = true;
this.file = null;
if (!this.form.officeList) this.form.officeList=[];
this.form.officeList.push(this);
}
},
_afterLoaded: function(){
if (Browser.name==="ie"){
if(!layout.serviceAddressList["x_jg_assemble_control"]){
this.node.set("html","<h3><font color=red>please install weboffice !!!</font></h3>");
return false;
}else{
var host = layout.serviceAddressList["x_jg_assemble_control"].host;
var port = layout.serviceAddressList["x_jg_assemble_control"].port;
this.webUrl = layout.protocol + "//" + host + ":" + port + "/x_jg_assemble_control/IndexServlet";
}
this.action = o2.Actions.load("x_jg_assemble_control");
if (!this.json.isNotLoadNow){
this.data = this.getData();
if(this.data.documentId === ""){
this.createDocument(function (){
this.loadOffice();
}.bind(this));
}else {
this.documentId = this.data.documentId;
this.loadOffice();
}
}
if (!this.json.isNotLoadNow){
this.loadOffice();
}
}else {
//console.log(JSON.stringify(this.json))
this.node.set("html","<h3><font color=red>只支持ie浏览器!</font></h3>");
}
},
createDocument : function (callback){
this.action.ManageJGAction.create({"fileType":this.getFileType()}, function( json ){
this.fireEvent("afterCreate");
this.documentId = json.data.message;
this.setData();
if (callback) callback();
}.bind(this),null, false);
},
createNew : function (){
this.officeOCX.CreateFile();
},
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);
},
loadOffice: function(file){
loadOffice: function(){
if (!this.officeLoaded){
if (!this.isActive){
this.loadOfficeNotActive();
}else{
MWF.getJSON("../o2_lib/iWebOffice/config.json", function(json){
this.officeConfig = json;
}.bind(this), false);
this.loadOfficeContorl(file);
}
this.loadOfficeContorl();
this.officeLoaded = true;
}else{
if (this.officeOCX) this.officeOCX.BeginOpenFromURL(file, true, this.readonly);
}
},
getProgID: function(){
switch (this.json.officeType){
case "word":
return "Word.Document";
case "excel":
return "Excel.Sheet";
case "ppt":
return "PowerPoint.Show";
}
return "Word.Document"
},
defaultParam: function(readonly){
var o = {
......@@ -88,24 +114,15 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
if (!layout.desktop.offices) layout.desktop.offices = {};
layout.desktop.offices[this.getOfficeObjectId()] = this;
if (this.readonly){
this.loadOfficeRead(file);
}else if (this.json.isReadonly){
if (this.json.isReadonly){
this.readonly = true;
this.loadOfficeRead(file);
}else{
if (this.json.readScript && this.json.readScript.code){
}else if (this.json.readScript && this.json.readScript.code){
var flag = this.form.Macro.exec(this.json.readScript.code, this);
if (flag){
this.readonly = true;
this.loadOfficeRead(file);
}else{
this.loadOfficeEdit(file);
}
}else{
this.loadOfficeEdit(file);
}
}
this.loadOfficeEditor();
},
loadOfficeSpacer: function(){
var size = this.node.getSize();
......@@ -148,15 +165,11 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
if (this.officeOCX) this.officeOCX.Activate(true);
}
},
isCover: function(node){
},
getFormId: function(){
var id = (!this.form.businessData.workCompleted) ? this.form.businessData.work.id : this.form.businessData.workCompleted.id;
return "form"+this.json.id+id;
},
getFileName: function(){
getFileType: function(){
var ename = "docx";
switch (this.json.officeType){
case "word":
......@@ -168,261 +181,211 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
case "ppt":
ename = "pptx";
}
var id = (!this.form.businessData.workCompleted) ? this.form.businessData.work.id : this.form.businessData.workCompleted.id;
return "file"+this.json.id+id+"."+ename;
return ename;
},
getOfficeObjectId: function(){
var id = (!this.form.businessData.workCompleted) ? this.form.businessData.work.id : this.form.businessData.workCompleted.id;
return "IWebOCX"+this.json.id+id;
},
getFileInputName: function(){
var id = (!this.form.businessData.workCompleted) ? this.form.businessData.work.id : this.form.businessData.workCompleted.id;
return "fileInput"+this.json.id+id;
return "WebOffice"+this.json.id+id;
},
getTempleteUrl: function(){
//return "../x_desktop/temp/杭州城管委文件.doc";
if (this.json.template){
var root = "";
var flag = this.json.template.substr(0,1);
if (flag==="/"){
root = this.json.template.substr(1, this.json.template.indexOf("/", 1)-1);
loadOfficeEditor: function(){
if (!this.officeOCX){
this.loadOfficeSpacer();
this.node.setStyle("pisition", "absolute");
var codeBase = this.officeConfig.codeBase || this.json.codeBase || this.options.codeBase;
var version = this.officeConfig.version || this.json.version || this.options.version;
var classid = this.officeConfig.classid || this.json.clsid || this.options.clsid;
var codeBase64 = this.officeConfig.codeBase64 || this.json.codeBase64 || this.options.codeBase64;
var classid64 = this.officeConfig.classid64 || this.json.clsid64 || this.options.clsid64;
var objectHtml = "";
if(window.navigator.platform=="Win64"){
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id=\""+this.getOfficeObjectId()+"\" " +
"style=\"HEIGHT: 99%; WIDTH: 100%\" " +
"codeBase=\""+codeBase64+"#version="+version+"\" " +
"classid=\"clsid:"+classid64+"\">";
}else{
root = this.json.template.substr(0, this.json.template.indexOf("/"));
}
if (["x_processplatform_assemble_surface", "x_portal_assemble_surface"].indexOf(root.toLowerCase())!==-1){
var host = MWF.Actions.getHost(root);
return (flag==="/") ? host+this.json.template : host+"/"+this.json.template
}
}
return this.json.template;
},
getFile: function(site){
var file = null;
atts = this.form.businessData.attachmentList;
for (var i=0; i<atts.length; i++){
//if ((atts[i].name===fileName) || (atts[i].site===this.json.id)){
//if (atts[i].site===this.json.id){
if (atts[i].site===site){
file = atts[i];
break;
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id=\""+this.getOfficeObjectId()+"\" " +
"style=\"HEIGHT: 99%; WIDTH: 100%\" " +
"codeBase=\""+codeBase+"#version="+version+"\" " +
"classid=\"clsid:"+classid+"\">";
}
var pars = this.defaultParam();
pars = Object.merge(pars, this.json.ntkoEditProperties);
pars = Object.merge(pars, this.json.editProperties);
Object.each(pars, function(p, key){
objectHtml += "<PARAM NAME=\""+key+"\" value=\""+p+"\">";
});
objectHtml += "</OBJECT></form>";
this.officeNode.appendHTML(objectHtml);
this.officeForm = this.officeNode.getFirst();
}
return file
setTimeout(function() {this.loadIwebOfficeEditor()}.bind(this), 5000);
},
getOfficeFileUrl: function(){
var fileName = this.getFileName();
loadIwebOfficeEditor : function (){
// this.officeOCX.EditType="1,1"; //EditType:编辑类型 方式一、方式二 <参考技术文档>
// //第一位可以为0,1,2,3 其中:0不可编辑;1可以编辑,无痕迹;2可以编辑,有痕迹,不能修订;3可以编辑,有痕迹,能修订;
// //第二位可以为0,1 其中:0不可批注,1可以批注。可以参考iWebOffice2009的EditType属性,详细参考技术白皮书
// //以下为自定义菜单↓
// this.officeOCX.AppendMenu("1","打开本地文件(&L)", png10);
// this.officeOCX.AppendMenu("2","保存本地文件(&S)", png2);
// this.officeOCX.AppendMenu("3","保存到服务器(&U)", png7);
// this.officeOCX.AppendMenu("7","-");
// this.officeOCX.AppendMenu("11","保存并退出(&E)", png4);
// this.officeOCX.AppendMenu("12","-");
// this.officeOCX.AppendMenu("13","打印文档(&P)", png13);
// //以上为自定义菜单↑
// //this.officeOCX.VersionFontColor = "bfdbff";
// this.officeOCX.AllowEmpty = true;
this.readSite = this.json.id;
if (this.json.fileSite && this.json.fileSite.code){
this.readSite = this.form.Macro.exec(this.json.fileSite.code, this);
this.officeOCX = document.getElementById(this.getOfficeObjectId()).FuncExtModule;
this.officeOCX.WebUrl = this.webUrl; //WebUrl:系统服务器路径,与服务器文件交互操作,如保存、打开文档,重要文件
this.officeOCX.FileName = "文件正文.docx"; //FileName:文档名称
this.officeOCX.UserName = layout.desktop.session.user.name; //UserName:操作用户名,痕迹保留需要
this.officeOCX.RecordID = this.documentId;
this.officeOCX.FileType="." + this.getFileType(); //FileType:文档类型 .doc .xls .wps
if(this.readonly){
this.officeOCX.EditType="0,0";
}
var file = this.getFile(this.readSite);
if (!file) if (this.readSite !== this.json.id) file = this.getFile(this.json.id);
this.officeOCX.ShowMenu = this.json.iWebOfficeEditProperties.Menubar; //控制整体菜单显示
this.officeOCX.ShowToolBar = this.json.iWebOfficeEditProperties.ToolBars; //ShowToolBar:是否显示工具栏:1显示,0不显示
this.officeOCX.ShowWindow = true; //控制显示打开或保存文档的进度窗口,默认不显示
this.officeOCX.MaxFileSize = 32 * 1024; //最大的文档大小控制,默认是8M,现在设置成4M。
this.officeOCX.Print="1";
this.officeOCX.WebOpen();
if (file){
this.file = file;
var url = "";
if (!this.form.businessData.workCompleted){
url = this.form.workAction.action.actions.getAttachmentData.uri;
url = url.replace("{id}", encodeURIComponent(file.id));
return this.form.workAction.action.address+url.replace("{workid}", encodeURIComponent(this.form.businessData.work.id));
}else{
url = this.form.workAction.action.actions.getWorkcompletedAttachmentData.uri;
url = url.replace("{id}", encodeURIComponent(file.id));
return this.form.workAction.action.address+url.replace("{workCompletedId}", encodeURIComponent(this.form.businessData.workCompleted.id));
this.fireEvent("afterOpen");
this.loadMenu();
if(!this.readonly){
if(this.json.iWebOfficeEditProperties.IsNoCopy === "1"){
this.unableCopy();
}else {
this.enableCopy();
}
if(this.json.trackRevisions === "1"){
this.showRevision();
}else {
this.hideRevision();
}
}else {
if(this.json.iWebOfficeReadProperties.IsNoCopy === "1"){
this.unableCopy();
}else {
this.enableCopy();
}
}else{
return this.getTempleteUrl();
}
},
/**
* @summary 允许编辑Office文档
* @example
* this.form.get("fieldId").editEnabled();
*/
editEnabled: function(){
try {
this.officeOCX.ActiveDocument.Unprotect();
}catch(e){}
setBookMark : function (name,value){
if (!this.officeOCX.WebSetBookMarks(name,value)){
//console.log("公文域内容设置失败");
//console.log(WebOffice.Status);
}else{
//alert("公文域内容设置成功");
//console.log(WebOffice.Status);
}
},
/**
* @summary 设置Office文档为只读
* @example
* this.form.get("fieldId").docReadonly();
*/
docReadonly: function(){
this.protect(3);
getBookMark : function (name){
return this.officeOCX.WebGetBookMarks(name);
},
/**
* @summary 设置Office文档状态
* @example
* this.form.get("fieldId").protect(1);
* @param {Number} type 1(批注),2(填写窗体),3(只读),0(修订),-1(限制编辑样式)
*/
protect: function(type){
// wdAllowOnlyComments = 1 //批注
// wdAllowOnlyFormFields = 2 //填写窗体
// wdAllowOnlyReading = 3 //只读
// wdAllowOnlyRevisions = 0 //修订
// wdNoProtection = -1 //限制编辑样式
try {
this.officeOCX.ActiveDocument.Protect(type);
}catch(e){}
openLocal : function (){
try{
this.officeOCX.WebOpenLocal();
}catch(e){this.officeOCX.Alert(e.description);}
},
/**
* @summary 设置Office文档保留痕迹
*/
startRevisions: function(){
if (this.officeOCX && (this.officeOCX.DocType==1 || this.officeOCX.DocType==6)){
this.officeOCX.ActiveDocument.Application.UserName = layout.desktop.session.user.name;
this.officeOCX.ActiveDocument.Application.UserInitials = layout.desktop.session.user.name;
if (!this.isNew){
this.officeOCX.ActiveDocument.TrackRevisions = true;
this.officeOCX.ActiveDocument.showRevisions = false;
}else{
this.officeOCX.ActiveDocument.TrackRevisions = false;
this.officeOCX.ActiveDocument.showRevisions = false;
saveLocal : function (){
try{
this.officeOCX.WebSaveLocal();
this.officeOCX.Alert("success");
}catch(e){
this.officeOCX.Alert(e.description);
}
this.officeOCX.ActiveDocument.Application.UserName = layout.desktop.session.user.name;
if( this.officeOCX.ActiveDocument && this.officeOCX.ActiveDocument.Application ){
if(15==this.officeOCX.getOfficeVer()){//如果是OFFICE 2013则设置Options.UseLocalUserInfo属性为true,TANGER_OCX_OBJ为文档控件对象
this.officeOCX.ActiveDocument.Application.Options.UseLocalUserInfo=true;
this.officeOCX.WebUserName= layout.desktop.session.user.name;
},
savePdf : function (){
try{
if(this.officeOCX.WebSavePDF())
{
this.officeOCX.Alert("success");
}
else{
this.officeOCX.Alert("error");
}
} catch(e){
alert(e.description);
}
//this.officeOCX.FullScreenMode = true;
},
/**
* @summary 设置Office文档取消保留痕迹
*/
stopRevisions: function(accept){
this.officeOCX.ActiveDocument.TrackRevisions = false;
this.officeOCX.ActiveDocument.showRevisions = false;
if (accept) this.officeOCX.ActiveDocument.AcceptAllRevisions();
print : function (){
try{
var falg = this.officeOCX.WebOpenPrint();
//alert(falg);
}catch(e){alert(e.description);}
},
createMenuAction: function(id, title, img){
var title = title || MWF.xApplication.process.Xform.LP[id];
return new Element("div", {
"MWFnodeid": id,
"MWFnodetype": "MWFToolBarButton",
"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+img,
"title": title,
"MWFButtonAction": "menuAction",
"MWFButtonText": title
}).inject(this.menuNode);
protect : function (){
try{
this.officeOCX.WebSetProtect(true,""); //""表示密码为空
}catch(e){this.officeOCX.Alert(e.description);}
},
createMenuActionMenu: function(id, title, img){
var title = title || MWF.xApplication.process.Xform.LP[id];
return new Element("div", {
"MWFnodeid": id,
"MWFnodetype": "MWFToolBarMenu",
"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+img,
"title": title,
"MWFButtonAction": "menuAction",
"MWFButtonText": title
}).inject(this.menuNode);
unProtect : function (){
try{
this.officeOCX.WebSetProtect(false,""); //""表示密码为空
}catch(e){this.officeOCX.Alert(e.description);}
},
createMenuActionMenuItem: function(id, title, img, action){
return new Element("div", {
"MWFnodeid": id,
"MWFnodetype": "MWFToolBarMenuItem",
"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+img,
"title": title,
"MWFButtonAction": action,
"MWFButtonText": title
}).inject(this.menuNode);
enableCopy : function (){
try{
this.officeOCX.CopyType=true;
}catch(e){this.officeOCX.Alert(e.description);}
},
menuAction: function(button){
switch (button.buttonID){
case "menu_new":
this.officeOCX.CreateNew(this.getProgID());
break;
case "menu_openfile":
this.officeOCX.ShowDialog(1);
break;
case "menu_savefile":
this.officeOCX.ShowDialog(3);
break;
case "revisions":
this.toggleRevisions(button);
break;
case "menu_fullscreen":
this.officeOCX.FullScreenMode = true;
break;
case "toolbar":
var text = (this.officeOCX.ToolBars) ? MWF.xApplication.process.Xform.LP.menu_toolbar_show : MWF.xApplication.process.Xform.LP.menu_toolbar_hide;
button.setText(text);
this.officeOCX.ToolBars = !this.officeOCX.ToolBars;
break;
case "menu_preview":
this.officeOCX.PrintPreview();
break;
case "menu_showHistory":
this.showHistory(button);
break;
case "menu_redfile":
this.redFile();
break;
case "menu_seal":
this.seal();
break;
case "menu_att":
button.menu.clearItems();
button._loadMenuItem(this.createMenuActionMenuItem("", MWF.xApplication.process.Xform.LP.menu_file, "109.png", "openFile"));
button._loadMenuLine();
var attcs = this.json.attachmentIds.split(/,\s*|;\s*|,\s*|;\s*/g);
attcs.each(function(att){
this.form.businessData.attachmentList.each(function (attachement) {
if(attachement.site===att){
if (attachement.control.allowEdit){
if (this.options.files.indexOf(attachement.extension.toLowerCase())!==-1){
button._loadMenuItem(this.createMenuActionMenuItem(attachement.id, attachement.name, "14.png", "openAttachment:"+attachement.id+":"+att+":"+attachement.name));
}
}
}
}.bind(this));
/*var attc = this.form.all[att];
if (attc){
attc.attachmentController.attachments.each(function(a){
if (a.data.control.allowEdit){
if (this.options.files.indexOf(a.data.extension.toLowerCase())!==-1){
button._loadMenuItem(this.createMenuActionMenuItem(a.data.id, a.data.name, "14.png", "openAttachment:"+a.data.id+":"+att+":"+a.data.name));
}
}
}.bind(this));
}*/
}.bind(this));
}
unableCopy : function (){
try{
this.officeOCX.CopyType=false;
}catch(e){this.officeOCX.Alert(e.description);}
},
showRevision : function (){
this.officeOCX.WebShow(true);
},
openFile: function(bt, e, item){
if (this.openedAttachment){
this.save();
this.loadOfficeEdit();
hideRevision : function (){
this.officeOCX.WebShow(false);
},
acceptAllRevisions : function (){
this.officeOCX.WebObject.Application.ActiveDocument.AcceptAllRevisions();
var mCount = this.officeOCX.WebObject.Application.ActiveDocument.Revisions.Count;
if(mCount>0){
return false;
}else{
return true;
}
},
openAttachment: function(id, site, name){
if (!this.openedAttachment || this.openedAttachment.id!==id){
this.save();
if (this.form.businessData.workCompleted){
MWF.Actions.get("x_processplatform_assemble_surface").getAttachmentWorkcompletedUrl(id, this.form.businessData.workCompleted.id, function(url){
this.openedAttachment = {"id": id, "site": site, "name": name};
this.officeOCX.BeginOpenFromURL(url, true, this.readonly || this.json.isAttReadonly );
}.bind(this));
isEmpty : function(){
},
save: function(){
if (!this.readonly){
this.fireEvent("beforeSave");
var ret = this.officeOCX.WebSave(); //交互OfficeServer的OPTION="SAVEFILE"
if (ret){
//this.officeOCX.Alert(this.officeOCX.Status);
}else{
MWF.Actions.get("x_processplatform_assemble_surface").getAttachmentUrl(id, this.form.businessData.work.id, function(url){
this.openedAttachment = {"id": id, "site": site, "name": name};
this.officeOCX.BeginOpenFromURL(url, true, this.readonly || this.json.isAttReadonly);
}.bind(this));
//alert(this.officeOCX.Status);
}
this.fireEvent("afterSave");
}
},
loadMenu: function(){
if (!this.isMenuLoad){
if (this.json.menuEditButtons && this.json.menuEditButtons.length){
this.menuNode = new Element("div", {"styles": this.form.css.officeMenuNode}).inject(this.node, "top");
MWF.require("MWF.widget.Toolbar", function(){
this.toolbarWidget = new MWF.widget.Toolbar(this.menuNode, {"style": "xform_blue_simple"}, this);
......@@ -449,9 +412,6 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
this.revisionsItem = this.createMenuAction("revisions", text, "76.png");
}
if (this.json.menuEditButtons.indexOf("fullscreen")!==-1){
this.fullscreenItem = this.createMenuAction("menu_fullscreen", "", "4.png");
}
if (this.json.menuEditButtons.indexOf("toolbar")!==-1){
if (!this.readonly){
var text = MWF.xApplication.process.Xform.LP.menu_toolbar_show;
......@@ -460,33 +420,10 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
}
this.toolbarItem = this.createMenuAction("toolbar", text, "91.png");
}
}
if (this.json.menuEditButtons.indexOf("preview")!==-1){
this.fullscreenItem = this.createMenuAction("menu_preview", "", "21.png");
}
if (this.json.menuEditButtons.indexOf("showHistory")!==-1){
atts = this.form.businessData.attachmentList;
if (atts.some(function(att){
return att.site == this.json.id+"history";
}.bind(this))){
this.historyItem = this.createMenuAction("menu_showHistory", "", "115.png");
}
}
if (this.json.menuEditButtons.indexOf("redfile")!==-1){
if (!this.readonly) this.redItem = this.createMenuAction("menu_redfile", "", "12.png");
}
if (this.json.menuEditButtons.indexOf("seal")!==-1){
if (!this.readonly) this.sealItem = this.createMenuAction("menu_seal", "", "84.png");
}
if (this.json.isOpenAttachment){
if (this.json.attachmentIds){
this.sealItem = this.createMenuActionMenu("menu_att", "", "14.png");
}
}
this.toolbarWidget.load();
}.bind(this));
......@@ -495,1057 +432,54 @@ MWF.xApplication.process.Xform.IWebOffice = MWF.APPIWebOffice = new Class({
this.isMenuLoad = true;
}
},
showHistory: function(button){
if (this.historyItem.get("text") == MWF.xApplication.process.Xform.LP.menu_hideHistory){
var url = this.getOfficeFileUrl();
if (url){
var id = this.getOfficeObjectId();
this.addOfficeEvent(id, "OnDocumentOpened(url, doc)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentOpened(url, doc);");
this.addOfficeEvent(id, "AfterOpenFromURL(doc, statusCode)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].AfterOpenFromURL(doc, statusCode);");
button.setText(MWF.xApplication.process.Xform.LP.menu_showHistory);
this.officeOCX.BeginOpenFromURL(url, true, this.readonly);
this.historyMode = false;
}
}else{
MWF.require("MWF.xDesktop.Dialog", function(){
var width = 680;
var height = 500;
var p = MWF.getCenterPosition(this.form.app.content, width, height);
var _self = this;
var dlg = new MWF.xDesktop.Dialog({
"title": MWF.xApplication.process.Xform.LP.menu_showHistory,
//"style": "work",
"style" : this.form.json.dialogStyle || "user",
"top": p.y-100,
"left": p.x,
"fromTop": p.y-100,
"fromLeft": p.x,
"width": width,
"height": height,
"html": "<div></div>",
"container": this.form.app.content,
"isClose": true,
"buttonList": [
{
"text": MWF.xApplication.process.Xform.LP.close,
"action": function(){this.close();}
}
],
"onPostShow": function(){
this.showHistoryContent(dlg, button)
}.bind(this)
});
dlg.show();
}.bind(this));
}
},
showHistoryContent: function(dlg, button){
dlg.content.setStyle("overflow", "auto");
atts = this.form.businessData.attachmentList;
var site = this.json.id+"history";
for (var i=0; i<atts.length; i++){
if ((atts[i].site===site)){
//for (var x=0; x<31; x++){
file = atts[i];
var div = new Element("div", {
"styles": {
"margin": "20px auto 0px auto",
"height": "30px",
"line-height": "30px",
"width": "80%",
"font-size": "16px",
"color": "#666666",
"border-bottom": "1px solid #CCCCCC"
},
"value": file.id
}).inject(dlg.content);
var fileNameNode = new Element("div", {
"styles": {"float": "left"},
"text": file.name
}).inject(div);
var buttonNode = new Element("input", {
"type": "button",
"styles": {"float": "right"},
"value": MWF.xApplication.process.Xform.LP.seeVersion,
"events": {
"click": function(e){
this.openOfficeHistory(e, dlg, button);
}.bind(this)
}
}).inject(div);
//}
}
}
},
openOfficeHistory: function(e, dlg, button){
var fileName = e.target.getParent().get("value");
if (!this.form.businessData.workCompleted){
url = this.form.workAction.action.actions.getAttachmentData.uri;
url = url.replace("{id}", encodeURIComponent(fileName));
url = this.form.workAction.action.address+url.replace("{workid}", encodeURIComponent(this.form.businessData.work.id));
}else{
url = this.form.workAction.action.actions.getWorkcompletedAttachmentData.uri;
url = url.replace("{id}", encodeURIComponent(fileName));
url = this.form.workAction.action.address+url.replace("{workCompletedId}", encodeURIComponent(this.form.businessData.workCompleted.id));
}
dlg.close();
this.save();
this.officeOCX.BeginOpenFromURL(url, true, true);
this.historyMode = true;
if (button){
button.setText(MWF.xApplication.process.Xform.LP.menu_hideHistory)
}
},
/**
* @summary 盖章
*/
seal: function(){
this.fireEvent("seal");
createMenuAction: function(id, title, img){
var title = title || MWF.xApplication.process.Xform.LP[id];
return new Element("div", {
"MWFnodeid": id,
"MWFnodetype": "MWFToolBarButton",
"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+img,
"title": title,
"MWFButtonAction": "menuAction",
"MWFButtonText": title
}).inject(this.menuNode);
},
/**
* @summary 套红
*/
redFile: function(){
// try {
if (this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter){
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.Markup = 0;
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.View = 0;
}
this.officeOCX.ActiveDocument.showRevisions = false;
this.stopRevisions(true);
menuAction: function(button){
this.fireEvent("redFile");
// this.officeOCX.ActiveDocument.Application.Selection.WholeStory();
// this.officeOCX.ActiveDocument.Application.Selection.Font.Name = "仿宋";
// this.officeOCX.ActiveDocument.Application.Selection.Font.Size = 14;
// this.officeOCX.ActiveDocument.Application.Selection.Cut();
//
// this.officeOCX.OpenFromUrl("../x_desktop/temp/1.doc", false);
//
// var mark = this.officeOCX.ActiveDocument.Bookmarks("bodyCw");
//
// mark.Range.PasteSpecial(false, false, 0, false, 2);
//mark.Range.Paste();
// }catch(e){
// throw e;
// }
},
/**
* @summary 显示痕迹
*/
showRevisions: function(){
try {
if (this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter) {
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.Markup = 2;
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.View = 0;
}
this.officeOCX.ActiveDocument.showRevisions = true;
}catch(e){}
},
/**
* @summary 隐藏痕迹
*/
hideRevisions: function(){
try {
if (this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter) {
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.Markup = 0;
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.View = 0;
switch (button.buttonID){
case "menu_new":
this.createNew();
break;
case "menu_openfile":
this.openLocal();
break;
case "menu_savefile":
this.saveLocal();
break;
case "revisions":
this.toggleRevisions(button);
break;
case "toolbar":
// var text = (this.officeOCX.ToolBars) ? MWF.xApplication.process.Xform.LP.menu_toolbar_show : MWF.xApplication.process.Xform.LP.menu_toolbar_hide;
// button.setText(text);
// this.officeOCX.ToolBars = !this.officeOCX.ToolBars;
break;
case "menu_preview":
this.print();
break;
}
this.officeOCX.ActiveDocument.showRevisions = false;
}catch(e){}
},
toggleRevisions: function(button){
var t = this.revisionsItem.get("text");
if (t===MWF.xApplication.process.Xform.LP.menu_revisions_show){
button.setText(MWF.xApplication.process.Xform.LP.menu_revisions_hide);
try {
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.Markup = 2;
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.View = 0;
}catch(e){}
try {
this.officeOCX.ActiveDocument.showRevisions = true;
}catch(e){}
this.showRevision();
}else{
button.setText(MWF.xApplication.process.Xform.LP.menu_revisions_show);
try {
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.Markup = 0;
this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter.View = 0;
}catch(e){}
try {
this.officeOCX.ActiveDocument.showRevisions = false;
}catch(e){}
this.hideRevision();
}
},
afterOpen: function(){
// this.officeOCX.AddCustomButtonOnMenu(0,"按钮0",false);
// this.officeOCX.AddCustomButtonOnMenu(1,"按钮1",true,1);
// this.officeOCX.AddCustomButtonOnMenu(2,"按钮2",true,2);
// this.officeOCX.AddCustomButtonOnMenu(3,"按钮3",false,3);
//
//
// this.officeOCX.AddCustomToolButton("预览(0)", 10);
//
// alert(111);
if (this.readonly) this.docReadonly();
if (this.json.trackRevisions==="1") this.startRevisions();
var scale = (this.readonly) ? this.json.readScale : this.json.editScale;
if (scale) scale = scale.toInt();
if (scale){
this.officeOCX.ActiveDocument.ActiveWindow.ActivePane.View.Zoom.Percentage = scale;
}
var display = this.officeNode.getStyle("display");
//window.setTimeout(function(){
this.officeOCX.Activate(false);
this.officeNode.setStyle("display", "none");
window.setTimeout(function(){
this.officeNode.setStyle("display", display);
this.officeOCX.Activate(true);
}.bind(this), 10);
//}.bind(this), 10);
//if (this.officeOCX) this.officeOCX.Activate(true);
// this.officeNode.scrollIntoView();
// this.form.app.node.scrollTo(0);
},
loadOfficeEditFirefox: function(file){
if (!this.officeOCX){
this.loadOfficeSpacer();
this.node.setStyle("pisition", "absolute");
var codeBase = this.json.codeBase || this.options.codeBase;
var version = this.json.version || this.options.version;
var classid = this.json.clsid || this.options.clsid;
var objectHtml = "";
if (navigator.userAgent.indexOf("Linux") > -1) {
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'>" +
"<OBJECT id='"+this.getOfficeObjectId()+"' " +
"type='application/ntko-plug' height='99%' width='100%' style='HEIGHT: 99%; WIDTH: 100%' "
}else{
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
"type='application/ntko-plug' " +
"style='HEIGHT: 99%; WIDTH: 100%' " +
"height='99%' width='100%' " +
"codeBase='"+codeBase+"#version="+version+"' " +
"clsid='{"+classid+"}' ";
}
// var objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
// "type='application/ntko-plug' " +
// "style='HEIGHT: 99%; WIDTH: 100%' " +
// "height='99%' width='100%' " +
// "codeBase='"+codeBase+"#version="+version+"' " +
// "clsid='{"+classid+"}' ";
objectHtml += "ForOnSaveToURL='OnComplete2' ";
objectHtml += "ForOnBeginOpenFromURL='OnComplete' ";
objectHtml += "ForOndocumentopened='OnComplete3' ";
objectHtml += "ForOnpublishAshtmltourl='publishashtml' ";
var pars = this.defaultParam();
pars = Object.merge(pars, this.json.ntkoEditProperties);
pars = Object.merge(pars, this.json.editProperties);
Object.each(pars, function(p, key){
objectHtml += "_"+key+"='"+p+"'";
});
objectHtml += ">";
//尚未安装NTKO Web Chrome跨浏览器插件。请点击<a href="../o2_lib/officecontrol/ntkoplugins.xpi">安装组件</a>
objectHtml += "<SPAN STYLE='color:red'>"+MWF.xApplication.process.Xform.LP.installNTKOWebChromePluginNotice_xpi+"</SPAN>";
objectHtml += "</OBJECT><input type='hidden' value='"+this.json.id+"' name='site'><input style='display:none' name=\"file\" type=\"file\"/></form>";
this.officeNode.appendHTML(objectHtml);
this.officeForm = this.officeNode.getFirst();
this.officeOCX = this.officeNode.getFirst().getFirst();
if(window.navigator.platform=="Win64"){
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase64,51,true);
}
if(window.navigator.platform=="Win32"){
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase,51,true);
}
this.doOfficeOCXEvents();
}
var url = this.getOfficeFileUrl();
if (url){
this.officeOCX.BeginOpenFromURL(url, true, this.readonly);
}else{
this.officeOCX.CreateNew(this.getProgID());
this.fireEvent("afterCreate");
}
},
loadOfficeEditChrome: function(file){
if (!this.officeOCX){
this.loadOfficeSpacer();
this.node.setStyle("pisition", "absolute");
var codeBase = this.officeConfig.codeBase || this.json.codeBase || this.options.codeBase;
var version = this.officeConfig.version || this.json.version || this.options.version;
var classid = this.officeConfig.classid || this.json.clsid || this.options.clsid;
var codeBase64 = this.officeConfig.codeBase64 || this.json.codeBase64 || this.options.codeBase64;
var classid64 = this.officeConfig.classid64 || this.json.clsid64 || this.options.clsid64;
var pdfType = this.officeConfig.pdfType || this.json.pdfType || this.options.pdfType;
var pdfVersion = this.officeConfig.pdfVersion || this.json.pdfVersion || this.options.pdfVersion;
var pdfCodeBase = this.officeConfig.pdfCodeBase || this.json.pdfCodeBase || this.options.pdfCodeBase;
var pdfCodeBase64 = this.officeConfig.pdfCodeBase64 || this.json.pdfCodeBase64 || this.options.pdfCodeBase64;
var objectHtml = "";
// if (navigator.userAgent.indexOf("Linux") > -1) {
// objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
// "type='application/ntko-plug' height='99%' width='100%' style='HEIGHT: 99%; WIDTH: 100%' "
// }else{
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT type='application/ntko-plug' id='"+this.getOfficeObjectId()+"' " +
"height='99%' width='100%' " +
"style='HEIGHT: 99%; WIDTH: 100%' " +
"codeBase='"+codeBase+"#version="+version+"' " +
"clsid='{"+classid+"}'";
// }
// if(window.navigator.platform=="Win64"){
// objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
// "style='HEIGHT: 99%; WIDTH: 100%' " +
// "codeBase='"+codeBase64+"#version="+version+"' " +
// "classid='{"+classid64+"}'>";
// }else{
// objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id='"+this.getOfficeObjectId()+"' " +
// "style='HEIGHT: 99%; WIDTH: 100%' " +
// "codeBase='"+codeBase+"#version="+version+"' " +
// "classid='{"+classid+"}'";
// }
// this.addOfficeEvent(id, "AfterOpenFromURL(doc, statusCode)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].AfterOpenFromURL(doc, statusCode);");
// this.addOfficeEvent(id, "OnDocumentOpened(url, doc)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentOpened(url, doc);");
// this.addOfficeEvent(id, "OnDocumentClosed()", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentClosed();");
// document.write('ForOnpublishAshtmltourl="ntkopublishashtml"');
// document.write('ForOnpublishAspdftourl="ntkopublishaspdf"');
// document.write('ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"');
objectHtml += "ForOnSaveToURL='OnComplete2' ";
objectHtml += "ForOnBeginOpenFromURL='OnComplete' ";
objectHtml += "ForOndocumentopened='OnComplete3' ";
objectHtml += "ForOnpublishAshtmltourl='publishashtml' ";
var pars = this.defaultParam();
pars = Object.merge(pars, this.json.ntkoEditProperties);
pars = Object.merge(pars, this.json.editProperties);
Object.each(pars, function(p, key){
objectHtml += "_"+key+"='"+p+"'";
});
objectHtml += ">";
//尚未安装NTKO Web Chrome跨浏览器插件。请点击<a href="../o2_lib/officecontrol/ntkoplugins.crx">安装组件</a>
objectHtml += "<SPAN STYLE='color:red'>"+MWF.xApplication.process.Xform.LP.installNTKOWebChromePluginNotice_crx+"</SPAN>";
objectHtml += "</OBJECT><input type='hidden' value='"+this.json.id+"' name='site'><input style='display:none' name=\"file\" type=\"file\"/></form>";
this.officeNode.appendHTML(objectHtml);
this.officeForm = this.officeNode.getFirst();
this.officeOCX = this.officeNode.getFirst().getFirst();
if (this.officeOCX){
if(window.navigator.platform=="Win64"){
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase64,51,true);
}
if(window.navigator.platform=="Win32"){
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase,51,true);
}
this.doOfficeOCXEvents();
}
}
var url = this.getOfficeFileUrl();
if (url){
this.officeOCX.BeginOpenFromURL(url, true, this.readonly);
}else{
window.setTimeout(function(){
this.officeOCX.CreateNew("WPS.Document");
}.bind(this), 5000);
//this.officeOCX.CreateNew(this.getProgID());
this.fireEvent("afterCreate");
}
},
loadOfficeEdit: function(file){
debugger;
if (Browser.name==="chrome"){
this.loadOfficeEditChrome(file);
}else if (Browser.name==="firefox") {
this.loadOfficeEditFirefox(file);
}else{
this.loadOfficeEditIE(file);
}
this.openedAttachment = null
},
getAutoSavedAttachments: function(){
this.autoSavedAttachments = [];
this.form.businessData.attachmentList.each(function(att){
if (att.site===this.json.id+"autosave") this.autoSavedAttachments.push(att);
}.bind(this));
},
loadOfficeEditIE: function(file){
if (!this.officeOCX){
this.loadOfficeSpacer();
//this.loadMenu();
this.node.setStyle("pisition", "absolute");
var codeBase = this.officeConfig.codeBase || this.json.codeBase || this.options.codeBase;
var version = this.officeConfig.version || this.json.version || this.options.version;
var classid = this.officeConfig.classid || this.json.clsid || this.options.clsid;
var codeBase64 = this.officeConfig.codeBase64 || this.json.codeBase64 || this.options.codeBase64;
var classid64 = this.officeConfig.classid64 || this.json.clsid64 || this.options.clsid64;
var pdfType = this.officeConfig.pdfType || this.json.pdfType || this.options.pdfType;
var pdfVersion = this.officeConfig.pdfVersion || this.json.pdfVersion || this.options.pdfVersion;
var pdfCodeBase = this.officeConfig.pdfCodeBase || this.json.pdfCodeBase || this.options.pdfCodeBase;
var pdfCodeBase64 = this.officeConfig.pdfCodeBase64 || this.json.pdfCodeBase64 || this.options.pdfCodeBase64;
var objectHtml = "";
if(window.navigator.platform=="Win64"){
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id=\""+this.getOfficeObjectId()+"\" " +
"style=\"HEIGHT: 99%; WIDTH: 100%\" " +
"codeBase=\""+codeBase64+"#version="+version+"\" " +
"classid=\"clsid:"+classid64+"\">";
}else{
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id=\""+this.getOfficeObjectId()+"\" " +
"style=\"HEIGHT: 99%; WIDTH: 100%\" " +
"codeBase=\""+codeBase+"#version="+version+"\" " +
"classid=\"clsid:"+classid+"\">";
}
var pars = this.defaultParam();
pars = Object.merge(pars, this.json.ntkoEditProperties);
pars = Object.merge(pars, this.json.editProperties);
Object.each(pars, function(p, key){
objectHtml += "<PARAM NAME=\""+key+"\" value=\""+p+"\">";
});
//objectHtml += "<div style=\"color:red; position:relative; top:-800px; background:#eeeeee; height:760px; padding:20px; text-align:center; font-size:18px; cursor: pointer \">如果不能自动安装控件,请将在点击此处下载并安装签章客户端。</div>";
objectHtml += "</OBJECT><input type='hidden' value='"+this.json.id+"' name='site'><input type='hidden' value='' name='fileName'><input style='display:none' name=\"file\" type=\"file\"/></form>";
this.officeNode.appendHTML(objectHtml);
this.officeForm = this.officeNode.getFirst();
this.officeOCX = this.officeNode.getFirst().getFirst();
if(window.navigator.platform=="Win64"){
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase64,51,true);
}else{
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase,51,true);
}
//TANGER_OCX_OBJ.CreateNew("word.document");
//this.officeOCX.AddDocTypePlugin(".pdf","PDF.NtkoDocument","4.0.0.7","../x_desktop/res/framework/officecontrol/ntkooledocall.cab",51,true);
this.doOfficeOCXEvents();
}
this.getAutoSavedAttachments();
if (this.autoSavedAttachments && this.autoSavedAttachments.length){
this.openRecoverAutoSaveDlg();
}else{
this.openOfficeFile(file);
}
},
openOfficeFile: function(file){
var url = file || this.getOfficeFileUrl();
if (url){
//layout.desktop.tmpOffice = this;
this.officeOCX.BeginOpenFromURL(url, true, this.readonly);
}else{
this.isNew = true;
this.officeOCX.CreateNew(this.getProgID());
this.fireEvent("afterCreate");
}
//begin auto save
if (this.json.isAutoSave){
if (!this.autoSaveTimerID){
this.autoSave();
this.form.app.addEvent("queryClose", function(){
if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID);
}.bind(this));
}
}
},
clearAutoSaveAttachments: function(){
this.form.businessData.attachmentList.each(function(att){
if (att.site===this.json.id+"autosave") o2.Actions.get("x_processplatform_assemble_surface").deleteAttachment(att.id, this.form.businessData.work.id);
}.bind(this));
this.autoSavedAttachments = [];
},
getRecoverItems: function(recoverItemNode){
var css = this.form.css;
var _self = this;
this.autoSavedAttachments.each(function(att){
var node = new Element("div", {"styles": css.officeRecoverItemNode}).inject(recoverItemNode);
var actionNode = new Element("div", {"styles": css.officeRecoverItemActionNode}).inject(node);
var titleNode = new Element("div", {"styles": css.officeRecoverItemTitleNode, "text": att.name}).inject(node);
node.store("att", att);
actionNode.addEvent("click", function(e){
var n = this.getParent();
var att = n.retrieve("att");
_self.form.workAction.getAttachmentData(att.id, _self.form.businessData.work.id);
e.stopPropagation();
});
node.addEvents({
"mouseover": function(){
var isSelected = this.retrieve("isSelected");
if (!isSelected) this.setStyles(css.officeRecoverItemNode_over);
},
"mouseout": function(){
var isSelected = this.retrieve("isSelected");
if (!isSelected) this.setStyles(css.officeRecoverItemNode)
},
"click": function(){
var isSelected = this.retrieve("isSelected");
if (isSelected){
this.setStyles(css.officeRecoverItemNode);
this.getFirst().setStyles(css.officeRecoverItemActionNode);
this.store("isSelected", false);
}else{
var items = recoverItemNode.getChildren();
items.each(function(item){
item.setStyles(css.officeRecoverItemNode);
item.getFirst().setStyles(css.officeRecoverItemActionNode);
item.store("isSelected", false);
});
this.setStyles(css.officeRecoverItemNode_current);
this.getFirst().setStyles(css.officeRecoverItemActionNode_current);
this.store("isSelected", true);
}
}
});
}.bind(this));
},
openRecoverAutoSaveDlg: function(){
var lp = MWF.xApplication.process.Xform.LP;
var node = new Element("div", {"styles": {"overflow": "hidden", "padding": "0 30px"}});
var html = "<div style=\"line-height: 30px; height: 30px; color: #333333; overflow: hidden\">"+lp.selectVersionToRestore+"</div>";
html += "<div style=\"max-height: 300px; margin-bottom:10px; margin-top:10px; overflow-y:auto;\"></div>";
node.set("html", html);
var recoverItemNode = node.getLast();
this.getRecoverItems(recoverItemNode);
node.inject(this.form.app.content);
var _self = this;
var dlg = o2.DL.open({
"title": lp.restoreFile,
//"style": "work",
"isResize": false,
"content": node,
"width": 600,
"onPostClose": function(){
_self.clearAutoSaveAttachments();
},
"buttonList": [
{
"text": MWF.xApplication.process.Xform.LP.recover,
"action": function(d, e){
this.doRecoverFile(node, e, dlg);
}.bind(this)
},
{
"text": MWF.xApplication.process.Xform.LP.notRecover,
"action": function(d, e){
this.doNotRecoverFile(node, e, dlg);
}.bind(this)
}
]
});
},
doNotRecoverFile: function(node, e, dlg){
var _self = this;
this.form.app.confirm("infor", e, this.form.app.lp.notRecoverFileConfirmTitle, this.form.app.lp.notRecoverFileConfirmContent, 450, 120, function(){
this.close();
dlg.close();
_self.openOfficeFile();
}, function(){
this.close();
}, null, null, this.form.json.confirmStyle);
},
doRecoverFile: function(node, e, dlg){
var recoverItemNode = node.getLast();
var items = recoverItemNode.getChildren();
var _self = this;
for (var i=0; i<items.length; i++){
if (items[i].retrieve("isSelected")){
var text = this.form.app.lp.recoverFileConfirmContent;
var att = items[i].retrieve("att");
text = text.replace("{att}", att.name);
this.form.app.confirm("infor", e, this.form.app.lp.recoverFileConfirmTitle, text, 450, 120, function(){
this.close();
dlg.close();
_self.form.workAction.getAttachmentUrl(att.id, _self.form.businessData.work.id, function(file){
_self.openOfficeFile(file);
dlg.close();
});
}, function(){
this.close();
}, null, null, this.form.json.confirmStyle);
break;
}
}
},
checkAutoSaveNumber: function(callback){
if (!this.autoSavedAttachments) this.autoSavedAttachments = [];
if (!this.json.autoSaveNumber) this.json.autoSaveNumber = 3;
if (this.autoSavedAttachments.length >= this.json.autoSaveNumber.toInt()){
//delete first att
var att = this.autoSavedAttachments.shift();
o2.Actions.get("x_processplatform_assemble_surface").deleteAttachment(att.id, this.form.businessData.work.id, function(){
this.checkAutoSaveNumber(callback);
}.bind(this));
}else{
if (callback) callback();
}
},
getAutoSaveFileName: function(){
var ename = "docx";
switch (this.json.officeType){
case "word":
ename = "docx";
break;
case "excel":
ename = "xlsx";
break;
case "ppt":
ename = "pptx";
}
var d = Date.parse(new Date());
var dText = d.format("%Y-%m-%d %H:%M:%S");
return MWF.xApplication.process.Xform.LP.autosave+"("+dText+")."+ename;
},
autoSave: function(){
var interval = (this.json.autoSaveTime) ? this.json.autoSaveTime.toInt()*60*1000 : (5*60*1000);
this.autoSaveTimerID = window.setInterval(function(){
if (!this.openedAttachment){
this.checkAutoSaveNumber(function(){
try{
var fileName = this.getAutoSaveFileName();
this.officeForm.getElement("input").set("value", this.json.id+"autosave");
url = this.form.workAction.action.actions.uploadAttachment.uri;
url = this.form.workAction.action.address+url.replace("{id}", this.form.businessData.work.id);
this.officeOCX.SaveToURL(url, "file", "", fileName, this.getFormId());
this.form.workAction.listAttachments(this.form.businessData.work.id, function(json){
this.form.businessData.attachmentList = json.data;
for (var i=0; i<json.data.length; i++){
var att = json.data[i];
if (att.name===fileName){
this.autoSavedAttachments.push(att);
break;
}
}
}.bind(this), null, false);
}catch(e){}
}.bind(this));
}
}.bind(this), interval);
},
doOfficeOCXEvents: function(){
var id = this.getOfficeObjectId();
this.addOfficeEvent(id, "AfterOpenFromURL(doc, statusCode)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].AfterOpenFromURL(doc, statusCode);");
this.addOfficeEvent(id, "OnDocumentOpened(url, doc)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentOpened(url, doc);");
this.addOfficeEvent(id, "OnDocumentClosed()", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentClosed();");
},
OnDocumentClosed: function(){
this.fireEvent("afterCloseOffice");
},
OnDocumentOpened: function(url, doc){
this.afterOpen();
this.loadMenu();
this.fireEvent("afterOpenOffice", {
url : url,
doc : doc
});
},
AfterOpenFromURL: function(doc, statusCode){
this.fireEvent("afterOpen", [doc, statusCode]);
},
addOfficeEvent: function(id, event, code){
var script = document.createElement("script");
script.setAttribute("for", id);
script.setAttribute("event", event);
script.innerText = code;
this.officeForm.appendChild(script);
},
loadOfficeRead: function(file){
this.loadOfficeSpacer();
this.node.setStyle("pisition", "absolute");
var codeBase = this.officeConfig.codeBase || this.json.codeBase || this.options.codeBase;
var version = this.officeConfig.version || this.json.version || this.options.version;
var classid = this.officeConfig.classid || this.json.clsid || this.options.clsid;
var codeBase64 = this.officeConfig.codeBase64 || this.json.codeBase64 || this.options.codeBase64;
var classid64 = this.officeConfig.classid64 || this.json.clsid64 || this.options.clsid64;
var objectHtml = "";
if(window.navigator.platform=="Win64"){
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id=\""+this.getOfficeObjectId()+"\" " +
"style=\"HEIGHT: 99%; WIDTH: 100%\" " +
"codeBase=\""+codeBase64+"#version="+version+"\" " +
"classid=\"clsid:"+classid64+"\">";
}else{
objectHtml = "<form id='"+this.getFormId()+"' style='height:100%'><OBJECT id=\""+this.getOfficeObjectId()+"\" " +
"style=\"HEIGHT: 99%; WIDTH: 100%\" " +
"codeBase=\""+codeBase+"#version="+version+"\" " +
"classid=\"clsid:"+classid+"\">";
}
var pars = this.defaultParam(true);
pars = Object.merge(pars, this.json.ntkoReadProperties);
pars = Object.merge(pars, this.json.readProperties);
Object.each(pars, function(p, key){
objectHtml += "<PARAM NAME=\""+key+"\" value=\""+p+"\">";
});
objectHtml += "</object></form>";
this.officeNode.set("html", objectHtml);
this.officeForm = this.officeNode.getFirst();
/**
@summary Ntko Office 控件对象, 第三方控件
@see {@link http://ieoffice.ntko.com/pro/show/mid/1_8/pid/2731|NTKO官网 }
@example
var officeOCX = this.form.get("fieldId").officeOCX;
var activeDocument = officeOCX.ActiveDocument //返回一个Office Document 对象,该对象代表活动文档。
*/
this.officeOCX = this.officeNode.getFirst().getFirst();
if(window.navigator.platform=="Win64"){
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase64,51,true);
}else{
this.officeOCX.AddDocTypePlugin(".pdf",pdfType,pdfVersion,pdfCodeBase,51,true);
}
//this.officeOCX.AddDocTypePlugin(".pdf","PDF.NtkoDocument","4.0.0.3","../x_desktop/res/framework/officecontrol/ntkooledocall.cab",51,true);
var url = file || this.getOfficeFileUrl();
if (url){
var id = this.getOfficeObjectId();
this.addOfficeEvent(id, "OnDocumentOpened(url, doc)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].OnDocumentOpened(url, doc);");
this.addOfficeEvent(id, "AfterOpenFromURL(doc, statusCode)", "if (layout.desktop.offices[\""+id+"\"]) layout.desktop.offices[\""+id+"\"].AfterOpenFromURL(doc, statusCode);");
this.officeOCX.BeginOpenFromURL(url, true, this.readonly);
}
},
createUploadFileNode: function(){
this.uploadFileAreaNode = new Element("div", {"styles": {"display": "none"}});
var html = "<input name=\"file\" type=\"file\"/>";
this.uploadFileAreaNode.set("html", html);
this.fileUploadNode = this.uploadFileAreaNode.getFirst();
this.uploadFileAreaNode.inject(this.officeForm);
},
isEmpty : function(){
var data = this.getData();
return !data.trim();
},
getData: function(){
if (this.officeOCX && (this.officeOCX.DocType==1 || this.officeOCX.DocType==6)){
this.officeOCX.ActiveDocument.Application.Selection.WholeStory();
var content = this.officeOCX.ActiveDocument.Application.Selection.Text;
return content;
}else{
return this._getBusinessData();
}
},
setData: function(){},
/**
* @summary 保存Office文档到后台
* @param {Boolean} history - 是否生产保留痕迹文件
*/
save: function(history){
//if (!this.uploadFileAreaNode) this.createUploadFileNode();
if (!this.readonly){
if (this.historyMode) return true;
if (!this.officeForm) return true;
this.fireEvent("beforeSave");
try{
if (this.openedAttachment){
this.officeForm.getElement("input").set("value", this.openedAttachment.site);
url = this.form.workAction.action.actions.replaceAttachment.uri;
url = url.replace("{id}", this.openedAttachment.id);
url = this.form.workAction.action.address+url.replace("{workid}", this.form.businessData.work.id);
this.officeOCX.SaveToURL(url, "file", "", this.openedAttachment.name, this.getFormId());
}else{
if (history){
if (this.json.isHistory) this.saveHistory();
}
this.clearAutoSaveAttachments();
// if (this.autoSavedAttachments && this.autoSavedAttachments.length){
// this.autoSavedAttachments.each(function(att){
// o2.Actions.get("x_processplatform_assemble_surface").deleteAttachment(att.id, this.form.businessData.work.id);
// }.bind(this));
// this.autoSavedAttachments = [];
// }
//this.saveHTML();
this.officeForm.getElement("input").set("value", this.json.id);
var url = "";
if (this.file){
url = this.form.workAction.action.actions.replaceAttachment.uri;
url = url.replace("{id}", this.file.id);
url = this.form.workAction.action.address+url.replace("{workid}", this.form.businessData.work.id);
this.officeOCX.SaveToURL(url, "file", "", this.getFileName(), this.getFormId());
}else{
url = this.form.workAction.action.actions.uploadAttachment.uri;
url = this.form.workAction.action.address+url.replace("{id}", this.form.businessData.work.id);
this.officeOCX.SaveToURL(url, "file", "", this.getFileName(), this.getFormId());
this.form.workAction.getWorkContent(this.form.businessData.work.id, function(json){
this.form.businessData.attachmentList = json.data.attachmentList;
this.getOfficeFileUrl();
}.bind(this));
}
}
}catch (e){}
this.fireEvent("afterSave");
}
},
getHistoryFileName: function(){
var ename = "docx";
switch (this.json.officeType){
case "word":
ename = "docx";
break;
case "excel":
ename = "xlsx";
break;
case "ppt":
ename = "pptx";
}
//var id = (this.form.businessData.work) ? this.form.businessData.work.id : this.form.businessData.workCompleted.id;
var activity = (this.form.businessData.work) ? this.form.businessData.work.activityName : MWF.xApplication.process.Xform.LP.completed;
var name = MWF.name.cn(layout.session.user.name);
var d = Date.parse(new Date());
var dText = d.format("%Y-%m-%d %H:%M");
return activity+"("+name+")-"+dText+"."+ename;
},
saveHistory: function(){
var fileName = this.getHistoryFileName();
this.officeForm.getElement("input").set("value", this.json.id+"history");
url = this.form.workAction.action.actions.uploadAttachment.uri;
url = this.form.workAction.action.address+url.replace("{id}", this.form.businessData.work.id);
this.officeOCX.SaveToURL(url, "file", "", fileName, this.getFormId());
},
getHTMLFileName: function(){
//var id = (this.form.businessData.work) ? this.form.businessData.work.id : this.form.businessData.workCompleted.id;
var id = (!this.form.businessData.workCompleted) ? this.form.businessData.work.id : this.form.businessData.workCompleted.workId;
return id+this.json.id+".mht";
},
saveHTML: function(){
this.officeForm.getElement("input").set("value", this.json.id+"$view");
var file = null;
for (var i=0; i<this.form.businessData.attachmentList.length; i++){
var att = this.form.businessData.attachmentList[i];
if (att.site==this.json.id+"$view"){
file = att;
}
}
var fileName = (file) ? file.name : this.getHTMLFileName();
this.officeForm.getElement("input").getNext().set("value", fileName);
if (file){
url = this.form.workAction.action.actions.replaceAttachment.uri;
url = url.replace("{id}", file.id);
url = this.form.workAction.action.address+url.replace("{workid}", this.form.businessData.work.id);
}else{
url = this.form.workAction.action.actions.uploadAttachment.uri;
url = this.form.workAction.action.address+url.replace("{id}", this.form.businessData.work.id);
}
//this.officeOCX.PublishAsHTMLToURL(url, "file", "", fileName, this.getFormId());
this.officeOCX.SaveAsOtherFormatToURL(1, url, "file", "", fileName, this.getFormId());
//this.officeOCX.PublishAsPDFToURL(url, "file", "", fileName, this.getFormId());
},
getHTMLFileUrl: function(name){
var fileName = name || this.getHTMLFileName();
var file = null;
atts = this.form.businessData.attachmentList;
for (var i=0; i<atts.length; i++){
if ((atts[i].name===fileName) || (atts[i].site===this.json.id+"$view")){
file = atts[i];
break;
}
}
if (file){
//this.file = file;
var url = "";
if (!this.form.businessData.workCompleted){
url = this.form.workAction.action.actions.getAttachmentData.uri;
url = url.replace("{id}", encodeURIComponent(file.id));
return this.form.workAction.action.address+url.replace("{workid}", encodeURIComponent(this.form.businessData.work.id));
}else{
url = this.form.workAction.action.actions.getWorkcompletedAttachmentData.uri;
url = url.replace("{id}", encodeURIComponent(file.id));
return this.form.workAction.action.address+url.replace("{workCompletedId}", encodeURIComponent(this.form.businessData.workCompleted.id));
}
}else{
return this.getTempleteUrl();
}
},
validationMode: function(){},
validation: function(){return true},
loadOfficeNotActive: function(){
var fileName = this.getFileName();
var htmlName = "";
var isHtml = false;
for (var i=0; i<this.form.businessData.attachmentList.length; i++){
var att = this.form.businessData.attachmentList[i];
if (att.site==this.json.id+"$view"){
htmlName = att.name;
}
}
if (false){
this.node.setStyles({
"min-height": "600px",
"padding": "0px",
"border": "0px solid #999999",
"background-color": "#e6e6e6",
"overflow": "hidden"
});
if (this.node.getSize().y<800) this.node.setStyle("height", "800px");
//this.node.setStyles(this.json.styles);
var wordNode = new Element("div", {
"styles": {
"padding": "40px",
"border": "1px solid #999999",
"background-color": "#e6e6e6",
"overflow": "auto"
}
}).inject(this.node);
var size = this.node.getSize();
var y = (size.y-80-80);
wordNode.setStyle("height", ""+y+"px");
var node = new Element("div", {
"styles": {
"width": "90%",
"height": "1900px",
"margin": "auto",
"background-color": "#ffffff"
}
}).inject(wordNode);
var iframe = new Element("iframe", {
"styles": {
"width": "100%",
"height": "100%",
"min-height": "600px",
"overflow": "auto",
"border": "1px solid #cccccc"
}
//"src": this.getHTMLFileUrl(htmlName)
}).inject(node);
//alert(iframe.contentWindow.document.body.firstChild);
iframe.contentWindow.document.addEventListener("readystatechange", function(){
alert("onreadystatechange"+ this.readyState );
alert(this.body.firstChild);
this.body.style.padding = "20px 40px";
});
// iframe.contentWindow.document.onreadystatechange = function(){
// alert("onreadystatechange"+ this.readyState );
// alert(this.body.firstChild);
// this.body.style.padding = "20px 40px";
// };
iframe.set("src", this.getHTMLFileUrl(htmlName));
// iframe.contentWindow.document.body.firstChild.style.paddingTop = "20px";
// iframe.contentWindow.document.body.firstChild.style.paddingBottom = "20px";
// iframe.contentWindow.document.body.firstChild.style.paddingLeft = "40px";
// iframe.contentWindow.document.body.firstChild.style.paddingRight = "40px";
}else{
if (this.json.isShowSummary!==false){
this.node.setStyles({
"overflow": "hidden",
"background-color": "#f3f3f3",
"min-height": "24px",
"padding": "18px"
});
var str = this.getData();
if (layout.mobile || COMMON.Browser.Platform.isMobile){
if (str.length>300) str = str.substr(0,300)+"……";
}
var text = new Element("div", {
"text": str
}).inject(this.node);
}
}
var text = MWF.xApplication.process.Xform.LP.openOfficeInfor;
text = text.replace("{type}", this.json.officeType);
var icon = new Element("div", {
"styles": {
"width": "200px",
"height": "24px",
"margin": "auto",
"margin-top": "18px",
"padding-left": "30px",
"font-size": "16px",
"font-weight": "bold",
"color": "#2b5797",
"font-family": "Gadugi",
"cursor": "pointer",
"background": "url("+this.form.path+""+this.form.options.style+"/icon/"+this.json.officeType+".png"+") no-repeat left center"
},
"text": text
}).inject(this.node);
var url = this.getOfficeFileUrl();
if (!url){
this.node.setStyle("display", "none");
}
icon.addEvent("click", function(){
var url = this.getOfficeFileUrl();
if (url){
if (window.o2android){
window.o2android.openDocument(url);
}else if(window.webkit){
window.webkit.messageHandlers.openDocument.postMessage(url);
}else{
window.open(o2.filterUrl(url));
}
}
}.bind(this));
}
validation: function(){return true}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册