MODULE WebComplex;
IMPORT DynamicWebpage, WebStd, HTTPSupport, PrevalenceSystem, XML, Strings, KernelLog;
CONST
WebForumNormalCell* = 0;
WebForumDetailViewCell* = 1;
WebForumEditViewCell* = 2;
WebForumDeleteCell* = 3;
WebForumSubInsertViewCell* = 4;
WebForumOverviewState = 0;
WebForumDetailViewState = 1;
WebForumEditViewState = 2;
WebForumInsertViewState = 3;
WebForumStandardBackLabel = "Back";
WebForumStandardEmptyList = "no entries";
WebForumStandardInsertText = "insert a new entry";
WebForumStandardSubmitLabel = "Save";
WebForumStdUnapplySortLabel = "unapply sorting";
WebForumStdUnapplyFilterLabel = "unapply search filter";
TYPE
TableCell* = OBJECT
VAR
content*: XML.Content;
modus*: LONGINT;
PROCEDURE &Init*(cellContent: XML.Content; cellModus: LONGINT);
BEGIN content := cellContent; modus := cellModus
END Init;
END TableCell;
HeaderCell* = OBJECT
VAR
content*: XML.Content;
compareFunction*: WebStd.PersistentDataCompare;
PROCEDURE &Init*(cellContent: XML.Content; compFunc: WebStd.PersistentDataCompare);
BEGIN
content := cellContent; compareFunction := compFunc
END Init;
END HeaderCell;
TableRow* = POINTER TO ARRAY OF TableCell;
HeaderRow* = POINTER TO ARRAY OF HeaderCell;
WebForumEntry* = OBJECT (WebStd.PersistentDataObject)
VAR
subEntries*: WebStd.PersistentDataContainer;
superEntry*: WebForumEntry;
PROCEDURE Internalize*(input: XML.Content);
VAR container: XML.Container; elem: XML.Element; oidStr: Strings.String;
persObj: PrevalenceSystem.PersistentObject; oidNr: LONGINT;
BEGIN
container := input(XML.Container);
elem := WebStd.GetXMLSubElement(container, "SubEntries");
subEntries := NIL;
IF (elem # NIL) THEN
oidStr := WebStd.GetXMLCharContent(elem);
IF (oidStr # NIL) THEN
Strings.StrToInt(oidStr^, oidNr);
persObj := PrevalenceSystem.GetPersistentObject(oidNr);
IF ((persObj # NIL) & (persObj IS WebStd.PersistentDataContainer)) THEN
subEntries := persObj(WebStd.PersistentDataContainer)
ELSE
HALT(9999)
END
END
END;
elem := WebStd.GetXMLSubElement(container, "SuperEntry");
superEntry := NIL;
IF (elem # NIL) THEN
oidStr := WebStd.GetXMLCharContent(elem);
IF (oidStr # NIL) THEN
Strings.StrToInt(oidStr^, oidNr);
persObj := PrevalenceSystem.GetPersistentObject(oidNr);
IF ((persObj # NIL) & (persObj IS WebForumEntry)) THEN
superEntry := persObj(WebForumEntry)
ELSE
HALT(9999)
END
END
END
END Internalize;
PROCEDURE Externalize*() : XML.Content;
VAR container: XML.Container; elem: XML.Element; oidStr: ARRAY 14 OF CHAR;
BEGIN
NEW(container);
IF (subEntries # NIL) THEN
NEW(elem); elem.SetName("SubEntries");
Strings.IntToStr(subEntries.oid, oidStr);
WebStd.AppendXMLContent(elem, WebStd.CreateXMLText(oidStr));
container.AddContent(elem)
END;
IF (superEntry # NIL) THEN
NEW(elem); elem.SetName("SuperEntry");
Strings.IntToStr(superEntry.oid, oidStr);
WebStd.AppendXMLContent(elem, WebStd.CreateXMLText(oidStr));
container.AddContent(elem)
END;
RETURN container
END Externalize;
PROCEDURE &Init*;
BEGIN subEntries := NIL; superEntry := NIL
END Init;
PROCEDURE GetReferrencedObjects*() : PrevalenceSystem.PersistentObjectList;
VAR list: PrevalenceSystem.PersistentObjectList; count, pos: LONGINT;
BEGIN
count := 0;
IF (subEntries # NIL) THEN INC(count) END;
IF (superEntry # NIL) THEN INC(count) END;
IF (count > 0) THEN
NEW(list, count); pos := 0;
IF (subEntries # NIL) THEN list[pos] := subEntries; INC(pos) END;
IF (superEntry # NIL) THEN list[pos] := superEntry; INC(pos) END;
RETURN list
ELSE
RETURN NIL
END
END GetReferrencedObjects;
PROCEDURE TableView*(forum: WebForum; request: HTTPSupport.HTTPRequest) : TableRow;
BEGIN HALT(309)
END TableView;
PROCEDURE DetailView*(forum: WebForum; request: HTTPSupport.HTTPRequest) : XML.Content;
BEGIN HALT(309);
END DetailView;
PROCEDURE EditView*(forum: WebForum; request: HTTPSupport.HTTPRequest) : XML.Content;
BEGIN HALT(309);
END EditView;
PROCEDURE ToXML*(request: HTTPSupport.HTTPRequest) : XML.Content;
VAR container: XML.Container; td: XML.Element;
BEGIN
IF (superEntry = NIL) THEN
NEW(container);
NEW(td); td.SetName("td"); container.AddContent(td);
RecursiveToXML(0, request, td, SELF);
RETURN container
ELSE
RETURN NIL
END
END ToXML;
PROCEDURE RecursiveToXML(depth: LONGINT; request: HTTPSupport.HTTPRequest;
container: XML.Container; entry: WebForumEntry);
VAR indent: Strings.String; row: TableRow; td, tr: XML.Element; i: LONGINT; content: XML.Content;
list: WebStd.PersistentDataObjectList; subEntry: WebForumEntry;
BEGIN
row := entry.TableView(NIL, request);
IF (row # NIL) THEN
NEW(tr); tr.SetName("tr");
container.AddContent(tr);
FOR i := 0 TO LEN(row)-1 DO
IF ((row[i] # NIL) & (row[i].modus # WebForumEditViewCell) & (row[i].modus # WebForumDeleteCell)
& (row[i].modus # WebForumSubInsertViewCell)) THEN
content := row[i].content;
NEW(td); td.SetName("td");
IF ((i = 0) & (depth > 0)) THEN
NEW(indent, depth+1);
FOR i := 0 TO depth DO
indent[i] := "-";
END; indent[depth] := 0X;
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(indent^))
END;
WebStd.AppendXMLContent(td, content);
tr.AddContent(td)
END
END
END;
IF (entry.subEntries # NIL) THEN
list := entry.subEntries.GetElementList(WebStd.DefaultPersistentDataFilter, NIL);
IF (list # NIL) THEN
FOR i := 0 TO LEN(list)-1 DO
IF (list[i] IS WebForumEntry) THEN
subEntry := list[i](WebForumEntry);
RecursiveToXML(depth+1, request, container, subEntry)
END
END
END
END
END RecursiveToXML;
END WebForumEntry;
WebForum* = OBJECT (DynamicWebpage.StateFullActiveElement);
VAR
allowEdit*, allowInsert*, allowDelete*: BOOLEAN;
state: LONGINT;
pos: LONGINT;
containerName: Strings.String;
objectId: Strings.String;
entryOid: LONGINT;
statusContent: XML.Content;
superEntryOid: LONGINT;
compareFunct: WebStd.PersistentDataCompare;
isOrderingApplied: BOOLEAN;
filterFunct: WebStd.PersistentDataFilter;
isFilterApplied: BOOLEAN;
prevSys: PrevalenceSystem.PrevalenceSystem;
PROCEDURE &Init*;
BEGIN
ReInitialize
END Init;
PROCEDURE ReInitialize*;
BEGIN
state := WebForumOverviewState; pos := 0;
allowEdit := FALSE; allowInsert := FALSE; allowDelete := FALSE;
compareFunct := GetDefaultOrdering();
filterFunct := GetDefaultSearchFilter();
isOrderingApplied := FALSE; isFilterApplied := FALSE
END ReInitialize;
PROCEDURE RootEntryFilter(obj: WebStd.PersistentDataObject) : BOOLEAN;
VAR entry: WebForumEntry;
BEGIN
IF (obj IS WebForumEntry) THEN
entry := obj(WebForumEntry);
IF (entry.superEntry = NIL) THEN
RETURN TRUE
END
END;
RETURN FALSE
END RootEntryFilter;
PROCEDURE Transform*(input: XML.Element; request: HTTPSupport.HTTPRequest) : XML.Content;
VAR persCont: WebStd.PersistentDataContainer; prevSysName, reInitStr: Strings.String;
BEGIN
reInitStr := input.GetAttributeValue("reinitialize");
IF ((reInitStr # NIL) & (reInitStr^ = "true")) THEN
ReInitialize
END;
containerName := input.GetAttributeValue("containername");
prevSysName := input.GetAttributeValue("prevalencesystem");
objectId := input.GetAttributeValue(DynamicWebpage.XMLAttributeObjectIdName);
IF (prevSysName # NIL) THEN
prevSys := PrevalenceSystem.GetPrevalenceSystem(prevSysName^)
ELSE
prevSys := PrevalenceSystem.standardPrevalenceSystem
END;
allowEdit := IsAccessGranted(input, "Edit");
allowInsert := IsAccessGranted(input, "Insert");
allowDelete := IsAccessGranted(input, "Delete");
IF ((containerName # NIL) & (prevSys # NIL)) THEN
persCont := WebStd.GetPersistentDataContainer(prevSys, containerName^);
IF (persCont # NIL) THEN
IF (state = WebForumOverviewState) THEN
RETURN GetMainOverview(persCont, input, request)
ELSIF (state = WebForumDetailViewState) THEN
RETURN GetMainDetailView(persCont, input, request)
ELSIF (state = WebForumEditViewState) THEN
RETURN GetMainEditView(persCont, input, request)
ELSIF (state = WebForumInsertViewState) THEN
RETURN GetMainInsertView(persCont, input, request)
ELSE
RETURN WebStd.CreateXMLText("WebComplex:WebForum: invalid state")
END
ELSE
RETURN WebStd.CreateXMLText("WebComplex:WebForum: unable to create a persistent data container.")
END
ELSIF (containerName = NIL) THEN
RETURN WebStd.CreateXMLText("Missing attribute 'containername' for a subclass of WebComplex:WebForum.")
ELSE
RETURN WebStd.CreateXMLText("The specified prevalence system for a subclass of WebComplex:WebForum is not present.")
END
END Transform;
PROCEDURE GetMainOverview(persCont: WebStd.PersistentDataContainer; input: XML.Element;
request: HTTPSupport.HTTPRequest) : XML.Content;
VAR table, tr, td, paging, eventButton, eventLink, eventParam, label, pTag, searching: XML.Element;
content: XML.Content; pagingSizeStr, labelName, buttonLabelName, moduleName, objectName: Strings.String;
pagingSize, index, listPos, columns, k, l: LONGINT; persObjList: WebStd.PersistentDataObjectList;
persObj: WebStd.PersistentDataObject; entryObj: WebForumEntry; colString, posString, tableNoStr: ARRAY 14 OF CHAR;
headerRow: HeaderRow; headerCell: HeaderCell; container: XML.Container;
BEGIN
persObjList := persCont.GetElementList(RootEntryFilter, compareFunct);
moduleName := ThisModuleName();
objectName := ThisObjectName();
NEW(container);
WebStd.AppendXMLContent(container, GetHeaderXMLContent(persCont, input, request));
AddStatusMessage(container);
IF (allowInsert) THEN
NEW(pTag); pTag.SetName("p");
NEW(eventLink); eventLink.SetName("WebStd:EventLink");
eventLink.SetAttributeValue("xmlns:WebStd", "WebStd");
NEW(label); label.SetName("Label");
labelName := GetInsertLinkLabel(request);
WebStd.AppendXMLContent(label, WebStd.CreateXMLText(labelName^));
eventLink.AddContent(label);
eventLink.SetAttributeValue("method", "SetInsertView");
eventLink.SetAttributeValue("object", objectName^);
eventLink.SetAttributeValue("module", moduleName^);
eventLink.SetAttributeValue("objectid", objectId^);
pTag.AddContent(eventLink);
container.AddContent(pTag)
END;
index := 0;
IF (persObjList # NIL) THEN
NEW(pTag); pTag.SetName("p");
container.AddContent(pTag);
IF ((filterFunct = NIL) OR (~isFilterApplied)) THEN
searching := WebStd.GetXMLSubElement(input, "Searching");
IF (searching # NIL) THEN
labelName := searching.GetAttributeValue("label");
buttonLabelName := searching.GetAttributeValue("buttonname");
WebStd.AppendXMLContent(pTag, GetSearchFormular(labelName, buttonLabelName));
END
ELSE
NEW(eventLink); eventLink.SetName("WebStd:EventLink");
eventLink.SetAttributeValue("xmlns:WebStd", "WebStd");
NEW(label); label.SetName("Label");
labelName := GetUnapplyFilterLabel(request);
WebStd.AppendXMLContent(label, WebStd.CreateXMLText(labelName^));
eventLink.AddContent(label);
eventLink.SetAttributeValue("method", "SetSearchFilter");
eventLink.SetAttributeValue("object", objectName^);
eventLink.SetAttributeValue("module", moduleName^);
eventLink.SetAttributeValue("objectid", objectId^);
pTag.AddContent(eventLink);
END;
IF (isOrderingApplied) THEN
NEW(eventLink); eventLink.SetName("WebStd:EventLink");
eventLink.SetAttributeValue("xmlns:WebStd", "WebStd");
NEW(label); label.SetName("Label");
labelName := GetUnapplySortLabel(request);
WebStd.AppendXMLContent(label, WebStd.CreateXMLText(labelName^));
eventLink.AddContent(label);
eventLink.SetAttributeValue("method", "SetOrdering");
eventLink.SetAttributeValue("object", objectName^);
eventLink.SetAttributeValue("module", moduleName^);
eventLink.SetAttributeValue("objectid", objectId^);
pTag.AddContent(eventLink);
END;
NEW(table); table.SetName("table");
headerRow := GetTableHeader(request);
IF (headerRow # NIL) THEN
NEW(tr); tr.SetName("tr");
FOR k := 0 TO LEN(headerRow)-1 DO
headerCell := headerRow[k];
IF (headerCell # NIL) THEN
NEW(td); td.SetName("td");
IF (headerCell.compareFunction # NIL) THEN
Strings.IntToStr(k, tableNoStr);
NEW(eventLink); eventLink.SetName("WebStd:EventLink");
eventLink.SetAttributeValue("xmlns:WebStd", "WebStd");
NEW(label); label.SetName("Label");
WebStd.AppendXMLContent(label, headerCell.content);
eventLink.AddContent(label);
eventLink.SetAttributeValue("method", "SetOrdering");
eventLink.SetAttributeValue("object", objectName^);
eventLink.SetAttributeValue("module", moduleName^);
eventLink.SetAttributeValue("objectid", objectId^);
NEW(eventParam); eventParam.SetName("Param");
eventParam.SetAttributeValue("name", "tableno");
eventParam.SetAttributeValue("value", tableNoStr);
eventLink.AddContent(eventParam);
td.AddContent(eventLink)
ELSE
WebStd.AppendXMLContent(td, headerCell.content);
END;
tr.AddContent(td)
END
END;
table.AddContent(tr)
END;
paging := WebStd.GetXMLSubElement(input, "Paging");
IF (paging # NIL) THEN
pagingSizeStr := paging.GetAttributeValue("size");
IF (pagingSizeStr # NIL) THEN
Strings.StrToInt(pagingSizeStr^, pagingSize)
END
ELSE
pagingSize := MAX(LONGINT)
END;
columns := 0;
index := 0; listPos := 0;
WHILE ((listPos < LEN(persObjList)) & (index < pos + pagingSize)) DO
persObj := persObjList[listPos];
IF ((filterFunct = NIL) OR (filterFunct(persObj))) THEN
IF (index >= pos) THEN
IF (persObj IS WebForumEntry) THEN
entryObj := persObj(WebForumEntry);
l := RecursiveEntryOverview(0, table, entryObj, request, moduleName, objectName);
IF (l > columns) THEN columns := l END;
ELSE
NEW(td); td.SetName("td");
WebStd.AppendXMLContent(td, WebStd.CreateXMLText("Object is not of type WebForumEntry"));
tr.AddContent(td);
table.AddContent(tr)
END;
END;
INC(index)
END;
INC(listPos)
END;
IF ((paging # NIL) & ((pos > 0) OR (listPos < LEN(persObjList)))) THEN
NEW(tr); tr.SetName("tr");
Strings.IntToStr(columns-1, colString);
NEW(td); td.SetName("td");
tr.AddContent(td);
IF (pos > 0) THEN
labelName := paging.GetAttributeValue("previouslabel");
Strings.IntToStr(pos-pagingSize, posString);
NEW(eventButton); eventButton.SetName("WebStd:EventButton");
eventButton.SetAttributeValue("xmlns:WebStd", "WebStd");
IF (labelName # NIL) THEN
eventButton.SetAttributeValue("label", labelName^)
ELSE
eventButton.SetAttributeValue("label", "back")
END;
eventButton.SetAttributeValue("method", "SetPos");
eventButton.SetAttributeValue("object", objectName^);
eventButton.SetAttributeValue("module", moduleName^);
eventButton.SetAttributeValue("objectid", objectId^);
NEW(eventParam); eventParam.SetName("Param");
eventParam.SetAttributeValue("name", "pos");
eventParam.SetAttributeValue("value", posString);
eventButton.AddContent(eventParam);
td.AddContent(eventButton)
ELSE
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(" "))
END;
NEW(td); td.SetName("td"); td.SetAttributeValue("colspan", colString);
tr.AddContent(td);
IF (listPos < LEN(persObjList)) THEN
labelName := paging.GetAttributeValue("nextlabel");
Strings.IntToStr(pos+pagingSize, posString);
NEW(eventButton); eventButton.SetName("WebStd:EventButton");
eventButton.SetAttributeValue("xmlns:WebStd", "WebStd");
IF (labelName # NIL) THEN
eventButton.SetAttributeValue("label", labelName^)
ELSE
eventButton.SetAttributeValue("label", "next")
END;
eventButton.SetAttributeValue("method", "SetPos");
eventButton.SetAttributeValue("object", objectName^);
eventButton.SetAttributeValue("module", moduleName^);
eventButton.SetAttributeValue("objectid", objectId^);
NEW(eventParam); eventParam.SetName("Param");
eventParam.SetAttributeValue("name", "pos");
eventParam.SetAttributeValue("value", posString);
eventButton.AddContent(eventParam);
td.AddContent(eventButton)
ELSE
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(" "))
END;
table.AddContent(tr)
END;
IF (index > 0) THEN
container.AddContent(table)
END
END;
IF (index = 0) THEN
content := GetEmptyListMessage(request);
WebStd.AppendXMLContent(container, content)
END;
RETURN container
END GetMainOverview;
PROCEDURE RecursiveEntryOverview(depth: LONGINT; table: XML.Element; entryObj: WebForumEntry;
request: HTTPSupport.HTTPRequest; moduleName, objectName: Strings.String) : LONGINT;
VAR row: TableRow; cell: TableCell; columns, k, l, i: LONGINT; tr, td, eventLink, eventParam, label: XML.Element;
oidString: ARRAY 14 OF CHAR; list: WebStd.PersistentDataObjectList; subEntry: WebForumEntry;
BEGIN
row := entryObj.TableView(SELF, request);
columns := 0;
IF (row # NIL) THEN
columns := LEN(row);
NEW(tr); tr.SetName("tr");
FOR k := 0 TO LEN(row)-1 DO
cell := row[k];
IF (cell # NIL) THEN
NEW(td); td.SetName("td");
IF ((k = 0) & (depth > 0)) THEN
WebStd.AppendXMLContent(td, GetIndent(depth, request))
END;
IF ((cell.modus = WebForumDetailViewCell) OR (allowEdit & (cell.modus = WebForumEditViewCell)) OR
(allowDelete & (cell.modus = WebForumDeleteCell)) OR
(allowInsert & (cell.modus = WebForumSubInsertViewCell))) THEN
Strings.IntToStr(entryObj.oid, oidString);
NEW(eventLink); eventLink.SetName("WebStd:EventLink");
eventLink.SetAttributeValue("xmlns:WebStd", "WebStd");
NEW(label); label.SetName("Label");
WebStd.AppendXMLContent(label, cell.content);
eventLink.AddContent(label);
IF (cell.modus = WebForumDetailViewCell) THEN
eventLink.SetAttributeValue("method", "SetDetailView")
ELSIF (cell.modus = WebForumEditViewCell) THEN
eventLink.SetAttributeValue("method", "SetEditView")
ELSIF (cell.modus = WebForumDeleteCell) THEN
eventLink.SetAttributeValue("method", "DeleteEntry")
ELSE
eventLink.SetAttributeValue("method", "SetInsertView");
END;
eventLink.SetAttributeValue("object", objectName^);
eventLink.SetAttributeValue("module", moduleName^);
eventLink.SetAttributeValue("objectid", objectId^);
NEW(eventParam); eventParam.SetName("Param");
eventParam.SetAttributeValue("name", "oid");
eventParam.SetAttributeValue("value", oidString);
eventLink.AddContent(eventParam);
td.AddContent(eventLink)
ELSIF (cell.modus = WebForumNormalCell) THEN
WebStd.AppendXMLContent(td, cell.content);
ELSE
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(" "));
END;
tr.AddContent(td)
END
END;
table.AddContent(tr)
END;
IF (entryObj.subEntries # NIL) THEN
list := entryObj.subEntries.GetElementList(WebStd.DefaultPersistentDataFilter, compareFunct);
IF (list # NIL) THEN
FOR i := 0 TO LEN(list)-1 DO
IF (list[i] IS WebForumEntry) THEN
subEntry := list[i](WebForumEntry);
l := RecursiveEntryOverview(depth+1, table, subEntry, request, moduleName, objectName);
IF (l > columns) THEN columns := l END
END
END
END
END;
RETURN columns
END RecursiveEntryOverview;
PROCEDURE GetSearchFormular(labelName, buttonName: Strings.String) : XML.Content;
VAR table, tr, td, htmlInput, formular: XML.Element;
moduleName, objectName: Strings.String;
BEGIN
moduleName := ThisModuleName();
objectName := ThisObjectName();
NEW(table); table.SetName("table");
NEW(tr); tr.SetName("tr");
table.AddContent(tr);
NEW(td); td.SetName("td");
tr.AddContent(td);
IF (labelName # NIL) THEN
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(labelName^))
ELSE
WebStd.AppendXMLContent(td, WebStd.CreateXMLText("Search: "))
END;
NEW(td); td.SetName("td");
tr.AddContent(td);
NEW(formular); formular.SetName("WebStd:Formular");
formular.SetAttributeValue("xmlns:WebStd", "WebStd");
formular.SetAttributeValue("method", "SetSearchFilter");
formular.SetAttributeValue("object", objectName^);
formular.SetAttributeValue("module", moduleName^);
formular.SetAttributeValue("objectid", objectId^);
NEW(htmlInput); htmlInput.SetName("input");
htmlInput.SetAttributeValue("type", "text");
htmlInput.SetAttributeValue("size", "40");
htmlInput.SetAttributeValue("name", "text");
formular.AddContent(htmlInput);
NEW(htmlInput); htmlInput.SetName("input");
htmlInput.SetAttributeValue("type", "submit");
htmlInput.SetAttributeValue("name", "searchsubmit");
IF (buttonName # NIL) THEN
htmlInput.SetAttributeValue("value", buttonName^)
ELSE
htmlInput.SetAttributeValue("value", "Go")
END;
formular.AddContent(htmlInput);
td.AddContent(formular);
RETURN table
END GetSearchFormular;
PROCEDURE AddStatusMessage(container: XML.Container);
BEGIN
IF (statusContent # NIL) THEN
WebStd.AppendXMLContent(container, statusContent);
statusContent := NIL
END;
END AddStatusMessage;
PROCEDURE GetMainDetailView(persCont: WebStd.PersistentDataContainer; input: XML.Element;
request: HTTPSupport.HTTPRequest) : XML.Content;
VAR persObj: WebStd.PersistentDataObject; container: XML.Container; list: WebStd.PersistentDataObjectList;
moduleName, objectName: Strings.String; entryObj, subEntry: WebForumEntry; content: XML.Content;
eventButton, table, tr, td: XML.Element; l, i: LONGINT; row: HeaderRow; cell: HeaderCell;
BEGIN
persObj := persCont.GetObjectByOid(entryOid);
moduleName := ThisModuleName();
objectName := ThisObjectName();
NEW(container);
IF ((persObj # NIL) & (persObj IS WebForumEntry)) THEN
entryObj := persObj(WebForumEntry);
content := entryObj.DetailView(SELF, request);
WebStd.AppendXMLContent(container, content);
IF (entryObj.subEntries # NIL) THEN
list := entryObj.subEntries.GetElementList(WebStd.DefaultPersistentDataFilter, compareFunct);
IF (list # NIL) THEN
NEW(table); table.SetName("table");
row := GetTableHeader(request);
IF (row # NIL) THEN
NEW(tr); tr.SetName("tr");
FOR i := 0 TO LEN(row)-1 DO
cell := row[i];
IF (cell # NIL) THEN
NEW(td); td.SetName("td");
WebStd.AppendXMLContent(td, cell.content);
tr.AddContent(td)
END
END;
table.AddContent(tr)
END;
FOR i := 0 TO LEN(list)-1 DO
IF (list[i] IS WebForumEntry) THEN
subEntry := list[i](WebForumEntry);
l := RecursiveEntryOverview(1, table, subEntry, request, moduleName, objectName);
END
END;
container.AddContent(table)
END
END;
eventButton := GetBackButton(input, request);
container.AddContent(eventButton)
ELSE
WebStd.AppendXMLContent(container, WebStd.CreateXMLText("object is not present"));
END;
RETURN container
END GetMainDetailView;
PROCEDURE GetMainEditView(persCont: WebStd.PersistentDataContainer; input: XML.Element;
request: HTTPSupport.HTTPRequest) : XML.Content;
VAR persObj: WebStd.PersistentDataObject; container: XML.Container; entryObj: WebForumEntry;
content: XML.Content; eventButton, submitButton, formular, htmlInput: XML.Element;
moduleName, objectName: Strings.String; oidString: ARRAY 14 OF CHAR;
BEGIN
moduleName := ThisModuleName();
objectName := ThisObjectName();
persObj := persCont.GetObjectByOid(entryOid);
NEW(container);
AddStatusMessage(container);
IF (allowEdit) THEN
IF ((persObj # NIL) & (persObj IS WebForumEntry)) THEN
entryObj := persObj(WebForumEntry);
Strings.IntToStr(entryObj.oid, oidString);
NEW(formular); formular.SetName("WebStd:Formular");
formular.SetAttributeValue("xmlns:WebStd", "WebStd");
formular.SetAttributeValue("method", "UpdateEditEntry");
formular.SetAttributeValue("object", objectName^);
formular.SetAttributeValue("module", moduleName^);
formular.SetAttributeValue("objectid", objectId^);
NEW(htmlInput); htmlInput.SetName("input");
htmlInput.SetAttributeValue("type", "hidden");
htmlInput.SetAttributeValue("name", "oid");
htmlInput.SetAttributeValue("value", oidString);
formular.AddContent(htmlInput);
content := entryObj.EditView(SELF, request);
WebStd.AppendXMLContent(formular, content);
submitButton := GetSubmitButton(request);
formular.AddContent(submitButton);
eventButton := GetInputBackButton(request);
formular.AddContent(eventButton);
container.AddContent(formular)
ELSE
WebStd.AppendXMLContent(container, WebStd.CreateXMLText("object is not present"))
END
ELSE
WebStd.AppendXMLContent(container, WebStd.CreateXMLText("Access forbidden."))
END;
RETURN container
END GetMainEditView;
PROCEDURE GetMainInsertView(persCont: WebStd.PersistentDataContainer; input: XML.Element;
request: HTTPSupport.HTTPRequest) : XML.Content;
VAR container: XML.Container; content: XML.Content; eventButton, submitButton, formular : XML.Element;
moduleName, objectName: Strings.String; superEntry: WebForumEntry; persObj: WebStd.PersistentDataObject;
BEGIN
moduleName := ThisModuleName();
objectName := ThisObjectName();
NEW(container);
AddStatusMessage(container);
IF (allowInsert) THEN
superEntry := NIL;
IF (superEntryOid # 0) THEN
persObj := persCont.GetObjectByOid(superEntryOid);
IF ((persObj # NIL) & (persObj IS WebForumEntry)) THEN
superEntry := persObj(WebForumEntry)
END
END;
NEW(formular); formular.SetName("WebStd:Formular");
formular.SetAttributeValue("xmlns:WebStd", "WebStd");
formular.SetAttributeValue("method", "InsertEditEntry");
formular.SetAttributeValue("object", objectName^);
formular.SetAttributeValue("module", moduleName^);
formular.SetAttributeValue("objectid", objectId^);
content := GetInsertView(superEntry, request);
WebStd.AppendXMLContent(formular, content);
submitButton := GetSubmitButton(request);
formular.AddContent(submitButton);
eventButton := GetInputBackButton(request);
formular.AddContent(eventButton);
container.AddContent(formular)
ELSE
WebStd.AppendXMLContent(container, WebStd.CreateXMLText("Access forbidden."))
END;
RETURN container
END GetMainInsertView;
PROCEDURE IsAccessGranted(input: XML.Element; type: ARRAY OF CHAR) : BOOLEAN;
VAR granted: BOOLEAN; accessConstraint, typeElem, grantedElem: XML.Element;
BEGIN
granted := TRUE;
accessConstraint := WebStd.GetXMLSubElement(input, "AccessConstraint");
IF (accessConstraint # NIL) THEN
typeElem := WebStd.GetXMLSubElement(accessConstraint, type);
IF (typeElem # NIL) THEN
grantedElem := WebStd.GetXMLSubElement(typeElem, "Granted");
IF (grantedElem # NIL) THEN
granted := TRUE
ELSE
granted := FALSE
END
END
END;
RETURN granted
END IsAccessGranted;
PROCEDURE GetBackButton(input: XML.Element; request: HTTPSupport.HTTPRequest) : XML.Element;
VAR eventButton: XML.Element; labelName: Strings.String;
moduleName, objectName: Strings.String;
BEGIN
moduleName := ThisModuleName();
objectName := ThisObjectName();
labelName := GetBackButtonLabel(request);
NEW(eventButton); eventButton.SetName("WebStd:EventButton");
eventButton.SetAttributeValue("xmlns:WebStd", "WebStd");
eventButton.SetAttributeValue("label", labelName^);
eventButton.SetAttributeValue("method", "SetOverview");
eventButton.SetAttributeValue("object", objectName^);
eventButton.SetAttributeValue("module", moduleName^);
eventButton.SetAttributeValue("objectid", objectId^);
RETURN eventButton
END GetBackButton;
PROCEDURE GetInputBackButton(request: HTTPSupport.HTTPRequest) : XML.Element;
VAR input: XML.Element; labelName: Strings.String;
BEGIN
labelName := GetBackButtonLabel(request);
NEW(input); input.SetName("input");
input.SetAttributeValue("type", "submit");
input.SetAttributeValue("name", "backbutton");
input.SetAttributeValue("value", labelName^);
RETURN input
END GetInputBackButton;
PROCEDURE GetSubmitButton(request: HTTPSupport.HTTPRequest) : XML.Element;
VAR input: XML.Element; labelName: Strings.String;
BEGIN
labelName := GetSubmitButtonLabel(request);
NEW(input); input.SetName("input");
input.SetAttributeValue("type", "submit");
input.SetAttributeValue("name", "submitbutton");
input.SetAttributeValue("value", labelName^);
RETURN input
END GetSubmitButton;
PROCEDURE SetPos(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR posString: Strings.String;
BEGIN
state := WebForumOverviewState;
posString := params.GetParameterValueByName("pos");
IF (posString # NIL) THEN
Strings.StrToInt(posString^, pos);
OnPositionChanged(pos, request)
ELSE
KernelLog.String("WebComplex:WebForum - event handler 'SetPos' has parameter 'pos'.");
KernelLog.Ln
END
END SetPos;
PROCEDURE SetDetailView(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR oidString: Strings.String;
BEGIN
oidString := params.GetParameterValueByName("oid");
IF (oidString # NIL) THEN
state := WebForumDetailViewState;
Strings.StrToInt(oidString^, entryOid);
OnDetailViewActivated(entryOid, request);
ELSE
KernelLog.String("WebComplex:WebForum - event handler 'SetDetailView' has parameter 'oid'.");
KernelLog.Ln
END
END SetDetailView;
PROCEDURE SetInsertView(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR parentStr: Strings.String;
BEGIN
IF (allowInsert) THEN
parentStr := params.GetParameterValueByName("oid");
IF (parentStr # NIL) THEN
Strings.StrToInt(parentStr^, superEntryOid);
OnInsertViewActivated(superEntryOid, request)
ELSE
superEntryOid := 0
END;
state := WebForumInsertViewState
END
END SetInsertView;
PROCEDURE SetEditView(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR oidString: Strings.String;
BEGIN
oidString := params.GetParameterValueByName("oid");
IF (allowEdit & (oidString # NIL)) THEN
state := WebForumEditViewState;
Strings.StrToInt(oidString^, entryOid);
OnEditViewActivated(entryOid, request)
ELSIF (oidString # NIL) THEN
KernelLog.String("WebComplex:WebForum - event handler 'SetEditView' has parameter 'oid'.");
KernelLog.Ln
END
END SetEditView;
PROCEDURE SetOrdering(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR tableNoString: Strings.String; tableNo: LONGINT; headerRow: HeaderRow;
BEGIN
state := WebForumOverviewState;
tableNoString := params.GetParameterValueByName("tableno");
IF (tableNoString # NIL) THEN
Strings.StrToInt(tableNoString^, tableNo);
headerRow := GetTableHeader(request);
IF ((headerRow # NIL) & (tableNo >= 0) & (tableNo < LEN(headerRow))) THEN
compareFunct := headerRow[tableNo].compareFunction;
isOrderingApplied := TRUE; pos := 0
END
ELSE
compareFunct := GetDefaultOrdering(); isOrderingApplied := FALSE; pos := 0
END
END SetOrdering;
PROCEDURE SetSearchFilter(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR text: Strings.String;
BEGIN
state := WebForumOverviewState;
text := params.GetParameterValueByName("text");
IF (text # NIL) THEN
filterFunct := GetSearchFilter(text);
isFilterApplied := TRUE
ELSE
filterFunct := GetDefaultSearchFilter();
isFilterApplied := FALSE
END;
pos := 0
END SetSearchFilter;
PROCEDURE DeleteEntry(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR oidString: Strings.String; oid: LONGINT; persObj: WebStd.PersistentDataObject;
persCont: WebStd.PersistentDataContainer; entry: WebForumEntry;
BEGIN
state := WebForumOverviewState;
oidString := params.GetParameterValueByName("oid");
IF (allowDelete & (oidString # NIL)) THEN
Strings.StrToInt(oidString^, oid);
IF (containerName # NIL) THEN
persCont := WebStd.GetPersistentDataContainer(prevSys, containerName^);
IF (persCont # NIL) THEN
persObj := persCont.GetObjectByOid(oid);
IF ((persObj # NIL) & (persObj IS WebForumEntry)) THEN
entry := persObj(WebForumEntry);
OnDelete(entry, request);
IF (entry.superEntry # NIL) THEN
IF (entry.superEntry.subEntries # NIL) THEN
entry.superEntry.subEntries.RemovePersistentDataObject(entry)
END
END;
DeleteRecursiveEntry(persCont, entry)
ELSE
statusContent := WebStd.CreateXMLText("object is not present");
END
ELSE
statusContent := WebStd.CreateXMLText("container is not present");
END
END
ELSE
KernelLog.String("WebComplex:WebForum - event handler 'DeleteEntry' has parameter 'oid'.");
KernelLog.Ln
END
END DeleteEntry;
PROCEDURE DeleteRecursiveEntry(persCont: WebStd.PersistentDataContainer; entry: WebForumEntry);
VAR list: WebStd.PersistentDataObjectList; i: LONGINT; subEntry: WebForumEntry;
BEGIN
persCont.RemovePersistentDataObject(entry);
IF (entry.subEntries # NIL) THEN
list := entry.subEntries.GetElementList(WebStd.DefaultPersistentDataFilter, NIL);
IF (list # NIL) THEN
FOR i := 0 TO LEN(list)-1 DO
IF (list[i] IS WebForumEntry) THEN
subEntry := list[i](WebForumEntry);
DeleteRecursiveEntry(persCont, subEntry)
END
END
END;
entry.BeginModification;
entry.subEntries := NIL;
entry.EndModification
END
END DeleteRecursiveEntry;
PROCEDURE SetOverview(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
BEGIN
state := WebForumOverviewState;
OnSetOverview(request)
END SetOverview;
PROCEDURE UpdateEditEntry(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR oid: LONGINT; oidString, buttonName: Strings.String; persObj: WebStd.PersistentDataObject;
obj: WebForumEntry; persCont: WebStd.PersistentDataContainer;
BEGIN
buttonName := params.GetParameterValueByName("backbutton");
IF (buttonName # NIL) THEN
SetOverview(request, params)
ELSE
oidString := params.GetParameterValueByName("oid");
IF (allowEdit & (oidString # NIL)) THEN
Strings.StrToInt(oidString^, oid);
IF (containerName # NIL) THEN
persCont := WebStd.GetPersistentDataContainer(prevSys, containerName^);
IF (persCont # NIL) THEN
persObj := persCont.GetObjectByOid(oid);
IF ((persObj # NIL) & (persObj IS WebForumEntry)) THEN
obj := persObj(WebForumEntry);
IF (UpdateObject(obj, request, params, statusContent)) THEN
state := WebForumOverviewState
END
ELSE
statusContent := WebStd.CreateXMLText("object is not present");
state := WebForumOverviewState
END
END
ELSE
statusContent := WebStd.CreateXMLText("container is not present");
state := WebForumOverviewState
END
ELSIF (oidString # NIL) THEN
KernelLog.String("WebComplex:WebForum - event handler 'UpdateEditEntry' has parameter 'oid'.");
KernelLog.Ln;
state := WebForumOverviewState
END
END
END UpdateEditEntry;
PROCEDURE InsertEditEntry(request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList);
VAR persCont: WebStd.PersistentDataContainer; buttonName: Strings.String;
persObj: WebStd.PersistentDataObject; superEntry: WebForumEntry;
BEGIN
buttonName := params.GetParameterValueByName("backbutton");
IF (buttonName # NIL) THEN
SetOverview(request, params)
ELSE
IF (allowInsert) THEN
IF (containerName # NIL) THEN
persCont := WebStd.GetPersistentDataContainer(prevSys, containerName^);
IF (persCont # NIL) THEN
superEntry := NIL;
IF (superEntryOid > 0) THEN
persObj := persCont.GetObjectByOid(superEntryOid);
IF ((persObj # NIL) & (persObj IS WebForumEntry)) THEN
superEntry := persObj(WebForumEntry)
END
END;
IF (InsertObject(persCont, superEntry, request, params, statusContent)) THEN
state := WebForumOverviewState
END;
END
ELSE
statusContent := WebStd.CreateXMLText("container is not present");
state := WebForumOverviewState
END;
ELSE
state := WebForumOverviewState
END
END
END InsertEditEntry;
PROCEDURE GetEventHandlers*() : DynamicWebpage.EventHandlerList;
VAR list, addList: DynamicWebpage.EventHandlerList; listLength, addListCount: LONGINT; i: LONGINT;
BEGIN
addList := GetAdditionalEventHandlers();
IF (addList # NIL) THEN
addListCount := LEN(addList)
ELSE
addListCount := 0
END;
listLength := 10;
NEW(list, listLength+ addListCount);
NEW(list[0], "SetPos", SetPos);
NEW(list[1], "SetDetailView", SetDetailView);
NEW(list[2], "SetEditView", SetEditView);
NEW(list[3], "DeleteEntry", DeleteEntry);
NEW(list[4], "SetOverview", SetOverview);
NEW(list[5], "UpdateEditEntry", UpdateEditEntry);
NEW(list[6], "SetInsertView", SetInsertView);
NEW(list[7], "InsertEditEntry", InsertEditEntry);
NEW(list[8], "SetOrdering", SetOrdering);
NEW(list[9], "SetSearchFilter", SetSearchFilter);
IF (addList # NIL) THEN
FOR i := 0 TO LEN(addList)-1 DO
list[listLength+i] := addList[i]
END
END;
RETURN list
END GetEventHandlers;
PROCEDURE GetAdditionalEventHandlers*() : DynamicWebpage.EventHandlerList;
BEGIN RETURN NIL
END GetAdditionalEventHandlers;
PROCEDURE GetHeaderXMLContent*(container: WebStd.PersistentDataContainer; input: XML.Element;
request: HTTPSupport.HTTPRequest) : XML.Content;
BEGIN RETURN NIL
END GetHeaderXMLContent;
PROCEDURE InsertObject*(container: WebStd.PersistentDataContainer; superEntry: WebForumEntry;
request: HTTPSupport.HTTPRequest; params: DynamicWebpage.ParameterList; VAR statusMsg: XML.Content) : BOOLEAN;
BEGIN HALT (309)
END InsertObject;
PROCEDURE UpdateObject*(obj: WebForumEntry; request: HTTPSupport.HTTPRequest;
params: DynamicWebpage.ParameterList; VAR statusMsg: XML.Content) : BOOLEAN;
BEGIN HALT (309)
END UpdateObject;
PROCEDURE OnPositionChanged*(pos: LONGINT; request: HTTPSupport.HTTPRequest);
END OnPositionChanged;
PROCEDURE OnInsertViewActivated*(superEntryOid: LONGINT; request: HTTPSupport.HTTPRequest);
END OnInsertViewActivated;
PROCEDURE OnEditViewActivated*(entryOid: LONGINT; request: HTTPSupport.HTTPRequest);
END OnEditViewActivated;
PROCEDURE OnSetOverview*(request: HTTPSupport.HTTPRequest);
END OnSetOverview;
PROCEDURE OnDetailViewActivated*(entryOid: LONGINT; request: HTTPSupport.HTTPRequest);
END OnDetailViewActivated;
PROCEDURE OnDelete*(obj: WebForumEntry; request: HTTPSupport.HTTPRequest);
END OnDelete;
PROCEDURE ThisObjectName*() : Strings.String;
BEGIN HALT(309)
END ThisObjectName;
PROCEDURE ThisModuleName*() : Strings.String;
BEGIN HALT(309)
END ThisModuleName;
PROCEDURE GetInsertView*(superEntry: WebForumEntry; request: HTTPSupport.HTTPRequest): XML.Content;
BEGIN HALT(309)
END GetInsertView;
PROCEDURE GetTableHeader*(request: HTTPSupport.HTTPRequest): HeaderRow;
BEGIN RETURN NIL
END GetTableHeader;
PROCEDURE GetIndent*(depth: LONGINT; request: HTTPSupport.HTTPRequest) : XML.Content;
VAR container: XML.Container; ch: ARRAY 5 OF CHAR; nbsp: XML.EntityRef; i: LONGINT;
BEGIN
IF (depth > 0) THEN
NEW(container);
FOR i := 0 TO 2*(depth-1) DO
NEW(nbsp); COPY("nbsp", ch); nbsp.SetName(ch);
container.AddContent(nbsp);
END;
WebStd.AppendXMLContent(container, WebStd.CreateXMLText("-> "));
RETURN container
END;
RETURN NIL
END GetIndent;
PROCEDURE GetDefaultOrdering*() : WebStd.PersistentDataCompare;
BEGIN RETURN NIL
END GetDefaultOrdering;
PROCEDURE GetDefaultSearchFilter*() : WebStd.PersistentDataFilter;
BEGIN RETURN NIL
END GetDefaultSearchFilter;
PROCEDURE GetSearchFilter*(text: Strings.String) : WebStd.PersistentDataFilter;
BEGIN RETURN NIL
END GetSearchFilter;
PROCEDURE GetEmptyListMessage*(request: HTTPSupport.HTTPRequest) : XML.Container;
BEGIN
RETURN WebStd.CreateXMLText(WebForumStandardEmptyList);
END GetEmptyListMessage;
PROCEDURE GetBackButtonLabel*(request: HTTPSupport.HTTPRequest) : Strings.String;
BEGIN RETURN WebStd.GetString(WebForumStandardBackLabel)
END GetBackButtonLabel;
PROCEDURE GetInsertLinkLabel*(request: HTTPSupport.HTTPRequest) : Strings.String;
BEGIN RETURN WebStd.GetString(WebForumStandardInsertText)
END GetInsertLinkLabel;
PROCEDURE GetSubmitButtonLabel*(request: HTTPSupport.HTTPRequest): Strings.String;
BEGIN RETURN WebStd.GetString(WebForumStandardSubmitLabel)
END GetSubmitButtonLabel;
PROCEDURE GetUnapplySortLabel*(request: HTTPSupport.HTTPRequest): Strings.String;
BEGIN RETURN WebStd.GetString(WebForumStdUnapplySortLabel)
END GetUnapplySortLabel;
PROCEDURE GetUnapplyFilterLabel*(request: HTTPSupport.HTTPRequest): Strings.String;
BEGIN RETURN WebStd.GetString(WebForumStdUnapplyFilterLabel)
END GetUnapplyFilterLabel;
END WebForum;
PROCEDURE GetTableCell*(str: Strings.String; modus: LONGINT) : TableCell;
VAR cell: TableCell; xmlText: XML.Container;
BEGIN
IF (str # NIL) THEN
xmlText := WebStd.CreateXMLText(str^)
ELSE
xmlText := WebStd.CreateXMLText(" ")
END;
NEW(cell, xmlText, modus);
RETURN cell
END GetTableCell;
PROCEDURE GetEmailTableCell*(str: Strings.String; modus: LONGINT) : TableCell;
VAR cell: TableCell; xmlText: XML.Container;
BEGIN
IF (str # NIL) THEN
NEW(cell, GetMailtoElement(str^), modus)
ELSE
xmlText := WebStd.CreateXMLText(" ");
NEW(cell, xmlText, modus)
END;
RETURN cell
END GetEmailTableCell;
PROCEDURE GetTableCellForText*(text: ARRAY OF CHAR; modus: LONGINT) : TableCell;
VAR cell: TableCell; xmlText: XML.Container;
BEGIN
xmlText := WebStd.CreateXMLText(text);
NEW(cell, xmlText, modus);
RETURN cell
END GetTableCellForText;
PROCEDURE GetHeaderCellForText*(text: ARRAY OF CHAR; compareFunct: WebStd.PersistentDataCompare) : HeaderCell;
VAR cell: HeaderCell; xmlText: XML.Container;
BEGIN
xmlText := WebStd.CreateXMLText(text);
NEW(cell, xmlText, compareFunct);
RETURN cell
END GetHeaderCellForText;
PROCEDURE GetMailtoElement*(mailAdr: ARRAY OF CHAR) : XML.Element;
VAR mailtoStr: Strings.String; a: XML.Element;
BEGIN
IF (mailAdr # "") THEN
NEW(mailtoStr, Strings.Length(mailAdr)+10);
Strings.Concat("mailto:", mailAdr, mailtoStr^);
NEW(a); a.SetName("a");
a.SetAttributeValue("href", mailtoStr^);
WebStd.AppendXMLContent(a, WebStd.CreateXMLText(mailAdr));
RETURN a
ELSE
RETURN NIL
END
END GetMailtoElement;
PROCEDURE AddStandardDetailView*(container: XML.Container; name: ARRAY OF CHAR; str: Strings.String);
VAR pTag: XML.Element;
BEGIN
NEW(pTag); pTag.SetName("p");
WebStd.AppendXMLContent(pTag, WebStd.CreateXMLText(name));
IF (str # NIL) THEN
WebStd.AppendXMLContent(pTag, WebStd.CreateXMLText(str^))
END;
container.AddContent(pTag)
END AddStandardDetailView;
PROCEDURE AddMultipleLinesDetailView*(container: XML.Container; name: ARRAY OF CHAR; str: Strings.String);
VAR pTag: XML.Element;
BEGIN
NEW(pTag); pTag.SetName("p");
WebStd.AppendXMLContent(pTag, WebStd.CreateXMLText(name));
IF (str # NIL) THEN
WebStd.AppendXMLContent(pTag, WebStd.CreateXMLTextWithBR(str^))
END;
container.AddContent(pTag);
END AddMultipleLinesDetailView;
PROCEDURE AddTextFieldInputRow*(table: XML.Container; label, paramName: ARRAY OF CHAR;
str: Strings.String);
VAR tr, td, input: XML.Element; encText: Strings.String;
BEGIN
NEW(tr); tr.SetName("tr"); table.AddContent(tr);
NEW(td); td.SetName("td"); tr.AddContent(td);
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(label));
NEW(td); td.SetName("td"); tr.AddContent(td);
NEW(input); input.SetName("input");
input.SetAttributeValue("type", "text");
input.SetAttributeValue("size", "40");
input.SetAttributeValue("name", paramName);
IF (str # NIL) THEN
encText := WebStd.GetEncXMLAttributeText(str^);
input.SetAttributeValue("value", encText^)
END;
td.AddContent(input)
END AddTextFieldInputRow;
PROCEDURE AddPasswordFieldInputRow*(table: XML.Container; label, paramName: ARRAY OF CHAR);
VAR tr, td, input: XML.Element;
BEGIN
NEW(tr); tr.SetName("tr"); table.AddContent(tr);
NEW(td); td.SetName("td"); tr.AddContent(td);
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(label));
NEW(td); td.SetName("td"); tr.AddContent(td);
NEW(input); input.SetName("input");
input.SetAttributeValue("type", "password");
input.SetAttributeValue("size", "40");
input.SetAttributeValue("name", paramName);
td.AddContent(input)
END AddPasswordFieldInputRow;
PROCEDURE AddTextAreaInputRow*(table: XML.Container; label, paramName: ARRAY OF CHAR;
str: Strings.String);
VAR tr, td, textarea: XML.Element;
BEGIN
NEW(tr); tr.SetName("tr"); table.AddContent(tr);
NEW(td); td.SetName("td"); tr.AddContent(td);
WebStd.AppendXMLContent(td, WebStd.CreateXMLText(label));
NEW(td); td.SetName("td"); tr.AddContent(td);
NEW(textarea); textarea.SetName("textarea");
textarea.SetAttributeValue("rows", "4");
textarea.SetAttributeValue("cols", "40");
textarea.SetAttributeValue("name", paramName);
IF ((str # NIL) & (str^ # "")) THEN
WebStd.AppendXMLContent(textarea, WebStd.CreateXMLText(str^))
ELSE
WebStd.AppendXMLContent(textarea, WebStd.CreateXMLText(" "))
END;
td.AddContent(textarea);
END AddTextAreaInputRow;
END WebComplex.