提交 b22646b5 编写于 作者: NoSubject's avatar NoSubject

Merge branch 'feature/add-yozo' into 'wrdp'

增加yozo(永中)控件

See merge request o2oa/o2oa!4526
......@@ -212,6 +212,11 @@
"text": "iWebOffice",
"className": "IWebOffice"
},
"yozoOffice": {
"icon": "yozoOffice.png",
"text": "yozoOffice",
"className": "YozoOffice"
},
"statementSelector": {
"icon": "statementSelector.png",
"text": MWF.xApplication.process.FormDesigner.LP.modules.statementSelector,
......
......@@ -40,6 +40,7 @@ MWF.xDesktop.requireApp("process.FormDesigner", "Module.Documenteditor", null, f
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.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.YozoOffice = MWF.FCYozoOffice = new Class({
Extends: MWF.FC$Element,
Implements: [Options, Events],
options: {
"style": "default",
"propertyPath": "../x_component_process_FormDesigner/Module/YozoOffice/office.html"
},
initialize: function(form, options){
this.setOptions(options);
this.path = "../x_component_process_FormDesigner/Module/YozoOffice/";
this.cssPath = "../x_component_process_FormDesigner/Module/YozoOffice/"+this.options.style+"/css.wcss";
this._loadCss();
this.moduleType = "element";
this.moduleName = "yozoOffice";
this.form = form;
this.container = null;
this.containerNode = null;
},
_createMoveNode: function(){
this.moveNode = new Element("div", {
"MWFType": "yozoOffice",
"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;
});
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": "YozoOffice"
}).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/Office/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="{{$.lp.base}}" class="MWFTab">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">{{$.lp.id}}:</td>
<td class="editTableValue"><input type="text" name="id" value="text{$.id}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.name}}:</td>
<td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.description}}:</td>
<td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.readonly}}:</td>
<td class="editTableValue">
<input type="radio" name="isReadonly" value="true" text{($.isReadonly)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.delayedLoading}}:</td>
<td class="editTableValue">
<input type="radio" name="isNotLoadNow" value="true" text{($.isNotLoadNow)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isNotLoadNow" value="false" text{(!$.isNotLoadNow)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableValue" colspan="2">
<b>{{$.lp.showSummary}}:</b>
<input type="radio" name="isShowSummary" value="true" text{($.isShowSummary!==false)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isShowSummary" value="false" text{($.isShowSummary===false)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
</table>
<div class="MWFMaplist" name="styles" title="{{$.lp.style}}"></div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">{{$.lp.type}}:</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/>
<input class="editTableRadio" onclick="if (this.checked) $('officeTemplateArea').setStyle('display', 'block'); " name="officeType" text{($.officeType=='other')?'checked':''} type="radio" value="other"/>{{$.lp.byTemplate}}
</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">{{$.lp.templatePath}}:</td>
<td class="editTableValue">
<input type="text" name="template" value="text{$.template}" class="editTableInput"/>
</td>
</tr>
</table>
</div>
<div class="MWFScriptArea" name="readScript" title="{{$.lp.readonlyCondition}} (S)"></div>
</div>
<div title="{{$.lp.event}}" 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": "YozoOffice",
"description": "",
"officeType": "word",
"template": "",
"isNotLoadNow": false,
"trackRevisions" : "0",
"script": {
"code": "",
"html": ""
},
"yozoOfficeEditProperties": {
"Menubar": "0",
"ToolBars": "1",
"IsNoCopy": "0"
},
"yozoOfficeReadProperties": {
"Menubar": "0",
"ToolBars": "0",
"IsNoCopy": "0"
},
"menuReadButtons": ["revisions","fullscreen","preview"],
"menuEditButtons": ["revisions","fullscreen","toolbar","preview"],
"events": {
"afterOpen": {
"code": "",
"html": ""
},
"afterCreate": {
"code": "",
"html": ""
},
"beforeSave": {
"code": "",
"html": ""
},
"afterSave": {
"code": "",
"html": ""
}
},
"properties": {},
"class": "",
"styles": {},
"container": ""
}
......@@ -31,6 +31,7 @@ MWF.xApplication.process.Xform.require = function(callback){
["process.Xform", "Htmleditor"],
["process.Xform", "Office"],
["process.Xform", "IWebOffice"],
["process.Xform", "YozoOffice"],
["process.Xform", "Attachment"],
["process.Xform", "Actionbar"],
["process.Xform", "Sidebar"],
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.YozoOffice = MWF.APPYozoOffice = new Class({
Extends: MWF.APP$Module,
options:{
"moduleEvents": [
"afterOpen",
"afterCreate",
"beforeSave",
"afterSave"
]
},
initialize: function(node, json, form, options){
this.node = $(node);
this.node.store("module", this);
this.json = json;
this.form = form;
this.field = true;
this.openedAttachment = null;
this.mode = "write";
},
_loadUserInterface: function(){
this.node.empty();
this.node.setStyles({
"min-height": "100px"
});
this.file = null;
if (!this.form.officeList) this.form.officeList=[];
this.form.officeList.push(this);
},
_afterLoaded: function(){
if(!layout.serviceAddressList["x_yozofile_assemble_control"]){
this.node.set("html","<h3><font color=red>please install weboffice !!!</font></h3>");
return false;
}
this.action = o2.Actions.load("x_yozofile_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();
}
},
createDocument : function (callback){
this.action.CustomAction.createFileBlank(this.json.officeType,{"userId":layout.user.distinguishedName,"fileName":"文件正文." + this.getFileType()}, function( json ){
this.fireEvent("afterCreate");
this.documentId = json.data.docId;
this.setData();
if (callback) callback();
}.bind(this),null, 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);
},
loadOffice: function(){
if (!this.officeLoaded){
this.loadOfficeContorl();
this.officeLoaded = true;
}
},
loadOfficeContorl: function(file){
if (this.node.getSize().y<800) this.node.setStyle("height", "800px");
if (this.json.isReadonly){
this.mode = "read";
}else{
if (this.json.readScript && this.json.readScript.code){
var flag = this.form.Macro.exec(this.json.readScript.code, this);
if (flag){
this.mode = "read";
}
}
}
this.loadOfficeEditor();
},
hide: function(){
this.node.hide();
},
show: function(){
this.node.show();
},
getFileType: function(){
var ename = "docx";
switch (this.json.officeType){
case "word":
ename = "docx";
break;
case "excel":
ename = "xlsx";
break;
case "ppt":
ename = "pptx";
}
return ename;
},
loadOfficeEditor: function(){
this.action.CustomAction.getFileUrl(this.documentId,{"userId":layout.user.distinguishedName,"permission":this.mode}, function( json ){
var iframe = new Element("iframe").inject(this.node);
iframe.set("src",json.data.redirectUrl);
iframe.set("scrolling","no");
iframe.set("frameborder",0);
iframe.setStyles({
"height" : "100%",
"width" : "100%"
});
}.bind(this),null, false);
},
isEmpty : function(){
},
save: function(){
if (!this.readonly){
this.fireEvent("beforeSave");
this.fireEvent("afterSave");
}
},
validation: function(){return true}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册