";
return html;
}
this.ShowComboFilter=function(id){
this.HideItem(this['filterType_'+id],true);
this.ShowItem(this['selectFilterType_'+id],null,true);
if (labelOperatorWidth && !this.isMobile){
if (this['label_'+id].IsHidden())
this['lbl_'+id].Ctrl.style.width=(labelOperatorWidth-this['selectFilterType_'+id].Ctrl.offsetWidth)+'px';
else
this['label_'+id].Ctrl.style.width=(labelOperatorWidth-this['selectFilterType_'+id].Ctrl.offsetWidth)+'px';
}
}
this.HideComboFilter=function(id){
this.ShowItem(this['filterType_'+id],null,true);
this.HideItem(this['selectFilterType_'+id],true);
if (labelOperatorWidth && !this.isMobile){
if (this['label_'+id].IsHidden())
this['lbl_'+id].Ctrl.style.width=(labelOperatorWidth-this['filterType_'+id].Ctrl.offsetWidth)+'px';
else this['label_'+id].Ctrl.style.width=(labelOperatorWidth-this['filterType_'+id].Ctrl.offsetWidth)+'px';
}
}
this.generateCodeTempFields=function(fld,id){
//campo
this['label_'+id]=new ZtVWeb.LabelCtrl(this,'label_'+id,this.formid+'_label_'+id,'',0,0,65,0,' ',' ',' ',' ',' ',' ',' ',' ',' ',false);
this.HideItem(this['label_'+id],true);
this['label_'+id].getRenderHeight=function(){return null};
if (!this.labelVzmFields && GetOpener().GetRepeatedFields)
this.SetConfigurationField(GetOpener().GetRepeatedFields());
var label=this.labelVzmFields;
var value=this.valueVzmFields;
var presetParams=this.presetParams.Value().split(',');
var sep=' ,';
if (this.vqrParameters && this.vqrParameters.length>0){
for (var i=0; i=,>,";
listOperator[1]+="<,<=,>=,>,";
}
listOperator[0]+="<>,";
listOperator[1]+="<>,";
}
if (type!='L'){
listOperator[0]+="empty,notempty,";
listOperator[1]+=ZtVWeb.Translate("MSG_EMPTY")+","+ZtVWeb.Translate("MSG_NOTEMPTY")+",";
}
if (type=='D' || type=='T'){
listOperator[0]+="currentmonth,currentyear,lastmonth,lastyear,last30days,last60days,last90days";
listOperator[1]+=ZtVWeb.Translate("MSG_CURRENTMONTH")+","+ZtVWeb.Translate("MSG_CURRENTYEAR")+","+
ZtVWeb.Translate("MSG_LASTMONTH")+","+ZtVWeb.Translate("MSG_LASTYEAR")+","+ZtVWeb.Translate("MSG_LAST30DAYS")+","+
ZtVWeb.Translate("MSG_LAST60DAYS")+","+ZtVWeb.Translate("MSG_LAST90DAYS");
}
else {
listOperator[0] = listOperator[0].substring(0,listOperator[0].length-1);
listOperator[1] = listOperator[1].substring(0,listOperator[1].length-1);
}
return listOperator;
}
this.drawTempFields=function(){
if (tempParameters_div.innerHTML!='')
return;
var html='', i, id;
var listMinLabelW=this.formObj.listMinLabelWidth||[this.formObj.minLabelWidth];
tempParameters_div.style.display='block';
if (tempParameters_lbl){
tempParameters_lbl.style.display='inline-block';
this.saveToolbar.Ctrl.style.top=(tempParameters_lbl.offsetTop-20)+'px';
this.saveToolbar.Show();
this.saveToolbar._refresh();
}
for (i=0; i"+this.generateHtmlTempFields(this.tempFields[i].realFieldName)+"";
}
tempParameters_div.innerHTML=html;
if (this.tempFields.length>0){
for (i=0; imaxWid[col].label && (fields[i].itemType!='label' || fields[i].labelAlign=='right'))
maxWid[col].label=wid.label;
if (wid.label>maxWid[col].allLabel)
maxWid[col].allLabel=wid.label;
}
wid.tot=Max(wid.field,wid.label);
for (var j=i+1; jmaxWid[col].field)
maxWid[col].field=wid.field;
if (wid.tot>maxWid[col].tot)
maxWid[col].tot=wid.tot;
count++;
}
fieldsDrawn=true;
}
}
if (maxWid[0].label==0)
maxWid[0].label=parms.minLabelWid+2||0
return maxWid;
}
function GetWid(el,mode,parms){
var wid={
label:0,
field:0
};
var id=Strtran(el.realFieldName,' ','');
if (Empty(id))
id=Strtran(el.fieldName,' ','');
var label=portletObj['lbl_'+id]?portletObj['lbl_'+id].Ctrl:null;
var field=portletObj['fld_'+id]?portletObj['fld_'+id].Ctrl:{};
if (label){
label.style.width='';
wid.label=label.scrollWidth+5;
if (el.labelWid>0)
wid.label=el.labelWid;
if (wid.label>parms.maxLabelWid && parms.maxLabelWid>0 && !el.keepOnPreviousRow)
wid.label=parms.maxLabelWid;
if ((portletObj.zoomMode.Value() || portletObj.detailFilterMode.Value()) && el.isFilter && !el.queryFilter)
wid.label+=filterTypeWid;
wid.field=(field.offsetWidth||0);
if (mode==1)
wid.field+=4;
}
var btn=getBtn(id)
if (btn)
wid.field+=2+(btn.offsetWidth)
return wid;
}
function adjustMode2(fields,parms){
var maxWid=GetMaxWid(fields,2,parms);
var label,col,field;
var count=0;
var fieldsDrawn=false;
var margin=4;
var marginLeft=portletObj.isMobile?2:18;
for (var i=0; i1)
label.parentNode.style.width=(maxWid[col].tot-marginLeft)+'px'
if (col!=0){
label.parentNode.style.marginLeft=marginLeft+'px';
}
else{
if (portletObj.editMode.Value()){
var check=portletObj['check_'+portletObj.currentCheck].Ctrl;
check.style.marginLeft='10px';
label.parentNode.style.marginLeft=margin+'px'
if (fields[i].hiddenGroup || fields[i].hiddenInVariant){
portletObj['check_'+portletObj.currentCheck].Value('../portalstudio/images/btn_check_hidden.png');
portletObj['check_'+portletObj.currentCheck+'_state']='hidden';
}
else if (fields[i].extMask){
portletObj['check_'+portletObj.currentCheck].Value('../portalstudio/images/btn_check_extended.png');
portletObj['check_'+portletObj.currentCheck+'_state']='extended';
}
portletObj.currentCheck++;
}
else label.parentNode.style.marginLeft=marginLeft+'px';
}
}
else if (fields[i].keepOnPreviousRow){
label.parentNode.style.marginLeft=margin+'px'
label.style.marginBottom=margin+'px'
}
}
var btn=getBtn(id);
if (btn!=null){
btn.style.position='relative';
if (fields[i].itemType=='button' && !fields[i].keepOnPreviousRow)
btn.style.marginLeft=marginLeft+'px';
else btn.style.marginLeft='2px';
}
fieldsDrawn=true;
}
}
}
function getBtn(id){
var btn=null;
if (portletObj['calendar_btn_'+id]){
btn=portletObj['calendar_btn_'+id].Ctrl;
}
else if (portletObj['zoom_btn_'+id]){
btn=portletObj['zoom_btn_'+id].Ctrl;
}
else if (portletObj['btn_'+id]){
btn=portletObj['btn_'+id].Ctrl;
}
return btn;
}
function setEmptyCss(fields){
var formId=portletObj.formid;
for (var i=0; i1)
// label.parentNode.style.width=(maxWid[col].label+maxWid[col].field+margin)+'px';
if (!isCheckbox && (fields[i].itemType!='label' || (fields[i].labelAlign=='right')))
label.style.width=maxWid[col].label+'px';
// else label.style.width=GetWid(fields[i],1,parms).label+'px';
if (portletObj.editMode.Value()){
var check=portletObj['check_'+portletObj.currentCheck].Ctrl;
check.style.marginLeft='10px';
if (fields[i].labelAlign=='left'){
label.style.marginLeft=(margin+maxWid[0].label)+'px';
}
else label.style.marginLeft=margin+'px'
if (fields[i].hiddenGroup || fields[i].hiddenInVariant){
portletObj['check_'+portletObj.currentCheck].Value('../portalstudio/images/btn_check_hidden.png');
portletObj['check_'+portletObj.currentCheck+'_state']='hidden';
}
else if (fields[i].extMask){
portletObj['check_'+portletObj.currentCheck].Value('../portalstudio/images/btn_check_extended.png');
portletObj['check_'+portletObj.currentCheck+'_state']='extended';
}
portletObj.currentCheck++
}
else if (isCheckbox){
if (existFilterType)
label.style.marginLeft=margin+'px';
else label.style.marginLeft=margin+'px';
}
else if (fields[i].labelAlign=='left'){
label.style.marginLeft=(marginLeft+margin+maxWid[0].label)+'px';
}
else{
label.style.marginLeft=marginLeft+'px'
}
if (!isCheckbox){
if ((portletObj.zoomMode.Value() || portletObj.detailFilterMode.Value()) && existFilterType){
var filterType=portletObj['selectFilterType_'+id];
if (filterType){
filterType=filterType.Ctrl;
filterType.style.position='relative';
filterType.style.marginLeft=margin+'px';
filterType=portletObj['filterType_'+id].Ctrl
filterType.style.marginLeft=margin+'px';
field.style.marginLeft=margin+'px';
label.style.width=(label.offsetWidth-filterType.offsetWidth-4)+'px'
}
else if (field){
field.style.marginLeft=margin+'px';
}
}
else if (field)
field.style.marginLeft=margin+'px';
}
else if (field){
field.style.marginLeft=(maxWid[col].label+22)+'px';
}
label.style.height='auto';
}
else { // keep on prev row
label.style.marginLeft=margin+'px';
if (!isCheckbox && (fields[i].itemType!='label' || (fields[i].labelAlign=='right')) && fields[i].labelWid>0)
label.style.width=fields[i].labelWid+'px';
// label.style.width=GetWid(fields[i],1,parms).label+'px'; //controllare altezza
if (!isCheckbox){
if (portletObj.zoomMode.Value() || portletObj.detailFilterMode.Value()){
filterType=portletObj['selectFilterType_'+id];
if (filterType){
filterType=filterType.Ctrl;
filterType.style.position='relative';
filterType.style.marginLeft=margin+'px';
filterType=portletObj['filterType_'+id].Ctrl;
filterType.style.marginLeft=margin+'px';
field.style.marginLeft=margin+'px';
}
else if (field)
field.style.marginLeft=margin+'px';
}
else if (field)
field.style.marginLeft=margin+'px'
}
else if (field)
field.style.marginLeft=margin+'px'
}
if ((portletObj.zoomMode.Value() || portletObj.detailFilterMode.Value()) && portletObj['label_'+id]){
var label2=portletObj['label_'+id].Ctrl;
label2.style.width=label.offsetWidth+'px';
label2.style.marginLeft=label.style.marginLeft;
label2.style.height='auto';
}
}
var btn=getBtn(id);
if (btn!=null){
if (fields[i].itemType=='button'){
if (!fields[i].keepOnPreviousRow)
btn.style.marginLeft='23px';
else if (portletObj.editMode.Value())
btn.style.marginLeft=margin+'px';
else btn.style.marginLeft='2px'
}
else btn.style.marginLeft='2px'
btn.style.position='relative';
btn.style.display='inline-block';
}
fieldsDrawn=true;
}
}
// }.bind(this),0)
}
this.setRequestParameters=function(objRequest){
objRequest=objRequest||this.objRequest;
for (var i=0; i-1){
var v=fileName.substring(idx);
if (!LibJavascript.String.EndsWith(v, '.'+this.Table.Value())){
fileName=fileName.substring(0,idx);
}
}
if (!Empty(versionName))
if(versionName!=this.selectVersionPortlet.getUserGroup())
fileName=fileName+'__'+versionName;
else fileName+=versionName;
this.formObj.originMask=this.formObj.configName;
this.currentname=fileName;
var obj=this.getObjConfigFromEditMode(true);
var refresh=false;
if (obj.configName==this.currentname)
refresh=true;
else obj.configName=this.currentname;
var custom=this.selectVersionPortlet.getCustom()||!this.isAdmin;
var url=new JSURL("../servlet/SPVDMProxy?m_cAction=save" +
"&m_cConfigName=" + this.currentname +
"&m_cWv=" + URLenc(JSON.stringify(obj)) +
"&forceSave=true" +
"&custom=" + custom +
"&m_cID=" + this.savinghashparameter
,true);
var output=url.Response();
if (output.indexOf('Saved')==-1){
alert(FormatMsg("MSG_ERROR_SAVING_CONFIG")+" "+output);
}
else {
if (GetOpener().refreshVdmVariant)
GetOpener().refreshVdmVariant(this.currentname,refresh)
WindowClose();
}
}
this.deleteVersion=function(){
var url=new JSURL("../servlet/SPVDMProxy?m_cAction=deleteVersion&m_cConfigName="+this.formObj.configName+"&custom="+this.custom.Value(),true);
var deleted=url.Response();
alert(deleted)
}
}
window.refreshVdmVariant=function(name,refresh){
if (refresh){
portletObj.ConfigObject.Value("");
portletObj.zoomConfigName.Value("");
portletObj.QueryName.Value("");
portletObj.ConfigName.Value(name);
portletObj.resetMask();
}
else
portletObj.addVersion(name);
}
this.getFilterValueAndOperator=function(){
var filters=[],obj,operator,value,id;
var operatorsWithoutValue = ["empty", "notempty", "currentyear", "lastyear", "currentmonth", "lastmonth", "last30days", "last60days", "last90days"];
for (var i=0; i -1){
obj={
name:this.allFields[i].fieldName,
operator:operator
}
if (this['fld_'+id].type=='D')
obj.value= FormatDate(value,'YYYY-MM-DD');
else if (this['fld_'+id].type=='T')
obj.value= FormatDateTime(value,'YYYY-MM-DD hh:mm:ss');
else
obj.value=value;
filters.push(obj);
}
}
}
return filters;
}
this.findDetail=function(next){
if (this.checkField()){
if (this.detailFilterMode.Value() && GetOpener().FindDetail){
GetOpener().FindDetail(this.getFilterValueAndOperator(),next);
}
}
}
this.applyFilter=function(blockClose){
if (this.checkField()){
this.$entity$_zoomSetFilter.Emit();
if (this.closeWhenApplyFilter.Value() && !blockClose)
WindowClose();
}
}
this.refreshZoom=function(){
this.resetAll=this.formObj.emptyAllParam;
this.resetMask();
this.resetAll=false;
this.applyFilter(true);
}
this.print=function(){
var height=600;
var width=800;
var left=(screen.width)?(screen.width-width)/2:100;
var top=(screen.height)?(screen.height-height-(height/4))/2:100;
window.open("../servlet/Report?ReportName="+this.ReportName.Value()+
(EmptyString(this.PrintFormat.Value())?"":"&outputFormat="+this.PrintFormat.Value())+
(EmptyString(this.PrintOrientation.Value())?"":"&rotation="+this.PrintOrientation.Value())+
"&m_cVZMParamBlock="+URLenc(this.GetParamBlock()),"print","height="+height+",width="+width+",left="+left+",top="+top+",resizable=yes,scrollbars=yes");
}
this.deleteGarbage=function(keepTempFields){ // hide dei gruppi
var id, i;
for (i=0; i0){
for (i=0; i0){
var presetParams=this.presetParams.Value().split(',');
for (i=0; i0){
var vzmFields=this.valueVzmFields.split(',');
var labelVzmFields=this.labelVzmFields.split(',');
for (i=0; i<_fields.length; i++){
var fieldName=this['lbl_'+_fields[i].fieldName].Value();
if (!Empty(fieldName)){
var idx=vzmFields.indexOf(fieldName);
if (idx==-1){ // parametro query
if (!vqrParameters[fieldName]){
vqrParameters[fieldName]=true;
_fields[i].fieldName=fieldName;
_fields[i].queryFilter=true;
_fields[i].initialValue=this['fld_'+_fields[i].realFieldName].Value();
_fields[i].realFieldName=fieldName;
var found=false;
for (var j=0; j