// Use WebLayout.nui // Different layout object classes
Use Base.nui // Item_Property command, Various macros (FOR_EX...), cArray, cSet and cStack classes (No User Interface)
Use WebAppXhtmlBuilder.nui // Global procedures for writing XHTML
Use ExtendedItemProp.nui // cExtendedItemPropertyArray class
//Use WebFolders.nui // Folders and XML envelopes
Use XmlBuilder.nui // cXmlBuilder class
use XmlSequence.nui // cXmlSequence class (and cXmlParamArray)
enumeration_list // Table layout purposes
define LAYOUTPURPOSE_UNKNOWN
define LAYOUTPURPOSE_PAGE
define LAYOUTPURPOSE_FORM
define LAYOUTPURPOSE_FIELDSET
define LAYOUTPURPOSE_BTNBAR
end_enumeration_list
desktop_section
object oWebLayoutPurposes is a cArray
item_property_list
item_property string psName.i
item_property string psXmlTag.i
end_item_property_list
procedure add_purpose integer liRow string lsName string lsXmlTag
set psName.i liRow to lsName
set psXmlTag.i liRow to lsXmlTag
end_procedure
send add_purpose LAYOUTPURPOSE_UNKNOWN "Unknown" "unknown"
send add_purpose LAYOUTPURPOSE_PAGE "Page" "page"
send add_purpose LAYOUTPURPOSE_FORM "Form" "form"
send add_purpose LAYOUTPURPOSE_FIELDSET "Fieldset" "fieldset"
send add_purpose LAYOUTPURPOSE_BTNBAR "Buttonbar" "buttonbar"
function sTagToPurposeId string lsName returns integer
integer liMax liRow
get row_count to liMax
decrement liMax
for liRow from 0 to liMax
if (lsName=psXmlTag.i(self,liRow)) function_return liRow
loop
function_return -1 // Not found
end_function
end_object
end_desktop_section
enumeration_list // Table layout type
define LAYOUTTYPE_DIV
define LAYOUTTYPE_TABLE
define LAYOUTTYPE_SEQ
define LAYOUTTYPE_HTML_PAGE
end_enumeration_list
desktop_section
object WebLayoutTypes is a cArray
item_property_list
item_property string psTypeName.i
item_property string psXmlTag.i
end_item_property_list
procedure add_layout_type integer liType string lsName string lsXmlTag
set psTypeName.i liType to lsName
set psXmlTag.i liType to lsXmlTag
end_procedure
send add_layout_type LAYOUTTYPE_DIV "Div" "div"
send add_layout_type LAYOUTTYPE_TABLE "Table" "table"
send add_layout_type LAYOUTTYPE_SEQ "Sequence" "sequence"
function sTagToTypeId string lsName returns integer
integer liMax liRow
get row_count to liMax
decrement liMax
for liRow from 0 to liMax
if (lsName=psXmlTag.i(self,liRow)) function_return liRow
loop
function_return -1 // Not found
end_function
end_object
end_desktop_section
desktop_section
object oWebLayoutList is a cArray
item_property_list
item_property integer phObj.i
end_item_property_list
register_function psLayoutName returns string
function iFindRow.s string lsLayoutName returns integer
integer liRow liMax lhObj
get row_count to liMax
decrement liMax
for liRow from 0 to liMax
get phObj.i liRow to lhObj
if (lsLayoutName=psLayoutName(lhObj)) function_return liRow
loop
function_return -1 // not found
end_function
function hFindHandle string lsLayoutName returns integer
integer liRow
get iFindRow.s lsLayoutName to liRow
if (liRow<>-1) function_return (phObj.i(self,liRow))
function_return 0 // Not found
end_function
end_object // oWebLayoutList
end_desktop_section
function WebLayout_NameToObjHandle global string lsLayoutName returns integer
integer lhRval
get hFindHandle of oWebLayoutList lsLayoutName to lhRval
function_return lhRval
end_function
procedure WebLayout_Register global integer lhObj
integer liRow
string lsLayoutName
get psLayoutName of lhObj to lsLayoutName
get iFindRow.s of oWebLayoutList lsLayoutName to liRow
if (liRow=-1) begin
get row_count of oWebLayoutList to liRow
set phObj.i of oWebLayoutList liRow to lhObj
end
end_procedure
// --- Layout for a complete page based on HTML file -----------------------------------
class cHtmlTemplateSplitter is a cArray
item_property_list
item_property integer piType.i // 0=raw HTML 1=call back data
item_property string psValue.i // Call back code (label, aux)
end_item_property_list cHtmlTemplateSplitter
procedure add_row integer liType string lsValue
integer liRow
get row_count to liRow
set piType.i liRow to liType
set psValue.i liRow to lsValue
end_procedure
function iSplitHtmlTemplate string lsHtml returns integer // Error code
integer liPos
string lsValue
repeat
move (pos("",lsHtml)) to liPos
ifnot liPos function_return 1 // Error: End of comment not found
move (left(lsHtml,liPos-1)) to lsValue
send add_row 1 lsValue
move (replace(lsValue,lsHtml,"")) to lsHtml
move (replace("-->",lsHtml,"")) to lsHtml
end
else if (lsHtml<>"") begin
send add_row 0 lsHtml
end
until (liPos=0)
end_function
end_class // cHtmlTemplateSplitter
class WebLayoutHtmlPage is a cHtmlTemplateSplitter
procedure construct_object
forward send construct_object
property string psLayoutName public ""
property integer piPurpose public LAYOUTPURPOSE_UNKNOWN
property integer piType public LAYOUTTYPE_HTML_PAGE // Don't change this
property string psHtmlFile public "nohtmlfilename.htm"
property boolean priv.pbFileLoaded public FALSE
end_procedure
procedure read_html_file
integer liError
string lsHtml
// ifnot (priv.pbFileLoaded(self)) begin
send delete_data
get SEQ_ReadFileAsOneString (psHtmlFile(self)) to lsHtml
get iSplitHtmlTemplate lsHtml to liError
set priv.pbFileLoaded to TRUE
// end
end_procedure
procedure OnWriteCell string lsLabel integer liAux
send XHTML_Add_Closed_Element "span" (lsLabel+" ("+string(liAux)+")")
end_procedure
procedure DoWriteHTML integer lhCallbackMsg integer lhCallbackObj // Div
integer liRow liMax liAux
string lsValue
send read_html_file
ifnot lhCallbackObj move self to lhCallbackObj
ifnot lhCallbackMsg move MSG_OnWriteCell to lhCallbackMsg
get row_count to liMax
decrement liMax
for liRow from 0 to liMax
if (piType.i(self,liRow)=0) begin // Chuck of HTML
send XHTML_Stream_Data (psValue.i(self,liRow))
end
else begin // call back code
get psValue.i liRow to lsValue
send lhCallbackMsg of lhCallbackObj (trim(ExtractWord(lsValue,",",1))) (trim(ExtractWord(lsValue,",",2)))
end
loop
end_procedure
end_class // WebLayoutHtmlPage
// --- Layout based on DIV elements ----------------------------------------------------
//> An object of the WebLayoutDiv class defines the structure of a web page or of part
//> of a web page. Note that the order of the layers in this array determines the order
//> in which they (and their content) is written to the page, and therefore the order
//> in which they appear before the user. Use that to place the most important one in the
//> beginning of the sequence.
class WebLayoutDiv is a cExtendedItemPropertyArray
// XML Format:
//
// name
//
//
// name
// name
// name
//
//
//
procedure construct_object
forward send construct_object
property string psLayoutName public ""
property integer piPurpose public LAYOUTPURPOSE_UNKNOWN
property integer piType public LAYOUTTYPE_DIV // Don't change this
set column_xml_tag 0 to "label"
set column_xml_tag 1 to "aux"
set column_xml_tag 2 to "class"
set column_xml_tag 3 to "style"
set psRowXmlTag to "divcell"
end_procedure
procedure DoReset // Div
set psLayoutName to ""
set piPurpose to LAYOUTPURPOSE_UNKNOWN
send delete_data
end_procedure
item_property_list
item_property string psLabel.i
item_property integer piLabelAux.i
item_property string psClass.i
item_property string psStyle.i
item_property integer phMessage.i // Send this message
item_property integer phObject.i // to this object
end_item_property_list WebLayoutDiv
function iFindLabelAndAux string lsLabel integer liAux returns integer
integer liMax liRow
get row_count to liMax
decrement liMax
for liRow from 0 to liMax
if (lsLabel=psLabel.i(self,liRow) and liAux=piLabelAux.i(self,liRow)) function_return liRow
loop
function_return -1
end_function
procedure add_div_cell string lsLabel integer liAux string lsClass string lsStyle integer lhMsg integer lhObj
integer liRow
get row_count to liRow
set psLabel.i liRow to lsLabel
set piLabelAux.i liRow to liAux
set psClass.i liRow to lsClass
set psStyle.i liRow to lsStyle
end_procedure
procedure OnWriteCell string lsLabel integer liAux
send XHTML_Add_Closed_Element "span" (lsLabel+" ("+string(liAux)+")")
end_procedure
procedure DoWriteHTML integer lhCallbackMsg integer lhCallbackObj // Div
integer liRow liMax liAux lhMsg lhObj
string lsLabel lsStyle lsClass
ifnot lhCallbackObj move self to lhCallbackObj
ifnot lhCallbackMsg move MSG_OnWriteCell to lhCallbackMsg
get row_count to liMax
decrement liMax
for liRow from 0 to liMax
get psLabel.i liRow to lsLabel
get piLabelAux.i liRow to liAux
get psStyle.i liRow to lsStyle
get psClass.i liRow to lsClass
get phMessage.i liRow to lhMsg
get phObject.i liRow to lhObj
send XHTML_Add_Open_Element "div"
if (lsClass<>"") send XHTML_Add_Attribute "class" lsClass
if (lsStyle<>"") send XHTML_Add_Attribute "style" lsStyle
if lhMsg begin
if lhObj send lhMsg of lhObj lsLabel liAux
else send lhMsg of lhCallbackObj lsLabel liAux
end
else send lhCallbackMsg of lhCallbackObj lsLabel liAux
send XHTML_Close_Element
loop
end_procedure
procedure WriteDefinitionXml
integer lhBuilder
move oItemPropertyArrayXmlBuilder to lhBuilder
send add_open_element of lhBuilder "divlist"
send WriteXml
send close_element of lhBuilder // divlist
end_procedure
procedure ReadDefinitionXml integer hoNode
integer hoChildNode
get FindNode of hoNode "divlist" to hoChildNode
if hoChildNode begin
send ReadXml hoChildNode
send destroy of hoChildNode
end
end_procedure
end_class // WebLayoutDiv
// --- Layout based on TABLE elements --------------------------------------------------
class WebLayoutTableCells is a cExtendedItemPropertyArray
procedure construct_object
forward send construct_object
property integer priv.iMaxColumn public -1
property integer priv.iMaxRow public -1
property integer priv.iRow public -1
property integer priv.bDirty public 0
object oHelper is a cArray2dFixedWidth
// In this array values have the following meaning:
// x=-1 : The cell should not be rendered
// x=0 : The cell should be rendered empty
// x>0 : Data regarding this cell can be found in row x-1
end_object
set column_xml_tag 0 to "row"
set column_xml_tag 1 to "column"
set column_xml_tag 2 to "class"
set column_xml_tag 3 to "style"
set column_xml_tag 6 to "label"
set column_xml_tag 7 to "aux"
set column_xml_tag 8 to "spanrows"
set column_xml_tag 9 to "spancols"
set psRowXmlTag to "cell"
end_procedure
item_property_list
item_property integer piRow.i // Table row 0
item_property integer piColumn.i // Table column 1
item_property string psCellClass.i // 2
item_property string psCellStyle.i // 3
item_property integer phMessage.i // Send this message 4
item_property integer phObject.i // to this object 5
item_property string psLabel.i // with this parameter 6
item_property integer piLabelAux.i // and this parameter 7
item_property integer piSpanRows.i // 8
item_property integer piSpanCols.i // 9
end_item_property_list WebLayoutTableCells
function iFindLabelAndAux string lsLabel integer liAux returns integer
integer liMax liRow
get row_count to liMax
decrement liMax
for liRow from 0 to liMax
if (lsLabel=psLabel.i(self,liRow) and liAux=piLabelAux.i(self,liRow)) function_return liRow
loop
function_return -1
end_function
procedure DoReset
set priv.iMaxRow to -1
set priv.iMaxColumn to -1
set priv.bDirty to false
send delete_data of oHelper
send delete_data
end_procedure
procedure add_cell integer liRow integer liCol integer lhMsg integer lhObj string lsLabel integer liLabelAux
integer liArrayRow
if (liRow>priv.iMaxRow(self)) set priv.iMaxRow to liRow
if (liCol>priv.iMaxColumn(self)) set priv.iMaxColumn to liCol
get row_count to liArrayRow
set piRow.i liArrayRow to liRow
set piColumn.i liArrayRow to liCol
set phMessage.i liArrayRow to lhMsg
set phObject.i liArrayRow to lhObj
set psLabel.i liArrayRow to lsLabel
set piLabelAux.i liArrayRow to liLabelAux
set priv.iRow to liArrayRow
set priv.bDirty to true
end_procedure
procedure set span_values integer liSpanRows integer liSpanCols
integer liRow
get priv.iRow to liRow
set piSpanCols.i liRow to liSpanCols
set piSpanRows.i liRow to liSpanRows
set priv.bDirty to true
end_procedure
procedure set class_and_style string lsClass string lsStyle
integer liRow
get priv.iRow to liRow
set psCellClass.i liRow to lsClass
set psCellStyle.i liRow to lsStyle
end_procedure
procedure DeactivateSpannedCells integer liStartRow integer liStartCol integer liSpanRows integer liSpanCols
integer liRow liCol lhHelper
move oHelper to lhHelper
for liRow from liStartRow to (liStartRow+liSpanRows-1)
for liCol from liStartCol to (liStartCol+liSpanCols-1)
set value.ii of lhHelper liRow liCol to -1
loop
loop
end_procedure
procedure BuildHelperArray
integer liArrayMax liArrayRow lhHelper
integer liRow liCol liSpanCols liSpanRows
integer liMaxRow liMaxCol
get priv.iMaxRow to liMaxRow
get priv.iMaxColumn to liMaxCol
move oHelper to lhHelper
send delete_data of lhHelper
set piMaxColumn of lhHelper to (priv.iMaxColumn(self)+1)
get row_count to liArrayMax
decrement liArrayMax
for liArrayRow from 0 to liArrayMax
get piRow.i liArrayRow to liRow
get piColumn.i liArrayRow to liCol
get piSpanCols.i liArrayRow to liSpanCols
get piSpanRows.i liArrayRow to liSpanRows
if (liSpanCols<1) move 1 to liSpanCols
if (liSpanRows<1) move 1 to liSpanRows
// Reduce the span values if they exceed the boundaries:
// if ((liRow+liSpanRows)>liMaxRow) move (liMaxRow-liRow) to liSpanRows
// if ((liCol+liSpanCols)>liMaxCol) move (liMaxCol-liCol) to liSpanCols
if ((liRow+liSpanRows-1)>liMaxRow) move (liMaxRow-liRow+1) to liSpanRows
if ((liCol+liSpanCols-1)>liMaxCol) move (liMaxCol-liCol+1) to liSpanCols
send DeactivateSpannedCells liRow liCol liSpanRows liSpanCols
set value.ii of lhHelper liRow liCol to (liArrayRow+1)
loop
set priv.bDirty to false
end_procedure
procedure DoWriteHtml integer lhCallbackMsg integer lhCallbackObj // Table
integer lhHelper liRow liCol liMaxRow liMaxCol liArrayRow liValue
integer lhMsg lhObj liLabelAux
integer liSpanCols liSpanRows
string lsLabel
if (priv.bDirty(self)) send BuildHelperArray
move oHelper to lhHelper
get row_count of lhHelper to liMaxRow
decrement liMaxRow
get column_count of lhHelper to liMaxCol
decrement liMaxCol
for liRow from 0 to liMaxRow
send XHTML_Add_Open_Element "tr"
for liCol from 0 to liMaxCol
get value.ii of lhHelper liRow liCol to liValue
if (liValue=0) send XHTML_Add_Closed_Element "td" ""
if (liValue>0) begin
move (liValue-1) to liArrayRow
send XHTML_Add_Open_Element "td"
get piSpanCols.i liArrayRow to liSpanCols
get piSpanRows.i liArrayRow to liSpanRows
// Reduce the span values if they exceed the boundaries:
if ((liRow+liSpanRows-1)>liMaxRow) move (liMaxRow-liRow+1) to liSpanRows
if ((liCol+liSpanCols-1)>liMaxCol) move (liMaxCol-liCol+1) to liSpanCols
if (liSpanCols>1) send XHTML_Add_Attribute "colspan" (string(liSpanCols))
if (liSpanRows>1) send XHTML_Add_Attribute "rowspan" (string(liSpanRows))
if (psCellClass.i(self,liArrayRow)<>"") send XHTML_Add_Attribute "class" (psCellClass.i(self,liArrayRow))
if (psCellStyle.i(self,liArrayRow)<>"") send XHTML_Add_Attribute "style" (psCellStyle.i(self,liArrayRow))
get phMessage.i liArrayRow to lhMsg
get phObject.i liArrayRow to lhObj
get psLabel.i liArrayRow to lsLabel
get piLabelAux.i liArrayRow to liLabelAux
// procedure XXX string lsLabel integer liAux integer liRow integer liCol
if lhMsg begin
if lhObj send lhMsg of lhObj lsLabel liLabelAux liRow liCol
else send lhMsg of lhCallbackObj lsLabel liLabelAux liRow liCol
end
else send lhCallbackMsg of lhCallbackObj lsLabel liLabelAux liRow liCol
send XHTML_Close_Element // td
end
loop
send XHTML_Close_Element // tr
loop
end_procedure
procedure ReadXml integer hoNode
integer liRow liMax liMaxRow liMaxCol
forward send ReadXml hoNode
set priv.bDirty to true
get row_count to liMax
move -1 to liMaxRow
move -1 to liMaxCol
decrement liMax
for liRow from 0 to liMax
if (piRow.i(self,liRow)>liMaxRow) get piRow.i liRow to liMaxRow
if (piColumn.i(self,liRow)>liMaxCol) get piColumn.i liRow to liMaxCol
loop
set priv.iMaxRow to liMaxRow
set priv.iMaxColumn to liMaxCol
end_procedure
procedure DoCallBackAllCells integer lhMsg integer lhObj
integer lhHelper liRow liCol liMaxRow liMaxCol liArrayRow liValue
integer liLabelAux
integer liSpanRows liSpanCols
string lsLabel
if (priv.bDirty(self)) send BuildHelperArray
move oHelper to lhHelper
get row_count of lhHelper to liMaxRow
decrement liMaxRow
get column_count of lhHelper to liMaxCol
decrement liMaxCol
for liRow from 0 to liMaxRow
for liCol from 0 to liMaxCol
get value.ii of lhHelper liRow liCol to liValue
if (liValue=0) send lhMsg of lhObj 0 "" 0 liRow liCol 0 0
if (liValue>0) begin
move (liValue-1) to liArrayRow
get piSpanRows.i liArrayRow to liSpanRows
get piSpanCols.i liArrayRow to liSpanCols
// Reduce the span values if they exceed the boundaries:
if ((liRow+liSpanRows-1)>liMaxRow) move (liMaxRow-liRow+1) to liSpanRows
if ((liCol+liSpanCols-1)>liMaxCol) move (liMaxCol-liCol+1) to liSpanCols
get psLabel.i liArrayRow to lsLabel
get piLabelAux.i liArrayRow to liLabelAux
// procedure XXX integer lbRender string lsLabel integer liAux integer liRow integer liCo3 integer liSpanRows integer liSpanCols
send lhMsg of lhObj 1 lsLabel liLabelAux liRow liCol liSpanRows liSpanCols
//send XHTML_Close_Element // td
end
loop
//send XHTML_Close_Element // tr
loop
end_procedure
end_class // WebLayoutTableCells
class WebLayoutTable is a cExtendedItemPropertyArray
procedure construct_object
forward send construct_object
property string psLayoutName public ""
property integer piPurpose public LAYOUTPURPOSE_UNKNOWN
property integer piType public LAYOUTTYPE_TABLE // Don't change this
property string psTableClass public ""
property string psTableStyle public ""
property string psBorder public "0"
property string psCellSpacing public "0"
property string psCellPadding public "0"
property string psWidth public ""
object oCells is a WebLayoutTableCells
end_object
set column_xml_tag 0 to "class"
set column_xml_tag 1 to "style"
set psRowXmlTag to "column"
end_procedure
// function next_row returns integer
// end_function
item_property_list
item_property string psColumnClass.i
item_property string psColumnStyle.i
end_item_property_list WebLayoutTable
function iFindLabelAndAux string lsLabel integer liAux returns integer
integer liRval
get iFindLabelAndAux of oCells lsLabel liAux to liRval
function_return liRval
end_function
//> Use this method to set the CSS class and/or CSS style of a column in the table. Note
//> that the first column of the table is column 0.
procedure add_column integer liColumn string lsClass string lsStyle
set psColumnClass.i liColumn to lsClass
set psColumnStyle.i liColumn to lsStyle
end_procedure
procedure DoReset // Table
send delete_data
set psLayoutName to ""
set piPurpose to LAYOUTPURPOSE_UNKNOWN
send DoReset of oCells
set psTableClass to ""
set psTableStyle to ""
set psBorder to ""
set psCellSpacing to ""
set psCellPadding to ""
set psWidth to ""
end_procedure
procedure begin_cells
send DoReset of oCells
end_procedure
procedure add_cell integer liRow integer liCol integer lhMsg integer lhObj string lsLabel integer liLabelAux
send add_cell of oCells liRow liCol lhMsg lhObj lsLabel liLabelAux
end_procedure
procedure set span_values integer liSpanRows integer liSpanCols
set span_values of oCells to liSpanRows liSpanCols
end_procedure
procedure set class_and_style string lsClass string lsStyle
set class_and_style of oCells to lsClass lsStyle
end_procedure
procedure end_cells
send sort_rows of oCells 0 1 // sort by row, column
end_procedure
procedure WriteColGroup
integer liMax liRow
get row_count to liMax
if liMax begin
decrement liMax
for liRow from 0 to liMax
send XHTML_Add_Open_Element "colgroup"
send XHTML_Add_Attribute "span" "1"
if (psColumnClass.i(self,liRow)<>"") send XHTML_Add_Attribute "class" (psColumnClass.i(self,liRow))
if (psColumnStyle.i(self,liRow)<>"") send XHTML_Add_Attribute "style" (psColumnStyle.i(self,liRow))
send XHTML_Close_Element // colgroup
loop
end
end_procedure
procedure OnWriteCell string lsLabel integer liAux integer liRow integer liCol
send XHTML_Add_Closed_Element "span" (lsLabel+" ("+string(liAux)+")")
end_procedure
procedure DoWriteHtml integer lhMsg integer lhCallbackObj
string lsValue
send XHTML_Add_Open_Element "table"
get psBorder to lsValue
if (lsValue<>"") send XHTML_Add_Attribute "border" lsValue
get psCellSpacing to lsValue
if (lsValue<>"") send XHTML_Add_Attribute "cellspacing" lsValue
get psCellPadding to lsValue
if (lsValue<>"") send XHTML_Add_Attribute "cellpadding" lsValue
get psWidth to lsValue
if (lsValue<>"") send XHTML_Add_Attribute "width" lsValue
if (psTableClass(self)<>"") send XHTML_Add_Attribute "class" (psTableClass(self))
if (psTableStyle(self)<>"") send XHTML_Add_Attribute "style" (psTableStyle(self))
send WriteColGroup
ifnot lhCallbackObj move self to lhCallbackObj
ifnot lhMsg move MSG_OnWriteCell to lhMsg
send DoWriteHtml of oCells lhMsg lhCallbackObj
send XHTML_Close_Element // table
end_procedure
procedure WriteDefinitionXml
integer lhBuilder
move oItemPropertyArrayXmlBuilder to lhBuilder
send add_open_element of lhBuilder "tabledata"
send add_closed_element of lhBuilder "class" (psTableClass(self))
send add_closed_element of lhBuilder "style" (psTableStyle(self))
send add_closed_element of lhBuilder "border" (psBorder(self))
send add_closed_element of lhBuilder "cellspacing" (psCellSpacing(self))
send add_closed_element of lhBuilder "cellpadding" (psCellPadding(self))
send add_closed_element of lhBuilder "width" (psWidth(self))
send close_element of lhBuilder // tabledata
send add_open_element of lhBuilder "columnlist"
send WriteXml
send close_element of lhBuilder // columnlist
send add_open_element of lhBuilder "celllist"
send WriteXml of oCells
send close_element of lhBuilder // celllist
end_procedure
procedure ReadDefinitionXml integer hoNode
integer hoChildNode
string lsValue
get FindNode of hoNode "tabledata" to hoChildNode
if hoChildNode begin
get ChildNodeValue of hoChildNode "class" to lsValue
set psTableClass to lsValue
get ChildNodeValue of hoChildNode "style" to lsValue
set psTableStyle to lsValue
get ChildNodeValue of hoChildNode "border" to lsValue
set psBorder to lsValue
get ChildNodeValue of hoChildNode "cellspacing" to lsValue
set psCellSpacing to lsValue
get ChildNodeValue of hoChildNode "cellpadding" to lsValue
set psCellPadding to lsValue
get ChildNodeValue of hoChildNode "width" to lsValue
set psWidth to lsValue
send destroy of hoChildNode
end
get FindNode of hoNode "columnlist" to hoChildNode
if hoChildNode begin
send ReadXml hoChildNode
send destroy of hoChildNode
end
get FindNode of hoNode "celllist" to hoChildNode
if hoChildNode begin
send ReadXml of oCells hoChildNode
send destroy of hoChildNode
end
end_procedure
end_class // WebLayoutTable
// --- Layout based on XHTML sequence --------------------------------------------------
class WebLayoutSequence is a cXmlSequence // cXmlSequence is defined in xmlbuilder.nui
procedure construct_object
forward send construct_object
property string psLayoutName public ""
property integer piPurpose public LAYOUTPURPOSE_UNKNOWN
property integer piType public LAYOUTTYPE_SEQ // Don't change this
property integer priv.hCallbackObj
property integer priv.hCallbackMsg
end_procedure
procedure DoReset // Table
set psLayoutName to ""
set piPurpose to LAYOUTPURPOSE_UNKNOWN
forward send DoReset
end_procedure
procedure DoWriteHtml integer lhMsg integer liCallbackObj integer lhParamArray // <--Last parameter is optional
integer lhParams
if num_arguments gt 2 move lhParamArray to lhParams
else move 0 to lhParams
ifnot liCallbackObj move self to liCallbackObj
ifnot lhMsg move MSG_OnWriteCell to lhMsg
set priv.hCallbackObj to liCallbackObj
set priv.hCallbackMsg to lhMsg
send DoWriteXml lhParams ghWebAppHtmlBuilder
end_procedure
procedure OnWriteCell string lsLabel integer liAux
send XHTML_Add_Closed_Element "span" (lsLabel+" ("+string(liAux)+")")
end_procedure
procedure OnWriteSubSequence string lsLabel integer liAux integer lhBuilder
integer liCallbackObj lhMsg
get priv.hCallbackObj to liCallbackObj
get priv.hCallbackMsg to lhMsg
send lhMsg of liCallbackObj lsLabel liAux // OnWriteCell
end_procedure
procedure WriteDefinitionXml
integer lhBuilder
move oItemPropertyArrayXmlBuilder to lhBuilder
send add_open_element of lhBuilder "seqlist"
send WriteXml
send close_element of lhBuilder // seqlist
end_procedure
procedure ReadDefinitionXml integer hoNode
end_procedure
end_class // WebLayoutSequence
// // Adds the contents of the lhLayout object to the DOM builder
// procedure WebXmlLayoutAddToDOM global integer lhLayout
// integer lhBuilder
// move oItemPropertyArrayXmlBuilder to lhBuilder
// send add_open_element of lhBuilder "layout"
// send add_closed_element of lhBuilder "type" (psXmlTag.i(WebLayoutTypes,piType(lhLayout)))
// send add_closed_element of lhBuilder "name" (psLayoutName(lhLayout))
// send add_closed_element of lhBuilder "purpose" (psXmlTag.i(oWebLayoutPurposes,piPurpose(lhLayout)))
// send WriteDefinitionXml of lhLayout
// send close_element of lhBuilder // "layout"
// end_procedure
//
// // Writes the contents of the lhLayout object to the file implicitly indicated
// // by the lsFileRoot parameter.
// function WebXmlLayoutSaveToFile global string lsFileRoot integer lhLayout returns boolean
// boolean lbRval
// integer lhBuilder
// move oItemPropertyArrayXmlBuilder to lhBuilder
// if (WebXmlSaveBegin(lsFileRoot,WA1P_XML_LAYOUT)) begin
// send WebXmlLayoutAddToDOM lhLayout
// send WebXmlSaveEnd
// move true to lbRval
// end
// else move false to lbRval
// function_return lbRval
// end_function
//
// procedure WebXmlLayoutReadFromDOM global integer lhLayout integer lhNode
// string lsName lsPurpose
// integer liPurpose
// get ChildNodeValue of lhNode "name" to lsName
// get ChildNodeValue of lhNode "purpose" to lsPurpose
// get sTagToPurposeId of oWebLayoutPurposes lsPurpose to liPurpose
// set psLayoutName of lhLayout to lsName
// set piPurpose of lhLayout to liPurpose
// send ReadDefinitionXml of lhLayout lhNode
// end_procedure
//
// function WebXmlLayoutReadFromFile global string lsFileRoot integer lhLayout returns integer
// boolean lbRval
// integer lhNode liType hoChildNode
// string lsType
// get WebXmlOpenBegin lsFileRoot WA1P_XML_LAYOUT to lhNode
// if lhNode begin
// get FindNode of lhNode "layout" to hoChildNode
// if hoChildNode begin
// get ChildNodeValue of hoChildNode "type" to lsType
// get sTagToTypeId of WebLayoutTypes lsType to liType
//
// if (liType=piType(lhLayout)) begin
// send DoReset of lhLayout
// send WebXmlLayoutReadFromDOM lhLayout hoChildNode
// end
// else error 331 "Layout type not matching that of target object"
// send destroy of hoChildNode
// end
// else error 332 "Layout specification not found"
//
// send WebXmlOpenEnd
// move true to lbRval
// end
// else move false to lbRval
// function_return lbRval
// end_function
//
//
//
//
//
//
//
//
//
//
//
//
//