VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frm_Bulletin 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   4020
   ClientLeft      =   1725
   ClientTop       =   1785
   ClientWidth     =   5745
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   4020
   ScaleWidth      =   5745
   Begin VB.CommandButton spp_save 
      Default         =   -1  'True
      Height          =   612
      Left            =   4260
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   3240
      Width           =   672
   End
   Begin VB.CommandButton ssp_quit 
      Height          =   612
      Left            =   5040
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   3240
      Width           =   672
   End
   Begin VB.CommandButton ssp_Memo 
      Height          =   612
      Left            =   3420
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   3240
      Visible         =   0   'False
      Width           =   672
   End
   Begin VB.CommandButton ssp_File 
      Height          =   612
      Left            =   2580
      Style           =   1  'Graphical
      TabIndex        =   13
      Top             =   3240
      Visible         =   0   'False
      Width           =   672
   End
   Begin VB.CommandButton ssp_Move 
      Height          =   612
      Left            =   1740
      Style           =   1  'Graphical
      TabIndex        =   17
      Top             =   3240
      Visible         =   0   'False
      Width           =   672
   End
   Begin VB.CommandButton SSC_Date 
      Height          =   276
      Left            =   3240
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   120
      Width           =   252
   End
   Begin VB.ComboBox cbo_ExtCode 
      Height          =   288
      Left            =   3360
      Style           =   2  'Dropdown List
      TabIndex        =   14
      Top             =   1500
      Visible         =   0   'False
      Width           =   492
   End
   Begin VB.CheckBox chk_Int 
      Caption         =   "Check1"
      Height          =   252
      Left            =   1920
      TabIndex        =   10
      Top             =   1920
      Width           =   192
   End
   Begin VB.PictureBox pic_TitleLanguage 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      DragIcon        =   "MEMO3.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        =   8
      Top             =   600
      Width           =   384
   End
   Begin VB.Frame frm_TitleLanguage 
      ClipControls    =   0   'False
      ForeColor       =   &H00FFFFFF&
      Height          =   1572
      Left            =   2280
      TabIndex        =   7
      Top             =   960
      Visible         =   0   'False
      Width           =   915
      Begin MSComctlLib.ListView lvw_TitleLanguage 
         Height          =   1395
         Left            =   60
         TabIndex        =   22
         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.TextBox txt_Title 
      Height          =   288
      Left            =   1920
      MaxLength       =   80
      TabIndex        =   1
      Top             =   1080
      Width           =   3732
   End
   Begin VB.TextBox txt_Date 
      ForeColor       =   &H00FF0000&
      Height          =   288
      Left            =   1920
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   120
      Width           =   1212
   End
   Begin VB.ComboBox cbo_Ext 
      Height          =   288
      Left            =   1920
      Style           =   2  'Dropdown List
      TabIndex        =   15
      Top             =   1500
      Width           =   2172
   End
   Begin MSComctlLib.ImageList img_pictList 
      Left            =   5040
      Top             =   60
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   8388736
      _Version        =   393216
   End
   Begin VB.Label lbl_PreviewF 
      Height          =   252
      Left            =   1380
      TabIndex        =   21
      Top             =   2640
      Visible         =   0   'False
      Width           =   1212
   End
   Begin VB.Label lbl_FullF 
      Height          =   252
      Left            =   1380
      TabIndex        =   20
      Top             =   2340
      Width           =   1212
   End
   Begin VB.Label lbl_Full 
      Caption         =   "Full file :"
      Height          =   252
      Left            =   120
      TabIndex        =   19
      Top             =   2340
      Width           =   1212
   End
   Begin VB.Label lbl_Preview 
      Caption         =   "Preview file :"
      Height          =   252
      Left            =   120
      TabIndex        =   18
      Top             =   2640
      Visible         =   0   'False
      Width           =   1212
   End
   Begin VB.Label Lbl_ext 
      Caption         =   "Extension :"
      Height          =   252
      Left            =   120
      TabIndex        =   16
      Top             =   1500
      Width           =   1752
   End
   Begin VB.Label lbl_Int 
      Caption         =   "Internet flag"
      Height          =   252
      Left            =   120
      TabIndex        =   11
      Top             =   1920
      Width           =   1692
   End
   Begin VB.Label lbl_TitleLanguage 
      Caption         =   "Language :"
      Height          =   252
      Left            =   120
      TabIndex        =   9
      Top             =   600
      Width           =   2052
   End
   Begin VB.Label lbl_Title 
      Caption         =   "Title"
      Height          =   252
      Left            =   120
      TabIndex        =   4
      Top             =   1080
      Width           =   1692
   End
   Begin VB.Label lbl_Date 
      Caption         =   "Issued date"
      Height          =   252
      Left            =   120
      TabIndex        =   3
      Top             =   120
      Width           =   1692
   End
End
Attribute VB_Name = "frm_Bulletin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mi_iConc As Integer
Dim ms_Code As String
Dim ms_Title() As String
Dim mb_Loading As Boolean
Dim mb_Change As Boolean
Dim ms_UserPath As String
Dim ms_RealPath As String
' REMOVED 13.4.2005 Task remove FTP
'Private WithEvents mo_FTPComponent As ftpmodule

Private Sub init_bulletin_supp()
txt_Date.Enabled = KO
SSC_Date.Visible = KO
txt_Title.Enabled = KO
chk_Int.Enabled = KO
cbo_Ext.Enabled = KO
End Sub

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

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

Private Sub Init_Lang_For_Title()
Dim i As Integer
'debug.assert (lvw_TitleLanguage.ListItems.Count > 0)
ReDim ms_Title(1, lvw_TitleLanguage.ListItems.Count) As String
i = 0
While i < lvw_TitleLanguage.ListItems.Count
'    ReDim Preserve ms_Title(1, i + 1)
    ms_Title(0, i) = GetTagValue(lvw_TitleLanguage.ListItems(i + 1), 0)
    ms_Title(1, i) = ""
    i = i + 1
Wend
End Sub

Private Function Control() As Boolean
Dim i As Integer

Control = KO
For i = 0 To UBound(ms_Title, 2)
    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
Next i
If txt_Date = "" Then
    txt_Date.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If txt_Title = "" Then
    txt_Title.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If cbo_Ext = "" Then
    cbo_Ext.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
Control = OK

End Function
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 Sub fill_title()
'Dim i As Integer

'i = 0
'While ms_Title(0, i) <> csp_TitleLanguage.ListTabText(csp_TitleLanguage.ListIndex, 1)
'    i = i + 1
'Wend
'ms_Title(1, i) = txt_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_txt_title()
'Dim i As Integer

'i = 0
'While ms_Title(0, i) <> csp_TitleLanguage.ListTabText(csp_TitleLanguage.ListIndex, 1)
'    i = i + 1
'Wend
'txt_Title = ms_Title(1, i)
'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 Function Insert_Media() As Boolean
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_path As String
Dim ll_lngrows As Long
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_bulletin_ins '"
ls_req = ls_req & FormatD(txt_Date, "mm/dd/yyyy") & "','"
ls_req = ls_req & cbo_ExtCode.List(cbo_Ext.ListIndex) & "','" & ls_IntFlag & "'"

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 Insert_Title() As Boolean
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim i As Integer

On Error GoTo suite

Insert_Title = 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
Insert_Title = OK
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 ll_lngrows As Long
Dim ls_Text As String
Dim ls_path As String
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_bulletin_upd '" & QuoteParam(gs_MediaCode) & "','"
ls_req = ls_req & FormatD(txt_Date, "mm/dd/yyyy") & "','"
ls_req = ls_req & cbo_ExtCode.List(cbo_Ext.ListIndex) & "','"
ls_req = ls_req & ls_IntFlag & "'," & 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

Private Function Update_Title()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim i As Integer

On Error GoTo suite

Update_Title = KO

ls_req = "EXEC media_title_del  '" & QuoteParam(gs_MediaCode) & "'" & Chr(13)
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)) & "','" & csp_TitleLanguage.ListTabText(i, 1) & "'" & Chr(13)
        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 = SQLRowCount(ll_Statement, ll_lngrows)
    If ll_lngrows = 0 Then
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        Exit Function
    Else
        Update_Title = OK
    End If
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 Sub Validate_Add()

If Control Then
    If BeginTran(gl_Environment, gl_Database) Then
        If Insert_Media Then
            If Insert_Title Then
                If CommitTran(gl_Environment, gl_Database) Then
                    ssp_Memo.Visible = OK
                    ssp_File.Visible = OK
                    ssp_Move.Visible = OK
                    gut_Param.Str12 = ""
                    mi_iConc = 1
                    ssp_File_Click
                    mb_Change = KO
                    Exit Sub
                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
    Else
        RollbackTran gl_Environment, gl_Database
        SendMessage 4, "Insert failed", gut_LangLogin.Code
    End If
End If
End Sub
' REMOVED 13.4.2005 Task remove FTP
'Private Sub Validate_Del()

'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.out_Media.RemoveItem frm_im_main.out_Media.ListIndex
'                    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
'Else
'    SendMessage 6, "Delete failed", gut_LangLogin.Code
'End If

'End Sub

' 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_bulletin_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 Validate_Upd() As Boolean
Dim li_Index As Integer

Validate_Upd = KO
If Control Then
    If BeginTran(gl_Environment, gl_Database) Then
        If Update_media Then
            If Update_Title Then
                If CommitTran(gl_Environment, gl_Database) Then
                    frm_im_main.Tv_MediaOutline.LocalDelItem gs_MediaCode
                    frm_im_main.Tv_MediaOutline.LocalAddItem gs_MediaCode
                    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_Upd = 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 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 csp_TitleLanguage_Click()
'MouseOff
'pic_TitleLanguage.Picture = LoadResPicture(CInt(csp_TitleLanguage.ListTabText(csp_TitleLanguage.ListIndex, 3)), 1)
'frm_TitleLanguage.Visible = KO
'fill_txt_title
'frm_TitleLanguage.Visible = KO
'MouseOn
'End Sub

'Private Sub csp_TitleLanguage_LostFocus()
'frm_TitleLanguage.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
    frm_TitleLanguage.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)
pic_TitleLanguage.Picture = LoadResPicture(RES_ENGLISH, 1)
SSC_Date.Picture = LoadResPicture(RES_DOWN2, vbResIcon)

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


FillCbo "File_Ext", cbo_ExtCode, cbo_Ext
get_sc_csts

'FillCspLanguage csp_TitleLanguage
FillLvwLanguage lvw_TitleLanguage
'debug.assert (lvw_TitleLanguage.ListItems.Count > 0)
Set lvw_TitleLanguage.SelectedItem = lvw_TitleLanguage.ListItems(0)

'csp_TitleLanguage.ListIndex = 0
Init_Lang_For_Title
gut_Param.Str11 = "0"

If gs_Action = "add" Then
    gut_Param.Str18 = ""
    gut_Param.Str19 = ""
    gut_Param.Str21 = ""
    gut_Param.Str22 = ""
    lbl_PreviewF = ""
    lbl_FullF = ""
Else
    def_bulletin_mtnc
    ssp_Memo.Visible = OK
'    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
End If

If gs_Action = "del" Then
    init_bulletin_supp
End If

If gs_Action = "moreinfo" Then
    init_bulletin_supp
    pic_TitleLanguage.Enabled = OK
    spp_save.Visible = KO
End If
mb_Loading = KO
MouseOn

End Sub
Private Sub def_bulletin_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 i As Integer

On Error GoTo suite

ls_req = "EXEC media_bulletin_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
        txt_Date = ODBCData(ll_Statement, 1)
        cbo_ExtCode = ODBCData(ll_Statement, 2)
        cbo_Ext.ListIndex = cbo_ExtCode.ListIndex
        If ODBCData(ll_Statement, 3) = "X" Then
            chk_Int.value = 1
        End If
        mi_iConc = ODBCData(ll_Statement, 4)
        lbl_FullF = ODBCData(ll_Statement, 5)
        gut_Param.Str21 = lbl_FullF
        lbl_PreviewF = ODBCData(ll_Statement, 6)
        gut_Param.Str22 = lbl_PreviewF
    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)
Exit Sub

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

On Error GoTo suite

ls_req = "EXEC Screen_Csts mtnc_item_memo, '" & gut_LangLogin.Code & "'"

Caption = gs_TableTitle
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 = Left(ODBCData(ll_Statement, 2), 30)
        Select Case ls_Field
        Case "titleA": If gs_Action = "add" Then Caption = Caption & " - " & ls_Text
        Case "titleU": If gs_Action = "upd" Then Caption = Caption & " - " & ls_Text
        Case "titleD": If gs_Action = "del" Then Caption = Caption & " - " & ls_Text
        Case "lbl_date": lbl_date = ls_Text
        Case "lbl_title": lbl_Title = ls_Text
        Case "lbl_lang": lbl_TitleLanguage = ls_Text
        Case "lbl_int": lbl_Int = ls_Text
        Case "lbl_ext": Lbl_ext = ls_Text
        Case "lbl_preview": lbl_Preview = ls_Text
        Case "lbl_full": lbl_Full = 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 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
Select Case gs_Action
Case "add":
    Validate_Add
Case "del":
    Call MsgBox("This function is not accesible since v2.0.94")
' REMOVED 13.4.2005 Task remove FTP
'    Validate_Del
    Unload Me
Case "upd":
    If Validate_Upd 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 SSC_Date_Click()

On Error GoTo suite

MouseOff
gb_Return = KO
gs_Date = txt_Date
Dates.show 1
If gb_Return Then
    txt_Date = gs_Date
End If
MouseOn
Exit Sub

suite:
StdError
MouseOn
End Sub

Private Sub ssp_File_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
gut_Param.Str20 = mi_iConc
gut_Param.Str16 = cbo_Ext
gut_Param.Str17 = cbo_ExtCode.List(cbo_Ext.ListIndex)

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

mi_iConc = gut_Param.Str20
Select Case gs_Action
Case "add"
    If gut_Param.Str15 = OK Then
        frm_im_main.Tv_MediaOutline.LocalDelItem gs_MediaCode
        frm_im_main.Tv_MediaOutline.LocalAddItem gs_MediaCode
        gs_Action = "upd"
        gs_MediaCode = ms_Code
    Else
        gs_MediaCode = ms_Code
' REMOVED 13.4.2005 Task remove FTP
'        Validate_Del
        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
lbl_FullF = gut_Param.Str21
lbl_PreviewF = gut_Param.Str22
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
'If gb_Return Then
'    If BeginTran(gl_Environment, gl_Database) Then
'        If UpdTable Then
'            If MoveFile(mo_FTPComponent, (lbl_PreviewF <> ""), (lbl_FullF <> "")) 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 txt_Title_Change()
MouseOff
fill_title
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

' 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 = lvwList
    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


