Return TypeFunction nameArguments
hzEcodehdsApp::ExportDefaultForm(const hzString&,)

Declared in file: hzDissemino.h
Defined in file : hdsResource.cpp

Function Logic:

0:START 1:hdbADP::CountDataClass hdbADP::CountObjRepos hzLogger::Log pebuf pebuf pebuf pebuf hzMapS::Count 2:m_Includes.Count() 3:hzMapS::GetObj pIncl dfltInclude 4:hdbADP::GetPureClass pClass 5:!pClass 6:Return hzerr(E_NOTFOUND,No such class as %s\n,*cname) 7:hdbClass::MbrCount hzLogger::Log bUser hzMapS::Exists 8:m_UserTypes.Exists(cname) 9:bUser 10:items hzChain::Printf items 11:dfltInclude 12:hzChain::Printf 13:hzChain::AddByte hzChain::Printf items nM 14:nMMbrCount(); 15:hdbClass::GetMember pMem hdbMember::txtName mname hzChain::Printf 16:items items hzChain::Printf items 17:dfltInclude 18:hzChain::Printf 19:hzChain::AddByte items items 20:bUser 21:hzChain::Printf 22:hzChain::Printf 23:items items nM 24:nMMbrCount(); 25:hdbClass::GetMember pMem hdbMember::txtName mname hdbMember::GetSpec pSpec 26:!pSpec 27:hzLogger::Log 28:pSpec->m_Desc 29:hzChain::Printf 30:hzChain::Printf 31:items items items items 32:items items items items 33:bUser 34:hzChain::Printf items items nM 35:nMMbrCount(); 36:hdbClass::GetMember pMem hdbMember::txtName mname hdbDatatype::txtType hzChain::Printf 37:hzChain::Printf hzChain::Printf items items items items items items items hzChain::Printf items hzChain::Printf items hzChain::Printf items hzChain::Printf nM 38:nMMbrCount(); 39:hdbClass::GetMember pMem hdbMember::txtName mname hzChain::Printf 40:items items items 41:hzChain::Printf items hzChain::Printf nM 42:nMMbrCount(); 43:hdbClass::GetMember pMem hdbMember::txtName mname hzChain::Printf 44:items hzChain::Printf hzChain::Printf items 45:items hzChain::Size 46:Z.Size() 47:sprintf hzChain::Size hzLogger::Log ofstream::open ofstream::fail 48:os.fail() 49:items ofstream::fail 50:os.fail() 51:close 52:ofstream::clear 53:hzChain::Clear 54:Return rc

Function body:

hzEcode hdsApp::ExportDefaultForm (const hzString& cname)
{
   _hzfunc("hdsApp::ExportDefaultForm") ;
   ofstream            os ;
   hzChain             Z ;
   const hdsFldspec*   pSpec ;
   const hdbMember*    pMem ;
   const hdbClass*     pClass ;
   hdsBlock*           pIncl ;
   hzString            dfltInclude ;
   const char*         mname ;
   uint32_t            nM ;
   bool                bUser ;
   char                fname[80];
   char                pebuf[4];
   hzEcode             rc = E_OK ;
   m_pLog->Log("Have %d classes and %d repositories\n", m_ADP.CountDataClass(), m_ADP.CountObjRepos()) ;
   pebuf[0]= CHAR_PERCENT ;
   pebuf[1]= ''s'';
   pebuf[2]= '':'';
   pebuf[3]= 0;
   if (m_Includes.Count())
   {
       pIncl = m_Includes.GetObj(0);
       dfltInclude = pIncl->m_Refname ;
   }
   pClass = m_ADP.GetPureClass(cname) ;
   if (!pClass)
       return hzerr(E_NOTFOUND, "No such class as %s\n", *cname) ;
   m_pLog->Log("Doing class %s with %d members\n", *cname, pClass->MbrCount()) ;
   bUser = false ;
   if (m_UserTypes.Exists(cname))
       bUser = true ;
   Z << "<disseminoInclude>\n" ;
   /*
   **  ** Write out a basic list page for the class
   **      */
   Z.Printf("<xpage path="/list_%s" subject="%s" title="List %s" access="any" bgcolor="eeeeee" ops="noindex">\n"            ,
       *cname, *pClass->m_Category, *cname) ;
   Z << "\t<desc>None</desc>\n" ;
   if (dfltInclude)
       Z.Printf("\t<xblock name="%s"/>\n"  , *dfltInclude) ;
   Z.AddByte(CHAR_NL) ;
   Z.Printf("\t<xtable repos="%s" criteria="all" rows="10000" width="90" height="500" css="main">\n"            , *cname) ;
   Z <<
   "\t\t<ifnone><p>Sorry no records ...</p></ifnone>\n\t\t<header>Table header ...</header>\n\t\t<footer>Table footer ...</footer>\n"
                                             ;
   for (nM = 0; nM < pClass->MbrCount() ; nM++)
   {
       pMem = pClass->GetMember(nM) ;
       mname = pMem->txtName() ;
       Z.Printf("\t\t<xcol member="%s" title="%s"/>\n"    , mname, mname) ;
   }
   Z << "\t</xtable>\n" ;
   Z << "</xpage>\n" ;
   /*
   **  ** Write out a basic host page for the form for the class
   **      */
   Z.Printf("<xpage path="/add_%s" subject="%s" title="Add %s" access="any" bgcolor="eeeeee" ops="noindex">\n"            , *cname, *pClass->m_Category, *cname) ;
   Z << "\t<desc>None</desc>\n" ;
   if (dfltInclude)
       Z.Printf("\t<xblock name="%s"/>\n"  , *dfltInclude) ;
   Z.AddByte(CHAR_NL) ;
   Z <<
   "<style>\n.tooltip { position: relative; display: inline-block; border-bottom: 1px dotted black; }\n.tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: black; color: #fff; text-align: center; padding: 5px 0; border-radius: 6px; position: absolute; z-index: 1; }\n.tooltip:hover .tooltiptext { visibility: visible; }\n</style>\n\n"
                  ;
   Z <<
   "\t<table width="96%" align="center" border="0" cellspacing="0" cellpadding="0">\n\t\t<tr><td height="20"> </td></tr>\n\t\t<tr><td class="title" align="center">Title: Add a "
                                                                << cname << "</td></tr>\n\t\t<tr>\n\t\t<td valign="top" align="center" class="main">\n\t\t<p>\n\t\tUse this form to create an instance of "
                                                 << cname << "\n\t\t</p>\n\t\t</td>\n\t</tr>\n\t<xdiv user="public">\n\t<tr><td height="20"> </td></tr>\n\t<tr>\n\t\t<td height="20" align="center" class="main">\n\t\tPlease be aware that by submitting this form, you are consenting to the use of cookies. Please read our cookie policy to <a href="/cookies">find out more</a>\n\t\t</td>\n\t</tr>\n\t</xdiv>\n\t<tr><td height="40"> </td></tr>\n\t</table>\n\n"
                    ;
   if (bUser)
       Z.Printf("\t<xform name="form_reg_%s" action="fhdl_phase1_%s" class="%s">\n"      , *cname, *cname, *cname) ;
   else
       Z.Printf("\t<xform name="form_add_%s" action="fhdl_add_%s" class="%s">\n"      , *cname, *cname, *cname) ;
   Z << "\t<xhide name="lastpage" value="%x:referer;"/>\n\n"     ;
   Z << "\t<table width="56%" align="center" border="0" cellspacing="0" cellpadding="0" class="main">\n"             ;
   for (nM = 0; nM < pClass->MbrCount() ; nM++)
   {
       pMem = pClass->GetMember(nM) ;
       mname = pMem->txtName() ;
       pSpec = pMem->GetSpec() ;
       if (!pSpec)
           { m_pLog->Log("Warning No Field specification for member %s\n", mname) ; continue ; }
       if (pSpec->m_Desc)
           Z.Printf("\t\t<tr height="18"><td class="fld"><div class="tooltip">%s<span class="tooltiptext">%s</span></div>:</td>\t<td><xfield member="%s""          ,
               *pSpec->m_Title, *pSpec->m_Desc, mname) ;
       else
           Z.Printf("\t\t<tr height="18"><td class="fld">%s:</td>\t<td><xfield member="%s""      , *pSpec->m_Title, mname) ;
       Z << "\tdata=""  ; Z << pebuf ; Z << mname << """  ;
       Z << "\tflags="req"/></td></tr>\n"   ;
   }
   Z << "\t</table>\n" ;
   Z <<
   "\t<table width="96%" align="center" border="0" cellspacing="0" cellpadding="0" class="fld">\n\t\t<tr height="50"><td align="center"><xbutton show="Abort"/> <xbutton show="Submit"/></td></tr>\n\t\t<tr height="50" bgcolor="#CCCCCC"><td class="vb10blue"><center>Site Name</center></td></tr>\n\t</table>\n"
                  ;
   Z << "\t</xform>\n" ;
   Z << "</xpage>\n\n" ;
   if (bUser)
   {
       Z.Printf("<formhdl name="fhdl_phase1_%s" form="form_reg_%s" ops="cookie">\n"      , *cname, *cname) ;
       Z << "\t<procdata>\n" ;
       Z << "\t\t<setvar name="iniCode" type="uint32_t" value="%x:usecs;"/>\n"       ;
       for (nM = 0; nM < pClass->MbrCount() ; nM++)
       {
           pMem = pClass->GetMember(nM) ;
           mname = pMem->txtName() ;
           Z.Printf("\t\t<setvar name="%s" type="%s" value="%ce:%s;"/>\n"      , mname, pSpec->m_pType->txtType() , CHAR_PERCENT, mname) ;
       }
       Z.Printf("\t\t<sendemail from="%s" to="%ce:email;" smtpuser="%s" smtppass="%s" subject="Membership Application">\n"          ,
           *m_SmtpAddr, CHAR_PERCENT, *m_SmtpUser, *m_SmtpPass) ;
       Z.Printf("Thank you for registering with %s. Your initial login code is %cs:iniCode;i\n\n", *m_Domain, CHAR_PERCENT) ;
       Z << "The code is good for 1 hour. Enter this code instead of your selected password in the login screen.\n\n" ;
       Z << "This email has been generated by a submission to the Registration form at " ;
       Z << m_Domain ;
       Z << ". If you have recived this in error, please ignore\n" ;
       Z << "\t\t</sendemail>\n" ;
       Z << "\t</procdata>\n" ;
       Z << "\t<error goto="/register"/>\n\n"   ;
       Z.Printf("\t<response name="form_reg_%s" bgcolor="eeeeee">\n"    , *cname) ;
       Z << "\t\t<xblock name="gdInclude"/>\n"   ;
       Z.Printf("<xform name="formCkCorp1" action="hdlCkCorp">\n"    ) ;
       Z <<
       "\t<table width="96%" align="center" border="0" cellspacing="0" cellpadding="0">\n\t\t<tr><td width=5 height=25> </td></tr>\n\t\t<tr><td align=center class=title>Email Verification</td></tr>\n\t\t<tr height="250">\n\t\t<td class="main">\n\t\tThank you %s:fname; %s:lname; for your registration on belhalf of %s:orgname; to the gdpr360 XLS document processing service.\n\t\t</td>\n\t\t</tr>\n\t\t<tr height="50"><td align="center" class="fld">Code:</td><td><xfield fldspec="fs_Usec" var="testCode" flags="req"/></td></tr>\n\t\t<tr height="50"><td align="center"><xbutton show="Complete Registration"/></td></tr>\n\t\t</table>\n\t</xform>\n\t</response>\n</formhdl>\n\n"
                        ;
       Z.Printf("<formhdl name="fhdl_phase2_%s" form="form_reg_%s" ops="cookie">\n"      , *cname, *cname) ;
       Z <<
       "\t<procdata>\n\t\t<testeq param1="%e:testCode;" param2="%s:iniCode;">\n\t\t\t<error name="InvalidCode" bgcolor="eeeeee">\n\t\t\t\t<xblock name="gdInclude"/>\n\t\t\t\t<xform name="formCkCorp2" action="hdlCkCorp">\n\t\t\t\t\t<table width="96%" align="center" border="0" cellspacing="0" cellpadding="0">\n\t\t\t\t\t\t<tr><td width=5 height=25> </td></tr>\n\t\t\t\t\t\t<tr><td align=center class=title>Oops! Wrong Code!</td></tr>\n\t\t\t\t\t\t<tr height="250"><td class="main">Please check the email again and type in or cut and paste the code.</td></tr>\n\t\t\t\t\t\t<tr height="50"><td align="center" class="fld">Code:</td><td><xfield fldspec="fs_Usec" var="testCode" flags="req"/></td></tr>\n\t\t\t\t\t\t<tr height="50"><td align="center"><xbutton show="Complete Registration"/></td></tr>\n\t\t\t\t\t</table>\n\t\t\t\t</xform>\n\t\t\t</error>\n\t\t</testeq>\n"
                         ;
       Z.Printf("<addSubscriber class="%s" userName="%css:orgname;" userPass="%css:password;" userEmail="%css:email;">\n"        ,
           *cname, CHAR_PERCENT, CHAR_PERCENT, CHAR_PERCENT) ;
       for (nM = 0; nM < pClass->MbrCount() ; nM++)
       {
           pMem = pClass->GetMember(nM) ;
           mname = pMem->txtName() ;
           Z.Printf("\t\t\t<seteq member="%s" input="%cs%s"/>\n"    , mname, CHAR_PERCENT, mname) ;
       }
       Z <<
       "\t\t</addSubscriber>\n\t\t<logon user="%s:orgname;"/>\n\t</procdata>\n"
                         ;
       Z <<
       "\t<error name="RegistrationError" bgcolor="eeeeee">\n\t\t<xblock name="gdInclude"/>\n\t\t<div class="stdpage">\n\t\t<table bgcolor="#FFDDDD" width="100%" align="center" border="0" cellspacing="0" cellpadding="0">\n\t\t<tr><td width=5 height=25> </td></tr>\n\t\t<tr><td align=center class=title>Internal Error</td></tr>\n\t\t<tr height="160"><td> </td></tr>\n\t\t<tr>\n\t\t<td>An Internal error has occured and system administration has been notified. Please try again later.</td>\n\t\t</tr>\n\t\t<tr height="160"><td> </td></tr>\n\t\t<tr height="50"><td align="center"><xbutton show="Return to Site" goto="/index.html"/></td></tr>\n\t\t</table>\n\t\t</div>\n\t</error>\n"
                      ;
       Z <<
       "\t<response name="CorpCodeOK" bgcolor="eeeeee">\n\t\t<xblock name="gdInclude"/>\n\t\t<table width="96%" align="center" border="0" cellspacing="0" cellpadding="0">\n\t\t\t<tr><td width=5 height=25> </td></tr>\n\t\t\t<tr><td align=center class=title>Registration Complete</td></tr>\n\t\t\t<tr height="250">\n\t\t\t\t<td class="main">\n\t\t\t\tYour registration as %u:orgname; is now complete. You are logged in and may now use the document processing facility.\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr height="50"><td align="center"><xbutton show="Continue" goto="/menu"/></td></tr>\n\t\t</table>\n\t</response>\n</formhdl>\n"
                      ;
   }
   else
   {
       Z.Printf("<formhdl name="fhdl_add_%s" form="form_add_%s">\n"    , *cname, *cname) ;
       Z << "\t<procdata>\n" ;
       Z.Printf("<commit class="%s">\n"  , *cname) ;
       for (nM = 0; nM < pClass->MbrCount() ; nM++)
       {
           pMem = pClass->GetMember(nM) ;
           mname = pMem->txtName() ;
           Z.Printf("<seteq member="%s" input="%ce:%s;"/>\n"    , mname, CHAR_PERCENT, mname) ;
       }
       Z <<
       "\t\t</commit>\n\t</procdata>\n\n"
                           ;
       Z.Printf("<error goto="/add_%s"/>\n"  , *cname) ;
       Z.Printf("<response name="%s" bgcolor="eeeeee">\n"    , *cname) ;
       Z <<
       "\t</response>\n</formhdl>\n"
                      ;
   }
   Z << "</disseminoInclude>\n" ;
   if (Z.Size())
   {
       sprintf(fname, "%s/%s.forms", *m_Configdir, *cname) ;
       m_pLog->Log("Writing form of %d bytes to %s\n", Z.Size(), fname) ;
       os.open(fname) ;
       if (os.fail())
           threadLog("Could not open export forms file (classforms.dat)\n") ;
       else
       {
           os << Z ;
           if (os.fail())
               threadLog("Could not write export forms file (classforms.dat)\n") ;
           os.close() ;
       }
       os.clear() ;
   }
   Z.Clear() ;
   return rc ;
}