mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-02 08:09:19 +08:00
[Legacy] Fix user edit view advanced tab display
- remove duplicate fields - fix field row display - fix strange styling issue when there are validation errors -- update valid check_form to allow setting if should switch tabs -- do not switch tabs on users edit view
This commit is contained in:
parent
3f98bb853f
commit
77de553338
8 changed files with 163 additions and 186 deletions
|
@ -97,10 +97,10 @@ function toDecimal(original,precision){precision=(precision==null)?2:precision;n
|
|||
return temp+'.00';if((temp*10)%10==0)
|
||||
return temp+'0';return temp}
|
||||
function isInteger(s){if(typeof num_grp_sep!='undefined'&&typeof dec_sep!='undefined'){s=unformatNumberNoParse(s,num_grp_sep,dec_sep).toString();}
|
||||
return /^[+-]?[0-9]*$/.test(s);}
|
||||
return/^[+-]?[0-9]*$/.test(s);}
|
||||
function isDecimal(s){if(typeof s=="string"&&s=="")
|
||||
return true;if(typeof num_grp_sep!='undefined'&&typeof dec_sep!='undefined'){s=unformatNumberNoParse(s,num_grp_sep,dec_sep).toString();}
|
||||
return /^[+-]?[0-9]*\.?[0-9]*$/.test(s);}
|
||||
return/^[+-]?[0-9]*\.?[0-9]*$/.test(s);}
|
||||
function isNumeric(s){return isDecimal(s);}
|
||||
if(typeof date_reg_positions!="object")var date_reg_positions={'Y':1,'m':2,'d':3};if(typeof date_reg_format!="string")var date_reg_format='([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})';function isDate(dtStr){if(dtStr.length==0){return true;}
|
||||
myregexp=new RegExp(date_reg_format)
|
||||
|
@ -134,7 +134,7 @@ return false
|
|||
return true}
|
||||
function isFloat(floatStr){if(floatStr.length==0){return true;}
|
||||
if(!(typeof(num_grp_sep)=='undefined'||typeof(dec_sep)=='undefined')){floatStr=unformatNumberNoParse(floatStr,num_grp_sep,dec_sep).toString();}
|
||||
return /^(-)?[0-9\.]+$/.test(floatStr);}
|
||||
return/^(-)?[0-9\.]+$/.test(floatStr);}
|
||||
function isDBName(str){if(str.length==0){return true;}
|
||||
if(!/^[a-zA-Z][a-zA-Z\_0-9]*$/.test(str))
|
||||
return false
|
||||
|
@ -150,9 +150,10 @@ function bothExist(item1,item2){if(typeof item1=='undefined'){return false;}
|
|||
if(typeof item2=='undefined'){return false;}
|
||||
if((item1==''&&item2!='')||(item1!=''&&item2=='')){return false;}
|
||||
return true;}
|
||||
trim=YAHOO.lang.trim;function check_form(formname){if(typeof(siw)!='undefined'&&siw&&typeof(siw.selectingSomething)!='undefined'&&siw.selectingSomething)
|
||||
return false;return validate_form(formname,'');}
|
||||
function add_error_style(formname,input,txt,flash){var raiseFlag=false;if(typeof flash=="undefined")
|
||||
trim=YAHOO.lang.trim;function check_form(formname,switchTab=true){if(typeof(siw)!='undefined'&&siw&&typeof(siw.selectingSomething)!='undefined'&&siw.selectingSomething)
|
||||
return false;return validate_form(formname,'',switchTab);}
|
||||
function add_error_style(formname,input,txt,flash,switchTab){var raiseFlag=false;if(typeof flash=="undefined"||switchTab===null){switchTab=true;}
|
||||
if(typeof flash=="undefined")
|
||||
flash=true;try{inputHandle=typeof input=="object"?input:document.forms[formname][input];style=get_current_bgcolor(inputHandle);if(txt.substring(txt.length-1)==':')
|
||||
txt=txt.substring(0,txt.length-1)
|
||||
requiredTxt=SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS');invalidTxt=SUGAR.language.get('app_strings','ERR_INVALID_VALUE');nomatchTxt=SUGAR.language.get('app_strings','ERR_SQS_NO_MATCH_FIELD');matchTxt=txt.replace(requiredTxt,'').replace(invalidTxt,'').replace(nomatchTxt,'');$.each($(inputHandle).parent().children(),function(index,item){if($(item).hasClass('validation-message')&&$(item).text.indexOf(matchTxt)>=0){raiseFlag=true;}});if(!raiseFlag){errorTextNode=document.createElement('div');errorTextNode.className='required validation-message';errorTextNode.innerHTML=txt;if(inputHandle.parentNode.className.indexOf('x-form-field-wrap')!=-1){inputHandle.parentNode.parentNode.appendChild(errorTextNode);}
|
||||
|
@ -160,7 +161,7 @@ else{inputHandle.parentNode.appendChild(errorTextNode);}
|
|||
if(flash)
|
||||
inputHandle.style.backgroundColor="#FF0000";inputsWithErrors.push(inputHandle);}
|
||||
if(flash){if(inputsWithErrors.length==1){for(var wp=1;wp<=10;wp++){window.setTimeout('fade_error_style(style, '+wp*10+')',1000+(wp*50));}}
|
||||
if(typeof(window[formname+"_tabs"])!="undefined"){var tabView=window[formname+"_tabs"];var parentDiv=YAHOO.util.Dom.getAncestorByTagName(inputHandle,"div");if(tabView.get){var tabs=tabView.get("tabs");for(var i in tabs){if(tabs[i].get("contentEl")==parentDiv||YAHOO.util.Dom.isAncestor(tabs[i].get("contentEl"),inputHandle)){tabs[i].get("labelEl").style.color="red";if(inputsWithErrors.length==1)
|
||||
if(typeof(window[formname+"_tabs"])!="undefined"){var tabView=window[formname+"_tabs"];var parentDiv=YAHOO.util.Dom.getAncestorByTagName(inputHandle,"div");if(tabView.get){var tabs=tabView.get("tabs");for(var i in tabs){if(tabs[i].get("contentEl")==parentDiv||YAHOO.util.Dom.isAncestor(tabs[i].get("contentEl"),inputHandle)){tabs[i].get("labelEl").style.color="red";if(inputsWithErrors.length==1&&switchTab===true)
|
||||
tabView.selectTab(i);}}
|
||||
if(typeof selectTabOnErrorInputHandle=='function'){selectTabOnErrorInputHandle(inputHandle);}}}
|
||||
window.setTimeout("inputsWithErrors["+(inputsWithErrors.length-1)+"].style.backgroundColor = '';",2000);}}catch(e){}}
|
||||
|
@ -177,37 +178,37 @@ function fade_error_style(normalStyle,percent){errorStyle='c60c30';var r1=hex2de
|
|||
function isFieldTypeExceptFromEmptyCheck(fieldType){var results=false;var exemptList=['bool','file'];for(var i=0;i<exemptList.length;i++){if(fieldType==exemptList[i])
|
||||
return true;}
|
||||
return results;}
|
||||
function validate_form(formname,startsWith){requiredTxt=SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS');invalidTxt=SUGAR.language.get('app_strings','ERR_INVALID_VALUE');if(typeof(formname)=='undefined'){return false;}
|
||||
function validate_form(formname,startsWith,switchTab=true){requiredTxt=SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS');invalidTxt=SUGAR.language.get('app_strings','ERR_INVALID_VALUE');if(typeof(formname)=='undefined'){return false;}
|
||||
if(typeof(validate[formname])=='undefined'){disableOnUnloadEditView(document.forms[formname]);return true;}
|
||||
var form=document.forms[formname];var isError=false;var errorMsg="";var _date=new Date();if(_date.getTime()<(lastSubmitTime+2000)&&startsWith==oldStartsWith){return false;}
|
||||
lastSubmitTime=_date.getTime();oldStartsWith=startsWith;clear_all_errors();inputsWithErrors=new Array();for(var i=0;i<validate[formname].length;i++){if(validate[formname][i][nameIndex].indexOf(startsWith)==0){if(typeof form[validate[formname][i][nameIndex]]!='undefined'&&typeof form[validate[formname][i][nameIndex]].value!='undefined'){var bail=false;if(!validate[formname][i][requiredIndex]&&trim(form[validate[formname][i][nameIndex]].value)==''&&(typeof(validate[formname][i][jstypeIndex])!='undefined'&&validate[formname][i][jstypeIndex]!='binarydep'&&validate[formname][i][jstypeIndex]!='callback')){continue;}
|
||||
if(validate[formname][i][requiredIndex]&&!isFieldTypeExceptFromEmptyCheck(validate[formname][i][typeIndex])){if(typeof form[validate[formname][i][nameIndex]]=='undefined'||trim(form[validate[formname][i][nameIndex]].value)==""){add_error_style(formname,validate[formname][i][nameIndex],requiredTxt+' '+validate[formname][i][msgIndex]);isError=true;}}
|
||||
if(!bail){switch(validate[formname][i][typeIndex]){case'email':if(!isValidEmail(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'time':if(!isTime(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'date':if(!isDate(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'alpha':break;case'DBName':if(!isDBName(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'DBNameRaw':if(!isDBName(form[validate[formname][i][nameIndex]].value)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'alphanumeric':break;case'file':var file_input=form[validate[formname][i][nameIndex]+'_file'];if(file_input&&validate[formname][i][requiredIndex]&&trim(file_input.value)==""&&!file_input.disabled){isError=true;add_error_style(formname,validate[formname][i][nameIndex],requiredTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'int':if(!isInteger(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'decimal':if(!isDecimal(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
break;case'currency':case'float':if(!isFloat(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}
|
||||
if(validate[formname][i][requiredIndex]&&!isFieldTypeExceptFromEmptyCheck(validate[formname][i][typeIndex])){if(typeof form[validate[formname][i][nameIndex]]=='undefined'||trim(form[validate[formname][i][nameIndex]].value)==""){add_error_style(formname,validate[formname][i][nameIndex],requiredTxt+' '+validate[formname][i][msgIndex],true,switchTab);isError=true;}}
|
||||
if(!bail){switch(validate[formname][i][typeIndex]){case'email':if(!isValidEmail(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'time':if(!isTime(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'date':if(!isDate(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'alpha':break;case'DBName':if(!isDBName(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'DBNameRaw':if(!isDBName(form[validate[formname][i][nameIndex]].value)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'alphanumeric':break;case'file':var file_input=form[validate[formname][i][nameIndex]+'_file'];if(file_input&&validate[formname][i][requiredIndex]&&trim(file_input.value)==""&&!file_input.disabled){isError=true;add_error_style(formname,validate[formname][i][nameIndex],requiredTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'int':if(!isInteger(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'decimal':if(!isDecimal(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'currency':case'float':if(!isFloat(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}
|
||||
break;case'teamset_mass':var div_element_id=formname+'_'+form[validate[formname][i][nameIndex]].name+'_operation_div';var input_elements=YAHOO.util.Selector.query('input',document.getElementById(div_element_id));var primary_field_id='';var validation_passed=false;var replace_selected=false;for(t in input_elements){if(input_elements[t].type&&input_elements[t].type=='radio'&&input_elements[t].checked==true&&input_elements[t].value=='replace'){var radio_elements=YAHOO.util.Selector.query('input[type=radio]',document.getElementById(formname+'_team_name_table'));for(var x=0;x<radio_elements.length;x++){if(radio_elements[x].name!='team_name_type'){primary_field_id='team_name_collection_'+radio_elements[x].value;if(radio_elements[x].checked){replace_selected=true;if(trim(document.forms[formname].elements[primary_field_id].value)!=''){validation_passed=true;break;}}else if(trim(document.forms[formname].elements[primary_field_id].value)!=''){replace_selected=true;}}}}}
|
||||
if(replace_selected&&!validation_passed){add_error_style(formname,primary_field_id,SUGAR.language.get('app_strings','ERR_NO_PRIMARY_TEAM_SPECIFIED'));isError=true;}
|
||||
if(replace_selected&&!validation_passed){add_error_style(formname,primary_field_id,SUGAR.language.get('app_strings','ERR_NO_PRIMARY_TEAM_SPECIFIED'),true,switchTab);isError=true;}
|
||||
break;case'teamset':var table_element_id=formname+'_'+form[validate[formname][i][nameIndex]].name+'_table';if(document.getElementById(table_element_id)){var input_elements=YAHOO.util.Selector.query('input[type=radio]',document.getElementById(table_element_id));var has_primary=false;var primary_field_id=form[validate[formname][i][nameIndex]].name+'_collection_0';for(t in input_elements){primary_field_id=form[validate[formname][i][nameIndex]].name+'_collection_'+input_elements[t].value;if(input_elements[t].type&&input_elements[t].type=='radio'&&input_elements[t].checked==true){if(document.forms[formname].elements[primary_field_id].value!=''){has_primary=true;}
|
||||
break;}}
|
||||
if(!has_primary){isError=true;var field_id=form[validate[formname][i][nameIndex]].name+'_collection_'+input_elements[0].value;add_error_style(formname,field_id,SUGAR.language.get('app_strings','ERR_NO_PRIMARY_TEAM_SPECIFIED'));}}
|
||||
break;case'error':isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]);break;}
|
||||
if(typeof validate[formname][i][jstypeIndex]!='undefined'){switch(validate[formname][i][jstypeIndex]){case'callback':if(typeof validate[formname][i][callbackIndex]=='function'){var result=validate[formname][i][callbackIndex](formname,validate[formname][i][nameIndex]);if(result==false){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}}
|
||||
break;case'range':if(!inRange(trim(form[validate[formname][i][nameIndex]].value),validate[formname][i][minIndex],validate[formname][i][maxIndex])){isError=true;var lbl_validate_range=SUGAR.language.get('app_strings','LBL_VALIDATE_RANGE');if(typeof validate[formname][i][minIndex]=='number'&&typeof validate[formname][i][maxIndex]=='number'){add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" value "+form[validate[formname][i][nameIndex]].value+" "+lbl_validate_range+" ("+validate[formname][i][minIndex]+" - "+validate[formname][i][maxIndex]+")");}
|
||||
else if(typeof validate[formname][i][minIndex]=='number'){add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_SHOULD_BE')+' '+validate[formname][i][minIndex]+' '+SUGAR.language.get('app_strings','MSG_OR_GREATER'));}
|
||||
else if(typeof validate[formname][i][maxIndex]=='number'){add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_IS_MORE_THAN')+' '+validate[formname][i][maxIndex]);}}
|
||||
break;case'isbefore':compareTo=form[validate[formname][i][compareToIndex]];if(typeof compareTo!='undefined'){if(trim(compareTo.value)!=''||(validate[formname][i][allowblank]!='true')){date2=trim(compareTo.value);date1=trim(form[validate[formname][i][nameIndex]].value);if(trim(date1).length!=0&&!isBefore(date1,date2)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+"("+date1+") "+SUGAR.language.get('app_strings','MSG_IS_NOT_BEFORE')+' '+date2);}}}
|
||||
break;case'less':value=unformatNumber(trim(form[validate[formname][i][nameIndex]].value),num_grp_sep,dec_sep);maximum=parseFloat(validate[formname][i][maxIndex]);if(typeof maximum!='undefined'){if(value>maximum){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_IS_MORE_THAN')+' '+validate[formname][i][altMsgIndex]);}}
|
||||
break;case'more':value=unformatNumber(trim(form[validate[formname][i][nameIndex]].value),num_grp_sep,dec_sep);minimum=parseFloat(validate[formname][i][minIndex]);if(typeof minimum!='undefined'){if(value<minimum){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_SHOULD_BE')+' '+minimum+' '+SUGAR.language.get('app_strings','MSG_OR_GREATER'));}}
|
||||
break;case'binarydep':compareTo=form[validate[formname][i][compareToIndex]];if(typeof compareTo!='undefined'){item1=trim(form[validate[formname][i][nameIndex]].value);item2=trim(compareTo.value);if(!bothExist(item1,item2)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]);}}
|
||||
break;case'comparison':compareTo=form[validate[formname][i][compareToIndex]];if(typeof compareTo!='undefined'){item1=trim(form[validate[formname][i][nameIndex]].value);item2=trim(compareTo.value);if(!bothExist(item1,item2)||item1!=item2){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]);}}
|
||||
if(!has_primary){isError=true;var field_id=form[validate[formname][i][nameIndex]].name+'_collection_'+input_elements[0].value;add_error_style(formname,field_id,SUGAR.language.get('app_strings','ERR_NO_PRIMARY_TEAM_SPECIFIED'),true,switchTab);}}
|
||||
break;case'error':isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex],true,switchTab);break;}
|
||||
if(typeof validate[formname][i][jstypeIndex]!='undefined'){switch(validate[formname][i][jstypeIndex]){case'callback':if(typeof validate[formname][i][callbackIndex]=='function'){var result=validate[formname][i][callbackIndex](formname,validate[formname][i][nameIndex]);if(result==false){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}}
|
||||
break;case'range':if(!inRange(trim(form[validate[formname][i][nameIndex]].value),validate[formname][i][minIndex],validate[formname][i][maxIndex])){isError=true;var lbl_validate_range=SUGAR.language.get('app_strings','LBL_VALIDATE_RANGE');if(typeof validate[formname][i][minIndex]=='number'&&typeof validate[formname][i][maxIndex]=='number'){add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" value "+form[validate[formname][i][nameIndex]].value+" "+lbl_validate_range+" ("+validate[formname][i][minIndex]+" - "+validate[formname][i][maxIndex]+")",true,switchTab);}
|
||||
else if(typeof validate[formname][i][minIndex]=='number'){add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_SHOULD_BE')+' '+validate[formname][i][minIndex]+' '+SUGAR.language.get('app_strings','MSG_OR_GREATER'),true,switchTab);}
|
||||
else if(typeof validate[formname][i][maxIndex]=='number'){add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_IS_MORE_THAN')+' '+validate[formname][i][maxIndex],true,switchTab);}}
|
||||
break;case'isbefore':compareTo=form[validate[formname][i][compareToIndex]];if(typeof compareTo!='undefined'){if(trim(compareTo.value)!=''||(validate[formname][i][allowblank]!='true')){date2=trim(compareTo.value);date1=trim(form[validate[formname][i][nameIndex]].value);if(trim(date1).length!=0&&!isBefore(date1,date2)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+"("+date1+") "+SUGAR.language.get('app_strings','MSG_IS_NOT_BEFORE')+' '+date2,true,switchTab);}}}
|
||||
break;case'less':value=unformatNumber(trim(form[validate[formname][i][nameIndex]].value),num_grp_sep,dec_sep);maximum=parseFloat(validate[formname][i][maxIndex]);if(typeof maximum!='undefined'){if(value>maximum){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_IS_MORE_THAN')+' '+validate[formname][i][altMsgIndex],true,switchTab);}}
|
||||
break;case'more':value=unformatNumber(trim(form[validate[formname][i][nameIndex]].value),num_grp_sep,dec_sep);minimum=parseFloat(validate[formname][i][minIndex]);if(typeof minimum!='undefined'){if(value<minimum){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex]+" "+SUGAR.language.get('app_strings','MSG_SHOULD_BE')+' '+minimum+' '+SUGAR.language.get('app_strings','MSG_OR_GREATER'),true,switchTab);}}
|
||||
break;case'binarydep':compareTo=form[validate[formname][i][compareToIndex]];if(typeof compareTo!='undefined'){item1=trim(form[validate[formname][i][nameIndex]].value);item2=trim(compareTo.value);if(!bothExist(item1,item2)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex],true,switchTab);}}
|
||||
break;case'comparison':compareTo=form[validate[formname][i][compareToIndex]];if(typeof compareTo!='undefined'){item1=trim(form[validate[formname][i][nameIndex]].value);item2=trim(compareTo.value);if(!bothExist(item1,item2)||item1!=item2){isError=true;add_error_style(formname,validate[formname][i][nameIndex],validate[formname][i][msgIndex],true,switchTab);}}
|
||||
break;case'in_array':SUGAR.util.globalEval("retValue = "+validate[formname][i][arrIndex]);arr=retValue;operator=validate[formname][i][operatorIndex];item1=trim(form[validate[formname][i][nameIndex]].value);if(operator.charAt(0)=='u'){item1=item1.toUpperCase();operator=operator.substring(1);}else if(operator.charAt(0)=='l'){item1=item1.toLowerCase();operator=operator.substring(1);}
|
||||
for(j=0;j<arr.length;j++){val=arr[j];if((operator=="=="&&val==item1)||(operator=="!="&&val!=item1)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}}
|
||||
for(j=0;j<arr.length;j++){val=arr[j];if((operator=="=="&&val==item1)||(operator=="!="&&val!=item1)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex],true,switchTab);}}
|
||||
break;case'verified':if(trim(form[validate[formname][i][nameIndex]].value)=='false'){isError=true;}
|
||||
break;}}}}}}
|
||||
if(formsWithFieldLogic){var invalidLogic=false;if(formsWithFieldLogic.min&&formsWithFieldLogic.max&&formsWithFieldLogic._default){var showErrorsOn={min:{value:'min',show:false,obj:formsWithFieldLogic.min.value},max:{value:'max',show:false,obj:formsWithFieldLogic.max.value},_default:{value:'default',show:false,obj:formsWithFieldLogic._default.value},len:{value:'len',show:false,obj:parseInt(formsWithFieldLogic.len.value,10)}};var min=(formsWithFieldLogic.min.value!='')?parseFloat(formsWithFieldLogic.min.value):'undef';var max=(formsWithFieldLogic.max.value!='')?parseFloat(formsWithFieldLogic.max.value):'undef';var _default=(formsWithFieldLogic._default.value!='')?parseFloat(formsWithFieldLogic._default.value):'undef';for(var i in showErrorsOn){if(showErrorsOn[i].value!='len'&&showErrorsOn[i].obj.length>showErrorsOn.len.obj){invalidLogic=true;showErrorsOn[i].show=true;showErrorsOn.len.show=true;}}
|
||||
|
@ -573,9 +574,8 @@ URL+='&create='+create;if(metadata!=''&&metadata!=undefined){URL+='&metadata='+m
|
|||
if(popup_request_data.jsonObject){var request_data=popup_request_data.jsonObject;}else{var request_data=popup_request_data;}
|
||||
var field_to_name_array_url='';if(request_data&&request_data.field_to_name_array!=undefined){for(var key in request_data.field_to_name_array){if(key.toLowerCase()!='id'){field_to_name_array_url+='&field_to_name[]='+encodeURIComponent(key.toLowerCase());}}}
|
||||
if(field_to_name_array_url){URL+=field_to_name_array_url;}
|
||||
win=SUGAR.util.openWindow(URL,windowName,windowFeatures);if(win){if(win.focus){win.focus();}
|
||||
win.popupCount=popupCount;return win;}
|
||||
return;}
|
||||
win=SUGAR.util.openWindow(URL,windowName,windowFeatures);if(win){$(win).focus(function(){win.focus();});win.popupCount=popupCount;return win;}
|
||||
return'';}
|
||||
var from_popup_return=false;function replaceHTMLChars(value){return value.replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');}
|
||||
function set_return_basic(popup_reply_data,filter){var form_name=popup_reply_data.form_name;var name_to_value_array=popup_reply_data.name_to_value_array;for(var the_key in name_to_value_array){if(the_key=='toJSON'){}
|
||||
else if(the_key.match(filter)){var displayValue=replaceHTMLChars(name_to_value_array[the_key]);if(window.document.forms[form_name]&&window.document.forms[form_name].elements[the_key]){if(window.document.forms[form_name].elements[the_key].tagName=='SELECT'){var selectField=window.document.forms[form_name].elements[the_key];for(var i=0;i<selectField.options.length;i++){if(selectField.options[i].text==displayValue){selectField.options[i].selected=true;SUGAR.util.callOnChangeListers(selectField);break;}}}else{window.document.forms[form_name].elements[the_key].value=displayValue;SUGAR.util.callOnChangeListers(window.document.forms[form_name].elements[the_key]);}}}}}
|
||||
|
|
|
@ -746,15 +746,18 @@ function bothExist(item1, item2) {
|
|||
trim = YAHOO.lang.trim;
|
||||
|
||||
|
||||
function check_form(formname) {
|
||||
function check_form(formname, switchTab = true) {
|
||||
if (typeof(siw) != 'undefined' && siw
|
||||
&& typeof(siw.selectingSomething) != 'undefined' && siw.selectingSomething)
|
||||
return false;
|
||||
return validate_form(formname, '');
|
||||
return validate_form(formname, '', switchTab);
|
||||
}
|
||||
|
||||
function add_error_style(formname, input, txt, flash) {
|
||||
function add_error_style(formname, input, txt, flash, switchTab) {
|
||||
var raiseFlag = false;
|
||||
if (typeof flash == "undefined" || switchTab === null) {
|
||||
switchTab = true;
|
||||
}
|
||||
if (typeof flash == "undefined")
|
||||
flash = true;
|
||||
try {
|
||||
|
@ -808,7 +811,7 @@ function add_error_style(formname, input, txt, flash) {
|
|||
if (tabs[i].get("contentEl") == parentDiv
|
||||
|| YAHOO.util.Dom.isAncestor(tabs[i].get("contentEl"), inputHandle)) {
|
||||
tabs[i].get("labelEl").style.color = "red";
|
||||
if (inputsWithErrors.length == 1)
|
||||
if (inputsWithErrors.length == 1 && switchTab === true)
|
||||
tabView.selectTab(i);
|
||||
}
|
||||
}
|
||||
|
@ -915,7 +918,7 @@ function isFieldTypeExceptFromEmptyCheck(fieldType) {
|
|||
}
|
||||
return results;
|
||||
}
|
||||
function validate_form(formname, startsWith) {
|
||||
function validate_form(formname, startsWith, switchTab = true) {
|
||||
requiredTxt = SUGAR.language.get('app_strings', 'ERR_MISSING_REQUIRED_FIELDS');
|
||||
invalidTxt = SUGAR.language.get('app_strings', 'ERR_INVALID_VALUE');
|
||||
|
||||
|
@ -956,7 +959,7 @@ function validate_form(formname, startsWith) {
|
|||
&& !isFieldTypeExceptFromEmptyCheck(validate[formname][i][typeIndex])
|
||||
) {
|
||||
if (typeof form[validate[formname][i][nameIndex]] == 'undefined' || trim(form[validate[formname][i][nameIndex]].value) == "") {
|
||||
add_error_style(formname, validate[formname][i][nameIndex], requiredTxt + ' ' + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], requiredTxt + ' ' + validate[formname][i][msgIndex], true, switchTab);
|
||||
isError = true;
|
||||
}
|
||||
}
|
||||
|
@ -965,19 +968,19 @@ function validate_form(formname, startsWith) {
|
|||
case 'email':
|
||||
if (!isValidEmail(trim(form[validate[formname][i][nameIndex]].value))) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'time':
|
||||
if (!isTime(trim(form[validate[formname][i][nameIndex]].value))) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
if (!isDate(trim(form[validate[formname][i][nameIndex]].value))) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'alpha':
|
||||
|
@ -985,14 +988,14 @@ function validate_form(formname, startsWith) {
|
|||
case 'DBName':
|
||||
if (!isDBName(trim(form[validate[formname][i][nameIndex]].value))) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
// Bug #49614 : Check value without trimming before
|
||||
case 'DBNameRaw':
|
||||
if (!isDBName(form[validate[formname][i][nameIndex]].value)) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'alphanumeric':
|
||||
|
@ -1001,26 +1004,26 @@ function validate_form(formname, startsWith) {
|
|||
var file_input = form[validate[formname][i][nameIndex] + '_file'];
|
||||
if (file_input && validate[formname][i][requiredIndex] && trim(file_input.value) == "" && !file_input.disabled) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], requiredTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], requiredTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'int':
|
||||
if (!isInteger(trim(form[validate[formname][i][nameIndex]].value))) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'decimal':
|
||||
if (!isDecimal(trim(form[validate[formname][i][nameIndex]].value))) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'currency':
|
||||
case 'float':
|
||||
if (!isFloat(trim(form[validate[formname][i][nameIndex]].value))) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
break;
|
||||
case 'teamset_mass':
|
||||
|
@ -1055,7 +1058,7 @@ function validate_form(formname, startsWith) {
|
|||
}
|
||||
|
||||
if (replace_selected && !validation_passed) {
|
||||
add_error_style(formname, primary_field_id, SUGAR.language.get('app_strings', 'ERR_NO_PRIMARY_TEAM_SPECIFIED'));
|
||||
add_error_style(formname, primary_field_id, SUGAR.language.get('app_strings', 'ERR_NO_PRIMARY_TEAM_SPECIFIED'), true, switchTab);
|
||||
isError = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1079,13 +1082,13 @@ function validate_form(formname, startsWith) {
|
|||
if (!has_primary) {
|
||||
isError = true;
|
||||
var field_id = form[validate[formname][i][nameIndex]].name + '_collection_' + input_elements[0].value;
|
||||
add_error_style(formname, field_id, SUGAR.language.get('app_strings', 'ERR_NO_PRIMARY_TEAM_SPECIFIED'));
|
||||
add_error_style(formname, field_id, SUGAR.language.get('app_strings', 'ERR_NO_PRIMARY_TEAM_SPECIFIED'), true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'error':
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex], true, switchTab);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1101,7 @@ function validate_form(formname, startsWith) {
|
|||
var result = validate[formname][i][callbackIndex](formname, validate[formname][i][nameIndex]);
|
||||
if (result == false) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1107,13 +1110,13 @@ function validate_form(formname, startsWith) {
|
|||
isError = true;
|
||||
var lbl_validate_range = SUGAR.language.get('app_strings', 'LBL_VALIDATE_RANGE');
|
||||
if (typeof validate[formname][i][minIndex] == 'number' && typeof validate[formname][i][maxIndex] == 'number') {
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " value " + form[validate[formname][i][nameIndex]].value + " " + lbl_validate_range + " (" + validate[formname][i][minIndex] + " - " + validate[formname][i][maxIndex] + ")");
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " value " + form[validate[formname][i][nameIndex]].value + " " + lbl_validate_range + " (" + validate[formname][i][minIndex] + " - " + validate[formname][i][maxIndex] + ")", true, switchTab);
|
||||
}
|
||||
else if (typeof validate[formname][i][minIndex] == 'number') {
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_SHOULD_BE') + ' ' + validate[formname][i][minIndex] + ' ' + SUGAR.language.get('app_strings', 'MSG_OR_GREATER'));
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_SHOULD_BE') + ' ' + validate[formname][i][minIndex] + ' ' + SUGAR.language.get('app_strings', 'MSG_OR_GREATER'), true, switchTab);
|
||||
}
|
||||
else if (typeof validate[formname][i][maxIndex] == 'number') {
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_IS_MORE_THAN') + ' ' + validate[formname][i][maxIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_IS_MORE_THAN') + ' ' + validate[formname][i][maxIndex], true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1128,7 +1131,7 @@ function validate_form(formname, startsWith) {
|
|||
|
||||
isError = true;
|
||||
//jc:#12287 - adding translation for the is not before message
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + "(" + date1 + ") " + SUGAR.language.get('app_strings', 'MSG_IS_NOT_BEFORE') + ' ' + date2);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + "(" + date1 + ") " + SUGAR.language.get('app_strings', 'MSG_IS_NOT_BEFORE') + ' ' + date2, true, switchTab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1139,7 +1142,7 @@ function validate_form(formname, startsWith) {
|
|||
if (typeof maximum != 'undefined') {
|
||||
if (value > maximum) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_IS_MORE_THAN') + ' ' + validate[formname][i][altMsgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_IS_MORE_THAN') + ' ' + validate[formname][i][altMsgIndex], true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1149,7 +1152,7 @@ function validate_form(formname, startsWith) {
|
|||
if (typeof minimum != 'undefined') {
|
||||
if (value < minimum) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_SHOULD_BE') + ' ' + minimum + ' ' + SUGAR.language.get('app_strings', 'MSG_OR_GREATER'));
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex] + " " + SUGAR.language.get('app_strings', 'MSG_SHOULD_BE') + ' ' + minimum + ' ' + SUGAR.language.get('app_strings', 'MSG_OR_GREATER'), true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1160,7 +1163,7 @@ function validate_form(formname, startsWith) {
|
|||
item2 = trim(compareTo.value);
|
||||
if (!bothExist(item1, item2)) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1171,7 +1174,7 @@ function validate_form(formname, startsWith) {
|
|||
item2 = trim(compareTo.value);
|
||||
if (!bothExist(item1, item2) || item1 != item2) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1191,7 +1194,7 @@ function validate_form(formname, startsWith) {
|
|||
val = arr[j];
|
||||
if ((operator == "==" && val == item1) || (operator == "!=" && val != item1)) {
|
||||
isError = true;
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex]);
|
||||
add_error_style(formname, validate[formname][i][nameIndex], invalidTxt + " " + validate[formname][i][msgIndex], true, switchTab);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -246,14 +246,10 @@ var restoreTabsState = function(tabsState) {
|
|||
|
||||
$.each(tabsState, function(i,e) {
|
||||
var tabElem = $('#EditView_tabs li:eq(' + i + ')');
|
||||
if(e.selected && invalidTabs.length == 0) {
|
||||
tabElem.click();
|
||||
}
|
||||
tabElem.find('a em').css('color', '');
|
||||
});
|
||||
|
||||
if(invalidTabs.length > 0) {
|
||||
$('#tab' + invalidTabs[0]).parent().click();
|
||||
$('#tab' + invalidTabs[0] + ' em').css('color', 'red');
|
||||
}
|
||||
|
||||
|
@ -266,9 +262,9 @@ function verify_data(form)
|
|||
var tabsState = saveTabsState();
|
||||
|
||||
// handles any errors in the email widget
|
||||
var isError = !check_form("EditView");
|
||||
var isError = !check_form("EditView", false);
|
||||
|
||||
|
||||
|
||||
if (trim(form.last_name.value) == "") {
|
||||
add_error_style('EditView',form.last_name.name,
|
||||
SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS') + SUGAR.language.get('Users','LBL_LIST_NAME') );
|
||||
|
@ -279,37 +275,37 @@ function verify_data(form)
|
|||
SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS') + SUGAR.language.get('Users','LBL_USER_NAME') );
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (document.getElementById("required_password").value=='1'
|
||||
|
||||
if (document.getElementById("required_password").value=='1'
|
||||
&& document.getElementById("new_password").value == "") {
|
||||
add_error_style('EditView',form.new_password.name,
|
||||
SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS') + SUGAR.language.get('Users','LBL_NEW_PASSWORD') );
|
||||
isError = true;
|
||||
}
|
||||
|
||||
|
||||
if (isError == true) {
|
||||
restoreTabsState(tabsState);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (document.EditView.return_id.value != '' && (typeof(form.reports_to_id)!="undefined") && (document.EditView.return_id.value == form.reports_to_id.value)) {
|
||||
alert(SUGAR.language.get('app_strings','ERR_SELF_REPORTING'));
|
||||
restoreTabsState(tabsState);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (document.EditView.dec_sep.value != '' && (document.EditView.dec_sep.value == "'")) {
|
||||
alert(SUGAR.language.get('app_strings','ERR_NO_SINGLE_QUOTE') + SUGAR.language.get('Users','LBL_DECIMAL_SEP'));
|
||||
restoreTabsState(tabsState);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (document.EditView.num_grp_sep.value != '' && (document.EditView.num_grp_sep.value == "'")) {
|
||||
alert(SUGAR.language.get('app_strings','ERR_NO_SINGLE_QUOTE') + SUGAR.language.get('Users','LBL_NUMBER_GROUPING_SEP'));
|
||||
restoreTabsState(tabsState);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (document.EditView.num_grp_sep.value == document.EditView.dec_sep.value) {
|
||||
alert(SUGAR.language.get('app_strings','ERR_DECIMAL_SEP_EQ_THOUSANDS_SEP'));
|
||||
restoreTabsState(tabsState);
|
||||
|
@ -329,46 +325,46 @@ function verify_data(form)
|
|||
restoreTabsState(tabsState);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function set_chooser()
|
||||
{
|
||||
var display_tabs_def = '';
|
||||
var hide_tabs_def = '';
|
||||
var remove_tabs_def = '';
|
||||
|
||||
|
||||
var display_td = document.getElementById('display_tabs_td');
|
||||
var hide_td = document.getElementById('hide_tabs_td');
|
||||
var remove_td = document.getElementById('remove_tabs_td');
|
||||
|
||||
|
||||
var display_ref = display_td.getElementsByTagName('select')[0];
|
||||
|
||||
|
||||
for(i=0; i < display_ref.options.length ;i++)
|
||||
{
|
||||
display_tabs_def += "display_tabs[]="+display_ref.options[i].value+"&";
|
||||
}
|
||||
|
||||
|
||||
if(hide_td != null)
|
||||
{
|
||||
var hide_ref = hide_td.getElementsByTagName('select')[0];
|
||||
|
||||
|
||||
for(i=0; i < hide_ref.options.length ;i++)
|
||||
{
|
||||
hide_tabs_def += "hide_tabs[]="+hide_ref.options[i].value+"&";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(remove_td != null)
|
||||
{
|
||||
var remove_ref = remove_td.getElementsByTagName('select')[0];
|
||||
|
||||
|
||||
for(i=0; i < remove_ref.options.length ;i++)
|
||||
{
|
||||
remove_tabs_def += "remove_tabs[]="+remove_ref.options[i].value+"&";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
document.EditView.display_tabs_def.value = display_tabs_def;
|
||||
document.EditView.hide_tabs_def.value = hide_tabs_def;
|
||||
document.EditView.remove_tabs_def.value = remove_tabs_def;
|
||||
|
|
|
@ -54,8 +54,7 @@ function testOutboundSettingsDialog(){if(!EmailMan.testOutboundDialog){EmailMan.
|
|||
EmailMan.testOutboundDialog.render();EmailMan.testOutboundDialog.show();}
|
||||
function overlay(reqtitle,body,type){var config={};config.type=type;config.title=reqtitle;config.msg=body;YAHOO.SUGAR.MessageBox.show(config);}
|
||||
function hideOverlay(){YAHOO.SUGAR.MessageBox.hide();}
|
||||
var saveTabsState=function(){var tabsState=[];$('#EditView_tabs li').each(function(i,e){tabsState.push({selected:$(e).hasClass('selected')?true:false,color:$(e).find('a em').css('color'),});});return tabsState;};var getInvalidTabs=function(){var invalidTabs=[];$('.user-tab-content').each(function(i,e){if($(e).find('.validation-message').length>0){invalidTabs.push(i+1);}});return invalidTabs;};var restoreTabsState=function(tabsState){var invalidTabs=getInvalidTabs();$.each(tabsState,function(i,e){var tabElem=$('#EditView_tabs li:eq('+i+')');if(e.selected&&invalidTabs.length==0){tabElem.click();}
|
||||
tabElem.find('a em').css('color','');});if(invalidTabs.length>0){$('#tab'+invalidTabs[0]).parent().click();$('#tab'+invalidTabs[0]+' em').css('color','red');}};function verify_data(form){var tabsState=saveTabsState();var isError=!check_form("EditView");if(trim(form.last_name.value)==""){add_error_style('EditView',form.last_name.name,SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS')+SUGAR.language.get('Users','LBL_LIST_NAME'));isError=true;}
|
||||
var saveTabsState=function(){var tabsState=[];$('#EditView_tabs li').each(function(i,e){tabsState.push({selected:$(e).hasClass('selected')?true:false,color:$(e).find('a em').css('color'),});});return tabsState;};var getInvalidTabs=function(){var invalidTabs=[];$('.user-tab-content').each(function(i,e){if($(e).find('.validation-message').length>0){invalidTabs.push(i+1);}});return invalidTabs;};var restoreTabsState=function(tabsState){var invalidTabs=getInvalidTabs();$.each(tabsState,function(i,e){var tabElem=$('#EditView_tabs li:eq('+i+')');tabElem.find('a em').css('color','');});if(invalidTabs.length>0){$('#tab'+invalidTabs[0]+' em').css('color','red');}};function verify_data(form){var tabsState=saveTabsState();var isError=!check_form("EditView",false);if(trim(form.last_name.value)==""){add_error_style('EditView',form.last_name.name,SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS')+SUGAR.language.get('Users','LBL_LIST_NAME'));isError=true;}
|
||||
if(trim(form.user_name.value)==""){add_error_style('EditView',form.user_name.name,SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS')+SUGAR.language.get('Users','LBL_USER_NAME'));isError=true;}
|
||||
if(document.getElementById("required_password").value=='1'&&document.getElementById("new_password").value==""){add_error_style('EditView',form.new_password.name,SUGAR.language.get('app_strings','ERR_MISSING_REQUIRED_FIELDS')+SUGAR.language.get('Users','LBL_NEW_PASSWORD'));isError=true;}
|
||||
if(isError==true){restoreTabsState(tabsState);return false;}
|
||||
|
|
|
@ -97,7 +97,7 @@ $mod_strings = array(
|
|||
'LBL_REGULAR_DESC' => 'User can access modules and records based on roles.',
|
||||
'LBL_PHOTO' => 'Photo',
|
||||
'LBL_ADMIN' => 'System Administrator',
|
||||
'LBL_LAST_ADMIN_NOTICE' => 'Current selection could include yourself. You cannot change your own type of user or status.',
|
||||
'LBL_LAST_ADMIN_NOTICE' => 'Current selection could include yourself. You cannot change your own type of user or status.',
|
||||
'LBL_ADVANCED' => 'Advanced',
|
||||
'LBL_ANY_ADDRESS' => 'Any Address:',
|
||||
'LBL_ANY_EMAIL' => 'Any Email',
|
||||
|
@ -435,6 +435,7 @@ $mod_strings = array(
|
|||
'LBL_QUICK_CALL' => 'Log Call',
|
||||
'LBL_QUICK_TASK' => 'Create Task',
|
||||
'LBL_ENABLE_NOTIFICATIONS' => 'Enable Desktop Notifications',
|
||||
'LBL_DESKTOP_NOTIFICATIONS' => 'Desktop Notifications',
|
||||
'LBL_LIST_NONINHERITABLE' => "Not Inheritable",
|
||||
'LBL_PRIMARY_GROUP' => "Primary Group",
|
||||
'LBL_PASSWORD_MIS_MATCH' => 'mis-match',
|
||||
|
|
|
@ -222,22 +222,22 @@
|
|||
<div class="row-user">
|
||||
<!--First row-->
|
||||
<div class="row-container">
|
||||
<div class="left-col">
|
||||
<div class="left-col d-flex flex-column">
|
||||
<div class="row-label">
|
||||
<slot>{$MOD.LBL_EXPORT_DELIMITER}:</slot> {sugar_help text=$MOD.LBL_EXPORT_DELIMITER_DESC }
|
||||
</div>
|
||||
<div class="row-bottom">
|
||||
<div class="row-bottom flex-grow-1">
|
||||
<slot><input style="line-height:21.5px;" type="text" tabindex='12' name="export_delimiter"
|
||||
value="{$EXPORT_DELIMITER}" size="5">
|
||||
</slot>
|
||||
</div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
<div class="right-col">
|
||||
<div class="right-col d-flex flex-column">
|
||||
<div class="row-label">
|
||||
<slot>{$MOD.LBL_RECEIVE_NOTIFICATIONS}:</slot> {sugar_help text=$MOD.LBL_RECEIVE_NOTIFICATIONS_TEXT}
|
||||
</div>
|
||||
<div class="row-bottom">
|
||||
<div class="row-bottom flex-grow-1">
|
||||
<slot style="line-height: 2.3">
|
||||
<input name='receive_notifications' class="checkbox" tabindex='12' type="checkbox"
|
||||
value="12" {$RECEIVE_NOTIFICATIONS} style="margin-top: -1em;">
|
||||
|
@ -249,36 +249,47 @@
|
|||
<!--First row ends here-->
|
||||
<!--Second row-->
|
||||
<div class="row-container">
|
||||
<div class="left-col">
|
||||
<div class="left-col d-flex flex-column">
|
||||
<div class="row-label"><slot>{$MOD.LBL_EXPORT_CHARSET}:</slot> {sugar_help text=$MOD.LBL_EXPORT_CHARSET_DESC }</div>
|
||||
<div class="row-bottom"><slot><select tabindex='12' name="default_export_charset">{$EXPORT_CHARSET}</select></slot></div>
|
||||
<div class="row-bottom flex-grow-1"><slot><select tabindex='12' name="default_export_charset">{$EXPORT_CHARSET}</select></slot></div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
<div class="right-col">
|
||||
<div class="right-col d-flex flex-column">
|
||||
<div class="row-label"><slot>{$MOD.LBL_REMINDER}:</slot> {sugar_help text=$MOD.LBL_REMINDER_TEXT }</div>
|
||||
<div class="row-bottom"><slot>{include file="modules/Reminders/tpls/remindersDefaults.tpl"}</slot></div>
|
||||
|
||||
<div class="bottom-dotted-border"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-container" >
|
||||
<div class="left-col d-flex flex-column">
|
||||
<div class="row-label"><slot>{$MOD.LBL_DESKTOP_NOTIFICATIONS}:</slot></div>
|
||||
<div class="row-bottom flex-grow-1">
|
||||
<slot>
|
||||
<button type="button" class="btn btn-primary btn-sm" onClick="Alerts.prototype.enable()">
|
||||
{$MOD.LBL_ENABLE_NOTIFICATIONS}
|
||||
</button>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
<div class="right-col d-flex flex-column" >
|
||||
<div class="row-label"><slot>{$MOD.LBL_SNOOZE_TIMER}:</slot></div>
|
||||
<div class="row-bottom flex-grow-1"><select tabindex='12' name="snooze_alert_timer">{$SNOOZE_ALERT_TIMER}</select></div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Second row ends here-->
|
||||
|
||||
<div class="row-container">
|
||||
<div class="left-col"></div>
|
||||
<div class="right-col">
|
||||
<button type="button" class="btn btn-primary btn-sm" onClick="Alerts.prototype.enable()">
|
||||
{$MOD.LBL_ENABLE_NOTIFICATIONS}
|
||||
</button>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-container">
|
||||
<div class="left-col">
|
||||
<div class="left-col d-flex flex-column">
|
||||
<div class="row-label"><slot>{$MOD.LBL_USE_REAL_NAMES}:</slot> {sugar_help text=$MOD.LBL_USE_REAL_NAMES_DESC }</div>
|
||||
<div class="row-bottom"><slot style="line-height: 2.3"><input style="margin-top: -1em;" tabindex='12' type="checkbox" name="use_real_names" {$USE_REAL_NAMES}></slot></div>
|
||||
<div class="row-bottom flex-grow-1"><slot style="line-height: 2.3"><input style="margin-top: -1em;" tabindex='12' type="checkbox" name="use_real_names" {$USE_REAL_NAMES}></slot></div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
<div class="right-col">
|
||||
<div class="right-col d-flex flex-column">
|
||||
<div class="row-label"><slot>{$MOD.LBL_MAILMERGE}:</slot> {sugar_help text=$MOD.LBL_MAILMERGE_TEXT }</div>
|
||||
<div class="row-bottom">
|
||||
<div class="row-bottom flex-grow-1">
|
||||
<slot style="line-height: 1"><input style="margin-top: -1em;" tabindex='12' name='mailmerge_on' class="checkbox" type="checkbox" {$MAILMERGE_ON}>
|
||||
</slot>
|
||||
</div>
|
||||
|
@ -288,7 +299,7 @@
|
|||
<!--{if !empty($EXTERNAL_AUTH_CLASS) && !empty($IS_ADMIN)}-->
|
||||
<div class="row-container">
|
||||
<div>{capture name=SMARTY_LBL_EXTERNAL_AUTH_ONLY} {$MOD.LBL_EXTERNAL_AUTH_ONLY} {$EXTERNAL_AUTH_CLASS_1}{/capture}</div>
|
||||
<div class="left-col">
|
||||
<div class="left-col d-flex flex-column">
|
||||
<div class="row-label"><slot>{$EXTERNAL_AUTH_CLASS} {$MOD.LBL_ONLY}:
|
||||
</slot> {sugar_help text=$smarty.capture.SMARTY_LBL_EXTERNAL_AUTH_ONLY}</div>
|
||||
<div class="row-bottom"> <input type='hidden' value='0' name='external_auth_only'><input type='checkbox' value='1'
|
||||
|
@ -301,81 +312,6 @@
|
|||
</div>
|
||||
<!-- User Settings Ends here -->
|
||||
|
||||
<div id="locale" style="display:{$HIDE_FOR_GROUP_AND_PORTAL}">
|
||||
<div>
|
||||
<h4><slot>{$MOD.LBL_USER_LOCALE}</slot></h4>
|
||||
</div>
|
||||
<div class="row-user">
|
||||
<div class="row-container">
|
||||
<div class="left-col">
|
||||
<div class="row-label">
|
||||
<slot>{$MOD.LBL_EXPORT_CHARSET}:</slot> {sugar_help text=$MOD.LBL_EXPORT_CHARSET_DESC }
|
||||
</div>
|
||||
<div class="row-bottom">
|
||||
<slot><select tabindex='12' name="default_export_charset">{$EXPORT_CHARSET}</select></slot>
|
||||
</div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
<div class="right-col">
|
||||
<div class="row-label">
|
||||
<slot>{$MOD.LBL_REMINDER}:</slot> {sugar_help text=$MOD.LBL_REMINDER_TEXT }</div>
|
||||
<div class="row-bottom">
|
||||
<slot>{include file="modules/Reminders/tpls/remindersDefaults.tpl"}</slot>
|
||||
</div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Second row ends here-->
|
||||
<div class="row-container" style="margin-top: 0.5em;">
|
||||
<div class="left-col">
|
||||
<div class="row-label"><slot>{$MOD.LBL_SNOOZE_TIMER}:</slot></div>
|
||||
<div class="row-bottom"><select tabindex='12' name="snooze_alert_timer">{$SNOOZE_ALERT_TIMER}</select></div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
<div class="right-col" style="padding-top: 20px">
|
||||
<button type="button" class="btn btn-primary btn-sm" onClick="Alerts.prototype.enable()">
|
||||
{$MOD.LBL_ENABLE_NOTIFICATIONS}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-container">
|
||||
<div class="left-col">
|
||||
<div class="row-label">
|
||||
<slot>{$MOD.LBL_USE_REAL_NAMES}:</slot> {sugar_help text=$MOD.LBL_USE_REAL_NAMES_DESC }
|
||||
</div>
|
||||
<div class="row-bottom">
|
||||
<slot><input tabindex='12' type="checkbox" name="use_real_names" {$USE_REAL_NAMES}></slot>
|
||||
</div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
<div class="right-col">
|
||||
<div class="row-label">
|
||||
<slot>{$MOD.LBL_MAILMERGE}:</slot> {sugar_help text=$MOD.LBL_MAILMERGE_TEXT }</div>
|
||||
<div class="row-bottom">
|
||||
<slot><input tabindex='12' name='mailmerge_on' class="checkbox" type="checkbox" {$MAILMERGE_ON}>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--{if !empty($EXTERNAL_AUTH_CLASS) && !empty($IS_ADMIN)}-->
|
||||
<div class="row-container">
|
||||
<div>{capture name=SMARTY_LBL_EXTERNAL_AUTH_ONLY} {$MOD.LBL_EXTERNAL_AUTH_ONLY} {$EXTERNAL_AUTH_CLASS_1}{/capture}</div>
|
||||
<div class="left-col">
|
||||
<div class="row-label">
|
||||
<slot>{$EXTERNAL_AUTH_CLASS} {$MOD.LBL_ONLY}:
|
||||
</slot> {sugar_help text=$smarty.capture.SMARTY_LBL_EXTERNAL_AUTH_ONLY}</div>
|
||||
<div class="row-bottom"><input type='hidden' value='0' name='external_auth_only'><input
|
||||
type='checkbox' value='1'
|
||||
name='external_auth_only' {$EXTERNAL_AUTH_ONLY_CHECKED}></div>
|
||||
<div class="bottom-dotted-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!--{/if}-->
|
||||
</div><!--row user-->
|
||||
</div>
|
||||
<!-- User Settings Ends here -->
|
||||
|
||||
<div id="locale" style="display:{$HIDE_FOR_GROUP_AND_PORTAL}">
|
||||
<div>
|
||||
<h4>
|
||||
|
|
|
@ -201,4 +201,5 @@
|
|||
@import '../suitep-base/email-compose.scss';
|
||||
@import '../suitep-base/reminders-panel.scss';
|
||||
@import '../suitep-base/editviewbutton-mobile.scss';
|
||||
@import '../suitep-base/flex.scss';
|
||||
//
|
||||
|
|
41
public/legacy/themes/suite8/css/suitep-base/flex.scss
Normal file
41
public/legacy/themes/suite8/css/suitep-base/flex.scss
Normal file
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
|
||||
* Copyright (C) 2023 SalesAgility Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
|
||||
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see http://www.gnu.org/licenses.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License
|
||||
* version 3, these Appropriate Legal Notices must retain the display of the
|
||||
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
|
||||
* feasible for technical reasons, the Appropriate Legal Notices must display
|
||||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
.d-flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-grow-1 {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.flex-column {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.flex-row {
|
||||
flex-direction: row;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue