123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- MWF.xDesktop.requireApp("process.Xform", "Actionbar", null, false);
- MWF.xApplication.cms.Xform.ProcessActionbar = MWF.CMSProcessActionbar = new Class({
- Extends: MWF.APPActionbar,
- reload : function(){
- this._loadUserInterface();
- },
- _loadUserInterface: function(){
- this.toolbarNode = this.node.getFirst("div");
- if(!this.toolbarNode)return;
- this.toolbarNode.empty();
- MWF.require("MWF.widget.Toolbar", function(){
- this.toolbarWidget = new MWF.widget.Toolbar(this.toolbarNode, {
- "style": this.json.style,
- "onPostLoad" : function(){
- this.fireEvent("afterLoad");
- }.bind(this)
- }, this);
- if (this.json.actionStyles) this.toolbarWidget.css = this.json.actionStyles;
- //alert(this.readonly)
- var CMSActions = [
- {
- "type": "MWFToolBarButton",
- "img": "close.png",
- "title": MWF.xApplication.cms.Xform.LP.closeTitle,
- "action": "closeDocument",
- "text": MWF.xApplication.cms.Xform.LP.close,
- "id": "action_close",
- "read": true,
- "edit" : true
- }
- // {
- // "type": "MWFToolBarButton",
- // "img": "edit.png",
- // "title": MWF.xApplication.cms.Xform.LP.editTitle,
- // "action": "editDocument",
- // "id": "action_edit",
- // "text": MWF.xApplication.cms.Xform.LP.edit,
- // "control": "allowEditDocument",
- // "read": true,
- // "edit" : false
- // },
- // {
- // "type": "MWFToolBarButton",
- // "img": "save.png",
- // "title": MWF.xApplication.cms.Xform.LP.saveTitle,
- // "action": "saveDocument",
- // "text": MWF.xApplication.cms.Xform.LP.save,
- // "id": "action_saveData",
- // "control": "allowSave",
- // "condition": "",
- // "read": false,
- // "edit" : true
- // }
- ];
- if (!this.json.hideSystemTools){
- this.setToolbars(CMSActions, this.toolbarNode, this.readonly);
- }
- if( this.json.multiTools ){ //自定义操作和系统操作混合的情况,用 system : true 来区分系统和自定义
- var jsonStr = JSON.stringify(this.json.multiTools);
- jsonStr = o2.bindJson(jsonStr, {"lp": MWF.xApplication.process.Xform.LP.form});
- this.json.multiTools = JSON.parse(jsonStr);
- this.json.multiTools.each( function (tool) {
- if( tool.system ){
- }else{
- this.setCustomToolbars([tool], this.toolbarNode);
- }
- }.bind(this));
- this.toolbarWidget.load();
- }else{
- this.setCustomToolbars(this.json.tools || [], this.toolbarNode);
- this.toolbarWidget.load();
- }
- }.bind(this));
- // }
- },
- setToolbars: function(tools, node, readonly, noCondition){
- tools.each(function(tool){
- var flag = true;
- if (tool.control){
- flag = this.form.businessData.control[tool.control];
- }
- if (!noCondition) if (tool.condition){
- var hideFlag = this.form.Macro.exec(tool.condition, this);
- flag = flag && (!hideFlag);
- }
- if (readonly){
- if (!tool.read) flag = false;
- }else{
- if (!tool.edit) flag = false;
- }
- if (flag){
- var actionNode = new Element("div", {
- "id": tool.id,
- "MWFnodetype": tool.type,
- "MWFButtonImage": "../x_component_process_FormDesigner/Module/Actionbar/"+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
- "title": tool.title,
- "MWFButtonAction": tool.action,
- "MWFButtonText": tool.text
- }).inject(node);
- if (tool.sub){
- var subNode = node.getLast();
- this.setToolbars(tool.sub, subNode);
- }
- }
- }.bind(this));
- },
- runCustomAction: function(bt){
- var script = bt.node.retrieve("script");
- this.form.Macro.exec(script, this);
- },
- saveDocument: function(){
- this.form.saveDocument();
- },
- saveDraftDocument: function(){
- this.form.saveDocument();
- },
- closeDocument: function(){
- this.form.closeDocument();
- },
- publishDocument: function(){
- this.form.publishDocument();
- },
- publishDocumentDelayed: function(){
- this.form.publishDocumentDelayed();
- },
- archiveDocument: function(){
- this.form.archiveDocument();
- },
- redraftDocument: function(){
- this.form.redraftDocument();
- },
- deleteDocument: function(){
- this.form.deleteDocument();
- },
- editDocument: function(){
- this.form.editDocument();
- },
- setPopularDocument: function(){
- this.form.setPopularDocument();
- },
- printDocument: function(){
- this.form.printDocument();
- },
- setTop: function(){
- this.form.setTop();
- },
- cancelTop: function(){
- this.form.cancelTop();
- }
- });
|