VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frm_im_main 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Media Manager"
   ClientHeight    =   6840
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   9480
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   6840
   ScaleWidth      =   9480
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Cmd_Short 
      Caption         =   "Short Code"
      Height          =   375
      Left            =   60
      TabIndex        =   23
      Top             =   6360
      Visible         =   0   'False
      Width           =   3000
   End
   Begin VB.CommandButton cmd_News 
      Caption         =   "Associated country"
      Height          =   375
      Left            =   60
      TabIndex        =   22
      Top             =   5880
      Width           =   3000
   End
   Begin Project1.CTreeView Tv_MediaOutline 
      Height          =   3795
      Left            =   60
      TabIndex        =   20
      Top             =   1800
      Width           =   9195
      _ExtentX        =   10398
      _ExtentY        =   5953
   End
   Begin MSComctlLib.ImageList Il_TreeviewImageList 
      Left            =   900
      Top             =   6120
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   12632256
      _Version        =   393216
   End
   Begin VB.Frame Frame1 
      Caption         =   "Display"
      ClipControls    =   0   'False
      Enabled         =   0   'False
      Height          =   612
      Left            =   4020
      TabIndex        =   5
      Top             =   720
      Visible         =   0   'False
      Width           =   5235
      Begin VB.OptionButton Option3 
         Caption         =   "Internet"
         Height          =   192
         Left            =   3180
         TabIndex        =   8
         Top             =   300
         Width           =   1500
      End
      Begin VB.OptionButton Option2 
         Caption         =   "Internet"
         Height          =   192
         Left            =   1920
         TabIndex        =   7
         Top             =   300
         Width           =   1500
      End
      Begin VB.OptionButton Option1 
         Caption         =   "All"
         Height          =   192
         Left            =   120
         TabIndex        =   6
         Top             =   300
         Value           =   -1  'True
         Width           =   1500
      End
   End
   Begin VB.Frame frm_Display 
      Caption         =   "Display"
      ClipControls    =   0   'False
      Height          =   612
      Left            =   60
      TabIndex        =   3
      Top             =   720
      Width           =   3792
      Begin VB.OptionButton opt_All 
         Caption         =   "All"
         Height          =   192
         Left            =   120
         TabIndex        =   2
         Top             =   300
         Value           =   -1  'True
         Width           =   1500
      End
      Begin VB.OptionButton opt_Internet 
         Caption         =   "Internet"
         Height          =   192
         Left            =   1920
         TabIndex        =   4
         Top             =   300
         Width           =   1500
      End
   End
   Begin VB.CommandButton cmd_Market 
      Caption         =   "Marketing classification"
      Height          =   375
      Left            =   3240
      TabIndex        =   1
      Top             =   6360
      Width           =   3000
   End
   Begin VB.CommandButton cmd_Product 
      Caption         =   "Classification within products range"
      Height          =   375
      Left            =   3240
      TabIndex        =   0
      Top             =   5880
      Width           =   3000
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ClipControls    =   0   'False
      ForeColor       =   &H80000008&
      Height          =   675
      Left            =   0
      ScaleHeight     =   675
      ScaleWidth      =   6135
      TabIndex        =   9
      Top             =   0
      Width           =   6135
      Begin VB.PictureBox pic_FullRefresh 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Height          =   480
         Left            =   3060
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   19
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_Print 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "IM_MAIN.frx":0000
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   5460
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   18
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_refresh 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Height          =   480
         Left            =   2460
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   17
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_upd 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "IM_MAIN.frx":030A
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   660
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   16
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_log 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "IM_MAIN.frx":0614
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   1860
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   15
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_help 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "IM_MAIN.frx":091E
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   4860
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   14
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_delete 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   1260
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   13
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_add 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "IM_MAIN.frx":0C28
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   12
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_Quit 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "IM_MAIN.frx":0F32
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   4260
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   11
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox Pic_Media 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "IM_MAIN.frx":123C
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   3660
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   10
         Top             =   60
         Visible         =   0   'False
         Width           =   480
      End
   End
   Begin MSForms.CommandButton Cmd_LinkedTables 
      Height          =   375
      Left            =   6360
      TabIndex        =   24
      Top             =   5880
      Visible         =   0   'False
      Width           =   3000
      Caption         =   "Links"
      Size            =   "5292;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.ComboBox Cbo_View 
      Height          =   315
      Left            =   60
      TabIndex        =   21
      Top             =   1440
      Width           =   3795
      VariousPropertyBits=   681592859
      DisplayStyle    =   7
      Size            =   "6694;556"
      TextColumn      =   1
      MatchEntry      =   1
      ShowDropButtonWhen=   2
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
   End
End
Attribute VB_Name = "frm_im_main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim mb_optAll As Boolean
Dim mo_ListMediaPathSecurity As New Collection
Public mb_Load As Boolean
Dim ms_Dropped As String



Private Function GetPathAutorization(ByVal ls_MediaPathCode As String) As Integer
'------------------------------------------------------------------
' Name : GetPathAutorization
'
' Purpose : Return the defined User availble Action for a Media Path
'
' Parameters :  li_MediaPathCode : ID of the media path
'
' Return values : return the action
'
' review : Sept/29/1999 by JJB
'------------------------------------------------------------------

On Error GoTo Err_GetPathAutorization
    GetPathAutorization = mo_ListMediaPathSecurity.Item(ls_MediaPathCode)
Exit Function

Err_GetPathAutorization:
'Media Path Code not found we will return 0
    GetPathAutorization = 0
End Function

Private Sub init_Path()
'------------------------------------------------------------------
' Name : init_Path
'
' Purpose : init gs_MediaPath var
'
' Parameters : None
'
' Return values : None
'
' review : Sept/29/1999 by JJB
'------------------------------------------------------------------
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_path() As String
Dim lb_One As Boolean
ReDim gs_MediaPath(4, 0) As String

On Error GoTo suite

ls_req = "EXEC Media_Path_lst '" & gs_TableName & "','" & 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
lb_One = KO
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
        If lb_One Then
            ReDim Preserve gs_MediaPath(4, UBound(gs_MediaPath, 2) + 1)
        End If
        'PT_ID
        gs_MediaPath(0, UBound(gs_MediaPath, 2)) = ODBCData(ll_Statement, 1)
        'Check user autorization for this directory (get Action of this media path)
        gs_MediaPath(1, UBound(gs_MediaPath, 2)) = GetPathAutorization(gs_MediaPath(0, UBound(gs_MediaPath, 2)))
        'PT_userPath
        gs_MediaPath(2, UBound(gs_MediaPath, 2)) = ODBCData(ll_Statement, 2)
        'PT_realPath
        gs_MediaPath(3, UBound(gs_MediaPath, 2)) = ODBCData(ll_Statement, 3)
        lb_One = OK
    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 def_permission()
'------------------------------------------------------------------
' Name : def_permission
'
' Purpose : Get all action avaliable for media paths
'           and save it in module var mo_ListMediaPAthSecurity
'
' Parameters : None
'
' Return values : None
'
' review : Sept/29/1999 by JJB
'------------------------------------------------------------------

Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_req As String
Dim ls_MediaPathCode As String
Dim ls_Action As String
Dim li_Curs As Integer


On Error GoTo suite

For li_Curs = 1 To mo_ListMediaPathSecurity.Count
    mo_ListMediaPathSecurity.Remove 1
Next

ls_req = "EXEC Media_Security_lst '" & gs_TableName & "'"
pic_add.Visible = KO
pic_delete.Visible = KO
pic_upd.Visible = KO
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_MediaPathCode = ODBCData(ll_Statement, 1)
        ls_Action = ODBCData(ll_Statement, 2)
        mo_ListMediaPathSecurity.Add Item:=ls_Action, Key:=ls_MediaPathCode
        If (CInt(ls_Action) And MEDIA_UPDATE) = MEDIA_UPDATE Then
            'The user got the right to at least one directory
            pic_add.Visible = OK
            pic_delete.Visible = OK
            pic_upd.Visible = OK
        End If
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
StdError
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
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
Dim ls_Text As String
   
On Error GoTo suite

ls_req = "EXEC Screen_Csts 'image','" & 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
Caption = gs_TableTitle
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 "opt_prod": cmd_Product.Caption = ls_Text
            Case "opd_market": cmd_Market.Caption = ls_Text
            Case "opt_All": opt_All.Caption = ls_Text
            Case "opt_Internet": opt_Internet.Caption = ls_Text
            Case "frm_Display": frm_Display.Caption = ls_Text
        End Select
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

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

Private Sub Cbo_View_Click()
Dim lPath As String, lReq As String, lArray() As String
Const C_REQ = "Exec Search_media_manager_lst2 '$1$', '$2$', '$3$','$4$', '$5$' "

On Error GoTo Err_CboView

'put a wart ==> avoiding changes in CTreeView component (o_combo property & LocalAddItem sub)
'waiting replacement by Arm_treeView
lArray = SplitString(Tv_MediaOutline.GetPath, "\")
lPath = lArray(1)
lReq = Replace(C_REQ, "$5$", lPath, , , vbTextCompare)
Tv_MediaOutline.s_SearchReq = lReq
    
Tv_MediaOutline.UpdateComboView

Err_CboView:
End Sub


Private Sub Cmd_LinkedTables_Click()
Dim li_Count As Integer
Dim ls_SOSName As String

MouseOff
ls_SOSName = gs_TableName
If gs_MediaCode <> "" Then
    gut_Param.Str1 = "Media Links"
    gut_Param.Str2 = "MDL"
    gut_Param.Str3 = gs_MediaCode
    SubMenu.show 1
Else
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
End If
gs_TableName = ls_SOSName
MouseOn
End Sub

Private Sub cmd_Market_Click()

If gs_MediaCode <> "" Then
    frm_main_mc.show 1
Else
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
    MouseOn
End If

End Sub

Private Sub cmd_News_Click()
Dim li_Count As Integer
Dim ls_SOSName As String

MouseOff
ls_SOSName = gs_TableName
If gs_MediaCode <> "" Then
    gs_TableName = "Media_CountriesLanguage"
    gs_ParamReq1 = "EXEC Media_CountriesLanguage_t_lst '" & gs_MediaCode & "','"
    gs_ParamReq2 = "EXEC Screen_Csts 'news_country', '" & gut_LangLogin.Code & "'"
    gs_ParamReq3 = "EXEC Check_Security 'Media_CountriesLanguage', '" & prg.LoginName & "'"
    gi_TranslateType = 1
    gi_GridWidth(0) = 1500
    gi_GridWidth(1) = 2500
    gi_GridWidth(2) = 1
    gi_GridWidth(3) = 1000
    gi_GridWidth(4) = 1
    For li_Count = 5 To 29
        gi_GridWidth(li_Count) = 1
    Next li_Count
    C_main.show 1
Else
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
End If
gs_TableName = ls_SOSName
MouseOn
End Sub

Private Sub cmd_product_Click()
MouseOff
If gs_MediaCode <> "" Then
    frm_main_cwpr.show 1
Else
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
End If
MouseOn
End Sub

Private Sub Cmd_Short_Click()
Dim ls_TableName As String
Dim li_Count As Integer
MouseOff
If gs_MediaCode <> "" Then
    ls_TableName = gs_TableName
    gs_TableName = "Media_Short_Classif"
    gs_ParamReq1 = "Exec Media_Short_Classif_t_lst '" & gs_MediaCode & "','"
    gs_ParamReq2 = "EXEC Screen_Csts 'main_MShortClas', '" & gut_LangLogin.Code & "'"
    gs_ParamReq3 = "EXEC Check_Security 'Media_Short_Classif', " & prg.LoginName
    gi_TranslateType = 1
    gi_GridWidth(0) = 1
    gi_GridWidth(1) = 1
    gi_GridWidth(2) = 1000
    gi_GridWidth(3) = 2000
    gi_GridWidth(4) = 1
    gi_GridWidth(5) = 1500
    gi_GridWidth(6) = 1000
    gi_GridWidth(7) = 1000
    gi_GridWidth(8) = 1000
    For li_Count = 9 To 29
        gi_GridWidth(li_Count) = 1
    Next li_Count
    C_main.show 1
    gs_TableName = ls_TableName
Else
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
End If
MouseOn
End Sub

Private Sub Form_Load()
Dim lo_TempPicure As Object
Dim li_Count As Integer
On Error GoTo suite
mb_Load = KO
MouseOff

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

pic_add.Picture = LoadResPicture(RES_ADD, 1)
pic_delete.Picture = LoadResPicture(RES_DELETE, 1)
pic_upd.Picture = LoadResPicture(RES_MODIFY, 1)
pic_help.Picture = LoadResPicture(RES_HELP, 1)
pic_log.Picture = LoadResPicture(RES_LOG, 1)
pic_quit.Picture = LoadResPicture(RES_QUIT, 1)
pic_refresh.Picture = LoadResPicture(RES_REFRESH, 1)
pic_print.Picture = LoadResPicture(RES_PRINT, 1)
pic_media.Picture = LoadResPicture(RES_MEDIA, 1)
pic_FullRefresh.Picture = LoadResPicture(RES_LONGREFRESH, 1)


Set lo_TempPicure = LoadResPicture(RES_OUTLINEFOLDER, 0)
Tv_MediaOutline.ListImageAdd "RES" & CStr(RES_OUTLINEFOLDER), lo_TempPicure

Set lo_TempPicure = LoadResPicture(RES_OUTLINELEAF, 0)
Tv_MediaOutline.ListImageAdd "RES" & CStr(RES_OUTLINELEAF), lo_TempPicure

Set lo_TempPicure = LoadResPicture(RES_OUTLINEVOID, 0)
Tv_MediaOutline.ListImageAdd "RES" & CStr(RES_OUTLINEVOID), lo_TempPicure

gut_LangWork = gut_LangLogin
get_sc_csts
mb_optAll = OK

def_permission

init_Path

Select Case gs_TableName
Case "media_manager"
    Set Tv_MediaOutline.o_ViewCombo = Cbo_View
    Tv_MediaOutline.b_FirstLevelInCombo = True
    Tv_MediaOutline.s_DefaultComboView = "ArboCode"
    Tv_MediaOutline.s_SearchReq = "Exec Search_media_manager_lst2 '$1$', '$2$', '$3$','$4$', '$5$' "
    Cbo_View.Visible = OK
    Cbo_View.Enabled = OK
    Cmd_Short.Visible = OK
    Cmd_LinkedTables.Visible = OK
'Case "bulletin_marketing"
'    Tv_MediaOutline.b_FirstLevelInCombo = KO
'    Tv_MediaOutline.s_SearchReq = "Exec Search_bulletin_marketing_lst2 '$1$', '$2$', '$3$','$4$'  "
'    cbo_view.Visible = KO
'    cbo_view.Enabled = KO
'Case "news"
'    Set Tv_MediaOutline.o_ViewCombo = cbo_view
'    Tv_MediaOutline.b_FirstLevelInCombo = OK
'    Tv_MediaOutline.s_DefaultComboView = "ByCountry"
'    Tv_MediaOutline.s_SearchReq = "Exec search_news_lst2 '$1$','$2$','$3$','$4$', '$5$' "
'    cbo_view.Visible = OK
'    cbo_view.Enabled = OK
Case Else
    Cbo_View.Visible = KO
    Cbo_View.Enabled = KO
End Select


Tv_MediaOutline.i_OutlineFilterCount = 1
Tv_MediaOutline.s_FilterValue(1) = ""
Tv_MediaOutline.s_LanguageCode = gut_LangLogin.Code
Tv_MediaOutline.s_ParamSystem = gs_TableName
Tv_MediaOutline.Reinit

Select Case gs_TableName
'    Case "bulletin_marketing"
'        cmd_Market.Visible = KO
'        pic_print.Enabled = KO
'        pic_print.Visible = KO
'        frm_Display.Visible = KO
'        cmd_News.Visible = KO
'    Case "news"
'        pic_log.Visible = KO
'        pic_FullRefresh.Visible = KO
'        cmd_Market.Visible = KO
'        cmd_Product.Visible = KO
'        cmd_News.Visible = OK
    Case Else
        cmd_News.Visible = KO
End Select
MouseOn
mb_Load = OK
Exit Sub

suite:
StdError
MouseOn
End Sub



Private Sub opt_All_Click()
Dim ls_path As String
    Tv_MediaOutline.s_FilterValue(1) = ""
    ls_path = Tv_MediaOutline.GetPath
    Tv_MediaOutline.Reinit
    If ls_path <> "" Then
        Tv_MediaOutline.SetPath (ls_path)
    End If
End Sub

Private Sub opt_Internet_Click()
Dim ls_path As String
    Tv_MediaOutline.s_FilterValue(1) = "X"
    ls_path = Tv_MediaOutline.GetPath
    Tv_MediaOutline.Reinit
    If ls_path <> "" Then
        Tv_MediaOutline.SetPath (ls_path)
    End If
End Sub



Private Sub Option1_Click()
Dim ls_path As String
    Tv_MediaOutline.s_FilterValue(1) = ""
    ls_path = Tv_MediaOutline.GetPath
    Tv_MediaOutline.Reinit
    Tv_MediaOutline.SetPath (ls_path)
End Sub

Private Sub Option2_Click()
Dim ls_path As String
    Tv_MediaOutline.s_FilterValue(1) = "X"
    ls_path = Tv_MediaOutline.GetPath
    Tv_MediaOutline.Reinit
    Tv_MediaOutline.SetPath (ls_path)
End Sub

Private Sub pic_add_Click()
Dim ls_Code As String

gs_Action = "add"
Select Case gs_TableName
Case "media_manager":
    gb_Return = False
    frm_techinfo.show 1
    If gb_Return Then
        ls_Code = gs_MediaCode
        If Tv_MediaOutline.GetPath <> "" Then
            pic_refresh_Click
            Tv_MediaOutline.SearchLeaf gs_MediaCode
        End If
    End If
'Case "bulletin_marketing":
'    frm_Bulletin.show 1
'Case "news":
'    News.show 1
End Select

End Sub

Private Sub pic_delete_Click()
Dim ls_Code As String

gs_Action = "del"
If gs_MediaCode = "" Then
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
    MouseOn
    Exit Sub
End If
If Not CheckCurrentMediaAutorization(gs_MediaCode, MEDIA_UPDATE) Then
    SendMessage 78, "You can't delete this object", gut_LangLogin.Code
    MouseOn
    Exit Sub
End If
Select Case gs_TableName
Case "media_manager"
    gb_Return = False
    frm_techinfo.show 1
    If gb_Return Then
        Tv_MediaOutline.LocalDelItem gs_MediaCode
        gs_MediaCode = ""
    End If
'Case "bulletin_marketing"
'    frm_Bulletin.show 1
'Case "news"
'    News.show 1
End Select

End Sub

Private Sub pic_FullRefresh_Click()
Dim ls_path As String
Dim li_Count As Integer
MouseOff

Tv_MediaOutline.ReFillChildOutline

MouseOn
End Sub

Private Sub pic_help_Click()

MouseOff
frm_help.show 1
MouseOn

End Sub

Private Sub pic_log_Click()

Dim i As Integer

If gs_MediaCode = "" Then
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
    MouseOn
    Exit Sub
End If

On Error GoTo suite
MouseOff

For i = 0 To 29
    gs_GridColumn2(i, 1) = i
Next i

gs_Param2Req1 = "EXEC Screen_Csts 'aud_MedManager', '" & gut_LangLogin.Code & "'"
gs_Param2Req2 = "EXEC Audit_MediaManager_t_lst '" & gs_MediaCode & "','" & gut_LangWork.Code & "'"
gi_GridWidth2(0) = 1500
gi_GridWidth2(1) = 1500
gi_GridWidth2(2) = 1500
gi_GridWidth2(3) = 3000
For i = 4 To 29
    gi_GridWidth2(i) = 1
Next i
gi_GridNbColumns = 4

C_audit.show 1
MouseOn
Exit Sub

suite:
StdError
End Sub

Private Sub pic_media_Click()
Dim ls_Desc As String
Dim la_Array() As String
Dim li_Nb As Integer

On Error GoTo Err_Visu_Click

MouseOff

Media_dsp.ms_Caller = "media"

ls_Desc = Tv_MediaOutline.GetPathDesc

la_Array = SplitString(ls_Desc, "\")
li_Nb = UBound(la_Array)
Media_dsp.ms_Title = la_Array(li_Nb)
Media_dsp.show 1

MouseOn
Exit Sub

Err_Visu_Click:
    If Err.Number = 364 Then Resume Next

    SendMessage 106, "No media associated or impossible to display it.", gut_LangLogin.Code
    MouseOn
End Sub

Private Sub pic_print_Click()
Dim ls_Tab As String
Dim li_Count As Integer
Dim li_Indent As Integer
Dim ls_Text As String

If Printers.Count = 0 Then
    SendMessage 135, "No printer is installed on your computer. Please, contact your system administrator.", gut_LangLogin.Code
    Exit Sub
End If

MouseOff
Printer.Font.Size = 14
Printer.Font.Bold = OK
Printer.Print Me.Caption
Printer.Print ""
Printer.Font.Size = 12
Printer.Font.Bold = KO
Tv_MediaOutline.PrintTree
Printer.EndDoc
MouseOn

End Sub

Private Sub pic_quit_Click()
Unload Me
End Sub


Private Sub pic_refresh_Click()
Dim ls_path As String
Dim li_Count As Integer
MouseOff
    ls_path = Tv_MediaOutline.GetPath
    Tv_MediaOutline.Reinit
    If ls_path <> "" Then
        Tv_MediaOutline.SetPath ls_path
    End If
MouseOn
End Sub

Private Sub pic_upd_Click()

gs_Action = "upd"
If gs_MediaCode = "" Then
    SendMessage 1, "Select record first, please", gut_LangLogin.Code
    MouseOn
    Exit Sub
End If
If Not CheckCurrentMediaAutorization(gs_MediaCode, MEDIA_UPDATE) Then
    SendMessage 77, "You can't update this object", gut_LangLogin.Code
    MouseOn
    Exit Sub
End If

Select Case gs_TableName
Case "media_manager"
    gb_Return = False
    frm_techinfo.show 1
    If gb_Return Then
        pic_refresh_Click
        Tv_MediaOutline.SearchLeaf gs_MediaCode
    End If
'Case "bulletin_marketing"
'    frm_Bulletin.show 1
'Case "news":
'    News.show 1
End Select

End Sub

Private Function CheckCurrentMediaAutorization(ByVal ls_MediaCode As String, ByVal li_Autorization As Integer) As Boolean
'------------------------------------------------------------------
' Name : CheckCurrentMediaAutorization
'
' Purpose : Return if the user have the good autorization (li_Autorization) for the media ls_MediaCode
'
' Parameters :  li_Autorization : authorization to check
'
' Return values : OK if the user got the autorization
'
' review : Mars/9/1999 by JJB
'------------------------------------------------------------------
On Error GoTo Err_CheckCurrentMediaAutorization
Dim ll_Statement As Long
Dim ls_req As String
Dim li_Status As Integer
Dim li_SGBDAutorization As Integer


    ls_req = "EXEC Media_GetAutorization_sel '" & QuoteParam(gs_TableName) & "','" & QuoteParam(ls_MediaCode) & "'"
    CheckCurrentMediaAutorization = KO
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
    
    li_SGBDAutorization = 0
    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
    
            li_SGBDAutorization = ODBCData(ll_Statement, 1)
            
        End If
    Loop
    
    If (li_SGBDAutorization And li_Autorization) = li_Autorization Then
        CheckCurrentMediaAutorization = OK
    End If
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Function

Err_CheckCurrentMediaAutorization:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)


End Function


Private Sub Tv_MediaOutline_DblClick()
    MouseOff
    gs_Action = "moreinfo"
    If gs_MediaCode <> "" Then
        Select Case gs_TableName
        Case "media_manager"
            frm_techinfo.show 1
'        Case "bulletin_marketing"
'            frm_Bulletin.show 1
        End Select
    End If
    MouseOn
End Sub

Private Sub Tv_MediaOutline_EvtLeafClick(ByVal ls_OutLineCode As String, ByVal ls_OutlineDesc As String)
    gs_MediaCode = ls_OutLineCode
    pic_media.Visible = OK
    pic_media.Enabled = OK
End Sub

Private Sub Tv_MediaOutline_EvtNodeClick(ByVal ls_OutLineCode As String, ByVal ls_OutlineDesc As String)
    gs_MediaCode = ""
    pic_media.Visible = KO
    pic_media.Enabled = KO
End Sub

