00001
00002
00003
00004
00005
00006
00007
00008 #include "ocControls.h"
00009 #include "read_base.hpp"
00010
00011
00012 ocCheckBoxes * ckboxesEntry( string name, string sql,
00013 string defaulted = "",
00014 string attr = "" )
00015 {
00016
00017 string attributes = attr;
00018
00019 ocCheckBoxes * checks = new ocCheckBoxes(name,attributes);
00020
00021
00022 if( defaulted.length() > 0 )
00023 {
00024 checks->addOption( defaulted, "-1" );
00025 }
00026 if( sql.length() )
00027 {
00028 quickQuery qq;
00029 openRS & rs = qq.getData(sql);
00030 for( bool result=qq.opened; result; result=rs.next() )
00031 {
00032 attributes = " name='";
00033 attributes += name;
00034 attributes += "' onChange='ctrlChanged(this)' ";
00035
00036 checks->addOption( rs.getField(1).format(),
00037 rs.getField(0).format(),
00038 attributes );
00039 }
00040 }
00041 return checks;
00042 }
00043
00044
00045 ocRadio * radioEntry( string name, string sql,
00046 string defaulted = "",
00047 string attr = "" )
00048 {
00049
00050 string attributes = attr;
00051
00052 ocRadio * radios = new ocRadio(name,attributes);
00053
00054
00055 if( defaulted.length() > 0 )
00056 {
00057 radios->addOption( defaulted, "-1" );
00058 }
00059 if( sql.length() )
00060 {
00061 quickQuery qq;
00062 openRS & rs = qq.getData(sql);
00063 for( bool result=qq.opened; result; result=rs.next() )
00064 {
00065 attributes = " name='";
00066 attributes += name;
00067 attributes += "' onChange='ctrlChanged(this)' ";
00068
00069 radios->addOption( rs.getField(1).format(),
00070 rs.getField(0).format(),
00071 attributes );
00072 }
00073 }
00074 return radios;
00075 }
00076