// Use WebSelectionList.nui use IndexScanner.nui // cIndexScanner class use RGB.nui // Some color functions use WebAppXhtmlBuilder.nui // Global procedures for writing XHTML use WebGlobalFunctions.nui // WafGetHtmlFormValue and WafGetQueryString functions class WebReportColumnLayout is a cArray procedure construct_object forward send construct_object property string psTableClass public "ReportTable" property string psTableStyle public "border: solid gray 1px; border-top: none" property string psTableHeaderStyle public "color:darkblue; background-color:silver; font-family:arial; font-size:13px; padding-left:3px; padding-right:3px" property string psTableDataStyle public "font-family:arial; font-size:12px; padding-left:3px; padding-right:3px" property string psTableWidth public "" property string psHeaderClass public "Header" property string psDataClass public "Data" property string psBorder public "0" property string psCellSpacing public "2" property string psCellPadding public "2" property integer piLinkType public 0 // 0:Link 1:Submit RowId 2:Submit link value property string psSubmitLinkStyle public "border: 0px inset;background-color: transparent;color: blue;text-decoration: underline;cursor: pointer;padding:0px;margin:0px;text-align:left;white-space:normal;" property string priv.SubmitIdPrefix public "" // Set automatically when called from a WebSelectionList object property integer pbScrollable public FALSE property string psHeight public "100px" property string psWidth public "300px" end_procedure item_property_list item_property integer pbDeactivate.i //> If<>0: Do not write column item_property string psLabel.i item_property string psWidth.i item_property integer piAlign.i //> Should be set to 0:"Left", 1:"Right", 2:"Center" item_property string psValue.i item_property string psLink.i item_property string psCellColor.i item_property integer piSpanColumns.i end_item_property_list WebReportColumnLayout function iColumnCount returns integer integer liMax liRow liRval move 0 to liRval get row_count to liMax decrement liMax for liRow from 0 to liMax ifnot (pbDeactivate.i(self,liRow)) increment liRval loop function_return liRval end_function //> Adds a column to the layout. The lsName parameter wil be used //> as column header, lsWidth (if not blank) will be used to set //> the column width, and liAlign will determine the justification //> of that column (0=left,1=center,2=right) procedure AddColumn string lsName string lsWidth integer liAlign integer liRow get row_count to liRow set psLabel.i liRow to lsName set psWidth.i liRow to lsWidth set piAlign.i liRow to liAlign end_procedure procedure set ColumnValue integer liRow string lsValue string lsLink set psValue.i liRow to (rtrim(lsValue)) // Might be a DB field set psLink.i liRow to lsLink end_procedure procedure WriteTitleRow string lsTitle integer liSpan if (lsTitle<>"") begin get iColumnCount to liSpan // Get number of active columns send XHTML_Add_Open_Element "tr" send XHTML_Add_Open_Element "td" send XHTML_Add_Attribute "colspan" liSpan send XHTML_Add_Closed_Element "h2" lsTitle send XHTML_Close_Element // td send XHTML_Close_Element // tr end end_procedure procedure WriteTableBegin string lsTitle string lsSubmitIdPrefix string lsClass lsWidth lsStyle string lsBorder lsCellSpacing lsCellPadding lsBorderThick if (piLinkType(self)>=1) begin // If submit style write a hidden input for storing selected record get priv.SubmitIdPrefix to lsSubmitIdPrefix send XHTML_Add_Closed_Element "input" "" // Add an input for detecting name of form send XHTML_Add_Attribute "type" "hidden" send XHTML_Add_Attribute "name" (lsSubmitIdPrefix+"selectedrowid") send XHTML_Add_Attribute "value" "" end send XHTML_Add_Open_Element "table" get psBorder to lsBorder get psCellSpacing to lsCellSpacing get psCellPadding to lsCellPadding get psTableWidth to lsWidth get psTableClass to lsClass get psTableStyle to lsStyle if (lsBorder<>"") send XHTML_Add_Attribute "border" lsBorder if (lsCellSpacing<>"") send XHTML_Add_Attribute "cellspacing" lsCellSpacing if (lsCellPadding<>"") send XHTML_Add_Attribute "cellpadding" lsCellPadding if (lsWidth<>"") send XHTML_Add_Attribute "width" lsWidth if (lsClass<>"") send XHTML_Add_Attribute "class" lsClass if (lsStyle<>"") send XHTML_Add_Attribute "style" lsStyle send WriteTitleRow lsTitle end_procedure procedure WriteTableEnd if (pbScrollable(self)) begin send XHTML_Close_Element // table send XHTML_Close_Element // div send XHTML_Close_Element // td send XHTML_Close_Element // tr // Create a table cell that will span all column send XHTML_Close_Element // table end else send XHTML_Close_Element // table end_procedure procedure OutputHeaderRowHelp integer lbDoHeader integer liRow liMax liAlign string lsClass lsValue lsWidth lsAlign lsColor lsStyle get psHeaderClass to lsClass get psTableHeaderStyle to lsStyle get row_count to liMax decrement liMax for liRow from 0 to liMax ifnot (pbDeactivate.i(self,liRow)) begin send XHTML_Add_Closed_Element "colgroup" "" send XHTML_Add_Attribute "span" "1" get psWidth.i liRow to lsWidth if (lsWidth<>"") begin send CSS_Reset_Properties "" set CSS_Property_Value CSSPS_DIMEN_WIDTH to lsWidth send XHTML_Add_Attribute "style" (CSS_InLineStyle()) end end loop if lbDoHeader begin send XHTML_Add_Open_Element "tr" for liRow from 0 to liMax ifnot (pbDeactivate.i(self,liRow)) begin get piAlign.i liRow to liAlign get psLabel.i liRow to lsValue get psCellColor.i liRow to lsColor if (liAlign=0) move "left" to lsAlign if (liAlign=1) move "center" to lsAlign if (liAlign=2) move "right" to lsAlign send XHTML_Add_Closed_Element "th" lsValue if (lsClass<>"") send XHTML_Add_Attribute "class" lsClass if (lsStyle<>"") send XHTML_Add_Attribute "style" lsStyle if (lsAlign<>"") send XHTML_Add_Attribute "align" lsAlign if (lsColor<>"") send XHTML_Add_Attribute "bgcolor" lsColor end loop send XHTML_Close_Element // tr end end_procedure procedure OutputHeaderRow integer liPush liSpan lbOverflowXY string lsPush if (pbScrollable(self)) begin send OutputHeaderRowHelp TRUE // Write column titles send XHTML_Add_Open_Element "tr" // Create a table cell that will span all column send XHTML_Add_Open_Element "td" get iColumnCount to liSpan // Get number of active columns send XHTML_Add_Attribute "colspan" liSpan send XHTML_Add_Open_Element "div" send CSS_Reset_Properties "" set CSS_Property_Value CSSPS_DIMEN_HEIGHT to (psHeight(self)) set CSS_Property_Value CSSPS_DIMEN_WIDTH to (psWidth(self)) get value of oWebBrowserInfo item WBI_OVERFLOW_XY to lbOverflowXY if lbOverflowXY begin // Browser can handle overflow in X and Y deimensions independantly set CSS_Property_Value CSSPS_POS_OVERFLOW_Y to "scroll" set CSS_Property_Value CSSPS_POS_OVERFLOW_X to "visible" end else begin set CSS_Property_Value CSSPS_POS_OVERFLOW to "scroll" end send XHTML_Add_Attribute "style" (CSS_InLineStyle()) get piLinkType to liPush set piLinkType to 0 // Setting this temporarily to 0 makes WriteTableBegin not write a second (hidden) input get psTableStyle to lsPush set psTableStyle to "border:none" send WriteTableBegin "" // The blank parameter ensures that WriteTableBegin doen't write a second title bar get psTableStyle to lsPush set piLinkType to liPush send OutputHeaderRowHelp FALSE // No column titles end else send OutputHeaderRowHelp TRUE end_procedure procedure OnWriteRecord end_procedure procedure OutputDataRow string lsRowId // (recnum for now) integer liRow liMax liSpan liAlign liLinkType string lsClass lsValue lsLink lsAlign lsAttributes lsColor string lsSubmitLinkStyle lsSubmitIdPrefix lsSubmitValueInput string lsStyle get psDataClass to lsClass send XHTML_Add_Open_Element "tr" move 0 to liSpan get piLinkType to liLinkType if (liLinkType>=1) begin get psSubmitLinkStyle to lsSubmitLinkStyle get priv.SubmitIdPrefix to lsSubmitIdPrefix move (lsSubmitIdPrefix+"selectedrowid") to lsSubmitValueInput end get psTableDataStyle to lsStyle get row_count to liMax decrement liMax for liRow from 0 to liMax ifnot (pbDeactivate.i(self,liRow)) begin if (liSpan>0) decrement liSpan else begin get psValue.i liRow to lsValue get psLink.i liRow to lsLink get piAlign.i liRow to liAlign get piSpanColumns.i liRow to liSpan get psCellColor.i liRow to lsColor if (lsValue="") move "" to lsLink // If there's no value => there's no link if (liAlign=0) move "left" to lsAlign if (liAlign=1) move "center" to lsAlign if (liAlign=2) move "right" to lsAlign send XHTML_Add_Open_Element "td" if (lsClass<>"") send XHTML_Add_Attribute "class" lsClass if (lsStyle<>"") send XHTML_Add_Attribute "style" lsStyle if (lsAlign<>"") send XHTML_Add_Attribute "align" lsAlign if (lsColor<>"") send XHTML_Add_Attribute "bgcolor" lsColor if (liSpan>1) begin send XHTML_Add_Attribute "colspan" liSpan decrement liSpan end if (liLinkType=1) begin // Submit row id // Create a button and let the CSS style (lsSubmitLinkStyle) make it look like a normal link send XHTML_Add_Closed_Element "button" lsValue send XHTML_Add_Attribute "type" "submit" if (lsSubmitLinkStyle<>"") send XHTML_Add_Attribute "style" lsSubmitLinkStyle send XHTML_Add_Attribute "onclick" ("waf_set_form_input_value(this,'"+lsSubmitValueInput+"','"+lsRowId+"')") // send XHTML_Add_Attribute "name" (lsSubmitIdPrefix+"listselect") end else if (liLinkType=2) begin // Submit link value if (lsLink<>"") begin send XHTML_Add_Closed_Element "button" lsValue send XHTML_Add_Attribute "type" "submit" if (lsSubmitLinkStyle<>"") send XHTML_Add_Attribute "style" lsSubmitLinkStyle send XHTML_Add_Attribute "onclick" ("waf_set_form_input_value(this,'"+lsSubmitValueInput+"','"+lsLink+"')") end else begin send XHTML_Add_Closed_Element "span" lsValue end end else begin // Link style if (lsLink<>"") begin if (lowercase(left(lsLink,4))="ext:") move (replace("ext:",lsLink,"http://")) to lsLink send XHTML_Add_Open_Element "a" send XHTML_Add_Attribute "href" lsLink end send XHTML_Add_Closed_Element "span" lsValue if (lsLink<>"") send XHTML_Close_Element // a end send XHTML_Close_Element // td end set psValue.i liRow to "" set psLink.i liRow to "" set psCellColor.i liRow to "" set piSpanColumns.i liRow to 0 end loop send XHTML_Close_Element // tr end_procedure procedure OutputEmptyRow // May be used to write empty rows (to maintain a constant list height) integer liRow liMax liAlign string lsClass lsAlign lsColor get psHeaderClass to lsClass send XHTML_Add_Open_Element "tr" get row_count to liMax decrement liMax for liRow from 0 to liMax ifnot (pbDeactivate.i(self,liRow)) begin get piAlign.i liRow to liAlign get psCellColor.i liRow to lsColor if (liAlign=0) move "left" to lsAlign if (liAlign=1) move "center" to lsAlign if (liAlign=2) move "right" to lsAlign send XHTML_Add_Closed_Element "th" "ÿ" if (lsClass<>"") send XHTML_Add_Attribute "class" lsClass if (lsAlign<>"") send XHTML_Add_Attribute "align" lsAlign if (lsColor<>"") send XHTML_Add_Attribute "bgcolor" lsColor end loop send XHTML_Close_Element // tr end_procedure //send AddColumn "Kunde" "" "Left" //send AddColumn "Projekt" "" "Left" //send AddColumn "Underprojekt" "" "Left" end_class // WebReportColumnLayout class WebSelectionList is a cIndexScanner procedure construct_object forward send construct_object property integer phReportColumnLayout property integer piFirstRecord property integer piLastRecord property string psTitle public "" //> Property psSellistId identifies the object uniquely within a WebForm. It is used to decode //> form actions regarding this list (like: previous next first last). It is also used to name //> hidden forms with first and last record of the list. //> //> The default value is "sl" and should be set to something short. property string psSubmitIdPrefix public "sl" end_procedure function bSelect returns integer function_return 1 end_function procedure OnPageHeader integer lhColumnLayout get phReportColumnLayout to lhColumnLayout if lhColumnLayout begin send WriteTableBegin of lhColumnLayout (psTitle(self)) send OutputHeaderRow of lhColumnLayout end end_procedure procedure OnSelected // OBS. Records in related files are not found at the time of calling this. integer lhColumnLayout get phReportColumnLayout to lhColumnLayout if lhColumnLayout send OnWriteRecord of lhColumnLayout end_procedure procedure OnFiller // May be used to write empty rows (to maintain a constant list height) integer lhColumnLayout get phReportColumnLayout to lhColumnLayout if lhColumnLayout send OutputEmptyRow of lhColumnLayout end_procedure procedure OnPreviousNextButtons integer liFirstRecnum integer liLastRecnum set piFirstRecord to liFirstRecnum set piLastRecord to liLastRecnum end_procedure procedure OnPageFooter integer lhColumnLayout get phReportColumnLayout to lhColumnLayout if lhColumnLayout send WriteTableEnd of lhColumnLayout end_procedure procedure DoWriteHtml integer liRecord integer liFindDirection integer lhTmpServer integer lhPushServer lhColumnLayout if lhTmpServer begin get phServer to lhPushServer set phServer to lhTmpServer end get phReportColumnLayout to lhColumnLayout if lhColumnLayout set priv.SubmitIdPrefix of lhColumnLayout to (psSubmitIdPrefix(self)) send OnPageHeader send DoScan liRecord liFindDirection send OnPageFooter send OnPreviousNextButtons (piFirstRecnum(self)) (piLastRecnum(self)) if lhColumnLayout set priv.SubmitIdPrefix of lhColumnLayout to "" if lhTmpServer begin set phServer to lhPushServer end end_procedure function iSelectedRecord returns integer string lsSubmitName lsValue move (psSubmitIdPrefix(self)+"selectedrowid") to lsSubmitName get WafGetHtmlFormValue lsSubmitName to lsValue function_return (integer(lsValue)) end_function end_class // WebSelectionList