##define SECURITY_NONE -1##
##define SECURITY_HARDCODED 0##	
##define SECURITY_TABLE 1##	
##define ADVSECURITY_ALL 0##
##define ADVSECURITY_VIEW_OWN 1##
##define ADVSECURITY_EDIT_OWN 2##


##define LOGIN_HARDCODED 0##
##define LOGIN_TABLE 1##

##define DATABASE_MySQL 0##
##define DATABASE_Oracle 1##
##define DATABASE_MSSQLServer 2##
##define DATABASE_Access 3##
##define DATABASE_PostgreSQL 4##

##define nDATABASE_MySQL 0##
##define nDATABASE_Oracle 1##
##define nDATABASE_MSSQLServer 2##
##define nDATABASE_Access 3##
##define nDATABASE_PostgreSQL 4##

##define FORMAT_NONE ""##
##define FORMAT_DATE_SHORT "Short Date"##
##define FORMAT_DATE_LONG "Long Date"##
##define FORMAT_DATE_TIME "Datetime"##
##define FORMAT_TIME "Time"##
##define FORMAT_CURRENCY "Currency"##
##define FORMAT_PERCENT "Percent"##
##define FORMAT_HYPERLINK "Hyperlink"##
##define FORMAT_EMAILHYPERLINK "Email Hyperlink"##
##define FORMAT_FILE_IMAGE "File-based Image"##
##define FORMAT_DATABASE_IMAGE "Database Image"##
##define FORMAT_DATABASE_FILE "Database File"##
##define FORMAT_FILE "Document Download"##
##define FORMAT_LOOKUP_WIZARD "Lookup wizard"##
##define FORMAT_PHONE_NUMBER "Phone Number"##
##define FORMAT_NUMBER "Number"##
##define FORMAT_HTML "HTML"##
##define FORMAT_CHECKBOX "Checkbox"##
##define FORMAT_CUSTOM "Custom"##

##define EDIT_FORMAT_NONE ""##
##define EDIT_FORMAT_TEXT_FIELD "Text field"##
##define EDIT_FORMAT_TEXT_AREA "Text area"##
##define EDIT_FORMAT_PASSWORD "Password"##
##define EDIT_FORMAT_DATE "Date"##
##define EDIT_FORMAT_TIME "Time"##
##define EDIT_FORMAT_RADIO "Radio button"##
##define EDIT_FORMAT_CHECKBOX "Checkbox"##
##define EDIT_FORMAT_DATABASE_IMAGE "Database image"##
##define EDIT_FORMAT_DATABASE_FILE "Database file"##
##define EDIT_FORMAT_FILE "Document upload"##
##define EDIT_FORMAT_LOOKUP_WIZARD "Lookup wizard"##
##define EDIT_FORMAT_HIDDEN "Hidden field"##
##define EDIT_FORMAT_READONLY "Readonly"##

##define EDIT_DATE_SIMPLE 0##
##define EDIT_DATE_SIMPLE_DP 11##
##define EDIT_DATE_DD 12##
##define EDIT_DATE_DD_DP 13##

##define LT_LISTOFVALUES 0##
##define LT_LOOKUPTABLE 1##

##define VALIDATE_AS_NONE ""##
##define VALIDATE_AS_NUMBER "Number"##
##define VALIDATE_AS_PASSWORD "Password"##
##define VALIDATE_AS_EMAIL "Email"##
##define VALIDATE_AS_CURRENCY "Currency"##
##define VALIDATE_AS_ZIPCODE "US ZIP Code"##
##define VALIDATE_AS_PHONENUMBER "US Phone Number"##
##define VALIDATE_AS_STATE "US State"##
##define VALIDATE_AS_SSN "US SSN"##
##define VALIDATE_AS_CC "Credit Card"##
##define VALIDATE_AS_REGEXP "Regular expression"##
##define VALIDATE_AS_TIME "Time"##

##define RTE_BASIC 	"BASIC"##
##define RTE_FCK 	"FCK"##
##define RTE_INNOVA 	"INNOVA"##

##define DATE_INTERVAL_NORMAL 0##
##define DATE_INTERVAL_YEAR 1##
##define DATE_INTERVAL_QUARTER 2##
##define DATE_INTERVAL_MONTH 3##
##define DATE_INTERVAL_WEEK 4##
##define DATE_INTERVAL_DAY 5##
##define DATE_INTERVAL_HOUR 6##
##define DATE_INTERVAL_MINUTE 7##

##define REPORT_STEPPED	0##
##define REPORT_BLOCK	1##
##define REPORT_OUTLINE	2##
##define REPORT_ALIGN	3##
##define REPORT_TABULAR	6##

##define CHART_2DCOLUMN		0##
##define CHART_3DCOLUMN		1##
##define CHART_2DPIE		2##
##define CHART_3DPIE		3##
##define CHART_2DDOUGHNUT	4##
##define CHART_HORIZONTAL2D	5##
##define CHART_HORIZONTAL3D	6##
##define CHART_2DCOLUMN_LINE	7##
##define CHART_2DLINE		8##
##define CHART_STACKED_2D	9##
##define CHART_STACKED_3D	10##
##define CHART_STACKED_HOR_2D	11##
##define CHART_STACKED_HOR_3D	12##

##define CHART_NEW_2DPIE		20##
##define CHART_NEW_2DDOUGHNUT		21##
##define CHART_NEW_3DCOLUMN		22##
##define CHART_NEW_3DCOLUMN_STACKED	23##
##define CHART_NEW_2DCOLUMN		24##
##define CHART_NEW_2DCOLUMN_STACKED	25##
##define CHART_NEW_3DBAR		26##
##define CHART_NEW_3DBAR_STACKED	27##
##define CHART_NEW_2DBAR		28##
##define CHART_NEW_2DBAR_STACKED	29##
##define CHART_NEW_LINE			30##
##define CHART_NEW_SPLINE		31##
##define CHART_NEW_STEP_LINE		32##
##define CHART_NEW_AREA			33##
##define CHART_NEW_AREA_STACKED		34##
##define CHART_NEW_COMBINED		35##


##define titTABLE 0##
##define titVIEW 1##
##define titREPORT 2##
##define titCHART 3##

##define CHART_INCLUDES##
##define CHART_DATA_START##
##define CHART_DATA_END##

##define dpPOPUP 0##
##define dpINLINE 1##
##define dpNONE 2##

##define LCT_DROPDOWN 0##
##define LCT_AJAX 1##
##define LCT_LIST 2##
##define LCT_CBLIST 3##

##define Fields @TABLE.arrFieldObj##

##define PAGENAME_MASTERLIST "Master table info (list)"##
##define PAGENAME_MASTERPRINT "Master table info (print)"##


##define NeedValidationOnEdit(@field)
@field.strEditFormat!=EDIT_FORMAT_FILE && @field.strEditFormat!=EDIT_FORMAT_DATABASE_IMAGE && @field.strEditFormat!=EDIT_FORMAT_DATABASE_FILE
&& 
(@field.EditFormatObj.strValidateAs || @field.EditFormatObj.bRequired)
##

##define NeedValidationOnAdd(@field)
(@field.EditFormatObj.strValidateAs || @field.EditFormatObj.bRequired)
##

##define NeedValidation(@field)
@field.strEditFormat!=EDIT_FORMAT_FILE && @field.strEditFormat!=EDIT_FORMAT_DATABASE_IMAGE && @field.strEditFormat!=EDIT_FORMAT_DATABASE_FILE
&& (@field.EditFormatObj.strValidateAs || @field.EditFormatObj.bRequired)
##
   
##define UseRTE(@field)
@field.strEditFormat==EDIT_FORMAT_TEXT_AREA && @field.m_EditFormatObj.m_bUseRTE && (@BUILDER.m_strRTEType==RTE_BASIC || @BUILDER.m_strRTEType=="")
##

##define UseRTEBASIC(@field)
@field.strEditFormat==EDIT_FORMAT_TEXT_AREA && @field.m_EditFormatObj.m_bUseRTE && (@BUILDER.m_strRTEType==RTE_BASIC || @BUILDER.m_strRTEType=="")
##

##define UseRTEFCK(@field)
@field.strEditFormat==EDIT_FORMAT_TEXT_AREA && @field.m_EditFormatObj.m_bUseRTE && @BUILDER.m_strRTEType==RTE_FCK
##

##define UseRTEINNOVA(@field)
@field.strEditFormat==EDIT_FORMAT_TEXT_AREA && @field.m_EditFormatObj.m_bUseRTE && @BUILDER.m_strRTEType==RTE_INNOVA
##

##define UseCalendar(@f)
@f.strEditFormat==EDIT_FORMAT_DATE && 
(@f.EditFormatObj.nDateEditType==EDIT_DATE_SIMPLE_DP || @f.EditFormatObj.nDateEditType==EDIT_DATE_DD_DP)
##


##define Field(@fieldname) 
@TABLE.arrFieldObj[strName==@fieldname]
##



##define NeedLegendIcon(@f)
@f.EditFormatObj.bRequired && @f.strEditFormat!=EDIT_FORMAT_CHECKBOX && @f.strEditFormat!=EDIT_FORMAT_READONLY
##


##define GroupSecurity @BUILDER.bCreateLoginPage && @BUILDER.m_nLoginMethod==SECURITY_TABLE && (@BUILDER.UserGroups.len || @BUILDER.bDynamicPermissions)##

##define SecurityViewEditOwn 
@BUILDER.bCreateLoginPage && @BUILDER.m_nLoginMethod==SECURITY_TABLE && (@TABLE.nSecOptions==ADVSECURITY_EDIT_OWN || @TABLE.nSecOptions==ADVSECURITY_VIEW_OWN)
##

##define SecurityEditOwn 
@BUILDER.bCreateLoginPage && @BUILDER.m_nLoginMethod==SECURITY_TABLE && @TABLE.nSecOptions==ADVSECURITY_EDIT_OWN
##

##define CreateMenu @BUILDER.MenuNodes.len>1 || @BUILDER.bWebReports##

##define IsSortable(@f) 
(@f.nDataType != 128 && (@BUILDER.nDatabaseType==nDATABASE_MySQL || @f.nDataType != 201) && (@f.nDataType<203 || @f.nDataType > 205))
##



##define NeedQuotes(@f)
(@f.nDataType == 203 || @f.nDataType == 8 || @f.nDataType == 129 || @f.nDataType == 130 ||  
@f.nDataType == 7 || @f.nDataType == 133 || @f.nDataType == 134 || @f.nDataType == 135 || 
@f.nDataType == 201 || @f.nDataType == 205 || @f.nDataType == 200 || @f.nDataType == 202 || @f.nDataType == 72 )
##

##define IsDateField(@f)
(@f.nDataType==7 || @f.nDataType==133 || @f.nDataType==134 || @f.nDataType==135)
##

##define IsUpdatable(@f)
((@f.bEditPage || @f.bInlineEdit))
##

##define IsBinaryField(@f)
(@f.nDataType == 128 || @f.nDataType == 205)
##

##define IsTextField(@f)
(@f.nDataType == 201 || @f.nDataType==203)
##

##define IsFloatField(@f)
(@f.nDataType=14 || @f.nDataType=5 || @f.nDataType=131)
##

##define IsNumberField(@f)
(@f.nDataType == 20 || @f.nDataType==11 || @f.nDataType==3 || @f.nDataType==2 
 || @f.nDataType==16 || @f.nDataType==21 || @f.nDataType==19 || @f.nDataType==18 
 || @f.nDataType==17 || @f.nDataType==1001
 || @f.nDataType==14 || @f.nDataType==5 || @f.nDataType==131 || @f.nDataType==6)
##


##define IsCharField(@f)
(IsTextField(@f) || @f.nDataType == 8 || @f.nDataType==129
|| @f.nDataType == 200 || @f.nDataType==202 
|| @f.nDataType == 130 )
##

##define NeedEncode(@f)
(@f.strViewFormat!=FORMAT_CUSTOM && @f.strViewFormat!=FORMAT_HTML && @f.strViewFormat!=FORMAT_FILE_IMAGE && @f.strViewFormat!=FORMAT_FILE && @f.strViewFormat!=FORMAT_HYPERLINK && @f.strViewFormat!=FORMAT_EMAILHYPERLINK && @f.strViewFormat!=FORMAT_CHECKBOX)
##

##define CP1250 "Windows-1250"##
##define CP1251 "Windows-1251"##
##define CP1252 "Windows-1252"##
##define CP1253 "Windows-1253"##
##define CP1254 "Windows-1254"##
##define CP1257 "Windows-1257"##
##define CP1258 "Windows-1258"##

##define IsTable(@t)
(@t.nType==titTABLE || @t.nType==titVIEW)
##

##define IsReport(@t)
(@t.nType==titREPORT)
##

##define IsChart(@t)
(@t.nType==titCHART)
##

##define VerticalChart 
@TABLE.nChartType==CHART_2DCOLUMN || @TABLE.nChartType==CHART_3DCOLUMN || @TABLE.nChartType==CHART_STACKED_2D || @TABLE.nChartType==CHART_STACKED_3D
##

##define IsAdminTable(@t)
(@t.strDataSourceTable=="admin_users" || @t.strDataSourceTable=="admin_members"|| @t.strDataSourceTable=="admin_rights")
##