Sub PutNewMail(new As Boolean)
Dim sb As ABMSideBar = page.GetSideBar("SideBar")
Dim cont As ABMContainer = sb.Content.Component("messcont")
cont.Cell(2,1).RemoveAllComponents
Dim SQL As SQL = DBM.GetSQL
If new Then
Dim SQL_mail As String = "Select * FROM mess_in where readit = 0 AND comp_id = "& Main.comp_id&" ORDER BY time_in DESC"
Else
Dim SQL_mail As String = "Select * FROM mess_in where readit >= 0 AND comp_id = "& Main.comp_id&" ORDER BY time_in DESC"
End If
Dim newm As List = DBM.SQLSelect(SQL, SQL_mail,Null)
If newm.size > 0 Then
For i = 0 To newm.size-1
Dim tbl As Map = newm.get(i)
Dim drv As String = GetDriver(tbl.Get("from_user"),True)
Dim veh As String = tbl.Get("map_to")
Dim pk As String = tbl.Get("pk")
Dim dt As String = DateTime.Time(tbl.Get("time_in"))
Dim mess As String = tbl.Get("mess_text")
Dim titl As String = drv&" | "&veh&" | "&dt
Dim card As ABMCard
card.InitializeAsCard(page, "me"&i, titl, mess, ABM.CARD_SMALL,"yeltitle")
card.AddAction("Reply")
card.AddAction("Delete")
card.AddAction("Set As Read")
card.Tag = pk 'the important bit... all actions require the primary key of the record...
cont.Cell(2,1).AddArrayComponent(card,"messarr")
Next
End If
DBM.CloseSQL(SQL)
cont.Refresh
End Sub
Sub messarr_linkclicked (target As String, Action As String)
' (MyMap) {eventparams=target,action, action=Reply, eventname=messarr_linkclicked, target=messcont-messarrme0}
Dim sb As ABMSideBar = page.GetSideBar("SideBar")
Dim cont As ABMContainer = sb.Content.Component("messcont")
Dim cid As String = target.Replace("messcont-","")
Dim card As ABMCard = cont.Component(cid)
Dim tag As String = card.Tag
Select Action
Case "Reply"
' Bring up reply mesaage form..
Case "Delete"
' Delete message record
Case "Set As Read"
' Mark as read and call button label update method
End Select
Log("What id mees arr trget: "&target&" "&Action&" tag: "&tag)
End Sub