// Use Wa1pStudio.nui use WebFolders.nui use WebAppFramework.nui use HTML.utl // HTML functions object oStudioBroker is a WebPageBroker end_object enumeration_list define WA1P_PREVIEW_FILE // (string) Name of file written when previewing HTML pages (without path) define WA1P_PREVIEW_TEST_HTML // (boolean) Should the output display the HTML generated as a page. end_enumeration_list desktop_section object oWa1pStudioSetupValues is a cArray // Default values: set value item WA1P_PREVIEW_FILE to "preview.htm" set value item WA1P_PREVIEW_TEST_HTML to 0 end_object end_desktop_section procedure set wa1p_studio_setup_value global integer liItem string lsValue set value of oWa1pStudioSetupValues item liItem to lsValue end_procedure function wa1p_studio_setup_value global integer liItem returns string string lsValue get value of oWa1pStudioSetupValues item liItem to lsValue function_return lsValue end_function function wa1p_open_xhtml_preview global returns integer integer lbOk lbHtmlTest string lsFile lsFolder lsLang get pbHtmlTestOutput to lbHtmlTest //get wa1p_studio_setup_value WA1P_PREVIEW_TEST_HTML to lbHtmlTest get Wa1p_Folder WA1P_FOLDER_PRIV_TMP true to lsFolder if (lsFolder<>"") begin get wa1p_studio_setup_value WA1P_PREVIEW_FILE to lsFile get Files_AppendPath lsFolder lsFile to lsFile set pbTest of oWebAppHtmlBuilder to lbHtmlTest send XHTML_SetOutputFile lsFile send XHTML_StartXhtml send XHTML_OpeningOath // This complete XHTML document. send XHTML_Add_Open_Element "html" send XHTML_Add_Attribute "xmlns" "http://www.w3.org/1999/xhtml" move "en" to lsLang send XHTML_Add_Attribute "xml:lang" lsLang send XHTML_Add_Attribute "lang" lsLang send XHTML_Add_Open_Element "head" send DoWriteHtmlHeaderSection of oStudioBroker send XHTML_Close_Element // head send XHTML_Add_Open_Element "body" move 1 to lbOk end else begin error 421 "Preview folder not found" move 0 to lbOk end function_return lbOk end_function procedure wa1p_close_xhtml_preview global string lsFile lsFolder send XHTML_Close_Element // body send XHTML_Close_Element // html send XHTML_EndXhtml set pbTest of oWebAppHtmlBuilder to false get Wa1p_Folder WA1P_FOLDER_PRIV_TMP false to lsFolder get wa1p_studio_setup_value WA1P_PREVIEW_FILE to lsFile get Files_AppendPath lsFolder lsFile to lsFile send html_StartDoc lsFile end_procedure