File: pwd_ds_cgibase.sru
Size: 6219
Date: Sat, 08 Dec 2007 15:38:31 +0100
$PBExportHeader$pwd_ds_cgibase.sru
$PBExportComments$Base Datastore with modifies for HTML Output
forward
global type pwd_ds_cgibase from n_ds_cgibase
end type
end forward

global type pwd_ds_cgibase from n_ds_cgibase
string #leadinghtml = "<html><head><style>body  { background-color:gainsboro }</style></head><body>"
end type
global pwd_ds_cgibase pwd_ds_cgibase

type variables

end variables

forward prototypes
public function integer of_fillretrieveargs ()
end prototypes

public function integer of_fillretrieveargs ();long ll_i
long ll_count 

ll_count = This.of_getarguments(  )

If ll_count > 0 Then 
   For ll_i = 1 To ll_count
      //log.of_addmessage( 2, "arg"+string(ll_i)+": '" +ls_argname[ll_i]+"' type: '"+ls_argtype[ll_i]+"'")
      // set retrieve arg always a string?!
      Choose Case __s_argtype[ll_i]
         Case "number"  ;  This.of_setargument( ll_i,Long( cgienv.of_getParam( __s_argname[ll_i] )))
         Case "string" ;   This.of_setargument( ll_i,cgienv.of_getParam( __s_argname[ll_i] ))
         Case "date" ;     This.of_setargument( ll_i,Date( cgienv.of_getParam( __s_argname[ll_i] )))
         Case "time" ;     This.of_setargument( ll_i,Time( cgienv.of_getParam( __s_argname[ll_i] )))
         Case "datetime" ; This.of_setargument( ll_i,DateTime( cgienv.of_getParam( __s_argname[ll_i] )))
      End Choose
   Next
End If

Return 1
end function

on pwd_ds_cgibase.create
call super::create
end on

on pwd_ds_cgibase.destroy
call super::destroy
end on

event pbw_setdetailwebproperties;call super::pbw_setdetailwebproperties;/**
  Set Specific properties and some dynamic button creation
*/

// Do specific modifies....
This.Object.DataWindow.HTMLDW='yes'
This.Object.DataWindow.HTMLGen.ObjectName= #detaildataobject

This.Object.DataWindow.HTMLGen.ResourceBase = jsresourcepath
// We just use MSIE 5.X 
string ls_browser
ls_browser = cgienv.of_getenv( 'HTTP_USER_AGENT')
if Len ( ls_browser ) > 0 then 
   This.Modify("DataWindow.HTMLGen.Browser = '" +ls_browser +"'")
else
   This.Modify("DataWindow.HTMLGen.Browser = 'Mozilla/4.0 (compatible; MSIE 5.x;) : Microsoft Internet Explorer 5.0'")
end if

This.Modify('DataWindow.HTMLGen.HTMLVersion = "4.0"')

// The JavaScript Class Files
This.Object.DataWindow.HTMLGen.CommonJSFile  = 'CommonClass.js'
This.Object.DataWindow.HTMLGen.DateJSFile    = 'DateTimeMgmt.js'
This.Object.DataWindow.HTMLGen.NumberJSFile  = 'NumberFormat.js'
This.Object.DataWindow.HTMLGen.StringJSFile  = 'StringFormat.js'

This.Object.DataWindow.HTMLGen.ClientEvents='1'
This.Object.DataWindow.HTMLGen.ClientValidation='1'
This.Object.DataWindow.HTMLGen.ClientComputedFields='1'
This.Object.DataWindow.HTMLGen.ClientFormatting='1'
This.Object.DataWindow.HTMLGen.ClientScriptable='1'
This.Object.DataWindow.HTMLGen.GenerateJavaScript='1'
// PB 10.5...
//This.Object.DataWindow.HTMLGen.GenerateDDDWFrames   ='1'

This.Object.DataWindow.Color=String(RGB(220,220,220))

// Create Buttons (
long ll_dwunits // 0 = PowerBuilder units / 1 = Pixels
ll_dwunits= long (This.Object.DataWindow.Units)

choose case ll_dwunits
   case 0 ; This.Object.DataWindow.Summary.Height = PixelstoUnits(16, YPixelsToUnits!)
   case 1 ; This.Object.DataWindow.Summary.Height = 16
end choose

long ll_buttonrect[5]={4,2,100,25,6} // X,Y, Width, Height , X-Gap
string ls_err
long ll_i
if ll_dwunits = 0 then
   ll_buttonrect[1] = PixelstoUnits(ll_buttonrect[1], XPixelsToUnits!)
   ll_buttonrect[2] = PixelstoUnits(ll_buttonrect[2], YPixelsToUnits!)
   ll_buttonrect[3] = PixelstoUnits(ll_buttonrect[3], XPixelsToUnits!)
   ll_buttonrect[4] = PixelstoUnits(ll_buttonrect[4], YPixelsToUnits!)
   ll_buttonrect[5] = PixelstoUnits(ll_buttonrect[5], XPixelsToUnits!)
end if
ls_err = This.Modify ( &
         "create button(band=summary text='Update' filename='' enabled=yes action='13' border='0' color='33554432' "+&
         "x='"+string(ll_buttonrect[1])+"' y='"+string(ll_buttonrect[2])+"' width='"+string(ll_buttonrect[3])+"' height='"+string(ll_buttonrect[4])+"' vtextalign='0' htextalign='0'  name=b_update visible='1'  font.face='Aria' font.height='-8' font.weight='700'  font.family='2' font.pitch='2' font.charset='0' background.mode='2' background.color='67108864' )")
//If len (ls_err) > 0 then log.of_addmessage( 1,ls_err)

ll_buttonrect[1] += ll_buttonrect[3] + ll_buttonrect[5]

ls_err = This.Modify ("create button(band=summary text='Reload' filename='' enabled=yes action='2'  border='0' color='33554432' x='"+string(ll_buttonrect[1])+"' y='"+string(ll_buttonrect[2])+"' width='"+string(ll_buttonrect[3])+"' height='"+string(ll_buttonrect[4])+"' vtextalign='0' htextalign='0'  name=b_retrieve visible='1'  font.face='Aria' font.height='-8' font.weight='700'  font.family='2' font.pitch='2' font.charset='0' background.mode='2' background.color='67108864' )")

If len (ls_err) > 0 then log.of_addmessage( 1,ls_err)
end event

event pbw_setlistwebproperties;call super::pbw_setlistwebproperties;// Do specific modifies....
This.Object.DataWindow.HTMLDW='yes'
This.Object.DataWindow.HTMLGen.ObjectName= #listdataobject

This.Object.DataWindow.HTMLGen.ResourceBase = jsresourcepath
// We just use MSIE 5.X 
string ls_browser
ls_browser = cgienv.of_getenv( 'HTTP_USER_AGENT')
if Len ( ls_browser ) > 0 then 
   This.Modify("DataWindow.HTMLGen.Browser = '" +ls_browser +"'")
else
   This.Modify("DataWindow.HTMLGen.Browser = 'Mozilla/4.0 (compatible; MSIE 5.x;) : Microsoft Internet Explorer 5.0'")
end if

This.Modify('DataWindow.HTMLGen.HTMLVersion = "4.0"')
// The JavaScript Class Files
This.Object.DataWindow.HTMLGen.CommonJSFile  = 'CommonClass.js'
This.Object.DataWindow.HTMLGen.DateJSFile    = 'DateTimeMgmt.js'
This.Object.DataWindow.HTMLGen.NumberJSFile  = 'NumberFormat.js'
This.Object.DataWindow.HTMLGen.StringJSFile  = 'StringFormat.js'

This.Object.DataWindow.HTMLGen.ClientEvents='1'
This.Object.DataWindow.HTMLGen.ClientValidation='1'
This.Object.DataWindow.HTMLGen.ClientComputedFields='1'
This.Object.DataWindow.HTMLGen.ClientFormatting='1'
This.Object.DataWindow.HTMLGen.ClientScriptable='1'
This.Object.DataWindow.HTMLGen.GenerateJavaScript='1'
//This.Object.DataWindow.HTMLGen.GenerateDDDWFrames   ='1'

end event