| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570 |
- MWF.xApplication.cms = MWF.xApplication.cms || {};
- MWF.CMSE = MWF.xApplication.cms.Module = MWF.xApplication.cms.Module ||{};
- MWF.require("MWF.widget.O2Identity", null,false);
- //MWF.xDesktop.requireApp("cms.Module", "Actions.RestActions", null, false);
- MWF.xApplication.cms.Module.options = {
- multitask: false,
- executable: true
- };
- MWF.xApplication.cms.Module.Main = new Class({
- Extends: MWF.xApplication.Common.Main,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "name": "cms.Module",
- "icon": "icon.png",
- "width": "1200",
- "height": "700",
- "isResize": true,
- "isMax": true,
- "isCategory" : false,
- "searchKey" : "",
- "title": MWF.xApplication.cms.Module.LP.title
- },
- onQueryLoad: function(){
- this.lp = MWF.xApplication.cms.Module.LP;
- },
- onQueryClose : function(){
- if (window.clipboardData){
- if (this.keyCopyItemsFun)this.removeEvent("copy", this.keyCopyItemsFun);
- if (this.keyPasteItemsFun)this.removeEvent("paste", this.keyPasteItemsFun);
- }else{
- if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
- if (this.keyPasteItemsFun) document.removeEventListener('paste', this.keyPasteItemsFun);
- }
- },
- loadApplication: function(callback){
- //this.controllers = [];
- this.isAdmin = false;
- this.restActions = MWF.Actions.get("x_cms_assemble_control"); //new MWF.xApplication.cms.Module.Actions.RestActions();
- this.createNode();
- this.loadApplicationContent();
- },
- createNode: function(){
- this.content.setStyle("overflow", "hidden");
- this.node = new Element("div", {
- "styles": this.css.node
- }).inject(this.content);
- this.naviContainerNode = new Element("div.naviContainerNode", {
- "styles": this.css.naviContainerNode
- }).inject(this.node);
- this.leftTitleNode = new Element("div.leftTitleNode", {
- "styles": this.css.leftTitleNode
- }).inject(this.naviContainerNode);
- this.rightContentNode = new Element("div", {
- "styles":this.css.rightContentNode
- }).inject(this.node);
- this.titleBar = new Element("div", {
- "styles": this.css.titleBar
- }).inject(this.rightContentNode );
- this.titleActionBar = new Element("div", {
- "styles": this.css.titleActionBar
- }).inject(this.titleBar );
- },
- loadApplicationContent: function(){
- if( this.options.columnData ){
- this.setColumnDataConfig();
- this.setTitle(this.options.columnData.appName);
- this.loadController(function(){
- this.loadTitle(function(){
- this.loadMenu();
- }.bind(this));
- }.bind(this))
- }else if( (this.status && this.status.columnId) || this.options.columnId ){
- var columnId = this.options.columnId || this.status.columnId;
- this.loadColumnData( columnId, function(){
- this.loadController(function(){
- this.loadTitle(function(){
- this.loadMenu();
- }.bind(this));
- }.bind(this))
- }.bind(this))
- }else if( this.options.columnAlias ){
- this.restActions.getColumnByAlias( this.options.columnAlias, function( json ){
- this.options.columnData = json.data;
- this.setColumnDataConfig();
- this.setTitle(this.options.columnData.appName);
- this.loadController(function(){
- this.loadTitle(function(){
- this.loadMenu();
- }.bind(this));
- }.bind(this))
- }.bind(this))
- }
- },
- setColumnDataConfig : function(){
- if( !this.options.columnData.config ){
- this.options.columnData.config = {};
- }else if( typeOf(this.options.columnData.config) === "string" ){
- this.options.columnData.config = JSON.parse( this.options.columnData.config || {} );
- }
- },
- loadColumnData : function(columnId, callback){
- this.restActions.getColumn( columnId, function( json ){
- this.options.columnData = json.data;
- this.setTitle(this.options.columnData.appName);
- this.setColumnDataConfig();
- //MWF.require("MWF.xScript.Actions.CMSScriptActions", null, false);
- //MWF.require("o2.xScript.Macro", null, false);
- //var scriptAction = new MWF.xScript.Actions.CMSScriptActions();
- //scriptAction.getScriptByName( this.options.columnData.id, "_config", [], function(json){
- // if (json.data){
- // try{
- // this.options.columnData = Object.merge(this.options.columnData,JSON.parse(json.data.text));
- // }catch(e){
- // }
- // }
- //}.bind(this), null, false);
- if(callback)callback()
- }.bind(this))
- },
- loadController: function(callback){
- //this.restActions.listColumnController(this.options.columnData.id, function( json ){
- // json.data = json.data || [];
- // json.data.each(function(item){
- // this.controllers.push(item.adminUid)
- // }.bind(this));
- // this.isAdmin = MWF.AC.isCMSManager() || this.controllers.contains(layout.desktop.session.user.distinguishedName);
- // if(callback)callback(json);
- //}.bind(this));
- this.restActions.isAppInfoManager( this.options.columnData.id, function( json ){
- this.isAdmin = MWF.AC.isCMSManager() || json.data.value;
- if(callback)callback(json);
- }.bind(this))
- },
- loadTitle : function(callback){
- if( this.isAdmin ){
- //this.loadImportActionNode();
- //this.loadExportActionNode();
- }
- this.loadCreateDocumentActionNode(
- function(){
- this.loadTitleIconNode();
- this.loadTitleContentNode();
- this.loadBatchAction();
- this.loadPastEvent();
- this.loadSearchNode();
- if(callback)callback();
- }.bind(this)
- );
- },
- loadBatchAction: function(){
- if( !this.isAdmin )return;
- this.batchAction = new Element("div", {
- "styles": this.css.batchAction,
- "text" : "选择"
- }).inject(this.titleActionBar);
- this.batchAction.addEvents({
- "click": function(e){
- if( this.view ){
- if( this.view.selectEnable ){
- this.selectEnable = false;
- this.batchAction.setStyles( this.css.batchAction );
- this.batchAction.set("text","选择");
- this.view.disableSelectMode();
- this.cancelBatchRemoveAction();
- this.cancelChangeCategoryAction();
- this.cancelCopyActionNode();
- }else{
- this.selectEnable = true;
- this.batchAction.setStyles( this.css.batchAction_over );
- this.batchAction.set("text","取消选择");
- this.view.selectMode();
- this.loadCopyActionNode();
- this.loadChangeCategoryAction();
- this.loadBatchRemoveAction();
- }
- }
- }.bind(this),
- "mouseover" : function(e){
- if( this.view.selectEnable )return;
- this.batchAction.setStyles( this.css.batchAction_over )
- }.bind(this),
- "mouseout" : function(e){
- if( this.view.selectEnable )return;
- this.batchAction.setStyles( this.css.batchAction )
- }.bind(this)
- });
- },
- getSearchBarSize : function(){
- var x_action = this.titleActionBar.getSize().x;
- var x_titlebar = this.titleBar.getSize().x;
- return x_titlebar - x_action;
- },
- loadPastEvent : function(){
- if( !this.isAdmin )return;
- this.keyPasteItemsFun = this.keyPasteItems.bind(this);
- if (window.clipboardData){
- this.addEvent("paste", this.keyPasteItemsFun);
- }else{
- document.addEventListener('paste', this.keyPasteItemsFun);
- //this.addEvent("queryClose", function(){
- // if (this.keyPasteItemsFun) document.removeEventListener('paste', this.keyPasteItemsFun);
- //}.bind(this));
- }
- },
- loadCreateDocumentActionNode: function( callback ){
- this.restActions.listCategoryByPublisher( this.options.columnData.id, function( json ){
- if( json.data && json.data.length ){
- this.createDocumentAction = new Element("div", {
- "styles": this.css.createDocumentAction,
- "text" : this.lp.start
- }).inject(this.titleActionBar);
- this.createDocumentAction.addEvents({
- "click": function(e){
- MWF.xDesktop.requireApp("cms.Index", "Newer", null, false);
- //if(this.options.columnData.latest===undefined) this.options.columnData.latest = true;
- //if(this.options.columnData.ignoreTitle===undefined) this.options.columnData.ignoreTitle = false;
- this.creater = new MWF.xApplication.cms.Index.Newer( this.options.columnData, null, this, this.view, {
- restrictToColumn : true
- //ignoreTitle : this.options.columnData.ignoreTitle,
- //latest : this.options.columnData.latest
- });
- this.creater.load();
- }.bind(this),
- "mouseover" : function(e){
- this.createDocumentAction.setStyles( this.css.createDocumentAction_over )
- }.bind(this),
- "mouseout" : function(e){
- this.createDocumentAction.setStyles( this.css.createDocumentAction )
- }.bind(this)
- });
- }
- if(callback)callback();
- }.bind(this));
- },
- cancelChangeCategoryAction : function(){
- if(this.moveAction)this.moveAction.destroy();
- this.moveAction = null;
- },
- loadChangeCategoryAction : function(){
- if( !this.isAdmin )return;
- this.moveAction = new Element("div", {
- "styles": this.css.moveDocumentAction,
- "text" : "移动"
- }).inject(this.titleActionBar);
- this.moveAction.addEvents({
- "click": function(e){
- var _self = this;
- if( this.view ){
- var itemIds = this.view.getSelectedIds();
- if (!itemIds.length) {
- this.notice("请先选择文档","error");
- return;
- }
- this.loadSelectColumnDialog( function( data ){
- if( data && data.id ){
- var text = "移动后将在本分类删除,确定要移动选中的"+itemIds.length+"个文档到"+data.categoryName+"?";
- this.confirm("warn", e, "移动确认", text, 350, 120, function(){
- _self.restActions.moveDocumentToCategory({
- ids : itemIds,
- categoryId : data.id
- }, function(){
- _self.notice("移动成功", "success");
- _self.view.reload();
- this.close();
- }.bind(this))
- }, function(){
- this.close();
- });
- }
- }.bind(this))
- }
- }.bind(this),
- "mouseover" : function(e){
- this.moveAction.setStyles( this.css.moveDocumentAction_over )
- }.bind(this),
- "mouseout" : function(e){
- this.moveAction.setStyles( this.css.moveDocumentAction )
- }.bind(this)
- });
- },
- cancelBatchRemoveAction : function(){
- if(this.batchRemoveAction)this.batchRemoveAction.destroy();
- this.batchRemoveAction = null;
- },
- loadBatchRemoveAction : function(){
- if( !this.isAdmin )return;
- var _self = this;
- this.batchRemoveAction = new Element("div", {
- "styles": this.css.batchRemoveDocumentAction,
- "text" : this.lp.batchRemove
- }).inject(this.titleActionBar);
- this.batchRemoveAction.addEvents({
- "click": function(e){
- if( this.view ){
- var itemIds = this.view.getSelectedIds();
- if (itemIds.length) {
- _self.readyRemove = true;
- var text = "删除后无法恢复,确定要删除选中的"+itemIds.length+"个文档?";
- this.confirm("warn", e, "清除确认", text, 350, 120, function(){
- _self.removeDocumentList(itemIds);
- this.close();
- }, function(){
- _self.readyRemove = false;
- this.close();
- });
- }else{
- this.notice("请先选择文档","error")
- }
- }
- }.bind(this),
- "mouseover" : function(e){
- this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction_over )
- }.bind(this),
- "mouseout" : function(e){
- this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction )
- }.bind(this)
- });
- },
- //loadBatchRemoveAction : function(){
- // if( !this.isAdmin )return;
- //
- // this.batchRemoveAction = new Element("div", {
- // "styles": this.css.batchRemoveDocumentAction,
- // "text" : this.lp.batchRemove
- // }).inject(this.titleBar);
- // this.batchRemoveAction.addEvents({
- // "click": function(e){
- // if( this.view ){
- // if( this.view.selectEnable ){
- // this.view.disableSelectMode();
- // this.batchRemoveConfirmAction.setStyle("display","none");
- // //this.batchRemoveAction.set("text",this.lp.batchRemove);
- // }else{
- // this.view.selectMode();
- // this.batchRemoveConfirmAction.setStyle("display","");
- // //this.batchRemoveAction.set("text",this.lp.cancel);
- // }
- // }
- // }.bind(this),
- // "mouseover" : function(e){
- // this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction_over )
- // }.bind(this),
- // "mouseout" : function(e){
- // this.batchRemoveAction.setStyles( this.css.batchRemoveDocumentAction )
- // }.bind(this)
- // });
- //
- //
- // this.batchRemoveConfirmAction = new Element("div", {
- // "styles": this.css.batchRemoveConfirmDocumentAction,
- // "text" : this.lp.batchRemoveConfirm
- // }).inject(this.titleBar);
- // var _self = this;
- // this.batchRemoveConfirmAction.addEvents({
- // "click": function (e) {
- // var itemIds = this.view.getSelectedIds();
- // if (itemIds.length) {
- // _self.readyRemove = true;
- // var text = "删除后无法恢复,确定要删除选中的"+itemIds.length+"个文档?";
- // this.confirm("warn", e, "清除确认", text, 350, 120, function(){
- //
- // _self.removeDocumentList(itemIds);
- //
- // this.close();
- //
- // }, function(){
- // _self.readyRemove = false;
- // this.close();
- // });
- // }else{
- // this.notice("请先选择文档","error")
- // }
- // }.bind(this)
- // });
- // this.batchRemoveConfirmAction.setStyle("display","none");
- //},
- removeDocumentList : function( itemIds ){
- var count = 0;
- itemIds.each( function(id){
- this.restActions.removeDocument(id, function(json){
- count++;
- if( count === itemIds.length ){
- this.notice("清除成功", "success");
- //this.view.disableSelectMode();
- this.view.reload();
- }
- }.bind(this));
- }.bind(this))
- },
- cancelCopyActionNode : function(){
- if (window.clipboardData){
- if (this.keyCopyItemsFun)this.removeEvent("copy", this.keyCopyItemsFun);
- }else{
- if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
- }
- this.keyCopyItemsFun = null;
- if(this.copyAction)this.copyAction.destroy();
- this.copyAction = null;
- },
- loadCopyActionNode : function(){
- if( !this.isAdmin )return;
- this.copyAction = new Element("div", {
- "styles": this.css.copyDocumentAction,
- "text" : "启用复制"
- }).inject(this.titleActionBar);
- this.copyAction.addEvents({
- "click": function(e){
- if( this.view ){
- if( this.keyCopyItemsFun )return;
- this.keyCopyItemsFun = this.keyCopyItems.bind(this);
- if (window.clipboardData){
- this.addEvent("copy", this.keyCopyItemsFun);
- }else{
- document.addEventListener('copy', this.keyCopyItemsFun);
- //this.addEvent("queryClose", function(){
- // if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
- //}.bind(this));
- }
- this.notice( this.lp.copyInfor );
- }
- }.bind(this),
- "mouseover" : function(e){
- this.copyAction.setStyles( this.css.copyDocumentAction_over )
- }.bind(this),
- "mouseout" : function(e){
- this.copyAction.setStyles( this.css.copyDocumentAction )
- }.bind(this)
- });
- },
- //loadCopyActionNode : function(){
- // if( !this.isAdmin )return;
- // this.copyAction = new Element("div", {
- // "styles": this.css.copyDocumentAction,
- // "text" : this.lp.copy
- // }).inject(this.titleBar);
- // this.copyAction.addEvents({
- // "click": function(e){
- // if( this.view ){
- // if( this.view.selectEnable ){
- // this.view.disableSelectMode();
- // if (window.clipboardData){
- // if (this.keyCopyItemsFun)this.removeEvent("copy", this.keyCopyItemsFun);
- // }else{
- // if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
- // }
- // this.keyCopyItemsFun = null;
- // }else{
- // this.view.selectMode();
- // this.keyCopyItemsFun = this.keyCopyItems.bind(this);
- // if (window.clipboardData){
- // this.addEvent("copy", this.keyCopyItemsFun);
- // }else{
- // document.addEventListener('copy', this.keyCopyItemsFun);
- // //this.addEvent("queryClose", function(){
- // // if (this.keyCopyItemsFun) document.removeEventListener('copy', this.keyCopyItemsFun);
- // //}.bind(this));
- // }
- // this.notice( this.lp.copyInfor );
- // }
- // }
- // }.bind(this),
- // "mouseover" : function(e){
- // this.copyAction.setStyles( this.css.copyDocumentAction_over )
- // }.bind(this),
- // "mouseout" : function(e){
- // this.copyAction.setStyles( this.css.copyDocumentAction )
- // }.bind(this)
- // });
- //},
- keyCopyItems: function(e){
- if (layout.desktop.currentApp && layout.desktop.currentApp.appId===this.appId) {
- var itemIds = this.view.getSelectedIds();
- if (itemIds.length) {
- var items = [];
- var i = 0;
- var checkItems = function (e) {
- if (i >= itemIds.length) {
- if (items.length) {
- var str = JSON.encode(items);
- if (e && e.clipboardData) {
- e.clipboardData.setData('text/plain', str);
- e.preventDefault();
- } else {
- window.clipboardData.setData("Text", str);
- }
- this.notice(this.lp.copyed, "success");
- }
- }
- }.bind(this);
- itemIds.each(function (id) {
- this.restActions.getDocument(id, function (json) {
- json.data.elementType = "cmsDocument";
- items.push(json.data);
- i++;
- checkItems(e);
- }.bind(this), null, false)
- }.bind(this));
- }
- }
- },
- keyPasteItems: function(e){
- if (layout.desktop.currentApp && layout.desktop.currentApp.appId===this.appId) {
- var dataStr = "";
- if (e && e.clipboardData) {
- dataStr = e.clipboardData.getData('text/plain');
- } else {
- dataStr = window.clipboardData.getData("Text");
- }
- var data = JSON.decode(dataStr);
- this.listPublishableCategoryInfo(function(){
- this.pasteItem(data, 0);
- }.bind(this))
- }
- },
- listPublishableCategoryInfo : function( callback ){
- this.publishableCategoryInfoObject_id = {};
- this.publishableCategoryInfoObject_alias = {};
- this.publishableCategoryInfoObject_name = {};
- this.categoryTransformMap = {};
- this.categoryRadioHtml = "";
- o2.Actions.load("x_cms_assemble_control").CategoryInfoAction.listPublishableCategoryInfo( this.options.columnData.id, function(json){
- ( json.data || [] ).each( function(c){
- this.publishableCategoryInfoObject_id[c.id] = c;
- this.publishableCategoryInfoObject_alias[c.categoryAlias] = c;
- this.publishableCategoryInfoObject_name[c.categoryName] = c;
- this.categoryRadioHtml += "<div><input type='radio' name='categoryRadio' value='"+ c.id+"'/>" + c.categoryName + "(" + c.categoryAlias +")</div>"
- }.bind(this));
- this.categoryRadioHtml = "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'>" +
- this.categoryRadioHtml + "</div>"
- if(callback)callback();
- }.bind(this));
- },
- pasteItem: function(data, i){
- if (i<data.length){
- var item = data[i];
- if (item.elementType==="cmsDocument"){
- this.saveItemAs(item, function(){
- i++;
- this.pasteItem(data, i);
- }.bind(this), function(){
- i++;
- this.pasteItem(data, i);
- }.bind(this), function(){
- this.view.reload();
- }.bind(this));
- }else{
- i++;
- this.pasteItem(data, i);
- }
- }else{
- this.view.reload();
- }
- },
- saveItemAs: function(data, success, failure, cancel){
- var lp = this.lp;
- var _self = this;
- if( this.publishableCategoryInfoObject_id[ data.document.categoryId ] ){
- this._saveItemAs(data, success, failure, cancel );
- }else if( this.categoryTransformMap[ data.document.categoryId ] ){
- this._saveItemAs(data, success, failure, cancel, this.categoryTransformMap[ data.document.categoryId ] );
- }else{
- var text;
- if( this.publishableCategoryInfoObject_alias[ data.document.categoryAlias ] ){
- text = lp.copyConfirmCategoryInfor_hasSameAlias + "。<br/>" + lp.copyConfirmCateogyrInfor_withChoice
- }else if( this.publishableCategoryInfoObject_name[ data.document.categoryName ] ){
- text = lp.copyConfirmCategoryInfor_hasSameName + "。<br/>" + lp.copyConfirmCateogyrInfor_withChoice
- }else{
- text = lp.copyConfirmCategoryInfor_noCategory + ":"
- }
- text = text.replace("{alias}", "(<span style='color:red;'>" + data.document.categoryAlias + "</span>)" );
- text = text.replace("{name}", "(<span style='color:red;'>" + data.document.categoryName + "</span>)" );
- var html = "<div style='overflow-y:auto;height:300px'>";
- html += "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'>";
- html += " <div style='clear: both;font-weight: bold; font-size:14px;'>"+lp.copyTarget+" "+data.document.title+"</div>";
- html += " <div style='font-size:12px; color: #666666; float: left;'>"+data.document.publishTime+"</div>";
- html += " <div style='font-size:12px; color: #666666; float: left; margin-left: 20px;'>"+MWF.name.cn(data.document.creatorPersonShort)+"</div>";
- html += "</div>";
- html += "<div>" + text + "</div>" + this.categoryRadioHtml;
- html += "<div><input type='checkbox' value='true' name='useSameChoice'>"+lp.copyConfirm_SameCategory+"</div>";
- html += "</div>";
- // html += "<>"
- this.dlg("inofr", null, lp.copyConfirmCategoryTitle, {"html": html}, 500, 360, [
- {
- "text": lp.copy,
- "action": function(){
- var categoryRadio = this.node.getElements("[name='categoryRadio']");
- var checkbox = this.node.getElement("[name='useSameChoice']");
- var newCategory;
- for( var i=0; i<categoryRadio.length; i++ ){
- if( categoryRadio[i].checked ){
- newCategory = _self.publishableCategoryInfoObject_id[ categoryRadio[i].get("value") ];
- }
- }
- if( !newCategory ){
- if( _self.publishableCategoryInfoObject_alias[ data.document.categoryAlias ] ){
- newCategory = _self.publishableCategoryInfoObject_alias[ data.document.categoryAlias ];
- }else if( _self.publishableCategoryInfoObject_name[ data.document.categoryName ] ){
- newCategory = _self.publishableCategoryInfoObject_name[ data.document.categoryName ];
- }
- }
- if( newCategory ){
- if( checkbox.checked )_self.categoryTransformMap[ data.document.categoryId ] = newCategory;
- this.close();
- _self._saveItemAs(data, success, failure, cancel, newCategory );
- }else{
- _self.notice( lp.notSelectCategory, "error" )
- }
- //_self.saveItemAsUpdate(someItem, data, success, failure);
- }
- },
- {
- "text": lp.copyConfirm_skip,
- "action": function(){/*nothing*/ this.close(); if (success) success();}
- },
- {
- "text": lp.copyConfirm_cancel,
- "action": function(){this.close(); if (cancel) cancel();}
- }
- ]);
- }
- },
- _saveItemAs: function(data, success, failure, cancel, newCategory ){
- this.restActions.getDocument(data.document.id, function(dJson){
- var someItem = dJson.data;
- var flag = false;
- if (someItem){
- if( newCategory ){
- if( newCategory.id !== someItem.document.categoryId ){ //如果已有文档的分类和新分类不一样,直接新建
- this.saveItemAsNew(data, success, failure, true, newCategory)
- }else{ //如果已有文档的分类和新分类一样,需要询问
- flag = true;
- }
- }else{ //如果使用原有分类,需要询问
- flag = true;
- }
- if( flag ){
- var lp = this.lp;
- var _self = this;
- var d1 = new Date().parse(data.document.publishTime);
- var d2 = new Date().parse(someItem.document.publishTime);
- var html = "<div>"+lp.copyConfirmInfor+"</div>";
- html += "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'><div style='font-weight: bold; font-size:14px;'>"+lp.copySource+" "+someItem.document.title+"</div>";
- html += "<div style='font-size:12px; color: #666666; float: left'>"+someItem.document.publishTime+"</div>" +
- "<div style='font-size:12px; color: #666666; float: left; margin-left: 20px;'>"+MWF.name.cn(someItem.document.creatorPersonShort)+"</div>" +
- "<div style='color: red; float: right;'>"+((d1>=d2) ? "": lp.copynew)+"</div></div>";
- html += "<div style='overflow: hidden; margin: 10px 0px; padding: 5px 10px; background-color: #ffffff; border-radius: 6px;'><div style='clear: both;font-weight: bold; font-size:14px;'>"+lp.copyTarget+" "+data.document.title+"</div>";
- html += "<div style='font-size:12px; color: #666666; float: left;'>"+data.document.publishTime+"</div>" +
- "<div style='font-size:12px; color: #666666; float: left; margin-left: 20px;'>"+MWF.name.cn(data.document.creatorPersonShort)+"</div>" +
- "<div style='color: red; float: right;'>"+((d1<=d2) ? "": lp.copynew)+"</div></div>";
- // html += "<>"
- this.dlg("inofr", null, lp.copyConfirmTitle, {"html": html}, 500, 290, [
- {
- "text": lp.copyConfirm_overwrite,
- "action": function(){_self.saveItemAsUpdate(someItem, data, success, failure);this.close();}
- },
- {
- "text": lp.copyConfirm_new,
- "action": function(){_self.saveItemAsNew( data, success, failure, true, newCategory );this.close();}
- },
- {
- "text": lp.copyConfirm_skip,
- "action": function(){/*nothing*/ this.close(); if (success) success();}
- },
- {
- "text": lp.copyConfirm_cancel,
- "action": function(){this.close(); if (cancel) cancel();}
- }
- ]);
- }
- }
- }.bind(this), function(){
- //if (failure) failure();
- this.saveItemAsNew(data, success, failure, false, newCategory)
- }.bind(this));
- },
- saveItemAsUpdate: function(someItem, data, success, failure){
- var doc = data.document;
- doc.id = someItem.document.id;
- doc.isNewDocument = false;
- doc.appId = someItem.document.appId;
- doc.appName = someItem.document.appName;
- doc.categoryId = someItem.document.categoryId;
- doc.categoryName = someItem.document.categoryName;
- doc.categoryAlias = someItem.document.categoryAlias;
- doc.form = someItem.document.form;
- doc.formName = someItem.document.formName;
- doc.readFormId = someItem.document.readFormId;
- doc.readFormName = someItem.document.readFormName;
- doc.docData = data.data;
- this.restActions.saveDocument(doc, function(){
- if (success) success();
- }.bind(this), function(){
- if (failure) failure();
- }.bind(this));
- },
- saveItemAsNew: function(data, success, failure, clearId, newCategory){
- var columnData = this.options.columnData;
- var doc = data.document;
- if( clearId ){
- delete doc.id;
- }
- delete doc.documentType;
- delete doc.appId;
- delete doc.appName;
- delete doc.appAlias;
- delete doc.categoryId;
- delete doc.categoryName;
- delete doc.categoryAlias;
- delete doc.form;
- delete doc.formName;
- delete doc.readFormId;
- delete doc.readFormName;
- doc.appId = columnData.id;
- doc.docData = data.data;
- delete doc.docData.$document;
- var callback = function(data){
- this.restActions.publishDocumentComplex(data, function(){
- if (success) success();
- }.bind(this), function(){
- if (failure) failure();
- }.bind(this));
- }.bind(this);
- if( newCategory ){
- doc.categoryId = newCategory.id;
- callback( doc );
- }else{
- this.restActions.getCategory( data.document.categoryId, function( json ){
- if( json.data.appId === columnData.id ){
- doc.categoryId = data.document.categoryId;
- callback( doc );
- }else{
- this.loadSelectCategoryDialog( "选择"+ data.document.title + "的分类",function(id){
- doc.categoryId = id;
- callback( doc );
- }.bind(this))
- }
- }.bind(this), function(){
- this.loadSelectCategoryDialog( "选择"+ data.document.title + "的分类",function(id){
- doc.categoryId = id;
- callback( doc );
- }.bind(this))
- }.bind(this))
- }
- },
- loadSelectColumnDialog : function( callback){
- MWF.xDesktop.requireApp("Selector", "package", null, false);
- var options = {
- "type": "CMSCategory",
- "count": 1,
- "onComplete": function(items){
- items.each(function(item){
- if( callback )callback( item.data );
- }.bind(this));
- }.bind(this)
- };
- var selector = new MWF.O2Selector(this.content, options);
- },
- loadSelectCategoryDialog : function(title, callback){
- if( !this.categoryList ){
- this.categoryList = [];
- this.restActions.listCategory( this.options.columnData.id, function( json ){
- json.data.each( function(d){
- this.categoryList.push( {
- name : d.categoryName,
- id : d.id
- })
- }.bind(this))
- }.bind(this), null, false)
- }
- MWF.xDesktop.requireApp("Template", "Selector.Custom", null, false);
- var opt = {
- "count": 1,
- "title": "选择分类",
- "selectableItems" : this.categoryList,
- "values": [],
- "onComplete": function( array ){
- if( !array || array.length == 0 )return;
- var id = array[0].data.id;
- callback( id )
- }.bind(this)
- };
- var selector = new MWF.xApplication.Template.Selector.Custom(this.content, opt );
- selector.load();
- },
- loadImportActionNode : function(){
- this.importAction = new Element("div", {
- "styles": this.css.importAction,
- "text" : this.lp.import
- }).inject(this.titleActionBar);
- this.importAction.setStyle("display","none");
- this.importAction.addEvents({
- "click": function(e){
- MWF.xDesktop.requireApp("cms.Module", "ExcelForm", null, false);
- var categoryData = this.navi.currentObject.isCategory ? this.navi.currentObject.data : this.navi.currentObject.category.data ;
- this.import = new MWF.xApplication.cms.Module.ImportForm( { app : this }, categoryData, {} );
- this.import.edit();
- }.bind(this),
- "mouseover" : function(e){
- this.importAction.setStyles( this.css.importAction_over )
- }.bind(this),
- "mouseout" : function(e){
- this.importAction.setStyles( this.css.importAction )
- }.bind(this)
- });
- },
- loadExportActionNode : function(){
- this.exportAction = new Element("div", {
- "styles": this.css.exportAction,
- "text" : this.lp.export
- }).inject(this.titleActionBar);
- this.exportAction.setStyle("display","none");
- this.exportAction.addEvents({
- "click": function(e){
- MWF.xDesktop.requireApp("cms.Module", "ExcelForm", null, false);
- var categoryData = this.navi.currentObject.isCategory ? this.navi.currentObject.data : this.navi.currentObject.category.data ;
- this.export = new MWF.xApplication.cms.Module.ExportForm ( { app : this }, categoryData, {} );
- this.export.edit();
- }.bind(this),
- "mouseover" : function(e){
- this.exportAction.setStyles( this.css.exportAction_over )
- }.bind(this),
- "mouseout" : function(e){
- this.exportAction.setStyles( this.css.exportAction )
- }.bind(this)
- });
- },
- loadTitleIconNode : function(){
- this.defaultColumnIcon = "/x_component_cms_Index/$Main/"+this.options.style+"/icon/column.png";
- var iconAreaNode = this.iconAreaNode = new Element("div",{
- "styles" : this.css.titleIconAreaNode
- }).inject(this.leftTitleNode);
- var iconNode = this.iconNode = new Element("img",{
- "styles" : this.css.titleIconNode
- }).inject(iconAreaNode);
- if (this.options.columnData.appIcon){
- this.iconNode.set("src", "data:image/png;base64,"+this.options.columnData.appIcon+"");
- }else{
- this.iconNode.set("src", this.defaultColumnIcon)
- }
- iconNode.makeLnk({
- "par": this._getLnkPar()
- });
- },
- _getLnkPar: function(){
- var lnkIcon = this.defaultColumnIcon;
- if (this.options.columnData.appIcon) lnkIcon = "data:image/png;base64,"+this.options.columnData.appIcon;
- var appId = "cms.Module"+this.options.columnData.id;
- return {
- "icon": lnkIcon,
- "title": this.options.columnData.appName,
- "par": "cms.Module#{\"columnId\": \""+this.options.columnData.id+"\", \"appId\": \""+appId+"\"}"
- };
- },
- loadTitleContentNode: function(){
- this.titleContentNode = new Element("div.titleContentNode", {
- "styles": this.css.titleContentNode
- }).inject(this.leftTitleNode);
- this.titleTextNode = new Element("div.titleTextNode", {
- "styles": this.css.titleTextNode,
- "text": this.options.columnData.appName,
- "title": this.options.columnData.appName
- }).inject(this.titleContentNode);
- this.titleDescriptionNode = new Element("div.titleDescriptionNode", {
- "styles": this.css.titleDescriptionNode,
- "text": this.options.columnData.description ? this.options.columnData.description : this.lp.noDescription,
- "title": this.options.columnData.description ? this.options.columnData.description : this.lp.noDescription
- }).inject(this.titleContentNode);
- },
- loadSearchNode : function(){
- this.searchNode = new Element("div").inject( this.titleBar );
- },
- loadMenu: function(callback){
- this.naviNode = new Element("div.naviNode", {
- "styles": this.css.naviNode
- }).inject(this.naviContainerNode);
- //this.setScrollBar(this.naviNode,{"where": "before"});
- MWF.require("MWF.widget.ScrollBar", function(){
- new MWF.widget.ScrollBar(this.naviContainerNode, {
- "style":"xApp_ProcessManager_StartMenu", "distance": 100, "friction": 4, "axis": {"x": false, "y": true}
- });
- }.bind(this));
- this.addEvent("resize", function(){this.setNaviSize();}.bind(this));
- //MWF.require("MWF.widget.ScrollBar", function(){
- // new MWF.widget.ScrollBar(this.menuNode, {
- // "style":"xApp_CMSModule_StartMenu", "distance": 100, "friction": 4, "axis": {"x": false, "y": true}
- // });
- //}.bind(this));
- if( this.options.categoryId == "all" ){
- this.options.categoryId = "whole";
- }
- if( this.status && this.status.categoryId ){
- this._loadMenu( this.status );
- }else if( this.options.categoryId && this.options.categoryId != "" ){
- if( this.options.viewId && this.options.viewId!="" ){
- this._loadMenu( { "categoryId" :this.options.categoryId , "viewId" : this.options.viewId } )
- }else{
- //this.getCategoryDefaultList(this.options.categoryId , function(viewId){
- // if( viewId ){
- // this._loadMenu( { "categoryId" :this.options.categoryId , "viewId" : viewId, "isCategory" : this.options.isCategory } );
- // }else{
- // this._loadMenu( { "categoryId" :this.options.categoryId , "isCategory" : this.options.isCategory, "naviIndex" : (this.options.naviIndex || 0) } );
- // }
- //}.bind(this))
- this._loadMenu( { "categoryId" :this.options.categoryId , "isCategory" : true, "naviIndex" : (this.options.naviIndex || 0) } ); //this.options.isCategory
- }
- }else if( this.options.categoryAlias && this.options.categoryAlias != "" ){
- this.restActions.getCategoryByAlias( this.options.categoryAlias, function( json ){
- this.options.categoryId = json.data.id;
- if( this.options.viewId && this.options.viewId!="" ){
- this._loadMenu( { "categoryId" :this.options.categoryId , "viewId" : this.options.viewId } )
- }else{
- this._loadMenu( { "categoryId" :this.options.categoryId , "isCategory" : true, "naviIndex" : (this.options.naviIndex || 0) } ); //this.options.isCategory
- }
- }.bind(this))
- }else{
- this._loadMenu( { "categoryId" :"whole" } )
- }
- },
- _loadMenu : function( options ){
- this.navi = new MWF.xApplication.cms.Module.Navi(this, this.naviNode, this.options.columnData, options );
- this.setNaviSize();
- },
- clearContent: function(){
- //debugger;
- if (this.moduleContent){
- if (this.view) delete this.view;
- this.moduleContent.destroy();
- this.searchNode.empty();
- this.moduleContent = null;
- }
- },
- openView : function(el, categoryData, revealData, searchKey, navi){
- if( revealData && revealData.type == "queryview" ){
- this.loadQueryView(el, categoryData, revealData, searchKey, navi);
- }else{
- this.loadList(el, categoryData, revealData, searchKey, navi);
- }
- },
- loadQueryView : function(el, categoryData, revealData, searchKey, navi){
- MWF.xDesktop.requireApp("cms.Module", "ViewExplorer", function(){
- this.clearContent();
- this.moduleContent = new Element("div", {
- "styles": this.css.moduleContent
- }).inject(this.rightContentNode);
- this.view = new MWF.xApplication.cms.Module.ViewExplorer(
- this.moduleContent,
- this,
- this.options.columnData,
- categoryData,
- revealData,
- {"isAdmin": this.isAdmin, "searchKey" : searchKey },
- this.searchNode
- );
- this.view.selectEnable = this.selectEnable;
- this.view.load();
- }.bind(this))
- },
- loadList : function(el, categoryData, revealData, searchKey, navi){
- MWF.xDesktop.requireApp("cms.Module", "ListExplorer", function(){
- this.clearContent();
- this.moduleContent = new Element("div", {
- "styles": this.css.moduleContent
- }).inject(this.rightContentNode);
- if (!this.restActions) this.restActions = MWF.Actions.get("x_cms_assemble_control"); //new MWF.xApplication.cms.Module.Actions.RestActions();
- this.view = new MWF.xApplication.cms.Module.ListExplorer(
- this.moduleContent,
- this.restActions,
- this.options.columnData,
- categoryData,
- revealData,
- {"isAdmin": this.isAdmin, "searchKey" : searchKey },
- this.searchNode
- );
- this.view.app = this;
- this.view.selectEnable = this.selectEnable;
- this.view.load();
- }.bind(this));
- },
- recordStatus: function(){
- var currentObject = this.navi.currentObject;
- if( currentObject ){
- var categoryId = currentObject.getCategoryId();
- if (categoryId){
- return {
- "columnId" : this.options.columnData.id,
- "categoryId" :categoryId,
- "isCategory" : currentObject.isCategory,
- "viewId" : currentObject.data.id
- };
- }else{
- return { "columnId" : this.options.columnData.id , "categoryId" : "whole"}
- }
- }else{
- return { "columnId" : this.options.columnData.id , "categoryId" : "whole" }
- }
- },
- setNaviSize: function(){
- //var titlebarSize = this.titleBar ? this.titleBar.getSize() : {"x":0,"y":0};
- var nodeSize = this.node.getSize();
- //var pt = this.naviContainerNode.getStyle("padding-top").toFloat();
- //var pb = this.naviContainerNode.getStyle("padding-bottom").toFloat();
- //var height = nodeSize.y-pt-pb-titlebarSize.y;
- this.naviContainerNode.setStyle("height", ""+nodeSize.y+"px");
- }
- });
- MWF.xApplication.cms.Module.Navi = new Class({
- Implements: [Options, Events],
- options : {
- "categoryId" :"" ,
- "viewId" : "",
- "isCategory" : false,
- "navi" : -1
- },
- initialize: function(app, node, columnData, options){
- this.setOptions(options);
- this.app = app;
- this.node = $(node);
- this.columnData = columnData;
- this.categoryList = [];
- this.css = this.app.css;
- this.load();
- },
- load: function(){
- var self = this;
- var showAll = (typeOf(this.columnData.showAllDocuments) === "boolean" ? this.columnData.showAllDocuments : true).toString();
- if( showAll !== "false" ){
- this.allView = new MWF.xApplication.cms.Module.NaviAllView( this, this.node, {} );
- }
- if( this.columnData.config.latest === false ){
- this.draftView = new MWF.xApplication.cms.Module.NaviDraftView( this, this.node, {} );
- }
- new Element("div",{
- "styles" : this.css.viewNaviBottom
- }).inject(this.node);
- this.app.restActions.listCategory( this.columnData.id, function( json ) {
- json.data.each(function (d, idx) {
- var isCurrent = false;
- var category = new MWF.xApplication.cms.Module.NaviCategory(this, this.node,d, {} );
- this.categoryList.push( category );
- if( showAll == "false" && idx === 0 ){
- category.setCurrent();
- }
- this.fireEvent("postLoad");
- }.bind(this))
- }.bind(this))
- }
- });
- MWF.xApplication.cms.Module.NaviCategory = new Class({
- Implements: [Options, Events],
- options: {
- "style": "default"
- },
- initialize: function ( navi, container, data, options) {
- this.setOptions(options);
- this.navi = navi;
- this.app = navi.app;
- this.container = $(container);
- this.data = data;
- this.css = this.app.css;
- this.load();
- },
- load: function () {
- var _self = this;
- this.isCategory = true;
- this.isCurrent = false;
- this.isExpended = false;
- this.hasSub = false;
- this.naviViewList = [];
- if( this.navi.options.categoryId == this.data.id && this.navi.options.isCategory ){
- this.isCurrent = true;
- }
- this.reveal = this.getRevealData();
- this.node = new Element("div.categoryNaviNode", {
- "styles": this.css.categoryNaviNode
- }).inject(this.container);
- this.expendNode = new Element("div.expendNode").inject(this.node);
- this.setExpendNodeStyle();
- if( this.hasSub ){
- this.expendNode.addEvent( "click" , function(ev){
- this.triggerExpend();
- ev.stopPropagation();
- }.bind(this));
- }
- this.textNode = new Element("div.categoryNaviTextNode",{
- "styles": this.css.categoryNaviTextNode,
- "text": this.data.name //this.defaultRevealData.id == "defaultList" ? this.data.name : this.defaultRevealData.showName
- }).inject(this.node);
- this.node.addEvents({
- "mouseover": function(){ if ( !_self.isCurrent )this.setStyles(_self.app.css.categoryNaviNode_over) },
- "mouseout": function(){ if ( !_self.isCurrent )this.setStyles( _self.app.css.categoryNaviNode ) },
- click : function(){ _self.setCurrent(this);}
- });
- this.listNode = new Element("div.viewNaviListNode",{
- "styles" : this.css.viewNaviListNode
- }).inject(this.container);
- this.loadListContent();
- if( this.isCurrent ){
- this.setCurrent();
- }
- },
- getRevealData: function(){
- debugger;
- var j = this.data.extContent;
- if( j ){
- this.extContent = JSON.parse( j );
- }
- if( !this.extContent || !this.extContent.reveal || this.extContent.reveal.length == 0 ){ //兼容以前的设置
- this.extContent = { reveal : [] };
- this.app.restActions.listViewByCategory( this.data.id, function(json){
- ( json.data || [] ).each( function(d){
- var itemData = {
- "type" : "list",
- "name" : d.name,
- "showName" : d.name,
- "id" : d.id,
- "alias" : d.alias,
- "appId" : d.appId,
- "formId" : d.formId,
- "formName" : d.formName
- };
- this.extContent.reveal.push( itemData );
- }.bind(this));
- }.bind(this), null, false );
- }
- this.extContent.reveal.each( function( r, i ){
- if(this.data.defaultViewName && r.id == this.data.defaultViewName ){
- this.defaultRevealData = r;
- }else if( i>0 ){
- this.isExpended = true;
- this.hasSub = true;
- }
- }.bind(this));
- if( !this.extContent || !this.extContent.reveal || this.extContent.reveal.length == 0 ){
- this.extContent = { reveal : [{
- id : "defaultList",
- showName : "系统列表",
- name : "系统列表"
- }] };
- }
- this.revealData = this.extContent.reveal;
- if( !this.defaultRevealData ){
- this.defaultRevealData = {
- id : "defaultList",
- showName : "系统列表",
- name : "系统列表"
- }
- }
- },
- setExpendNodeStyle : function(){
- var style;
- if( this.hasSub ){
- if( this.isExpended ){
- if( this.isCurrent ){
- style = this.css.categoryExpendNode_selected;
- }else{
- style = this.css.categoryExpendNode;
- }
- }else{
- if( this.isCurrent ){
- style = this.css.categoryCollapseNode_selected;
- }else{
- style = this.css.categoryCollapseNode;
- }
- }
- }else{
- style = this.css.emptyExpendNode;
- }
- this.expendNode.setStyles( style );
- },
- triggerExpend : function(){
- if( this.hasSub ){
- if( this.isExpended ){
- this.isExpended = false;
- this.listNode.setStyle("display","none")
- }else{
- this.isExpended = true;
- this.listNode.setStyle("display","")
- }
- this.setExpendNodeStyle();
- }
- },
- setCurrent : function(){
- if( this.navi.currentObject ){
- this.navi.currentObject.cancelCurrent();
- }
- this.node.setStyles( this.css.categoryNaviNode_selected );
- if( this.hasSub ){
- if( this.isExpended ){
- this.expendNode.setStyles( this.css.categoryExpendNode_selected );
- }else{
- this.expendNode.setStyles( this.css.categoryCollapseNode_selected );
- }
- }
- this.isCurrent = true;
- this.navi.currentObject = this;
- var action = this.app.importAction;
- if( action ){
- action.setStyle("display", (this.data.importViewId && this.app.isAdmin) ? "" : "none");
- }
- action = this.app.exportAction;
- if( action ){
- action.setStyle("display", (this.data.importViewId && this.app.isAdmin) ? "" : "none");
- }
- this.loadView();
- },
- cancelCurrent : function(){
- this.isCurrent = false;
- this.node.setStyles( this.css.categoryNaviNode );
- if( this.hasSub ){
- if( this.isExpended ){
- this.expendNode.setStyles( this.css.categoryExpendNode );
- }else{
- this.expendNode.setStyles( this.css.categoryCollapseNode );
- }
- }
- },
- loadView: function( searchkey ){
- this.app.openView( this, this.data, this.viewData || this.defaultRevealData, searchkey || "", this );
- },
- loadListContent : function(){
- this.revealData.each( function( d , i){
- if( d.id != this.defaultRevealData.id ){
- var naviView = new MWF.xApplication.cms.Module.NaviView(this.navi, this, this.listNode, d, {
- "style": this.options.style,
- "index" : i
- });
- this.naviViewList.push( naviView );
- }
- }.bind(this));
- new Element("div", {
- "styles": this.css.viewNaviSepartorNode
- }).inject( this.listNode );
- },
- getCategoryId : function(){
- return this.data.id;
- }
- });
- MWF.xApplication.cms.Module.NaviView = new Class({
- Implements: [Options, Events],
- options: {
- "style": "default",
- "index" : 0
- },
- initialize: function ( navi, category, container, data, options) {
- this.setOptions(options);
- this.navi = navi;
- this.category = category;
- this.app = navi.app;
- this.data = data;
- this.container = $(container);
- this.css = this.app.css;
- this.load();
- },
- load: function(){
- this.isDefault = this.data.id == "defaultList";
- this.isCurrent = false;
- this.isCategory = false;
- if( this.navi.options.categoryId == this.category.data.id && !this.navi.options.isCategory ){
- if( this.navi.options.viewId == "defaultList" && this.isDefault ){
- this.isCurrent = true;
- }else if( this.navi.options.viewId == this.data.id ){
- this.isCurrent = true;
- }else if( this.navi.options.naviIndex == this.options.index ){
- this.isCurrent = true;
- }
- }
- var _self = this;
- this.node = new Element("div.viewNaviNode", {
- "styles": this.css.viewNaviNode,
- "text" : (this.isDefault && !this.data.showName) ? this.app.lp.defaultView : this.data.showName
- }).inject(this.container);
- this.node.addEvents({
- "mouseover": function(){ if (!_self.isCurrent)this.setStyles(_self.css.viewNaviNode_over) },
- "mouseout": function(){ if (!_self.isCurrent)this.setStyles( _self.css.viewNaviNode ) },
- "click": function (el) {
- _self.setCurrent();
- }
- });
- if( this.isCurrent ){
- this.setCurrent()
- }
- },
- setCurrent : function(){
- if( this.navi.currentObject ){
- this.navi.currentObject.cancelCurrent();
- }
- this.node.setStyles( this.css.viewNaviNode_selected );
- this.isCurrent = true;
- this.navi.currentObject = this;
- var action = this.app.importAction;
- if( action ){
- action.setStyle("display", (this.category.data.importViewId && this.app.isAdmin) ? "" : "none");
- }
- action = this.app.exportAction;
- if( action ){
- action.setStyle("display", (this.category.data.importViewId && this.app.isAdmin) ? "" : "none");
- }
- this.loadView();
- },
- cancelCurrent : function(){
- this.isCurrent = false;
- this.node.setStyles( this.css.viewNaviNode );
- },
- getCategoryId : function(){
- return this.category.data.id;
- },
- loadView : function( searchKey ){
- this.app.openView( this, this.category.data, this.data, searchKey || "", this );
- }
- });
- MWF.xApplication.cms.Module.NaviAllView = new Class({
- Implements: [Options, Events],
- options: {
- "style": "default"
- },
- initialize: function ( navi, container, options) {
- this.setOptions(options);
- this.navi = navi;
- this.app = navi.app;
- this.container = $(container);
- this.css = this.app.css;
- this.data = {
- "isAll" : true,
- "id" : "defaultList"
- };
- this.load();
- },
- load: function(){
- var _self = this;
- this.isDefault = true;
- this.isAll = true;
- this.isCurrent = false;
- this.isCategory = false;
- if( this.navi.options.categoryId == "whole" ){
- this.isCurrent = true;
- }
- this.listNode = new Element("div.viewNaviListNode_all",{
- "styles" : this.css.viewNaviListNode_all
- }).inject(this.container);
- this.node = new Element("div.viewNaviNode_all", {
- "styles": this.css.viewNaviNode_all,
- "text" : this.app.lp.allDocument
- }).inject(this.listNode);
- this.node.addEvents({
- "mouseover": function(){ if ( !_self.isCurrent )this.setStyles(_self.css.viewNaviNode_all_over) },
- "mouseout": function(){ if ( !_self.isCurrent )this.setStyles( _self.css.viewNaviNode_all ) },
- "click": function (el) {
- _self.setCurrent();
- }
- });
- new Element("div", {
- "styles": this.css.viewNaviSepartorNode
- }).inject(this.listNode);
- if( this.isCurrent ){
- this.setCurrent()
- }
- },
- setCurrent : function(){
- if( this.navi.currentObject ){
- this.navi.currentObject.cancelCurrent();
- }
- this.node.setStyles( this.css.viewNaviNode_all_selected );
- this.isCurrent = true;
- this.navi.currentObject = this;
- var action = this.app.importAction;
- if( action ){
- action.setStyle("display","none");
- }
- var action = this.app.exportAction;
- if( action ){
- action.setStyle("display","none");
- }
- this.loadView();
- },
- cancelCurrent : function(){
- this.isCurrent = false;
- this.node.setStyles( this.css.viewNaviNode_all );
- },
- getCategoryId : function(){
- return null;
- },
- loadView : function( searchKey ){
- this.app.openView( this, null, this.data, searchKey || "", this );
- }
- });
- MWF.xApplication.cms.Module.NaviDraftView = new Class({
- Implements: [Options, Events],
- options: {
- "style": "default"
- },
- initialize: function ( navi, container, options) {
- this.setOptions(options);
- this.navi = navi;
- this.app = navi.app;
- this.container = $(container);
- this.css = this.app.css;
- this.data = {
- "isDraft" : true,
- "id" : "defaultList"
- };
- this.load();
- },
- load: function(){
- var _self = this;
- this.isDefault = true;
- this.isAll = true;
- this.isCurrent = false;
- this.isCategory = false;
- this.listNode = new Element("div.viewNaviListNode_all",{
- "styles" : this.css.viewNaviListNode_all
- }).inject(this.container);
- this.node = new Element("div.viewNaviNode_all", {
- "styles": this.css.viewNaviNode_all,
- "text" : this.app.lp.draftStatus
- }).inject(this.listNode);
- this.node.addEvents({
- "mouseover": function(){ if ( !_self.isCurrent )this.setStyles(_self.css.viewNaviNode_all_over) },
- "mouseout": function(){ if ( !_self.isCurrent )this.setStyles( _self.css.viewNaviNode_all ) },
- "click": function (el) {
- _self.setCurrent();
- }
- });
- new Element("div", {
- "styles": this.css.viewNaviSepartorNode
- }).inject(this.listNode);
- if( this.isCurrent ){
- this.setCurrent()
- }
- },
- setCurrent : function(){
- if( this.navi.currentObject ){
- this.navi.currentObject.cancelCurrent();
- }
- this.node.setStyles( this.css.viewNaviNode_all_selected );
- this.isCurrent = true;
- this.navi.currentObject = this;
- var action = this.app.importAction;
- if( action ){
- action.setStyle("display","none");
- }
- var action = this.app.exportAction;
- if( action ){
- action.setStyle("display","none");
- }
- this.loadView();
- },
- cancelCurrent : function(){
- this.isCurrent = false;
- this.node.setStyles( this.css.viewNaviNode_all );
- },
- getCategoryId : function(){
- return null;
- },
- loadView : function( searchKey ){
- this.app.openView( this, null, this.data, searchKey || "", this );
- }
- });
|