I would like to share with the community the solution to a problem we had that could interest others users, and to have any comment/suggestion/improvement about it.
It would be great also if the maintainer integrate it in the main project.
kind regards ,
Alessandro
--------------------------------------------------------------
The problem :
Using the visual tool CreateReport in a workflow, the parameters are all shown in text boxes editable by the user, even those that have already assigned a value that should not be changed.
Let's think to a report containing the user profile data, where the parameter is the username. The workflow could set the parameter value to the current user Id but, since the text is editable by the user, he can easily change such value to obtain the data of some other user.
We would deny to the user the possibility to edit such parameter.
The Solution:
The solution we found imply a little coding and is transparent to the user that don't need such functionality, also is backward compatible to the XPDL/jrxml already existing : simply, when the parameter's name start by "h_" the text box will be hidden.
How to implement:
The file to edit to introduce such behavior depends by the cmdbuild version you are using :
CMDBuild 1.3 :[cmdbuild]/javascripts/cmdbuild/management/workflow/extendedattribute/CreateReport.js
CMDBuild 1.4 :[cmdbuild]/javascripts/cmdbuild/view/management/workflow/widget/CMCreateReport.js]
CMDBuild 1.5 :[cmdbuild]/javascripts/cmdbuild/view/management/common/widgets/CMOpenReport.js]
CMDBuild 2.04 :[cmdbuild]/javascripts/cmdbuild/view/management/common/widgets/CMOpenReport.js
In this file you have to search the following snippet of code, and add the lines surrounded by asterisks
//add the required attributes
configureForm: function() {
var conf = this.extAttrDef;
// add fields to form panel
for (var i=0; i<this.attributeList.length; i++) {
var attribute = this.attributeList[i];
var field = CMDBuild.Management.FieldManager.getFieldForAttr(attribute, false);
if (field) {
if(conf.parameters[attribute.name] && typeof (conf.parameters[attribute.name] != 'object')) {
field.setValue( conf.parameters[attribute.name] );
} else if(attribute.defaultvalue) {
field.setValue(attribute.defaultvalue);
}
this.formFields[i] = field;
//*********** hide parameters starting by "h_ "****************
if (field.name.length>2 && field.name.substring(0,2)=='h_') {
this.formFields[i].hide();
}
//****************************************************
this.formPanel.add(field);
}
}
this.formPanel.doLayout();
},