VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form News 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "News"
   ClientHeight    =   5850
   ClientLeft      =   1545
   ClientTop       =   1110
   ClientWidth     =   9300
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   5850
   ScaleWidth      =   9300
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame frm_Language 
      ClipControls    =   0   'False
      ForeColor       =   &H00FFFFFF&
      Height          =   1572
      Left            =   2280
      TabIndex        =   17
      Top             =   1080
      Visible         =   0   'False
      Width           =   915
      Begin MSComctlLib.ListView lvw_Language 
         Height          =   1395
         Left            =   60
         TabIndex        =   26
         Top             =   120
         Width           =   795
         _ExtentX        =   1402
         _ExtentY        =   2461
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         HideColumnHeaders=   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   0
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Object.Width           =   882
         EndProperty
      End
   End
   Begin VB.Frame frm_TitleLanguage 
      ClipControls    =   0   'False
      ForeColor       =   &H00FFFFFF&
      Height          =   1572
      Left            =   2280
      TabIndex        =   27
      Top             =   2760
      Visible         =   0   'False
      Width           =   915
      Begin MSComctlLib.ListView lvw_TitleLanguage 
         Height          =   1395
         Left            =   60
         TabIndex        =   28
         Top             =   120
         Width           =   795
         _ExtentX        =   1402
         _ExtentY        =   2461
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         HideColumnHeaders=   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   0
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Object.Width           =   882
         EndProperty
      End
   End
   Begin VB.CommandButton ssp_quit 
      Height          =   615
      Left            =   8160
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   4260
      Width           =   675
   End
   Begin VB.CommandButton spp_save 
      Default         =   -1  'True
      Height          =   615
      Left            =   7320
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   4260
      Width           =   675
   End
   Begin VB.CommandButton ssp_Memo 
      Height          =   615
      Left            =   6480
      Style           =   1  'Graphical
      TabIndex        =   18
      Top             =   4260
      Visible         =   0   'False
      Width           =   675
   End
   Begin VB.CommandButton ssp_File 
      Height          =   615
      Left            =   5640
      Style           =   1  'Graphical
      TabIndex        =   20
      Top             =   4260
      Visible         =   0   'False
      Width           =   675
   End
   Begin VB.CommandButton ssp_Move 
      Height          =   615
      Left            =   4800
      Style           =   1  'Graphical
      TabIndex        =   21
      Top             =   4260
      Visible         =   0   'False
      Width           =   675
   End
   Begin VB.CommandButton ssp_Visu 
      Height          =   615
      Left            =   3960
      Style           =   1  'Graphical
      TabIndex        =   22
      Top             =   4260
      Visible         =   0   'False
      Width           =   675
   End
   Begin VB.TextBox txt_Date 
      ForeColor       =   &H00000000&
      Height          =   315
      Left            =   2280
      Locked          =   -1  'True
      TabIndex        =   24
      Top             =   1860
      Width           =   2172
   End
   Begin VB.PictureBox pic_Date 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      FillColor       =   &H00FFFFFF&
      ForeColor       =   &H80000008&
      Height          =   345
      Left            =   4400
      ScaleHeight     =   345
      ScaleWidth      =   375
      TabIndex        =   23
      Top             =   1860
      Visible         =   0   'False
      Width           =   375
   End
   Begin VB.PictureBox pic_TitleLanguage 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      DragIcon        =   "News.frx":0000
      DrawStyle       =   5  'Transparent
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   384
      Left            =   2280
      ScaleHeight     =   390
      ScaleWidth      =   390
      TabIndex        =   5
      Top             =   2340
      Width           =   384
   End
   Begin VB.PictureBox pic_Language 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      DragIcon        =   "News.frx":030A
      DrawStyle       =   5  'Transparent
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   384
      Left            =   2280
      ScaleHeight     =   390
      ScaleWidth      =   390
      TabIndex        =   4
      Top             =   240
      Width           =   384
   End
   Begin VB.CheckBox chk_Int 
      Caption         =   "Check1"
      Height          =   252
      Left            =   2040
      TabIndex        =   6
      Top             =   3780
      Width           =   252
   End
   Begin VB.TextBox txt_Title 
      Height          =   285
      Left            =   2280
      MaxLength       =   80
      TabIndex        =   2
      Top             =   2820
      Width           =   6855
   End
   Begin VB.ComboBox cbo_MedTypeCode 
      Height          =   315
      Left            =   3720
      Style           =   2  'Dropdown List
      TabIndex        =   10
      Top             =   1380
      Visible         =   0   'False
      Width           =   492
   End
   Begin VB.ComboBox cbo_ExtCode 
      Height          =   288
      Left            =   3720
      Style           =   2  'Dropdown List
      TabIndex        =   9
      Top             =   720
      Visible         =   0   'False
      Width           =   492
   End
   Begin VB.ComboBox cbo_MedType 
      Height          =   315
      Left            =   2280
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   1380
      Width           =   2172
   End
   Begin VB.ComboBox cbo_Ext 
      Height          =   315
      Left            =   2280
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   720
      Width           =   2172
   End
   Begin VB.TextBox txt_IntTitle 
      Height          =   288
      Left            =   2280
      MaxLength       =   250
      TabIndex        =   3
      Top             =   3300
      Width           =   6855
   End
   Begin MSComctlLib.ImageList img_pictList 
      Left            =   8580
      Top             =   120
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   8388736
      _Version        =   393216
   End
   Begin VB.Label lbl_date 
      Caption         =   "Published date :"
      Height          =   255
      Left            =   120
      TabIndex        =   25
      Top             =   1860
      Width           =   1755
   End
   Begin VB.Label lbl_IntTitle 
      Caption         =   "Internet title :"
      Height          =   255
      Left            =   120
      TabIndex        =   19
      Top             =   3300
      Width           =   2055
   End
   Begin VB.Label lbl_Int 
      Caption         =   "Internet flag"
      Height          =   255
      Left            =   120
      TabIndex        =   16
      Top             =   3780
      Width           =   1455
   End
   Begin VB.Label lbl_TitleLanguage 
      Caption         =   "Language :"
      Height          =   255
      Left            =   120
      TabIndex        =   15
      Top             =   2340
      Width           =   2055
   End
   Begin VB.Label Lbl_ext 
      Caption         =   "Extension :"
      Height          =   252
      Left            =   120
      TabIndex        =   14
      Top             =   720
      Width           =   2052
   End
   Begin VB.Label lbl_Title 
      Caption         =   "Title :"
      Height          =   255
      Left            =   120
      TabIndex        =   13
      Top             =   2820
      Width           =   2055
   End
   Begin VB.Label Lbl_med_type 
      Caption         =   "News type :"
      Height          =   255
      Left            =   120
      TabIndex        =   12
      Top             =   1380
      Width           =   2175
   End
   Begin VB.Label lbl_Language 
      Caption         =   "Language :"
      Height          =   252
      Left            =   120
      TabIndex        =   11
      Top             =   240
      Width           =   2052
   End
End
Attribute VB_Name = "News"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim ms_Code As String
Dim mi_iConc As Integer
Dim ms_Vo() As String
Dim ms_Title() As String
Dim ms_IntTitle() As String
Dim ms_AdjustTitle As String
Dim mb_Loading As Boolean
Dim mb_Change As Boolean
' REMOVED 13.4.2005 Task remove FTP
'Private WithEvents mo_FTPComponent As ftpmodule

Dim ms_RealPath As String
Dim ms_UserPath As String


Private Sub Pic_Date_Click()
    
On Error GoTo Err_pic_Date
    
MouseOff
gs_Date = txt_Date
MouseOn
Dates.show 1
MouseOff
txt_Date = gs_Date
MouseOn
Exit Sub
    
Err_pic_Date:
    StdError
End Sub
Private Function UpdTable() As Boolean
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long

On Error GoTo suite

UpdTable = KO

ls_req = "EXEC media_upd3 '" & QuoteParam(gs_MediaCode) & "'," _
    & gut_Param.Str14 & "," & gut_Param.Str20

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQLRowCount(ll_Statement, ll_lngrows)
    If ll_lngrows = 0 Then
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 2, "Another user change the record", gut_LangLogin.Code
        Exit Function
    End If
    UpdTable = OK
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Function
End If
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function


Private Function Control() As Boolean
Dim i As Integer
Dim mb_One As Boolean

Control = KO
mb_One = KO
If cbo_Ext = "" Then
    SendMessage 73, "You must fill every field", gut_LangLogin.Code
    cbo_Ext.SetFocus
    MouseOn
    Exit Function
End If
If cbo_MedType = "" Then
    SendMessage 73, "You must fill every field", gut_LangLogin.Code
    cbo_MedType.SetFocus
    MouseOn
    Exit Function
End If
If txt_Date = "" Then
    SendMessage 73, "You must fill every field", gut_LangLogin.Code
    txt_Date.SetFocus
    MouseOn
    Exit Function
End If

'debug.assert (Not lvw_Language.SelectedItem Is Nothing)
For i = 0 To UBound(ms_Title, 2) - 1
    If ms_Title(0, i) = "E" And ms_Title(1, i) = "" Then
        SendMessage 74, "You must fill the English title", gut_LangLogin.Code
        MouseOn
        Exit Function
    End If
'    If ms_Title(0, i) = csp_Language.ListTabText(csp_Language.ListIndex, 1) And ms_Title(1, i) = "" Then
    If ms_Title(0, i) = GetTagValue(lvw_Language.SelectedItem, 0) And ms_Title(1, i) = "" Then
        SendMessage 80, "No document title in the document's Language, you may want to enter one", gut_LangLogin.Code
        mb_One = OK
        MouseOn
    End If
Next i

For i = 0 To UBound(ms_IntTitle, 2) - 1
    If ms_IntTitle(0, i) = "E" And ms_IntTitle(1, i) = "" Then
        SendMessage 74, "You must fill the English title", gut_LangLogin.Code
        MouseOn
        Exit Function
    End If
'    If ms_IntTitle(0, i) = csp_Language.ListTabText(csp_Language.ListIndex, 1) And ms_IntTitle(1, i) = "" And Not mb_One Then
    If ms_IntTitle(0, i) = GetTagValue(lvw_Language.SelectedItem, 0) And ms_IntTitle(1, i) = "" And Not mb_One Then
        SendMessage 80, "No document title in the document's Language, you may want to enter one", gut_LangLogin.Code
        MouseOn
    End If
Next i

Control = OK

End Function


Private Sub get_sc_csts()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Field, ls_Text As String
   
On Error GoTo suite

ls_req = "EXEC Screen_Csts 'news','" & QuoteParam(gut_LangLogin.Code) & "'"

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If

Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        ls_Field = ODBCData(ll_Statement, 1)
        ls_Text = ODBCData(ll_Statement, 2)
        Select Case ls_Field
            Case "title": Caption = ls_Text
            Case "File_Ext": Lbl_ext = ls_Text
            Case "lbl_title": lbl_Title = ls_Text
            Case "lbl_inttitle": lbl_IntTitle = ls_Text
            Case "lbl_mt": Lbl_med_type = ls_Text
            Case "lbl_lang": lbl_Language = ls_Text
            Case "lbl_lang2": lbl_TitleLanguage = ls_Text
            Case "lbl_int": lbl_Int = ls_Text
            Case "advert_msg": ms_AdjustTitle = ls_Text
        End Select
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub
Private Sub GetExtension()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer

On Error GoTo suite

ls_req = "EXEC media_File_Ext_cbo2"

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If

cbo_Ext.Clear
cbo_ExtCode.Clear
Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        cbo_ExtCode.AddItem ODBCData(ll_Statement, 1)
        cbo_Ext.AddItem ODBCData(ll_Statement, 2)
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
cbo_Ext.ListIndex = 0
Exit Sub

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub

Private Sub Init_Lang_For_Title()
Dim i As Integer
ReDim ms_Title(1, 0) As String
ReDim ms_IntTitle(1, 0) As String

'While i < csp_TitleLanguage.ListCount
While i < lvw_TitleLanguage.ListItems.Count
    ReDim Preserve ms_Title(1, i + 1)
'    ms_Title(0, i) = csp_TitleLanguage.ListTabText(i, 1)
    ms_Title(0, i) = GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0)
    ms_Title(1, i) = ""
    ReDim Preserve ms_IntTitle(1, i + 1)
'    ms_IntTitle(0, i) = csp_TitleLanguage.ListTabText(i, 1)
    ms_IntTitle(0, i) = GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0)
    ms_IntTitle(1, i) = ""
    i = i + 1
Wend
End Sub

Private Sub init_media_mtnc()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim i As Integer

On Error GoTo suite

'cbo_Ext.ListIndex = -1
cbo_MedType.ListIndex = -1

'csp_Language.ListIndex = 0
'debug.assert (lvw_Language.ListItems.Count > 0)
lvw_Language.SelectedItem = lvw_Language.ListItems(0)

'csp_TitleLanguage.ListIndex = 0
'debug.assert (lvw_TitleLanguage.ListItems.Count > 0)
lvw_TitleLanguage.SelectedItem = lvw_TitleLanguage.ListItems(0)
txt_Title.Text = ""
txt_IntTitle.Text = ""
Exit Sub

suite:
StdError
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End Sub
Private Function Insert_Media() As Boolean
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_IntFlag As String

On Error GoTo suite

Insert_Media = KO

If chk_Int.value = 1 Then ls_IntFlag = "X"
'ls_Req = "EXEC media_ins2 '" & QuoteParam(csp_Language.ListTabText(csp_Language.ListIndex, 1)) & "','"
ls_req = "EXEC media_ins2 '" & QuoteParam(GetTagValue(lvw_Language.SelectedItem, 0)) & "','" _
& QuoteParam(cbo_MedTypeCode.List(cbo_MedType.ListIndex)) & "','" _
& QuoteParam(cbo_ExtCode.List(cbo_Ext.ListIndex)) & "','" _
& prg.LoginName & "','" & ls_IntFlag & "','" & FormatD(txt_Date, "mm/dd/yyyy") & "'"


If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
    Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            ms_Code = ODBCData(ll_Statement, 1)
        End If
    Loop
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Function
End If
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
If ms_Code <> "" Then
    gs_MediaCode = ms_Code
    Insert_Media = OK
End If
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function

Private Function Update_media() As Boolean
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_IntFlag As String

On Error GoTo suite

Update_media = KO

If chk_Int.value = 1 Then ls_IntFlag = "X"
'ls_Req = "EXEC Media_News_upd '" & QuoteParam(gs_MediaCode) & "','" _
'    & QuoteParam(csp_Language.ListTabText(csp_Language.ListIndex, 1)) & "','" _
'    & QuoteParam(cbo_MedTypeCode.List(cbo_MedType.ListIndex)) & "','" _
'    & QuoteParam(cbo_ExtCode.List(cbo_Ext.ListIndex)) & "','" _
'    & ls_IntFlag & "','" & FormatD(txt_Date, "mm/dd/yyyy") & "'," & mi_iConc
ls_req = "EXEC Media_News_upd '" & QuoteParam(gs_MediaCode) & "','" _
    & QuoteParam(GetTagValue(lvw_Language.SelectedItem, 0)) & "','" _
    & QuoteParam(cbo_MedTypeCode.List(cbo_MedType.ListIndex)) & "','" _
    & QuoteParam(cbo_ExtCode.List(cbo_Ext.ListIndex)) & "','" _
    & ls_IntFlag & "','" & FormatD(txt_Date, "mm/dd/yyyy") & "'," & mi_iConc

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
    Update_media = OK
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Function
End If
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function

' REMOVED 13.4.2005 Task remove FTP
'Private Function Delete_Media() As Boolean
'Dim ls_Req As String
'Dim ll_Statement As Long
'Dim li_Status As Integer
'Dim ll_lngrows As Long

'On Error GoTo suite

'Delete_Media = KO

'ls_Req = "EXEC Media_News_del '" & QuoteParam(gs_MediaCode) & "'," & mi_iConc

'If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_Req) Then
'    li_Status = SQLRowCount(ll_Statement, ll_lngrows)
'    If ll_lngrows = 0 Then
'        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
'        SendMessage 7, "Delete failed : concurrency problem ?", gut_LangLogin.Code
'    Else
'        Delete_Media = OK
'        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
'    End If
'Else
'    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
'    SendMessage 6, "Delete failed", gut_LangLogin.Code
'End If
'Exit Function

'suite:
'li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
'StdError
'End Function

Private Function Insert_MediaTitle() As Boolean
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim i As Integer

On Error GoTo suite

Insert_MediaTitle = KO

ls_req = ""
For i = 0 To UBound(ms_Title, 2) - 1
    If ms_Title(1, i) <> "" Then
'        ls_Req = ls_Req & "EXEC media_title_ins '" & QuoteParam(ms_Code) & "','" & QuoteParam(ms_Title(1, i)) & "','" & csp_TitleLanguage.ListTabText(i, 1) & "'" & Chr(13)
        ls_req = ls_req & "EXEC media_title_ins '" & QuoteParam(ms_Code) & "','" & QuoteParam(ms_Title(1, i)) & "','" & GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0) & "'" & Chr(13)
    End If
Next i
    
If ls_req <> "" Then
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        Exit Function
    End If
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End If

ls_req = ""
For i = 0 To UBound(ms_IntTitle, 2) - 1
    If ms_IntTitle(1, i) <> "" Then
        ls_req = ls_req & "EXEC media_internet_title_ins '" & QuoteParam(ms_Code) & "','" & QuoteParam(ms_IntTitle(1, i)) & "','" & GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0) & "'" & Chr(13)
    End If
Next i
    
If ls_req <> "" Then
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        Exit Function
    End If
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End If

Insert_MediaTitle = OK
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function
Private Function Update_MediaTitle() As Boolean
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim i As Integer

On Error GoTo suite

Update_MediaTitle = KO

ls_req = "EXEC media_title_del '" & QuoteParam(gs_MediaCode) & "'"
For i = 0 To UBound(ms_Title, 2) - 1
    If ms_Title(1, i) <> "" Then
        ls_req = ls_req & "EXEC media_title_ins '" & QuoteParam(gs_MediaCode) & "','" & QuoteParam(ms_Title(1, i)) & "','" & GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0) & "'" & Chr(13)
    End If
Next i
    
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Function
End If
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)

ls_req = "EXEC media_internet_title_del '" & QuoteParam(gs_MediaCode) & "'"
For i = 0 To UBound(ms_IntTitle, 2) - 1
    If ms_IntTitle(1, i) <> "" Then
        ls_req = ls_req & "EXEC media_internet_title_ins '" & QuoteParam(gs_MediaCode) & "','" & QuoteParam(ms_IntTitle(1, i)) & "','" & GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0) & "'" & Chr(13)
    End If
Next i
    
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Function
End If
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)

Update_MediaTitle = OK
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function

Private Sub Cbo_ext_Click()
MouseOff
ssp_File.Visible = KO
ssp_Move.Visible = KO
If Not mb_Loading Then
    mb_Change = OK
End If
MouseOn
End Sub

Private Sub fill_txt_title()
Dim i As Integer

i = 0
While ms_Title(0, i) <> GetTagValue(lvw_TitleLanguage.SelectedItem, 0)
    i = i + 1
Wend
txt_Title = ms_Title(1, i)
End Sub

Private Sub fill_txt_int_title()
Dim i As Integer

i = 0
While ms_IntTitle(0, i) <> GetTagValue(lvw_TitleLanguage.SelectedItem, 0)
    i = i + 1
Wend
txt_IntTitle = ms_IntTitle(1, i)
End Sub

Private Sub GetNewsType()

Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer

On Error GoTo Err_GetNewsType

ls_req = "EXEC Media_NewsType_cbo '" & gut_LangWork.Code & "'"

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If

cbo_MedType.Clear
cbo_MedTypeCode.Clear
Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        cbo_MedTypeCode.AddItem ODBCData(ll_Statement, 1)
        cbo_MedType.AddItem ODBCData(ll_Statement, 2)
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
cbo_MedType.Tag = Loaded
Exit Sub

Err_GetNewsType:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub

'Private Sub csp_Language_Click()

'pic_Language.Picture = LoadResPicture(CInt(csp_Language.ListTabText(csp_Language.ListIndex, 3)), 1)
'frm_Language.Visible = KO

'End Sub
'Private Sub csp_Language_LostFocus()
'frm_TitleLanguage.Visible = KO
'frm_Language.Visible = KO
'End Sub

'Private Sub csp_TitleLanguage_Click()

'MouseOff
'pic_TitleLanguage.Picture = LoadResPicture(CInt(csp_TitleLanguage.ListTabText(csp_TitleLanguage.ListIndex, 3)), 1)
'frm_TitleLanguage.Visible = KO
'fill_txt_title
'fill_txt_int_title
'frm_Language.Visible = KO
'MouseOn

'End Sub
'Private Sub csp_TitleLanguage_LostFocus()
'frm_TitleLanguage.Visible = KO
'End Sub

Private Sub lvw_Language_Click()
pic_Language.Picture = img_pictList.ListImages(lvw_Language.SelectedItem.SmallIcon).Picture
'pic_Language.Picture = LoadResPicture(CInt(csp_Language.ListTabText(csp_Language.ListIndex, 3)), 1)
frm_Language.Visible = KO

End Sub

Private Sub lvw_Language_LostFocus()
    frm_TitleLanguage.Visible = KO
    frm_Language.Visible = KO
End Sub

Private Sub lvw_TitleLanguage_Click()
MouseOff
If Not lvw_TitleLanguage.SelectedItem Is Nothing Then
    pic_TitleLanguage.Picture = img_pictList.ListImages(lvw_TitleLanguage.SelectedItem.SmallIcon).Picture
    frm_TitleLanguage.Visible = KO
    fill_txt_title
    fill_txt_int_title
    frm_Language.Visible = KO
End If
MouseOn
End Sub

Private Sub lvw_TitleLanguage_LostFocus()
    frm_TitleLanguage.Visible = KO
End Sub



Private Sub Form_Load()
Dim ls_UserPath As String
Dim ls_RealPath As String
Dim i As Integer

MouseOff

If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

mb_Loading = OK
gut_LangWork.Code = gut_LangLogin.Code
mb_Change = KO

spp_save.Picture = LoadResPicture(RES_OK, 1)
ssp_quit.Picture = LoadResPicture(RES_QUIT, 1)
ssp_Memo.Picture = LoadResPicture(RES_MEMO, 1)
ssp_File.Picture = LoadResPicture(RES_FILEMANAGER, 1)
ssp_Move.Picture = LoadResPicture(RES_MOVEFILE, 1)
ssp_Visu.Picture = LoadResPicture(RES_MEDIA, 1)
pic_Language.Picture = LoadResPicture(RES_ENGLISH, 1)
pic_TitleLanguage.Picture = LoadResPicture(RES_ENGLISH, 1)
pic_Date.Picture = LoadResPicture(RES_COMBOCOPY, 1)

    ' NEW remove ListView begin
    Call InitImageList(img_pictList)
    Call InitListView(lvw_Language, img_pictList)
    Call InitListView(lvw_TitleLanguage, img_pictList)
    ' NEW remove ListView end

get_sc_csts
GetExtension
GetNewsType
'FillCspLanguage csp_Language
FillLvwLanguage lvw_Language
'csp_Language.ListIndex = 0
Set lvw_Language.SelectedItem = lvw_Language.ListItems(0)
'FillCspLanguage csp_TitleLanguage
FillLvwLanguage lvw_TitleLanguage
'csp_TitleLanguage.ListIndex = 0
Set lvw_TitleLanguage.SelectedItem = lvw_TitleLanguage.ListItems(0)
Init_Lang_For_Title
init_media_mtnc

If gs_Action = "add" Then
    gut_Param.Str18 = ""
    gut_Param.Str19 = ""
    gut_Param.Str21 = ""
    gut_Param.Str22 = ""
    pic_Date.Visible = OK
Else
    def_media_mtnc
    ssp_Memo.Visible = OK
    If gs_TableName = "news" Then ssp_Memo.Visible = KO
'    csp_TitleLanguage_Click
    lvw_TitleLanguage_Click
    GetMediaInfo
    gut_Param.Str18 = ms_RealPath
    gut_Param.Str19 = cbo_Ext
End If

If gs_Action = "upd" Then
    ssp_File.Visible = OK
    ssp_Move.Visible = OK
    ssp_Visu.Visible = OK
    ssp_Visu.Enabled = OK
    pic_Date.Visible = OK
End If

If gs_Action = "del" Then
    init_media_supp
End If

If gs_Action = "moreinfo" Then
    init_media_supp
    pic_TitleLanguage.Enabled = OK
    spp_save.Visible = KO
    ssp_Visu.Visible = OK
    ssp_Visu.Enabled = OK

End If
mb_Loading = KO
MouseOn

End Sub


Private Sub GetMediaInfo()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer

ls_req = "EXEC Media_Path_sel '" & gs_MediaCode & " ', '" & gut_LangLogin.Code & "'"
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If
Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        ms_UserPath = ODBCData(ll_Statement, 1)
        ms_RealPath = ODBCData(ll_Statement, 2)
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub

' REMOVED 13.4.2005 Task remove FTP
'Private Sub Validate_DelNews()

'If BeginTran(gl_Environment, gl_Database) Then
'    If Delete_Media Then
'        If DeleteFile(mo_FTPComponent, gut_Param.Str18, gs_MediaCode, gut_Param.Str19) Then
'            If CommitTran(gl_Environment, gl_Database) Then
'                If gs_Action = "del" Then
'                    frm_im_main.Tv_MediaOutline.LocalDelItem gs_MediaCode
'                End If
'            Else
'                RollbackTran gl_Environment, gl_Database
'                SendMessage 6, "Delete failed", gut_LangLogin.Code
'            End If
'        Else
'            RollbackTran gl_Environment, gl_Database
'            SendMessage 6, "Delete failed", gut_LangLogin.Code
'        End If
'    Else
'        RollbackTran gl_Environment, gl_Database
'        SendMessage 6, "Delete failed", gut_LangLogin.Code
'    End If
'End If

'End Sub
Private Sub init_media_supp()

pic_Language.Enabled = KO
cbo_Ext.Enabled = KO
cbo_MedType.Enabled = KO
pic_TitleLanguage.Enabled = KO
txt_Title.Locked = OK
txt_IntTitle.Locked = OK
chk_Int.Enabled = KO
txt_Date.Locked = OK

End Sub

Private Sub def_media_mtnc()

Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Text As String
Dim ls_Text2 As String
Dim ls_Def As String
Dim ls_Qons As String
Dim ls_Lang As String
Dim i As Integer

On Error GoTo suite

ls_req = "EXEC media_News_dtl '" & QuoteParam(gs_MediaCode) & "'"
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If
Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        ls_Lang = ODBCData(ll_Statement, 1)
        Dim ll_i As Long
        ' 24.5.2005 BUG FIX julo ll_i starts from 1
        ll_i = 1
        While GetTagValue(lvw_Language.ListItems(ll_i), 0) <> ls_Lang
            ll_i = ll_i + 1
        Wend
        Set lvw_Language.SelectedItem = lvw_Language.ListItems(ll_i)
        
        pic_Language.Picture = img_pictList.ListImages(lvw_Language.SelectedItem.SmallIcon).Picture
'        pic_Language.Picture = LoadResPicture(CInt(csp_Language.ListTabText(csp_Language.ListIndex, 3)), 1)
        cbo_ExtCode = ODBCData(ll_Statement, 2)
        cbo_Ext.ListIndex = cbo_ExtCode.ListIndex
        cbo_MedTypeCode = ODBCData(ll_Statement, 3)
        cbo_MedType.ListIndex = cbo_MedTypeCode.ListIndex
        If ODBCData(ll_Statement, 4) = "X" Then
            chk_Int.value = 1
        End If
        mi_iConc = ODBCData(ll_Statement, 5)
        txt_Date = ODBCData(ll_Statement, 9)
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)

ls_req = "EXEC media_title_lst '" & QuoteParam(gs_MediaCode) & "'"
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If

Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        ls_Text = ODBCData(ll_Statement, 1)
        ls_Text2 = ODBCData(ll_Statement, 2)
        i = 0
'        While csp_TitleLanguage.ListTabText(i, 1) <> ls_Text2
        While GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0) <> ls_Text2
            i = i + 1
            If ls_Text2 = "E" Then
                txt_Title = ls_Text
            End If
        Wend
        ms_Title(1, i) = ls_Text
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)

ls_req = "EXEC media_internet_title_lst '" & QuoteParam(gs_MediaCode) & "'"
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If

Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        ls_Text = ODBCData(ll_Statement, 1)
        ls_Text2 = ODBCData(ll_Statement, 2)
        i = 0
        While GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0) <> ls_Text2
            i = i + 1
            If ls_Text2 = "E" Then
                txt_IntTitle = ls_Text
            End If
        Wend
        ms_IntTitle(1, i) = ls_Text
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub

Private Sub pic_Language_Click()
MouseOff
frm_Language.Visible = Not frm_Language.Visible
'csp_Language.SetFocus
lvw_Language.SetFocus
MouseOn
End Sub

Private Sub pic_TitleLanguage_Click()
MouseOff
frm_TitleLanguage.Visible = Not frm_TitleLanguage.Visible
'csp_TitleLanguage.SetFocus
lvw_TitleLanguage.SetFocus
MouseOn
End Sub
Private Sub spp_save_Click()
' Comment added by JJB 7/Dec/1999
Dim i As Integer
Dim j As Integer
Dim lb_FoundNewLine As Boolean
Dim ls_Title As String

MouseOff
gb_Return = OK

Select Case gs_Action
Case "add":
    If Control Then
        Validate_AddNews
    End If
Case "del":
    Call MsgBox("This function is not accesible since v2.0.94")
' REMOVED 13.4.2005 Task remove FTP
'    Validate_DelNews
    Unload Me
Case "upd":
    If Validate_UpdNews Then
        frm_im_main.Tv_MediaOutline.LocalDelItem gs_MediaCode
        frm_im_main.Tv_MediaOutline.LocalAddItem gs_MediaCode
        Unload Me
    End If
End Select

MouseOn

End Sub
Private Sub Validate_AddNews()

If BeginTran(gl_Environment, gl_Database) Then
    If Insert_Media Then
        If Insert_MediaTitle Then
'                ssp_Memo.Visible = OK
            ssp_File.Visible = OK
'                ssp_Move.Visible = OK
            gut_Param.Str12 = ""
            mi_iConc = 1
'                ssp_File_Click
            If gb_Return Then
                mb_Change = KO
                gs_Action = "upd"
                If CommitTran(gl_Environment, gl_Database) Then
                    Exit Sub
                Else
                    RollbackTran gl_Environment, gl_Database
                    SendMessage 4, "Insert failed", gut_LangLogin.Code
                End If
            Else
'                    ssp_Memo.Visible = KO
                ssp_File.Visible = KO
'                    ssp_Move.Visible = KO
                RollbackTran gl_Environment, gl_Database
            End If
        Else
            RollbackTran gl_Environment, gl_Database
            SendMessage 4, "Insert failed", gut_LangLogin.Code
        End If
    Else
        RollbackTran gl_Environment, gl_Database
        SendMessage 4, "Insert failed", gut_LangLogin.Code
    End If
Else
    RollbackTran gl_Environment, gl_Database
    SendMessage 4, "Insert failed", gut_LangLogin.Code
End If

End Sub

Private Function Validate_UpdNews() As Boolean
Dim i As Integer
Dim ls_Title As String

Validate_UpdNews = KO
If Control Then
    If BeginTran(gl_Environment, gl_Database) Then
        If Update_media Then
            If Update_MediaTitle Then
                If CommitTran(gl_Environment, gl_Database) Then
                    mi_iConc = mi_iConc + 1
                    ssp_File.Visible = OK
                    ssp_Move.Visible = OK
                    If mb_Change Then
                        ssp_File_Click
                    End If
                    mb_Change = KO
                    Validate_UpdNews = OK
                    Exit Function
                Else
                    RollbackTran gl_Environment, gl_Database
                    SendMessage 3, "Update failed", gut_LangLogin.Code
                End If
            Else
                RollbackTran gl_Environment, gl_Database
                SendMessage 3, "Update failed", gut_LangLogin.Code
            End If
        Else
            RollbackTran gl_Environment, gl_Database
            SendMessage 3, "Update failed", gut_LangLogin.Code
        End If
    Else
        RollbackTran gl_Environment, gl_Database
        SendMessage 3, "Update failed", gut_LangLogin.Code
    End If
End If

End Function
Private Sub ssp_File_Click()
Dim i As Integer
Dim j As Integer
Dim lb_FoundNewLine As Boolean
Dim ls_Title As String

MouseOff
gut_Param.Str20 = mi_iConc
gut_Param.Str16 = cbo_Ext
gut_Param.Str17 = cbo_ExtCode.List(cbo_Ext.ListIndex)
gut_Param.Str12 = ms_UserPath

Dim lo_techInfoFile As New frm_TechinfoFile
lo_techInfoFile.U_Code = prg.U_Code
Set lo_techInfoFile.ArmDb = aDb
lo_techInfoFile.b_Display = KO

If lo_techInfoFile.Load_A_Com Then

    Call lo_techInfoFile.show(1, Me)
    Call lo_techInfoFile.UnLoad_A_Com
End If
Set lo_techInfoFile = Nothing

MouseOff
If gb_Return Then
    mi_iConc = gut_Param.Str20
    Select Case gs_Action
    Case "add"
        If gut_Param.Str15 = OK Then
            gs_Action = "upd"
            gs_MediaCode = ms_Code
            frm_im_main.Tv_MediaOutline.LocalAddItem gs_MediaCode
        Else
            gs_MediaCode = ms_Code
' REMOVED 13.4.2005 Task remove FTP
'            Validate_DelNews
            Call MsgBox("This function is not accesible since v2.0.94")
            Unload Me
        End If
    Case "upd"
        frm_im_main.Tv_MediaOutline.LocalDelItem gs_MediaCode
        frm_im_main.Tv_MediaOutline.LocalAddItem gs_MediaCode
    End Select
End If
Unload Me
MouseOn
End Sub

Private Sub ssp_Memo_Click()
gut_Param.Str1 = gs_MediaCode
gut_Param.Str2 = ""
gut_Param.Str3 = "Type_Of_Memo"
gut_Param.Str4 = "EXEC media_memo_ins"
gut_Param.Str5 = "EXEC media_memo_lst"
gut_Param.Str6 = "EXEC media_memo_del"
gut_Param.Str7 = "EXEC media_memo_upd"
If gs_Action = "upd" Then
    gut_Param.Str8 = "1"
Else
    gut_Param.Str8 = "0"
End If
Memo_mtnc.show 1
End Sub

' REMOVED 13.4.2005 Task remove FTP
Private Sub ssp_Move_Click()
    Call MsgBox("This function is not accesible since v2.0.94")
    Exit Sub


' Comment added by JJB 7/Dec/1999
'Dim ls_Text As String
'Dim lb_FoundNewLine As Boolean
'Dim i As Integer
'Dim j As Integer

'MouseOff
'gut_Param.Str20 = mi_iConc
'gb_Return = KO
'DirectorySel.show 1
'MouseOff
'If gb_Return Then
'    If BeginTran(gl_Environment, gl_Database) Then
'        If UpdTable Then
'            If MoveFile(mo_FTPComponent, KO, KO) Then
'                If CommitTran(gl_Environment, gl_Database) Then
'                    gut_Param.Str20 = gut_Param.Str20 + 1
'                    mi_iConc = gut_Param.Str20
                    
'                    frm_im_main.Tv_MediaOutline.LocalDelItem gs_MediaCode
'                    frm_im_main.Tv_MediaOutline.LocalAddItem gs_MediaCode
'                Else
'                    RollbackTran gl_Environment, gl_Database
'                    SendMessage 3, "Update failed", gut_LangLogin.Code
'                End If
'            Else
'                RollbackTran gl_Environment, gl_Database
'                SendMessage 3, "Update failed", gut_LangLogin.Code
'            End If
'        Else
'            RollbackTran gl_Environment, gl_Database
'            SendMessage 3, "Update failed", gut_LangLogin.Code
'        End If
'    Else
'        SendMessage 3, "Update failed", gut_LangLogin.Code
'    End If
'End If
'MouseOn
End Sub

Private Sub ssp_quit_Click()
Unload Me
End Sub

Private Sub ssp_Visu_Click()
On Error GoTo Err_Visu_Click
MouseOff
Media_dsp.show 1
MouseOn
Exit Sub
Err_Visu_Click:
SendMessage 106, "No media associated or impossible to display it.", gut_LangLogin.Code
MouseOn
End Sub

Private Sub txt_IntTitle_Change()
fill_IntTitle
End Sub

Private Sub txt_Title_Change()
fill_title
End Sub
Private Sub fill_title()
Dim i As Integer

i = 0
While ms_Title(0, i) <> GetTagValue(lvw_TitleLanguage.SelectedItem, 0)
    i = i + 1
Wend
ms_Title(1, i) = txt_Title
End Sub
Private Sub fill_IntTitle()
Dim i As Integer

i = 0
While ms_IntTitle(0, i) <> GetTagValue(lvw_TitleLanguage.SelectedItem, 0)
    i = i + 1
Wend
ms_IntTitle(1, i) = txt_IntTitle
End Sub

Private Sub txt_Title_LostFocus()
MouseOff
If txt_IntTitle = "" Then
    txt_IntTitle = Left(txt_Title, 30)
Else
    If txt_IntTitle <> Left(txt_Title, 30) And gs_Action <> "del" And Not mb_Loading Then
        If (MsgBox(ms_AdjustTitle, 4)) = 6 Then
            txt_IntTitle = Left(txt_Title, 30)
        End If
    End If
End If
MouseOn
End Sub

' NEW Remove ListView begin
Private Function GetTagValue(ByVal ao_lvw As MSComctlLib.ListItem, ByVal al_Index As Long)
    Dim ls_values() As String
    ls_values = Split(ao_lvw.Tag, SEP)

    GetTagValue = ls_values(al_Index)

End Function

Private Function LoadImage(ByVal ao_imageList As MSComctlLib.ImageList, ByVal al_resIndex As Long, ByVal al_resType As LoadResConstants) As Long
    Dim lo_image As MSComctlLib.ListImage
    Set lo_image = ao_imageList.ListImages.Add(, "_" & al_resIndex, LoadResPicture(al_resIndex, al_resType))
    LoadImage = lo_image.Index
End Function

Private Sub InitListView(ByRef ao_lvw As MSComctlLib.ListView, Optional ByVal ao_imgList As MSComctlLib.ImageList = Nothing)
    ao_lvw.HideSelection = False        ' don't hide selection when lostFocus
    ao_lvw.View = lvwReport
    ao_lvw.LabelEdit = lvwManual       ' disable edit labels
    ao_lvw.Icons = ao_imgList
    ao_lvw.SmallIcons = ao_imgList
End Sub

Private Sub InitImageList(ByRef ao_imgList As MSComctlLib.ImageList)
    ao_imgList.ImageHeight = 32
    ao_imgList.ImageWidth = 32
    ao_imgList.MaskColor = vbMagenta

    ' at least one image must be loaded to correctly initialize imagelist
    Call LoadImage(ao_imgList, RES_OPENFOLDER, vbResBitmap)
End Sub
' NEW Remove ListView end

