VERSION 5.00
Begin VB.Form Trans_mtnc 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Translator"
   ClientHeight    =   3570
   ClientLeft      =   1050
   ClientTop       =   2235
   ClientWidth     =   7905
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   3570
   ScaleWidth      =   7905
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.TextBox txt_Glossary 
      Height          =   1400
      Left            =   5100
      MultiLine       =   -1  'True
      TabIndex        =   4
      Top             =   1860
      Visible         =   0   'False
      Width           =   2112
   End
   Begin VB.Frame frm_Propagation 
      Caption         =   "Screen scope"
      Height          =   612
      Left            =   60
      TabIndex        =   11
      Top             =   2400
      Width           =   3852
      Begin VB.OptionButton opt_One 
         Caption         =   "Only this one"
         Height          =   192
         Left            =   1680
         TabIndex        =   13
         Top             =   300
         Value           =   -1  'True
         Width           =   1392
      End
      Begin VB.OptionButton opt_All 
         Caption         =   "All"
         Height          =   192
         Left            =   120
         TabIndex        =   12
         Top             =   300
         Width           =   1392
      End
   End
   Begin VB.PictureBox pic_Language 
      AutoSize        =   -1  'True
      BorderStyle     =   0  'None
      DragIcon        =   "TRAN_DET.frx":0000
      DrawStyle       =   5  'Transparent
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   384
      Left            =   240
      ScaleHeight     =   390
      ScaleWidth      =   390
      TabIndex        =   10
      Top             =   1440
      Width           =   384
   End
   Begin VB.TextBox txt_prompt 
      Height          =   288
      Left            =   720
      TabIndex        =   2
      Top             =   1500
      Width           =   7100
   End
   Begin VB.TextBox txt_nbmax 
      BackColor       =   &H00C0C0C0&
      ForeColor       =   &H00000000&
      Height          =   285
      Left            =   2340
      Locked          =   -1  'True
      TabIndex        =   5
      TabStop         =   0   'False
      Top             =   2000
      Width           =   555
   End
   Begin VB.PictureBox pic_pic 
      BackColor       =   &H00FFFFFF&
      Height          =   552
      Left            =   0
      ScaleHeight     =   495
      ScaleWidth      =   3915
      TabIndex        =   6
      Top             =   0
      Width           =   3972
      Begin VB.PictureBox pic_UnDo 
         Appearance      =   0  'Flat
         AutoRedraw      =   -1  'True
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DrawStyle       =   5  'Transparent
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   660
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   9
         Top             =   60
         Width           =   384
      End
      Begin VB.PictureBox pic_quit 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "TRAN_DET.frx":030A
         DrawStyle       =   5  'Transparent
         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          =   384
         Left            =   1200
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   8
         Top             =   60
         Width           =   384
      End
      Begin VB.PictureBox pic_Save 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "TRAN_DET.frx":0614
         DrawStyle       =   5  'Transparent
         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          =   384
         Left            =   120
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   7
         Top             =   60
         Width           =   384
      End
   End
   Begin VB.TextBox txt_MultiPrompt 
      Height          =   1300
      Left            =   720
      MultiLine       =   -1  'True
      TabIndex        =   3
      Top             =   1500
      Visible         =   0   'False
      Width           =   7100
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Do not add the "":"" character at the end of your translation. Respect singular/plural used in english."
      ForeColor       =   &H00000000&
      Height          =   432
      Left            =   120
      TabIndex        =   14
      Top             =   3060
      Width           =   3792
   End
   Begin VB.Label lbl_nbmax 
      BackStyle       =   0  'Transparent
      Caption         =   "Max number of characters :"
      ForeColor       =   &H00000000&
      Height          =   252
      Left            =   120
      TabIndex        =   0
      Top             =   2000
      Width           =   2232
   End
   Begin VB.Label lbl_Prompt 
      ForeColor       =   &H00000000&
      Height          =   550
      Left            =   60
      TabIndex        =   1
      Top             =   660
      Width           =   7700
   End
End
Attribute VB_Name = "Trans_mtnc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public ms_NewTextTrans As String

Dim ms_Text As String
Dim ms_TextTrans As String
Dim ms_NbMaxChar As String

Private Sub Form_Load()

    If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me
    
    pic_Save.Picture = LoadResPicture(RES_OK, 1)
    pic_quit.Picture = LoadResPicture(RES_QUIT, 1)
    pic_UnDo.Picture = LoadResPicture(RES_CANCEL, 1)
    pic_Language.Picture = LoadResPicture(gut_LangWork.Icon, 1)
    
    Select Case gut_Param2.Str1
    Case "Glossary"
        ms_Text = GetMemoDesc(gut_Param.Str1, gut_Param.Str2, "E", KO)
        If gut_LangWork.Code <> "E" Then
            ms_TextTrans = GetMemoDesc(gut_Param.Str1, gut_Param.Str2, gut_LangWork.Code, KO)
        Else
            ms_TextTrans = ms_Text
        End If
        ms_NbMaxChar = gut_Param.Str6
    Case "Quot_Comment"
        ms_Text = GetMemoDesc(gut_Param.Str1, "", "E", KO)
        If gut_LangWork.Code <> "E" Then
            ms_TextTrans = GetMemoDesc(gut_Param.Str1, "", gut_LangWork.Code, KO)
        Else
            ms_TextTrans = ms_Text
        End If
        ms_NbMaxChar = gut_Param.Str6
    Case "TopBottomPage"
        ms_Text = GetMemoDesc("", "", "E", KO)
        If gut_LangWork.Code <> "E" Then
            ms_TextTrans = GetMemoDesc("", "", gut_LangWork.Code, KO)
        Else
            ms_TextTrans = ms_Text
        End If
        ms_NbMaxChar = gut_Param.Str6
    Case "NewInternet"
        ms_Text = GetMemoDesc(gut_Param.Str1, "", "E", OK)
        If gut_LangWork.Code <> "E" Then
            ms_TextTrans = GetMemoDesc(gut_Param.Str1, "", gut_LangWork.Code, OK)
        Else
            ms_TextTrans = ms_Text
        End If
        ms_NbMaxChar = gut_Param.Str6
    Case Else
        ms_Text = gut_Param.Str4
        ms_TextTrans = gut_Param.Str5
        ms_NbMaxChar = gut_Param.Str6
    End Select
    
    If gut_Param2.Str1 = "Glossary" Then
        lbl_Prompt.Caption = "Translation for : " + Chr(10) + ms_Text
    Else
        lbl_Prompt.Caption = "Translation for : " + ms_Text
    End If
    
    txt_nbmax = ms_NbMaxChar
    
    Select Case gut_Param2.Str1
    Case "Internet"
        Me.Left = 1000
        Me.Width = 8000
        Me.Height = 3000
        lbl_Prompt.Width = 7700
        lbl_Prompt.Height = 550
        txt_prompt.Width = 7100
        pic_Language.Top = 1440
        txt_prompt.Top = 1500
        lbl_nbmax.Top = 2000
        txt_nbmax.Top = 2000
        frm_Propagation.Visible = KO
        opt_All.Visible = KO
        opt_One.Visible = KO
        Label1.Visible = KO
        txt_prompt.MaxLength = ms_NbMaxChar
        txt_prompt = ms_TextTrans
        txt_Glossary.Visible = KO
    Case "NewInternet"
        Me.Left = 1000
        Me.Width = 8000
        Me.Height = 5200
        lbl_Prompt.Width = 7700
        lbl_Prompt.Height = 1550
        txt_prompt.Visible = KO
        txt_MultiPrompt.Visible = OK
        txt_MultiPrompt.Top = 2200
        txt_MultiPrompt.MaxLength = ms_NbMaxChar
        txt_MultiPrompt.Text = ms_TextTrans
        pic_Language.Top = 2140
        lbl_nbmax.Top = 3700
        txt_nbmax.Top = 3700
        frm_Propagation.Top = 3620
        frm_Propagation.Left = 3980
        Label1.Top = 4320
        Label1.Left = 3980
        frm_Propagation.Visible = OK
        opt_All.Visible = OK
        opt_One.Visible = OK
        Label1.Visible = OK
        txt_Glossary.Visible = KO
    Case "Glossary"
        Me.Left = 1000
        Me.Width = 8000
        Me.Height = 4800
        lbl_Prompt.Width = 7800
        lbl_Prompt.Height = 1400
        txt_prompt.Visible = KO
        txt_Glossary.Visible = OK
        txt_Glossary.Left = 720
        txt_Glossary.Top = 2300
        txt_Glossary.Width = 7000
        pic_Language.Top = 2300
        lbl_nbmax.Top = 3860
        txt_nbmax.Top = 3860
        frm_Propagation.Visible = KO
        opt_All.Visible = KO
        opt_One.Visible = KO
        Label1.Visible = KO
        txt_Glossary.MaxLength = ms_NbMaxChar
        txt_Glossary = ms_TextTrans
    Case "Quot_Comment", "TopBottomPage"
        Me.Left = 1000
        Me.Width = 8000
        Me.Height = 4800
        lbl_Prompt.Width = 7800
        lbl_Prompt.Height = 1400
        txt_prompt.Visible = KO
        txt_Glossary.Visible = OK
        txt_Glossary.Left = 720
        txt_Glossary.Top = 2300
        txt_Glossary.Width = 7000
        pic_Language.Top = 2300
        lbl_nbmax.Top = 3860
        txt_nbmax.Top = 3860
        frm_Propagation.Visible = KO
        opt_All.Visible = KO
        opt_One.Visible = KO
        Label1.Visible = KO
        txt_Glossary = ms_TextTrans
    Case Else
        Me.Left = 2712
        Me.Width = 4056
        Me.Height = 3684
        lbl_Prompt.Width = 3852
        lbl_Prompt.Height = 312
        txt_prompt.Width = 3048
        pic_Language.Top = 1080
        txt_prompt.Top = 1140
        lbl_nbmax.Top = 1560
        txt_nbmax.Top = 1560
        frm_Propagation.Visible = OK
        frm_Propagation.Top = 1980
        opt_All.Visible = OK
        opt_One.Visible = OK
        Label1.Visible = OK
        Label1.Top = 2760
        txt_prompt.MaxLength = ms_NbMaxChar
        txt_prompt = ms_TextTrans
        txt_Glossary.Visible = KO
    End Select
    MouseOn
    
End Sub

Private Function GetMemoDesc(as_Topic As String, as_Item As String, as_Language As String, isUnicode As Boolean) As String
Dim li_Status As Integer
Dim ll_HStmt As Long
Dim ls_req As String
    
    On Error GoTo suite
    
    Select Case gs_TableName
    Case "Quot_Comment"
        ls_req = "EXEC Quot_Comment_sel3 " _
            & gs_TableCode & ", '" _
            & as_Language & "'"
    Case "TopBottomPage"
        ls_req = "EXEC TopBottomPage_sel " _
            & gs_TableCode & ",'" _
            & as_Language & "'"
    Case "NewInternet"
        ls_req = "EXEC Web_Data_Item_sel " _
            & gut_Param.Str8 & "," _
            & gut_Param.Str3 & ",'" _
            & as_Language & "'"
    Case Else
        ls_req = "EXEC TranslatorGlossary_dtl '" _
        & QuoteParam(as_Topic) & "', '" _
        & QuoteParam(as_Item) & "', '" _
        & as_Language & "'"
    End Select
    
    If SQLSubmit(gl_Environment, gl_Database, ll_HStmt, ls_req) Then
        li_Status = SQL_SUCCESS
        Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
            li_Status = SQLFetch(ll_HStmt)
            If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
                GetMemoDesc = ODBCMemoGet(ll_HStmt, 1, isUnicode)
            End If
        Loop
        li_Status = SQLFreeStatement(ll_HStmt, SQL_DROP)
    End If
    
    Exit Function
    
suite:
    li_Status = SQLFreeStatement(ll_HStmt, SQL_DROP)
    StdError
End Function

Private Sub pic_quit_Click()
    
    MouseOff
    Unload Me
    MouseOn
    
End Sub

Private Sub pic_UnDo_Click()
    
    Select Case gut_Param2.Str1
    Case "Glossary"
        txt_Glossary = ms_TextTrans
    Case "NewInternet"
        txt_MultiPrompt = ms_TextTrans
    Case Else
        txt_prompt = ms_TextTrans
    End Select
    
End Sub

Private Sub pic_Save_Click()
Dim li_Status As Integer
Dim ll_Statement As Long
Dim ls_req As String
Dim ls_NewTextTrans As String
    
    MouseOff
    ms_Text = QuoteParam(Trim(ms_Text))
    ms_TextTrans = QuoteParam(Trim(ms_TextTrans))
    Select Case gut_Param2.Str1
    Case "Glossary", "Quot_Comment", "TopBottomPage"
        ls_NewTextTrans = QuoteParam(Trim(txt_Glossary))
    Case "NewInternet"
        ls_NewTextTrans = QuoteParam(Trim(txt_MultiPrompt))
    Case Else
        ls_NewTextTrans = QuoteParam(Trim(txt_prompt))
    End Select
    If ls_NewTextTrans <> ms_TextTrans Then ' Translation has changed
        If gut_LangWork.Code = "E" Then
            If ls_NewTextTrans = "" Then ' English cannot be deleted
                SendMessage 113, "English text cannot be deleted !", gut_LangLogin.Code
                Select Case gut_Param2.Str1
                Case "Glossary"
                    txt_Glossary = ms_TextTrans
                Case "NewInternet"
                    txt_MultiPrompt = ms_TextTrans
                Case Else
                    txt_prompt = ms_TextTrans
                End Select
                MouseOn
                Exit Sub
            Else
                Select Case gut_Param2.Str1
                Case "Internet"
                    ls_req = "EXEC TranslatorInternet_upd '" _
                        & gut_Param.Str1 & "', '" _
                        & gut_Param.Str3 & "', 'E', '" _
                        & ls_NewTextTrans & "', " _
                        & gut_Param.Str6
                Case "NewInternet"
                    If opt_All Then
                        ls_req = "EXEC Web_Data_Level_upd2 " _
                            & gut_Param.Str3 & ", '" _
                            & gut_Param.Str8 & "', '" _
                            & "E" & "', '" _
                            & ls_NewTextTrans & "'"
                    Else
                        ls_req = "EXEC Web_Data_Level_upd " _
                            & gut_Param.Str3 & ", '" _
                            & gut_Param.Str8 & "', '" _
                            & "E" & "', '" _
                            & ls_NewTextTrans & "'"
                    End If
                Case "Glossary"
                    ls_req = "EXEC TranslatorGlossary_upd '" _
                        & gut_Param.Str1 & "', '" _
                        & gut_Param.Str3 & "', 'E', '" _
                        & ls_NewTextTrans & "'"
                Case Else
                    If opt_All Then
                        ls_req = "EXEC Translator_upd2 'E', '" _
                            & ms_Text & "', '" & ms_TextTrans & "', '" _
                            & ls_NewTextTrans & "','" _
                            & gut_Param.Str7 & "'"
                    Else
                        ls_req = "EXEC Translator_upd '" _
                            & gut_Param.Str1 & "', '" _
                            & gut_Param.Str3 & "', 'E', '" _
                            & ls_NewTextTrans & "', " _
                            & gut_Param.Str6 & ",'" _
                            & gut_Param.Str7 & "'"
                    End If
                End Select
            End If
        Else
            If ls_NewTextTrans = "" Then
                Select Case gut_Param2.Str1
                Case "Internet"
                    ls_req = "EXEC TranslatorInternet_del '" _
                        & gut_Param.Str1 & "', '" _
                        & gut_Param.Str3 & "', '" _
                        & gut_LangWork.Code & "'"
                Case "NewInternet"
                    If opt_All Then
                        ls_req = "EXEC Web_Data_Level_upd2 " _
                            & gut_Param.Str3 & ", '" _
                            & gut_Param.Str8 & "', '" _
                            & gut_LangWork.Code & "', '" _
                            & ls_NewTextTrans & "'"
                    Else
                        ls_req = "EXEC Web_Data_Level_upd " _
                            & gut_Param.Str3 & ", '" _
                            & gut_Param.Str8 & "', '" _
                            & gut_LangWork.Code & "', '" _
                            & ls_NewTextTrans & "'"
                    End If
                Case "Glossary"
                    ls_req = "EXEC TranslatorGlossary_del '" _
                        & gut_Param.Str1 & "', '" _
                        & gut_Param.Str3 & "', '" _
                        & gut_LangWork.Code & "'"
                Case Else
                    If opt_All Then
                        ls_req = "EXEC Translator_del2 '" _
                            & gut_LangWork.Code & "', '" _
                            & ms_TextTrans & "' "
                    Else
                        ls_req = "EXEC Translator_del '" _
                            & gut_Param.Str1 & "', '" _
                            & gut_Param.Str3 & "', '" _
                            & gut_LangWork.Code & "'"
                    End If
                End Select
            Else
                Select Case gut_Param2.Str1
                Case "Internet"
                    ls_req = "EXEC TranslatorInternet_upd '" _
                        & gut_Param.Str1 & "', '" _
                        & gut_Param.Str3 & "', '" _
                        & gut_LangWork.Code & "', '" _
                        & ls_NewTextTrans & "', " _
                        & gut_Param.Str6
                Case "NewInternet"
                    If opt_All Then
                        ls_req = "EXEC Web_Data_Level_upd2 " _
                            & gut_Param.Str3 & ", '" _
                            & gut_Param.Str8 & "', '" _
                            & gut_LangWork.Code & "', '" _
                            & ls_NewTextTrans & "'"
                    Else
                        ls_req = "EXEC Web_Data_Level_upd " _
                            & gut_Param.Str3 & ", '" _
                            & gut_Param.Str8 & "', '" _
                            & gut_LangWork.Code & "', '" _
                            & ls_NewTextTrans & "'"
                    End If
                Case "Glossary"
                    ls_req = "EXEC TranslatorGlossary_upd '" _
                        & gut_Param.Str1 & "', '" _
                        & gut_Param.Str3 & "', '" _
                        & gut_LangWork.Code & "', '" _
                        & ls_NewTextTrans & "'"
                Case Else
                    If opt_All Then
                        ls_req = "EXEC Translator_upd2 '" _
                            & gut_LangWork.Code & "', '" _
                            & ms_Text & "', '" & ms_TextTrans & "', '" _
                            & ls_NewTextTrans & "','" _
                            & gut_Param.Str7 & "'"
                    Else
                        ls_req = "EXEC Translator_upd '" _
                            & gut_Param.Str1 & "', '" _
                            & gut_Param.Str3 & "', '" _
                            & gut_LangWork.Code & "', '" _
                            & ls_NewTextTrans & "', " _
                            & gut_Param.Str6 & ",'" _
                            & gut_Param.Str7 & "'"
                    End If
                End Select
            End If
            If gs_TableName = "Quot_Comment" Then
                ls_req = "EXEC Quot_Comment_upd2 " _
                    & gs_TableCode & ",'" & gut_LangWork.Code & "','" _
                    & ls_NewTextTrans & "'," & gs_TableCode2
            ElseIf gs_TableName = "TopBottomPage" Then
                ls_req = "EXEC TopBottomPage_upd2 " _
                    & gs_TableCode & ",'" & gut_LangWork.Code & "','" _
                    & ls_NewTextTrans & "'," & gs_TableCode2
            End If
        End If
        If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
            If gs_TableName = "Quot_Comment" Or gs_TableName = "TopBottomPage" Then RefreshGrid
            gb_Return = OK
        End If
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    End If
    
    If gut_Param2.Str1 = "NewInternet" Then
        ms_NewTextTrans = txt_MultiPrompt
    Else
        ms_NewTextTrans = ls_NewTextTrans
    End If
    
    Unload Me
    MouseOn
    
End Sub

Public Sub RefreshGrid()
Dim ls_Line As String
    
    On Error GoTo suite
    
    Select Case gs_TableName
    Case "Quot_Comment":
        gs_TableCode2 = gs_TableCode2 + 1
        ls_Line = gs_TableCode & Chr(9) & gs_TableCode2 & Chr(9) & gs_TableCode3 & Chr(9) & gs_TableCode4 & Chr(9) & gs_TableCode5
    Case "TopBottomPage":
        gs_TableCode2 = gs_TableCode2 + 1
        ls_Line = gs_TableCode & Chr(9) & gs_TableCode2 & Chr(9) & Left(Trim(txt_Glossary), 255) & Chr(9) & gs_TableCode4 & Chr(9) & gs_TableCode5 & Chr(9) & gs_TableCode6 & Chr(9) & gs_TableCode7 & Chr(9) & gs_TableCode8 & Chr(9) & gs_TableCode9
    End Select
    
    C_main.Grid.RemoveItem C_main.Grid.Row
    C_main.Grid.AddItem ls_Line, C_main.Grid.Row
    gb_Return = KO
    
    Exit Sub
    
suite:
    If Err = 30015 Then
        C_main.FillGrid
    Else
        StdError
    End If
End Sub
