Revision 36171e6e
Added by Alessandro_N over 10 years ago
| szcluster-db/workspace/client-user/js/components/datasetServices/columnsDefinitionService.js | ||
|---|---|---|
| 1 |
/******************************************************************************* |
|
| 2 |
* Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES |
|
| 3 |
* |
|
| 4 |
* This file is part of SITools2. |
|
| 5 |
* |
|
| 6 |
* SITools2 is free software: you can redistribute it and/or modify it under the |
|
| 7 |
* terms of the GNU General Public License as published by the Free Software |
|
| 8 |
* Foundation, either version 3 of the License, or (at your option) any later |
|
| 9 |
* version. |
|
| 10 |
* |
|
| 11 |
* SITools2 is distributed in the hope that it will be useful, but WITHOUT ANY |
|
| 12 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
|
| 13 |
* A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|
| 14 |
* |
|
| 15 |
* You should have received a copy of the GNU General Public License along with |
|
| 16 |
* SITools2. If not, see <http://www.gnu.org/licenses/>. |
|
| 17 |
******************************************************************************/ |
|
| 18 |
/* |
|
| 19 |
* global Ext, sitools, ID, i18n, document, showResponse, alertFailure, LOCALE, |
|
| 20 |
* ImageChooser, loadUrl, extColModelToStorage, SitoolsDesk |
|
| 21 |
*/ |
|
| 22 |
|
|
| 23 |
Ext.namespace('sitools.user.component.dataviews.services');
|
|
| 24 |
|
|
| 25 |
/** |
|
| 26 |
* GUI Service to download a data selection from the dataset |
|
| 27 |
* |
|
| 28 |
* @required datasetId |
|
| 29 |
* @required datasetUrl |
|
| 30 |
* @cfg {Ext.data.JsonStore} the store where nodes are saved
|
|
| 31 |
* @class sitools.user.component.dataviews.services.addSelectionService |
|
| 32 |
* @extends Ext.Window |
|
| 33 |
*/ |
|
| 34 |
|
|
| 35 |
sitools.user.component.dataviews.services.columnsDefinitionService = {};
|
|
| 36 |
|
|
| 37 |
sitools.user.component.dataviews.services.columnsDefinitionService.getParameters = function() {
|
|
| 38 |
return []; |
|
| 39 |
}; |
|
| 40 |
|
|
| 41 |
sitools.user.component.dataviews.services.columnsDefinitionService.executeAsService = function( |
|
| 42 |
config) {
|
|
| 43 |
var windowConfig = {
|
|
| 44 |
title : "Dataset definitions", //i18n.get('label.definitionTitle') + " : "
|
|
| 45 |
// + config.dataview.datasetName, |
|
| 46 |
datasetName : config.dataview.datasetName, |
|
| 47 |
iconCls : "semantic", |
|
| 48 |
datasetDescription : config.datasetDescription, |
|
| 49 |
type : "defi", |
|
| 50 |
saveToolbar : true, |
|
| 51 |
toolbarItems : [] |
|
| 52 |
}; |
|
| 53 |
|
|
| 54 |
var javascriptObject = sitools.user.component.columnsDefinition; |
|
| 55 |
|
|
| 56 |
Ext.apply(windowConfig, {
|
|
| 57 |
id : "defi" + config.dataview.datasetId |
|
| 58 |
}); |
|
| 59 |
var componentCfg = {
|
|
| 60 |
datasetId : config.dataview.datasetId, |
|
| 61 |
datasetCm : config.dataview.datasetCm, |
|
| 62 |
datasetName : config.dataview.datasetName, |
|
| 63 |
dictionaryMappings : config.dataview.dictionaryMappings, |
|
| 64 |
preferencesPath : "/" + config.dataview.datasetName, |
|
| 65 |
preferencesFileName : "semantic" |
|
| 66 |
}; |
|
| 67 |
|
|
| 68 |
SitoolsDesk.addDesktopWindow(windowConfig, componentCfg, javascriptObject); |
|
| 69 |
}; |
|
| szcluster-db/workspace/client-user/js/components/datasetServices/plotService.js | ||
|---|---|---|
| 1 |
/******************************************************************************* |
|
| 2 |
* Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES |
|
| 3 |
* |
|
| 4 |
* This file is part of SITools2. |
|
| 5 |
* |
|
| 6 |
* SITools2 is free software: you can redistribute it and/or modify it under the |
|
| 7 |
* terms of the GNU General Public License as published by the Free Software |
|
| 8 |
* Foundation, either version 3 of the License, or (at your option) any later |
|
| 9 |
* version. |
|
| 10 |
* |
|
| 11 |
* SITools2 is distributed in the hope that it will be useful, but WITHOUT ANY |
|
| 12 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
|
| 13 |
* A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|
| 14 |
* |
|
| 15 |
* You should have received a copy of the GNU General Public License along with |
|
| 16 |
* SITools2. If not, see <http://www.gnu.org/licenses/>. |
|
| 17 |
******************************************************************************/ |
|
| 18 |
/*global Ext, sitools, ID, i18n, document, showResponse, alertFailure, LOCALE, ImageChooser, loadUrl, extColModelToStorage, SitoolsDesk, WARNING_NB_RECORDS_PLOT*/ |
|
| 19 |
|
|
| 20 |
Ext.namespace('sitools.user.component.dataviews.services');
|
|
| 21 |
|
|
| 22 |
/** |
|
| 23 |
* service used to show the plot |
|
| 24 |
* |
|
| 25 |
* @required datasetId |
|
| 26 |
* @required datasetUrl |
|
| 27 |
* @cfg {Ext.data.JsonStore} the store where nodes are saved
|
|
| 28 |
* @class sitools.user.component.dataviews.services.addSelectionService |
|
| 29 |
* @extends Ext.Window |
|
| 30 |
*/ |
|
| 31 |
sitools.user.component.dataviews.services.plotService = {};
|
|
| 32 |
|
|
| 33 |
Ext.reg('sitools.user.component.dataviews.services.plotService', sitools.user.component.dataviews.services.plotService);
|
|
| 34 |
|
|
| 35 |
sitools.user.component.dataviews.services.plotService.getParameters = function () {
|
|
| 36 |
return [{
|
|
| 37 |
jsObj : "Ext.form.TextField", |
|
| 38 |
config : {
|
|
| 39 |
anchor : "100%", |
|
| 40 |
fieldLabel : i18n.get("label.warning_nb_records"),
|
|
| 41 |
value : WARNING_NB_RECORDS_PLOT, |
|
| 42 |
name : "warning_nb_records" |
|
| 43 |
} |
|
| 44 |
}]; |
|
| 45 |
}; |
|
| 46 |
|
|
| 47 |
sitools.user.component.dataviews.services.plotService.executeAsService = function (config) {
|
|
| 48 |
|
|
| 49 |
var grid = config.dataview; |
|
| 50 |
var datasetId = grid.datasetId; |
|
| 51 |
var datasetUrl = grid.sitoolsAttachementForUsers; |
|
| 52 |
var datasetName = grid.datasetName; |
|
| 53 |
var columnModel = grid.datasetCm; |
|
| 54 |
var formParams = grid.formParams; |
|
| 55 |
var formMultiDsParams = grid.formMultiDsParams; |
|
| 56 |
|
|
| 57 |
var sortInfo = grid.getSortInfo(); |
|
| 58 |
|
|
| 59 |
var maxWarningRecords = WARNING_NB_RECORDS_PLOT; |
|
| 60 |
Ext.each(config.parameters, function (param) {
|
|
| 61 |
if (param.name === "warning_nb_records") {
|
|
| 62 |
maxWarningRecords = parseInt(param.value, 10); |
|
| 63 |
} |
|
| 64 |
}, this); |
|
| 65 |
|
|
| 66 |
var jsObj = sitools.user.component.dataPlotter; |
|
| 67 |
var componentCfg = {
|
|
| 68 |
columnModel : columnModel, |
|
| 69 |
formParams : formParams, |
|
| 70 |
formMultiDsParams : formMultiDsParams, |
|
| 71 |
dataUrl : datasetUrl, |
|
| 72 |
datasetName : datasetName, |
|
| 73 |
datasetId : datasetId, |
|
| 74 |
componentType : "plot", |
|
| 75 |
preferencesPath : "/" + datasetName, |
|
| 76 |
preferencesFileName : "plot", |
|
| 77 |
filters : grid.getFilters(), |
|
| 78 |
selections : Ext.isEmpty(grid.getSelections()) ? undefined : grid.getSelectionForPlot(), |
|
| 79 |
sortInfo : sortInfo, |
|
| 80 |
selectionSize : (grid.isAllSelected()) ? grid.store.getTotalCount() : grid.getNbRowsSelected(), |
|
| 81 |
maxWarningRecords : maxWarningRecords |
|
| 82 |
}; |
|
| 83 |
var windowConfig = {
|
|
| 84 |
id : "plot" + datasetId, |
|
| 85 |
title : "Data plot",//"Data plot : " + datasetName, |
|
| 86 |
iconCls : "plot", |
|
| 87 |
datasetName : datasetName, |
|
| 88 |
type : "plot", |
|
| 89 |
saveToolbar : true, |
|
| 90 |
winHeight : 600 |
|
| 91 |
}; |
|
| 92 |
SitoolsDesk.addDesktopWindow(windowConfig, componentCfg, jsObj); |
|
| 93 |
}; |
|
| szcluster-db/workspace/client-user/js/components/datasetServices/viewDataDetailsService.js | ||
|---|---|---|
| 1 |
/******************************************************************************* |
|
| 2 |
* Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES |
|
| 3 |
* |
|
| 4 |
* This file is part of SITools2. |
|
| 5 |
* |
|
| 6 |
* SITools2 is free software: you can redistribute it and/or modify it under the |
|
| 7 |
* terms of the GNU General Public License as published by the Free Software |
|
| 8 |
* Foundation, either version 3 of the License, or (at your option) any later |
|
| 9 |
* version. |
|
| 10 |
* |
|
| 11 |
* SITools2 is distributed in the hope that it will be useful, but WITHOUT ANY |
|
| 12 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
|
| 13 |
* A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|
| 14 |
* |
|
| 15 |
* You should have received a copy of the GNU General Public License along with |
|
| 16 |
* SITools2. If not, see <http://www.gnu.org/licenses/>. |
|
| 17 |
******************************************************************************/ |
|
| 18 |
/*global Ext, sitools, ID, i18n, document, showResponse, alertFailure, LOCALE, ImageChooser, loadUrl, extColModelToStorage, SitoolsDesk*/ |
|
| 19 |
|
|
| 20 |
Ext.namespace('sitools.user.component.dataviews.services');
|
|
| 21 |
|
|
| 22 |
/** |
|
| 23 |
* service used to show the details of a specific record |
|
| 24 |
* |
|
| 25 |
* @required datasetId |
|
| 26 |
* @required datasetUrl |
|
| 27 |
* @cfg {Ext.data.JsonStore} the store where nodes are saved
|
|
| 28 |
* @class sitools.user.component.dataviews.services.addSelectionService |
|
| 29 |
* @extends Ext.Window |
|
| 30 |
*/ |
|
| 31 |
sitools.user.component.dataviews.services.viewDataDetailsService = {};
|
|
| 32 |
|
|
| 33 |
Ext.reg('sitools.user.component.dataviews.services.viewDataDetailsService', sitools.user.component.dataviews.services.viewDataDetailsService);
|
|
| 34 |
|
|
| 35 |
sitools.user.component.dataviews.services.viewDataDetailsService.getParameters = function () {
|
|
| 36 |
return []; |
|
| 37 |
}; |
|
| 38 |
|
|
| 39 |
sitools.user.component.dataviews.services.viewDataDetailsService.executeAsService = function (config) {
|
|
| 40 |
|
|
| 41 |
var grid = config.dataview; |
|
| 42 |
var fromWhere = config.origin; |
|
| 43 |
var urlRecords = grid.urlRecords; |
|
| 44 |
var datasetId = grid.datasetId; |
|
| 45 |
var datasetUrl = grid.sitoolsAttachementForUsers; |
|
| 46 |
var datasetName = grid.datasetName; |
|
| 47 |
var selections = grid.getSelections(); |
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
if (Ext.isEmpty(selections) || selections.length === 0) {
|
|
| 52 |
return Ext.Msg.alert(i18n.get('label.warning'), i18n.get('warning.noselection'));
|
|
| 53 |
} |
|
| 54 |
|
|
| 55 |
var componentCfg = {
|
|
| 56 |
baseUrl : urlRecords + "/", |
|
| 57 |
grid : grid, |
|
| 58 |
fromWhere : fromWhere, |
|
| 59 |
datasetId : datasetId, |
|
| 60 |
datasetUrl : datasetUrl, |
|
| 61 |
selections : selections, |
|
| 62 |
preferencesPath : "/" + datasetName, |
|
| 63 |
preferencesFileName : "dataDetails" |
|
| 64 |
}; |
|
| 65 |
var jsObj = sitools.user.component.viewDataDetail; |
|
| 66 |
|
|
| 67 |
var windowConfig = {
|
|
| 68 |
id : "dataDetail" + datasetId, |
|
| 69 |
title : "Details", //i18n.get('label.viewDataDetail') + " : " + datasetName,
|
|
| 70 |
datasetName : datasetName, |
|
| 71 |
saveToolbar : true, |
|
| 72 |
iconCls : "dataDetail", |
|
| 73 |
type : "dataDetail", |
|
| 74 |
shadow : true, |
|
| 75 |
shadowOffset : 5, |
|
| 76 |
toolbarItems : [ {
|
|
| 77 |
iconCls : 'arrow-back', |
|
| 78 |
handler : function () {
|
|
| 79 |
this.ownerCt.ownerCt.items.items[0].goPrevious(); |
|
| 80 |
} |
|
| 81 |
}, {
|
|
| 82 |
iconCls : 'arrow-next', |
|
| 83 |
handler : function () {
|
|
| 84 |
this.ownerCt.ownerCt.items.items[0].goNext(); |
|
| 85 |
} |
|
| 86 |
} ] |
|
| 87 |
}; |
|
| 88 |
|
|
| 89 |
SitoolsDesk.addDesktopWindow(windowConfig, componentCfg, jsObj, true); |
|
| 90 |
}; |
|
| szcluster-db/workspace/client-user/js/modules/formsAsMenu/formsAsMenu.js | ||
|---|---|---|
| 1 |
/*************************************** |
|
| 2 |
* Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES |
|
| 3 |
* |
|
| 4 |
* This file is part of SITools2. |
|
| 5 |
* |
|
| 6 |
* SITools2 is free software: you can redistribute it and/or modify |
|
| 7 |
* it under the terms of the GNU General Public License as published by |
|
| 8 |
* the Free Software Foundation, either version 3 of the License, or |
|
| 9 |
* (at your option) any later version. |
|
| 10 |
* |
|
| 11 |
* SITools2 is distributed in the hope that it will be useful, |
|
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 14 |
* GNU General Public License for more details. |
|
| 15 |
* |
|
| 16 |
* You should have received a copy of the GNU General Public License |
|
| 17 |
* along with SITools2. If not, see <http://www.gnu.org/licenses/>. |
|
| 18 |
***************************************/ |
|
| 19 |
/*global Ext, sitools, i18n, document, projectGlobal, SitoolsDesk, userLogin, DEFAULT_PREFERENCES_FOLDER, loadUrl*/ |
|
| 20 |
/* |
|
| 21 |
* @include "../../sitoolsProject.js" |
|
| 22 |
* @include "../../desktop/desktop.js" |
|
| 23 |
* @include "../../components/forms/forms.js" |
|
| 24 |
* @include "../../components/forms/projectForm.js" |
|
| 25 |
*/ |
|
| 26 |
|
|
| 27 |
Ext.namespace('sitools.user.modules');
|
|
| 28 |
|
|
| 29 |
/** |
|
| 30 |
* Forms Module : |
|
| 31 |
* Displays All Forms depending on datasets attached to the project. |
|
| 32 |
* @class sitools.user.modules.formsAsMenu |
|
| 33 |
* @extends Ext.menu.Menu |
|
| 34 |
* @requires sitools.user.component.forms.mainContainer |
|
| 35 |
*/ |
|
| 36 |
sitools.user.modules.formsAsMenu = function () {
|
|
| 37 |
var urlFormsModule = projectGlobal.sitoolsAttachementForUsers + "/forms"; |
|
| 38 |
this.storeFormDs = new Ext.data.JsonStore({
|
|
| 39 |
root : 'data', |
|
| 40 |
restful : true, |
|
| 41 |
remoteSort : true, |
|
| 42 |
url : urlFormsModule, |
|
| 43 |
// sortField: 'name', |
|
| 44 |
idProperty : 'id', |
|
| 45 |
fields : [ {
|
|
| 46 |
name : 'id', |
|
| 47 |
type : 'string' |
|
| 48 |
}, {
|
|
| 49 |
name : 'parent', |
|
| 50 |
type : 'string' |
|
| 51 |
}, {
|
|
| 52 |
name : 'name', |
|
| 53 |
type : 'string' |
|
| 54 |
}, {
|
|
| 55 |
name : 'css', |
|
| 56 |
type : 'string' |
|
| 57 |
}, {
|
|
| 58 |
name : 'description', |
|
| 59 |
type : 'string' |
|
| 60 |
}, {
|
|
| 61 |
name : 'width', |
|
| 62 |
type : 'numeric' |
|
| 63 |
}, {
|
|
| 64 |
name : 'height', |
|
| 65 |
type : 'numeric' |
|
| 66 |
}, {
|
|
| 67 |
name : 'parameters' |
|
| 68 |
}, {
|
|
| 69 |
name : 'authorized' |
|
| 70 |
}, {
|
|
| 71 |
name : 'parentUrl', |
|
| 72 |
type : 'string' |
|
| 73 |
}, {
|
|
| 74 |
name : 'zones' |
|
| 75 |
}], |
|
| 76 |
autoLoad : true, |
|
| 77 |
listeners : {
|
|
| 78 |
scope : this, |
|
| 79 |
load : this.onLoadDatasetsForms, |
|
| 80 |
beforeload : function () {
|
|
| 81 |
var menuItems = [{
|
|
| 82 |
text : i18n.get("label.loading"),
|
|
| 83 |
icon: '/sitools/cots/extjs/resources/images/default/grid/loading.gif' |
|
| 84 |
}]; |
|
| 85 |
this.addItem(menuItems); |
|
| 86 |
|
|
| 87 |
} |
|
| 88 |
|
|
| 89 |
} |
|
| 90 |
|
|
| 91 |
}); |
|
| 92 |
var urlFormsMultiDs = projectGlobal.sitoolsAttachementForUsers + "/formsProject"; |
|
| 93 |
|
|
| 94 |
this.storeFormsMultiDs = new Ext.data.JsonStore({
|
|
| 95 |
root : 'data', |
|
| 96 |
restful : true, |
|
| 97 |
remoteSort : true, |
|
| 98 |
url : urlFormsMultiDs, |
|
| 99 |
// sortField: 'name', |
|
| 100 |
idProperty : 'id', |
|
| 101 |
fields : [ {
|
|
| 102 |
name : 'id', |
|
| 103 |
type : 'string' |
|
| 104 |
}, {
|
|
| 105 |
name : 'parent', |
|
| 106 |
type : 'string' |
|
| 107 |
}, {
|
|
| 108 |
name : 'name', |
|
| 109 |
type : 'string' |
|
| 110 |
}, {
|
|
| 111 |
name : 'css', |
|
| 112 |
type : 'string' |
|
| 113 |
}, {
|
|
| 114 |
name : 'description', |
|
| 115 |
type : 'string' |
|
| 116 |
}, {
|
|
| 117 |
name : 'width', |
|
| 118 |
type : 'numeric' |
|
| 119 |
}, {
|
|
| 120 |
name : 'height', |
|
| 121 |
type : 'numeric' |
|
| 122 |
}, {
|
|
| 123 |
name : 'parameters' |
|
| 124 |
}, {
|
|
| 125 |
name : 'authorized' |
|
| 126 |
}, {
|
|
| 127 |
name : 'parentUrl', |
|
| 128 |
type : 'string' |
|
| 129 |
}, {
|
|
| 130 |
name : 'properties' |
|
| 131 |
}, {
|
|
| 132 |
name : 'urlServicePropertiesSearch', |
|
| 133 |
type : 'string' |
|
| 134 |
}, {
|
|
| 135 |
name : 'urlServiceDatasetSearch', |
|
| 136 |
type : 'string' |
|
| 137 |
}, {
|
|
| 138 |
name : 'collection' |
|
| 139 |
}, {
|
|
| 140 |
name : 'dictionary' |
|
| 141 |
}, {
|
|
| 142 |
name : 'nbDatasetsMax', |
|
| 143 |
type : 'numeric' |
|
| 144 |
}, {
|
|
| 145 |
name : 'zones' |
|
| 146 |
}], |
|
| 147 |
autoLoad : false, |
|
| 148 |
listeners : {
|
|
| 149 |
scope : this, |
|
| 150 |
load : this.onLoadMultiDSForms |
|
| 151 |
} |
|
| 152 |
}); |
|
| 153 |
|
|
| 154 |
|
|
| 155 |
sitools.user.modules.formsAsMenu.superclass.constructor.call(this, Ext.apply({
|
|
| 156 |
menuMultiDsFormLoaded : false, |
|
| 157 |
formDsLoaded : false, |
|
| 158 |
formMultiDsLoaded : false, |
|
| 159 |
cls : "sitools-navbar-menu" |
|
| 160 |
})); |
|
| 161 |
|
|
| 162 |
}; |
|
| 163 |
|
|
| 164 |
Ext.extend(sitools.user.modules.formsAsMenu, Ext.menu.Menu, {
|
|
| 165 |
enableScrolling : true, |
|
| 166 |
id : "formAsMenu", |
|
| 167 |
onLoadDatasetsForms : function () {
|
|
| 168 |
var menuItems = []; |
|
| 169 |
var test = []; |
|
| 170 |
this.storeFormDs.each(function (rec) {
|
|
| 171 |
if(test.indexOf(rec.get("parent")) < 0){
|
|
| 172 |
test.push(rec.get("parent"));
|
|
| 173 |
} |
|
| 174 |
},this); |
|
| 175 |
this.storeFormDs.each(function (rec) {
|
|
| 176 |
if(rec.get("name").indexOf("Search") < 0){
|
|
| 177 |
menuItems.push({
|
|
| 178 |
text : rec.get("name"),
|
|
| 179 |
rec : rec, |
|
| 180 |
scope : this, |
|
| 181 |
handler : function (b) {
|
|
| 182 |
this.showDetail(b.rec); |
|
| 183 |
} |
|
| 184 |
}); |
|
| 185 |
}else if(rec.get("name") == "Name Search"){
|
|
| 186 |
menuItems.push({
|
|
| 187 |
text : "Search Query", |
|
| 188 |
rec : rec, |
|
| 189 |
scope : this, |
|
| 190 |
handler : function (b) {
|
|
| 191 |
this.showDetail(b.rec); |
|
| 192 |
} |
|
| 193 |
}); |
|
| 194 |
} |
|
| 195 |
}, this); |
|
| 196 |
|
|
| 197 |
if (menuItems.length > 0) {
|
|
| 198 |
menuItems.unshift({
|
|
| 199 |
xtype : 'label', |
|
| 200 |
text : i18n.get('label.forms'),
|
|
| 201 |
labelStyle : 'padding-top:10px;', |
|
| 202 |
cls : 'menu-forms-title' |
|
| 203 |
}, '-'); |
|
| 204 |
// menuItems.unshift('<span class="menu-forms-title" style="padding-top:10px;">' + i18n.get('label.forms') + '</span>', '-');
|
|
| 205 |
} |
|
| 206 |
this.addItem(menuItems); |
|
| 207 |
|
|
| 208 |
this.storeFormsMultiDs.load(); |
|
| 209 |
}, |
|
| 210 |
onLoadMultiDSForms : function () {
|
|
| 211 |
var menuItems = []; |
|
| 212 |
|
|
| 213 |
this.storeFormsMultiDs.each(function (rec) {
|
|
| 214 |
menuItems.push({
|
|
| 215 |
text : rec.get("name"),
|
|
| 216 |
rec : rec, |
|
| 217 |
scope : this, |
|
| 218 |
handler : function (b) {
|
|
| 219 |
this.showDetailMultiDs(b.rec); |
|
| 220 |
} |
|
| 221 |
}); |
|
| 222 |
}, this); |
|
| 223 |
|
|
| 224 |
if (menuItems.length > 0) {
|
|
| 225 |
menuItems.unshift('<span class="menu-forms-title">' + i18n.get('label.projectForm') + '</span>', '-');
|
|
| 226 |
} |
|
| 227 |
this.addItem(menuItems); |
|
| 228 |
this.formsLoaded = true; |
|
| 229 |
this.menuMultiDsFormLoaded = true; |
|
| 230 |
|
|
| 231 |
var loadingButton = this.items.get(0); |
|
| 232 |
this.remove(loadingButton); |
|
| 233 |
|
|
| 234 |
}, |
|
| 235 |
|
|
| 236 |
showDetail : function (rec) {
|
|
| 237 |
if (rec.data.authorized === "false") {
|
|
| 238 |
return; |
|
| 239 |
} |
|
| 240 |
Ext.Ajax.request({
|
|
| 241 |
url : rec.data.parentUrl, |
|
| 242 |
method : 'GET', |
|
| 243 |
success : function (response) {
|
|
| 244 |
try {
|
|
| 245 |
var json = Ext.decode(response.responseText); |
|
| 246 |
if (! json.success) {
|
|
| 247 |
Ext.Msg.alert(i18n.get('label.error'), json.message);
|
|
| 248 |
return; |
|
| 249 |
} |
|
| 250 |
|
|
| 251 |
var dataset = json.dataset; |
|
| 252 |
var jsObj = SitoolsDesk.navProfile.getFormOpenMode(); |
|
| 253 |
|
|
| 254 |
var componentCfg = {
|
|
| 255 |
dataUrl : dataset.sitoolsAttachementForUsers, |
|
| 256 |
dataset : dataset, |
|
| 257 |
formId : rec.data.id, |
|
| 258 |
formName : rec.data.name, |
|
| 259 |
formParameters : rec.data.parameters, |
|
| 260 |
formWidth : rec.data.width, |
|
| 261 |
formHeight : rec.data.height, |
|
| 262 |
formCss : rec.data.css, |
|
| 263 |
preferencesPath : "/" + dataset.name + "/forms", |
|
| 264 |
preferencesFileName : rec.data.name, |
|
| 265 |
formZones : rec.data.zones |
|
| 266 |
}; |
|
| 267 |
|
|
| 268 |
SitoolsDesk.navProfile.addSpecificFormParameters(componentCfg, dataset); |
|
| 269 |
|
|
| 270 |
var windowSettings = {
|
|
| 271 |
datasetName : dataset.name, |
|
| 272 |
type : "form", |
|
| 273 |
title : "Please query our database using the forms below.", //i18n.get('label.forms') + " : " + dataset.name + "." + rec.data.name,
|
|
| 274 |
id : "form" + dataset.id + rec.data.id, |
|
| 275 |
saveToolbar : true, |
|
| 276 |
iconCls : "form" |
|
| 277 |
}; |
|
| 278 |
|
|
| 279 |
SitoolsDesk.addDesktopWindow(windowSettings, componentCfg, jsObj); |
|
| 280 |
return; |
|
| 281 |
} |
|
| 282 |
catch (err) {
|
|
| 283 |
Ext.Msg.alert(i18n.get('label.error'), err);
|
|
| 284 |
return; |
|
| 285 |
} |
|
| 286 |
|
|
| 287 |
}, |
|
| 288 |
failure : function () {
|
|
| 289 |
Ext.Msg.alert(i18n.get('label.error'), i18n.get('label.noActiveDatasetFound'));
|
|
| 290 |
return; |
|
| 291 |
} |
|
| 292 |
}); |
|
| 293 |
}, |
|
| 294 |
showDetailMultiDs : function (rec) {
|
|
| 295 |
if (Ext.isEmpty(rec)) {
|
|
| 296 |
return; |
|
| 297 |
} |
|
| 298 |
var jsObj = sitools.user.component.forms.projectForm; |
|
| 299 |
var componentCfg = {
|
|
| 300 |
formId : rec.data.id, |
|
| 301 |
formName : rec.data.name, |
|
| 302 |
formParameters : rec.data.parameters, |
|
| 303 |
formWidth : rec.data.width, |
|
| 304 |
formHeight : rec.data.height, |
|
| 305 |
formCss : rec.data.css, |
|
| 306 |
properties : rec.data.properties, |
|
| 307 |
urlServicePropertiesSearch : rec.data.urlServicePropertiesSearch, |
|
| 308 |
urlServiceDatasetSearch : rec.data.urlServiceDatasetSearch, |
|
| 309 |
dictionaryName : rec.data.dictionary.name, |
|
| 310 |
nbDatasetsMax : rec.data.nbDatasetsMax, |
|
| 311 |
preferencesPath : "/formProjects", |
|
| 312 |
preferencesFileName : rec.data.name, |
|
| 313 |
formZones : rec.data.zones |
|
| 314 |
}; |
|
| 315 |
var windowSettings = {
|
|
| 316 |
type : "formProject", |
|
| 317 |
title : i18n.get('label.forms') + " : " + rec.data.name + ", Collection " + rec.data.collection.name,
|
|
| 318 |
id : "formProject" + rec.data.id, |
|
| 319 |
saveToolbar : true, |
|
| 320 |
datasetName : rec.data.name, |
|
| 321 |
winWidth : 600, |
|
| 322 |
winHeight : 600, |
|
| 323 |
iconCls : "form" |
|
| 324 |
}; |
|
| 325 |
|
|
| 326 |
SitoolsDesk.addDesktopWindow(windowSettings, componentCfg, jsObj); |
|
| 327 |
return; |
|
| 328 |
} |
|
| 329 |
}); |
|
| 330 |
|
|
| 331 |
Ext.reg('sitools.user.modules.formsAsMenu', sitools.user.modules.formsAsMenu);
|
|
| 332 |
|
|
| 333 |
|
|
| 334 |
sitools.user.modules.formsAsMenu.openModule = function (btn, event) {
|
|
| 335 |
if (Ext.isEmpty(event)) {
|
|
| 336 |
return; |
|
| 337 |
} |
|
| 338 |
var menu = Ext.getCmp("formAsMenu");
|
|
| 339 |
if (Ext.isEmpty(menu)) {
|
|
| 340 |
menu = new sitools.user.modules.formsAsMenu(); |
|
| 341 |
} |
|
| 342 |
if (btn.getPosition) {
|
|
| 343 |
menu.showAt([btn.getPosition()[0], SitoolsDesk.getEnteteEl().getHeight()]); |
|
| 344 |
} |
|
| 345 |
else |
|
| 346 |
{
|
|
| 347 |
menu.showAt([0, SitoolsDesk.getEnteteEl().getHeight()]); |
|
| 348 |
} |
|
| 349 |
}; |
|
| 350 |
|
|
| 351 |
sitools.user.modules.formsAsMenu.getStaticParameters = function () {
|
|
| 352 |
return {
|
|
| 353 |
showAsMenu : true |
|
| 354 |
}; |
|
| 355 |
}; |
|
Also available in: Unified diff
Updated code to hide the Dataset name from any panel/window header