Return Type | Function name | Arguments |
---|---|---|
void | hdsField::Generate | (hzChain&,hzHttpEvent*,unsigned int&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsField::Generate (hzChain& C, hzHttpEvent* pE, unsigned int& nLine) { _hzfunc("hdsField::Generate") ; hzAtom atom ; hdbEnum* pSlct ; const char* pDictStr ; hzString value ; hzString S ; uint32_t rows ; uint32_t n ; hzEcode rc ; if (pE && m_Source) { rc = m_pApp->PcEntConv(atom, m_Source, pE) ; if (atom.IsSet()) value = atom.Str() ; } switch (m_Fldspec.htype) { case HTMLTYPE_HIDDEN: C.Printf("<input type="hidden" name="%s" value="%s"/>" , *m_Varname, *value) ; break ; case HTMLTYPE_SELECT: pSlct = (hdbEnum*) m_Fldspec.m_pType ; if (m_flagVE & VE_MULTIPLE) C.Printf("<select name="%s" multiple>" , *m_Varname) ; else C.Printf("<select name="%s">" , *m_Varname) ; for (n = 0; n < pSlct->Count() ; n++) { S = pSlct->GetStr(n) ; if (value == pDictStr) C.Printf("<option selected>%s</option>", *S) ; else C.Printf("<option>%s</option>", *S) ; } C << "</select>" ; break ; case HTMLTYPE_RADIO: pSlct = (hdbEnum*) m_Fldspec.m_pType ; rows = (pSlct->Count() / m_Fldspec.nCols) + 1; C << "<table>\n" ; C << "\t<tr>\n" ; C << "\t\t<td>\n" ; for (n = 0; n < pSlct->Count() ; n++) { S = pSlct->GetStr(n) ; if (n && (n % rows) == 0) { C.Printf("<input type="radio" name="%s" value="%d">%s\n" , *m_Varname, n, *S) ; C << "\t\t<td>\n\t\t</td>\n" ; continue ; } C.Printf("<input type="radio" name="%s" value="%d">%s<br>\n" , *m_Varname, n, *S) ; } C << "\t\t</td>\n" ; C << "\t</tr>\n" ; C << "</table>\n" ; break ; case HTMLTYPE_CHECKBOX: if (value) C.Printf("<input type="checkbox" name="%s" checked>" , *m_Varname) ; else C.Printf("<input type="checkbox" name="%s">" , *m_Varname) ; break ; case HTMLTYPE_FILE: C.Printf("<input type="file" name="%s" value="%s">" , *m_Varname, *value) ; break ; case HTMLTYPE_TEXT: case HTMLTYPE_TEXTAREA: if (m_Fldspec.nRows <&eq; 1) { if (m_flagVE & VE_UNIQUE) C.Printf("<input type="text" name="%s" size="%d" maxlength="%d" onchange="ckUnique_%s()"" , *m_Varname, m_Fldspec.nCols, m_Fldspec.nSize, *m_Varname) ; else C.Printf("<input type="text" name="%s" size="%d" maxlength="%d"" , *m_Varname, m_Fldspec.nCols, m_Fldspec.nSize) ; if (m_CSS) C.Printf(" class="%s"" , *m_CSS) ; if (value) C.Printf(" value="%s"" , *value) ; if (m_flagVE & VE_DISABLED) C << " disabled" ; C << "/>" ; } else { C.Printf("<textarea name="%s" rows="%d" cols="%d" maxlength="%d"" , *m_Varname, m_Fldspec.nRows, m_Fldspec.nCols, m_Fldspec.nSize) ; if (m_CSS) C.Printf(" class="%s"" , *m_CSS) ; C.AddByte(CHAR_MORE) ; if (value) C << value ; C << "</textarea>" ; } break ; case HTMLTYPE_PASSWORD: C.Printf("<input type="password" name="%s" size="%d" maxlength="%d"" , *m_Varname, m_Fldspec.nCols, m_Fldspec.nSize) ; if (m_CSS) C.Printf(" class="%s"" , *m_CSS) ; if (value) C.Printf(" value="%s"" , *value) ; C << "/>" ; break ; default: C.Printf("Sorry: HTML Unknown type. FldDesc=%s Name=%s Type=%s htype=%d Rows=%d Cols=%d Size=%d", *m_Fldspec.m_Refname, *m_Varname, m_Fldspec.m_pType->txtType(), m_Fldspec.htype, m_Fldspec.nRows, m_Fldspec.nCols, m_Fldspec.nSize) ; break ; } }