Commit f13f0bd4fe63006414cab48ad2e424399f054fa1

Authored by Elena.Budnik
1 parent 23769849

New Catalog creation

js/app/controllers/CatalogModule.js
... ... @@ -33,19 +33,7 @@ Ext.define('amdaDesktop.CatalogModule', {
33 33 uiType : 'panelCatalog',
34 34 helpTitle : 'Help on Catalog Module',
35 35 helpFile : 'catalogHelp',
36   -
37   - operationOnShow: function() {
38   - var obj = this.linkedNode.get('object');
39   - if (obj && obj.get('id') == '' && !obj.get('fromPlugin')) {
40   - Ext.Msg.prompt('Define Parameters', 'Please enter parameters number:', function(btn, text){
41   - if (btn == 'ok'){
42   - AmdaAction.initTTCache(this.getUiContent().isCatalog, text, this.getUiContent().onAfterInit, this.getUiContent());
43   - }
44   - }, this);
45   - }
46   -
47   - },
48   -
  36 +
49 37 shareCatalog : function(catObj) {
50 38 var win = myDesktopApp.desktop.getWindow('sharecat-win');
51 39 if(!win)
... ...
js/app/controllers/InteractiveModule.js
... ... @@ -132,9 +132,10 @@ Ext.define('amdaDesktop.InteractiveModule', {
132 132 this.getUiContent().updateObject();
133 133 },
134 134 show: function() {
135   - // configuration of empty catalog
136   - if (this.isOperationOnShow)
137   - Ext.Function.defer(this.operationOnShow, 2000, this);
  135 +// // configuration of empty catalog
  136 +// if (this.isOperationOnShow)
  137 +// // Ext.Function.defer(this.operationOnShow, 2000, this);
  138 +// this.operationOnShow();
138 139 if (onShowEvent)
139 140 onShowEvent();
140 141 }
... ...
js/app/views/CatalogUI.js
... ... @@ -418,177 +418,225 @@ Ext.define('amdaUI.CatalogUI', {
418 418 }]
419 419 });
420 420  
421   - this.formPanel = Ext.create('Ext.form.Panel', {
422   - region : 'center',
423   - layout: 'hbox',
424   - bodyStyle: {background : '#dfe8f6'},
425   - defaults: { border : false, align: 'stretch', bodyStyle: {background : '#dfe8f6'}, padding: '3'},
426   - fieldDefaults: { labelWidth: 80, labelAlign : 'top' },
427   - items: [
428   - {
429   - xtype: 'form',
430   - flex: 1,
431   - buttonAlign: 'left',
432   -// title : 'Information',
433   - layout: {type: 'vbox', pack: 'start', align: 'stretch'},
434   - items : [
435   - this.fieldName,
436   - {
437   - xtype: 'fieldcontainer',
438   - layout: 'hbox',
439   - items: [
440   - {
441   - xtype:'datefield', fieldLabel:'Creation date',
442   - name: 'created', disabled: true,
443   - hideTrigger: true, format: 'Y/m/d H:i:s'
444   - },
445   - { xtype: 'splitter' },
446   - { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', disabled: true}
447   - ]
448   - },
449   - {
450   - xtype: 'textarea',
451   - name: 'description',
452   - fieldLabel: 'Description',
453   - height: 200
454   - },
455   - {
456   - xtype: 'component',
457   - height: 180
458   - }
459   - ],
460   - fbar:[
461   - {
462   - type: 'button',
463   - text: 'Save',
464   - scope : this,
465   - handler: function () {
466   - if (this.updateObject()){
467   -
468   - var basicForm = this.formPanel.getForm();
469   - // if there's at least one record in the store of TTGrid
470   - if (this.TTGrid.getStore().getTotalCount() > 0) {
471   - // update TimeTable object which the content of form
472   - basicForm.updateRecord(this.object);
  421 + this.formPanel = Ext.create('Ext.form.Panel',
  422 + {
  423 + region : 'center',
  424 + layout: 'hbox',
  425 + bodyStyle: {background : '#dfe8f6'},
  426 + defaults: { border : false, align: 'stretch', bodyStyle: {background : '#dfe8f6'}, padding: '3'},
  427 + fieldDefaults: { labelWidth: 80, labelAlign : 'top' },
  428 + items: [
  429 + {
  430 + xtype: 'form',
  431 + flex: 1,
  432 + buttonAlign: 'left',
  433 + // title : 'Information',
  434 + layout: {type: 'vbox', pack: 'start', align: 'stretch'},
  435 + items : [
  436 + this.fieldName,
  437 + {
  438 + xtype: 'fieldcontainer',
  439 + layout: 'hbox',
  440 + items: [
  441 + {
  442 + xtype:'datefield', fieldLabel:'Creation date',
  443 + name: 'created', disabled: true,
  444 + hideTrigger: true, format: 'Y/m/d H:i:s'
  445 + },
  446 + { xtype: 'splitter' },
  447 + { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', disabled: true}
  448 + ]
  449 + },
  450 + {
  451 + xtype: 'textarea',
  452 + name: 'description',
  453 + fieldLabel: 'Description',
  454 + height: 200
  455 + },
  456 + {
  457 + xtype: 'component',
  458 + height: 180
  459 + }],
  460 + dockedItems:[
  461 + {
  462 + xtype: 'toolbar',
  463 + dock: 'bottom',
  464 + ui: 'footer',
  465 + items: [
  466 + {
  467 + type: 'button',
  468 + text: 'Create New Catalog',
  469 + scope : this,
  470 + handler: function ()
  471 + {
  472 + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
  473 +
  474 + if (!module) return;
  475 + var obj = module.linkedNode.get('object');
  476 +
  477 + if (obj && obj.get('id') == '' && !obj.get('fromPlugin')) {
  478 + var me = this
  479 + Ext.Msg.prompt('Define Parameters', 'Please enter parameters number:', function(btn, text){
  480 + if (btn == 'ok'){
  481 + AmdaAction.initTTCache(me.isCatalog, text, me.onAfterInit, me);
  482 + }
  483 + }, this);
  484 + }
  485 + }
  486 + }]
  487 + },
  488 + {
  489 + xtype: 'toolbar',
  490 + dock: 'bottom',
  491 + ui: 'footer',
  492 + items: [
  493 + {
  494 + type: 'button',
  495 + text: 'Save',
  496 + scope : this,
  497 + handler: function ()
  498 + {
  499 + if (this.updateObject())
  500 + {
  501 + var basicForm = this.formPanel.getForm();
  502 + // if there's at least one record in the store of TTGrid
  503 + if (this.TTGrid.getStore().getTotalCount() > 0)
  504 + {
  505 + // update TimeTable object which the content of form
  506 + basicForm.updateRecord(this.object);
473 507  
474   - var me = this;
475   - this.checkIntervalsStatusForSave(function () {
476   - //Name validation
477   - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
478   - if (!module)
479   - return;
480   - module.linkedNode.isValidName(me.fieldName.getValue(), function (res) {
481   - if (!res)
482   - {
483   - me.fieldName.validFlag = 'Error during object validation';
484   - myDesktopApp.errorMsg(me.fieldName.validFlag);
485   - me.fieldName.validate();
486   - return;
487   - }
488   -
489   - if (!res.valid)
490   - {
491   - if (res.error)
492   - {
493   - if (res.error.search('subtree') != -1) {
494   - Ext.MessageBox.show({title:'Warning',
495   - msg: res.error+'<br/>Do you want to overwrite it?',
496   - width: 300,
497   - buttons: Ext.MessageBox.OKCANCEL,
498   - fn : me.overwriteProcess,
499   - icon: Ext.MessageBox.WARNING,
500   - scope : me
501   - });
502   - me.fieldName.validFlag = true;
503   - }
504   - else
505   - me.fieldName.validFlag = res.error;
506   - }
507   - else
508   - {
509   - me.fieldName.validFlag = 'Invalid object name';
510   - myDesktopApp.errorMsg(me.fieldName.validFlag);
511   - }
512   - me.fieldName.validate();
513   - return;
514   - }
515   -
516   - me.fieldName.validFlag = true;
517   - me.fieldName.validate();
518   - me.saveProcess(false);
519   - });
520   - });
521   - } else {
522   - // warning:
523   - Ext.Msg.alert('No intervals', 'Your time table is invalid, <br>you must have at least one interval');
524   - }
525   - }
526   - }
527   - },{
528   - type: 'button',
529   - text: 'Share',
530   - disabled: true
531   - },
532   - {
533   - type: 'button',
534   - text: 'Visualize',
535   - scope: this,
536   - handler: function() {
537   - var me = this;
538   -
539   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) {
  508 + var me = this;
  509 + this.checkIntervalsStatusForSave(function ()
  510 + {
  511 + //Name validation
  512 + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
  513 +
  514 + if (!module) return;
  515 + module.linkedNode.isValidName(me.fieldName.getValue(), function (res)
  516 + {
  517 + if (!res)
  518 + {
  519 + me.fieldName.validFlag = 'Error during object validation';
  520 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  521 + me.fieldName.validate();
  522 + return;
  523 + }
  524 +
  525 + if (!res.valid)
  526 + {
  527 + if (res.error)
  528 + {
  529 + if (res.error.search('subtree') != -1)
  530 + {
  531 + Ext.MessageBox.show({title:'Warning',
  532 + msg: res.error+'<br/>Do you want to overwrite it?',
  533 + width: 300,
  534 + buttons: Ext.MessageBox.OKCANCEL,
  535 + fn : me.overwriteProcess,
  536 + icon: Ext.MessageBox.WARNING,
  537 + scope : me
  538 + });
  539 + me.fieldName.validFlag = true;
  540 + }
  541 + else
  542 + me.fieldName.validFlag = res.error;
  543 + }
  544 + else
  545 + {
  546 + me.fieldName.validFlag = 'Invalid object name';
  547 + myDesktopApp.errorMsg(me.fieldName.validFlag);
  548 + }
  549 + me.fieldName.validate();
  550 + return;
  551 + }
  552 +
  553 + me.fieldName.validFlag = true;
  554 + me.fieldName.validate();
  555 + me.saveProcess(false);
  556 + });
  557 + });
  558 + }
  559 + else
  560 + {
  561 + // warning:
  562 + Ext.Msg.alert('No intervals', 'Your time table is invalid, <br>you must have at least one interval');
  563 + }
  564 + }
  565 + }
  566 + },
  567 + {
  568 + type: 'button',
  569 + text: 'Reset'
  570 + },
  571 + {
  572 + type: 'button',
  573 + text: 'Share',
  574 + disabled: true
  575 + },
  576 + {
  577 + type: 'button',
  578 + text: 'Visualize',
  579 + scope: this,
  580 + handler: function()
  581 + {
  582 + var me = this;
540 583  
541   - //temporary linked node - as Visu module is 'pseudo' interactive - no 'save', no 'execute'
542   - var temporaryNode = Ext.create('amdaModel.CatalogNode', {
543   - leaf : true
544   - });
545   -
546   - if (temporaryNode) temporaryNode.set('object',me.object);
547   - module.setLinkedNode(temporaryNode);
548   -
549   - module.createWindow();
550   - });
551   - }
552   - }
553   - ]
554   - }, {
555   - xtype: 'form',
556   - bodyStyle: {background : '#dfe8f6'},
557   -// padding: '3',
558   - flex: 2,
559   - items : [
560   - this.TTGrid
561   - ]
562   - }
563   - ]
564   - });
  584 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module)
  585 + {
  586 + //temporary linked node - as Visu module is 'pseudo' interactive - no 'save', no 'execute'
  587 + var temporaryNode = Ext.create('amdaModel.CatalogNode', {
  588 + leaf : true
  589 + });
  590 +
  591 + if (temporaryNode) temporaryNode.set('object',me.object);
  592 + module.setLinkedNode(temporaryNode);
  593 +
  594 + module.createWindow();
  595 + });
  596 + }
  597 + }]
  598 + }]
  599 + },
  600 + {
  601 + xtype: 'form',
  602 + bodyStyle: {background : '#dfe8f6'},
  603 + //padding: '3',
  604 + flex: 2,
  605 + items : [
  606 + this.TTGrid
  607 + ]
  608 + }]
  609 + });
565 610  
566   - this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections){
567   - this.TTGrid.down('#delete').setDisabled(selections.length === 0);
568   - }, this);
  611 + this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections)
  612 + {
  613 + this.TTGrid.down('#delete').setDisabled(selections.length === 0);
  614 + }, this);
569 615  
570   - var myConf = {
571   - layout: 'border',
572   - items: [
573   - this.formPanel,
574   - {
575   - xtype: 'panel',
576   - region: 'south',
577   - title: 'Information',
578   - collapsible: true,
579   - height: 100,
580   - autoHide: false,
581   - bodyStyle: 'padding:5px',
582   - iconCls: 'icon-information',
583   - loader: {
584   - autoLoad: true,
585   - url: helpDir+'catalogHOWTO'
586   - }
587   - }
588   - ]
589   - };
  616 + var myConf =
  617 + {
  618 + layout: 'border',
  619 + items: [
  620 + this.formPanel,
  621 + {
  622 + xtype: 'panel',
  623 + region: 'south',
  624 + title: 'Information',
  625 + collapsible: true,
  626 + height: 100,
  627 + autoHide: false,
  628 + bodyStyle: 'padding:5px',
  629 + iconCls: 'icon-information',
  630 + loader:
  631 + {
  632 + autoLoad: true,
  633 + url: helpDir+'catalogHOWTO'
  634 + }
  635 + }
  636 + ]
  637 + };
590 638  
591   - Ext.apply (this, Ext.apply(arguments, myConf));
592   - }
  639 + Ext.apply (this, Ext.apply(arguments, myConf));
  640 + }
593 641  
594 642 });
... ...