Browse files

Finished the functionality to create a run

  • Loading branch information...
1 parent b984498 commit fcb3ff61ff55b56716898db8f2884e9728049af7 @isuftin isuftin committed Mar 19, 2012
View
3 src/main/webapp/index.jsp
@@ -41,7 +41,8 @@
CONFIG.CSW_PARENT_IDENTIFIER = '<%= props.getProperty("watersmart.csw.identifier.parent", "497cf2db-56d6-4cad-9a56-a14b63fb232a") %>';
WATERSMART.USER = '<%= (user == null) ? "" : user.uid %>';
-
+ WATERSMART.USER_NAME = '<%= (user == null) ? "" : user.fullName %>';
+
/**
* Takes an element, checks the array for that element
* and if found, returns the index of that element.
View
31 src/main/webapp/pages/index/Form/ModelRunSelectionPanel.js
@@ -4,7 +4,6 @@ WaterSMART.ModelRunSelectionPanel = Ext.extend(Ext.Panel, {
cswStore : undefined,
modelStore : undefined,
mapPanel : undefined,
-// modelPanel : undefined,
runPanel : undefined,
constructor : function(config) {
if (!config) config = {};
@@ -54,12 +53,35 @@ WaterSMART.ModelRunSelectionPanel = Ext.extend(Ext.Panel, {
click : function() {
LOG.debug('')
- var isoFormPanel = new WaterSMART.ISOFormPanel({
+ var comboValue = this.getTopToolbar().get('model-combobox').getValue();
+ var modelStore = this.getTopToolbar().get('model-combobox').getStore().getById(comboValue);
+
+ var modelVersion = 0;
+ var runIdentifier = 0;
+ Ext.each(modelStore.data.rec.data.identificationInfo, function(iiItem) {
+ if (iiItem.serviceIdentification && iiItem.serviceIdentification.id.toLowerCase() === 'ncsos') {
+ var runVersion = iiItem.serviceIdentification.citation.edition.CharacterString.value.split('.')[0];
+
+ if (parseInt(runVersion) > this.runVersion) this.runVersion = runVersion;
+ this.modelVersion = iiItem.serviceIdentification.citation.edition.CharacterString.value.split('.')[0];
+
+ }
+ }, {
+ modelVersion : modelVersion,
+ runVersion : runIdentifier
+ })
+ runIdentifier++;
- });
+ var isoFormPanel = new WaterSMART.ISOFormPanel({
+ modelerName : WATERSMART.USER_NAME,
+ modelName : comboValue,
+ modelVersion : modelVersion,
+ runIdentifier : runIdentifier,
+ runDate : new Date()
+ });
var modalRunWindow = new Ext.Window({
- width: 'auto',
+ width: '30%',
height : 'auto',
modal : true,
items : [ isoFormPanel ]
@@ -85,6 +107,7 @@ WaterSMART.ModelRunSelectionPanel = Ext.extend(Ext.Panel, {
},
{
xtype: 'combo',
+ id : 'model-combobox',
store: this.modelStore,
autoWidth: true,
triggerAction : 'all',
View
28 src/main/webapp/pages/index/Form/isoFormPanel.js
@@ -3,9 +3,21 @@ Ext.ns("WaterSMART");
WaterSMART.ISOFormPanel = Ext.extend(Ext.form.FormPanel, {
htmlTransform : undefined,
xmlTransform : undefined,
+ modelName : undefined,
+ modelerName : undefined,
+ modelVersion : undefined,
+ runVersion : undefined,
+ runIdentifier : undefined,
+ runDate : undefined,
constructor : function(config) {
+
if (!config) config = {};
+ this.modelName = config.modelName || '';
+ this.modelerName = config.modelerName || '';
+ this.runIdentifier = config.runIdentifier || 0;
+ this.modelVersion = config.modelVersion || 0;
+ this.runDate = config.runDate || undefined;
Ext.Ajax.request({
url: 'xsl/csw-metadata.xsl',
success: function(response) {
@@ -34,6 +46,7 @@ WaterSMART.ISOFormPanel = Ext.extend(Ext.form.FormPanel, {
id: 'test_form',
bodyPadding: 5,
region: 'center',
+ width: '100%',
// The form will submit an AJAX request to this URL when submitted
url: 'pages/index/Utils/isorecord.jsp',
// Fields will be arranged vertically, stretched to full width
@@ -43,23 +56,29 @@ WaterSMART.ISOFormPanel = Ext.extend(Ext.form.FormPanel, {
items: [{
fieldLabel: 'Modeler Name',
name: 'name',
+ value : this.modelerName,
allowBlank: false
},{
+ xtype : 'displayfield',
fieldLabel: 'Model Name',
name: 'model',
+ value : this.modelName,
allowBlank: false
},{
fieldLabel: 'Model Version',
name: 'version',
+ value : this.modelVersion,
allowBlank: false
},{
fieldLabel: 'Run Identifier',
name: 'runIdent',
+ value : this.runIdentifier,
allowBlank: false
},{
xtype : 'datefield',
fieldLabel: 'Run Date',
name: 'creationDate',
+ value : this.runDate,
allowBlank: false
},{
fieldLabel: 'Calibration/ Validation Scenario',
@@ -147,14 +166,11 @@ WaterSMART.ISOFormPanel = Ext.extend(Ext.form.FormPanel, {
uploadPanel.getForm().submit({
url: uploadPanel.url,
- params : {
- modeltype : 'SYE'
- },
success: function(x, action) {
var form = Ext.getCmp('test_form');
form.getForm().submit({
url: form.url,
- modeltype : 'SYE',
+ modeltype : this.modelName,
success: function(x, action) {
LOG.debug('');
// var form = Ext.getCmp('test_form');
@@ -174,7 +190,7 @@ WaterSMART.ISOFormPanel = Ext.extend(Ext.form.FormPanel, {
// });
},
failure: function(panel, fail) {
- LOG.debug(fail);
+ NOTIFY.error({ msg : fail.result.message})
},
params: {
transaction: true
@@ -183,7 +199,7 @@ WaterSMART.ISOFormPanel = Ext.extend(Ext.form.FormPanel, {
});
},
failure: function(panel, fail) {
- LOG.debug(fail);
+ NOTIFY.error({ msg : fail.result.message})
},
waitMsg: 'Saving...'
});

0 comments on commit fcb3ff6

Please sign in to comment.